consistent names:

default file operations: save/load, non-default save_xx/load_xx
This commit is contained in:
Martin Diehl 2020-09-20 22:04:28 +02:00
parent 24febcd15b
commit 7bdd44a3d9
6 changed files with 11 additions and 11 deletions

@ -1 +1 @@
Subproject commit 7c543a98e89840f1f1540c7af8c62a19084dab6e
Subproject commit bb30118067c33a2b8ba3e0f1cee52ca4a0b786d8

View File

@ -142,4 +142,4 @@ geom = damask.Geom(microstructure.reshape(grid),
homogenization=options.homogenization,comments=header)
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)

View File

@ -348,7 +348,7 @@ class Geom:
@staticmethod
def load_vtr(fname):
def load(fname):
"""
Read a VTK rectilinear grid.
@ -516,7 +516,7 @@ class Geom:
f.write(f'{reps} of {former}\n')
def save_vtr(self,fname,compress=True):
def save(self,fname,compress=True):
"""
Generates vtk rectilinear grid.

View File

@ -1100,7 +1100,7 @@ class Result:
pool.join()
def write_XDMF(self):
def save_XDMF(self):
"""
Write XDMF file to directly visualize data in DADF5 file.

View File

@ -75,12 +75,12 @@ class TestGeom:
assert geom_equal(default,new)
def test_read_write_vtr(self,default,tmpdir):
default.save_vtr(tmpdir/'default')
default.save(tmpdir/'default')
for _ in range(10):
time.sleep(.2)
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)
def test_invalid_geom(self,tmpdir):
@ -97,7 +97,7 @@ class TestGeom:
time.sleep(.2)
if os.path.exists(tmpdir/'no_materialpoint.vtr'): break
with pytest.raises(ValueError):
Geom.load_vtr(tmpdir/'no_materialpoint.vtr')
Geom.load(tmpdir/'no_materialpoint.vtr')
@pytest.mark.parametrize('compress',[True,False])
@ -188,11 +188,11 @@ class TestGeom:
current = default.clean(stencil,selection,periodic)
reference = reference_dir/f'clean_{stencil}_{"+".join(map(str,[None] if selection is None else selection))}_{periodic}'
if update and stencil > 1:
current.save_vtr(reference)
current.save(reference)
for _ in range(10):
time.sleep(.2)
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
)

View File

@ -343,4 +343,4 @@ class TestResult:
def test_XDMF(self,tmp_path,single_phase):
os.chdir(tmp_path)
single_phase.write_XDMF()
single_phase.save_XDMF()