add tracer to vtk files

This commit is contained in:
Martin Diehl 2021-04-25 22:52:13 +02:00
parent 68a839ed97
commit 62c987badf
10 changed files with 18 additions and 11 deletions

View File

@ -98,7 +98,7 @@ class Result:
self.version_major = f.attrs['DADF5_version_major']
self.version_minor = f.attrs['DADF5_version_minor']
if self.version_major != 0 or not 12 <= self.version_minor <= 12:
if self.version_major != 0 or not 12 <= self.version_minor <= 13:
raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}')
self.structured = 'cells' in f['geometry'].attrs.keys()
@ -1407,6 +1407,7 @@ class Result:
v = self.geometry0
elif mode.lower()=='point':
v = VTK.from_poly_data(self.coordinates0_point)
v.set_comments(util.execution_stamp('Result','save_VTK'))
N_digits = int(np.floor(np.log10(max(1,int(self.increments[-1][10:])))))+1
@ -1419,6 +1420,10 @@ class Result:
at_cell_ph,in_data_ph,at_cell_ho,in_data_ho = self._mappings()
with h5py.File(self.fname,'r') as f:
if self.version_minor >= 13:
creator = f.attrs['creator'] if h5py3 else f.attrs['creator'].decode()
created = f.attrs['created'] if h5py3 else f.attrs['created'].decode()
v.add_comments(f'{creator} ({created})')
for inc in util.show_progress(self.visible['increments']):

View File

@ -1 +1 @@
3b83384def67552ab7dd211efc0d54fd
0f68c932b85aac1d30e03e05a16c4605

View File

@ -1 +1 @@
c32c86ed50dbb39a93ca2a2ebe47d9cb
b206ef9e7a096586c7d71d58fc7278bd

View File

@ -1 +1 @@
ead4f6fcaff174fddc041d701e54ac60
11bd422f0a6c78ee1d3c939b1fccf1ee

View File

@ -1 +1 @@
bde8b728110c2c05a6a4740f7c5f9c06
541f423cfde8e2a98582491f7af3add5

View File

@ -1 +1 @@
e09bfa9248283fc390003ad28d15d36e
82e309984cab644fd94f433d5ec24133

View File

@ -1 +1 @@
3f21254164f96de8ee4a28249ae72cc6
f1f85bcdba23e3e4001512c1c6c4707a

View File

@ -333,7 +333,7 @@ class TestResult:
@pytest.mark.parametrize('output',['F','*',['P']],ids=range(3))
@pytest.mark.parametrize('fname',['12grains6x7x8_tensionY.hdf5'],ids=range(1))
@pytest.mark.parametrize('inc',[4,0],ids=range(2))
def test_vtk(self,request,tmp_path,ref_path,update,output,fname,inc):
def test_vtk(self,request,tmp_path,ref_path,update,patch_execution_stamp,patch_datetime_now,output,fname,inc):
result = Result(ref_path/fname).view('increments',inc)
os.chdir(tmp_path)
result.save_VTK(output)

View File

@ -57,7 +57,7 @@ subroutine results_init(restart)
logical, intent(in) :: restart
character(len=pStringLen) :: commandLine
character(len=pPathLen) :: commandLine
print'(/,a)', ' <<<+- results init -+>>>'; flush(IO_STDOUT)
@ -67,8 +67,10 @@ subroutine results_init(restart)
if(.not. restart) then
resultsFile = HDF5_openFile(getSolverJobName()//'.hdf5','w')
call results_addAttribute('DADF5_version_major',0)
call results_addAttribute('DADF5_version_minor',12)
call results_addAttribute('DAMASK_version',DAMASKVERSION)
call results_addAttribute('DADF5_version_minor',13)
call get_command_argument(0,commandLine)
call results_addAttribute('creator',trim(commandLine)//' '//DAMASKVERSION)
call results_addAttribute('created',now())
call get_command(commandLine)
call results_addAttribute('call',trim(commandLine))
call results_closeGroup(results_addGroup('cell_to'))