test handling of Marc results

This commit is contained in:
Martin Diehl 2021-04-26 00:22:37 +02:00
parent 62c987badf
commit de79d2d897
3 changed files with 14 additions and 1 deletions

View File

@ -505,7 +505,7 @@ class Result:
return grid_filters.coordinates0_point(self.cells,self.size,self.origin).reshape(-1,3,order='F') return grid_filters.coordinates0_point(self.cells,self.size,self.origin).reshape(-1,3,order='F')
else: else:
with h5py.File(self.fname,'r') as f: with h5py.File(self.fname,'r') as f:
return f['geometry/x_c'][()] return f['geometry/x_p'][()]
@property @property
def coordinates0_node(self): def coordinates0_node(self):

Binary file not shown.

View File

@ -354,6 +354,19 @@ class TestResult:
with open((ref_path/'save_VTK'/request.node.name).with_suffix('.md5')) as f: with open((ref_path/'save_VTK'/request.node.name).with_suffix('.md5')) as f:
assert cur == f.read() assert cur == f.read()
@pytest.mark.parametrize('mode',['point','cell'])
@pytest.mark.parametrize('output',[False,True])
def test_vtk_marc(self,tmp_path,ref_path,mode,output):
os.chdir(tmp_path)
result = Result(ref_path/'check_compile_job1.hdf5')
result.save_VTK(output,mode)
def test_marc_coordinates(self,ref_path):
result = Result(ref_path/'check_compile_job1.hdf5').view('increments',-1)
c_n = result.coordinates0_node + result.get('u_n')
c_p = result.coordinates0_point + result.get('u_p')
assert len(c_n) > len(c_p)
@pytest.mark.parametrize('mode',['point','cell']) @pytest.mark.parametrize('mode',['point','cell'])
def test_vtk_mode(self,tmp_path,single_phase,mode): def test_vtk_mode(self,tmp_path,single_phase,mode):
os.chdir(tmp_path) os.chdir(tmp_path)