Write a single Eulerian object to file using H5HUT.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(eulerian_set), | intent(inout) | :: | this |
An Eulerian Set |
||
| type(h5hut_obj), | intent(inout) | :: | h5 |
H5hut structure |
||
| integer, | intent(in) | :: | ind |
Index of Eulerian object |
impure subroutine eulerian_set_WriteSingleH5HUT(this,h5,ind) !> Write a single Eulerian object to file using H5HUT. implicit none class(eulerian_set), intent(inout) :: this !! An Eulerian Set type(h5hut_obj), intent(inout) :: h5 !! H5hut structure integer, intent(in) :: ind !! Index of Eulerian object ! Work variables real(wp),allocatable :: buff_r(:,:,:) !! Buffer to write integer, allocatable :: buff_i(:,:,:) !! Buffer to write real(wp) :: shift(3) !! Shift to account for staggering real(wp) :: origin(3) !! Absolute origin ! Get grid origin and displacement origin=this%block%pmin ! Write grid attributes shift=0.5_wp*this%block%dx select case(this%field(ind)%p%staggering) case (0) ! cell centered ! Do nothing case (1) ! X1-face centered shift(1)=0.0_wp case (2) ! X2-face centered shift(2)=0.0_wp case (3) ! X3-face centered shift(3)=0.0_wp end select associate (lo => this%block%lo, hi => this%block%hi, ngc=> this%block%ngc) select type (my_field=>this%field(ind)%p) type is (eulerian_obj_r) ! Allocate buffer allocate(buff_r(lo(1):hi(1), lo(2):hi(2), lo(3):hi(3))) ! Write data buff_r = my_field%cell(lo(1):hi(1), lo(2):hi(2), lo(3):hi(3)) call h5%Write(my_field%name,buff_r,lo,hi) deallocate(buff_r) type is (eulerian_obj_i) ! Allocate buffer allocate(buff_i(lo(1):hi(1), lo(2):hi(2), lo(3):hi(3))) ! Write data buff_i = my_field%cell(lo(1):hi(1), lo(2):hi(2), lo(3):hi(3)) call h5%Write(my_field%name,buff_i,lo,hi) deallocate(buff_i) end select end associate ! Write grid attributes call h5%WriteGrid(this%field(ind)%p%name,origin+shift,this%block%dx) return end subroutine eulerian_set_WriteSingleH5HUT