polished addAttribute and use it to store meta data
This commit is contained in:
parent
b2062f2a12
commit
3f3e23c2c8
|
@ -154,13 +154,13 @@ subroutine CPFEM_init
|
|||
|
||||
fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5')
|
||||
|
||||
call HDF5_read(fileHandle,material_phase,'recordedPhase')
|
||||
call HDF5_read(fileHandle, crystallite_F0,'convergedF')
|
||||
call HDF5_read(fileHandle, crystallite_Fp0,'convergedFp')
|
||||
call HDF5_read(fileHandle, crystallite_Fi0,'convergedFi')
|
||||
call HDF5_read(fileHandle, crystallite_Lp0,'convergedLp')
|
||||
call HDF5_read(fileHandle, crystallite_Li0,'convergedLi')
|
||||
call HDF5_read(fileHandle, crystallite_dPdF0, 'convergeddPdF')
|
||||
call HDF5_read(fileHandle,material_phase, 'recordedPhase')
|
||||
call HDF5_read(fileHandle,crystallite_F0, 'convergedF')
|
||||
call HDF5_read(fileHandle,crystallite_Fp0, 'convergedFp')
|
||||
call HDF5_read(fileHandle,crystallite_Fi0, 'convergedFi')
|
||||
call HDF5_read(fileHandle,crystallite_Lp0, 'convergedLp')
|
||||
call HDF5_read(fileHandle,crystallite_Li0, 'convergedLi')
|
||||
call HDF5_read(fileHandle,crystallite_dPdF0, 'convergeddPdF')
|
||||
call HDF5_read(fileHandle,crystallite_Tstar0_v,'convergedTstar')
|
||||
|
||||
groupPlasticID = HDF5_openGroup(fileHandle,'PlasticPhases')
|
||||
|
@ -282,13 +282,13 @@ subroutine CPFEM_age()
|
|||
write(rankStr,'(a1,i0)')'_',worldrank
|
||||
fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','w')
|
||||
|
||||
call HDF5_write(fileHandle, material_phase,'recordedPhase')
|
||||
call HDF5_write(fileHandle, crystallite_F0,'convergedF')
|
||||
call HDF5_write(fileHandle, crystallite_Fp0,'convergedFp')
|
||||
call HDF5_write(fileHandle, crystallite_Fi0,'convergedFi')
|
||||
call HDF5_write(fileHandle, crystallite_Lp0,'convergedLp')
|
||||
call HDF5_write(fileHandle, crystallite_Li0,'convergedLi')
|
||||
call HDF5_write(fileHandle, crystallite_dPdF0,'convergeddPdF')
|
||||
call HDF5_write(fileHandle,material_phase, 'recordedPhase')
|
||||
call HDF5_write(fileHandle,crystallite_F0, 'convergedF')
|
||||
call HDF5_write(fileHandle,crystallite_Fp0, 'convergedFp')
|
||||
call HDF5_write(fileHandle,crystallite_Fi0, 'convergedFi')
|
||||
call HDF5_write(fileHandle,crystallite_Lp0, 'convergedLp')
|
||||
call HDF5_write(fileHandle,crystallite_Li0, 'convergedLi')
|
||||
call HDF5_write(fileHandle,crystallite_dPdF0, 'convergeddPdF')
|
||||
call HDF5_write(fileHandle,crystallite_Tstar0_v,'convergedTstar')
|
||||
|
||||
groupPlastic = HDF5_addGroup(fileHandle,'PlasticPhases')
|
||||
|
@ -317,7 +317,7 @@ end subroutine CPFEM_age
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief triggers writing of the results
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine CPFEM_results(inc)
|
||||
subroutine CPFEM_results(inc,time)
|
||||
use prec, only: &
|
||||
pInt
|
||||
use results
|
||||
|
@ -327,13 +327,12 @@ subroutine CPFEM_results(inc)
|
|||
|
||||
implicit none
|
||||
integer(pInt), intent(in) :: inc
|
||||
character(len=16) :: incChar
|
||||
real(pReal), intent(in) :: time
|
||||
|
||||
call results_openJobFile
|
||||
write(incChar,*) inc
|
||||
call HDF5_closeGroup(results_addGroup(trim('inc'//trim(adjustl(incChar)))))
|
||||
call results_setLink(trim('inc'//trim(adjustl(incChar))),'current')
|
||||
call results_addIncrement(inc,time)
|
||||
call constitutive_results()
|
||||
call results_removeLink('current') ! put this into closeJobFile
|
||||
call results_closeJobFile
|
||||
|
||||
end subroutine CPFEM_results
|
||||
|
|
|
@ -161,7 +161,6 @@ program DAMASK_spectral
|
|||
|
||||
|
||||
call results_openJobFile()
|
||||
call results_addIncrement()
|
||||
call results_closeJobFile()
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! initialize field solver information
|
||||
|
@ -426,6 +425,7 @@ program DAMASK_spectral
|
|||
|
||||
writeUndeformed: if (interface_restartInc < 1_pInt) then
|
||||
write(6,'(1/,a)') ' ... writing initial configuration to file ........................'
|
||||
call CPFEM_results(0_pInt,0.0_pReal)
|
||||
do i = 1, size(materialpoint_results,3)/(maxByteOut/(materialpoint_sizeResults*pReal))+1 ! slice the output of my process in chunks not exceeding the limit for one output
|
||||
outputIndex = int([(i-1_pInt)*((maxRealOut)/materialpoint_sizeResults)+1_pInt, & ! QUESTION: why not starting i at 0 instead of murky 1?
|
||||
min(i*((maxRealOut)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt)
|
||||
|
@ -602,7 +602,7 @@ program DAMASK_spectral
|
|||
if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_write')
|
||||
enddo
|
||||
fileOffset = fileOffset + sum(outputSize) ! forward to current file position
|
||||
call CPFEM_results(totalIncsCounter)
|
||||
call CPFEM_results(totalIncsCounter,time)
|
||||
endif
|
||||
if ( loadCases(currentLoadCase)%restartFrequency > 0_pInt & ! writing of restart info requested ...
|
||||
.and. mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0_pInt) then ! ... and at frequency of writing restart information
|
||||
|
|
|
@ -35,7 +35,7 @@ module HDF5_utilities
|
|||
module procedure HDF5_read_pInt4
|
||||
module procedure HDF5_read_pInt5
|
||||
module procedure HDF5_read_pInt6
|
||||
module procedure HDF5_read_pInt7 !ABOVE 8 DIMENSIONS IT GIVES ERROR: THE CALL TO H5DREAD_F DOESNT WORK
|
||||
module procedure HDF5_read_pInt7
|
||||
|
||||
end interface HDF5_read
|
||||
|
||||
|
@ -57,25 +57,26 @@ module HDF5_utilities
|
|||
module procedure HDF5_write_pInt4
|
||||
module procedure HDF5_write_pInt5
|
||||
module procedure HDF5_write_pInt6
|
||||
module procedure HDF5_write_pInt7 !ABOVE 8 DIMENSIONS IT GIVES ERROR: THE CALL TO H5DREAD_F DOESNT WORK
|
||||
module procedure HDF5_write_pInt7
|
||||
|
||||
end interface HDF5_write
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief attached attributes of type char,pInt or pReal to a file/dataset/group
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
interface HDF5_attributes
|
||||
module procedure HDF5_addStringAttribute
|
||||
module procedure HDF5_addIntegerAttribute
|
||||
module procedure HDF5_addRealAttribute
|
||||
end interface HDF5_attributes
|
||||
interface HDF5_addAttribute
|
||||
module procedure HDF5_addAttribute_str
|
||||
module procedure HDF5_addAttribute_pInt
|
||||
module procedure HDF5_addAttribute_pReal
|
||||
end interface HDF5_addAttribute
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
public :: &
|
||||
HDF5_utilities_init, &
|
||||
HDF5_openFile, &
|
||||
HDF5_closeFile, &
|
||||
HDF5_addStringAttribute, &
|
||||
HDF5_addIntegerAttribute, &
|
||||
HDF5_addRealAttribute, &
|
||||
HDF5_addAttribute, &
|
||||
HDF5_closeGroup ,&
|
||||
HDF5_openGroup, &
|
||||
HDF5_addGroup, &
|
||||
|
@ -253,118 +254,165 @@ end subroutine HDF5_closeGroup
|
|||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief adds a StringAttribute to the results file
|
||||
!> @brief adds a string attribute to the path given relative to the location
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine HDF5_addStringAttribute(entity,attrLabel,attrValue)
|
||||
subroutine HDF5_addAttribute_str(loc_id,attrLabel,attrValue,path)
|
||||
|
||||
implicit none
|
||||
integer(HID_T), intent(in) :: entity
|
||||
integer(HID_T), intent(in) :: loc_id
|
||||
character(len=*), intent(in) :: attrLabel, attrValue
|
||||
character(len=*), intent(in), optional :: path
|
||||
integer(HDF5_ERR_TYPE) :: hdferr
|
||||
integer(HID_T) :: attr_id, space_id, type_id
|
||||
logical :: attrExists
|
||||
character(len=256) :: p
|
||||
|
||||
if (present(path)) then
|
||||
p = trim(path)
|
||||
else
|
||||
p = '.'
|
||||
endif
|
||||
|
||||
call h5screate_f(H5S_SCALAR_F,space_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addStringAttribute: h5screate_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5screate_f')
|
||||
call h5tcopy_f(H5T_NATIVE_CHARACTER, type_id, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addStringAttribute: h5tcopy_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5tcopy_f')
|
||||
call h5tset_size_f(type_id, int(len(trim(attrValue)),HSIZE_T), hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addStringAttribute: h5tset_size_f')
|
||||
call h5acreate_f(entity, trim(attrLabel),type_id,space_id,attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addStringAttribute: h5acreate_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5tset_size_f')
|
||||
call h5aexists_by_name_f(loc_id,trim(p),attrLabel,attrExists,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5aexists_by_name_f')
|
||||
if (attrExists) then
|
||||
call h5adelete_by_name_f(loc_id, trim(p), attrLabel, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5adelete_by_name_f')
|
||||
endif
|
||||
call h5acreate_by_name_f(loc_id,trim(p),trim(attrLabel),type_id,space_id,attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5acreate_f')
|
||||
call h5awrite_f(attr_id, type_id, trim(attrValue), int([1],HSIZE_T), hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addStringAttribute: h5awrite_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5awrite_f')
|
||||
call h5aclose_f(attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addStringAttribute: h5aclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5aclose_f')
|
||||
call h5tclose_f(type_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addStringAttribute: h5tclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5tclose_f')
|
||||
call h5sclose_f(space_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addStringAttribute: h5sclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_str: h5sclose_f')
|
||||
|
||||
end subroutine HDF5_addStringAttribute
|
||||
end subroutine HDF5_addAttribute_str
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief adds a IntegerAttribute to the results file
|
||||
!> @brief adds a integer attribute to the path given relative to the location
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine HDF5_addIntegerAttribute(entity,attrLabel,attrValue)
|
||||
subroutine HDF5_addAttribute_pInt(loc_id,attrLabel,attrValue,path)
|
||||
|
||||
implicit none
|
||||
integer(HID_T), intent(in) :: entity
|
||||
integer(HID_T), intent(in) :: loc_id
|
||||
character(len=*), intent(in) :: attrLabel
|
||||
integer(pInt), intent(in) :: attrValue
|
||||
character(len=*), intent(in), optional :: path
|
||||
integer(HDF5_ERR_TYPE) :: hdferr
|
||||
integer(HID_T) :: attr_id, space_id, type_id
|
||||
logical :: attrExists
|
||||
character(len=256) :: p
|
||||
|
||||
if (present(path)) then
|
||||
p = trim(path)
|
||||
else
|
||||
p = '.'
|
||||
endif
|
||||
|
||||
call h5screate_f(H5S_SCALAR_F,space_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addIntegerAttribute: h5screate_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5screate_f')
|
||||
call h5tcopy_f(H5T_NATIVE_INTEGER, type_id, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addIntegerAttribute: h5tcopy_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5tcopy_f')
|
||||
call h5tset_size_f(type_id, 1_HSIZE_T, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addIntegerAttribute: h5tset_size_f')
|
||||
call h5acreate_f(entity, trim(attrLabel),type_id,space_id,attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addIntegerAttribute: h5acreate_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5tset_size_f')
|
||||
call h5aexists_by_name_f(loc_id,trim(p),attrLabel,attrExists,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5aexists_by_name_f')
|
||||
if (attrExists) then
|
||||
call h5adelete_by_name_f(loc_id, trim(p), attrLabel, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5adelete_by_name_f')
|
||||
endif
|
||||
call h5acreate_by_name_f(loc_id,trim(p),trim(attrLabel),type_id,space_id,attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5acreate_f')
|
||||
call h5awrite_f(attr_id, type_id, attrValue, int([1],HSIZE_T), hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addIntegerAttribute: h5awrite_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5awrite_f')
|
||||
call h5aclose_f(attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addIntegerAttribute: h5aclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5aclose_f')
|
||||
call h5tclose_f(type_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addIntegerAttribute: h5tclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5tclose_f')
|
||||
call h5sclose_f(space_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addIntegerAttribute: h5sclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5sclose_f')
|
||||
|
||||
end subroutine HDF5_addAttribute_pInt
|
||||
|
||||
end subroutine HDF5_addIntegerAttribute
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief adds a Real number Attribute to the results file
|
||||
!> @brief adds a integer attribute to the path given relative to the location
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine HDF5_addRealAttribute(entity,attrLabel,attrValue)
|
||||
subroutine HDF5_addAttribute_pReal(loc_id,attrLabel,attrValue,path)
|
||||
|
||||
implicit none
|
||||
integer(HID_T), intent(in) :: entity
|
||||
integer(HID_T), intent(in) :: loc_id
|
||||
character(len=*), intent(in) :: attrLabel
|
||||
real(pReal), intent(in) :: attrValue
|
||||
character(len=*), intent(in), optional :: path
|
||||
integer(HDF5_ERR_TYPE) :: hdferr
|
||||
integer(HID_T) :: attr_id, space_id, type_id
|
||||
logical :: attrExists
|
||||
character(len=256) :: p
|
||||
|
||||
if (present(path)) then
|
||||
p = trim(path)
|
||||
else
|
||||
p = '.'
|
||||
endif
|
||||
|
||||
call h5screate_f(H5S_SCALAR_F,space_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addRealAttribute: h5screate_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5screate_f')
|
||||
call h5tcopy_f(H5T_NATIVE_DOUBLE, type_id, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addRealAttribute: h5tcopy_f')
|
||||
call h5tset_size_f(type_id, 8_HSIZE_T, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addRealAttribute: h5tset_size_f')
|
||||
call h5acreate_f(entity, trim(attrLabel),type_id,space_id,attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addRealAttribute: h5acreate_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5tcopy_f')
|
||||
call h5tset_size_f(type_id, 8_HSIZE_T, hdferr) ! ToDo
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5tset_size_f')
|
||||
call h5aexists_by_name_f(loc_id,trim(p),attrLabel,attrExists,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5aexists_by_name_f')
|
||||
if (attrExists) then
|
||||
call h5adelete_by_name_f(loc_id, trim(p), attrLabel, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5adelete_by_name_f')
|
||||
endif
|
||||
call h5acreate_by_name_f(loc_id,trim(p),trim(attrLabel),type_id,space_id,attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5acreate_f')
|
||||
call h5awrite_f(attr_id, type_id, attrValue, int([1],HSIZE_T), hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addRealAttribute: h5awrite_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5awrite_f')
|
||||
call h5aclose_f(attr_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addRealAttribute: h5aclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5aclose_f')
|
||||
call h5tclose_f(type_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addRealAttribute: h5tclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5tclose_f')
|
||||
call h5sclose_f(space_id,hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addRealAttribute: h5sclose_f')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5sclose_f')
|
||||
|
||||
end subroutine HDF5_addAttribute_pReal
|
||||
|
||||
end subroutine HDF5_addRealAttribute
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief set link to object in results file
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine HDF5_setLink(fileHandle,path,link)
|
||||
subroutine HDF5_setLink(loc_id,target_name,link_name)
|
||||
use hdf5
|
||||
|
||||
implicit none
|
||||
character(len=*), intent(in) :: path, link
|
||||
integer(HID_T), intent(in) :: fileHandle
|
||||
character(len=*), intent(in) :: target_name, link_name
|
||||
integer(HID_T), intent(in) :: loc_id
|
||||
integer(HDF5_ERR_TYPE) :: hdferr
|
||||
logical :: linkExists
|
||||
|
||||
call h5lexists_f(fileHandle, link,linkExists, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_setLink: h5lexists_soft_f ('//trim(link)//')')
|
||||
call h5lexists_f(loc_id, link_name,linkExists, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_setLink: h5lexists_soft_f ('//trim(link_name)//')')
|
||||
if (linkExists) then
|
||||
call h5ldelete_f(fileHandle,link, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_setLink: h5ldelete_soft_f ('//trim(link)//')')
|
||||
call h5ldelete_f(loc_id,link_name, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_setLink: h5ldelete_soft_f ('//trim(link_name)//')')
|
||||
endif
|
||||
call h5lcreate_soft_f(path, fileHandle, link, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_setLink: h5lcreate_soft_f ('//trim(path)//' '//trim(link)//')')
|
||||
call h5lcreate_soft_f(target_name, loc_id, link_name, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_setLink: h5lcreate_soft_f ('//trim(target_name)//' '//trim(link_name)//')')
|
||||
|
||||
end subroutine HDF5_setLink
|
||||
|
||||
|
|
|
@ -768,7 +768,6 @@ subroutine plastic_phenopowerlaw_results(instance,group)
|
|||
end select
|
||||
enddo outputsLoop
|
||||
end associate
|
||||
!results_writeVectorDataset
|
||||
#else
|
||||
integer(pInt), intent(in) :: instance
|
||||
character(len=*) :: group
|
||||
|
|
|
@ -24,18 +24,11 @@ module results
|
|||
results_openJobFile, &
|
||||
results_closeJobFile, &
|
||||
results_addIncrement, &
|
||||
HDF5_mappingPhase, &
|
||||
HDF5_mappingHomog, &
|
||||
HDF5_mappingCrystallite, &
|
||||
HDF5_backwardMappingPhase, &
|
||||
HDF5_backwardMappingHomog, &
|
||||
HDF5_backwardMappingCrystallite, &
|
||||
HDF5_mappingCells, &
|
||||
results_addGroup, &
|
||||
results_openGroup, &
|
||||
results_writeVectorDataset, &
|
||||
results_setLink, &
|
||||
HDF5_removeLink
|
||||
results_removeLink
|
||||
contains
|
||||
|
||||
subroutine results_init
|
||||
|
@ -62,6 +55,8 @@ subroutine results_openJobFile()
|
|||
implicit none
|
||||
|
||||
resultsFile = HDF5_openFile(trim(getSolverJobName())//'.hdf5','a',.true.)
|
||||
call HDF5_addAttribute(resultsFile,'DADF5version',0.1_pReal)
|
||||
call HDF5_addAttribute(resultsFile,'DAMASKversion',DAMASKVERSION)
|
||||
|
||||
end subroutine results_openJobFile
|
||||
|
||||
|
@ -80,10 +75,16 @@ end subroutine results_closeJobFile
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief closes the results file
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine results_addIncrement()
|
||||
implicit none
|
||||
subroutine results_addIncrement(inc,time)
|
||||
|
||||
call HDF5_addIntegerAttribute(resultsFile,'test',1)
|
||||
implicit none
|
||||
integer(pInt), intent(in) :: inc
|
||||
real(pReal), intent(in) :: time
|
||||
character(len=pStringLen) :: incChar
|
||||
|
||||
call HDF5_closeGroup(results_addGroup(trim('inc'//trim(adjustl(incChar)))))
|
||||
call results_setLink(trim('inc'//trim(adjustl(incChar))),'current')
|
||||
call HDF5_addAttribute(resultsFile,'time/s',time,trim('inc'//trim(adjustl(incChar))))
|
||||
|
||||
end subroutine results_addIncrement
|
||||
|
||||
|
@ -112,6 +113,7 @@ integer(HID_T) function results_addGroup(groupName)
|
|||
|
||||
end function results_addGroup
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief set link to object in results file
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
@ -126,10 +128,11 @@ subroutine results_setLink(path,link)
|
|||
|
||||
end subroutine results_setLink
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief remove link to an object
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine HDF5_removeLink(link)
|
||||
subroutine results_removeLink(link)
|
||||
use hdf5
|
||||
|
||||
implicit none
|
||||
|
@ -137,9 +140,27 @@ subroutine HDF5_removeLink(link)
|
|||
integer :: hdferr
|
||||
|
||||
call h5ldelete_f(resultsFile,link, hdferr)
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_removeLink: h5ldelete_soft_f ('//trim(link)//')')
|
||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'results_removeLink: h5ldelete_soft_f ('//trim(link)//')')
|
||||
|
||||
end subroutine HDF5_removeLink
|
||||
end subroutine results_removeLink
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief stores a vector dataset in a group
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine results_writeVectorDataset(group,dataset,label,SIunit)
|
||||
|
||||
implicit none
|
||||
character(len=*), intent(in) :: SIunit,label,group
|
||||
real(pReal), intent(inout), dimension(:,:) :: dataset
|
||||
integer(HID_T) :: groupHandle
|
||||
|
||||
groupHandle = results_openGroup(group)
|
||||
call HDF5_write(groupHandle,dataset,label)
|
||||
call HDF5_addAttribute(groupHandle,'Unit',SIunit,label)
|
||||
call HDF5_closeGroup(groupHandle)
|
||||
|
||||
end subroutine results_writeVectorDataset
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
@ -943,21 +964,5 @@ subroutine HDF5_mappingCells(mapping)
|
|||
|
||||
end subroutine HDF5_mappingCells
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief creates a new vector dataset in the given group location
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine results_writeVectorDataset(group,dataset,label,SIunit)
|
||||
|
||||
implicit none
|
||||
character(len=*), intent(in) :: SIunit,label,group
|
||||
real(pReal), intent(inout), dimension(:,:) :: dataset
|
||||
integer(HID_T) :: groupHandle
|
||||
|
||||
groupHandle = results_openGroup(group)
|
||||
call HDF5_write(groupHandle,dataset,label)
|
||||
call HDF5_closeGroup(groupHandle)
|
||||
|
||||
end subroutine results_writeVectorDataset
|
||||
|
||||
|
||||
end module results
|
||||
|
|
Loading…
Reference in New Issue