added grid spacing and origin to hdf5 saveField method

This commit is contained in:
Tiago Pestana 2020-09-16 21:38:38 +02:00
parent a0643f951b
commit abd7b0c4f5
1 changed files with 7 additions and 0 deletions

View File

@ -417,6 +417,11 @@ class ibmppp:
ioflag = 'a'
else:
ioflag = 'w'
# get information about origin and grid spacing
delta = [self.__dx[key], self.__dx[key], self.__dx[key]]
origin = [self.grid[key][0][ib-1]-nghx*dx, \
self.grid[key][1][jb-1]-nghy*dx, \
self.grid[key][2][kb-1]-nghz*dx]
# Open the file and write data, then close it because we are done
fid = h5py.File(file_chunk,ioflag)
if not append:
@ -427,6 +432,8 @@ class ibmppp:
fid.create_dataset('nxproc',data=self.__nxp)
fid.create_dataset('nyproc',data=self.__nyp)
fid.create_dataset('nzproc',data=self.__nzp)
fid.create_dataset('origin',data=origin)
fid.create_dataset('delta',data=delta)
gid = fid.create_group('/'+key)
gid.create_dataset('ib',data=self.__localChunkBounds[key][0])
gid.create_dataset('ie',data=self.__localChunkBounds[key][1])