Пример #1
0
 void FTN(c_esmc_calendarcreatebuiltin)(Calendar    **ptr,
                                        int               *nameLen,
                                        const char        *name,
                                        ESMC_CalendarType *calendarType, 
                                        int *status,
                                        ESMCI_FortranStrLenArg name_l) {
    *ptr = ESMCI_CalendarCreate(
                                     *nameLen,      // always present 
                                                    //  internal argument.
              ESMC_NOT_PRESENT_FILTER(name),
                                     *calendarType, // required
              ESMC_NOT_PRESENT_FILTER(status) );
 }
Пример #2
0
  void FTN(c_esmc_arraybundlehalo)(ESMCI::ArrayBundle **arraybundle,
    ESMCI::RouteHandle **routehandle, ESMC_Logical *checkflag, int *rc){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arrayhalo()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    // convert to bool
    bool checkflagOpt = false;  // default
    if (ESMC_NOT_PRESENT_FILTER(checkflag) != ESMC_NULL_POINTER)
      if (*checkflag == ESMF_TRUE) checkflagOpt = true;
    // Call into the actual C++ method wrapped inside LogErr handling
    ESMC_LogDefault.MsgFoundError(ESMCI::ArrayBundle::halo(
      *arraybundle, routehandle, checkflagOpt),
      ESMF_ERR_PASSTHRU, ESMC_CONTEXT,
      ESMC_NOT_PRESENT_FILTER(rc));
  }
Пример #3
0
  void FTN(c_esmc_arraybundleget)(ESMCI::ArrayBundle **ptr, int *arrayCount,  
    ESMCI::Array **opt_arrayList, int *len_arrayList, int *rc){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundleget()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    int localrc = ESMC_RC_NOT_IMPL;
    // fill simple return values
    if (ESMC_NOT_PRESENT_FILTER(arrayCount) != ESMC_NULL_POINTER)
      *arrayCount = (*ptr)->getArrayCount();
    // fill arrayList
    if (*len_arrayList != 0){
      // opt_arrayList was provided
      if (*len_arrayList < (*ptr)->getArrayCount()){
        ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_SIZE,
          "- opt_arrayList must provide arrayCount elements", rc);
        return;
      }
      // opt_arrayList has correct number of elements
      for (int i=0; i<(*ptr)->getArrayCount(); i++)
        opt_arrayList[i] = ((*ptr)->getArrayList())[i];
    }
    // return successfully
    if (rc!=NULL) *rc = ESMF_SUCCESS;
  }
Пример #4
0
 void FTN(c_esmc_alarmcreatecopy)(Alarm **ptr,
                                  Alarm **alarm,
                                  int *status) {
    *ptr = ESMCI_alarmCreate(
                                     *alarm,   // required
              ESMC_NOT_PRESENT_FILTER(status) );
 }
Пример #5
0
 void FTN(c_esmc_calendarcreatecopy)(Calendar **ptr,
                                     Calendar **calendar,
                                     int *status) {
    *ptr = ESMCI_CalendarCreate(
                      *calendar,   // required
              ESMC_NOT_PRESENT_FILTER(status) );
 }
Пример #6
0
 void FTN(c_esmc_clockcreatecopy)(Clock **ptr,
                                  Clock **clock,
                                  int *status) {
    *ptr = ESMCI_ClockCreate(
                                     *clock,   // required
              ESMC_NOT_PRESENT_FILTER(status) );
 }
Пример #7
0
  void FTN(c_esmc_arraybundledestroy)(ESMCI::ArrayBundle **ptr, int *rc){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundledestroy()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    // call into C++
    ESMC_LogDefault.MsgFoundError(ESMCI::ArrayBundle::destroy(ptr),
      ESMF_ERR_PASSTHRU, ESMC_CONTEXT,
      ESMC_NOT_PRESENT_FILTER(rc));
  }
Пример #8
0
  void FTN(c_esmc_arraybundleprint)(ESMCI::ArrayBundle **ptr, int *rc){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundleprint()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    // Call into the actual C++ method wrapped inside LogErr handling
    ESMC_LogDefault.MsgFoundError((*ptr)->print(),
      ESMF_ERR_PASSTHRU, ESMC_CONTEXT,
      ESMC_NOT_PRESENT_FILTER(rc));
  }
Пример #9
0
  void FTN(c_esmc_arraybundlerediststorenf)(ESMCI::ArrayBundle **srcArraybundle,
    ESMCI::ArrayBundle **dstArraybundle, ESMCI::RouteHandle **routehandle,
    ESMCI::InterfaceInt **srcToDstTransposeMap, int *rc){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundlerediststorenf()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    // Call into the actual C++ method wrapped inside LogErr handling
    ESMC_LogDefault.MsgFoundError(ESMCI::ArrayBundle::redistStore(
      *srcArraybundle, *dstArraybundle, routehandle, *srcToDstTransposeMap),
      ESMF_ERR_PASSTHRU, ESMC_CONTEXT,
      ESMC_NOT_PRESENT_FILTER(rc));
  }
Пример #10
0
  void FTN(c_esmc_arraybundledeserialize)(ESMCI::ArrayBundle **arraybundle,
    char *buf, int *offset, ESMC_AttReconcileFlag *attreconflag, int *rc,
    ESMCI_FortranStrLenArg buf_l){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundledeserialize()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    *arraybundle = new ESMCI::ArrayBundle(-1);  // prevent baseID counter incr.
    // Call into the actual C++ method wrapped inside LogErr handling
    ESMC_LogDefault.MsgFoundError((*arraybundle)->deserialize(
      buf,offset,*attreconflag),
      ESMF_ERR_PASSTHRU, ESMC_CONTEXT,
      ESMC_NOT_PRESENT_FILTER(rc));
  }
Пример #11
0
  void FTN(c_esmc_arraybundlecreate)(ESMCI::ArrayBundle **ptr, 
    ESMCI::Array **arrayList, int *arrayCount, char *name, int *len_name,
    int *rc,
    ESMCI_FortranStrLenArg name_l){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundlecreate()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    int localrc = ESMC_RC_NOT_IMPL;
    // call into C++
    *ptr = ESMCI::ArrayBundle::create(arrayList, *arrayCount, &localrc);
    if (ESMC_LogDefault.MsgFoundError(localrc, ESMF_ERR_PASSTHRU,
      ESMC_NOT_PRESENT_FILTER(rc))) return;
    // set the name in the ArrayBundle object
    char *cname = ESMC_F90toCstring(name, *len_name);
    if (cname){
      (*ptr)->setName(cname);
      delete [] cname;
    }else if(*len_name){
      ESMC_LogDefault.MsgFoundError(ESMC_RC_PTR_NULL,
        "- Not a valid string", ESMC_NOT_PRESENT_FILTER(rc));
      return;
    }
  }
Пример #12
0
  void FTN(c_esmc_arraybundlesmmstorenf)(ESMCI::ArrayBundle **srcArraybundle,
    ESMCI::ArrayBundle **dstArraybundle, ESMCI::RouteHandle **routehandle,
    int *rc){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundlesmmstorenf()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    // prepare empty SparseMatrix vector
    vector<ESMCI::SparseMatrix> sparseMatrix;
    // Call into the actual C++ method wrapped inside LogErr handling
    ESMC_LogDefault.MsgFoundError(ESMCI::ArrayBundle::sparseMatMulStore(
      *srcArraybundle, *dstArraybundle, routehandle, sparseMatrix),
      ESMF_ERR_PASSTHRU, ESMC_CONTEXT,
      ESMC_NOT_PRESENT_FILTER(rc));
  }
Пример #13
0
  void FTN(c_esmc_arraybundlehalostore)(ESMCI::ArrayBundle **arraybundle,
    ESMCI::RouteHandle **routehandle,
    ESMC_HaloStartRegionFlag *halostartregionflag,
    ESMCI::InterfaceInt **haloLDepth, ESMCI::InterfaceInt **haloUDepth,
    int *rc){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundlehalostore()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    // Call into the actual C++ method wrapped inside LogErr handling
    ESMC_LogDefault.MsgFoundError(ESMCI::ArrayBundle::haloStore(
      *arraybundle, routehandle, *halostartregionflag, *haloLDepth,
      *haloUDepth),
      ESMF_ERR_PASSTHRU, ESMC_CONTEXT,
      ESMC_NOT_PRESENT_FILTER(rc));
  }
Пример #14
0
 // for daysPerMonth missing
 void FTN(c_esmc_calendarcreatecustom0)(Calendar **ptr,
                              int          *nameLen,
                              const char   *name,
                              int          *monthsPerYear,
                              ESMC_I4 *secondsPerDay,
                              ESMC_I4 *daysPerYear,
                              ESMC_I4 *daysPerYearDn,
                              ESMC_I4 *daysPerYearDd, int *status,
                              ESMCI_FortranStrLenArg name_l) {
     *ptr = ESMCI_CalendarCreate(
                                     *nameLen,    // always present
                                                  //   internal argument.
              ESMC_NOT_PRESENT_FILTER(name),
                                      ESMC_NULL_POINTER,  // daysPerMonth
                                                          //   missing
                                     *monthsPerYear,  // always present
                                                    // internal argument.
              ESMC_NOT_PRESENT_FILTER(secondsPerDay),
              ESMC_NOT_PRESENT_FILTER(daysPerYear),
              ESMC_NOT_PRESENT_FILTER(daysPerYearDn),
              ESMC_NOT_PRESENT_FILTER(daysPerYearDd),
              ESMC_NOT_PRESENT_FILTER(status) );
 }
Пример #15
0
       void FTN(c_esmc_calendardestroy)(Calendar **ptr, int *status) {
          int rc = ESMCI_CalendarDestroy(ptr);
          if (ESMC_PRESENT(status)) *status = rc;
       }

       void FTN(c_esmc_calendarsetbuiltin)(Calendar **ptr,
                                           int *nameLen,
                                           const char *name,
                                           ESMC_CalendarType *calendarType, 
                                           int *status,
                                           ESMCI_FortranStrLenArg name_l) {
           ESMF_CHECK_POINTER(*ptr, status)
           int rc = (*ptr)->Calendar::set(
                                             *nameLen,   // always present
                                                         //   internal argument.
                      ESMC_NOT_PRESENT_FILTER(name),
                                             *calendarType);  // required
           if (ESMC_PRESENT(status)) *status = rc;
       }

       void FTN(c_esmc_calendarsetdefaultcal)(Calendar **calendar, 
                                              int *status) {
          int rc =
                ESMCI_CalendarSetDefault(
                          (Calendar **)ESMC_NOT_PRESENT_FILTER(calendar));
          if (ESMC_PRESENT(status)) *status = rc;
       }

       void FTN(c_esmc_calendarsetdefaulttype)(ESMC_CalendarType *calendarType, 
                                               int *status) {
          int rc =
Пример #16
0
  void FTN(c_esmc_arraybundlesmmstore)(ESMCI::ArrayBundle **srcArraybundle,
    ESMCI::ArrayBundle **dstArraybundle, ESMCI::RouteHandle **routehandle, 
    ESMC_TypeKind *typekindFactors, void *factorList, int *factorListCount,
    ESMCI::InterfaceInt **factorIndexList, int *rc){
#undef  ESMC_METHOD
#define ESMC_METHOD "c_esmc_arraybundlesmmstore()"
    // Initialize return code; assume routine not implemented
    if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL;
    
    try{
    
    // check argument consistency
    if (*factorListCount > 0){
      // must provide valid factorList and factorIndexList args
      if (*factorIndexList == NULL){
        ESMC_LogDefault.MsgFoundError(ESMC_RC_PTR_NULL,
          "- Not a valid pointer to factorIndexList array", rc);
        return;
      }
      if ((*factorIndexList)->dimCount != 2){
        ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_RANK,
          "- factorIndexList array must be of rank 2", rc);
        return;
      }
      if ((*factorIndexList)->extent[0] != 2 && 
        (*factorIndexList)->extent[0] != 4){
        ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_SIZE,
          "- 1st dimension of factorIndexList array must be of size 2 or 4",
          rc);
        return;
      }
      if ((*factorIndexList)->extent[1] != *factorListCount){
        ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_SIZE,
          "- 2nd dimension of factorIndexList does not match factorListCount",
          rc);
        return;
      }
    }
    // prepare SparseMatrix vector
    vector<ESMCI::SparseMatrix> sparseMatrix;
    int srcN = (*factorIndexList)->extent[0]/2;
    int dstN = (*factorIndexList)->extent[0]/2;
    sparseMatrix.push_back(ESMCI::SparseMatrix(*typekindFactors, factorList,
      *factorListCount, srcN, dstN, (*factorIndexList)->array));
    // Call into the actual C++ method wrapped inside LogErr handling
    if (ESMC_LogDefault.MsgFoundError(ESMCI::ArrayBundle::sparseMatMulStore(
      *srcArraybundle, *dstArraybundle, routehandle, sparseMatrix ),
      ESMF_ERR_PASSTHRU, ESMC_CONTEXT,
      ESMC_NOT_PRESENT_FILTER(rc))) return;
    
    }catch(int localrc){
      // catch standard ESMF return code
      ESMC_LogDefault.MsgFoundError(localrc, ESMF_ERR_PASSTHRU, rc);
      return;
    }catch(exception &x){
      ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, x.what(), rc);
      return;
    }catch(...){
      ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD,
        "- Caught exception", rc);
      return;
    }
  
    // return successfully
    if (rc!=NULL) *rc = ESMF_SUCCESS;
  }
Пример #17
0
          if (ESMC_PRESENT(status)) *status = rc;
       }

       void FTN(c_esmc_alarmset)(Alarm **ptr, int *nameLen, 
                                 const char *name, Clock **clock,
                Time *ringTime, TimeInterval *ringInterval,
                Time *stopTime, TimeInterval *ringDuration, 
                int *ringTimeStepCount, Time *refTime,
                bool *ringing, bool *enabled, bool *sticky,
                int *status,
                ESMCI_FortranStrLenArg name_l) {
          ESMF_CHECK_POINTER(*ptr, status)
          int rc = (*ptr)->Alarm::set(
                                           *nameLen, // always present
                                                     //   internal argument.
                    ESMC_NOT_PRESENT_FILTER(name),
                    ESMC_NOT_PRESENT_FILTER(clock),
                    ESMC_NOT_PRESENT_FILTER(ringTime),
                    ESMC_NOT_PRESENT_FILTER(ringInterval),
                    ESMC_NOT_PRESENT_FILTER(stopTime),
                    ESMC_NOT_PRESENT_FILTER(ringDuration),
                    ESMC_NOT_PRESENT_FILTER(ringTimeStepCount),
                    ESMC_NOT_PRESENT_FILTER(refTime),
                    ESMC_NOT_PRESENT_FILTER(ringing),
                    ESMC_NOT_PRESENT_FILTER(enabled),
                    ESMC_NOT_PRESENT_FILTER(sticky) );
          if (ESMC_PRESENT(status)) *status = rc;
       }

       void FTN(c_esmc_alarmget)(Alarm **ptr, int *nameLen, 
                                 int *tempNameLen, char *tempName,
Пример #18
0
                                 TimeInterval *timeStep,
                                 Time *startTime,
                                 Time *stopTime,
                                 TimeInterval *runDuration,
                                 int *runTimeStepCount,
                                 Time *refTime,
                                 Time *currTime,
                                 ESMC_I8 *advanceCount,
                                 ESMC_Direction *direction,
                                 int *status,
                                 ESMCI_FortranStrLenArg name_l) {
          ESMF_CHECK_POINTER(*ptr, status)
          int rc = (*ptr)->Clock::set(
                                           *nameLen,   // always present 
                                                       //   internal argument.
                    ESMC_NOT_PRESENT_FILTER(name),
                    ESMC_NOT_PRESENT_FILTER(timeStep),
                    ESMC_NOT_PRESENT_FILTER(startTime),
                    ESMC_NOT_PRESENT_FILTER(stopTime),
                    ESMC_NOT_PRESENT_FILTER(runDuration),
                    ESMC_NOT_PRESENT_FILTER(runTimeStepCount),
                    ESMC_NOT_PRESENT_FILTER(refTime),
                    ESMC_NOT_PRESENT_FILTER(currTime),
                    ESMC_NOT_PRESENT_FILTER(advanceCount),
                    ESMC_NOT_PRESENT_FILTER(direction) );
          if (ESMC_PRESENT(status)) *status = rc;
       }

       void FTN(c_esmc_clockget)(Clock **ptr,
                                 int *nameLen,
                                 int *tempNameLen,