Merge branch 'load_neper_fix' into 'development'

don't change Neper material ID definition

See merge request damask/DAMASK!759
This commit is contained in:
Sharan Roongta 2023-06-01 17:07:06 +00:00
commit 51210a05e0
2 changed files with 8 additions and 3 deletions

View File

@ -317,6 +317,11 @@ class Grid:
loaded : damask.Grid
Grid-based geometry from file.
Notes
-----
Material indices in Neper usually start at 1 unless
a buffer material with index 0 is added.
Examples
--------
Read a periodic polycrystal generated with Neper.
@ -325,7 +330,7 @@ class Grid:
>>> N_grains = 20
>>> cells = (32,32,32)
>>> damask.util.run(f'neper -T -n {N_grains} -tesrsize {cells[0]}:{cells[1]}:{cells[2]} -periodicity all -format vtk')
>>> damask.Grid.load_Neper(f'n{N_grains}-id1.vtk')
>>> damask.Grid.load_Neper(f'n{N_grains}-id1.vtk').renumber()
cells: 32 × 32 × 32
size: 1.0 × 1.0 × 1.0
origin: 0.0 0.0 0.0 m
@ -336,7 +341,7 @@ class Grid:
cells = np.array(v.vtk_data.GetDimensions())-1
bbox = np.array(v.vtk_data.GetBounds()).reshape(3,2).T
return Grid(material = v.get('MaterialId').reshape(cells,order='F').astype('int32',casting='unsafe') - 1,
return Grid(material = v.get('MaterialId').reshape(cells,order='F').astype('int32',casting='unsafe'),
size = bbox[1] - bbox[0],
origin = bbox[0],
comments = util.execution_stamp('Grid','load_Neper'),

View File

@ -501,7 +501,7 @@ class TestGrid:
assert current == reference
def test_load_Neper_reference(self,res_path,update):
current = Grid.load_Neper(res_path/'n10-id1_scaled.vtk')
current = Grid.load_Neper(res_path/'n10-id1_scaled.vtk').renumber()
reference = Grid.load(res_path/'n10-id1_scaled.vti')
if update:
current.save(res_path/'n10-id1_scaled.vti')