ESMF_BaseCreate Subroutine

public subroutine ESMF_BaseCreate(base, superclass, name, nattr, vm, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Base) :: base
character(len=*), intent(in) :: superclass
character(len=*), intent(in), optional :: name
integer, intent(in), optional :: nattr
type(ESMF_VM), intent(in), optional :: vm
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_BaseCreate(base, superclass, name, nattr, vm, rc)
!
! !ARGUMENTS:
    type(ESMF_Base)                         :: base
    character(len=*), intent(in)            :: superclass
    character(len=*), intent(in),  optional :: name
    integer,          intent(in),  optional :: nattr
    type(ESMF_VM),    intent(in),  optional :: vm
    integer,          intent(out), optional :: rc

!
! !DESCRIPTION:
!     Set initial state on a Base object.
!
!     \begin{description}
!     \item [base]
!           An {\tt ESMF\_Base} derived type.  It is expected that all 
!           specialized derived types will include an {\tt ESMF\_Base} 
!           object as the first entry.
!     \item [superclass]
!           The name of the superclass, e.g. {\tt "IGrid"}, {\tt "Array"}.
!           This sets the scope for unique object names.
!     \item [{[name]}]
!           If given, the unique name for this object.  If not given,
!           a unique name will be generated.  
!     \item [{[nattr]}]
!           If given, the initial number of attributes to allocate space for.
!           Additional attributes can be added at any time, but it will be
!           more efficient if space is allocated at create time.
!     \item[{[vm]}]
!           If present, base is created on the specified {\tt ESMF\_VM} object.
!           The default is to create on the VM of the current component context.
!     \item [{[rc]}]
!           Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!
!     \end{description}
!
!EOPI

    integer :: localrc, allocNAttrs

    ! Initialize return code; assume routine not implemented
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    allocNAttrs = 0   ! default value, overwrite if argument specified
    if (present(nattr)) allocNAttrs = nattr

    if (present(name)) then
      call c_ESMC_BaseCreate(base , superclass, name, allocNattrs, vm, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    else
      call c_ESMC_BaseCreate(base , superclass, "", allocNattrs, vm, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    endif
    
    ! Set init code
    ESMF_INIT_SET_CREATED(base)
 
    ! Return successfully
    if (present(rc)) rc = ESMF_SUCCESS
 
  end subroutine ESMF_BaseCreate