initializing and closing the HDF5 library
This commit is contained in:
parent
e7e0cf7118
commit
48403c37b7
|
@ -37,6 +37,8 @@ subroutine CPFEM_initAll(el,ip)
|
||||||
mesh_init
|
mesh_init
|
||||||
use material, only: &
|
use material, only: &
|
||||||
material_init
|
material_init
|
||||||
|
use HDF5_utilities, only: &
|
||||||
|
HDF5_utilities_init
|
||||||
use lattice, only: &
|
use lattice, only: &
|
||||||
lattice_init
|
lattice_init
|
||||||
use constitutive, only: &
|
use constitutive, only: &
|
||||||
|
@ -72,6 +74,7 @@ subroutine CPFEM_initAll(el,ip)
|
||||||
call mesh_init(ip, el) ! pass on coordinates to alter calcMode of first ip
|
call mesh_init(ip, el) ! pass on coordinates to alter calcMode of first ip
|
||||||
call lattice_init
|
call lattice_init
|
||||||
call material_init
|
call material_init
|
||||||
|
call HDF5_utilities_init
|
||||||
call constitutive_init
|
call constitutive_init
|
||||||
call crystallite_init
|
call crystallite_init
|
||||||
call homogenization_init
|
call homogenization_init
|
||||||
|
|
|
@ -58,8 +58,19 @@ subroutine HDF5_Utilities_init
|
||||||
write(6,'(/,a)') ' <<<+- HDF5_Utilities init -+>>>'
|
write(6,'(/,a)') ' <<<+- HDF5_Utilities init -+>>>'
|
||||||
#include "compilation_info.f90"
|
#include "compilation_info.f90"
|
||||||
|
|
||||||
currentInc = -1_pInt
|
!currentInc = -1_pInt ToDo
|
||||||
call HDF5_createJobFile
|
!call HDF5_createJobFile ToDo
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!initialize HDF5 library and check if integer and float type size match
|
||||||
|
call h5open_f(hdferr)
|
||||||
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_Utilities_init: h5open_f')
|
||||||
|
call h5tget_size_f(H5T_NATIVE_INTEGER,typeSize, hdferr)
|
||||||
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_Utilities_init: h5tget_size_f (int)')
|
||||||
|
if (int(pInt,SIZE_T)/=typeSize) call IO_error(0_pInt,ext_msg='pInt does not match H5T_NATIVE_INTEGER')
|
||||||
|
call h5tget_size_f(H5T_NATIVE_DOUBLE,typeSize, hdferr)
|
||||||
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_Utilities_init: h5tget_size_f (double)')
|
||||||
|
if (int(pReal,SIZE_T)/=typeSize) call IO_error(0_pInt,ext_msg='pReal does not match H5T_NATIVE_DOUBLE')
|
||||||
|
|
||||||
end subroutine HDF5_Utilities_init
|
end subroutine HDF5_Utilities_init
|
||||||
|
|
||||||
|
@ -74,23 +85,11 @@ subroutine HDF5_createJobFile
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer :: hdferr
|
integer :: hdferr
|
||||||
integer(SIZE_T) :: typeSize
|
|
||||||
character(len=1024) :: path
|
character(len=1024) :: path
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
#include <petsc/finclude/petscsys.h>
|
#include <petsc/finclude/petscsys.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!initialize HDF5 library and check if integer and float type size match
|
|
||||||
|
|
||||||
call h5open_f(hdferr)
|
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_Utilities_init: h5open_f')
|
|
||||||
call h5tget_size_f(H5T_NATIVE_INTEGER,typeSize, hdferr)
|
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_Utilities_init: h5tget_size_f (int)')
|
|
||||||
if (int(pInt,SIZE_T)/=typeSize) call IO_error(0_pInt,ext_msg='pInt does not match H5T_NATIVE_INTEGER')
|
|
||||||
call h5tget_size_f(H5T_NATIVE_DOUBLE,typeSize, hdferr)
|
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_Utilities_init: h5tget_size_f (double)')
|
|
||||||
if (int(pReal,SIZE_T)/=typeSize) call IO_error(0_pInt,ext_msg='pReal does not match H5T_NATIVE_DOUBLE')
|
|
||||||
|
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
call h5pcreate_f(H5P_FILE_ACCESS_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_FILE_ACCESS_F, plist_id, hdferr)
|
||||||
|
@ -157,7 +156,7 @@ subroutine HDF5_closeJobFile()
|
||||||
call HDF5_removeLink('current')
|
call HDF5_removeLink('current')
|
||||||
call h5fclose_f(resultsFile,hdferr)
|
call h5fclose_f(resultsFile,hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_closeJobFile: h5fclose_f',el=hdferr)
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_closeJobFile: h5fclose_f',el=hdferr)
|
||||||
call h5close_f(hdferr)
|
! call h5close_f(hdferr)
|
||||||
|
|
||||||
end subroutine HDF5_closeJobFile
|
end subroutine HDF5_closeJobFile
|
||||||
|
|
||||||
|
@ -171,8 +170,6 @@ integer(HID_T) function HDF5_openFile(filePath)
|
||||||
integer :: hdferr
|
integer :: hdferr
|
||||||
character(len=*), intent(in) :: filePath
|
character(len=*), intent(in) :: filePath
|
||||||
|
|
||||||
call h5open_f(hdferr)!############################################################ DANGEROUS
|
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_openFile: h5open_f',el=hdferr)
|
|
||||||
call h5fopen_f(filePath,H5F_ACC_RDONLY_F,HDF5_openFile,hdferr)
|
call h5fopen_f(filePath,H5F_ACC_RDONLY_F,HDF5_openFile,hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_openFile: h5fopen_f',el=hdferr)
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_openFile: h5fopen_f',el=hdferr)
|
||||||
|
|
||||||
|
|
|
@ -14,18 +14,24 @@ subroutine quit(stop_id)
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
pInt
|
pInt
|
||||||
use PetscSys
|
use PetscSys
|
||||||
|
use hdf5
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: stop_id
|
integer(pInt), intent(in) :: stop_id
|
||||||
integer, dimension(8) :: dateAndTime ! type default integer
|
integer, dimension(8) :: dateAndTime ! type default integer
|
||||||
|
integer :: hdferr
|
||||||
integer(pInt) :: error = 0_pInt
|
integer(pInt) :: error = 0_pInt
|
||||||
PetscErrorCode :: ierr = 0
|
PetscErrorCode :: ierr = 0
|
||||||
|
|
||||||
|
call h5close_f(hdferr)
|
||||||
|
if (hdferr /= 0) write(6,'(a,i5)') ' Error in h5close_f',hdferr
|
||||||
|
|
||||||
call PETScFinalize(ierr)
|
call PETScFinalize(ierr)
|
||||||
CHKERRQ(ierr)
|
CHKERRQ(ierr)
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
call MPI_finalize(error)
|
call MPI_finalize(error)
|
||||||
if (error /= 0) write(6,'(a)') ' Error in MPI_finalize'
|
if (error /= 0) write(6,'(a,i5)') ' Error in MPI_finalize',error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
call date_and_time(values = dateAndTime)
|
call date_and_time(values = dateAndTime)
|
||||||
|
|
Loading…
Reference in New Issue