Merge branch 'rename-hdf5-output' into development

This commit is contained in:
Sharan Roongta 2020-08-26 12:34:56 +02:00
commit 68c2908ba8
2 changed files with 20 additions and 9 deletions

View File

@ -49,7 +49,7 @@ class Result:
self.version_major = f.attrs['DADF5-major'] self.version_major = f.attrs['DADF5-major']
self.version_minor = f.attrs['DADF5-minor'] self.version_minor = f.attrs['DADF5-minor']
if self.version_major != 0 or not 2 <= self.version_minor <= 6: if self.version_major != 0 or not 2 <= self.version_minor <= 7:
raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}') raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}')
self.structured = 'grid' in f['geometry'].attrs.keys() self.structured = 'grid' in f['geometry'].attrs.keys()

View File

@ -73,7 +73,7 @@ subroutine results_init(restart)
if(.not. restart) then if(.not. restart) then
resultsFile = HDF5_openFile(trim(getSolverJobName())//'.hdf5','w',.true.) resultsFile = HDF5_openFile(trim(getSolverJobName())//'.hdf5','w',.true.)
call results_addAttribute('DADF5_version_major',0) call results_addAttribute('DADF5_version_major',0)
call results_addAttribute('DADF5_version_minor',6) call results_addAttribute('DADF5_version_minor',7)
call results_addAttribute('DAMASK_version',DAMASKVERSION) call results_addAttribute('DAMASK_version',DAMASKVERSION)
call get_command(commandLine) call get_command(commandLine)
call results_addAttribute('call',trim(commandLine)) call results_addAttribute('call',trim(commandLine))
@ -118,8 +118,14 @@ subroutine results_addIncrement(inc,time)
call results_closeGroup(results_addGroup(trim('inc'//trim(adjustl(incChar))))) call results_closeGroup(results_addGroup(trim('inc'//trim(adjustl(incChar)))))
call results_setLink(trim('inc'//trim(adjustl(incChar))),'current') call results_setLink(trim('inc'//trim(adjustl(incChar))),'current')
call results_addAttribute('time/s',time,trim('inc'//trim(adjustl(incChar)))) call results_addAttribute('time/s',time,trim('inc'//trim(adjustl(incChar))))
call results_closeGroup(results_addGroup('current/constituent')) call results_closeGroup(results_addGroup('current/phase'))
call results_closeGroup(results_addGroup('current/materialpoint')) call results_closeGroup(results_addGroup('current/homogenization'))
! for backward compatibility
call results_setLink(trim('/inc'//trim(adjustl(incChar)))//'/phase',&
trim('/inc'//trim(adjustl(incChar)))//'/constituent')
call results_setLink(trim('/inc'//trim(adjustl(incChar)))//'/homogenization',&
trim('/inc'//trim(adjustl(incChar)))//'/materialpoint')
end subroutine results_addIncrement end subroutine results_addIncrement
@ -182,7 +188,6 @@ subroutine results_setLink(path,link)
end subroutine results_setLink end subroutine results_setLink
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief adds a string attribute to an object in the results file !> @brief adds a string attribute to an object in the results file
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -608,8 +613,8 @@ subroutine results_mapping_constituent(phaseAt,memberAtLocal,label)
! write the components of the compound type individually ! write the components of the compound type individually
call h5pset_preserve_f(plist_id, .TRUE., ierr) call h5pset_preserve_f(plist_id, .TRUE., ierr)
loc_id = results_openGroup('/mapping/cellResults') loc_id = results_openGroup('/mapping')
call h5dcreate_f(loc_id, 'constituent', dtype_id, filespace_id, dset_id, ierr) call h5dcreate_f(loc_id, 'phase', dtype_id, filespace_id, dset_id, ierr)
if (ierr < 0) call IO_error(1,ext_msg='results_mapping_constituent: h5dcreate_f') if (ierr < 0) call IO_error(1,ext_msg='results_mapping_constituent: h5dcreate_f')
call h5dwrite_f(dset_id, name_id, reshape(label(pack(phaseAtMaterialpoint,.true.)),myShape), & call h5dwrite_f(dset_id, name_id, reshape(label(pack(phaseAtMaterialpoint,.true.)),myShape), &
@ -630,6 +635,9 @@ subroutine results_mapping_constituent(phaseAt,memberAtLocal,label)
call h5tclose_f(name_id, ierr) call h5tclose_f(name_id, ierr)
call h5tclose_f(position_id, ierr) call h5tclose_f(position_id, ierr)
! for backward compatibility
call results_setLink('/mapping/phase','/mapping/cellResults/constituent')
end subroutine results_mapping_constituent end subroutine results_mapping_constituent
@ -743,8 +751,8 @@ subroutine results_mapping_materialpoint(homogenizationAt,memberAtLocal,label)
! write the components of the compound type individually ! write the components of the compound type individually
call h5pset_preserve_f(plist_id, .TRUE., ierr) call h5pset_preserve_f(plist_id, .TRUE., ierr)
loc_id = results_openGroup('/mapping/cellResults') loc_id = results_openGroup('/mapping')
call h5dcreate_f(loc_id, 'materialpoint', dtype_id, filespace_id, dset_id, ierr) call h5dcreate_f(loc_id, 'homogenization', dtype_id, filespace_id, dset_id, ierr)
if (ierr < 0) call IO_error(1,ext_msg='results_mapping_materialpoint: h5dcreate_f') if (ierr < 0) call IO_error(1,ext_msg='results_mapping_materialpoint: h5dcreate_f')
call h5dwrite_f(dset_id, name_id, reshape(label(pack(homogenizationAtMaterialpoint,.true.)),myShape), & call h5dwrite_f(dset_id, name_id, reshape(label(pack(homogenizationAtMaterialpoint,.true.)),myShape), &
@ -765,6 +773,9 @@ subroutine results_mapping_materialpoint(homogenizationAt,memberAtLocal,label)
call h5tclose_f(name_id, ierr) call h5tclose_f(name_id, ierr)
call h5tclose_f(position_id, ierr) call h5tclose_f(position_id, ierr)
! for backward compatibility
call results_setLink('/mapping/homogenization','/mapping/cellResults/materialpoint')
end subroutine results_mapping_materialpoint end subroutine results_mapping_materialpoint