test_shape Subroutine

public subroutine test_shape(this)

Arguments

Type IntentOptional Attributes Name
class(Test_LatLonGridFactory), intent(inout) :: this

Calls

proc~~test_shape~2~~CallsGraph proc~test_shape~2 test_shape ESMF_GridGetCoord ESMF_GridGetCoord proc~test_shape~2->ESMF_GridGetCoord anyexceptions anyexceptions proc~test_shape~2->anyexceptions assert_that assert_that proc~test_shape~2->assert_that ims ims proc~test_shape~2->ims jms jms proc~test_shape~2->jms mpiassertequal mpiassertequal proc~test_shape~2->mpiassertequal mpiasserttrue mpiasserttrue proc~test_shape~2->mpiasserttrue none~getlocalpet ESMF_TestCase%getLocalPET proc~test_shape~2->none~getlocalpet sourcelocation sourcelocation proc~test_shape~2->sourcelocation ESMF_VMGet ESMF_VMGet none~getlocalpet->ESMF_VMGet none~getvm ESMF_TestCase%getVM none~getlocalpet->none~getvm ESMF_GridCompGet ESMF_GridCompGet none~getvm->ESMF_GridCompGet

Source Code

   subroutine test_shape(this)
      class (Test_LatLonGridFactory), intent(inout) :: this

      integer :: status
      integer, parameter :: SUCCESS = 0
      real(ESMF_KIND_R8), pointer :: centers(:,:)

      integer :: petX, petY

      select type (p => this%testParameter)
      type is (GridCase)
         petX = mod(this%getLocalPET(), p%nx)
         petY = this%getLocalPET() / p%nx

         @mpiAssertTrue(petX >= 0)
         @mpiAssertTrue(petX < size(p%ims))
         @mpiAssertTrue(petY >= 0)
         @mpiAssertTrue(petY < size(p%jms))
      end select

      ! X
      call ESMF_GridGetCoord(this%grid, coordDim=1, staggerLoc=ESMF_STAGGERLOC_CENTER, &
           & farrayPtr=centers, _RC)

      select type (p => this%testparameter)
      type is (GridCase)
         @mpiAssertEqual([p%ims(petX+1),p%jms(petY+1)], shape(centers), message='Wrong shape.')
      end select

      ! Y
      call ESMF_GridGetCoord(this%grid, coordDim=2, staggerLoc=ESMF_STAGGERLOC_CENTER, &
           & farrayPtr=centers, _RC)

      select type (p => this%testparameter)
      type is (GridCase)
         @mpiAssertEqual([p%ims(petX+1),p%jms(petY+1)], shape(centers), message='Wrong shape.')
      end select
      
   end subroutine test_shape