ESMF_LocStream_C.F90 Source File


This file depends on

sourcefile~~esmf_locstream_c.f90~~EfferentGraph sourcefile~esmf_locstream_c.f90 ESMF_LocStream_C.F90 sourcefile~esmf_array.f90 ESMF_Array.F90 sourcefile~esmf_locstream_c.f90->sourcefile~esmf_array.f90 sourcefile~esmf_arrayspec.f90 ESMF_ArraySpec.F90 sourcefile~esmf_locstream_c.f90->sourcefile~esmf_arrayspec.f90 sourcefile~esmf_base.f90 ESMF_Base.F90 sourcefile~esmf_locstream_c.f90->sourcefile~esmf_base.f90 sourcefile~esmf_locstream.f90 ESMF_LocStream.F90 sourcefile~esmf_locstream_c.f90->sourcefile~esmf_locstream.f90 sourcefile~esmf_logerr.f90 ESMF_LogErr.F90 sourcefile~esmf_locstream_c.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_utiltypes.f90 ESMF_UtilTypes.F90 sourcefile~esmf_locstream_c.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_array.f90->sourcefile~esmf_arrayspec.f90 sourcefile~esmf_array.f90->sourcefile~esmf_base.f90 sourcefile~esmf_array.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_array.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_arrayha.f90 ESMF_ArrayHa.F90 sourcefile~esmf_array.f90->sourcefile~esmf_arrayha.f90 sourcefile~esmf_delayout.f90 ESMF_DELayout.F90 sourcefile~esmf_array.f90->sourcefile~esmf_delayout.f90 sourcefile~esmf_distgrid.f90 ESMF_DistGrid.F90 sourcefile~esmf_array.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_dynamicmask.f90 ESMF_DynamicMask.F90 sourcefile~esmf_array.f90->sourcefile~esmf_dynamicmask.f90 sourcefile~esmf_f90interface.f90 ESMF_F90Interface.F90 sourcefile~esmf_array.f90->sourcefile~esmf_f90interface.f90 sourcefile~esmf_factorread.f90 ESMF_FactorRead.F90 sourcefile~esmf_array.f90->sourcefile~esmf_factorread.f90 sourcefile~esmf_initmacros.f90 ESMF_InitMacros.F90 sourcefile~esmf_array.f90->sourcefile~esmf_initmacros.f90 sourcefile~esmf_localarray.f90 ESMF_LocalArray.F90 sourcefile~esmf_array.f90->sourcefile~esmf_localarray.f90 sourcefile~esmf_rhandle.f90 ESMF_RHandle.F90 sourcefile~esmf_array.f90->sourcefile~esmf_rhandle.f90 sourcefile~esmf_vm.f90 ESMF_VM.F90 sourcefile~esmf_array.f90->sourcefile~esmf_vm.f90 sourcefile~esmf_arrayspec.f90->sourcefile~esmf_base.f90 sourcefile~esmf_arrayspec.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_arrayspec.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_arrayspec.f90->sourcefile~esmf_initmacros.f90 sourcefile~esmf_ioutil.f90 ESMF_IOUtil.F90 sourcefile~esmf_arrayspec.f90->sourcefile~esmf_ioutil.f90 sourcefile~esmf_base.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_base.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_base.f90->sourcefile~esmf_initmacros.f90 sourcefile~esmf_base.f90->sourcefile~esmf_ioutil.f90 sourcefile~esmf_base.f90->sourcefile~esmf_vm.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_array.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_arrayspec.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_base.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_arraybundle.f90 ESMF_ArrayBundle.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_arraybundle.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_delayout.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_grid.f90 ESMF_Grid.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_grid.f90 sourcefile~esmf_gridutil.f90 ESMF_GridUtil.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_gridutil.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_initmacros.f90 sourcefile~esmf_ioscrip.f90 ESMF_IOScrip.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_ioscrip.f90 sourcefile~esmf_iougrid.f90 ESMF_IOUGrid.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_iougrid.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_ioutil.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_localarray.f90 sourcefile~esmf_mesh.f90 ESMF_Mesh.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_mesh.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_rhandle.f90 sourcefile~esmf_staggerloc.f90 ESMF_StaggerLoc.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_staggerloc.f90 sourcefile~esmf_util.f90 ESMF_Util.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_util.f90 sourcefile~esmf_locstream.f90->sourcefile~esmf_vm.f90 sourcefile~esmf_logerr.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_logerr.f90->sourcefile~esmf_ioutil.f90 sourcefile~esmf_utilstring.f90 ESMF_UtilString.F90 sourcefile~esmf_logerr.f90->sourcefile~esmf_utilstring.f90

Source Code

!  $Id$
!
! Earth System Modeling Framework
! Copyright (c) 2002-2025, University Corporation for Atmospheric Research, 
! Massachusetts Institute of Technology, Geophysical Fluid Dynamics 
! Laboratory, University of Michigan, National Centers for Environmental 
! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, 
! NASA Goddard Space Flight Center.
! Licensed under the University of Illinois-NCSA License.
!
!==============================================================================
!
! F77 interface files for C++ layer calling into F90 implementation layer.
!  This cannot use any F90 syntax, including modules, or allocatable 
!   arrays, or ...
!
!==============================================================================
#define ESMF_FILENAME "ESMF_LocStream_C.F90"
!
!------------------------------------------------------------------------------
! INCLUDES
#include "ESMF.h"
!==============================================================================
!------------------------------------------------------------------------------
! The following line turns the CVS identifier string into a printable variable.
!      character(*), parameter, private :: version = &
!      '$Id$'
!==============================================================================

#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_locstreamcreate"
  subroutine f_esmf_locstreamcreate(locstream, ls_size, indexflag, coordSys, rc)

    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_LocStreamMod

    implicit none

    ! arguments
    type(ESMF_LocStream)               :: locstream
    integer, intent(in)           :: ls_size
    type(ESMF_Index_Flag), optional :: indexflag
    type(ESMF_CoordSys_Flag), optional :: coordSys
    integer, intent(out)           :: rc              
  
    ! local variables  
  
    ! initialize return code; assume routine not implemented
    rc = ESMF_RC_NOT_IMPL

    locstream=ESMF_LocStreamCreate(localCount=ls_size, &
                                   coordSys=coordSys, &
                                   indexflag=indexflag, rc=rc)
    if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
                           ESMF_CONTEXT, rcToReturn=rc)) return

    rc = ESMF_SUCCESS
  
  end subroutine f_esmf_locstreamcreate


#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_locstreamgetbounds"
  subroutine f_esmf_locstreamgetbounds(locstream, localDe, cLBound, cUBound, rc)

    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_LocStreamMod

    implicit none

    type(ESMF_LocStream) :: locstream
    integer              :: localDe
    integer              :: cLBound
    integer              :: cUBound
    integer, intent(out) :: rc

  ! initialize return code; assume routine not implemented
    rc = ESMF_RC_NOT_IMPL

    call ESMF_LocStreamGetBounds(locstream, localDe=localDe, &
      computationalLBound=cLBound, computationalUBound=cUBound, rc=rc)
    if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    rc = ESMF_SUCCESS

  end subroutine f_esmf_locstreamgetbounds


#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_locstreamaddkeyalloc"
  subroutine f_esmf_locstreamaddkeyalloc(locstream, keyName, typekind, rc)

    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_LocStreamMod

    implicit none

    type(ESMF_LocStream)         :: locstream
    character(len=*),intent(in)  :: keyName
    type(ESMF_TypeKind_Flag),optional     :: typekind
    integer, intent(out)         :: rc

  ! initialize return code; assume routine not implemented
    rc = ESMF_RC_NOT_IMPL

    call ESMF_LocStreamAddKey(locstream, keyName=keyName, keyTypeKind=typekind, rc=rc)
    if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    rc = ESMF_SUCCESS

  end subroutine f_esmf_locstreamaddkeyalloc


#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_locstreamgetkeyarray"
  subroutine f_esmf_locstreamgetkeyarray(locstream, keyName, array, rc)

    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_ArraySpecMod
    use ESMF_ArrayMod
    use ESMF_LocStreamMod

    implicit none

    type(ESMF_LocStream)         :: locstream
    character(len=*),intent(in)  :: keyName
    type(ESMF_Array)             :: array
    integer, intent(out)         :: rc

    ! local
    type(ESMF_Array)               :: l_array

  ! initialize return code; assume routine not implemented
    rc = ESMF_RC_NOT_IMPL

    call ESMF_LocStreamGetKey(locstream, keyName=keyName, keyArray=l_array, rc=rc)
    if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! because ESMF_Array.this is private, it cannot be accessed directly
    ! we use the public interface to do the ptr copy;
    ! the array object returned to the C interface must consist only of the
    ! this pointer. It must not contain the isInit member.
    call ESMF_ArrayCopyThis(l_array, array, rc)
    if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    rc = ESMF_SUCCESS

  end subroutine f_esmf_locstreamgetkeyarray

#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_locstreamdestroy"
  subroutine f_esmf_locstreamdestroy(locstream, rc)

    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_LocStreamMod

    implicit none

    type(ESMF_LocStream)               :: locstream
    integer, intent(out)           :: rc

  ! initialize return code; assume routine not implemented
    rc = ESMF_RC_NOT_IMPL

    call ESMF_LocStreamDestroy(locstream, rc=rc)
    if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    rc = ESMF_SUCCESS

  end subroutine f_esmf_locstreamdestroy

  subroutine f_esmf_locstreamcollectgarbage(locstream, rc)
#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_fieldcollectgarbage()"
    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_LocStreamMod

    implicit none

    type(ESMF_LocStream) :: locstream
    integer, intent(out) :: rc     
  
    integer :: localrc              
  
    ! initialize return code; assume routine not implemented
    localrc = ESMF_RC_NOT_IMPL
    rc = ESMF_RC_NOT_IMPL
  
    !print *, "collecting LocStream garbage"
  
    ! destruct internal data allocations
    call ESMF_LocStreamDestruct(locstream%lstypep, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! deallocate actual LocStreamType allocation
    if (associated(locstream%lstypep)) then
      deallocate(locstream%lstypep, stat=localrc)
      if (ESMF_LogFoundDeallocError(localrc, msg="Deallocating LocStream", &
        ESMF_CONTEXT, rcToReturn=rc)) return
    endif
    nullify(locstream%lstypep)

    ! return successfully
    rc = ESMF_SUCCESS

  end subroutine f_esmf_locstreamcollectgarbage