test_arithmetic_3d Subroutine

public subroutine test_arithmetic_3d(this)

Arguments

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

Calls

proc~~test_arithmetic_3d~~CallsGraph proc~test_arithmetic_3d test_arithmetic_3d assertequal assertequal proc~test_arithmetic_3d->assertequal esmf_fieldget esmf_fieldget proc~test_arithmetic_3d->esmf_fieldget proc~mapl_return MAPL_Return proc~test_arithmetic_3d->proc~mapl_return proc~mapl_stateeval MAPL_StateEval proc~test_arithmetic_3d->proc~mapl_stateeval proc~mapl_verify MAPL_Verify proc~test_arithmetic_3d->proc~mapl_verify

Source Code

   subroutine test_arithmetic_3d(this)
      class(ESMF_TestMethod), intent(inout) :: this

      integer :: status, rc
      real(ESMF_KIND_R4), pointer :: ptr3d(:,:,:), extra_ptr(:,:,:)
      real(ESMF_KIND_R4), allocatable :: expected_array(:,:,:)
      real(ESMF_KIND_R4) :: rval
      character(len=:), allocatable :: expr

      call ESMF_FieldGet(extra_3d, 0, farrayPtr=extra_ptr, _RC)
      call ESMF_FieldGet(field_3d, 0, farrayPtr=ptr3d, _RC)
      expr = "field_3d+2.0*sqrt(extra_3d)"
      rval = 17.0 
      ptr3d = rval
      rval = 16.0
      extra_ptr = rval
      allocate(expected_array(3,3,2),_STAT)
      expected_array = 17.0 + 2.0*sqrt(16.0) 
      call  MAPL_StateEval(state, expr, field_3d, _RC)
      @assertEqual(expected_array, ptr3d)
      _RETURN(_SUCCESS)

   end subroutine test_arithmetic_3d