avoid checking of unitialized variables

This commit is contained in:
Martin Diehl 2019-04-04 11:49:23 +02:00
parent bc4b79a3a2
commit 280a11c4bc
2 changed files with 852 additions and 842 deletions

View File

@ -20,21 +20,21 @@ module HDF5_utilities
!> @details for parallel IO, all dimension except for the last need to match
!--------------------------------------------------------------------------------------------------
interface HDF5_read
module procedure HDF5_read_pReal1
module procedure HDF5_read_pReal2
module procedure HDF5_read_pReal3
module procedure HDF5_read_pReal4
module procedure HDF5_read_pReal5
module procedure HDF5_read_pReal6
module procedure HDF5_read_pReal7
module procedure HDF5_read_real1
module procedure HDF5_read_real2
module procedure HDF5_read_real3
module procedure HDF5_read_real4
module procedure HDF5_read_real5
module procedure HDF5_read_real6
module procedure HDF5_read_real7
module procedure HDF5_read_pInt1
module procedure HDF5_read_pInt2
module procedure HDF5_read_pInt3
module procedure HDF5_read_pInt4
module procedure HDF5_read_pInt5
module procedure HDF5_read_pInt6
module procedure HDF5_read_pInt7
module procedure HDF5_read_int1
module procedure HDF5_read_int2
module procedure HDF5_read_int3
module procedure HDF5_read_int4
module procedure HDF5_read_int5
module procedure HDF5_read_int6
module procedure HDF5_read_int7
end interface HDF5_read
@ -43,21 +43,21 @@ module HDF5_utilities
!> @details for parallel IO, all dimension except for the last need to match
!--------------------------------------------------------------------------------------------------
interface HDF5_write
module procedure HDF5_write_pReal1
module procedure HDF5_write_pReal2
module procedure HDF5_write_pReal3
module procedure HDF5_write_pReal4
module procedure HDF5_write_pReal5
module procedure HDF5_write_pReal6
module procedure HDF5_write_pReal7
module procedure HDF5_write_real1
module procedure HDF5_write_real2
module procedure HDF5_write_real3
module procedure HDF5_write_real4
module procedure HDF5_write_real5
module procedure HDF5_write_real6
module procedure HDF5_write_real7
module procedure HDF5_write_pInt1
module procedure HDF5_write_pInt2
module procedure HDF5_write_pInt3
module procedure HDF5_write_pInt4
module procedure HDF5_write_pInt5
module procedure HDF5_write_pInt6
module procedure HDF5_write_pInt7
module procedure HDF5_write_int1
module procedure HDF5_write_int2
module procedure HDF5_write_int3
module procedure HDF5_write_int4
module procedure HDF5_write_int5
module procedure HDF5_write_int6
module procedure HDF5_write_int7
end interface HDF5_write
@ -66,8 +66,8 @@ module HDF5_utilities
!--------------------------------------------------------------------------------------------------
interface HDF5_addAttribute
module procedure HDF5_addAttribute_str
module procedure HDF5_addAttribute_pInt
module procedure HDF5_addAttribute_pReal
module procedure HDF5_addAttribute_int
module procedure HDF5_addAttribute_real
end interface HDF5_addAttribute
@ -86,6 +86,10 @@ module HDF5_utilities
HDF5_objectExists
contains
!--------------------------------------------------------------------------------------------------
!> @brief open libary and do sanity checks
!--------------------------------------------------------------------------------------------------
subroutine HDF5_utilities_init
implicit none
@ -189,20 +193,20 @@ integer(HID_T) function HDF5_addGroup(fileHandle,groupName)
integer :: hdferr
integer(HID_T) :: aplist_id
!-------------------------------------------------------------------------------------------------
! creating a property list for data access properties
!-------------------------------------------------------------------------------------------------
! creating a property list for data access properties
call h5pcreate_f(H5P_GROUP_ACCESS_F, aplist_id, hdferr)
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_addGroup: h5pcreate_f ('//trim(groupName)//')')
!-------------------------------------------------------------------------------------------------
! setting I/O mode to collective
!-------------------------------------------------------------------------------------------------
! setting I/O mode to collective
#ifdef PETSc
call h5pset_all_coll_metadata_ops_f(aplist_id, .true., hdferr)
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_addGroup: h5pset_all_coll_metadata_ops_f ('//trim(groupName)//')')
#endif
!-------------------------------------------------------------------------------------------------
! Create group
!-------------------------------------------------------------------------------------------------
! Create group
call h5gcreate_f(fileHandle, trim(groupName), HDF5_addGroup, hdferr, OBJECT_NAMELEN_DEFAULT_F,gapl_id = aplist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg = 'HDF5_addGroup: h5gcreate_f ('//trim(groupName)//')')
@ -336,7 +340,7 @@ end subroutine HDF5_addAttribute_str
!--------------------------------------------------------------------------------------------------
!> @brief adds a integer attribute to the path given relative to the location
!--------------------------------------------------------------------------------------------------
subroutine HDF5_addAttribute_pInt(loc_id,attrLabel,attrValue,path)
subroutine HDF5_addAttribute_int(loc_id,attrLabel,attrValue,path)
implicit none
integer(HID_T), intent(in) :: loc_id
@ -377,13 +381,13 @@ subroutine HDF5_addAttribute_pInt(loc_id,attrLabel,attrValue,path)
call h5sclose_f(space_id,hdferr)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pInt: h5sclose_f')
end subroutine HDF5_addAttribute_pInt
end subroutine HDF5_addAttribute_int
!--------------------------------------------------------------------------------------------------
!> @brief adds a integer attribute to the path given relative to the location
!--------------------------------------------------------------------------------------------------
subroutine HDF5_addAttribute_pReal(loc_id,attrLabel,attrValue,path)
subroutine HDF5_addAttribute_real(loc_id,attrLabel,attrValue,path)
implicit none
integer(HID_T), intent(in) :: loc_id
@ -424,14 +428,13 @@ subroutine HDF5_addAttribute_pReal(loc_id,attrLabel,attrValue,path)
call h5sclose_f(space_id,hdferr)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_addAttribute_pReal: h5sclose_f')
end subroutine HDF5_addAttribute_pReal
end subroutine HDF5_addAttribute_real
!--------------------------------------------------------------------------------------------------
!> @brief set link to object in results file
!--------------------------------------------------------------------------------------------------
subroutine HDF5_setLink(loc_id,target_name,link_name)
use hdf5
implicit none
character(len=*), intent(in) :: target_name, link_name
@ -454,7 +457,7 @@ end subroutine HDF5_setLink
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pReal with 1 dimension
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pReal1(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_real1(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:) :: dataset
@ -486,16 +489,16 @@ subroutine HDF5_read_pReal1(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_DOUBLE,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal1: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_real1: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pReal1
end subroutine HDF5_read_real1
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pReal with 2 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pReal2(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_real2(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:) :: dataset
@ -527,16 +530,16 @@ subroutine HDF5_read_pReal2(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_DOUBLE,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal2: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_real2: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pReal2
end subroutine HDF5_read_real2
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pReal with 2 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pReal3(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_real3(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:) :: dataset
@ -568,16 +571,16 @@ subroutine HDF5_read_pReal3(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_DOUBLE,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal3: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_real3: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pReal3
end subroutine HDF5_read_real3
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pReal with 4 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pReal4(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_real4(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:,:) :: dataset
@ -609,16 +612,16 @@ subroutine HDF5_read_pReal4(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_DOUBLE,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal4: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_real4: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pReal4
end subroutine HDF5_read_real4
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pReal with 5 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pReal5(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_real5(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:,:,:) :: dataset
@ -650,16 +653,16 @@ subroutine HDF5_read_pReal5(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_DOUBLE,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal5: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_real5: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pReal5
end subroutine HDF5_read_real5
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pReal with 6 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pReal6(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_real6(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:,:,:,:) :: dataset
@ -691,16 +694,16 @@ subroutine HDF5_read_pReal6(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_DOUBLE,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal6: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_real6: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pReal6
end subroutine HDF5_read_real6
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pReal with 7 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pReal7(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_real7(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:,:,:,:,:) :: dataset
@ -732,17 +735,17 @@ subroutine HDF5_read_pReal7(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_DOUBLE,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal7: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_real7: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pReal7
end subroutine HDF5_read_real7
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pInt with 1 dimension
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pInt1(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_int1(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:) :: dataset
@ -774,16 +777,16 @@ subroutine HDF5_read_pInt1(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_INTEGER,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pInt1: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_int1: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pInt1
end subroutine HDF5_read_int1
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pInt with 2 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pInt2(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_int2(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:) :: dataset
@ -815,16 +818,16 @@ subroutine HDF5_read_pInt2(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_INTEGER,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pInt2: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_int2: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pInt2
end subroutine HDF5_read_int2
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pInt with 3 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pInt3(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_int3(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:) :: dataset
@ -856,16 +859,16 @@ subroutine HDF5_read_pInt3(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_INTEGER,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pInt3: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_int3: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pInt3
end subroutine HDF5_read_int3
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pInt withh 4 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pInt4(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_int4(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:,:) :: dataset
@ -897,16 +900,16 @@ subroutine HDF5_read_pInt4(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_INTEGER,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pInt4: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_int4: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pInt4
end subroutine HDF5_read_int4
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pInt with 5 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pInt5(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_int5(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:,:,:) :: dataset
@ -938,16 +941,16 @@ subroutine HDF5_read_pInt5(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_INTEGER,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pInt5: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_int5: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pInt5
end subroutine HDF5_read_int5
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pInt with 6 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pInt6(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_int6(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:,:,:,:) :: dataset
@ -979,16 +982,16 @@ subroutine HDF5_read_pInt6(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_INTEGER,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pInt6: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_int6: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pInt6
end subroutine HDF5_read_int6
!--------------------------------------------------------------------------------------------------
!> @brief read dataset of type pInt with 7 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_read_pInt7(loc_id,dataset,datasetName,parallel)
subroutine HDF5_read_int7(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:,:,:,:,:) :: dataset
@ -1020,17 +1023,17 @@ subroutine HDF5_read_pInt7(loc_id,dataset,datasetName,parallel)
call h5dread_f(dset_id, H5T_NATIVE_INTEGER,dataset,totalShape, hdferr,&
file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pInt7: h5dread_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_int7: h5dread_f')
call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
end subroutine HDF5_read_pInt7
end subroutine HDF5_read_int7
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pReal with 1 dimension
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pReal1(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_real1(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:) :: dataset
@ -1059,19 +1062,20 @@ subroutine HDF5_write_pReal1(loc_id,dataset,datasetName,parallel)
myStart, totalShape,loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal1: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_real1: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pReal1
end subroutine HDF5_write_real1
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pReal with 2 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pReal2(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_real2(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:) :: dataset
@ -1100,19 +1104,20 @@ subroutine HDF5_write_pReal2(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal2: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_real2: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pReal2
end subroutine HDF5_write_real2
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pReal with 3 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pReal3(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_real3(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:) :: dataset
@ -1141,19 +1146,20 @@ subroutine HDF5_write_pReal3(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal3: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_real3: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pReal3
end subroutine HDF5_write_real3
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pReal with 4 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pReal4(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_real4(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:,:) :: dataset
@ -1182,20 +1188,21 @@ subroutine HDF5_write_pReal4(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal4: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_real4: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pReal4
end subroutine HDF5_write_real4
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pReal with 5 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pReal5(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_real5(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:,:,:) :: dataset
@ -1224,19 +1231,20 @@ subroutine HDF5_write_pReal5(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal5: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_real5: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pReal5
end subroutine HDF5_write_real5
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pReal with 6 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pReal6(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_real6(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:,:,:,:) :: dataset
@ -1265,19 +1273,20 @@ subroutine HDF5_write_pReal6(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal6: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_real6: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pReal6
end subroutine HDF5_write_real6
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pReal with 7 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pReal7(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_real7(loc_id,dataset,datasetName,parallel)
implicit none
real(pReal), intent(inout), dimension(:,:,:,:,:,:,:) :: dataset
@ -1306,20 +1315,21 @@ subroutine HDF5_write_pReal7(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal7: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_real7: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pReal7
end subroutine HDF5_write_real7
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pInt with 1 dimension
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pInt1(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_int1(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:) :: dataset
@ -1348,19 +1358,20 @@ subroutine HDF5_write_pInt1(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt1: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_int1: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pInt1
end subroutine HDF5_write_int1
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pInt with 2 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pInt2(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_int2(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:) :: dataset
@ -1389,19 +1400,20 @@ subroutine HDF5_write_pInt2(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt2: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_int2: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pInt2
end subroutine HDF5_write_int2
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pInt with 3 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pInt3(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_int3(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:) :: dataset
@ -1430,19 +1442,20 @@ subroutine HDF5_write_pInt3(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt3: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_int3: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pInt3
end subroutine HDF5_write_int3
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pInt with 4 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pInt4(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_int4(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:,:) :: dataset
@ -1471,19 +1484,20 @@ subroutine HDF5_write_pInt4(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt4: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_int4: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pInt4
end subroutine HDF5_write_int4
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pInt with 5 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pInt5(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_int5(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:,:,:) :: dataset
@ -1512,19 +1526,20 @@ subroutine HDF5_write_pInt5(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt5: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_int5: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pInt5
end subroutine HDF5_write_int5
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pInt with 6 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pInt6(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_int6(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:,:,:,:) :: dataset
@ -1553,19 +1568,20 @@ subroutine HDF5_write_pInt6(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt6: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_int6: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pInt6
end subroutine HDF5_write_int6
!--------------------------------------------------------------------------------------------------
!> @brief write dataset of type pInt with 7 dimensions
!--------------------------------------------------------------------------------------------------
subroutine HDF5_write_pInt7(loc_id,dataset,datasetName,parallel)
subroutine HDF5_write_int7(loc_id,dataset,datasetName,parallel)
implicit none
integer, intent(inout), dimension(:,:,:,:,:,:,:) :: dataset
@ -1594,14 +1610,15 @@ subroutine HDF5_write_pInt7(loc_id,dataset,datasetName,parallel)
myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,.false.)
endif
if (product(totalShape) /= 0) &
if (product(totalShape) /= 0) then
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,&
file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt7: h5dwrite_f')
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_int7: h5dwrite_f')
endif
call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
end subroutine HDF5_write_pInt7
end subroutine HDF5_write_int7
!--------------------------------------------------------------------------------------------------

View File

@ -5,9 +5,6 @@
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!--------------------------------------------------------------------------------------------------
module results
use prec
use IO
use HDF5
use HDF5_utilities
#ifdef PETSc
use PETSC
@ -135,8 +132,6 @@ end function results_addGroup
!> @brief set link to object in results file
!--------------------------------------------------------------------------------------------------
subroutine results_setLink(path,link)
use hdf5_utilities, only: &
HDF5_setLink
implicit none
character(len=*), intent(in) :: path, link
@ -163,7 +158,6 @@ end subroutine results_addAttribute
!> @brief remove link to an object
!--------------------------------------------------------------------------------------------------
subroutine results_removeLink(link)
use hdf5
implicit none
character(len=*), intent(in) :: link
@ -313,7 +307,6 @@ end subroutine results_writeTensorDataset_int
!> @brief adds the unique mapping from spatial position and constituent ID to results
!--------------------------------------------------------------------------------------------------
subroutine HDF5_mappingPhase(mapping,mapping2,Nconstituents,material_phase,phase_name,dataspace_size,mpiOffset,mpiOffset_phase)
use hdf5
implicit none
integer(pInt), intent(in) :: Nconstituents, dataspace_size, mpiOffset