Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
Damask: Change Config to YAML and Grid to GeomGrid
Browse files Browse the repository at this point in the history
The corresponding commits in the DAMASK repository:
* damask-multiphysics/DAMASK@7bfb081 
* damask-multiphysics/DAMASK@4c5f980
  • Loading branch information
jan-janssen authored Mar 15, 2024
1 parent b443b4a commit 0903d32
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pyiron_continuum/damask/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'DAMASK functionality requires the `damask` module (and its dependencies) specified as extra'
'requirements. Please install it and try again.'
) as damask_alarm:
from damask import Grid, Config, ConfigMaterial, seeds
from damask import GeomGrid, YAML, ConfigMaterial, seeds
import numpy as np

__author__ = "Muhammad Hassani"
Expand Down Expand Up @@ -49,22 +49,22 @@ def write(file_path):

class GridFactory:
def __init__(self):
"""A factory for damask._grid.Grid class."""
"""A factory for damask._geomgrid.Grid class."""
self._origin = None

@staticmethod
def read(file_path):
return Grid.load(fname=file_path)
return GeomGrid.load(fname=file_path)

@property
def origin(self):
"""
Returns damask._grid.Grid, it can be used to call damask original methods.
Returns damask._geomgrid.GeomGrid, it can be used to call damask original methods.
For example:
origin.from_Voronoi_tessellation(...)
"""
if self._origin is None:
return Grid(material=np.ones((1, 1, 1)), size=[1., 1., 1.])
return GeomGrid(material=np.ones((1, 1, 1)), size=[1., 1., 1.])
else:
return self._origin

Expand All @@ -79,12 +79,12 @@ def via_voronoi_tessellation(grid_dim, num_grains, box_size):
if isinstance(box_size, int) or isinstance(box_size, float):
box_size = np.array([box_size, box_size, box_size])
seed = seeds.from_random(box_size, num_grains)
return Grid.from_Voronoi_tessellation(grid_dim, box_size, seed)
return GeomGrid.from_Voronoi_tessellation(grid_dim, box_size, seed)


class DamaskLoading(dict):
def __init__(self, solver, load_steps):
"""A factory for damask Loading class, which is a damask._config.Config object."""
"""A factory for damask Loading class, which is a damask._yaml.YAML object."""
super(DamaskLoading, self).__init__(self)

def __new__(cls, solver, load_steps):
Expand All @@ -102,7 +102,7 @@ def __new__(cls, solver, load_steps):
discretization=load_steps['discretization'],
additional_parameters_dict=load_steps["additional"])
]
return Config(solver=loading_dict["solver"], loadstep=loading_dict["loadstep"])
return YAML(solver=loading_dict["solver"], loadstep=loading_dict["loadstep"])


class LoadStep(dict):
Expand Down

0 comments on commit 0903d32

Please sign in to comment.