Updates the dimensional extents of the block.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
impure subroutine block_obj_UpdateExtents(this) !> Updates the dimensional extents of the block. implicit none class(block_obj), intent(inout) :: this !! A block object ! Work variables integer :: dir integer :: hi_b,lo_b,i_b integer :: Nblock(3) integer :: nsize real(wp), & allocatable :: buff(:) associate (lo => this%lo, hi => this%hi, ngc=> this%ngc,& axis => this%axis) do dir=1,3 this%xhi(dir) = axis(dir)%x(hi(dir)+1) this%xlo(dir) = axis(dir)%x(lo(dir) ) end do end associate if (this%is_partitioned) then do dir=1,3 ! High/low bounds and index of current block lo_b = 1 hi_b = this%parallel%np(dir) i_b = this%parallel%rank%dir(dir) ! Initialize partition axis call this%axis_partition(dir)%Initialize(lo_b,hi_b,ngc=0) ! Add values ! - Low bound this%axis_partition(dir)%x(i_b) = this%xlo(dir) ! - High bound if (i_b.eq.hi_b) this%axis_partition(dir)%x(i_b+1) = this%xhi(dir) Nblock = this%parallel%np Nblock(dir) = 1 nsize = Nblock(1)*Nblock(2)*Nblock(3) allocate(buff(hi_b + 1)) call this%parallel%Sum(this%axis_partition(dir)%x,buff) this%axis_partition(dir)%x=buff/nsize deallocate(buff) end do else do dir=1,3 ! High/low bounds and index of current block lo_b = 1 hi_b = 1 i_b = 1 ! Initialize partition axis call this%axis_partition(dir)%Initialize(lo_b,hi_b,ngc=0) this%axis_partition(dir)%x(i_b) = this%xlo(dir) this%axis_partition(dir)%x(i_b+1) = this%xhi(dir) end do end if ! Global min and max do dir=1,3 this%pmin(dir) = minval(this%axis_partition(dir)%x(:)) this%pmax(dir) = maxval(this%axis_partition(dir)%x(:)) end do ! Convenience min and max this%xmin = this%pmin(1); this%xmax = this%pmax(1) this%ymin = this%pmin(2); this%ymax = this%pmax(2) this%zmin = this%pmin(3); this%zmax = this%pmax(3) return end subroutine block_obj_UpdateExtents