Merge branch 'material_add-no-kwargs' into 'development'

kwargs flexibility not needed

See merge request damask/DAMASK!694
This commit is contained in:
Sharan Roongta 2023-01-09 11:27:14 +00:00
commit 214ee7b2f8
1 changed files with 26 additions and 6 deletions

View File

@ -415,23 +415,39 @@ class ConfigMaterial(Config):
return dup
def material_add(self,
**kwargs: Any) -> 'ConfigMaterial':
def material_add(self,*,
homogenization: Any = None,
phase: Any = None,
v: Any = None,
O: Any = None,
V_e: Any = None) -> 'ConfigMaterial':
"""
Add material entries.
Parameters
----------
**kwargs
Key-value pairs.
First index of array-like values runs over materials,
whereas second index runs over constituents.
homogenization: (array-like) of str, optional
Homogenization label.
phase: (array-like) of str, optional
Phase label (per constituent).
v: (array-like) of float, optional
Constituent volume fraction (per constituent).
O: (array-like) of damask.Rotation or np.array/list of shape(4), optional
Orientation as unit quaternion (per constituent).
V_e: (array-like) of np.array/list of shape(3,3), optional
Left elastic stretch (per constituent).
Returns
-------
updated : damask.ConfigMaterial
Updated material configuration.
Notes
-----
First index of array-like values that are defined per
consituent runs over materials, whereas second index runs
over constituents.
Examples
--------
Create two grains of ferrite and one grain of martensite, each with random orientation:
@ -509,6 +525,10 @@ class ConfigMaterial(Config):
phase: {Austenite: null, Ferrite: null}
"""
kwargs = {}
for keyword,value in zip(['homogenization','phase','v','O','V_e'],[homogenization,phase,v,O,V_e]):
if value is not None: kwargs[keyword] = value
_constituent_properties = ['phase','O','v','V_e']
_dim = {'O':(4,),'V_e':(3,3,)}
_ex = dict((k, -len(v)) for k, v in _dim.items())