Reads block data using HDF5.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
||
| character(len=*), | intent(in) | :: | name |
Name of file to write |
impure subroutine block_obj_Read(this,name) !> Reads block data using HDF5. implicit none class(block_obj), intent(inout) :: this !! A block object character(len=*), intent(in) :: name !! Name of file to write ! Work variables type(hdf5_obj), & pointer :: hdf5 type(hdf5_obj), & target :: hdf5t integer :: Ng(3) integer :: dir character(len=2):: label ! Use internal pointer, if associated. ! Otherwise, use a new object. if (associated(this%hdf5)) then hdf5 => this%hdf5 else call hdf5t%Initialize(this%parallel) hdf5 => hdf5t end if ! Open file call hdf5%Open(trim(adjustl(name)),'R') associate (lo => this%lo, hi => this%hi, periods => this%periods) ! Get periodicity and number of grid points call hdf5%ReadAttributes('/','Periodicity',periods) call hdf5%ReadAttributes('/','Ng', Ng ) ! Set bounds lo = 1 hi = Ng ! Initialize axes do dir=1,3 call this%axis(dir)%Initialize(this%lo(dir),this%hi(dir),this%ngc) end do ! Associate pointers call this%SetConveniencePointers ! Read coordinates from file do dir=1,3 ! Form label for this axis: x1, x2, x3 write(label,fmt='(a,i1)') 'x',dir ! Read coordinates call hdf5%ReadCoord('/',label,this%axis(dir)%x(lo(dir):hi(dir)+1)) end do end associate ! Close file call hdf5%Close() ! Free data if (associated(this%hdf5)) then hdf5 => null() else call hdf5t%Finalize() hdf5 => null() end if ! Update values within ghostcells call this%UpdateGridGhostCells() ! Update mid points (xm) call this%UpdateMidPoints() ! Update spacing (dxm) call this%UpdateSpacing() ! Create MPI type for ghostcell communication call this%SetupMPITypes() return end subroutine block_obj_Read