Write every set's solution and geometry to one HDF5 file; see the module
documentation for the layout. Without filename the file is
solution.
Collective over the global mesh communicator. Ranks with no elements of a set still take part in every dataset of that set.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(MultiSetModel3D_t), | intent(inout) | :: | this | |||
| character, | intent(in), | optional | :: | filename |
subroutine Write_MultiSetModel3D_t(this,filename)
!! Write every set's solution and geometry to one HDF5 file; see the module
!! documentation for the layout. Without filename the file is
!! solution.<ioIterate>.h5, as for a single model.
!!
!! Collective over the global mesh communicator. Ranks with no elements of a set
!! still take part in every dataset of that set.
implicit none
class(MultiSetModel3D_t),intent(inout) :: this
character(*),intent(in),optional :: filename
! Local
integer(HID_T) :: fileId
character(LEN=self_FileNameLength) :: pickupFile
character(13) :: timeStampString
character(4) :: setString
character(1) :: dimString
character(LEN=:),allocatable :: group
integer :: k,ivar,idir,elemOffset
logical :: parallel
if(present(filename)) then
pickupFile = filename
else
write(timeStampString,'(I13.13)') this%ioIterate
pickupFile = 'solution.'//timeStampString//'.h5'
endif
parallel = this%globalMesh%decomp%mpiEnabled
if(this%globalMesh%decomp%rankId == 0) then
print*,__FILE__//" : Writing pickup file : "//trim(pickupFile)
endif
if(parallel) then
call Open_HDF5(pickupFile,H5F_ACC_TRUNC_F,fileId,this%globalMesh%decomp%mpiComm)
else
call Open_HDF5(pickupFile,H5F_ACC_TRUNC_F,fileId)
endif
call this%sets(1)%model%solution%interp%WriteHDF5(fileId)
call CreateGroup_HDF5(fileId,'/elementsets')
call WriteArray_HDF5(fileId,'/elementsets/setOfElem',this%setOfElem)
do k = 1,this%nSets
write(setString,'(I4.4)') k
group = '/set_'//setString
call CreateGroup_HDF5(fileId,group)
call CreateGroup_HDF5(fileId,group//'/controlgrid')
call CreateGroup_HDF5(fileId,group//'/controlgrid/solution')
call CreateGroup_HDF5(fileId,group//'/controlgrid/geometry')
elemOffset = this%sets(k)%mesh%decomp%offsetElem(this%globalMesh%decomp%rankId+1)
call this%sets(k)%model%solution%UpdateHost()
do ivar = 1,this%sets(k)%model%solution%nVar
call WriteSetArray_HDF5(fileId, &
group//'/controlgrid/solution/'// &
trim(this%sets(k)%model%solution%meta(ivar)%name), &
this%sets(k)%model%solution%interior(:,:,:,:,ivar), &
elemOffset,this%sets(k)%mesh%nGlobalElem,parallel)
enddo
do idir = 1,3
write(dimString,'(I1)') idir
call WriteSetArray_HDF5(fileId, &
group//'/controlgrid/geometry/'// &
trim(this%sets(k)%geometry%x%meta(1)%name)//'_dim'//dimString, &
this%sets(k)%geometry%x%interior(:,:,:,:,1,idir), &
elemOffset,this%sets(k)%mesh%nGlobalElem,parallel)
enddo
enddo
call Close_HDF5(fileId)
endsubroutine Write_MultiSetModel3D_t