parent
0e0bc07b8d
commit
2923f639da
259
src/results.f90
259
src/results.f90
|
@ -793,263 +793,4 @@ character(len=24) function now()
|
||||||
|
|
||||||
end function now
|
end function now
|
||||||
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!!> @brief adds the backward mapping from spatial position and constituent ID to results
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!subroutine HDF5_backwardMappingPhase(material_phase,phasememberat,phase_name,dataspace_size,mpiOffset,mpiOffset_phase)
|
|
||||||
|
|
||||||
! integer(pInt), intent(in), dimension(:,:,:) :: material_phase, phasememberat
|
|
||||||
! character(len=*), intent(in), dimension(:) :: phase_name
|
|
||||||
! integer(pInt), intent(in), dimension(:) :: dataspace_size, mpiOffset_phase
|
|
||||||
! integer(pInt), intent(in) :: mpiOffset
|
|
||||||
|
|
||||||
! integer(pInt) :: hdferr, NmatPoints, Nconstituents, i, j
|
|
||||||
! integer(HID_T) :: mapping_id, dtype_id, dset_id, space_id, position_id, plist_id, memspace
|
|
||||||
! integer(SIZE_T) :: type_size
|
|
||||||
|
|
||||||
! integer(pInt), dimension(:,:), allocatable :: arr
|
|
||||||
|
|
||||||
! integer(HSIZE_T), dimension(1) :: counter
|
|
||||||
! integer(HSSIZE_T), dimension(1) :: fileOffset
|
|
||||||
|
|
||||||
! character(len=64) :: phaseID
|
|
||||||
|
|
||||||
! Nconstituents = size(phasememberat,1)
|
|
||||||
! NmatPoints = count(material_phase /=0)/Nconstituents
|
|
||||||
|
|
||||||
! allocate(arr(2,NmatPoints*Nconstituents))
|
|
||||||
|
|
||||||
! do i=1, NmatPoints
|
|
||||||
! do j=Nconstituents-1, 0, -1
|
|
||||||
! arr(1,Nconstituents*i-j) = i-1
|
|
||||||
! enddo
|
|
||||||
! enddo
|
|
||||||
! arr(2,:) = pack(material_phase,material_phase/=0)
|
|
||||||
|
|
||||||
! do i=1, size(phase_name)
|
|
||||||
! write(phaseID, '(i0)') i
|
|
||||||
! mapping_ID = results_openGroup('/current/constitutive/'//trim(phaseID)//'_'//phase_name(i))
|
|
||||||
! NmatPoints = count(material_phase == i)
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! create dataspace
|
|
||||||
! call h5screate_simple_f(1, int([dataspace_size(i)],HSIZE_T), space_id, hdferr, &
|
|
||||||
! int([dataspace_size(i)],HSIZE_T))
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='HDF5_writeBackwardMapping')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! compound type
|
|
||||||
! call h5tget_size_f(H5T_STD_I32LE, type_size, hdferr)
|
|
||||||
! call h5tcreate_f(H5T_COMPOUND_F, type_size, dtype_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='HDF5_writeBackwardMapping: h5tcreate_f dtype_id')
|
|
||||||
|
|
||||||
! call h5tinsert_f(dtype_id, "Position", 0_SIZE_T, H5T_STD_I32LE, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5tinsert_f 0')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! create Dataset
|
|
||||||
! call h5dcreate_f(mapping_id, 'mapGeometry', dtype_id, space_id, dset_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! Create memory types (one compound datatype for each member)
|
|
||||||
! call h5tcreate_f(H5T_COMPOUND_F, int(pInt,SIZE_T), position_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5tcreate_f position_id')
|
|
||||||
! call h5tinsert_f(position_id, "Position", 0_SIZE_T, H5T_STD_I32LE, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5tinsert_f position_id')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! Define and select hyperslabs
|
|
||||||
! counter = NmatPoints ! how big i am
|
|
||||||
! fileOffset = mpiOffset_phase(i) ! where i start to write my data
|
|
||||||
|
|
||||||
! call h5screate_simple_f(1, counter, memspace, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5screate_simple_f')
|
|
||||||
! call h5dget_space_f(dset_id, space_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5dget_space_f')
|
|
||||||
! call h5sselect_hyperslab_f(space_id, H5S_SELECT_SET_F, fileOffset, counter, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5sselect_hyperslab_f')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! Create property list for collective dataset write
|
|
||||||
!#ifdef PETSc
|
|
||||||
! call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5pcreate_f')
|
|
||||||
! call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5pset_dxpl_mpio_f')
|
|
||||||
!#endif
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! write data by fields in the datatype. Fields order is not important.
|
|
||||||
! call h5dwrite_f(dset_id, position_id, pack(arr(1,:),arr(2,:)==i)+mpiOffset, int([dataspace_size(i)],HSIZE_T),&
|
|
||||||
! hdferr, file_space_id = space_id, mem_space_id = memspace, xfer_prp = plist_id)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5dwrite_f instance_id')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! !close types, dataspaces
|
|
||||||
! call h5tclose_f(dtype_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5tclose_f dtype_id')
|
|
||||||
! call h5tclose_f(position_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5tclose_f position_id')
|
|
||||||
! call h5dclose_f(dset_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5dclose_f')
|
|
||||||
! call h5sclose_f(space_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5sclose_f space_id')
|
|
||||||
! call h5sclose_f(memspace, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5sclose_f memspace')
|
|
||||||
! call h5pclose_f(plist_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingPhase: h5pclose_f')
|
|
||||||
! call HDF5_closeGroup(mapping_ID)
|
|
||||||
|
|
||||||
! enddo
|
|
||||||
|
|
||||||
!end subroutine HDF5_backwardMappingPhase
|
|
||||||
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!!> @brief adds the backward mapping from spatial position and constituent ID to results
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!subroutine HDF5_backwardMappingHomog(material_homog,homogmemberat,homogenization_name,dataspace_size,mpiOffset,mpiOffset_homog)
|
|
||||||
|
|
||||||
! integer(pInt), intent(in), dimension(:,:) :: material_homog, homogmemberat
|
|
||||||
! character(len=*), intent(in), dimension(:) :: homogenization_name
|
|
||||||
! integer(pInt), intent(in), dimension(:) :: dataspace_size, mpiOffset_homog
|
|
||||||
! integer(pInt), intent(in) :: mpiOffset
|
|
||||||
|
|
||||||
! integer(pInt) :: hdferr, NmatPoints, i
|
|
||||||
! integer(HID_T) :: mapping_id, dtype_id, dset_id, space_id, position_id, plist_id, memspace
|
|
||||||
! integer(SIZE_T) :: type_size
|
|
||||||
|
|
||||||
! integer(pInt), dimension(:,:), allocatable :: arr
|
|
||||||
|
|
||||||
! integer(HSIZE_T), dimension(1) :: counter
|
|
||||||
! integer(HSSIZE_T), dimension(1) :: fileOffset
|
|
||||||
|
|
||||||
! character(len=64) :: homogID
|
|
||||||
|
|
||||||
! NmatPoints = count(material_homog /=0)
|
|
||||||
! allocate(arr(2,NmatPoints))
|
|
||||||
|
|
||||||
! arr(1,:) = (/(i, i=0,NmatPoints-1)/)
|
|
||||||
! arr(2,:) = pack(material_homog,material_homog/=0)
|
|
||||||
|
|
||||||
! do i=1, size(homogenization_name)
|
|
||||||
! write(homogID, '(i0)') i
|
|
||||||
! mapping_ID = results_openGroup('/current/homogenization/'//trim(homogID)//'_'//homogenization_name(i))
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! create dataspace
|
|
||||||
! call h5screate_simple_f(1, int([dataspace_size(i)],HSIZE_T), space_id, hdferr, &
|
|
||||||
! int([dataspace_size(i)],HSIZE_T))
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='HDF5_writeBackwardMapping')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! compound type
|
|
||||||
! call h5tget_size_f(H5T_STD_I32LE, type_size, hdferr)
|
|
||||||
! call h5tcreate_f(H5T_COMPOUND_F, type_size, dtype_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='HDF5_writeBackwardMapping: h5tcreate_f dtype_id')
|
|
||||||
|
|
||||||
! call h5tinsert_f(dtype_id, "Position", 0_SIZE_T, H5T_STD_I32LE, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5tinsert_f 0')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! create Dataset
|
|
||||||
! call h5dcreate_f(mapping_id, 'mapGeometry', dtype_id, space_id, dset_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! Create memory types (one compound datatype for each member)
|
|
||||||
! call h5tcreate_f(H5T_COMPOUND_F, int(pInt,SIZE_T), position_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5tcreate_f position_id')
|
|
||||||
! call h5tinsert_f(position_id, "Position", 0_SIZE_T, H5T_STD_I32LE, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5tinsert_f position_id')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! Define and select hyperslabs
|
|
||||||
! counter = NmatPoints ! how big i am
|
|
||||||
! fileOffset = mpiOffset_homog(i) ! where i start to write my data
|
|
||||||
|
|
||||||
! call h5screate_simple_f(1, counter, memspace, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5screate_simple_f')
|
|
||||||
! call h5dget_space_f(dset_id, space_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5dget_space_f')
|
|
||||||
! call h5sselect_hyperslab_f(space_id, H5S_SELECT_SET_F, fileOffset, counter, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5sselect_hyperslab_f')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! Create property list for collective dataset write
|
|
||||||
!#ifdef PETSc
|
|
||||||
! call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5pcreate_f')
|
|
||||||
! call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5pset_dxpl_mpio_f')
|
|
||||||
!#endif
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! ! write data by fields in the datatype. Fields order is not important.
|
|
||||||
! call h5dwrite_f(dset_id, position_id, pack(arr(1,:),arr(2,:)==i)+mpiOffset,int([dataspace_size(i)],HSIZE_T),&
|
|
||||||
! hdferr, file_space_id = space_id, mem_space_id = memspace, xfer_prp = plist_id)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5dwrite_f instance_id')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
! !close types, dataspaces
|
|
||||||
! call h5tclose_f(dtype_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5tclose_f dtype_id')
|
|
||||||
! call h5tclose_f(position_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5tclose_f position_id')
|
|
||||||
! call h5dclose_f(dset_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5dclose_f')
|
|
||||||
! call h5sclose_f(space_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5sclose_f space_id')
|
|
||||||
! call h5sclose_f(memspace, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5sclose_f memspace')
|
|
||||||
! call h5pclose_f(plist_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_backwardMappingHomog: h5pclose_f')
|
|
||||||
! call HDF5_closeGroup(mapping_ID)
|
|
||||||
|
|
||||||
! enddo
|
|
||||||
|
|
||||||
!end subroutine HDF5_backwardMappingHomog
|
|
||||||
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!!> @brief adds the unique cell to node mapping
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!subroutine HDF5_mappingCells(mapping)
|
|
||||||
|
|
||||||
! integer(pInt), intent(in), dimension(:) :: mapping
|
|
||||||
|
|
||||||
! integer :: hdferr, Nnodes
|
|
||||||
! integer(HID_T) :: mapping_id, dset_id, space_id
|
|
||||||
|
|
||||||
! Nnodes=size(mapping)
|
|
||||||
! mapping_ID = results_openGroup("mapping")
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!! create dataspace
|
|
||||||
! call h5screate_simple_f(1, int([Nnodes],HSIZE_T), space_id, hdferr, &
|
|
||||||
! int([Nnodes],HSIZE_T))
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_mappingCells: h5screate_simple_f')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!! create Dataset
|
|
||||||
! call h5dcreate_f(mapping_id, "Cell",H5T_NATIVE_INTEGER, space_id, dset_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_mappingCells')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!! write data by fields in the datatype. Fields order is not important.
|
|
||||||
! call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, mapping, int([Nnodes],HSIZE_T), hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_mappingCells: h5dwrite_f instance_id')
|
|
||||||
|
|
||||||
!!--------------------------------------------------------------------------------------------------
|
|
||||||
!!close types, dataspaces
|
|
||||||
! call h5dclose_f(dset_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_mappingConstitutive: h5dclose_f')
|
|
||||||
! call h5sclose_f(space_id, hdferr)
|
|
||||||
! if (hdferr < 0) call IO_error(1,ext_msg='IO_mappingConstitutive: h5sclose_f')
|
|
||||||
! call HDF5_closeGroup(mapping_ID)
|
|
||||||
|
|
||||||
!end subroutine HDF5_mappingCells
|
|
||||||
|
|
||||||
end module results
|
end module results
|
||||||
|
|
Loading…
Reference in New Issue