test_change_geom Subroutine

public subroutine test_change_geom(this)

Arguments

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

Calls

proc~~test_change_geom~~CallsGraph proc~test_change_geom test_change_geom ESMF_GeomCreate ESMF_GeomCreate proc~test_change_geom->ESMF_GeomCreate ESMF_GeomDestroy ESMF_GeomDestroy proc~test_change_geom->ESMF_GeomDestroy ESMF_GridCreateNoPeriDim ESMF_GridCreateNoPeriDim proc~test_change_geom->ESMF_GridCreateNoPeriDim ESMF_GridDestroy ESMF_GridDestroy proc~test_change_geom->ESMF_GridDestroy anyexceptions anyexceptions proc~test_change_geom->anyexceptions assert_that assert_that proc~test_change_geom->assert_that equal_to equal_to proc~test_change_geom->equal_to esmf_fieldcreate esmf_fieldcreate proc~test_change_geom->esmf_fieldcreate esmf_fielddestroy esmf_fielddestroy proc~test_change_geom->esmf_fielddestroy esmf_fieldget esmf_fieldget proc~test_change_geom->esmf_fieldget interface~mapl_fieldset MAPL_FieldSet proc~test_change_geom->interface~mapl_fieldset none~reallocate_field FieldDelta%reallocate_field proc~test_change_geom->none~reallocate_field sourcelocation sourcelocation proc~test_change_geom->sourcelocation true true proc~test_change_geom->true none~reallocate_field->esmf_fieldget esmf_arraydestroy esmf_arraydestroy none~reallocate_field->esmf_arraydestroy esmf_fieldemptycomplete esmf_fieldemptycomplete none~reallocate_field->esmf_fieldemptycomplete esmf_fieldemptyset esmf_fieldemptyset none~reallocate_field->esmf_fieldemptyset interface~fieldgetlocalelementcount FieldGetLocalElementCount none~reallocate_field->interface~fieldgetlocalelementcount interface~mapl_assert MAPL_Assert none~reallocate_field->interface~mapl_assert interface~mapl_fieldget MAPL_FieldGet none~reallocate_field->interface~mapl_fieldget proc~mapl_return MAPL_Return none~reallocate_field->proc~mapl_return proc~mapl_verify MAPL_Verify none~reallocate_field->proc~mapl_verify at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

   subroutine test_change_geom(this)
      class(ESMF_TestMethod), intent(inout) :: this
      type(ESMF_Field) :: f
      type(ESMF_Grid), target :: grid1, grid2
      type(ESMF_Geom) :: geom1, geom2

      integer :: status
      type(ESMF_FieldStatus_Flag) :: field_status
      type(ESMF_TypeKind_Flag) :: typekind
      real(kind=ESMF_KIND_R4), pointer :: x(:,:)
      type(FieldDelta) :: delta
      
      grid1 = ESMF_GridCreateNoPeriDim(maxIndex=[4,4], name='I_AM_GROOT', _RC)
      geom1 = ESMF_GeomCreate(grid1, _RC)
      f = ESMF_FieldCreate(geom1, typekind=ESMF_TYPEKIND_R4, name='in', _RC)
      call MAPL_FieldSet(f, num_levels=ORIG_VGRID_LEVELS+1, vert_staggerloc=VERTICAL_STAGGER_EDGE, _RC)

      grid2 = ESMF_GridCreateNoPeriDim(maxIndex=[3,5], name='I_AM_GROOT', _RC)
      geom2 = ESMF_GeomCreate(grid2, _RC)
      delta = FieldDelta(geom=geom2)
      call delta%reallocate_field(f, _RC)
 
      call ESMF_FieldGet(f, status=field_status, typekind=typekind, _RC)
      @assert_that(field_status == ESMF_FIELDSTATUS_COMPLETE, is(true()))
      @assert_that(typekind == ESMF_TYPEKIND_R4, is(true()))

      call ESMF_FieldGet(f, fArrayPtr=x, _RC)
      @assert_that(shape(x),is(equal_to([3,5])))

      call ESMF_FieldDestroy(f, _RC)
      call ESMF_GridDestroy(grid1, _RC)
      call ESMF_GridDestroy(grid2, _RC)
      call ESMF_GeomDestroy(geom2, _RC)

       _UNUSED_DUMMY(this)
  end subroutine test_change_geom