consistent names:
default file operations: save/load, non-default save_xx/load_xx
This commit is contained in:
parent
24febcd15b
commit
7bdd44a3d9
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit 7c543a98e89840f1f1540c7af8c62a19084dab6e
|
Subproject commit bb30118067c33a2b8ba3e0f1cee52ca4a0b786d8
|
|
@ -142,4 +142,4 @@ geom = damask.Geom(microstructure.reshape(grid),
|
||||||
homogenization=options.homogenization,comments=header)
|
homogenization=options.homogenization,comments=header)
|
||||||
damask.util.croak(geom)
|
damask.util.croak(geom)
|
||||||
|
|
||||||
geom.save_ASCII(sys.stdout if name is None else name,pack=False)
|
geom.save_ASCII(sys.stdout if name is None else name,compress=False)
|
||||||
|
|
|
@ -348,7 +348,7 @@ class Geom:
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load_vtr(fname):
|
def load(fname):
|
||||||
"""
|
"""
|
||||||
Read a VTK rectilinear grid.
|
Read a VTK rectilinear grid.
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ class Geom:
|
||||||
f.write(f'{reps} of {former}\n')
|
f.write(f'{reps} of {former}\n')
|
||||||
|
|
||||||
|
|
||||||
def save_vtr(self,fname,compress=True):
|
def save(self,fname,compress=True):
|
||||||
"""
|
"""
|
||||||
Generates vtk rectilinear grid.
|
Generates vtk rectilinear grid.
|
||||||
|
|
||||||
|
|
|
@ -1100,7 +1100,7 @@ class Result:
|
||||||
pool.join()
|
pool.join()
|
||||||
|
|
||||||
|
|
||||||
def write_XDMF(self):
|
def save_XDMF(self):
|
||||||
"""
|
"""
|
||||||
Write XDMF file to directly visualize data in DADF5 file.
|
Write XDMF file to directly visualize data in DADF5 file.
|
||||||
|
|
||||||
|
|
|
@ -75,12 +75,12 @@ class TestGeom:
|
||||||
assert geom_equal(default,new)
|
assert geom_equal(default,new)
|
||||||
|
|
||||||
def test_read_write_vtr(self,default,tmpdir):
|
def test_read_write_vtr(self,default,tmpdir):
|
||||||
default.save_vtr(tmpdir/'default')
|
default.save(tmpdir/'default')
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
time.sleep(.2)
|
time.sleep(.2)
|
||||||
if os.path.exists(tmpdir/'default.vtr'): break
|
if os.path.exists(tmpdir/'default.vtr'): break
|
||||||
|
|
||||||
new = Geom.load_vtr(tmpdir/'default.vtr')
|
new = Geom.load(tmpdir/'default.vtr')
|
||||||
assert geom_equal(new,default)
|
assert geom_equal(new,default)
|
||||||
|
|
||||||
def test_invalid_geom(self,tmpdir):
|
def test_invalid_geom(self,tmpdir):
|
||||||
|
@ -97,7 +97,7 @@ class TestGeom:
|
||||||
time.sleep(.2)
|
time.sleep(.2)
|
||||||
if os.path.exists(tmpdir/'no_materialpoint.vtr'): break
|
if os.path.exists(tmpdir/'no_materialpoint.vtr'): break
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
Geom.load_vtr(tmpdir/'no_materialpoint.vtr')
|
Geom.load(tmpdir/'no_materialpoint.vtr')
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('compress',[True,False])
|
@pytest.mark.parametrize('compress',[True,False])
|
||||||
|
@ -188,11 +188,11 @@ class TestGeom:
|
||||||
current = default.clean(stencil,selection,periodic)
|
current = default.clean(stencil,selection,periodic)
|
||||||
reference = reference_dir/f'clean_{stencil}_{"+".join(map(str,[None] if selection is None else selection))}_{periodic}'
|
reference = reference_dir/f'clean_{stencil}_{"+".join(map(str,[None] if selection is None else selection))}_{periodic}'
|
||||||
if update and stencil > 1:
|
if update and stencil > 1:
|
||||||
current.save_vtr(reference)
|
current.save(reference)
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
time.sleep(.2)
|
time.sleep(.2)
|
||||||
if os.path.exists(reference.with_suffix('.vtr')): break
|
if os.path.exists(reference.with_suffix('.vtr')): break
|
||||||
assert geom_equal(Geom.load_vtr(reference) if stencil > 1 else default,
|
assert geom_equal(Geom.load(reference) if stencil > 1 else default,
|
||||||
current
|
current
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -343,4 +343,4 @@ class TestResult:
|
||||||
|
|
||||||
def test_XDMF(self,tmp_path,single_phase):
|
def test_XDMF(self,tmp_path,single_phase):
|
||||||
os.chdir(tmp_path)
|
os.chdir(tmp_path)
|
||||||
single_phase.write_XDMF()
|
single_phase.save_XDMF()
|
||||||
|
|
Loading…
Reference in New Issue