#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
#
# _____ _ _ _ _____ _____
# | ____|__| | ___| |_ _____(_)___ ___| ___| ____|
# | _| / _` |/ _ \ \ \ /\ / / _ \ / __/ __| |_ | _|
# | |__| (_| | __/ |\ V V / __/ \__ \__ \ _| | |___
# |_____\__,_|\___|_| \_/\_/ \___|_|___/___/_| |_____|
#
#
# Unit of Strength of Materials and Structural Analysis
# University of Innsbruck,
# 2017 - today
#
# Daniel Reitmair daniel.reitmair@uibk.ac.at
# Matthias Neuner matthias.neuner@uibk.ac.at
#
# This file is part of EdelweissFE.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# The full text of the license can be found in the file LICENSE.md at
# the top level directory of EdelweissFE.
# ---------------------------------------------------------------------
from edelweissfe.utils.misc import strCaseCmp
[docs]def getMaterialClass(materialName: str, provider: str = None) -> type:
"""Get the the requested material class.
Parameters
----------
materialName
The name of the requested material.
provider
The name of the material provider.
Returns
-------
type
The material provider class type.
"""
if provider is None:
provider = "MarmotMaterial"
if strCaseCmp(provider, "marmotmaterial"):
return None
if strCaseCmp(provider, "edelweissmaterial"):
if strCaseCmp(materialName, "linearelastic"):
from edelweissfe.materials.linearelastic.linearelastic import (
LinearElasticMaterial,
)
material = LinearElasticMaterial
elif strCaseCmp(materialName, "vonmises"):
from edelweissfe.materials.vonmises.vonmises import VonMisesMaterial
material = VonMisesMaterial
else:
raise Exception("This material type doesn't exist (yet). Chosen material was: " + materialName)
return material