2 ! Earth System Modeling Framework
3 ! Copyright 2002-2003, University Corporation for Atmospheric Research,
4 ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
5 ! Laboratory, University of Michigan, National Centers for Environmental
6 ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
7 ! NASA Goddard Space Flight Center.
8 ! Licensed under the University of Illinois-NCSA license.
12 ! (all lines between the !BOP and !EOP markers will be included in the
13 ! automated document processing.)
14 !------------------------------------------------------------------------------
16 !------------------------------------------------------------------------------
22 ! !MODULE: ESMF_BaseMod - Base class for all ESMF classes
26 ! The code in this file implements the Base defined type
27 ! and functions which operate on all types. This is an
28 ! interface to the actual C++ base class implementation in the ../src dir.
30 ! See the ESMF Developers Guide document for more details.
32 !------------------------------------------------------------------------------
40 !------------------------------------------------------------------------------
42 ! Global integer parameters, used frequently
44 integer, parameter :: ESMF_SUCCESS = 0, ESMF_FAILURE = -1
45 integer, parameter :: ESMF_MAXSTR = 128
46 integer, parameter :: ESMF_MAXDIM = 7, &
47 ESMF_MAXDECOMPDIM=3, &
50 integer, parameter :: ESMF_MAJOR_VERSION = 2
51 integer, parameter :: ESMF_MINOR_VERSION = 1
52 integer, parameter :: ESMF_REVISION = 1
53 integer, parameter :: ESMF_PATCHLEVEL = 0
54 character(32), parameter :: ESMF_VERSION_STRING = "2.1.1"
56 !------------------------------------------------------------------------------
63 type(ESMF_Status), parameter :: ESMF_STATE_UNINIT = ESMF_Status(1), &
64 ESMF_STATE_READY = ESMF_Status(2), &
65 ESMF_STATE_UNALLOCATED = ESMF_Status(3), &
66 ESMF_STATE_ALLOCATED = ESMF_Status(4), &
67 ESMF_STATE_BUSY = ESMF_Status(5), &
68 ESMF_STATE_INVALID = ESMF_Status(6)
70 !------------------------------------------------------------------------------
77 type(ESMF_Pointer), parameter :: ESMF_NULL_POINTER = ESMF_Pointer(0), &
78 ESMF_BAD_POINTER = ESMF_Pointer(-1)
81 !------------------------------------------------------------------------------
83 !! TODO: I believe if we define an assignment(=) operator to convert
84 !! a datatype into integer, then we could use the type and kind as
85 !! targets in a select case() statement and make the contents private.
86 !! (see pg 248 of the "big book")
92 type(ESMF_DataType), parameter :: ESMF_DATA_INTEGER = ESMF_DataType(1), &
93 ESMF_DATA_REAL = ESMF_DataType(2), &
94 ESMF_DATA_LOGICAL = ESMF_DataType(3), &
95 ESMF_DATA_CHARACTER = ESMF_DataType(4)
97 !------------------------------------------------------------------------------
99 integer, parameter :: &
100 ESMF_KIND_I1 = selected_int_kind(2), &
101 ESMF_KIND_I2 = selected_int_kind(4), &
102 ESMF_KIND_I4 = selected_int_kind(9), &
103 ESMF_KIND_I8 = selected_int_kind(18), &
104 ESMF_KIND_R4 = selected_real_kind(3,25), &
105 ESMF_KIND_R8 = selected_real_kind(6,45), &
106 ESMF_KIND_C8 = selected_real_kind(3,25), &
107 ESMF_KIND_C16 = selected_real_kind(6,45)
109 !------------------------------------------------------------------------------
113 type(ESMF_DataType) :: dt
115 ! how do you do values of all types here ? TODO
116 ! in C++ i'd do a union w/ overloaded access funcs
118 !integer, dimension (:), pointer :: vip
120 !real, dimension (:), pointer :: vrp
122 !logical, pointer :: vlp
123 !character (len=ESMF_MAXSTR) :: vc
124 !character, pointer :: vcp
127 !------------------------------------------------------------------------------
131 character (len=ESMF_MAXSTR) :: attr_name
132 type (ESMF_DataType) :: attr_type
133 type (ESMF_DataValue) :: attr_value
136 !------------------------------------------------------------------------------
138 !! TODO: this should be a shallow object, with a simple init() and
139 !! get() function, and the contents should go back to being private.
149 !! TODO: same comment as above.
158 !------------------------------------------------------------------------------
160 type ESMF_BasePointer
162 integer*8 :: base_ptr
165 integer :: global_count = 0
167 !------------------------------------------------------------------------------
169 ! ! WARNING: must match corresponding values in ../include/ESMC_Base.h
175 type(ESMF_Logical), parameter :: ESMF_TF_UNKNOWN = ESMF_Logical(1), &
176 ESMF_TF_TRUE = ESMF_Logical(2), &
177 ESMF_TF_FALSE = ESMF_Logical(3)
179 !------------------------------------------------------------------------------
185 type (ESMF_Status) :: base_status
186 character (len=ESMF_MAXSTR) :: name
191 public ESMF_STATE_INVALID
192 ! public ESMF_STATE_UNINIT, ESMF_STATE_READY, &
193 ! ESMF_STATE_UNALLOCATED, ESMF_STATE_ALLOCATED, &
196 public ESMF_DATA_INTEGER, ESMF_DATA_REAL, &
197 ESMF_DATA_LOGICAL, ESMF_DATA_CHARACTER
199 public ESMF_KIND_I1, ESMF_KIND_I2, ESMF_KIND_I4, ESMF_KIND_I8, &
200 ESMF_KIND_R4, ESMF_KIND_R8, ESMF_KIND_C8, ESMF_KIND_C16
202 public ESMF_NULL_POINTER, ESMF_BAD_POINTER
205 public ESMF_FAILURE, ESMF_SUCCESS
207 public ESMF_MAXDIM, ESMF_MAXDECOMPDIM, ESMF_MAXGRIDDIM
209 public ESMF_MAJOR_VERSION, ESMF_MINOR_VERSION, ESMF_REVISION
210 public ESMF_VERSION_STRING
212 public ESMF_Status, ESMF_Pointer, ESMF_DataType
213 public ESMF_DataValue, ESMF_Attribute
214 ! public ESMF_MemIndex
215 ! public ESMF_BasePointer
218 public ESMF_AxisIndex, ESMF_AxisIndexGet
219 ! public ESMF_AxisIndexInit
221 ! public ESMF_TF_TRUE, ESMF_TF_FALSE
223 ! !PUBLIC MEMBER FUNCTIONS:
226 ! The following routines apply to any type in the system.
227 ! The attribute routines can be inherited as-is. The other
228 ! routines need to be specialized by the higher level objects.
231 ! public ESMF_BaseInit
233 ! public ESMF_BaseGetConfig
234 ! public ESMF_BaseSetConfig
236 ! public ESMF_BaseGetInstCount
238 ! public ESMF_BaseSetID
239 ! public ESMF_BaseGetID
241 ! public ESMF_BaseSetRefCount
242 ! public ESMF_BaseGetRefCount
244 ! public ESMF_BaseSetStatus
245 ! public ESMF_BaseGetStatus
247 ! Virtual methods to be defined by derived classes
250 ! public ESMF_Validate
254 public ESMF_AttributeSet
255 public ESMF_AttributeGet
256 public ESMF_AttributeGetCount
257 public ESMF_AttributeGetbyNumber
258 public ESMF_AttributeGetNameList
259 public ESMF_AttributeSetList
260 public ESMF_AttributeGetList
261 public ESMF_AttributeSetObjectList
262 public ESMF_AttributeGetObjectList
263 public ESMF_AttributeCopy
264 public ESMF_AttributeCopyAll
269 public ESMF_SetPointer
270 public ESMF_SetNullPointer
271 public ESMF_GetPointer
273 ! Print methods for calling by higher level print functions
274 ! (they have little formatting other than the actual values)
275 public ESMF_StatusString, ESMF_DataTypeString
277 ! Overloaded = operator functions
278 public operator(.eq.), operator(.ne.), assignment(=)
283 !------------------------------------------------------------------------------
285 ! overload .eq. & .ne. with additional derived types so you can compare
286 ! them as if they were simple integers.
289 interface operator (.eq.)
290 module procedure ESMF_sfeq
291 module procedure ESMF_dteq
292 module procedure ESMF_pteq
293 module procedure ESMF_tfeq
294 module procedure ESMF_aieq
297 interface operator (.ne.)
298 module procedure ESMF_sfne
299 module procedure ESMF_dtne
300 module procedure ESMF_ptne
301 module procedure ESMF_tfne
302 module procedure ESMF_aine
305 interface assignment (=)
306 module procedure ESMF_dtas
307 module procedure ESMF_ptas
310 !------------------------------------------------------------------------------
314 !------------------------------------------------------------------------------
315 ! function to compare two ESMF_Status flags to see if they're the same or not
317 function ESMF_sfeq(sf1, sf2)
319 type(ESMF_Status), intent(in) :: sf1, sf2
321 ESMF_sfeq = (sf1%status .eq. sf2%status)
324 function ESMF_sfne(sf1, sf2)
326 type(ESMF_Status), intent(in) :: sf1, sf2
328 ESMF_sfne = (sf1%status .ne. sf2%status)
331 !------------------------------------------------------------------------------
332 ! function to compare two ESMF_DataTypes to see if they're the same or not
334 function ESMF_dteq(dt1, dt2)
336 type(ESMF_DataType), intent(in) :: dt1, dt2
338 ESMF_dteq = (dt1%dtype .eq. dt2%dtype)
341 function ESMF_dtne(dt1, dt2)
343 type(ESMF_DataType), intent(in) :: dt1, dt2
345 ESMF_dtne = (dt1%dtype .ne. dt2%dtype)
348 subroutine ESMF_dtas(intval, dtval)
349 integer, intent(out) :: intval
350 type(ESMF_DataType), intent(in) :: dtval
356 !------------------------------------------------------------------------------
357 ! function to compare two ESMF_Pointers to see if they're the same or not
359 function ESMF_pteq(pt1, pt2)
361 type(ESMF_Pointer), intent(in) :: pt1, pt2
363 ESMF_pteq = (pt1%ptr .eq. pt2%ptr)
366 function ESMF_ptne(pt1, pt2)
368 type(ESMF_Pointer), intent(in) :: pt1, pt2
370 ESMF_ptne = (pt1%ptr .ne. pt2%ptr)
373 subroutine ESMF_ptas(ptval, intval)
374 type(ESMF_Pointer), intent(out) :: ptval
375 integer, intent(in) :: intval
380 !------------------------------------------------------------------------------
381 ! function to compare two ESMF_Logicals to see if they're the same or not
382 ! also need assignment to real f90 logical?
384 function ESMF_tfeq(tf1, tf2)
386 type(ESMF_Logical), intent(in) :: tf1, tf2
388 ESMF_tfeq = (tf1%value .eq. tf2%value)
391 function ESMF_tfne(tf1, tf2)
393 type(ESMF_Logical), intent(in) :: tf1, tf2
395 ESMF_tfne = (tf1%value .ne. tf2%value)
398 !------------------------------------------------------------------------------
399 ! function to compare two ESMF_AxisIndex to see if they're the same or not
401 function ESMF_aieq(ai1, ai2)
403 type(ESMF_AxisIndex), intent(in) :: ai1, ai2
405 ESMF_aieq = ((ai1%l .eq. ai2%l) .and. &
406 (ai1%r .eq. ai2%r) .and. &
407 (ai1%max .eq. ai2%max) .and. &
408 (ai1%decomp .eq. ai2%decomp) .and. &
409 (ai1%gstart .eq. ai2%gstart))
413 function ESMF_aine(ai1, ai2)
415 type(ESMF_AxisIndex), intent(in) :: ai1, ai2
417 ESMF_aine = ((ai1%l .ne. ai2%l) .or. &
418 (ai1%r .ne. ai2%r) .or. &
419 (ai1%max .ne. ai2%max) .or. &
420 (ai1%decomp .ne. ai2%decomp) .or. &
421 (ai1%gstart .ne. ai2%gstart))
425 !------------------------------------------------------------------------------
426 !------------------------------------------------------------------------------
430 !------------------------------------------------------------------------------
431 !------------------------------------------------------------------------------
433 ! !IROUTINE: ESMF_BaseInit - initialize a Base object
436 subroutine ESMF_BaseInit(base, rc)
439 type(ESMF_Base) :: base
440 integer, intent(out), optional :: rc
444 ! Set initial state on a Base object.
446 ! \begin{description}
448 ! In the Fortran interface, this must in fact be a {\tt Base}
449 ! derived type object. It is expected that all specialized
450 ! derived types will include a {\tt Base} object as the first
453 ! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
459 logical :: rcpresent ! Return code present
461 ! !Initialize return code
468 global_count = global_count + 1
469 base%ID = global_count
471 base%base_status = ESMF_STATE_READY
472 base%name = "undefined"
474 if (rcpresent) rc = ESMF_SUCCESS
476 end subroutine ESMF_BaseInit
478 !------------------------------------------------------------------------------
480 ! !IROUTINE: ESMF_SetName - set the name of this object
483 subroutine ESMF_SetName(anytype, name, namespace, rc)
486 type(ESMF_Base) :: anytype
487 character (len = *), intent(in), optional :: name
488 character (len = *), intent(in), optional :: namespace
489 integer, intent(out), optional :: rc
493 ! Associate a name with any object in the system.
495 ! \begin{description}
497 ! In the Fortran interface, this must in fact be a {\tt Base}
498 ! derived type object. It is expected that all specialized
499 ! derived types will include a {\tt Base} object as the first
502 ! Object name. An error will be returned if a duplicate name
503 ! is specified. If a name is not given a unique name will be
504 ! generated and can be queried by the {\tt ESMF_GetName} routine.
505 ! \item [[namespace]]
506 ! Object namespace (e.g. "Application", "Component", "Grid", etc).
507 ! If given, the name will be checked that it is unique within
508 ! this namespace. If not given, the generated name will be
509 ! unique within this namespace. If namespace is not specified,
510 ! a default "global" namespace will be assumed and the same rules
511 ! for names will be followed.
513 ! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
521 ! !REQUIREMENTS: FLD1.5, FLD1.5.3
522 logical :: rcpresent ! Return code present
523 character (len = ESMF_MAXSTR) :: ournamespace ! Namespace if not given
524 character (len = ESMF_MAXSTR) :: defaultname ! Name if not given
525 integer, save :: seqnum = 0 ! HACK - generate uniq names
526 ! but not coordinated across procs
528 ! !Initialize return code
535 ! ! TODO: this code should generate a unique name if a name
536 ! ! is not given. If a namespace is given, the name has to
537 ! ! be unique within that namespace. Example namespaces could
538 ! ! be: Applications, Components, Fields/Bundles, Grids.
540 ! ! Construct a default namespace if one is not given
541 if((.not. present(namespace)) .or. (namespace .eq. "")) then
542 ournamespace = "global"
544 ournamespace = namespace
546 ! ! Construct a default name if one is not given
547 if((.not. present(name)) .or. (name .eq. "")) then
549 write(defaultname, 20) trim(ournamespace), seqnum
552 anytype%name = defaultname
557 if (rcpresent) rc = ESMF_SUCCESS
559 end subroutine ESMF_SetName
561 !-------------------------------------------------------------------------
563 ! !IROUTINE: ESMF_GetName - get the name of this object
566 subroutine ESMF_GetName(anytype, name, rc)
569 type(ESMF_Base), intent(in) :: anytype ! any ESMF object/type
570 character (len = *), intent(out) :: name ! object/type name
571 integer, intent(out), optional :: rc ! return code
575 ! Return the name of any type in the system.
579 ! !REQUIREMENTS: FLD1.5, FLD1.5.3
582 if (present(rc)) rc = ESMF_SUCCESS
584 end subroutine ESMF_GetName
587 !-------------------------------------------------------------------------
589 ! !IROUTINE: ESMF_AttributeSet - set attribute on an ESMF type
592 subroutine ESMF_AttributeSet(anytype, name, value, rc)
595 type(ESMF_Base), intent(in) :: anytype ! any ESMF type
596 character (len = *), intent(in) :: name ! attribute name
597 type(ESMF_DataValue), intent(in) :: value ! attribute value
598 integer, intent(out), optional :: rc ! return code
602 ! Associate a (name,value) pair with any type in the system.
606 ! !REQUIREMENTS: FLD1.5, FLD1.5.3
608 end subroutine ESMF_AttributeSet
611 !-------------------------------------------------------------------------
613 ! !IROUTINE: ESMF_AttributeGet - get attribute from an ESMF type
616 subroutine ESMF_AttributeGet(anytype, name, type, value, rc)
619 type(ESMF_Base), intent(in) :: anytype ! any ESMF type
620 character (len = *), intent(in) :: name ! attribute name
621 type(ESMF_DataType), intent(out) :: type ! all possible data types
622 type(ESMF_DataValue), intent(out) :: value ! attribute value
623 integer, intent(out), optional :: rc ! return code
630 ! !REQUIREMENTS: FLD1.5.1, FLD1.5.3
632 end subroutine ESMF_AttributeGet
635 !-------------------------------------------------------------------------
638 ! !IROUTINE: ESMF_AttributeGetCount - get an ESMF object's number of attributes
641 subroutine ESMF_AttributeGetCount(anytype, count, rc)
644 type(ESMF_Base), intent(in) :: anytype ! any ESMF type
645 integer, intent(out) :: count ! attribute count
646 integer, intent(out), optional :: rc ! return code
650 ! Returns number of attributes present.
654 ! !REQUIREMENTS: FLD1.7.5
656 end subroutine ESMF_AttributeGetCount
659 !-------------------------------------------------------------------------
662 ! !IROUTINE: ESMF_AttributeGetbyNumber - get an ESMF object's attribute by num ber
665 subroutine ESMF_AttributeGetbyNumber(anytype, number, name, type, value, rc)
668 type(ESMF_Base), intent(in) :: anytype ! any ESMF type
669 integer, intent(in) :: number ! attribute number
670 character (len = *), intent(in) :: name ! attribute name
671 type(ESMF_DataType), intent(out) :: type ! all possible data types
672 type(ESMF_DataValue), intent(out) :: value ! attribute value
673 integer, intent(out), optional :: rc ! return code
677 ! Allows the caller to get attributes by number instead of by name.
678 ! This can be useful in iterating through all attributes in a loop.
683 end subroutine ESMF_AttributeGetbyNumber
686 !-------------------------------------------------------------------------
689 !IROUTINE: ESMF_AttributeGetNameList - get an ESMF object's attribute name list
692 subroutine ESMF_AttributeGetNameList(anytype, count, namelist, rc)
695 type(ESMF_Base), intent(in) :: anytype ! any ESMF type
696 integer, intent(out) :: count ! attribute count
697 character (len = *), dimension (:), intent(out) :: namelist ! attribute names
698 integer, intent(out), optional :: rc ! return code
702 ! Return a list of all attribute names without returning the values.
706 ! !REQUIREMENTS: FLD1.7.3
708 end subroutine ESMF_AttributeGetNameList
711 !-------------------------------------------------------------------------
714 ! !IROUTINE: ESMF_AttributeSetList - set an ESMF object's attributes
717 subroutine ESMF_AttributeSetList(anytype, namelist, valuelist, rc)
721 type(ESMF_Base), intent(in) :: anytype ! any ESMF type
722 character (len = *), dimension (:), intent(in) :: namelist ! attribute names
723 type(ESMF_DataValue), dimension (:), intent(in) :: valuelist ! attribute values
724 integer, intent(out), optional :: rc ! return code
728 ! Set multiple attributes on an object in one call. Depending on what is
729 ! allowed by the interface, all attributes may have to have the same type.
732 ! !REQUIREMENTS: (none. added for completeness)
734 end subroutine ESMF_AttributeSetList
737 !-------------------------------------------------------------------------
740 ! !IROUTINE: ESMF_AttributeGetList - get an ESMF object's attributes
743 subroutine ESMF_AttributeGetList(anytype, namelist, typelist, valuelist, rc)
746 type(ESMF_Base), intent(in) :: anytype ! any ESMF type
747 character (len = *), dimension (:), intent(in) :: namelist ! attribute names
748 type(ESMF_DataType), dimension (:), intent(out) :: typelist ! all possible data types
749 type(ESMF_DataValue), dimension (:), intent(out) :: valuelist ! attribute values
750 integer, intent(out), optional :: rc ! return code
754 ! Get multiple attributes from an object in a single call.
758 ! !REQUIREMENTS: FLD1.7.4
760 end subroutine ESMF_AttributeGetList
763 !-------------------------------------------------------------------------
766 ! !IROUTINE: ESMF_AttributeSetObjectList - set an attribute on multiple ESMF objects
769 subroutine ESMF_AttributeSetObjectList(anytypelist, name, value, rc)
772 type(ESMF_Base), dimension (:), intent(in) :: anytypelist ! list of any ESMF types
773 character (len = *), intent(in) :: name ! attribute name
774 type(ESMF_DataValue), dimension (:), intent(in) :: value ! attribute value
775 integer, intent(out), optional :: rc ! return code
779 ! Set the same attribute on multiple objects in one call.
783 ! !REQUIREMENTS: FLD1.5.5 (pri 2)
785 end subroutine ESMF_AttributeSetObjectList
788 !-------------------------------------------------------------------------
792 ! !IROUTINE: ESMF_AttributeGetObjectList - get an attribute from multiple ESMF objects
795 subroutine ESMF_AttributeGetObjectList(anytypelist, name, typelist, valuelist, rc)
798 type(ESMF_Base), dimension (:), intent(in) :: anytypelist ! list of any ESMF types
799 character (len = *), intent(in) :: name ! attribute name
800 type(ESMF_DataType), dimension (:), intent(out) :: typelist ! all possible data types
801 type(ESMF_DataValue), dimension (:), intent(out) :: valuelist ! attribute values
802 integer, intent(out), optional :: rc ! return code
806 ! Get the same attribute name from multiple objects in one call.
810 ! !REQUIREMENTS: FLD1.5.5 (pri 2)
812 end subroutine ESMF_AttributeGetObjectList
815 !-------------------------------------------------------------------------
818 ! !IROUTINE: ESMF_AttributeCopy - copy an attribute between two objects
821 subroutine ESMF_AttributeCopy(name, source, destination, rc)
824 character (len = *), intent(in) :: name ! attribute name
825 type(ESMF_Base), intent(in) :: source ! any ESMF type
826 type(ESMF_Base), intent(in) :: destination ! any ESMF type
827 integer, intent(out), optional :: rc ! return code
831 ! The specified attribute associated with the source object is
832 ! copied to the destination object. << does this assume overwriting the
833 ! attribute if it already exists in the output or does this require yet
834 ! another arg to say what to do with collisions? >>
839 ! !REQUIREMENTS: FLD1.5.4
841 end subroutine ESMF_AttributeCopy
844 !-------------------------------------------------------------------------
847 !IROUTINE: ESMC_AttributeCopyAll - copy attributes between two objects
851 subroutine ESMF_AttributeCopyAll(source, destination, rc)
854 type(ESMF_Base), intent(in) :: source ! any ESMF type
855 type(ESMF_Base), intent(in) :: destination ! any ESMF type
856 integer, intent(out), optional :: rc ! return code
860 ! All attributes associated with the source object are copied to the
861 ! destination object. Some attributes will have to be considered
862 ! {\tt read only} and won't be updated by this call. (e.g. an attribute
863 ! like {\tt name} must be unique and therefore can't be duplicated.)
867 ! !REQUIREMENTS: FLD1.5.4
869 end subroutine ESMF_AttributeCopyAll
871 !=========================================================================
872 ! Misc utility routines, perhaps belongs in a utility file?
873 !-------------------------------------------------------------------------
876 !IROUTINE: ESMC_AxisIndexInit - initialize an AxisIndex object
880 subroutine ESMF_AxisIndexInit(ai, l, r, max, decomp, gstart, rc)
883 type(ESMF_AxisIndex), intent(inout) :: ai
884 integer, intent(in) :: l, r, max, decomp, gstart
885 integer, intent(out), optional :: rc
888 ! Set the contents of an AxisIndex type.
900 if (present(rc)) rc = ESMF_SUCCESS
902 end subroutine ESMF_AxisIndexInit
906 !IROUTINE: ESMC_AxisIndexInit - initialize an AxisIndex object
910 subroutine ESMF_AxisIndexGet(ai, l, r, max, decomp, gstart, rc)
913 type(ESMF_AxisIndex), intent(inout) :: ai
914 integer, intent(out), optional :: l, r, max, decomp, gstart
915 integer, intent(out), optional :: rc
918 ! Get the contents of an AxisIndex type.
924 if (present(l)) l = ai%l
925 if (present(r)) r = ai%r
926 if (present(max)) max = ai%max
927 if (present(decomp)) decomp = ai%decomp
928 if (present(gstart)) gstart = ai%gstart
930 if (present(rc)) rc = ESMF_SUCCESS
932 end subroutine ESMF_AxisIndexGet
934 !-------------------------------------------------------------------------
935 !-------------------------------------------------------------------------
938 !IROUTINE: ESMF_SetPointer - set an opaque value
942 subroutine ESMF_SetPointer(ptype, contents, rc)
945 type(ESMF_Pointer) :: ptype
946 integer*8, intent(in) :: contents
947 integer, intent(out), optional :: rc
951 ! Set the contents of an opaque pointer type.
957 if (present(rc)) rc = ESMF_SUCCESS
959 end subroutine ESMF_SetPointer
961 !-------------------------------------------------------------------------
964 !IROUTINE: ESMF_SetNullPointer - set an opaque value
968 subroutine ESMF_SetNullPointer(ptype, rc)
971 type(ESMF_Pointer) :: ptype
972 integer, intent(out), optional :: rc
976 ! Set the contents of an opaque pointer type.
981 integer*8, parameter :: nullp = 0
984 if (present(rc)) rc = ESMF_SUCCESS
986 end subroutine ESMF_SetNullPointer
987 !-------------------------------------------------------------------------
989 ! !IROUTINE: ESMF_GetPointer - get an opaque value
992 function ESMF_GetPointer(ptype, rc)
995 integer*8 :: ESMF_GetPointer
998 type(ESMF_Pointer), intent(in) :: ptype
999 integer, intent(out), optional :: rc
1003 ! Get the contents of an opaque pointer type.
1008 ESMF_GetPointer = ptype%ptr
1009 if (present(rc)) rc = ESMF_SUCCESS
1011 end function ESMF_GetPointer
1013 !-------------------------------------------------------------------------
1014 ! misc print routines
1015 !-------------------------------------------------------------------------
1017 ! !IROUTINE: ESMF_StatusString - Return status as a string
1020 subroutine ESMF_StatusString(status, string, rc)
1023 type(ESMF_Status), intent(in) :: status
1024 character(len=*), intent(out) :: string
1025 integer, intent(out), optional :: rc
1029 ! Return a status variable as a string.
1035 if (status .eq. ESMF_STATE_UNINIT) string = "Uninitialized"
1036 if (status .eq. ESMF_STATE_READY) string = "Ready"
1037 if (status .eq. ESMF_STATE_UNALLOCATED) string = "Unallocated"
1038 if (status .eq. ESMF_STATE_ALLOCATED) string = "Allocated"
1039 if (status .eq. ESMF_STATE_BUSY) string = "Busy"
1040 if (status .eq. ESMF_STATE_INVALID) string = "Invalid"
1042 if (present(rc)) rc = ESMF_SUCCESS
1044 end subroutine ESMF_StatusString
1046 !-------------------------------------------------------------------------
1048 ! !IROUTINE: ESMF_DataTypeString - Return DataType as a string
1051 subroutine ESMF_DataTypeString(datatype, string, rc)
1054 type(ESMF_DataType), intent(in) :: datatype
1055 character(len=*), intent(out) :: string
1056 integer, intent(out), optional :: rc
1060 ! Return a datatype variable as a string.
1066 if (datatype .eq. ESMF_DATA_INTEGER) string = "Integer"
1067 if (datatype .eq. ESMF_DATA_REAL) string = "Real"
1068 if (datatype .eq. ESMF_DATA_LOGICAL) string = "Logical"
1069 if (datatype .eq. ESMF_DATA_CHARACTER) string = "Character"
1071 if (present(rc)) rc = ESMF_SUCCESS
1073 end subroutine ESMF_DataTypeString
1075 !-------------------------------------------------------------------------
1077 !-------------------------------------------------------------------------
1078 ! put Print and Validate skeletons here - but they should be
1079 ! overridden by higher level more specialized functions.
1080 !-------------------------------------------------------------------------
1082 end module ESMF_BaseMod