Changeset 1021 for XIOS/dev/dev_olga


Ignore:
Timestamp:
01/10/17 14:36:29 (4 years ago)
Author:
oabramkina
Message:

Intermeadiate version for merging with new server functionalities.

Location:
XIOS/dev/dev_olga
Files:
55 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/bld.cfg

    r1009 r1021  
    3535bld::target xios_server.exe  
    3636bld::target xios_server1.exe xios_server2.exe 
    37 bld::target test_regular.exe 
     37#bld::target test_regular.exe 
    3838#bld::target test_new_features.exe test_unstruct_complete.exe  
    3939#bld::target test_client.exe test_complete.exe 
  • XIOS/dev/dev_olga/src/client.cpp

    r1009 r1021  
    5757 
    5858          unsigned long hashClient = hashString(codeId) ; 
    59           unsigned long hashServer = hashString(CXios::xiosCodeIdPrm); 
     59          unsigned long hashServer = hashString(CXios::xiosCodeId); 
     60//          unsigned long hashServer = hashString(CXios::xiosCodeIdPrm); 
    6061          unsigned long* hashAll ; 
    6162          int size ; 
     
    8889          for (i=0; i < size; ++i) 
    8990          { 
    90             if ((hashAll[i] == hashString(CXios::xiosCodeId)) 
    91                 || (hashAll[i] == hashString(CXios::xiosCodeIdPrm)) 
    92                 || (hashAll[i] == hashString(CXios::xiosCodeIdSnd))) 
     91            if (hashAll[i] == hashString(CXios::xiosCodeId)) 
     92//                || (hashAll[i] == hashString(CXios::xiosCodeIdPrm)) 
     93//                || (hashAll[i] == hashString(CXios::xiosCodeIdSnd))) 
    9394            { 
    9495              CXios::setUsingServer(); 
     
    103104          { 
    104105            int clientLeader=leaders[hashClient] ; 
    105 //            serverLeader=leaders[hashServer] ; 
    106106            serverLeader.push_back(leaders[hashServer]) ; 
    107107            int intraCommSize, intraCommRank ; 
     
    111111                   <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< serverLeader.back()<<endl ; 
    112112             MPI_Intercomm_create(intraComm, 0, CXios::globalComm, serverLeader.back(), 0, &interComm) ; 
    113 //             info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize 
    114 //                    <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< serverLeader<<endl ; 
    115 //              MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ; 
    116113          } 
    117114          else 
     
    181178/*! 
    182179 * \fn void CClient::registerContext(const string& id, MPI_Comm contextComm) 
    183  * Function creates intraComm (CClient::intraComm) for client group with id=codeId and interComm (CClient::interComm) between client and server groups. 
     180 * \brief Sends a request to create a context to server. Creates client/server contexts. 
    184181 * \param [in] id id of context. 
    185182 * \param [in] contextComm. 
     183 * Function is only called by client. 
    186184 */ 
    187185    void CClient::registerContext(const string& id, MPI_Comm contextComm) 
     
    250248    } 
    251249 
    252     ///--------------------------------------------------------------- 
    253     /*! 
    254      * \fn void CClient::registerContext(const string& id, const int poolNb, MPI_Comm contextComm) 
    255      * Function creates intraComm (CClient::intraComm) for client group with id=codeId and interComm (CClient::interComm) between client and server groups. 
    256      * \param [in] id id of context. 
    257      * \param [in] contextComm. 
    258      */ 
    259         void CClient::registerContextOnSrvPools(const string& id, MPI_Comm contextComm) 
     250///--------------------------------------------------------------- 
     251/*! 
     252  * \fn void CClient::registerContextByClienOfServer(const string& id, MPI_Comm contextComm) 
     253  * \brief Sends a request to create contexts on secondary servers. Creates clientPrimServer/serverPrimServer contexts. 
     254  * \param [in] id id of context. 
     255  * \param [in] contextComm. 
     256  * Function is called by primary server. 
     257  * The only difference with CClient::registerContext() is naming of contexts on servers (appearing of pool id at the end). 
     258  */ 
     259        void CClient::registerContextByClienOfServer(const string& id, MPI_Comm contextComm) 
    260260        { 
    261261          CContext::setCurrent(id) ; 
  • XIOS/dev/dev_olga/src/client.hpp

    r1009 r1021  
    1515        static void finalize(void); 
    1616        static void registerContext(const string& id, MPI_Comm contextComm); 
    17         static void registerContextOnSrvPools(const string& id, MPI_Comm contextComm); 
     17        static void registerContextByClienOfServer(const string& id, MPI_Comm contextComm); 
    1818 
    1919        static MPI_Comm intraComm; 
  • XIOS/dev/dev_olga/src/config/field_attribute.conf

    r887 r1021  
    1111DECLARE_ATTRIBUTE(int,       level) 
    1212DECLARE_ATTRIBUTE(int,       prec) 
     13DECLARE_ATTRIBUTE(StdString, expr) 
    1314 
    1415DECLARE_ATTRIBUTE(bool,      enabled) 
     
    3334DECLARE_ATTRIBUTE(bool,      ts_enabled) 
    3435DECLARE_ATTRIBUTE(CDuration, ts_split_freq) 
     36 
     37DECLARE_ATTRIBUTE(StdString, cell_methods) 
     38DECLARE_ENUM4(cell_methods_mode,  overwrite, prefix, suffix, none) 
  • XIOS/dev/dev_olga/src/config/interpolate_domain_attribute.conf

    r846 r1021  
    33DECLARE_ATTRIBUTE(int, order) 
    44DECLARE_ATTRIBUTE(bool, renormalize) 
     5 
     6/* Write interpolation weights into file */ 
     7DECLARE_ENUM3(mode,compute,read,read_or_compute) 
     8DECLARE_ATTRIBUTE(StdString, weight_filename) 
     9DECLARE_ATTRIBUTE(bool, write_weight) 
  • XIOS/dev/dev_olga/src/context_client.cpp

    r983 r1021  
    5050        for (int i = 0; i < serverByClient; i++) 
    5151          ranksServerLeader.push_back(rankStart + i); 
    52       } 
     52 
     53        ranksServerNotLeader.resize(0);      } 
    5354      else 
    5455      { 
     
    6061          if (clientRank % (clientByServer + 1) == 0) 
    6162            ranksServerLeader.push_back(clientRank / (clientByServer + 1)); 
     63          else 
     64            ranksServerNotLeader.push_back(clientRank / (clientByServer + 1)); 
    6265        } 
    6366        else 
     
    6669          if (rank % clientByServer == 0) 
    6770            ranksServerLeader.push_back(remain + rank / clientByServer); 
     71          else 
     72            ranksServerNotLeader.push_back(remain + rank / clientByServer); 
    6873        } 
    6974      } 
     
    244249                          + 1;                                   // the other local buffer might contain only one event 
    245250   } 
     251 
     252   /*! 
     253    Get leading server in the group of connected server 
     254    \return ranks of leading servers 
     255    */ 
     256    const std::list<int>& CContextClient::getRanksServerNotLeader(void) const 
     257    { 
     258      return ranksServerNotLeader; 
     259    } 
     260 
     261    /*! 
     262    Check if client connects to leading server 
     263    \return connected(true), not connected (false) 
     264    */ 
     265    bool CContextClient::isServerNotLeader(void) const 
     266    { 
     267      return !ranksServerNotLeader.empty(); 
     268    } 
    246269 
    247270  /*! 
  • XIOS/dev/dev_olga/src/context_client.hpp

    r917 r1021  
    4141 
    4242      bool isServerLeader(void) const; 
     43      bool isServerNotLeader(void) const; 
    4344      const std::list<int>& getRanksServerLeader(void) const; 
     45      const std::list<int>& getRanksServerNotLeader(void) const; 
    4446 
    4547      bool isAttachedModeEnabled() const; 
     
    8082      std::list<int> ranksServerLeader; 
    8183 
     84      //! List of server ranks for which the client is not leader 
     85      std::list<int> ranksServerNotLeader; 
     86 
    8287    public: // Some function should be removed in the future 
    8388      //    void registerEvent(CEventClient& event); 
  • XIOS/dev/dev_olga/src/context_server.cpp

    r1009 r1021  
    4444  } 
    4545 
    46   CContextServer::CContextServer(CContext* parent, int srvLvl, MPI_Comm intraComm_,MPI_Comm interComm_) 
    47   { 
    48     context=parent; 
    49     intraComm=intraComm_; 
    50     MPI_Comm_size(intraComm,&intraCommSize); 
    51     MPI_Comm_rank(intraComm,&intraCommRank); 
    52     interComm=interComm_; 
    53     int flag; 
    54     MPI_Comm_test_inter(interComm,&flag); 
    55     if (flag) MPI_Comm_remote_size(interComm,&commSize); 
    56     else  MPI_Comm_size(interComm,&commSize); 
    57  
    58     currentTimeLine=0; 
    59     scheduled=false; 
    60     finished=false; 
    61  
    62     boost::hash<string> hashString; 
    63     StdString contextId = context->getId(); 
    64     hashId=hashString(contextId); 
    65  
    66   } 
     46//  CContextServer::CContextServer(CContext* parent, int srvLvl, MPI_Comm intraComm_,MPI_Comm interComm_) 
     47//  { 
     48//    context=parent; 
     49//    intraComm=intraComm_; 
     50//    MPI_Comm_size(intraComm,&intraCommSize); 
     51//    MPI_Comm_rank(intraComm,&intraCommRank); 
     52//    interComm=interComm_; 
     53//    int flag; 
     54//    MPI_Comm_test_inter(interComm,&flag); 
     55//    if (flag) MPI_Comm_remote_size(interComm,&commSize); 
     56//    else  MPI_Comm_size(interComm,&commSize); 
     57// 
     58//    currentTimeLine=0; 
     59//    scheduled=false; 
     60//    finished=false; 
     61// 
     62//    boost::hash<string> hashString; 
     63//    StdString contextId = context->getId(); 
     64//    hashId=hashString(contextId); 
     65// 
     66//  } 
    6767  void CContextServer::setPendingEvent(void) 
    6868  { 
  • XIOS/dev/dev_olga/src/cxios.cpp

    r983 r1021  
    1616  string CXios::rootFile="./iodef.xml" ; 
    1717  string CXios::xiosCodeId="xios.x" ; 
    18   string CXios::xiosCodeIdPrm="xios.x.1" ; 
    19   string CXios::xiosCodeIdSnd="xios.x.2" ; 
     18//  string CXios::xiosCodeIdPrm="xios.x.1" ; 
     19//  string CXios::xiosCodeIdSnd="xios.x.2" ; 
    2020  string CXios::clientFile="./xios_client"; 
    2121  string CXios::serverFile="./xios_server"; 
    22   string CXios::serverPrimFile="./xios_server1"; 
    23   string CXios::serverScndFile="./xios_server2"; 
     22  string CXios::serverPrmFile="./xios_server1"; 
     23  string CXios::serverSndFile="./xios_server2"; 
    2424 
    2525  bool CXios::isClient ; 
    2626  bool CXios::isServer ; 
    27   int CXios::serverLevel = 0 ; 
     27//  int CXios::serverLevel = 0 ; 
    2828  MPI_Comm CXios::globalComm ; 
    2929  bool CXios::usingOasis ; 
    3030  bool CXios::usingServer = false; 
     31  bool CXios::usingServer2 = false; 
     32  int CXios::ratioServer2 = 50; 
    3133  double CXios::bufferSizeFactor = 1.0; 
    3234  const double CXios::defaultBufferSizeFactor = 1.0; 
     
    5254    usingOasis=getin<bool>("using_oasis",false) ; 
    5355    usingServer=getin<bool>("using_server",false) ; 
     56    usingServer2=getin<bool>("using_server2",false) ; 
     57    ratioServer2=getin<int>("ratio_server2",50); 
    5458    info.setLevel(getin<int>("info_level",0)) ; 
    5559    report.setLevel(getin<int>("info_level",50)); 
     
    135139  { 
    136140    initServer(); 
    137     if (serverLvl == 1) 
     141 
     142//    if (serverLvl == 1) 
     143//      isClient = true; 
     144//    else 
     145//      isClient = false; 
     146// 
     147//    isServer = true; 
     148//    serverLevel = serverLvl; 
     149 
     150 
     151 
     152    // Initialize all aspects MPI 
     153    CServer::initialize(); 
     154    isServer = true; 
     155    if (CServer::serverLevel == 1) 
    138156      isClient = true; 
    139157    else 
    140158      isClient = false; 
    141159 
    142     isServer = true; 
    143     serverLevel = serverLvl; 
    144  
    145     // Initialize all aspects MPI 
    146     CServer::initialize(); 
    147160    if (CServer::getRank()==0) globalRegistry = new CRegistry(CServer::intraComm) ; 
    148161     
    149162    if (printLogs2Files) 
    150163    { 
    151       if (CXios::serverLevel == 0) 
     164      if (CServer::serverLevel == 0) 
     165//      if (CXios::serverLevel == 0) 
    152166      { 
    153167        CServer::openInfoStream(serverFile); 
    154168        CServer::openErrorStream(serverFile); 
    155169      } 
    156       else if (CXios::serverLevel == 1) 
     170      else if (CServer::serverLevel == 1) 
     171//      else if (CXios::serverLevel == 1) 
    157172      { 
    158         CServer::openInfoStream(serverPrimFile); 
    159         CServer::openErrorStream(serverPrimFile); 
     173        CServer::openInfoStream(serverPrmFile); 
     174        CServer::openErrorStream(serverPrmFile); 
    160175      } 
    161176      else 
    162177      { 
    163         CServer::openInfoStream(serverScndFile); 
    164         CServer::openErrorStream(serverScndFile); 
     178        CServer::openInfoStream(serverSndFile); 
     179        CServer::openErrorStream(serverSndFile); 
    165180      } 
    166181    } 
     
    197212  } 
    198213 
    199   //! Set using secondary server 
    200 //  void CXios::setUsingSecondaryServer() 
    201 //  { 
    202 //    usingSecondaryServer = true; 
    203 //  } 
    204  
    205214  //! Unset using server 
    206215  void CXios::setNotUsingServer() 
  • XIOS/dev/dev_olga/src/cxios.hpp

    r992 r1021  
    2929     static string rootFile ; //!< Configuration filename 
    3030     static string xiosCodeId ; //!< Identity for XIOS 
    31      static string xiosCodeIdPrm ; //!< Identity for XIOS primary server 
    32      static string xiosCodeIdSnd ; //!< Identity for XIOS secondary server 
     31//     static string xiosCodeIdPrm ; //!< Identity for XIOS primary server 
     32//     static string xiosCodeIdSnd ; //!< Identity for XIOS secondary server 
    3333     static string clientFile;        //!< Filename template for client 
    3434     static string serverFile;        //!< Filename template for server 
    35      static string serverPrimFile;  //!< Filename template for primary server in case of two server groups 
    36      static string serverScndFile;  //!< Filename template for secondary server in case of two server groups 
     35     static string serverPrmFile;  //!< Filename template for primary server in case of two server levels 
     36     static string serverSndFile;  //!< Filename template for secondary server in case of two server levels 
    3737 
    3838     static bool isClient ; //!< Check if xios is client 
    3939     static bool isServer ; //!< Check if xios is server 
    4040 
    41      static int serverLevel ; // 
     41//     static int serverLevel ; 
    4242 
    4343     static MPI_Comm globalComm ; //!< Global communicator 
     
    4646     static bool usingOasis ; //!< Using Oasis 
    4747     static bool usingServer ; //!< Using server (server mode) 
     48     static bool usingServer2 ; //!< Using secondary server (server mode) 
     49     static int ratioServer2 ;  //!< Percentage of server processors dedicated to secondary server 
    4850     static double bufferSizeFactor; //!< Factor used to tune the buffer size 
    4951     static const double defaultBufferSizeFactor; //!< Default factor value 
     
    5557     //! Setting xios to use server mode 
    5658     static void setUsingServer(); 
    57  
    58      //! Setting xios to use secondary server mode 
    59 //     static void setUsingSecondaryServer(); 
    6059 
    6160     //! Setting xios NOT to use server mode 
  • XIOS/dev/dev_olga/src/distribution_client.cpp

    r992 r1021  
    2424   , elementZoomMask_(), elementNLocal_(), elementNGlobal_() 
    2525{ 
    26 //  numElement_ = globalLocalIndex.size();    !!! numElement_ should be calculated (?) 
    2726  isComputed_ = true; 
    2827  localDataIndex_.resize(globalLocalIndex.size()); 
  • XIOS/dev/dev_olga/src/filter/filter.cpp

    r827 r1021  
    55  CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine) 
    66    : CInputPin(gc, inputSlotsCount) 
    7     , COutputPin() 
     7    , COutputPin(gc) 
    88    , engine(engine) 
    99    , inputSlotCount(inputSlotCount) 
     
    1414    CDataPacketPtr outputPacket = engine->apply(data); 
    1515    if (outputPacket) 
    16       deliverOuput(outputPacket); 
     16      onOutputReady(outputPacket); 
     17  } 
     18 
     19  void CFilter::setInputTrigger(size_t inputSlot, COutputPin* trigger) 
     20  { 
     21    // Was the filter already triggerable? If not, we need to inform 
     22    // all downstream filters. 
     23    bool wasTriggerable = canBeTriggered(); 
     24 
     25    CInputPin::setInputTrigger(inputSlot, trigger); 
     26 
     27    if (!wasTriggerable) 
     28      setOutputTriggers(); 
     29  } 
     30 
     31  void CFilter::trigger(Time timestamp) 
     32  { 
     33    CInputPin::trigger(timestamp); 
     34 
     35    COutputPin::trigger(timestamp); 
     36  } 
     37 
     38  bool CFilter::canBeTriggered() const 
     39  { 
     40    return (CInputPin::canBeTriggered() || COutputPin::canBeTriggered()); 
    1741  } 
    1842} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/filter.hpp

    r827 r1021  
    2626      CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 
    2727 
     28      /*! 
     29       * Sets the trigger for a specific input slot. 
     30       * 
     31       * \param inputSlot the input slot number 
     32       * \param trigger the corresponding trigger 
     33       */ 
     34      void virtual setInputTrigger(size_t inputSlot, COutputPin* trigger); 
     35 
     36      /*! 
     37       * Triggers the filter for the specified timestamp. 
     38       * 
     39       * \param timestamp the timestamp for which we are triggering the filter 
     40       */ 
     41      void virtual trigger(Time timestamp); 
     42 
     43      /*! 
     44       * Tests if the filter can be triggered. 
     45       * 
     46       * \return true if the filter can be triggered 
     47       */ 
     48      bool virtual canBeTriggered() const; 
     49 
    2850    protected: 
    2951      IFilterEngine* engine; //!< The filter engine, might be the filter itself 
  • XIOS/dev/dev_olga/src/filter/garbage_collector.cpp

    r639 r1021  
    33namespace xios 
    44{ 
    5   void CGarbageCollector::registerFilter(CInputPin* inputPin, Time timestamp) 
     5  void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) 
    66  { 
    7     registeredFilters[timestamp].insert(inputPin); 
     7    registeredObjects[timestamp].insert(Object); 
    88  } 
    99 
    10   void CGarbageCollector::unregisterFilter(CInputPin* inputPin, Time timestamp) 
     10  void CGarbageCollector::unregisterObject(InvalidableObject* Object, Time timestamp) 
    1111  { 
    12     std::map<Time, std::set<CInputPin*> >::iterator it = registeredFilters.find(timestamp); 
    13     if (it != registeredFilters.end()) 
    14       it->second.erase(inputPin); 
     12    std::map<Time, std::set<InvalidableObject*> >::iterator it = registeredObjects.find(timestamp); 
     13    if (it != registeredObjects.end()) 
     14      it->second.erase(Object); 
    1515  } 
    1616 
    1717  void CGarbageCollector::invalidate(Time timestamp) 
    1818  { 
    19     std::map<Time, std::set<CInputPin*> >::iterator it    = registeredFilters.begin(), 
    20                                                     itEnd = registeredFilters.lower_bound(timestamp); 
     19    std::map<Time, std::set<InvalidableObject*> >::iterator it    = registeredObjects.begin(), 
     20                                                            itEnd = registeredObjects.lower_bound(timestamp); 
    2121    for (; it != itEnd; ++it) 
    2222    { 
    23       std::set<CInputPin*>::iterator itFilter    = it->second.begin(), 
    24                                      itFilterEnd = it->second.end(); 
    25       for (; itFilter != itFilterEnd; ++itFilter) 
    26         (*itFilter)->invalidate(timestamp); 
     23      std::set<InvalidableObject*>::iterator itObject    = it->second.begin(), 
     24                                             itObjectEnd = it->second.end(); 
     25      for (; itObject != itObjectEnd; ++itObject) 
     26        (*itObject)->invalidate(timestamp); 
    2727    } 
    28     registeredFilters.erase(registeredFilters.begin(), itEnd); 
     28    registeredObjects.erase(registeredObjects.begin(), itEnd); 
    2929  } 
    3030} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/garbage_collector.hpp

    r639 r1021  
    55#include <set> 
    66 
    7 #include "input_pin.hpp" 
     7#include "date.hpp" 
    88 
    99namespace xios 
    1010{ 
     11  /*! 
     12   * Interface shared by all objects that might need to invalidate packets. 
     13   */ 
     14  struct InvalidableObject 
     15  { 
     16    /*! 
     17     * Removes all pending packets which are older than the specified timestamp. 
     18     * 
     19     * \param timestamp the timestamp used for invalidation 
     20     */ 
     21    void virtual invalidate(Time timestamp) = 0; 
     22  }; // struct InvalidableObject 
     23 
    1124  /*! 
    1225   * A basic garbage collector which ensures no old packets linger in the filter graph. 
     
    2235 
    2336      /*! 
    24        * Registers a filter for a specified timestamp. 
     37       * Registers an object for a specified timestamp. 
    2538       * 
    26        * \param inputPin the input pin of the filter to register 
    27        * \param timestamp the timestamp for which the filter is registered 
     39       * \param object the object to register 
     40       * \param timestamp the timestamp for which the object is registered 
    2841       */ 
    29       void registerFilter(CInputPin* inputPin, Time timestamp); 
     42      void registerObject(InvalidableObject* object, Time timestamp); 
    3043 
    3144      /*! 
    32        * Removes a filter previously registered for a specified timestamp. 
     45       * Removes a object previously registered for a specified timestamp. 
    3346       * 
    34        * \param inputPin the input pin of the filter to unregister 
    35        * \param timestamp the timestamp for which the filter is unregistered 
     47       * \param object the object to unregister 
     48       * \param timestamp the timestamp for which the object is unregistered 
    3649       */ 
    37       void unregisterFilter(CInputPin* inputPin, Time timestamp); 
     50      void unregisterObject(InvalidableObject* object, Time timestamp); 
    3851 
    3952      /*! 
    40        * Ensures all registered filters invalidate packets older than the specified timestamp. 
     53       * Ensures all registered objects invalidate packets older than the specified timestamp. 
    4154       * 
    4255       * \param timestamp the timestamp used for invalidation 
     
    4861      CGarbageCollector& operator=(const CGarbageCollector&); 
    4962 
    50       std::map<Time, std::set<CInputPin*> > registeredFilters; //!< Currently registered filters 
     63      std::map<Time, std::set<InvalidableObject*> > registeredObjects; //!< Currently registered objects 
    5164  }; // class CGarbageCollector 
    5265} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/input_pin.cpp

    r639 r1021  
    11#include "input_pin.hpp" 
     2#include "output_pin.hpp" 
    23#include "garbage_collector.hpp" 
    34#include "exception.hpp" 
     
    89    : gc(gc) 
    910    , slotsCount(slotsCount) 
     11    , triggers(slotsCount) 
     12    , hasTriggers(false) 
    1013  { /* Nothing to do */ } 
    1114 
     
    2326    { 
    2427      it = inputs.insert(std::make_pair(packet->timestamp, InputBuffer(slotsCount))).first; 
    25       gc.registerFilter(this, packet->timestamp); 
     28      gc.registerObject(this, packet->timestamp); 
    2629    } 
    2730    it->second.slotsFilled++; 
     
    3134    { 
    3235      // Unregister before calling onInputReady in case the filter registers again 
    33       gc.unregisterFilter(this, packet->timestamp); 
     36      gc.unregisterObject(this, packet->timestamp); 
    3437      onInputReady(it->second.packets); 
    3538      inputs.erase(it); 
    3639    } 
     40  } 
     41 
     42  void CInputPin::setInputTrigger(size_t inputSlot, COutputPin* trigger) 
     43  { 
     44    if (inputSlot >= slotsCount) 
     45      ERROR("void CInputPin::setInputTrigger(size_t inputSlot, COutputPin* trigger)", 
     46            "The input slot " << inputSlot << " does not exist."); 
     47    if (triggers[inputSlot]) 
     48      ERROR("void CInputPin::setInputTrigger(size_t inputSlot, COutputPin* trigger)", 
     49            "The trigger for input slot " << inputSlot << " has already been set."); 
     50 
     51    triggers[inputSlot] = trigger; 
     52    hasTriggers = true; 
     53  } 
     54 
     55  void CInputPin::trigger(Time timestamp) 
     56  { 
     57    if (hasTriggers) // Don't use canBeTriggered here, this function is virtual and can be overriden 
     58    { 
     59      std::map<Time, InputBuffer>::iterator it = inputs.find(timestamp); 
     60      bool nothingReceived = (it == inputs.end()); 
     61 
     62      for (size_t s = 0; s < slotsCount; s++) 
     63      { 
     64        if (triggers[s] && (nothingReceived || !it->second.packets[s])) 
     65          triggers[s]->trigger(timestamp); 
     66      } 
     67    } 
     68  } 
     69 
     70  bool CInputPin::canBeTriggered() const 
     71  { 
     72    return hasTriggers; 
    3773  } 
    3874 
  • XIOS/dev/dev_olga/src/filter/input_pin.hpp

    r639 r1021  
    55#include <map> 
    66 
     7#include "garbage_collector.hpp" 
    78#include "data_packet.hpp" 
    89 
    910namespace xios 
    1011{ 
    11   class CGarbageCollector; 
     12  class COutputPin; 
    1213 
    1314  /*! 
    1415   * An input pin handles the data packets received by a filter. 
    1516   */ 
    16   class CInputPin 
     17  class CInputPin : public InvalidableObject 
    1718  { 
    1819    public: 
     
    2728 
    2829      /*! 
     30       * Sets the trigger for a specific input slot. 
     31       * 
     32       * \param inputSlot the input slot number 
     33       * \param trigger the corresponding trigger 
     34       */ 
     35      void virtual setInputTrigger(size_t inputSlot, COutputPin* trigger); 
     36 
     37      /*! 
    2938       * Receives a data packet from an upstream filter on 
    3039       * the specified input slot. 
     
    3746 
    3847      /*! 
     48       * Triggers the input of any buffered packet for the specified timestamp. 
     49       * 
     50       * \param timestamp the timestamp for which we are triggering the input 
     51       */ 
     52      void virtual trigger(Time timestamp); 
     53 
     54      /*! 
     55       * Tests if the pin can be triggered. 
     56       * 
     57       * \return true if the pin can be triggered 
     58       */ 
     59      bool virtual canBeTriggered() const; 
     60 
     61      /*! 
    3962       * Removes all pending packets which are older than the specified timestamp. 
    4063       * 
     
    4467 
    4568    protected: 
    46       CGarbageCollector& gc; //!< The garbage collector associated to the input pin 
    47  
    4869      /*! 
    4970       * Function triggered when all slots have been filled for a specific timestamp. 
     
    7596      }; 
    7697 
     98      CGarbageCollector& gc; //!< The garbage collector associated to the input pin 
     99 
    77100      size_t slotsCount; //!< The number of slots 
    78101 
    79102      //! Input buffer, store the packets until all slots are full for a timestep 
    80103      std::map<Time, InputBuffer> inputs; 
     104 
     105      //! Store the triggers corresponding to the input slots 
     106      std::vector<COutputPin*> triggers; 
     107 
     108      //! Whether some triggers have been set 
     109      bool hasTriggers; 
    81110  }; // class CInputPin 
    82111} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/output_pin.cpp

    r637 r1021  
    44namespace xios 
    55{ 
     6  COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/) 
     7    : gc(gc) 
     8    , manualTrigger(manualTrigger) 
     9  { /* Nothing to do */ } 
     10 
    611  void COutputPin::connectOutput(boost::shared_ptr<CInputPin> inputPin, size_t inputSlot) 
    712  { 
     
    1116 
    1217    outputs.push_back(std::make_pair(inputPin, inputSlot)); 
     18 
     19    if (canBeTriggered()) 
     20      inputPin->setInputTrigger(inputSlot, this); 
     21  } 
     22 
     23  void COutputPin::onOutputReady(CDataPacketPtr packet) 
     24  { 
     25    if (!packet) 
     26      ERROR("void COutputPin::onOutputReady(CDataPacketPtr packet)", 
     27            "The packet cannot be null."); 
     28 
     29    if (manualTrigger) // Don't use canBeTriggered here, this function is virtual and can be overriden 
     30    { 
     31      outputPackets[packet->timestamp] = packet; 
     32      gc.registerObject(this, packet->timestamp); 
     33    } 
     34    else 
     35      deliverOuput(packet); 
    1336  } 
    1437 
     
    2346      it->first->setInput(it->second, packet); 
    2447  } 
     48 
     49  void COutputPin::trigger(Time timestamp) 
     50  { 
     51    if (manualTrigger) // Don't use canBeTriggered here, this function is virtual and can be overriden 
     52    { 
     53      std::map<Time, CDataPacketPtr>::iterator it = outputPackets.find(timestamp); 
     54      if (it != outputPackets.end()) 
     55      { 
     56        gc.unregisterObject(this, timestamp); 
     57        deliverOuput(it->second); 
     58        outputPackets.erase(it); 
     59      } 
     60    } 
     61  } 
     62 
     63  bool COutputPin::canBeTriggered() const 
     64  { 
     65    return manualTrigger; 
     66  } 
     67 
     68  void COutputPin::setOutputTriggers() 
     69  { 
     70    std::vector<std::pair<boost::shared_ptr<CInputPin>, size_t> >::iterator it, itEnd; 
     71    for (it = outputs.begin(), itEnd = outputs.end(); it != itEnd; ++it) 
     72      it->first->setInputTrigger(it->second, this); 
     73  } 
     74 
     75  void COutputPin::invalidate(Time timestamp) 
     76  { 
     77    outputPackets.erase(outputPackets.begin(), outputPackets.lower_bound(timestamp)); 
     78  } 
    2579} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/output_pin.hpp

    r637 r1021  
    22#define __XIOS_COutputPin__ 
    33 
     4#include "garbage_collector.hpp" 
    45#include "input_pin.hpp" 
    56 
     
    910   * An output pin handles the connections with downstream filters. 
    1011   */ 
    11   class COutputPin 
     12  class COutputPin : public InvalidableObject 
    1213  { 
    1314    public: 
     15      /*! 
     16       * Constructs an ouput pin with manual or automatic trigger 
     17       * and an associated garbage collector. 
     18       * 
     19       * \param gc the garbage collector associated with this ouput pin 
     20       * \param slotsCount the number of slots 
     21       */ 
     22      COutputPin(CGarbageCollector& gc, bool manualTrigger = false); 
     23 
    1424      /*! 
    1525       * Connects to a specific slot of the input pin of a downstream filter. 
     
    2131      void connectOutput(boost::shared_ptr<CInputPin> inputPin, size_t inputSlot); 
    2232 
     33      /*! 
     34       * Triggers the output of any buffered packet for the specified timestamp. 
     35       * 
     36       * \param timestamp the timestamp for which we are triggering the output 
     37       */ 
     38      void virtual trigger(Time timestamp); 
     39 
     40      /*! 
     41       * Tests if the pin can be triggered. 
     42       * 
     43       * \return true if the pin can be triggered 
     44       */ 
     45      bool virtual canBeTriggered() const; 
     46 
     47      /*! 
     48       * Removes all pending packets which are older than the specified timestamp. 
     49       * 
     50       * \param timestamp the timestamp used for invalidation 
     51       */ 
     52      void virtual invalidate(Time timestamp); 
     53 
    2354    protected: 
     55      /*! 
     56       * Function triggered when a packet is ready to be delivered. 
     57       * 
     58       * \param packet the packet ready for output 
     59       */ 
     60      void onOutputReady(CDataPacketPtr packet); 
     61 
     62      /*! 
     63       * Informs the downstream pins that this output pin should be triggered. 
     64       */ 
     65      void setOutputTriggers(); 
     66 
     67    private: 
    2468      /*! 
    2569       * Delivers an output packet to the downstreams filter. 
     
    2973      void deliverOuput(CDataPacketPtr packet); 
    3074 
    31     private: 
     75      CGarbageCollector& gc; //!< The garbage collector associated to the output pin 
     76 
     77      //!< Whether the ouput should be triggered manually 
     78      bool manualTrigger; 
     79 
    3280      //!< The list of connected filters and the corresponding slot numbers 
    3381      std::vector<std::pair<boost::shared_ptr<CInputPin>, size_t> > outputs; 
     82 
     83      //! Output buffer, store the packets until the output is triggered 
     84      std::map<Time, CDataPacketPtr> outputPackets; 
    3485  }; // class COutputPin 
    3586} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/source_filter.cpp

    r932 r1021  
    66namespace xios 
    77{ 
    8   CSourceFilter::CSourceFilter(CGrid* grid, const CDuration offset /*= NoneDu*/) 
    9     : grid(grid) 
     8  CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
     9                               const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/) 
     10    : COutputPin(gc, manualTrigger) 
     11    , grid(grid) 
    1012    , offset(offset) 
    1113  { 
     
    2830    grid->inputField(data, packet->data); 
    2931 
    30     deliverOuput(packet); 
     32    onOutputReady(packet); 
    3133  } 
    3234 
     
    4850    packet->status = CDataPacket::NO_ERROR; 
    4951 
    50     if (data.size() != grid->storeIndex_toSrv.size()) 
     52    // if (data.size() != grid->storeIndex_toSrv.size()) 
     53    if (data.size() != grid->storeIndex_fromSrv.size()) 
    5154      ERROR("CSourceFilter::streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data)", 
    5255            << "Incoherent data received from servers," 
    53             << " expected " << grid->storeIndex_toSrv.size() << " chunks but " << data.size() << " were given."); 
     56            << " expected " << grid->storeIndex_fromSrv.size() << " chunks but " << data.size() << " were given."); 
    5457 
    5558    packet->data.resize(grid->storeIndex_client.numElements()); 
     
    5760    for (it = data.begin(); it != itEnd; it++) 
    5861    { 
    59       CArray<int,1>& index = grid->storeIndex_toSrv[it->first]; 
    60  
     62      // CArray<int,1>& index = grid->storeIndex_toSrv[it->first]; 
     63      CArray<int,1>& index = grid->storeIndex_fromSrv[it->first]; 
    6164      for (int n = 0; n < index.numElements(); n++) 
    6265        packet->data(index(n)) = it->second(n); 
    6366    } 
    6467 
    65     deliverOuput(packet); 
     68    onOutputReady(packet); 
    6669  } 
    6770 
     
    7275    packet->timestamp = date; 
    7376    packet->status = CDataPacket::END_OF_STREAM; 
    74     deliverOuput(packet); 
     77    onOutputReady(packet); 
    7578  } 
    7679} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/source_filter.hpp

    r756 r1021  
    1919       * Constructs a source filter accepting data attached to the specified grid. 
    2020       * 
     21       * \param gc the garbage collector associated with this filter 
    2122       * \param grid the grid to which the data is attached 
    2223       * \param offset the offset applied to the timestamp of all packets 
     24       * \param manualTrigger whether the output should be triggered manually 
    2325       */ 
    24       CSourceFilter(CGrid* grid, const CDuration offset = NoneDu); 
     26      CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
     27                    const CDuration offset = NoneDu, bool manualTrigger = false); 
    2528 
    2629      /*! 
  • XIOS/dev/dev_olga/src/filter/spatial_transform_filter.cpp

    r979 r1021  
    5353    CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue); 
    5454    if (outputPacket) 
    55       deliverOuput(outputPacket); 
     55      onOutputReady(outputPacket); 
    5656  } 
    5757 
     
    218218    if (dataCurrentDest.numElements() != dataDest.numElements()) 
    219219    ERROR("CSpatialTransformFilterEngine::apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest)", 
    220           "Incoherent between the received size and expected size" << 
    221           "Expected size: " << dataDest.numElements() << 
    222           "Received size: " << dataCurrentDest.numElements()); 
     220          "Incoherent between the received size and expected size. " << std::endl  
     221          << "Expected size: " << dataDest.numElements() << std::endl  
     222          << "Received size: " << dataCurrentDest.numElements()); 
    223223 
    224224    dataDest = dataCurrentDest; 
  • XIOS/dev/dev_olga/src/filter/store_filter.cpp

    r932 r1021  
    88  CStoreFilter::CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid) 
    99    : CInputPin(gc, 1) 
     10    , gc(gc) 
    1011    , context(context) 
    1112    , grid(grid) 
     
    2324    CTimer timer("CStoreFilter::getPacket"); 
    2425    CConstDataPacketPtr packet; 
    25     const double timeout = 10; // 10 seconds timeout 
     26    const double timeout = 10 ; // 10 seconds timeout 
    2627 
    2728    do 
    2829    { 
     30      if (canBeTriggered()) 
     31        trigger(timestamp); 
     32 
    2933      timer.resume(); 
    3034 
     
    3943 
    4044    if (!packet) 
     45    { 
     46      std::map<Time, CDataPacketPtr>::const_iterator it ; 
     47      info(0)<<"Impossible to get the packet with timestamp = " << timestamp<<std::endl<<"Available timestamp are : "<<std::endl ; 
     48      for(it=packets.begin();it!=packets.end();++it) info(0)<<it->first<<"  "; 
     49      info(0)<<std::endl ; 
    4150      ERROR("CConstDataPacketPtr CStoreFilter::getPacket(Time timestamp) const", 
    4251            << "Impossible to get the packet with timestamp = " << timestamp); 
    43  
     52    } 
    4453    return packet; 
    4554  } 
     
    6978    // The packet is always destroyed by the garbage collector 
    7079    // so we register but never unregister 
    71     gc.registerFilter(this, data[0]->timestamp); 
     80    gc.registerObject(this, data[0]->timestamp); 
    7281  } 
    7382 
  • XIOS/dev/dev_olga/src/filter/store_filter.hpp

    r639 r1021  
    6565 
    6666    private: 
     67      CGarbageCollector& gc; //!< The garbage collector associated to the filter 
    6768      CContext* context; //!< The context to which the data belongs 
    6869      CGrid* grid; //!< The grid attached to the data the filter can accept 
  • XIOS/dev/dev_olga/src/group_template.hpp

    r1009 r1021  
    66#include "event_server.hpp" 
    77#include "object_template.hpp" 
     8#include "context_client.hpp" 
    89 
    910namespace xios 
     
    7273         static bool dispatchEvent(CEventServer& event) ; 
    7374         void sendCreateChild(const string& id="") ; 
    74          void sendCreateChild(const string& id, const int srvPool) ; 
     75         void sendCreateChild(const string& id, CContextClient* client) ; 
    7576         void sendCreateChildGroup(const string& id="") ; 
    7677         static void recvCreateChild(CEventServer& event) ; 
  • XIOS/dev/dev_olga/src/group_template_impl.hpp

    r1009 r1021  
    88#include "context.hpp" 
    99#include "event_client.hpp" 
    10 #include "context_client.hpp" 
    1110#include "message.hpp" 
    1211#include "type.hpp" 
     
    419418       
    420419   } 
    421     
    422    template <class U, class V, class W> 
    423    void CGroupTemplate<U, V, W>::sendCreateChild(const string& id, const int srvPool) 
    424    { 
    425     CContext* context=CContext::getCurrent() ; 
    426     CContextClient* contextClientTmp = context->clientPrimServer[srvPool]; 
     420 
     421   template <class U, class V, class W> 
     422   void CGroupTemplate<U, V, W>::sendCreateChild(const string& id, CContextClient* client) 
     423   { 
    427424 
    428425    CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ; 
    429     if (contextClientTmp->isServerLeader()) 
     426    if (client->isServerLeader()) 
    430427    { 
    431428      CMessage msg ; 
    432429      msg<<this->getId() ; 
    433430      msg<<id ; 
    434       const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
     431      const std::list<int>& ranks = client->getRanksServerLeader(); 
    435432      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    436433       event.push(*itRank,1,msg) ; 
    437       contextClientTmp->sendEvent(event) ; 
     434      client->sendEvent(event) ; 
    438435    } 
    439     else contextClientTmp->sendEvent(event) ; 
    440    } 
     436    else client->sendEvent(event) ; 
     437   } 
     438 
    441439 
    442440   template <class U, class V, class W> 
     
    444442   { 
    445443    CContext* context=CContext::getCurrent() ; 
    446  
    447         // if (! context->hasServer ) 
    448444    if (context->hasClient) 
    449445    { 
    450         // Use correct context client to send message 
    451 //      CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 
     446      // Use correct context client to send message 
    452447      int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    453448      for (int i = 0; i < nbSrvPools; ++i) 
  • XIOS/dev/dev_olga/src/interface/c_attr/icfield_attr.cpp

    r891 r1021  
    6767 
    6868 
     69  void cxios_set_field_cell_methods(field_Ptr field_hdl, const char * cell_methods, int cell_methods_size) 
     70  { 
     71    std::string cell_methods_str; 
     72    if (!cstr2string(cell_methods, cell_methods_size, cell_methods_str)) return; 
     73    CTimer::get("XIOS").resume(); 
     74    field_hdl->cell_methods.setValue(cell_methods_str); 
     75    CTimer::get("XIOS").suspend(); 
     76  } 
     77 
     78  void cxios_get_field_cell_methods(field_Ptr field_hdl, char * cell_methods, int cell_methods_size) 
     79  { 
     80    CTimer::get("XIOS").resume(); 
     81    if (!string_copy(field_hdl->cell_methods.getInheritedValue(), cell_methods, cell_methods_size)) 
     82      ERROR("void cxios_get_field_cell_methods(field_Ptr field_hdl, char * cell_methods, int cell_methods_size)", << "Input string is too short"); 
     83    CTimer::get("XIOS").suspend(); 
     84  } 
     85 
     86  bool cxios_is_defined_field_cell_methods(field_Ptr field_hdl) 
     87  { 
     88     CTimer::get("XIOS").resume(); 
     89     bool isDefined = field_hdl->cell_methods.hasInheritedValue(); 
     90     CTimer::get("XIOS").suspend(); 
     91     return isDefined; 
     92  } 
     93 
     94 
     95  void cxios_set_field_cell_methods_mode(field_Ptr field_hdl, const char * cell_methods_mode, int cell_methods_mode_size) 
     96  { 
     97    std::string cell_methods_mode_str; 
     98    if (!cstr2string(cell_methods_mode, cell_methods_mode_size, cell_methods_mode_str)) return; 
     99    CTimer::get("XIOS").resume(); 
     100    field_hdl->cell_methods_mode.fromString(cell_methods_mode_str); 
     101    CTimer::get("XIOS").suspend(); 
     102  } 
     103 
     104  void cxios_get_field_cell_methods_mode(field_Ptr field_hdl, char * cell_methods_mode, int cell_methods_mode_size) 
     105  { 
     106    CTimer::get("XIOS").resume(); 
     107    if (!string_copy(field_hdl->cell_methods_mode.getInheritedStringValue(), cell_methods_mode, cell_methods_mode_size)) 
     108      ERROR("void cxios_get_field_cell_methods_mode(field_Ptr field_hdl, char * cell_methods_mode, int cell_methods_mode_size)", << "Input string is too short"); 
     109    CTimer::get("XIOS").suspend(); 
     110  } 
     111 
     112  bool cxios_is_defined_field_cell_methods_mode(field_Ptr field_hdl) 
     113  { 
     114     CTimer::get("XIOS").resume(); 
     115     bool isDefined = field_hdl->cell_methods_mode.hasInheritedValue(); 
     116     CTimer::get("XIOS").suspend(); 
     117     return isDefined; 
     118  } 
     119 
     120 
    69121  void cxios_set_field_compression_level(field_Ptr field_hdl, int compression_level) 
    70122  { 
     
    180232     CTimer::get("XIOS").resume(); 
    181233     bool isDefined = field_hdl->enabled.hasInheritedValue(); 
     234     CTimer::get("XIOS").suspend(); 
     235     return isDefined; 
     236  } 
     237 
     238 
     239  void cxios_set_field_expr(field_Ptr field_hdl, const char * expr, int expr_size) 
     240  { 
     241    std::string expr_str; 
     242    if (!cstr2string(expr, expr_size, expr_str)) return; 
     243    CTimer::get("XIOS").resume(); 
     244    field_hdl->expr.setValue(expr_str); 
     245    CTimer::get("XIOS").suspend(); 
     246  } 
     247 
     248  void cxios_get_field_expr(field_Ptr field_hdl, char * expr, int expr_size) 
     249  { 
     250    CTimer::get("XIOS").resume(); 
     251    if (!string_copy(field_hdl->expr.getInheritedValue(), expr, expr_size)) 
     252      ERROR("void cxios_get_field_expr(field_Ptr field_hdl, char * expr, int expr_size)", << "Input string is too short"); 
     253    CTimer::get("XIOS").suspend(); 
     254  } 
     255 
     256  bool cxios_is_defined_field_expr(field_Ptr field_hdl) 
     257  { 
     258     CTimer::get("XIOS").resume(); 
     259     bool isDefined = field_hdl->expr.hasInheritedValue(); 
    182260     CTimer::get("XIOS").suspend(); 
    183261     return isDefined; 
  • XIOS/dev/dev_olga/src/interface/c_attr/icfieldgroup_attr.cpp

    r891 r1021  
    6767 
    6868 
     69  void cxios_set_fieldgroup_cell_methods(fieldgroup_Ptr fieldgroup_hdl, const char * cell_methods, int cell_methods_size) 
     70  { 
     71    std::string cell_methods_str; 
     72    if (!cstr2string(cell_methods, cell_methods_size, cell_methods_str)) return; 
     73    CTimer::get("XIOS").resume(); 
     74    fieldgroup_hdl->cell_methods.setValue(cell_methods_str); 
     75    CTimer::get("XIOS").suspend(); 
     76  } 
     77 
     78  void cxios_get_fieldgroup_cell_methods(fieldgroup_Ptr fieldgroup_hdl, char * cell_methods, int cell_methods_size) 
     79  { 
     80    CTimer::get("XIOS").resume(); 
     81    if (!string_copy(fieldgroup_hdl->cell_methods.getInheritedValue(), cell_methods, cell_methods_size)) 
     82      ERROR("void cxios_get_fieldgroup_cell_methods(fieldgroup_Ptr fieldgroup_hdl, char * cell_methods, int cell_methods_size)", << "Input string is too short"); 
     83    CTimer::get("XIOS").suspend(); 
     84  } 
     85 
     86  bool cxios_is_defined_fieldgroup_cell_methods(fieldgroup_Ptr fieldgroup_hdl) 
     87  { 
     88     CTimer::get("XIOS").resume(); 
     89     bool isDefined = fieldgroup_hdl->cell_methods.hasInheritedValue(); 
     90     CTimer::get("XIOS").suspend(); 
     91     return isDefined; 
     92  } 
     93 
     94 
     95  void cxios_set_fieldgroup_cell_methods_mode(fieldgroup_Ptr fieldgroup_hdl, const char * cell_methods_mode, int cell_methods_mode_size) 
     96  { 
     97    std::string cell_methods_mode_str; 
     98    if (!cstr2string(cell_methods_mode, cell_methods_mode_size, cell_methods_mode_str)) return; 
     99    CTimer::get("XIOS").resume(); 
     100    fieldgroup_hdl->cell_methods_mode.fromString(cell_methods_mode_str); 
     101    CTimer::get("XIOS").suspend(); 
     102  } 
     103 
     104  void cxios_get_fieldgroup_cell_methods_mode(fieldgroup_Ptr fieldgroup_hdl, char * cell_methods_mode, int cell_methods_mode_size) 
     105  { 
     106    CTimer::get("XIOS").resume(); 
     107    if (!string_copy(fieldgroup_hdl->cell_methods_mode.getInheritedStringValue(), cell_methods_mode, cell_methods_mode_size)) 
     108      ERROR("void cxios_get_fieldgroup_cell_methods_mode(fieldgroup_Ptr fieldgroup_hdl, char * cell_methods_mode, int cell_methods_mode_size)", << "Input string is too short"); 
     109    CTimer::get("XIOS").suspend(); 
     110  } 
     111 
     112  bool cxios_is_defined_fieldgroup_cell_methods_mode(fieldgroup_Ptr fieldgroup_hdl) 
     113  { 
     114     CTimer::get("XIOS").resume(); 
     115     bool isDefined = fieldgroup_hdl->cell_methods_mode.hasInheritedValue(); 
     116     CTimer::get("XIOS").suspend(); 
     117     return isDefined; 
     118  } 
     119 
     120 
    69121  void cxios_set_fieldgroup_compression_level(fieldgroup_Ptr fieldgroup_hdl, int compression_level) 
    70122  { 
     
    180232     CTimer::get("XIOS").resume(); 
    181233     bool isDefined = fieldgroup_hdl->enabled.hasInheritedValue(); 
     234     CTimer::get("XIOS").suspend(); 
     235     return isDefined; 
     236  } 
     237 
     238 
     239  void cxios_set_fieldgroup_expr(fieldgroup_Ptr fieldgroup_hdl, const char * expr, int expr_size) 
     240  { 
     241    std::string expr_str; 
     242    if (!cstr2string(expr, expr_size, expr_str)) return; 
     243    CTimer::get("XIOS").resume(); 
     244    fieldgroup_hdl->expr.setValue(expr_str); 
     245    CTimer::get("XIOS").suspend(); 
     246  } 
     247 
     248  void cxios_get_fieldgroup_expr(fieldgroup_Ptr fieldgroup_hdl, char * expr, int expr_size) 
     249  { 
     250    CTimer::get("XIOS").resume(); 
     251    if (!string_copy(fieldgroup_hdl->expr.getInheritedValue(), expr, expr_size)) 
     252      ERROR("void cxios_get_fieldgroup_expr(fieldgroup_Ptr fieldgroup_hdl, char * expr, int expr_size)", << "Input string is too short"); 
     253    CTimer::get("XIOS").suspend(); 
     254  } 
     255 
     256  bool cxios_is_defined_fieldgroup_expr(fieldgroup_Ptr fieldgroup_hdl) 
     257  { 
     258     CTimer::get("XIOS").resume(); 
     259     bool isDefined = fieldgroup_hdl->expr.hasInheritedValue(); 
    182260     CTimer::get("XIOS").suspend(); 
    183261     return isDefined; 
  • XIOS/dev/dev_olga/src/interface/c_attr/icinterpolate_domain_attr.cpp

    r891 r1021  
    3939     CTimer::get("XIOS").resume(); 
    4040     bool isDefined = interpolate_domain_hdl->file.hasInheritedValue(); 
     41     CTimer::get("XIOS").suspend(); 
     42     return isDefined; 
     43  } 
     44 
     45 
     46  void cxios_set_interpolate_domain_mode(interpolate_domain_Ptr interpolate_domain_hdl, const char * mode, int mode_size) 
     47  { 
     48    std::string mode_str; 
     49    if (!cstr2string(mode, mode_size, mode_str)) return; 
     50    CTimer::get("XIOS").resume(); 
     51    interpolate_domain_hdl->mode.fromString(mode_str); 
     52    CTimer::get("XIOS").suspend(); 
     53  } 
     54 
     55  void cxios_get_interpolate_domain_mode(interpolate_domain_Ptr interpolate_domain_hdl, char * mode, int mode_size) 
     56  { 
     57    CTimer::get("XIOS").resume(); 
     58    if (!string_copy(interpolate_domain_hdl->mode.getInheritedStringValue(), mode, mode_size)) 
     59      ERROR("void cxios_get_interpolate_domain_mode(interpolate_domain_Ptr interpolate_domain_hdl, char * mode, int mode_size)", << "Input string is too short"); 
     60    CTimer::get("XIOS").suspend(); 
     61  } 
     62 
     63  bool cxios_is_defined_interpolate_domain_mode(interpolate_domain_Ptr interpolate_domain_hdl) 
     64  { 
     65     CTimer::get("XIOS").resume(); 
     66     bool isDefined = interpolate_domain_hdl->mode.hasInheritedValue(); 
    4167     CTimer::get("XIOS").suspend(); 
    4268     return isDefined; 
     
    88114     return isDefined; 
    89115  } 
     116 
     117 
     118  void cxios_set_interpolate_domain_weight_filename(interpolate_domain_Ptr interpolate_domain_hdl, const char * weight_filename, int weight_filename_size) 
     119  { 
     120    std::string weight_filename_str; 
     121    if (!cstr2string(weight_filename, weight_filename_size, weight_filename_str)) return; 
     122    CTimer::get("XIOS").resume(); 
     123    interpolate_domain_hdl->weight_filename.setValue(weight_filename_str); 
     124    CTimer::get("XIOS").suspend(); 
     125  } 
     126 
     127  void cxios_get_interpolate_domain_weight_filename(interpolate_domain_Ptr interpolate_domain_hdl, char * weight_filename, int weight_filename_size) 
     128  { 
     129    CTimer::get("XIOS").resume(); 
     130    if (!string_copy(interpolate_domain_hdl->weight_filename.getInheritedValue(), weight_filename, weight_filename_size)) 
     131      ERROR("void cxios_get_interpolate_domain_weight_filename(interpolate_domain_Ptr interpolate_domain_hdl, char * weight_filename, int weight_filename_size)", << "Input string is too short"); 
     132    CTimer::get("XIOS").suspend(); 
     133  } 
     134 
     135  bool cxios_is_defined_interpolate_domain_weight_filename(interpolate_domain_Ptr interpolate_domain_hdl) 
     136  { 
     137     CTimer::get("XIOS").resume(); 
     138     bool isDefined = interpolate_domain_hdl->weight_filename.hasInheritedValue(); 
     139     CTimer::get("XIOS").suspend(); 
     140     return isDefined; 
     141  } 
     142 
     143 
     144  void cxios_set_interpolate_domain_write_weight(interpolate_domain_Ptr interpolate_domain_hdl, bool write_weight) 
     145  { 
     146    CTimer::get("XIOS").resume(); 
     147    interpolate_domain_hdl->write_weight.setValue(write_weight); 
     148    CTimer::get("XIOS").suspend(); 
     149  } 
     150 
     151  void cxios_get_interpolate_domain_write_weight(interpolate_domain_Ptr interpolate_domain_hdl, bool* write_weight) 
     152  { 
     153    CTimer::get("XIOS").resume(); 
     154    *write_weight = interpolate_domain_hdl->write_weight.getInheritedValue(); 
     155    CTimer::get("XIOS").suspend(); 
     156  } 
     157 
     158  bool cxios_is_defined_interpolate_domain_write_weight(interpolate_domain_Ptr interpolate_domain_hdl) 
     159  { 
     160     CTimer::get("XIOS").resume(); 
     161     bool isDefined = interpolate_domain_hdl->write_weight.hasInheritedValue(); 
     162     CTimer::get("XIOS").suspend(); 
     163     return isDefined; 
     164  } 
    90165} 
  • XIOS/dev/dev_olga/src/interface/fortran_attr/field_interface_attr.F90

    r891 r1021  
    5050 
    5151 
     52    SUBROUTINE cxios_set_field_cell_methods(field_hdl, cell_methods, cell_methods_size) BIND(C) 
     53      USE ISO_C_BINDING 
     54      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     55      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: cell_methods 
     56      INTEGER  (kind = C_INT)     , VALUE        :: cell_methods_size 
     57    END SUBROUTINE cxios_set_field_cell_methods 
     58 
     59    SUBROUTINE cxios_get_field_cell_methods(field_hdl, cell_methods, cell_methods_size) BIND(C) 
     60      USE ISO_C_BINDING 
     61      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     62      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: cell_methods 
     63      INTEGER  (kind = C_INT)     , VALUE        :: cell_methods_size 
     64    END SUBROUTINE cxios_get_field_cell_methods 
     65 
     66    FUNCTION cxios_is_defined_field_cell_methods(field_hdl) BIND(C) 
     67      USE ISO_C_BINDING 
     68      LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_cell_methods 
     69      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     70    END FUNCTION cxios_is_defined_field_cell_methods 
     71 
     72 
     73    SUBROUTINE cxios_set_field_cell_methods_mode(field_hdl, cell_methods_mode, cell_methods_mode_size) BIND(C) 
     74      USE ISO_C_BINDING 
     75      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     76      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: cell_methods_mode 
     77      INTEGER  (kind = C_INT)     , VALUE        :: cell_methods_mode_size 
     78    END SUBROUTINE cxios_set_field_cell_methods_mode 
     79 
     80    SUBROUTINE cxios_get_field_cell_methods_mode(field_hdl, cell_methods_mode, cell_methods_mode_size) BIND(C) 
     81      USE ISO_C_BINDING 
     82      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     83      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: cell_methods_mode 
     84      INTEGER  (kind = C_INT)     , VALUE        :: cell_methods_mode_size 
     85    END SUBROUTINE cxios_get_field_cell_methods_mode 
     86 
     87    FUNCTION cxios_is_defined_field_cell_methods_mode(field_hdl) BIND(C) 
     88      USE ISO_C_BINDING 
     89      LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_cell_methods_mode 
     90      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     91    END FUNCTION cxios_is_defined_field_cell_methods_mode 
     92 
     93 
    5294    SUBROUTINE cxios_set_field_compression_level(field_hdl, compression_level) BIND(C) 
    5395      USE ISO_C_BINDING 
     
    147189 
    148190 
     191    SUBROUTINE cxios_set_field_expr(field_hdl, expr, expr_size) BIND(C) 
     192      USE ISO_C_BINDING 
     193      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     194      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: expr 
     195      INTEGER  (kind = C_INT)     , VALUE        :: expr_size 
     196    END SUBROUTINE cxios_set_field_expr 
     197 
     198    SUBROUTINE cxios_get_field_expr(field_hdl, expr, expr_size) BIND(C) 
     199      USE ISO_C_BINDING 
     200      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     201      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: expr 
     202      INTEGER  (kind = C_INT)     , VALUE        :: expr_size 
     203    END SUBROUTINE cxios_get_field_expr 
     204 
     205    FUNCTION cxios_is_defined_field_expr(field_hdl) BIND(C) 
     206      USE ISO_C_BINDING 
     207      LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_expr 
     208      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     209    END FUNCTION cxios_is_defined_field_expr 
     210 
     211 
    149212    SUBROUTINE cxios_set_field_field_ref(field_hdl, field_ref, field_ref_size) BIND(C) 
    150213      USE ISO_C_BINDING 
  • XIOS/dev/dev_olga/src/interface/fortran_attr/fieldgroup_interface_attr.F90

    r891 r1021  
    5050 
    5151 
     52    SUBROUTINE cxios_set_fieldgroup_cell_methods(fieldgroup_hdl, cell_methods, cell_methods_size) BIND(C) 
     53      USE ISO_C_BINDING 
     54      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     55      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: cell_methods 
     56      INTEGER  (kind = C_INT)     , VALUE        :: cell_methods_size 
     57    END SUBROUTINE cxios_set_fieldgroup_cell_methods 
     58 
     59    SUBROUTINE cxios_get_fieldgroup_cell_methods(fieldgroup_hdl, cell_methods, cell_methods_size) BIND(C) 
     60      USE ISO_C_BINDING 
     61      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     62      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: cell_methods 
     63      INTEGER  (kind = C_INT)     , VALUE        :: cell_methods_size 
     64    END SUBROUTINE cxios_get_fieldgroup_cell_methods 
     65 
     66    FUNCTION cxios_is_defined_fieldgroup_cell_methods(fieldgroup_hdl) BIND(C) 
     67      USE ISO_C_BINDING 
     68      LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_cell_methods 
     69      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     70    END FUNCTION cxios_is_defined_fieldgroup_cell_methods 
     71 
     72 
     73    SUBROUTINE cxios_set_fieldgroup_cell_methods_mode(fieldgroup_hdl, cell_methods_mode, cell_methods_mode_size) BIND(C) 
     74      USE ISO_C_BINDING 
     75      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     76      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: cell_methods_mode 
     77      INTEGER  (kind = C_INT)     , VALUE        :: cell_methods_mode_size 
     78    END SUBROUTINE cxios_set_fieldgroup_cell_methods_mode 
     79 
     80    SUBROUTINE cxios_get_fieldgroup_cell_methods_mode(fieldgroup_hdl, cell_methods_mode, cell_methods_mode_size) BIND(C) 
     81      USE ISO_C_BINDING 
     82      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     83      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: cell_methods_mode 
     84      INTEGER  (kind = C_INT)     , VALUE        :: cell_methods_mode_size 
     85    END SUBROUTINE cxios_get_fieldgroup_cell_methods_mode 
     86 
     87    FUNCTION cxios_is_defined_fieldgroup_cell_methods_mode(fieldgroup_hdl) BIND(C) 
     88      USE ISO_C_BINDING 
     89      LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_cell_methods_mode 
     90      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     91    END FUNCTION cxios_is_defined_fieldgroup_cell_methods_mode 
     92 
     93 
    5294    SUBROUTINE cxios_set_fieldgroup_compression_level(fieldgroup_hdl, compression_level) BIND(C) 
    5395      USE ISO_C_BINDING 
     
    147189 
    148190 
     191    SUBROUTINE cxios_set_fieldgroup_expr(fieldgroup_hdl, expr, expr_size) BIND(C) 
     192      USE ISO_C_BINDING 
     193      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     194      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: expr 
     195      INTEGER  (kind = C_INT)     , VALUE        :: expr_size 
     196    END SUBROUTINE cxios_set_fieldgroup_expr 
     197 
     198    SUBROUTINE cxios_get_fieldgroup_expr(fieldgroup_hdl, expr, expr_size) BIND(C) 
     199      USE ISO_C_BINDING 
     200      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     201      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: expr 
     202      INTEGER  (kind = C_INT)     , VALUE        :: expr_size 
     203    END SUBROUTINE cxios_get_fieldgroup_expr 
     204 
     205    FUNCTION cxios_is_defined_fieldgroup_expr(fieldgroup_hdl) BIND(C) 
     206      USE ISO_C_BINDING 
     207      LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_expr 
     208      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     209    END FUNCTION cxios_is_defined_fieldgroup_expr 
     210 
     211 
    149212    SUBROUTINE cxios_set_fieldgroup_field_ref(fieldgroup_hdl, field_ref, field_ref_size) BIND(C) 
    150213      USE ISO_C_BINDING 
  • XIOS/dev/dev_olga/src/interface/fortran_attr/ifield_attr.F90

    r966 r1021  
    1212 
    1313  SUBROUTINE xios(set_field_attr)  & 
    14     ( field_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    15     , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    16     , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    17     , unit, valid_max, valid_min ) 
     14    ( field_id, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     15    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     16    , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     17    , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    1818 
    1919    IMPLICIT NONE 
     
    2222      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset 
    2323      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref 
     24      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods 
     25      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode 
    2426      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level 
    2527      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value 
     
    2931      LOGICAL  , OPTIONAL, INTENT(IN) :: enabled 
    3032      LOGICAL (KIND=C_BOOL) :: enabled_tmp 
     33      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr 
    3134      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref 
    3235      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset 
     
    5659      (field_id,field_hdl) 
    5760      CALL xios(set_field_attr_hdl_)   & 
    58       ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    59       , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    60       , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    61       , unit, valid_max, valid_min ) 
     61      ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     62      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     63      , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     64      , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    6265 
    6366  END SUBROUTINE xios(set_field_attr) 
    6467 
    6568  SUBROUTINE xios(set_field_attr_hdl)  & 
    66     ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    67     , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    68     , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    69     , unit, valid_max, valid_min ) 
     69    ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     70    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     71    , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     72    , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    7073 
    7174    IMPLICIT NONE 
     
    7376      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset 
    7477      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref 
     78      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods 
     79      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode 
    7580      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level 
    7681      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value 
     
    8085      LOGICAL  , OPTIONAL, INTENT(IN) :: enabled 
    8186      LOGICAL (KIND=C_BOOL) :: enabled_tmp 
     87      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr 
    8288      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref 
    8389      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset 
     
    105111 
    106112      CALL xios(set_field_attr_hdl_)  & 
    107       ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    108       , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    109       , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    110       , unit, valid_max, valid_min ) 
     113      ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     114      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     115      , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     116      , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    111117 
    112118  END SUBROUTINE xios(set_field_attr_hdl) 
    113119 
    114120  SUBROUTINE xios(set_field_attr_hdl_)   & 
    115     ( field_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    116     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_  & 
    117     , level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_  & 
    118     , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     121    ( field_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, compression_level_, default_value_  & 
     122    , detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_, freq_offset_, freq_op_, grid_path_  & 
     123    , grid_ref_, indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_  & 
     124    , scale_factor_, standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_  & 
     125     ) 
    119126 
    120127    IMPLICIT NONE 
     
    122129      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset_ 
    123130      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref_ 
     131      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_ 
     132      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode_ 
    124133      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level_ 
    125134      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value_ 
     
    129138      LOGICAL  , OPTIONAL, INTENT(IN) :: enabled_ 
    130139      LOGICAL (KIND=C_BOOL) :: enabled__tmp 
     140      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr_ 
    131141      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref_ 
    132142      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset_ 
     
    163173      ENDIF 
    164174 
     175      IF (PRESENT(cell_methods_)) THEN 
     176        CALL cxios_set_field_cell_methods & 
     177      (field_hdl%daddr, cell_methods_, len(cell_methods_)) 
     178      ENDIF 
     179 
     180      IF (PRESENT(cell_methods_mode_)) THEN 
     181        CALL cxios_set_field_cell_methods_mode & 
     182      (field_hdl%daddr, cell_methods_mode_, len(cell_methods_mode_)) 
     183      ENDIF 
     184 
    165185      IF (PRESENT(compression_level_)) THEN 
    166186        CALL cxios_set_field_compression_level & 
     
    190210      ENDIF 
    191211 
     212      IF (PRESENT(expr_)) THEN 
     213        CALL cxios_set_field_expr & 
     214      (field_hdl%daddr, expr_, len(expr_)) 
     215      ENDIF 
     216 
    192217      IF (PRESENT(field_ref_)) THEN 
    193218        CALL cxios_set_field_field_ref & 
     
    296321 
    297322  SUBROUTINE xios(get_field_attr)  & 
    298     ( field_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    299     , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    300     , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    301     , unit, valid_max, valid_min ) 
     323    ( field_id, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     324    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     325    , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     326    , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    302327 
    303328    IMPLICIT NONE 
     
    306331      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset 
    307332      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref 
     333      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods 
     334      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode 
    308335      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level 
    309336      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value 
     
    313340      LOGICAL  , OPTIONAL, INTENT(OUT) :: enabled 
    314341      LOGICAL (KIND=C_BOOL) :: enabled_tmp 
     342      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr 
    315343      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref 
    316344      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset 
     
    340368      (field_id,field_hdl) 
    341369      CALL xios(get_field_attr_hdl_)   & 
    342       ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    343       , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    344       , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    345       , unit, valid_max, valid_min ) 
     370      ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     371      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     372      , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     373      , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    346374 
    347375  END SUBROUTINE xios(get_field_attr) 
    348376 
    349377  SUBROUTINE xios(get_field_attr_hdl)  & 
    350     ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    351     , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    352     , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    353     , unit, valid_max, valid_min ) 
     378    ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     379    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     380    , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     381    , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    354382 
    355383    IMPLICIT NONE 
     
    357385      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset 
    358386      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref 
     387      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods 
     388      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode 
    359389      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level 
    360390      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value 
     
    364394      LOGICAL  , OPTIONAL, INTENT(OUT) :: enabled 
    365395      LOGICAL (KIND=C_BOOL) :: enabled_tmp 
     396      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr 
    366397      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref 
    367398      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset 
     
    389420 
    390421      CALL xios(get_field_attr_hdl_)  & 
    391       ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    392       , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    393       , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    394       , unit, valid_max, valid_min ) 
     422      ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     423      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     424      , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     425      , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    395426 
    396427  END SUBROUTINE xios(get_field_attr_hdl) 
    397428 
    398429  SUBROUTINE xios(get_field_attr_hdl_)   & 
    399     ( field_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    400     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_  & 
    401     , level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_  & 
    402     , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     430    ( field_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, compression_level_, default_value_  & 
     431    , detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_, freq_offset_, freq_op_, grid_path_  & 
     432    , grid_ref_, indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_  & 
     433    , scale_factor_, standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_  & 
     434     ) 
    403435 
    404436    IMPLICIT NONE 
     
    406438      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset_ 
    407439      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref_ 
     440      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_ 
     441      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode_ 
    408442      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level_ 
    409443      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value_ 
     
    413447      LOGICAL  , OPTIONAL, INTENT(OUT) :: enabled_ 
    414448      LOGICAL (KIND=C_BOOL) :: enabled__tmp 
     449      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr_ 
    415450      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref_ 
    416451      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset_ 
     
    447482      ENDIF 
    448483 
     484      IF (PRESENT(cell_methods_)) THEN 
     485        CALL cxios_get_field_cell_methods & 
     486      (field_hdl%daddr, cell_methods_, len(cell_methods_)) 
     487      ENDIF 
     488 
     489      IF (PRESENT(cell_methods_mode_)) THEN 
     490        CALL cxios_get_field_cell_methods_mode & 
     491      (field_hdl%daddr, cell_methods_mode_, len(cell_methods_mode_)) 
     492      ENDIF 
     493 
    449494      IF (PRESENT(compression_level_)) THEN 
    450495        CALL cxios_get_field_compression_level & 
     
    474519      ENDIF 
    475520 
     521      IF (PRESENT(expr_)) THEN 
     522        CALL cxios_get_field_expr & 
     523      (field_hdl%daddr, expr_, len(expr_)) 
     524      ENDIF 
     525 
    476526      IF (PRESENT(field_ref_)) THEN 
    477527        CALL cxios_get_field_field_ref & 
     
    580630 
    581631  SUBROUTINE xios(is_defined_field_attr)  & 
    582     ( field_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    583     , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    584     , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    585     , unit, valid_max, valid_min ) 
     632    ( field_id, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     633    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     634    , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     635    , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    586636 
    587637    IMPLICIT NONE 
     
    592642      LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref 
    593643      LOGICAL(KIND=C_BOOL) :: axis_ref_tmp 
     644      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods 
     645      LOGICAL(KIND=C_BOOL) :: cell_methods_tmp 
     646      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode 
     647      LOGICAL(KIND=C_BOOL) :: cell_methods_mode_tmp 
    594648      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 
    595649      LOGICAL(KIND=C_BOOL) :: compression_level_tmp 
     
    602656      LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 
    603657      LOGICAL(KIND=C_BOOL) :: enabled_tmp 
     658      LOGICAL, OPTIONAL, INTENT(OUT) :: expr 
     659      LOGICAL(KIND=C_BOOL) :: expr_tmp 
    604660      LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref 
    605661      LOGICAL(KIND=C_BOOL) :: field_ref_tmp 
     
    646702      (field_id,field_hdl) 
    647703      CALL xios(is_defined_field_attr_hdl_)   & 
    648       ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    649       , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    650       , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    651       , unit, valid_max, valid_min ) 
     704      ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     705      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     706      , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     707      , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    652708 
    653709  END SUBROUTINE xios(is_defined_field_attr) 
    654710 
    655711  SUBROUTINE xios(is_defined_field_attr_hdl)  & 
    656     ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    657     , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    658     , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    659     , unit, valid_max, valid_min ) 
     712    ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     713    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     714    , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     715    , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    660716 
    661717    IMPLICIT NONE 
     
    665721      LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref 
    666722      LOGICAL(KIND=C_BOOL) :: axis_ref_tmp 
     723      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods 
     724      LOGICAL(KIND=C_BOOL) :: cell_methods_tmp 
     725      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode 
     726      LOGICAL(KIND=C_BOOL) :: cell_methods_mode_tmp 
    667727      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 
    668728      LOGICAL(KIND=C_BOOL) :: compression_level_tmp 
     
    675735      LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 
    676736      LOGICAL(KIND=C_BOOL) :: enabled_tmp 
     737      LOGICAL, OPTIONAL, INTENT(OUT) :: expr 
     738      LOGICAL(KIND=C_BOOL) :: expr_tmp 
    677739      LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref 
    678740      LOGICAL(KIND=C_BOOL) :: field_ref_tmp 
     
    717779 
    718780      CALL xios(is_defined_field_attr_hdl_)  & 
    719       ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    720       , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
    721       , name, operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
    722       , unit, valid_max, valid_min ) 
     781      ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     782      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     783      , grid_ref, indexed_output, level, long_name, name, operation, prec, read_access, scalar_ref  & 
     784      , scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
    723785 
    724786  END SUBROUTINE xios(is_defined_field_attr_hdl) 
    725787 
    726788  SUBROUTINE xios(is_defined_field_attr_hdl_)   & 
    727     ( field_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    728     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_  & 
    729     , level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_  & 
    730     , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     789    ( field_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, compression_level_, default_value_  & 
     790    , detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_, freq_offset_, freq_op_, grid_path_  & 
     791    , grid_ref_, indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_  & 
     792    , scale_factor_, standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_  & 
     793     ) 
    731794 
    732795    IMPLICIT NONE 
     
    736799      LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref_ 
    737800      LOGICAL(KIND=C_BOOL) :: axis_ref__tmp 
     801      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_ 
     802      LOGICAL(KIND=C_BOOL) :: cell_methods__tmp 
     803      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode_ 
     804      LOGICAL(KIND=C_BOOL) :: cell_methods_mode__tmp 
    738805      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level_ 
    739806      LOGICAL(KIND=C_BOOL) :: compression_level__tmp 
     
    746813      LOGICAL, OPTIONAL, INTENT(OUT) :: enabled_ 
    747814      LOGICAL(KIND=C_BOOL) :: enabled__tmp 
     815      LOGICAL, OPTIONAL, INTENT(OUT) :: expr_ 
     816      LOGICAL(KIND=C_BOOL) :: expr__tmp 
    748817      LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref_ 
    749818      LOGICAL(KIND=C_BOOL) :: field_ref__tmp 
     
    799868      ENDIF 
    800869 
     870      IF (PRESENT(cell_methods_)) THEN 
     871        cell_methods__tmp = cxios_is_defined_field_cell_methods & 
     872      (field_hdl%daddr) 
     873        cell_methods_ = cell_methods__tmp 
     874      ENDIF 
     875 
     876      IF (PRESENT(cell_methods_mode_)) THEN 
     877        cell_methods_mode__tmp = cxios_is_defined_field_cell_methods_mode & 
     878      (field_hdl%daddr) 
     879        cell_methods_mode_ = cell_methods_mode__tmp 
     880      ENDIF 
     881 
    801882      IF (PRESENT(compression_level_)) THEN 
    802883        compression_level__tmp = cxios_is_defined_field_compression_level & 
     
    829910      ENDIF 
    830911 
     912      IF (PRESENT(expr_)) THEN 
     913        expr__tmp = cxios_is_defined_field_expr & 
     914      (field_hdl%daddr) 
     915        expr_ = expr__tmp 
     916      ENDIF 
     917 
    831918      IF (PRESENT(field_ref_)) THEN 
    832919        field_ref__tmp = cxios_is_defined_field_field_ref & 
  • XIOS/dev/dev_olga/src/interface/fortran_attr/ifieldgroup_attr.F90

    r966 r1021  
    1212 
    1313  SUBROUTINE xios(set_fieldgroup_attr)  & 
    14     ( fieldgroup_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    15     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    16     , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    17     , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     14    ( fieldgroup_id, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     15    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     16    , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     17    , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     18     ) 
    1819 
    1920    IMPLICIT NONE 
     
    2223      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset 
    2324      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref 
     25      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods 
     26      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode 
    2427      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level 
    2528      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value 
     
    2932      LOGICAL  , OPTIONAL, INTENT(IN) :: enabled 
    3033      LOGICAL (KIND=C_BOOL) :: enabled_tmp 
     34      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr 
    3135      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref 
    3236      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset 
     
    5761      (fieldgroup_id,fieldgroup_hdl) 
    5862      CALL xios(set_fieldgroup_attr_hdl_)   & 
    59       ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    60       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    61       , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    62       , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     63      ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     64      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     65      , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     66      , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     67       ) 
    6368 
    6469  END SUBROUTINE xios(set_fieldgroup_attr) 
    6570 
    6671  SUBROUTINE xios(set_fieldgroup_attr_hdl)  & 
    67     ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    68     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    69     , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    70     , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     72    ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     73    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     74    , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     75    , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     76     ) 
    7177 
    7278    IMPLICIT NONE 
     
    7480      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset 
    7581      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref 
     82      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods 
     83      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode 
    7684      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level 
    7785      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value 
     
    8189      LOGICAL  , OPTIONAL, INTENT(IN) :: enabled 
    8290      LOGICAL (KIND=C_BOOL) :: enabled_tmp 
     91      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr 
    8392      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref 
    8493      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset 
     
    107116 
    108117      CALL xios(set_fieldgroup_attr_hdl_)  & 
    109       ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    110       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    111       , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    112       , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     118      ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     119      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     120      , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     121      , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     122       ) 
    113123 
    114124  END SUBROUTINE xios(set_fieldgroup_attr_hdl) 
    115125 
    116126  SUBROUTINE xios(set_fieldgroup_attr_hdl_)   & 
    117     ( fieldgroup_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    118     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_  & 
    119     , indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_  & 
    120     , standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     127    ( fieldgroup_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, compression_level_  & 
     128    , default_value_, detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_, freq_offset_  & 
     129    , freq_op_, grid_path_, grid_ref_, group_ref_, indexed_output_, level_, long_name_, name_, operation_  & 
     130    , prec_, read_access_, scalar_ref_, scale_factor_, standard_name_, ts_enabled_, ts_split_freq_  & 
     131    , unit_, valid_max_, valid_min_ ) 
    121132 
    122133    IMPLICIT NONE 
     
    124135      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset_ 
    125136      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref_ 
     137      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_ 
     138      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode_ 
    126139      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level_ 
    127140      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value_ 
     
    131144      LOGICAL  , OPTIONAL, INTENT(IN) :: enabled_ 
    132145      LOGICAL (KIND=C_BOOL) :: enabled__tmp 
     146      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr_ 
    133147      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref_ 
    134148      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset_ 
     
    166180      ENDIF 
    167181 
     182      IF (PRESENT(cell_methods_)) THEN 
     183        CALL cxios_set_fieldgroup_cell_methods & 
     184      (fieldgroup_hdl%daddr, cell_methods_, len(cell_methods_)) 
     185      ENDIF 
     186 
     187      IF (PRESENT(cell_methods_mode_)) THEN 
     188        CALL cxios_set_fieldgroup_cell_methods_mode & 
     189      (fieldgroup_hdl%daddr, cell_methods_mode_, len(cell_methods_mode_)) 
     190      ENDIF 
     191 
    168192      IF (PRESENT(compression_level_)) THEN 
    169193        CALL cxios_set_fieldgroup_compression_level & 
     
    193217      ENDIF 
    194218 
     219      IF (PRESENT(expr_)) THEN 
     220        CALL cxios_set_fieldgroup_expr & 
     221      (fieldgroup_hdl%daddr, expr_, len(expr_)) 
     222      ENDIF 
     223 
    195224      IF (PRESENT(field_ref_)) THEN 
    196225        CALL cxios_set_fieldgroup_field_ref & 
     
    304333 
    305334  SUBROUTINE xios(get_fieldgroup_attr)  & 
    306     ( fieldgroup_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    307     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    308     , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    309     , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     335    ( fieldgroup_id, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     336    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     337    , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     338    , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     339     ) 
    310340 
    311341    IMPLICIT NONE 
     
    314344      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset 
    315345      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref 
     346      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods 
     347      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode 
    316348      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level 
    317349      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value 
     
    321353      LOGICAL  , OPTIONAL, INTENT(OUT) :: enabled 
    322354      LOGICAL (KIND=C_BOOL) :: enabled_tmp 
     355      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr 
    323356      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref 
    324357      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset 
     
    349382      (fieldgroup_id,fieldgroup_hdl) 
    350383      CALL xios(get_fieldgroup_attr_hdl_)   & 
    351       ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    352       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    353       , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    354       , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     384      ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     385      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     386      , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     387      , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     388       ) 
    355389 
    356390  END SUBROUTINE xios(get_fieldgroup_attr) 
    357391 
    358392  SUBROUTINE xios(get_fieldgroup_attr_hdl)  & 
    359     ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    360     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    361     , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    362     , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     393    ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     394    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     395    , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     396    , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     397     ) 
    363398 
    364399    IMPLICIT NONE 
     
    366401      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset 
    367402      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref 
     403      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods 
     404      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode 
    368405      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level 
    369406      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value 
     
    373410      LOGICAL  , OPTIONAL, INTENT(OUT) :: enabled 
    374411      LOGICAL (KIND=C_BOOL) :: enabled_tmp 
     412      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr 
    375413      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref 
    376414      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset 
     
    399437 
    400438      CALL xios(get_fieldgroup_attr_hdl_)  & 
    401       ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    402       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    403       , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    404       , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     439      ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     440      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     441      , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     442      , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     443       ) 
    405444 
    406445  END SUBROUTINE xios(get_fieldgroup_attr_hdl) 
    407446 
    408447  SUBROUTINE xios(get_fieldgroup_attr_hdl_)   & 
    409     ( fieldgroup_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    410     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_  & 
    411     , indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_  & 
    412     , standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     448    ( fieldgroup_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, compression_level_  & 
     449    , default_value_, detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_, freq_offset_  & 
     450    , freq_op_, grid_path_, grid_ref_, group_ref_, indexed_output_, level_, long_name_, name_, operation_  & 
     451    , prec_, read_access_, scalar_ref_, scale_factor_, standard_name_, ts_enabled_, ts_split_freq_  & 
     452    , unit_, valid_max_, valid_min_ ) 
    413453 
    414454    IMPLICIT NONE 
     
    416456      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset_ 
    417457      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref_ 
     458      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_ 
     459      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode_ 
    418460      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level_ 
    419461      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value_ 
     
    423465      LOGICAL  , OPTIONAL, INTENT(OUT) :: enabled_ 
    424466      LOGICAL (KIND=C_BOOL) :: enabled__tmp 
     467      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr_ 
    425468      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref_ 
    426469      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset_ 
     
    458501      ENDIF 
    459502 
     503      IF (PRESENT(cell_methods_)) THEN 
     504        CALL cxios_get_fieldgroup_cell_methods & 
     505      (fieldgroup_hdl%daddr, cell_methods_, len(cell_methods_)) 
     506      ENDIF 
     507 
     508      IF (PRESENT(cell_methods_mode_)) THEN 
     509        CALL cxios_get_fieldgroup_cell_methods_mode & 
     510      (fieldgroup_hdl%daddr, cell_methods_mode_, len(cell_methods_mode_)) 
     511      ENDIF 
     512 
    460513      IF (PRESENT(compression_level_)) THEN 
    461514        CALL cxios_get_fieldgroup_compression_level & 
     
    485538      ENDIF 
    486539 
     540      IF (PRESENT(expr_)) THEN 
     541        CALL cxios_get_fieldgroup_expr & 
     542      (fieldgroup_hdl%daddr, expr_, len(expr_)) 
     543      ENDIF 
     544 
    487545      IF (PRESENT(field_ref_)) THEN 
    488546        CALL cxios_get_fieldgroup_field_ref & 
     
    596654 
    597655  SUBROUTINE xios(is_defined_fieldgroup_attr)  & 
    598     ( fieldgroup_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    599     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    600     , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    601     , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     656    ( fieldgroup_id, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     657    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     658    , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     659    , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     660     ) 
    602661 
    603662    IMPLICIT NONE 
     
    608667      LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref 
    609668      LOGICAL(KIND=C_BOOL) :: axis_ref_tmp 
     669      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods 
     670      LOGICAL(KIND=C_BOOL) :: cell_methods_tmp 
     671      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode 
     672      LOGICAL(KIND=C_BOOL) :: cell_methods_mode_tmp 
    610673      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 
    611674      LOGICAL(KIND=C_BOOL) :: compression_level_tmp 
     
    618681      LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 
    619682      LOGICAL(KIND=C_BOOL) :: enabled_tmp 
     683      LOGICAL, OPTIONAL, INTENT(OUT) :: expr 
     684      LOGICAL(KIND=C_BOOL) :: expr_tmp 
    620685      LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref 
    621686      LOGICAL(KIND=C_BOOL) :: field_ref_tmp 
     
    664729      (fieldgroup_id,fieldgroup_hdl) 
    665730      CALL xios(is_defined_fieldgroup_attr_hdl_)   & 
    666       ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    667       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    668       , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    669       , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     731      ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     732      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     733      , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     734      , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     735       ) 
    670736 
    671737  END SUBROUTINE xios(is_defined_fieldgroup_attr) 
    672738 
    673739  SUBROUTINE xios(is_defined_fieldgroup_attr_hdl)  & 
    674     ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    675     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    676     , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    677     , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     740    ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     741    , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     742    , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     743    , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     744     ) 
    678745 
    679746    IMPLICIT NONE 
     
    683750      LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref 
    684751      LOGICAL(KIND=C_BOOL) :: axis_ref_tmp 
     752      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods 
     753      LOGICAL(KIND=C_BOOL) :: cell_methods_tmp 
     754      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode 
     755      LOGICAL(KIND=C_BOOL) :: cell_methods_mode_tmp 
    685756      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 
    686757      LOGICAL(KIND=C_BOOL) :: compression_level_tmp 
     
    693764      LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 
    694765      LOGICAL(KIND=C_BOOL) :: enabled_tmp 
     766      LOGICAL, OPTIONAL, INTENT(OUT) :: expr 
     767      LOGICAL(KIND=C_BOOL) :: expr_tmp 
    695768      LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref 
    696769      LOGICAL(KIND=C_BOOL) :: field_ref_tmp 
     
    737810 
    738811      CALL xios(is_defined_fieldgroup_attr_hdl_)  & 
    739       ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    740       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    741       , level, long_name, name, operation, prec, read_access, scalar_ref, scale_factor, standard_name  & 
    742       , ts_enabled, ts_split_freq, unit, valid_max, valid_min ) 
     812      ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, compression_level, default_value  & 
     813      , detect_missing_value, domain_ref, enabled, expr, field_ref, freq_offset, freq_op, grid_path  & 
     814      , grid_ref, group_ref, indexed_output, level, long_name, name, operation, prec, read_access  & 
     815      , scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit, valid_max, valid_min  & 
     816       ) 
    743817 
    744818  END SUBROUTINE xios(is_defined_fieldgroup_attr_hdl) 
    745819 
    746820  SUBROUTINE xios(is_defined_fieldgroup_attr_hdl_)   & 
    747     ( fieldgroup_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    748     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_  & 
    749     , indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_  & 
    750     , standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     821    ( fieldgroup_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, compression_level_  & 
     822    , default_value_, detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_, freq_offset_  & 
     823    , freq_op_, grid_path_, grid_ref_, group_ref_, indexed_output_, level_, long_name_, name_, operation_  & 
     824    , prec_, read_access_, scalar_ref_, scale_factor_, standard_name_, ts_enabled_, ts_split_freq_  & 
     825    , unit_, valid_max_, valid_min_ ) 
    751826 
    752827    IMPLICIT NONE 
     
    756831      LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref_ 
    757832      LOGICAL(KIND=C_BOOL) :: axis_ref__tmp 
     833      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_ 
     834      LOGICAL(KIND=C_BOOL) :: cell_methods__tmp 
     835      LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode_ 
     836      LOGICAL(KIND=C_BOOL) :: cell_methods_mode__tmp 
    758837      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level_ 
    759838      LOGICAL(KIND=C_BOOL) :: compression_level__tmp 
     
    766845      LOGICAL, OPTIONAL, INTENT(OUT) :: enabled_ 
    767846      LOGICAL(KIND=C_BOOL) :: enabled__tmp 
     847      LOGICAL, OPTIONAL, INTENT(OUT) :: expr_ 
     848      LOGICAL(KIND=C_BOOL) :: expr__tmp 
    768849      LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref_ 
    769850      LOGICAL(KIND=C_BOOL) :: field_ref__tmp 
     
    821902      ENDIF 
    822903 
     904      IF (PRESENT(cell_methods_)) THEN 
     905        cell_methods__tmp = cxios_is_defined_fieldgroup_cell_methods & 
     906      (fieldgroup_hdl%daddr) 
     907        cell_methods_ = cell_methods__tmp 
     908      ENDIF 
     909 
     910      IF (PRESENT(cell_methods_mode_)) THEN 
     911        cell_methods_mode__tmp = cxios_is_defined_fieldgroup_cell_methods_mode & 
     912      (fieldgroup_hdl%daddr) 
     913        cell_methods_mode_ = cell_methods_mode__tmp 
     914      ENDIF 
     915 
    823916      IF (PRESENT(compression_level_)) THEN 
    824917        compression_level__tmp = cxios_is_defined_fieldgroup_compression_level & 
     
    851944      ENDIF 
    852945 
     946      IF (PRESENT(expr_)) THEN 
     947        expr__tmp = cxios_is_defined_fieldgroup_expr & 
     948      (fieldgroup_hdl%daddr) 
     949        expr_ = expr__tmp 
     950      ENDIF 
     951 
    853952      IF (PRESENT(field_ref_)) THEN 
    854953        field_ref__tmp = cxios_is_defined_fieldgroup_field_ref & 
  • XIOS/dev/dev_olga/src/interface/fortran_attr/iinterpolate_domain_attr.F90

    r966 r1021  
    1212 
    1313  SUBROUTINE xios(set_interpolate_domain_attr)  & 
    14     ( interpolate_domain_id, file, order, renormalize ) 
     14    ( interpolate_domain_id, file, mode, order, renormalize, weight_filename, write_weight ) 
    1515 
    1616    IMPLICIT NONE 
     
    1818      CHARACTER(LEN=*), INTENT(IN) ::interpolate_domain_id 
    1919      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: file 
     20      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode 
    2021      INTEGER  , OPTIONAL, INTENT(IN) :: order 
    2122      LOGICAL  , OPTIONAL, INTENT(IN) :: renormalize 
    2223      LOGICAL (KIND=C_BOOL) :: renormalize_tmp 
     24      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: weight_filename 
     25      LOGICAL  , OPTIONAL, INTENT(IN) :: write_weight 
     26      LOGICAL (KIND=C_BOOL) :: write_weight_tmp 
    2327 
    2428      CALL xios(get_interpolate_domain_handle) & 
    2529      (interpolate_domain_id,interpolate_domain_hdl) 
    2630      CALL xios(set_interpolate_domain_attr_hdl_)   & 
    27       ( interpolate_domain_hdl, file, order, renormalize ) 
     31      ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    2832 
    2933  END SUBROUTINE xios(set_interpolate_domain_attr) 
    3034 
    3135  SUBROUTINE xios(set_interpolate_domain_attr_hdl)  & 
    32     ( interpolate_domain_hdl, file, order, renormalize ) 
     36    ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    3337 
    3438    IMPLICIT NONE 
    3539      TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl 
    3640      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: file 
     41      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode 
    3742      INTEGER  , OPTIONAL, INTENT(IN) :: order 
    3843      LOGICAL  , OPTIONAL, INTENT(IN) :: renormalize 
    3944      LOGICAL (KIND=C_BOOL) :: renormalize_tmp 
     45      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: weight_filename 
     46      LOGICAL  , OPTIONAL, INTENT(IN) :: write_weight 
     47      LOGICAL (KIND=C_BOOL) :: write_weight_tmp 
    4048 
    4149      CALL xios(set_interpolate_domain_attr_hdl_)  & 
    42       ( interpolate_domain_hdl, file, order, renormalize ) 
     50      ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    4351 
    4452  END SUBROUTINE xios(set_interpolate_domain_attr_hdl) 
    4553 
    4654  SUBROUTINE xios(set_interpolate_domain_attr_hdl_)   & 
    47     ( interpolate_domain_hdl, file_, order_, renormalize_ ) 
     55    ( interpolate_domain_hdl, file_, mode_, order_, renormalize_, weight_filename_, write_weight_  & 
     56     ) 
    4857 
    4958    IMPLICIT NONE 
    5059      TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl 
    5160      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: file_ 
     61      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode_ 
    5262      INTEGER  , OPTIONAL, INTENT(IN) :: order_ 
    5363      LOGICAL  , OPTIONAL, INTENT(IN) :: renormalize_ 
    5464      LOGICAL (KIND=C_BOOL) :: renormalize__tmp 
     65      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: weight_filename_ 
     66      LOGICAL  , OPTIONAL, INTENT(IN) :: write_weight_ 
     67      LOGICAL (KIND=C_BOOL) :: write_weight__tmp 
    5568 
    5669      IF (PRESENT(file_)) THEN 
    5770        CALL cxios_set_interpolate_domain_file & 
    5871      (interpolate_domain_hdl%daddr, file_, len(file_)) 
     72      ENDIF 
     73 
     74      IF (PRESENT(mode_)) THEN 
     75        CALL cxios_set_interpolate_domain_mode & 
     76      (interpolate_domain_hdl%daddr, mode_, len(mode_)) 
    5977      ENDIF 
    6078 
     
    7088      ENDIF 
    7189 
     90      IF (PRESENT(weight_filename_)) THEN 
     91        CALL cxios_set_interpolate_domain_weight_filename & 
     92      (interpolate_domain_hdl%daddr, weight_filename_, len(weight_filename_)) 
     93      ENDIF 
     94 
     95      IF (PRESENT(write_weight_)) THEN 
     96        write_weight__tmp = write_weight_ 
     97        CALL cxios_set_interpolate_domain_write_weight & 
     98      (interpolate_domain_hdl%daddr, write_weight__tmp) 
     99      ENDIF 
     100 
    72101  END SUBROUTINE xios(set_interpolate_domain_attr_hdl_) 
    73102 
    74103  SUBROUTINE xios(get_interpolate_domain_attr)  & 
    75     ( interpolate_domain_id, file, order, renormalize ) 
     104    ( interpolate_domain_id, file, mode, order, renormalize, weight_filename, write_weight ) 
    76105 
    77106    IMPLICIT NONE 
     
    79108      CHARACTER(LEN=*), INTENT(IN) ::interpolate_domain_id 
    80109      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: file 
     110      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode 
    81111      INTEGER  , OPTIONAL, INTENT(OUT) :: order 
    82112      LOGICAL  , OPTIONAL, INTENT(OUT) :: renormalize 
    83113      LOGICAL (KIND=C_BOOL) :: renormalize_tmp 
     114      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: weight_filename 
     115      LOGICAL  , OPTIONAL, INTENT(OUT) :: write_weight 
     116      LOGICAL (KIND=C_BOOL) :: write_weight_tmp 
    84117 
    85118      CALL xios(get_interpolate_domain_handle) & 
    86119      (interpolate_domain_id,interpolate_domain_hdl) 
    87120      CALL xios(get_interpolate_domain_attr_hdl_)   & 
    88       ( interpolate_domain_hdl, file, order, renormalize ) 
     121      ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    89122 
    90123  END SUBROUTINE xios(get_interpolate_domain_attr) 
    91124 
    92125  SUBROUTINE xios(get_interpolate_domain_attr_hdl)  & 
    93     ( interpolate_domain_hdl, file, order, renormalize ) 
     126    ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    94127 
    95128    IMPLICIT NONE 
    96129      TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl 
    97130      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: file 
     131      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode 
    98132      INTEGER  , OPTIONAL, INTENT(OUT) :: order 
    99133      LOGICAL  , OPTIONAL, INTENT(OUT) :: renormalize 
    100134      LOGICAL (KIND=C_BOOL) :: renormalize_tmp 
     135      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: weight_filename 
     136      LOGICAL  , OPTIONAL, INTENT(OUT) :: write_weight 
     137      LOGICAL (KIND=C_BOOL) :: write_weight_tmp 
    101138 
    102139      CALL xios(get_interpolate_domain_attr_hdl_)  & 
    103       ( interpolate_domain_hdl, file, order, renormalize ) 
     140      ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    104141 
    105142  END SUBROUTINE xios(get_interpolate_domain_attr_hdl) 
    106143 
    107144  SUBROUTINE xios(get_interpolate_domain_attr_hdl_)   & 
    108     ( interpolate_domain_hdl, file_, order_, renormalize_ ) 
     145    ( interpolate_domain_hdl, file_, mode_, order_, renormalize_, weight_filename_, write_weight_  & 
     146     ) 
    109147 
    110148    IMPLICIT NONE 
    111149      TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl 
    112150      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: file_ 
     151      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode_ 
    113152      INTEGER  , OPTIONAL, INTENT(OUT) :: order_ 
    114153      LOGICAL  , OPTIONAL, INTENT(OUT) :: renormalize_ 
    115154      LOGICAL (KIND=C_BOOL) :: renormalize__tmp 
     155      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: weight_filename_ 
     156      LOGICAL  , OPTIONAL, INTENT(OUT) :: write_weight_ 
     157      LOGICAL (KIND=C_BOOL) :: write_weight__tmp 
    116158 
    117159      IF (PRESENT(file_)) THEN 
    118160        CALL cxios_get_interpolate_domain_file & 
    119161      (interpolate_domain_hdl%daddr, file_, len(file_)) 
     162      ENDIF 
     163 
     164      IF (PRESENT(mode_)) THEN 
     165        CALL cxios_get_interpolate_domain_mode & 
     166      (interpolate_domain_hdl%daddr, mode_, len(mode_)) 
    120167      ENDIF 
    121168 
     
    131178      ENDIF 
    132179 
     180      IF (PRESENT(weight_filename_)) THEN 
     181        CALL cxios_get_interpolate_domain_weight_filename & 
     182      (interpolate_domain_hdl%daddr, weight_filename_, len(weight_filename_)) 
     183      ENDIF 
     184 
     185      IF (PRESENT(write_weight_)) THEN 
     186        CALL cxios_get_interpolate_domain_write_weight & 
     187      (interpolate_domain_hdl%daddr, write_weight__tmp) 
     188        write_weight_ = write_weight__tmp 
     189      ENDIF 
     190 
    133191  END SUBROUTINE xios(get_interpolate_domain_attr_hdl_) 
    134192 
    135193  SUBROUTINE xios(is_defined_interpolate_domain_attr)  & 
    136     ( interpolate_domain_id, file, order, renormalize ) 
     194    ( interpolate_domain_id, file, mode, order, renormalize, weight_filename, write_weight ) 
    137195 
    138196    IMPLICIT NONE 
     
    141199      LOGICAL, OPTIONAL, INTENT(OUT) :: file 
    142200      LOGICAL(KIND=C_BOOL) :: file_tmp 
     201      LOGICAL, OPTIONAL, INTENT(OUT) :: mode 
     202      LOGICAL(KIND=C_BOOL) :: mode_tmp 
    143203      LOGICAL, OPTIONAL, INTENT(OUT) :: order 
    144204      LOGICAL(KIND=C_BOOL) :: order_tmp 
    145205      LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize 
    146206      LOGICAL(KIND=C_BOOL) :: renormalize_tmp 
     207      LOGICAL, OPTIONAL, INTENT(OUT) :: weight_filename 
     208      LOGICAL(KIND=C_BOOL) :: weight_filename_tmp 
     209      LOGICAL, OPTIONAL, INTENT(OUT) :: write_weight 
     210      LOGICAL(KIND=C_BOOL) :: write_weight_tmp 
    147211 
    148212      CALL xios(get_interpolate_domain_handle) & 
    149213      (interpolate_domain_id,interpolate_domain_hdl) 
    150214      CALL xios(is_defined_interpolate_domain_attr_hdl_)   & 
    151       ( interpolate_domain_hdl, file, order, renormalize ) 
     215      ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    152216 
    153217  END SUBROUTINE xios(is_defined_interpolate_domain_attr) 
    154218 
    155219  SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl)  & 
    156     ( interpolate_domain_hdl, file, order, renormalize ) 
     220    ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    157221 
    158222    IMPLICIT NONE 
     
    160224      LOGICAL, OPTIONAL, INTENT(OUT) :: file 
    161225      LOGICAL(KIND=C_BOOL) :: file_tmp 
     226      LOGICAL, OPTIONAL, INTENT(OUT) :: mode 
     227      LOGICAL(KIND=C_BOOL) :: mode_tmp 
    162228      LOGICAL, OPTIONAL, INTENT(OUT) :: order 
    163229      LOGICAL(KIND=C_BOOL) :: order_tmp 
    164230      LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize 
    165231      LOGICAL(KIND=C_BOOL) :: renormalize_tmp 
     232      LOGICAL, OPTIONAL, INTENT(OUT) :: weight_filename 
     233      LOGICAL(KIND=C_BOOL) :: weight_filename_tmp 
     234      LOGICAL, OPTIONAL, INTENT(OUT) :: write_weight 
     235      LOGICAL(KIND=C_BOOL) :: write_weight_tmp 
    166236 
    167237      CALL xios(is_defined_interpolate_domain_attr_hdl_)  & 
    168       ( interpolate_domain_hdl, file, order, renormalize ) 
     238      ( interpolate_domain_hdl, file, mode, order, renormalize, weight_filename, write_weight ) 
    169239 
    170240  END SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl) 
    171241 
    172242  SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl_)   & 
    173     ( interpolate_domain_hdl, file_, order_, renormalize_ ) 
     243    ( interpolate_domain_hdl, file_, mode_, order_, renormalize_, weight_filename_, write_weight_  & 
     244     ) 
    174245 
    175246    IMPLICIT NONE 
     
    177248      LOGICAL, OPTIONAL, INTENT(OUT) :: file_ 
    178249      LOGICAL(KIND=C_BOOL) :: file__tmp 
     250      LOGICAL, OPTIONAL, INTENT(OUT) :: mode_ 
     251      LOGICAL(KIND=C_BOOL) :: mode__tmp 
    179252      LOGICAL, OPTIONAL, INTENT(OUT) :: order_ 
    180253      LOGICAL(KIND=C_BOOL) :: order__tmp 
    181254      LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize_ 
    182255      LOGICAL(KIND=C_BOOL) :: renormalize__tmp 
     256      LOGICAL, OPTIONAL, INTENT(OUT) :: weight_filename_ 
     257      LOGICAL(KIND=C_BOOL) :: weight_filename__tmp 
     258      LOGICAL, OPTIONAL, INTENT(OUT) :: write_weight_ 
     259      LOGICAL(KIND=C_BOOL) :: write_weight__tmp 
    183260 
    184261      IF (PRESENT(file_)) THEN 
     
    188265      ENDIF 
    189266 
     267      IF (PRESENT(mode_)) THEN 
     268        mode__tmp = cxios_is_defined_interpolate_domain_mode & 
     269      (interpolate_domain_hdl%daddr) 
     270        mode_ = mode__tmp 
     271      ENDIF 
     272 
    190273      IF (PRESENT(order_)) THEN 
    191274        order__tmp = cxios_is_defined_interpolate_domain_order & 
     
    200283      ENDIF 
    201284 
     285      IF (PRESENT(weight_filename_)) THEN 
     286        weight_filename__tmp = cxios_is_defined_interpolate_domain_weight_filename & 
     287      (interpolate_domain_hdl%daddr) 
     288        weight_filename_ = weight_filename__tmp 
     289      ENDIF 
     290 
     291      IF (PRESENT(write_weight_)) THEN 
     292        write_weight__tmp = cxios_is_defined_interpolate_domain_write_weight & 
     293      (interpolate_domain_hdl%daddr) 
     294        write_weight_ = write_weight__tmp 
     295      ENDIF 
     296 
    202297  END SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl_) 
    203298 
  • XIOS/dev/dev_olga/src/interface/fortran_attr/interpolate_domain_interface_attr.F90

    r891 r1021  
    2929      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
    3030    END FUNCTION cxios_is_defined_interpolate_domain_file 
     31 
     32 
     33    SUBROUTINE cxios_set_interpolate_domain_mode(interpolate_domain_hdl, mode, mode_size) BIND(C) 
     34      USE ISO_C_BINDING 
     35      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     36      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: mode 
     37      INTEGER  (kind = C_INT)     , VALUE        :: mode_size 
     38    END SUBROUTINE cxios_set_interpolate_domain_mode 
     39 
     40    SUBROUTINE cxios_get_interpolate_domain_mode(interpolate_domain_hdl, mode, mode_size) BIND(C) 
     41      USE ISO_C_BINDING 
     42      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     43      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: mode 
     44      INTEGER  (kind = C_INT)     , VALUE        :: mode_size 
     45    END SUBROUTINE cxios_get_interpolate_domain_mode 
     46 
     47    FUNCTION cxios_is_defined_interpolate_domain_mode(interpolate_domain_hdl) BIND(C) 
     48      USE ISO_C_BINDING 
     49      LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_mode 
     50      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     51    END FUNCTION cxios_is_defined_interpolate_domain_mode 
    3152 
    3253 
     
    6889    END FUNCTION cxios_is_defined_interpolate_domain_renormalize 
    6990 
     91 
     92    SUBROUTINE cxios_set_interpolate_domain_weight_filename(interpolate_domain_hdl, weight_filename, weight_filename_size) BIND(C) 
     93      USE ISO_C_BINDING 
     94      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     95      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: weight_filename 
     96      INTEGER  (kind = C_INT)     , VALUE        :: weight_filename_size 
     97    END SUBROUTINE cxios_set_interpolate_domain_weight_filename 
     98 
     99    SUBROUTINE cxios_get_interpolate_domain_weight_filename(interpolate_domain_hdl, weight_filename, weight_filename_size) BIND(C) 
     100      USE ISO_C_BINDING 
     101      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     102      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: weight_filename 
     103      INTEGER  (kind = C_INT)     , VALUE        :: weight_filename_size 
     104    END SUBROUTINE cxios_get_interpolate_domain_weight_filename 
     105 
     106    FUNCTION cxios_is_defined_interpolate_domain_weight_filename(interpolate_domain_hdl) BIND(C) 
     107      USE ISO_C_BINDING 
     108      LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_weight_filename 
     109      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     110    END FUNCTION cxios_is_defined_interpolate_domain_weight_filename 
     111 
     112 
     113    SUBROUTINE cxios_set_interpolate_domain_write_weight(interpolate_domain_hdl, write_weight) BIND(C) 
     114      USE ISO_C_BINDING 
     115      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     116      LOGICAL (KIND=C_BOOL)      , VALUE :: write_weight 
     117    END SUBROUTINE cxios_set_interpolate_domain_write_weight 
     118 
     119    SUBROUTINE cxios_get_interpolate_domain_write_weight(interpolate_domain_hdl, write_weight) BIND(C) 
     120      USE ISO_C_BINDING 
     121      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     122      LOGICAL (KIND=C_BOOL)             :: write_weight 
     123    END SUBROUTINE cxios_get_interpolate_domain_write_weight 
     124 
     125    FUNCTION cxios_is_defined_interpolate_domain_write_weight(interpolate_domain_hdl) BIND(C) 
     126      USE ISO_C_BINDING 
     127      LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_write_weight 
     128      INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 
     129    END FUNCTION cxios_is_defined_interpolate_domain_write_weight 
     130 
    70131  END INTERFACE 
    71132 
  • XIOS/dev/dev_olga/src/io/nc4_data_output.cpp

    r973 r1021  
    16751675           for (vector<CVariable*>::iterator it = listVars.begin() ;it != listVars.end(); it++) writeAttribute_(*it, fieldid) ; 
    16761676 
     1677           bool alreadyAddCellMethod = false; 
     1678           StdString cellMethodsPrefix(""), cellMethodsSuffix(""); 
     1679           if (!field->cell_methods.isEmpty()) 
     1680           { 
     1681             StdString cellMethodString = field->cell_methods; 
     1682             if (field->cell_methods_mode.isEmpty() || 
     1683                 (CField::cell_methods_mode_attr::overwrite == field->cell_methods_mode)) 
     1684             { 
     1685               SuperClassWriter::addAttribute("cell_methods", cellMethodString, &fieldid); 
     1686               alreadyAddCellMethod = true; 
     1687             } 
     1688             else 
     1689             { 
     1690               switch (field->cell_methods_mode) 
     1691               { 
     1692               case (CField::cell_methods_mode_attr::prefix): 
     1693                 cellMethodsPrefix = cellMethodString; 
     1694                 cellMethodsPrefix += " "; 
     1695                 break; 
     1696               case (CField::cell_methods_mode_attr::suffix): 
     1697                 cellMethodsSuffix = " "; 
     1698                 cellMethodsSuffix += cellMethodString; 
     1699                 break; 
     1700               case (CField::cell_methods_mode_attr::none): 
     1701                 break; 
     1702               default: 
     1703                 break; 
     1704               } 
     1705             } 
     1706           } 
     1707 
    16771708 
    16781709           if (wtime) 
     
    16871718              SuperClassWriter::addAttribute("interval_write", freqOut.toStringUDUnits(), &fieldid); 
    16881719 
    1689               StdString cellMethods = "time: "; 
     1720              StdString cellMethods(cellMethodsPrefix + "time: "); 
    16901721              if (field->operation.getValue() == "instant") cellMethods += "point"; 
    16911722              else if (field->operation.getValue() == "average") cellMethods += "mean"; 
     
    16941725              if (freqOp.resolve(*context->calendar) != freqOut.resolve(*context->calendar)) 
    16951726                cellMethods += " (interval: " + freqOpStr + ")"; 
    1696               SuperClassWriter::addAttribute("cell_methods", cellMethods, &fieldid); 
     1727              cellMethods += cellMethodsSuffix; 
     1728              if (!alreadyAddCellMethod) 
     1729                SuperClassWriter::addAttribute("cell_methods", cellMethods, &fieldid); 
    16971730           } 
    16981731 
     
    19281961        if (!field->wasWritten()) 
    19291962        { 
    1930           if (appendMode && field->file->record_offset.isEmpty()) 
     1963          if (appendMode && field->file->record_offset.isEmpty() && 
     1964               field->getOperationTimeType() != func::CFunctor::once) 
    19311965          { 
    19321966            field->resetNStep(getRecordFromTime(field->last_Write_srv) + 1); 
  • XIOS/dev/dev_olga/src/node/context.cpp

    r1009 r1021  
    247247 
    248248     hasClient = true; 
    249      if (CXios::serverLevel != 1)  // initClient is called by client pool 
     249     if (CServer::serverLevel != 1) 
     250//     if (CXios::serverLevel != 1) 
     251     // initClient is called by client pool 
    250252     { 
    251253       client = new CContextClient(this, intraComm, interComm, cxtServer); 
    252254       server = new CContextServer(this, intraComm, interComm); 
    253255     } 
    254      else                         // initClient is called by primary server pool 
    255      { 
    256 //       clientPrimServer = new CContextClient(this, intraComm, interComm); 
    257 //       serverPrimServer = new CContextServer(this, 1, intraComm, interComm);  // just some int parameter to distinguish server from serverPrimServer on server1 
     256     else 
     257     // initClient is called by primary server pool 
     258     { 
    258259       clientPrimServer.push_back(new CContextClient(this, intraComm, interComm)); 
    259260       serverPrimServer.push_back(new CContextServer(this, intraComm, interComm)); 
     
    376377   bool CContext::eventLoop(void) 
    377378   { 
    378      if (CXios::serverLevel == 0) 
     379     if (CServer::serverLevel == 0) 
    379380     { 
    380381       return server->eventLoop(); 
    381382     } 
    382      else if (CXios::serverLevel == 1) 
     383     else if (CServer::serverLevel == 1) 
    383384     { 
    384385       bool serverFinished = server->eventLoop(); 
     
    399400   bool CContext::checkBuffersAndListen(void) 
    400401   { 
    401      if (CXios::serverLevel == 0) 
     402     if (CServer::serverLevel == 0) 
    402403     { 
    403404       client->checkBuffers(); 
    404405       return server->eventLoop(); 
    405406     } 
    406      else if (CXios::serverLevel == 1) 
     407     else if (CServer::serverLevel == 1) 
    407408     { 
    408409       client->checkBuffers(); 
     
    417418       return ( serverFinished && serverPrimFinished); 
    418419     } 
    419      else if (CXios::serverLevel == 2) 
     420     else if (CServer::serverLevel == 2) 
    420421     { 
    421422       client->checkBuffers(); 
     
    430431     { 
    431432       finalized = true; 
    432 //        if (hasClient) sendRegistry() ; 
     433       if (hasClient) sendRegistry() ; 
    433434 
    434435       if ((hasClient) && (hasServer)) 
     
    487488     // There is nothing client need to send to server 
    488489     if (hasClient) 
    489 //     if (hasClient && !hasServer) 
    490490     { 
    491491       // After xml is parsed, there are some more works with post processing 
     
    495495     setClientServerBuffer(); 
    496496 
    497 //     if (hasClient && !hasServer) 
    498497     if (hasClient) 
    499498     { 
     
    505504 
    506505      // We have enough information to send to server 
    507       if (!hasServer) 
    508       { 
    509         // First of all, send all enabled files 
    510        sendEnabledFiles(); 
    511        // Then, send all enabled fields 
    512        sendEnabledFields(); 
    513       } 
    514       else 
    515       { 
    516         sendEnabledFiles(clientPrimServer.size()); 
    517         sendEnabledFields(clientPrimServer.size()); 
    518       } 
     506      // First of all, send all enabled files 
     507      sendEnabledFiles(); 
     508 
     509      // Then, send all enabled fields 
     510      sendEnabledFields(); 
    519511 
    520512      // At last, we have all info of domain and axis, then send them 
    521513       sendRefDomainsAxis(); 
    522       // After that, send all grid (if any) 
     514 
     515       // After that, send all grid (if any) 
    523516       sendRefGrid(); 
     517 
    524518       // We have a xml tree on the server side and now, it should be also processed 
    525519       sendPostProcessing(); 
    526520     } 
    527521 
    528     // We have a xml tree on the server side and now, it should be also processed 
    529    // if (hasClient && !hasServer) sendPostProcessing(); 
    530  
    531 //     // Now tell server that it can process all messages from client 
    532 // //    if (hasClient && !hasServer) this->sendCloseDefinition(); 
     522 
     523     // Now tell server that it can process all messages from client 
    533524     if (hasClient) this->sendCloseDefinition(); 
    534525 
    535526    // There are some processings that should be done after all of above. For example: check mask or index 
    536527     if (hasClient && !hasServer) 
    537 //    if (hasClient) 
    538528    { 
    539529      this->buildFilterGraphOfEnabledFields();  // references are resolved here (access xml file) 
     
    692682         DEBUG(<<"Aucun fichier ne va être sorti dans le contexte nommé \"" 
    693683               << getId() << "\" !"); 
     684 
     685      // Assigning contextClient to each enabled file 
     686      if (hasClient) 
     687      { 
     688        for (int i = 0; i < enabledFiles.size(); ++i) 
     689        { 
     690          if (hasServer) 
     691          { 
     692            int srvId = i % clientPrimServer.size(); 
     693            enabledFiles[i]->setContextClient(clientPrimServer[srvId]); 
     694          } 
     695          else 
     696            enabledFiles[i]->setContextClient(client); 
     697        } 
     698      } 
    694699   } 
    695700 
     
    769774   { 
    770775     // Use correct context client to send message 
    771 //     CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[0] : client; 
    772776     int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 
    773777     for (int i = 0; i < nbSrvPools; ++i) 
     
    883887   { 
    884888     // Use correct context client to send message 
    885 //     CContextClient* contextClientTmp = (0 != clientPrimServer) ? clientPrimServer : client; 
    886889     int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 
    887890     for (int i = 0; i < nbSrvPools; ++i) 
     
    958961   { 
    959962      // Use correct context client to send message 
    960 //     CContextClient* contextClientTmp = (0 != clientPrimServer) ? clientPrimServer : client; 
    961963     int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 
    962964     for (int i = 0; i < nbSrvPools; ++i) 
     
    10771079      // Check if some automatic time series should be generated 
    10781080      // Warning: This must be done after solving the inheritance and before the rest of post-processing 
    1079       prepareTimeseries(); 
     1081      if (!hasServer) 
     1082        prepareTimeseries(); 
    10801083 
    10811084      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
     
    12041207     for (int i = 0; i < size; ++i) 
    12051208     { 
    1206        cfgrpPtr->sendCreateChild(this->enabledFiles[i]->getId()); 
    1207        this->enabledFiles[i]->sendAllAttributesToServer(); 
    1208        this->enabledFiles[i]->sendAddAllVariables(); 
    1209      } 
    1210    } 
    1211  
    1212    //! Client side: Send infomation of active files (files are enabled to write out) 
    1213    void CContext::sendEnabledFiles(const int nbPools) 
    1214    { 
    1215      int size = this->enabledFiles.size(); 
    1216  
    1217      // In a context, each type has a root definition, e.g: axis, domain, field. 
    1218      // Every object must be a child of one of these root definition. In this case 
    1219      // all new file objects created on server must be children of the root "file_definition" 
    1220      StdString fileDefRoot("file_definition"); 
    1221      CFileGroup* cfgrpPtr = CFileGroup::get(fileDefRoot); 
    1222  
    1223      { 
    1224        for (int i = 0; i < size; ++i) 
    1225        { 
    1226          int srvId = i % nbPools; 
    1227          cfgrpPtr->sendCreateChild(this->enabledFiles[i]->getId(), srvId); 
    1228          this->enabledFiles[i]->sendAllAttributesToServer(srvId); 
    1229          this->enabledFiles[i]->sendAddAllVariables(srvId); 
    1230        } 
     1209       cfgrpPtr->sendCreateChild(this->enabledFiles[i]->getId(),enabledFiles[i]->getContextClient()); 
     1210       this->enabledFiles[i]->sendAllAttributesToServer(enabledFiles[i]->getContextClient()); 
     1211       this->enabledFiles[i]->sendAddAllVariables(enabledFiles[i]->getContextClient()); 
    12311212     } 
    12321213   } 
     
    12381219     for (int i = 0; i < size; ++i) 
    12391220     { 
    1240        this->enabledFiles[i]->sendEnabledFields(); 
    1241      } 
    1242    } 
    1243  
    1244    void CContext::sendEnabledFields(const int nbPools) 
    1245    { 
    1246      int size = this->enabledFiles.size(); 
    1247      for (int i = 0; i < size; ++i) 
    1248      { 
    1249        int srvId = i % nbPools; 
    1250        this->enabledFiles[i]->sendEnabledFields(srvId); 
     1221       this->enabledFiles[i]->sendEnabledFields(enabledFiles[i]->getContextClient()); 
    12511222     } 
    12521223   } 
     
    13611332   //! Client side: Send information of reference domain and axis of active fields 
    13621333   void CContext::sendRefDomainsAxis() 
    1363    { 
    1364      std::set<StdString> domainIds, axisIds, scalarIds; 
    1365  
    1366      // Find all reference domain and axis of all active fields 
    1367      int numEnabledFiles = this->enabledFiles.size(); 
    1368      for (int i = 0; i < numEnabledFiles; ++i) 
    1369      { 
    1370        std::vector<CField*> enabledFields = this->enabledFiles[i]->getEnabledFields(); 
    1371        int numEnabledFields = enabledFields.size(); 
    1372        for (int j = 0; j < numEnabledFields; ++j) 
    1373        { 
    1374          const std::vector<StdString>& prDomAxisScalarId = enabledFields[j]->getRefDomainAxisIds(); 
    1375          if ("" != prDomAxisScalarId[0]) domainIds.insert(prDomAxisScalarId[0]); 
    1376          if ("" != prDomAxisScalarId[1]) axisIds.insert(prDomAxisScalarId[1]); 
    1377          if ("" != prDomAxisScalarId[2]) scalarIds.insert(prDomAxisScalarId[2]); 
    1378        } 
    1379      } 
    1380  
    1381      // Create all reference axis on server side 
    1382      std::set<StdString>::iterator itDom, itAxis, itScalar; 
    1383      std::set<StdString>::const_iterator itE; 
    1384  
    1385      StdString scalarDefRoot("scalar_definition"); 
    1386      CScalarGroup* scalarPtr = CScalarGroup::get(scalarDefRoot); 
    1387      itE = scalarIds.end(); 
    1388      for (itScalar = scalarIds.begin(); itScalar != itE; ++itScalar) 
    1389      { 
    1390        if (!itScalar->empty()) 
    1391        { 
    1392          scalarPtr->sendCreateChild(*itScalar); 
    1393          CScalar::get(*itScalar)->sendAllAttributesToServer(); 
    1394        } 
    1395      } 
    1396  
    1397      StdString axiDefRoot("axis_definition"); 
    1398      CAxisGroup* axisPtr = CAxisGroup::get(axiDefRoot); 
    1399      itE = axisIds.end(); 
    1400      for (itAxis = axisIds.begin(); itAxis != itE; ++itAxis) 
    1401      { 
    1402        if (!itAxis->empty()) 
    1403        { 
    1404          axisPtr->sendCreateChild(*itAxis); 
    1405          CAxis::get(*itAxis)->sendAllAttributesToServer(); 
    1406        } 
    1407      } 
    1408  
    1409      // Create all reference domains on server side 
    1410      StdString domDefRoot("domain_definition"); 
    1411      CDomainGroup* domPtr = CDomainGroup::get(domDefRoot); 
    1412      itE = domainIds.end(); 
    1413      for (itDom = domainIds.begin(); itDom != itE; ++itDom) 
    1414      { 
    1415        if (!itDom->empty()) { 
    1416           domPtr->sendCreateChild(*itDom); 
    1417           CDomain::get(*itDom)->sendAllAttributesToServer(); 
    1418        } 
    1419      } 
    1420    } 
    1421  
    1422    //! Client side: Send information of reference domain and axis of active fields 
    1423    void CContext::sendRefDomainsAxis(const int nbPools) 
    14241334   { 
    14251335     std::set<StdString> domainIds, axisIds, scalarIds; 
     
    15691479 
    15701480    // Use correct context client to send message 
    1571 //    CContextClient* contextClientTmp = (0 != clientPrimServer) ? clientPrimServer : client; 
    15721481    int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 
    15731482    for (int i = 0; i < nbSrvPools; ++i) 
     
    15751484      CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; 
    15761485      CEventClient event(CContext::GetType(), CContext::EVENT_ID_SEND_REGISTRY); 
    1577             if (contextClientTmp->isServerLeader()) 
     1486        if (contextClientTmp->isServerLeader()) 
    15781487        { 
    15791488           CMessage msg ; 
     
    15831492             msg<<this->getIdServer(); 
    15841493           if (contextClientTmp->clientRank==0) msg<<*registryOut ; 
    1585            const std::list<int>& ranks = client->getRanksServerLeader(); 
     1494           const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    15861495           for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    15871496             event.push(*itRank,1,msg); 
  • XIOS/dev/dev_olga/src/node/context.hpp

    r1009 r1021  
    133133         void sendCreateFileHeader(void); 
    134134         void sendEnabledFiles(); 
    135          void sendEnabledFiles(const int nbPools); 
    136135         void sendEnabledFields(); 
    137          void sendEnabledFields(const int nbPools); 
    138136         void sendRefDomainsAxis(); 
    139          void sendRefDomainsAxis(const int nbPools); 
    140137         void sendRefGrid(); 
    141138         void sendPostProcessing(); 
  • XIOS/dev/dev_olga/src/node/field.cpp

    r1009 r1021  
    3636      , domAxisScalarIds_(vector<StdString>(3,"")), areAllReferenceSolved(false), isReferenceSolved(false) 
    3737      , useCompressedOutput(false) 
    38       , isReadDataRequestPending(false) 
     38      , wasDataAlreadyReceivedFromServer(false) 
    3939   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
    4040 
     
    4747      , domAxisScalarIds_(vector<StdString>(3,"")), areAllReferenceSolved(false), isReferenceSolved(false) 
    4848      , useCompressedOutput(false) 
    49       , isReadDataRequestPending(false) 
     49      , wasDataAlreadyReceivedFromServer(false) 
    5050   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
    5151 
     
    179179  } 
    180180 
    181   void CField::sendUpdateData(const CArray<double,1>& data, const int srvPool) 
     181  void CField::sendUpdateData(const CArray<double,1>& data, CContextClient* client) 
    182182  { 
    183183    CTimer::get("XIOS Send Data").resume(); 
    184  
    185     CContext* context = CContext::getCurrent(); 
    186     CContextClient* client = context->clientPrimServer[srvPool]; 
    187184 
    188185    CEventClient event(getType(), EVENT_ID_UPDATE_DATA); 
     
    312309        int fileIdx = std::find(context->enabledFiles.begin(), context->enabledFiles.end(), this->file) - context->enabledFiles.begin(); 
    313310        int srvId = fileIdx % context->clientPrimServer.size(); 
    314         sendUpdateData(fieldData, srvId); 
     311        sendUpdateData(fieldData, context->clientPrimServer[srvId]); 
    315312    } 
    316313    if (!context->hasClient && context->hasServer) 
     
    348345  } 
    349346 
    350   void CField::sendReadDataRequest(void) 
     347  void CField::sendReadDataRequest(const CDate& tsDataRequested) 
    351348  { 
    352349    CContext* context = CContext::getCurrent(); 
    353350    CContextClient* client = context->client; 
    354351 
    355     lastDataRequestedFromServer = context->getCalendar()->getCurrentDate(); 
    356     isReadDataRequestPending = true; 
     352    lastDataRequestedFromServer = tsDataRequested; 
    357353 
    358354    CEventClient event(getType(), EVENT_ID_READ_DATA); 
     
    377373    const CDate& currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate(); 
    378374 
    379     bool requestData = (currentDate >= lastDataRequestedFromServer + file->output_freq.getValue()); 
    380  
    381     if (requestData) 
    382     { 
    383       cout<<"currentDate : "<<currentDate<<endl ; 
    384       cout<<"lastDataRequestedFromServer : "<<lastDataRequestedFromServer<<endl ; 
    385       cout<<"file->output_freq.getValue() : "<<file->output_freq.getValue()<<endl ; 
    386       cout<<"lastDataRequestedFromServer + file->output_freq.getValue() : "<<lastDataRequestedFromServer + file->output_freq.getValue()<<endl ; 
    387  
    388       sendReadDataRequest(); 
    389     } 
    390  
    391     return requestData; 
     375    bool dataRequested = false; 
     376    while (currentDate >= lastDataRequestedFromServer) 
     377    { 
     378      info(20) << "currentDate : " << currentDate << endl ; 
     379      info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; 
     380      info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ; 
     381      info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
     382 
     383      sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); 
     384 
     385      dataRequested = true; 
     386    } 
     387    return dataRequested; 
    392388  } 
    393389 
     
    411407 
    412408    map<int, CArray<double,1> >::iterator it; 
    413     for (it = data_srv.begin(); it != data_srv.end(); it++) 
    414     { 
    415       msgs.push_back(CMessage()); 
    416       CMessage& msg = msgs.back(); 
    417       msg << getId(); 
    418       if (hasData) 
    419         msg << getNStep() - 1 << it->second; 
    420       else 
    421         msg << int(-1); 
    422       event.push(it->first, grid->nbSenders[it->first], msg); 
    423     } 
    424     client->sendEvent(event); 
     409//    for (it = data_srv.begin(); it != data_srv.end(); it++) 
     410//    { 
     411//      msgs.push_back(CMessage()); 
     412//      CMessage& msg = msgs.back(); 
     413//      msg << getId(); 
     414//      if (hasData) 
     415//        msg << getNStep() - 1 << it->second; 
     416//      else 
     417//        msg << int(-1); 
     418//      event.push(it->first, grid->nbSenders[it->first], msg); 
     419//    } 
     420//    client->sendEvent(event); 
     421    if (!grid->doGridHaveDataDistributed()) 
     422    { 
     423       if (client->isServerLeader()) 
     424       { 
     425          if (!data_srv.empty()) 
     426          { 
     427            it = data_srv.begin(); 
     428            const std::list<int>& ranks = client->getRanksServerLeader(); 
     429            for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     430            { 
     431              msgs.push_back(CMessage()); 
     432              CMessage& msg = msgs.back(); 
     433              msg << getId(); 
     434              if (hasData) 
     435                msg << getNStep() - 1 << it->second; 
     436              else 
     437                msg << int(-1); 
     438              event.push(*itRank, 1, msg); 
     439            } 
     440          } 
     441          client->sendEvent(event); 
     442       } 
     443       else 
     444       { 
     445          // if (!data_srv.empty()) 
     446          // { 
     447          //   it = data_srv.begin(); 
     448          //   const std::list<int>& ranks = client->getRanksServerNotLeader(); 
     449          //   for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     450          //   { 
     451          //     msgs.push_back(CMessage()); 
     452          //     CMessage& msg = msgs.back(); 
     453          //     msg << getId(); 
     454          //     if (hasData) 
     455          //       msg << getNStep() - 1 << it->second; 
     456          //     else 
     457          //       msg << int(-1); 
     458          //     event.push(*itRank, 1, msg); 
     459          //   } 
     460          // } 
     461          client->sendEvent(event); 
     462       } 
     463    } 
     464    else 
     465    { 
     466      for (it = data_srv.begin(); it != data_srv.end(); it++) 
     467      { 
     468        msgs.push_back(CMessage()); 
     469        CMessage& msg = msgs.back(); 
     470        msg << getId(); 
     471        if (hasData) 
     472          msg << getNStep() - 1 << it->second; 
     473        else 
     474          msg << int(-1); 
     475        event.push(it->first, grid->nbSenders[it->first], msg); 
     476      } 
     477      client->sendEvent(event); 
     478    } 
    425479  } 
    426480 
     
    494548    } 
    495549 
     550    if (wasDataAlreadyReceivedFromServer) 
     551      lastDataReceivedFromServer = lastDataReceivedFromServer + file->output_freq; 
     552    else 
     553    { 
     554      lastDataReceivedFromServer = context->getCalendar()->getInitDate(); 
     555      wasDataAlreadyReceivedFromServer = true; 
     556    } 
     557 
    496558    if (isEOF) 
    497       serverSourceFilter->signalEndOfStream(lastDataRequestedFromServer); 
     559      serverSourceFilter->signalEndOfStream(lastDataReceivedFromServer); 
    498560    else 
    499       serverSourceFilter->streamDataFromServer(lastDataRequestedFromServer, data); 
    500  
    501     isReadDataRequestPending = false; 
     561      serverSourceFilter->streamDataFromServer(lastDataReceivedFromServer, data); 
    502562  } 
    503563 
     
    749809     solveGridDomainAxisRef(doSending2Server); 
    750810 
    751      if (context->hasClient && !context->hasClient) 
     811     if (context->hasClient && !context->hasServer) 
    752812     { 
    753813       solveTransformedGrid(); 
     
    831891     { 
    832892       // Check if we have an expression to parse 
    833        if (!content.empty()) 
    834        { 
    835          boost::scoped_ptr<IFilterExprNode> expr(parseExpr(content + '\0')); 
    836          instantDataFilter = expr->reduce(gc, *this); 
     893       if (hasExpression()) 
     894       { 
     895         boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0')); 
     896         boost::shared_ptr<COutputPin> filter = expr->reduce(gc, *this); 
     897 
     898         // Check if a spatial transformation is needed 
     899         if (!field_ref.isEmpty()) 
     900         { 
     901           CGrid* gridRef = CField::get(field_ref)->grid; 
     902 
     903           if (grid && grid != gridRef && grid->hasTransform()) 
     904           { 
     905             double defaultValue = !default_value.isEmpty() ? default_value : 0.0; 
     906             std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, defaultValue); 
     907 
     908             filter->connectOutput(filters.first, 0); 
     909             filter = filters.second; 
     910           } 
     911         } 
     912 
     913         instantDataFilter = filter; 
    837914       } 
    838915       // Check if we have a reference on another field 
     
    841918       // Check if the data is to be read from a file 
    842919       else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 
    843          instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid, 
    844                                                                                                      freq_offset.isEmpty() ? NoneDu : freq_offset)); 
     920         instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, 
     921                                                                                                     freq_offset.isEmpty() ? NoneDu : freq_offset, 
     922                                                                                                     true)); 
    845923       else // The data might be passed from the model 
    846          instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid)); 
     924         instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid)); 
    847925     } 
    848926 
     
    863941     } 
    864942   } 
     943 
    865944 
    866945   /*! 
     
    871950    * \return the output pin corresponding to the field reference 
    872951    */ 
    873    boost::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 
    874    { 
    875      if (instantDataFilter || field_ref.isEmpty()) 
    876        ERROR("COutputPin* CField::getFieldReference(CGarbageCollector& gc)", 
    877              "Impossible to get the field reference for a field which has already been parsed or which does not have a field_ref."); 
    878  
    879      CField* fieldRef = CField::get(field_ref); 
    880      fieldRef->buildFilterGraph(gc, false); 
    881  
    882      std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters; 
    883      // Check if a spatial transformation is needed 
    884      if (grid && grid != fieldRef->grid && grid->hasTransform()) 
    885      { 
    886        double defaultValue = 0.0; 
    887        if (!default_value.isEmpty()) defaultValue = this->default_value; 
    888        filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, defaultValue); 
    889      } 
    890  
    891      else 
    892        filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 
    893  
    894      fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
    895  
    896      return filters.second; 
    897    } 
     952     boost::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 
     953     { 
     954       if (instantDataFilter || field_ref.isEmpty()) 
     955         ERROR("COutputPin* CField::getFieldReference(CGarbageCollector& gc)", 
     956               "Impossible to get the field reference for a field which has already been parsed or which does not have a field_ref."); 
     957 
     958       CField* fieldRef = CField::get(field_ref); 
     959       fieldRef->buildFilterGraph(gc, false); 
     960 
     961       std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters; 
     962       // Check if a spatial transformation is needed 
     963       if (grid && grid != fieldRef->grid && grid->hasTransform()) 
     964       { 
     965         double defaultValue = !default_value.isEmpty() ? default_value : 0.0; 
     966         filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, defaultValue); 
     967       } 
     968       else 
     969         filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 
     970 
     971       fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
     972 
     973       return filters.second; 
     974     } 
    898975 
    899976   /*! 
     
    908985   boost::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 
    909986   { 
    910      if (instantDataFilter || content.empty()) 
     987     if (instantDataFilter || !hasExpression()) 
    911988       ERROR("COutputPin* CField::getSelfReference(CGarbageCollector& gc)", 
    912989             "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); 
     
    917994       { 
    918995         if (!serverSourceFilter) 
    919            serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid, 
    920                                                                                    freq_offset.isEmpty() ? NoneDu : freq_offset)); 
    921  
     996           serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, 
     997                                                                                   freq_offset.isEmpty() ? NoneDu : freq_offset, 
     998                                                                                   true)); 
    922999         selfReferenceFilter = serverSourceFilter; 
    9231000       } 
    9241001       else if (!field_ref.isEmpty()) 
    925          selfReferenceFilter = getFieldReference(gc); 
     1002       { 
     1003         CField* fieldRef = CField::get(field_ref); 
     1004         fieldRef->buildFilterGraph(gc, false); 
     1005         selfReferenceFilter = fieldRef->getInstantDataFilter(); 
     1006       } 
    9261007       else 
    9271008       { 
    9281009         if (!clientSourceFilter) 
    929            clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid)); 
     1010           clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid)); 
    9301011 
    9311012         selfReferenceFilter = clientSourceFilter; 
     
    11261207     else if (grid && grid->hasTransform() && !grid->isTransformed()) 
    11271208     { 
    1128        grid->transformGrid(grid); 
     1209       // Temporarily deactivate the self-transformation of grid 
     1210       //grid->transformGrid(grid); 
    11291211     } 
    11301212   } 
     
    13251407   } 
    13261408 
    1327    void CField::sendAddAllVariables(const int srvPool) 
     1409   void CField::sendAddAllVariables(CContextClient* client) 
    13281410   { 
    13291411     std::vector<CVariable*> allVar = getAllVariables(); 
     
    13331415     for (; it != itE; ++it) 
    13341416     { 
    1335        this->sendAddVariable((*it)->getId()); 
    1336        (*it)->sendAllAttributesToServer(srvPool); 
    1337        (*it)->sendValue(srvPool); 
     1417       this->sendAddVariable((*it)->getId(), client); 
     1418       (*it)->sendAllAttributesToServer(client); 
     1419       (*it)->sendValue(client); 
    13381420     } 
    13391421   } 
     
    13631445   } 
    13641446 
     1447   void CField::sendAddVariable(const string& id, CContextClient* client) 
     1448   { 
     1449      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 
     1450    // CContext* context = CContext::getCurrent(); 
     1451 
     1452    // if (!context->hasServer) 
     1453    // { 
     1454    //    CContextClient* client = context->client; 
     1455 
     1456    //    CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE); 
     1457    //    if (client->isServerLeader()) 
     1458    //    { 
     1459    //      CMessage msg; 
     1460    //      msg << this->getId(); 
     1461    //      msg << id; 
     1462    //      const std::list<int>& ranks = client->getRanksServerLeader(); 
     1463    //      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     1464    //        event.push(*itRank,1,msg); 
     1465    //      client->sendEvent(event); 
     1466    //    } 
     1467    //    else client->sendEvent(event); 
     1468    // } 
     1469   } 
     1470 
    13651471   void CField::sendAddVariableGroup(const string& id) 
    13661472   { 
     
    14181524   } 
    14191525 
     1526   /*! 
     1527    * Returns string arithmetic expression associated to the field. 
     1528    * \return if content is defined return content string, otherwise, if "expr" attribute is defined, return expr string. 
     1529    */ 
     1530   const string& CField::getExpression(void) 
     1531   { 
     1532     if (!expr.isEmpty() && content.empty()) 
     1533     { 
     1534       content = expr; 
     1535       expr.reset(); 
     1536     } 
     1537 
     1538     return content; 
     1539   } 
     1540 
     1541   bool CField::hasExpression(void) const 
     1542   { 
     1543     return (!expr.isEmpty() || !content.empty()); 
     1544   } 
     1545 
     1546 
    14201547   DEFINE_REF_FUNC(Field,field) 
    14211548} // namespace xios 
  • XIOS/dev/dev_olga/src/node/field.hpp

    r1009 r1021  
    1616#include "transformation_enum.hpp" 
    1717#include "variable.hpp" 
     18#include "context_client.hpp" 
    1819 
    1920 
     
    124125         boost::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc); 
    125126         boost::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 
     127         boost::shared_ptr<COutputPin> getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 
    126128 
    127129//         virtual void fromBinary(StdIStream& is); 
     
    139141        static bool dispatchEvent(CEventServer& event); 
    140142        void sendUpdateData(const CArray<double,1>& data); 
    141         void sendUpdateData(const CArray<double,1>& data, const int srvPool); 
     143        void sendUpdateData(const CArray<double,1>& data, CContextClient* client); 
    142144        static void recvUpdateData(CEventServer& event); 
    143145        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers); 
    144146        void writeField(void); 
    145         void sendReadDataRequest(void); 
     147        void sendReadDataRequest(const CDate& tsDataRequested); 
    146148        bool sendReadDataRequestIfNeeded(void); 
    147149        static void recvReadDataRequest(CEventServer& event); 
     
    169171        CVariableGroup* addVariableGroup(const string& id = ""); 
    170172        void sendAddVariable(const string& id = ""); 
    171         void sendAddVariable(const string& id, const int srvPool); 
     173        void sendAddVariable(const string& id, CContextClient* client); 
    172174        void sendAddVariableGroup(const string& id = ""); 
    173175        static void recvAddVariable(CEventServer& event); 
     
    176178        void recvAddVariableGroup(CBufferIn& buffer); 
    177179        void sendAddAllVariables(); 
    178         void sendAddAllVariables(const int srvPool); 
    179  
     180        void sendAddAllVariables(CContextClient* client); 
    180181 
    181182        const std::vector<StdString>& getRefDomainAxisIds(); 
     183 
     184        const string& getExpression(void); 
     185        bool hasExpression(void) const; 
    182186 
    183187      public: 
     
    194198         bool isEOF; 
    195199         CDate lastlast_Write_srv, last_Write_srv, last_operation_srv; 
    196          CDate lastDataRequestedFromServer; 
     200         CDate lastDataRequestedFromServer, lastDataReceivedFromServer; 
     201         bool wasDataAlreadyReceivedFromServer; 
    197202 
    198203         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
     
    204209         bool isReferenceSolved; 
    205210         std::vector<StdString> domAxisScalarIds_; 
    206          bool isReadDataRequestPending; 
    207211         bool useCompressedOutput; 
     212 
     213         // Two variables to identify the time_counter meta data written in file, which has no time_counter 
     214         bool hasTimeInstant; 
     215         bool hasTimeCentered; 
    208216 
    209217         DECLARE_REF_FUNC(Field,field) 
  • XIOS/dev/dev_olga/src/node/field_impl.hpp

    r645 r1021  
    2020    if (clientSourceFilter) 
    2121      clientSourceFilter->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); 
    22     else if (!field_ref.isEmpty() || !content.empty()) 
     22    else if (instantDataFilter) 
    2323      ERROR("void CField::setData(const CArray<double, N>& _data)", 
    2424            << "Impossible to receive data from the model for a field [ id = " << getId() << " ] with a reference or an arithmetic operation."); 
  • XIOS/dev/dev_olga/src/node/file.cpp

    r1009 r1021  
    1414#include "type.hpp" 
    1515#include "xios_spl.hpp" 
    16 #include "context_client.hpp" 
    1716#include "mpi.hpp" 
    1817 
     
    376375         { 
    377376           middlePart=filename.substr(pos1,pos2-pos1) ; 
    378            cout<<pos2<<endl ; 
    379377           pos2+=strEndDate.size() ; 
    380378           lastPart=filename.substr(pos2,filename.size()-pos2) ; 
     
    746744     int size = this->enabledFields.size(); 
    747745     for (int i = 0; i < size; ++i) 
    748        this->enabledFields[i]->sendReadDataRequest(); 
     746       this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    749747   } 
    750748 
     
    822820   { 
    823821     return vVariableGroup->createChildGroup(id); 
     822   } 
     823 
     824   void CFile::setContextClient(CContextClient* newContextClient) 
     825   { 
     826     client = newContextClient; 
     827   } 
     828 
     829   CContextClient* CFile::getContextClient() 
     830   { 
     831     return client; 
    824832   } 
    825833 
     
    853861   } 
    854862 
    855    void CFile::sendAddField(const string& id, const int srvPool) 
    856    { 
    857       sendAddItem(id, EVENT_ID_ADD_FIELD, srvPool); 
     863   void CFile::sendAddField(const string& id, CContextClient* client) 
     864   { 
     865      sendAddItem(id, EVENT_ID_ADD_FIELD, client); 
    858866    // CContext* context = CContext::getCurrent(); 
    859867 
     
    974982   } 
    975983 
    976    void CFile::sendAddAllVariables(const int srvPool) 
     984   void CFile::sendAddAllVariables(CContextClient* client) 
    977985   { 
    978986     std::vector<CVariable*> allVar = getAllVariables(); 
     
    982990     for (; it != itE; ++it) 
    983991     { 
    984        this->sendAddVariable((*it)->getId(), srvPool); 
    985        (*it)->sendAllAttributesToServer(srvPool); 
    986        (*it)->sendValue(srvPool); 
     992       this->sendAddVariable((*it)->getId(), client); 
     993       (*it)->sendAllAttributesToServer(client); 
     994       (*it)->sendValue(client); 
    987995     } 
    988996   } 
     
    10461054   } 
    10471055 
    1048    void CFile::sendAddVariable(const string& id, const int srvPool) 
    1049    { 
    1050       sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, srvPool); 
     1056   void CFile::sendAddVariable(const string& id, CContextClient* client) 
     1057   { 
     1058      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 
    10511059    // CContext* context = CContext::getCurrent(); 
    10521060 
     
    11261134   Remark: This function must be called AFTER all active (enabled) files have been created on the server side 
    11271135   */ 
    1128    void CFile::sendEnabledFields() 
     1136//   void CFile::sendEnabledFields() 
     1137//   { 
     1138//     size_t size = this->enabledFields.size(); 
     1139//     for (size_t i = 0; i < size; ++i) 
     1140//     { 
     1141//       CField* field = this->enabledFields[i]; 
     1142//       this->sendAddField(field->getId()); 
     1143//       field->sendAllAttributesToServer(); 
     1144//       field->sendAddAllVariables(); 
     1145//     } 
     1146//   } 
     1147 
     1148   /*! 
     1149     \brief Sending all active (enabled) fields from client to server. 
     1150   Each field is identified uniquely by its string identity. Not only should we 
     1151   send the id to server but also we need to send ids of reference domain and reference axis. 
     1152   With these two id, it's easier to make reference to grid where all data should be written. 
     1153   Remark: This function must be called AFTER all active (enabled) files have been created on the server side 
     1154   */   void CFile::sendEnabledFields(CContextClient* client) 
    11291155   { 
    11301156     size_t size = this->enabledFields.size(); 
     
    11321158     { 
    11331159       CField* field = this->enabledFields[i]; 
    1134        this->sendAddField(field->getId()); 
    1135        field->sendAllAttributesToServer(); 
    1136        field->sendAddAllVariables(); 
     1160       this->sendAddField(field->getId(), client); 
     1161       field->sendAllAttributesToServer(client); 
     1162       field->sendAddAllVariables(client); 
    11371163     } 
    11381164   } 
    11391165 
    1140    void CFile::sendEnabledFields(const int srvPool) 
    1141    { 
    1142      size_t size = this->enabledFields.size(); 
    1143      for (size_t i = 0; i < size; ++i) 
    1144      { 
    1145        CField* field = this->enabledFields[i]; 
    1146        this->sendAddField(field->getId(), srvPool); 
    1147        field->sendAllAttributesToServer(srvPool); 
    1148        field->sendAddAllVariables(srvPool); 
    1149      } 
    1150    } 
    11511166 
    11521167   /*! 
  • XIOS/dev/dev_olga/src/node/file.hpp

    r1009 r1021  
    1111#include "attribute_enum.hpp" 
    1212#include "attribute_enum_impl.hpp" 
     13#include "context_client.hpp" 
    1314#include "mpi.hpp" 
    1415 
     
    114115         CVariable* addVariable(const string& id = ""); 
    115116         CVariableGroup* addVariableGroup(const string& id = ""); 
     117         void setContextClient(CContextClient* newContextClient); 
     118         CContextClient* getContextClient(); 
    116119 
    117120         // Send info to server 
    118          void sendEnabledFields(); 
    119          void sendEnabledFields(const int srvPool); 
     121//         void sendEnabledFields(); 
     122         void sendEnabledFields(CContextClient* client); 
    120123         void sendAddField(const string& id = ""); 
    121          void sendAddField(const string& id, const int srvPool); 
     124         void sendAddField(const string& id, CContextClient* client); 
    122125         void sendAddFieldGroup(const string& id = ""); 
    123          void sendAddAllVariables(); 
    124          void sendAddAllVariables(const int srvPool); 
    125          void sendAddVariable(const string& id = ""); 
    126          void sendAddVariable(const string& id, const int srvPool); 
     126         void sendAddAllVariables();                        // to be removed (?) 
     127         void sendAddAllVariables(CContextClient* client); 
     128         void sendAddVariable(const string& id = "");         // to be removed (?) 
     129         void sendAddVariable(const string& id, CContextClient* client); 
    127130         void sendAddVariableGroup(const string& id = ""); 
    128131 
     
    169172         boost::shared_ptr<CDataInput> data_in; 
    170173         std::vector<CField*> enabledFields; 
     174         CContextClient* client; 
    171175 
    172176      public: 
  • XIOS/dev/dev_olga/src/node/grid.cpp

    r1009 r1021  
    299299         } 
    300300 
    301          this->isChecked = true; 
     301//         this->isChecked = true; 
     302         if (!(this->hasTransform() && !this->isTransformed())) 
     303          this->isChecked = true; 
    302304         return; 
    303305       } 
     
    316318          this->computeIndex(); 
    317319       } 
    318        this->isChecked = true; 
     320//       this->isChecked = true; 
     321       if (!(this->hasTransform() && !this->isTransformed())) 
     322        this->isChecked = true; 
     323 
     324       if (!(this->hasTransform() && (!this->isGenerated()))) 
     325        this->isChecked = true; 
    319326     } 
    320327   } 
     
    10941101          } 
    10951102 
     1103          storeIndex_fromSrv.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 
    10961104          listMsg.push_back(CMessage()); 
    10971105          listMsg.back() << getId( )<< isDataDistributed_ << isCompressible_ << listOutIndex.back(); 
     
    11021110      } 
    11031111      else 
     1112      { 
     1113        const std::list<int>& ranks = client->getRanksServerNotLeader(); 
     1114        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     1115        { 
     1116          int rank = *itRank; 
     1117          int nb = 1; 
     1118          storeIndex_fromSrv.insert(std::make_pair(rank, CArray<int,1>(nb))); 
     1119          CArray<int, 1>& outLocalIndexToServer = storeIndex_fromSrv[rank]; 
     1120          for (int k = 0; k < nb; ++k) 
     1121          { 
     1122            outLocalIndexToServer(k)  = 0; 
     1123          } 
     1124        } 
    11041125        client->sendEvent(event); 
     1126      } 
    11051127    } 
    11061128  } 
     
    11361158          } 
    11371159 
    1138           //int nbClient = client->clientSize; // This stupid variable signals the servers the number of client connect to them 
    11391160          const std::list<int>& ranks = client->getRanksServerLeader(); 
    11401161          for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    11411162          { 
    11421163            storeIndex_toSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
     1164            storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
    11431165            listOutIndex.push_back(CArray<size_t,1>(outGlobalIndexOnServer)); 
    11441166 
     
    11511173        } 
    11521174        else 
    1153           client->sendEvent(event); 
     1175        { 
     1176           int indexSize = globalLocalIndexSendToServer.size(); 
     1177           CArray<int,1> outLocalIndexToServer(indexSize); 
     1178           for (int idx = 0; itIndex != iteIndex; ++itIndex, ++idx) 
     1179           { 
     1180             outLocalIndexToServer(idx) = itIndex->second; 
     1181           } 
     1182 
     1183           const std::list<int>& ranks = client->getRanksServerNotLeader(); 
     1184           for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     1185           { 
     1186             storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
     1187           } 
     1188           client->sendEvent(event); 
     1189         } 
    11541190      } 
    11551191      else 
     
    11771213        } 
    11781214 
    1179 //        for (int ns = 0; ns < connectedServerRank_.size(); ++ns) 
    1180         for (int ns = 0; ns < client->serverSize; ++ns) 
     1215        for (int ns = 0; ns < connectedServerRank_.size(); ++ns) 
     1216//        for (int ns = 0; ns < client->serverSize; ++ns) 
    11811217        { 
    11821218          rank = connectedServerRank_[ns]; 
     
    11971233          } 
    11981234 
     1235          storeIndex_fromSrv.insert(make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 
    11991236          listMsg.push_back(CMessage()); 
    12001237          listMsg.back() << getId() << isDataDistributed_ << isCompressible_ << listOutIndex.back(); 
  • XIOS/dev/dev_olga/src/node/grid.hpp

    r976 r1021  
    221221 
    222222         map<int, CArray<int, 1> > storeIndex_toSrv; 
     223         map<int, CArray<int, 1> > storeIndex_fromSrv; 
    223224         map<int,int> nbSenders; 
    224225 
  • XIOS/dev/dev_olga/src/node/interpolate_domain.cpp

    r836 r1021  
    4747             << "Please define a correct one") ; 
    4848    } 
     49 
     50    if (this->mode.isEmpty()) this->mode.setValue(mode_attr::compute); 
     51    if (this->write_weight.isEmpty()) this->write_weight.setValue(false); 
     52 
     53    StdString weightFile; 
     54    switch (this->mode) 
     55    { 
     56      case mode_attr::read: 
     57        if (this->file.isEmpty()) 
     58        { 
     59          if (!this->write_weight) 
     60            ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 
     61                 << "Read mode is activated but there is no file specified." << std::endl 
     62                 << "Please define a correct file containing interpolation weights with option 'file'. "); 
     63        } 
     64        else 
     65        { 
     66          weightFile = this->file; 
     67          ifstream f(weightFile.c_str()); 
     68          if (!f.good()) 
     69            ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 
     70                  << "Read mode is activated but file "  << weightFile << " doesn't exist." << std::endl 
     71                  << "Please check this file "); 
     72        } 
     73        break; 
     74      case mode_attr::compute: 
     75        break; 
     76      case mode_attr::read_or_compute: 
     77        if (!this->file.isEmpty() && !this->write_weight) 
     78        { 
     79          weightFile = this->file; 
     80          ifstream f(weightFile.c_str()); 
     81          if (!f.good()) 
     82            ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 
     83                  << "read_or_compute mode is activated but file "  << weightFile << " doesn't exist." << std::endl 
     84                  << "Please check this file "); 
     85        } 
     86        break; 
     87      default: 
     88        break; 
     89    } 
     90 
    4991  } 
    5092 
  • XIOS/dev/dev_olga/src/node/interpolate_domain.hpp

    r836 r1021  
    5050      virtual ~CInterpolateDomain(void); 
    5151 
    52       virtual void checkValid(CDomain* axisDest); 
     52      virtual void checkValid(CDomain* domainSource); 
    5353 
    5454      /// Accesseurs statiques /// 
  • XIOS/dev/dev_olga/src/node/variable.cpp

    r1009 r1021  
    127127   } 
    128128 
    129    void CVariable::sendValue(const int srvPool) 
    130    { 
    131      CContext* context=CContext::getCurrent() ; 
    132      CContextClient* contextClientTmp = context->clientPrimServer[srvPool]; 
     129   void CVariable::sendValue(CContextClient* client) 
     130   { 
    133131     CEventClient event(this->getType(),EVENT_ID_VARIABLE_VALUE) ; 
    134      if (contextClientTmp->isServerLeader()) 
     132     if (client->isServerLeader()) 
    135133     { 
    136134       CMessage msg ; 
    137135       msg<<this->getId() ; 
    138136       msg<<content ; 
    139        const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
     137       const std::list<int>& ranks = client->getRanksServerLeader(); 
    140138       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    141139         event.push(*itRank,1,msg); 
    142        contextClientTmp->sendEvent(event) ; 
     140       client->sendEvent(event) ; 
    143141     } 
    144      else contextClientTmp->sendEvent(event) ; 
     142     else client->sendEvent(event) ; 
    145143   } 
    146144 
  • XIOS/dev/dev_olga/src/node/variable.hpp

    r1009 r1021  
    7979            //! Sending a request to set up variable data 
    8080            void sendValue(); 
    81             void sendValue(const int srvPool); 
     81            void sendValue(CContextClient* client); 
    8282 
    8383            static void recvValue(CEventServer& event) ; 
  • XIOS/dev/dev_olga/src/object_template.hpp

    r1009 r1021  
    99#include "event_server.hpp" 
    1010#include "attribute.hpp" 
     11#include "context_client.hpp" 
    1112 
    1213namespace xios 
     
    5657         std::map<int, size_t> getMinimumBufferSizeForAttributes(); 
    5758         void sendAttributToServer(const string& id); 
    58          void sendAttributToServer(const string& id, const int srvPool); 
     59         void sendAttributToServer(const string& id, CContextClient* client); 
    5960         void sendAttributToServer(CAttribute& attr) ; 
    60          void sendAttributToServer(CAttribute& attr, const int srvPool) ; 
     61         void sendAttributToServer(CAttribute& attr, CContextClient* client) ; 
    6162         void sendAllAttributesToServer(); 
    62          void sendAllAttributesToServer(const int srvPool); 
     63         void sendAllAttributesToServer(CContextClient* client); 
    6364         void sendAddItem(const string& id, int itemType); 
    64          void sendAddItem(const string& id, int itemType, const int srvPool); 
     65         void sendAddItem(const string& id, int itemType, CContextClient* client); 
    6566         static void recvAttributFromClient(CEventServer& event) ; 
    6667         static bool dispatchEvent(CEventServer& event) ; 
  • XIOS/dev/dev_olga/src/object_template_impl.hpp

    r1009 r1021  
    164164   std::map<int, size_t> CObjectTemplate<T>::getMinimumBufferSizeForAttributes() 
    165165   { 
    166      // CContextClient* client = CContext::getCurrent()->client; 
     166     // Use correct context client to send message 
    167167     CContext* context = CContext::getCurrent(); 
    168  
    169           // Use correct context client to send message 
    170 //     CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 
    171168     int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    172169     for (int i = 0; i < nbSrvPools; ++i) 
     
    244241 
    245242   template<typename T> 
    246    void CObjectTemplate<T>::sendAllAttributesToServer(const int srvPool) 
     243   void CObjectTemplate<T>::sendAllAttributesToServer(CContextClient* client) 
    247244   { 
    248245     CAttributeMap& attrMap = *this; 
     
    250247     for (; it != itE; ++it) 
    251248     { 
    252        if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second), srvPool); 
     249       if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second), client); 
    253250     } 
    254251   } 
     
    263260 
    264261   template <class T> 
    265    void CObjectTemplate<T>::sendAttributToServer(const string& id, const int srvPool) 
     262   void CObjectTemplate<T>::sendAttributToServer(const string& id, CContextClient* client) 
    266263   { 
    267264      CAttributeMap & attrMap = *this; 
    268265      CAttribute* attr=attrMap[id]; 
    269       sendAttributToServer(*attr, srvPool); 
     266      sendAttributToServer(*attr, client); 
    270267   } 
    271268 
     
    273270  void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr) 
    274271  { 
     272     // Use correct context client to send message 
    275273    CContext* context=CContext::getCurrent(); 
    276  
    277      // Use correct context client to send message 
    278 //    CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 
    279274    if (context->hasClient) 
    280275    { 
     
    283278      { 
    284279        CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    285         // CContextClient* contextClientTmp=context->contextClientTmp; 
    286  
    287280        CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); 
    288281        if (contextClientTmp->isServerLeader()) 
    289282        { 
    290283          CMessage msg; 
    291 //          if (context->hasServer) 
    292 //          { 
    293 //            StdString tmp = this->getIdServer() + "_" +boost::lexical_cast<string>(i); 
    294 //            msg<<tmp; 
    295 //          } 
    296 //          else 
    297             msg<<this->getIdServer(); 
    298  
     284          msg<<this->getIdServer(); 
    299285          msg << attr.getName(); 
    300286          msg << attr; 
     
    331317 
    332318  template <class T> 
    333   void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr, const int srvPool) 
     319  void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr, CContextClient* client) 
    334320  { 
    335     CContext* context=CContext::getCurrent(); 
    336     CContextClient* contextClientTmp = context->clientPrimServer[srvPool]; 
    337321    CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); 
    338     if (contextClientTmp->isServerLeader()) 
     322    if (client->isServerLeader()) 
    339323    { 
    340324      CMessage msg; 
     
    342326      msg << attr.getName(); 
    343327      msg << attr; 
    344       const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
     328      const std::list<int>& ranks = client->getRanksServerLeader(); 
    345329      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    346330        event.push(*itRank,1,msg); 
    347       contextClientTmp->sendEvent(event); 
     331      client->sendEvent(event); 
    348332    } 
    349     else contextClientTmp->sendEvent(event); 
     333    else client->sendEvent(event); 
    350334  } 
    351  
    352335 
    353336  /*! 
     
    364347    if (context->hasClient) 
    365348    { 
    366        // Use correct context client to send message 
    367 //      CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 
     349      // Use correct context client to send message 
    368350      int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    369351      for (int i = 0; i < nbSrvPools; ++i) 
     
    387369 
    388370  template<class T> 
    389   void CObjectTemplate<T>::sendAddItem(const StdString& id, int itemType, const int srvPool) 
     371  void CObjectTemplate<T>::sendAddItem(const StdString& id, int itemType, CContextClient* client) 
    390372  { 
    391     CContext* context = CContext::getCurrent(); 
    392373    typedef typename T::EEventId ItemType; 
    393      CContextClient* contextClientTmp = context->clientPrimServer[srvPool]; 
    394374     CEventClient event(this->getType(),ItemType(itemType)); 
    395      if (contextClientTmp->isServerLeader()) 
     375     if (client->isServerLeader()) 
    396376     { 
    397377       CMessage msg; 
    398378       msg << this->getId(); 
    399379       msg << id; 
    400        const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
     380       const std::list<int>& ranks = client->getRanksServerLeader(); 
    401381       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    402382         event.push(*itRank,1,msg); 
    403        contextClientTmp->sendEvent(event); 
     383       client->sendEvent(event); 
    404384     } 
    405      else contextClientTmp->sendEvent(event); 
     385     else client->sendEvent(event); 
    406386  } 
     387 
    407388 
    408389  template <class T> 
  • XIOS/dev/dev_olga/src/server.cpp

    r1009 r1021  
    2222    list<MPI_Comm> CServer::interComm ; 
    2323    std::list<MPI_Comm> CServer::contextInterComms; 
    24     int CServer::nbSndSrvPools = (CXios::serverLevel == 0) ? 0 : 1; 
    25     int CServer::poolNb = 0; 
     24    int CServer::serverLevel = 0 ; 
     25    int CServer::nbPools = 0; 
     26    int CServer::poolId = 0; 
     27    int CServer::serverSize = 0; 
    2628    bool CServer::isRoot = false ; 
    2729    int CServer::rank = INVALID_RANK; 
    28     int CServer::rankSndServers = 0; 
    2930    StdOFStream CServer::m_infoStream; 
    3031    StdOFStream CServer::m_errorStream; 
     
    3738/*! 
    3839 * \fn void CServer::initialize(void) 
    39  * Function creates intra and inter comm for each initialized server pool 
     40 * Creates intraComm and interComm for a server pool (primary or secondary). 
    4041 */ 
    4142    void CServer::initialize(void) 
     
    4647      else is_MPI_Initialized=false ; 
    4748 
    48  
    4949      // Not using OASIS 
    5050      if (!CXios::usingOasis) 
     
    5858 
    5959        boost::hash<string> hashString ; 
    60         unsigned long hashServer1 = hashString(CXios::xiosCodeIdPrm); 
    61         unsigned long hashServer2 = hashString(CXios::xiosCodeIdSnd); 
    62         unsigned long hashServer = (CXios::serverLevel < 2)  ? hashServer1 : hashServer2; 
     60//        unsigned long hashServer1 = hashString(CXios::xiosCodeIdPrm); 
     61//        unsigned long hashServer2 = hashString(CXios::xiosCodeIdSnd); 
     62//        unsigned long hashServer = (CXios::serverLevel < 2)  ? hashServer1 : hashServer2; 
     63        unsigned long hashServer = hashString(CXios::xiosCodeId); 
    6364 
    6465        unsigned long* hashAll ; 
    65         unsigned long* hashAllServers ; 
     66//        unsigned long* hashAllServers ; 
    6667 
    6768//        int rank ; 
     
    6970        int myColor ; 
    7071        int i,c ; 
    71         MPI_Comm newComm, serversInterComm; 
     72        MPI_Comm newComm, serversComm; 
    7273 
    7374        MPI_Comm_size(CXios::globalComm, &size) ; 
     
    7778        MPI_Allgather(&hashServer, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ; 
    7879 
    79         map<unsigned long, int> colors, colorsServers ; 
     80        map<unsigned long, int> colors ; 
    8081        map<unsigned long, int> leaders ; 
    8182        map<unsigned long, int>::iterator it ; 
    82 //        map<unsigned long, int> leadersServers ; 
    83         vector<int> leadersServers; 
    8483 
    8584        for(i=0,c=0;i<size;i++) 
     
    9392        } 
    9493 
    95         nbSndSrvPools = size - leaders[hashServer2];    // one proc per secondary-server pool 
    96  
    97         // Taking into account multiple pools on secondary server 
    98         if (nbSndSrvPools > 1) 
    99         { 
    100           if (CXios::serverLevel > 1) 
     94        // Setting the number of secondary pools 
     95        myColor = colors[hashServer]; 
     96        if (CXios::usingServer2) 
     97        { 
     98          int serverRank = rank - leaders[hashServer]; // server proc rank starting 0 
     99          serverSize = size - leaders[hashServer]; 
     100          nbPools = serverSize * CXios::ratioServer2 / 100; 
     101          if ( serverRank < (serverSize - nbPools) ) 
    101102          { 
    102             int nbProcs = size - leaders[hashServer2]; 
    103             int remain = nbProcs % nbSndSrvPools; 
    104             int procsPerPool = nbProcs / nbSndSrvPools; 
    105             rankSndServers = rank - leaders[hashServer2]; 
    106             StdString strTmp = CXios::xiosCodeIdSnd; 
    107  
    108             if (remain == 0) 
    109             { 
    110               poolNb = rankSndServers/procsPerPool; 
    111             } 
    112             else 
    113             { 
    114               if (rankSndServers <= (procsPerPool + 1) * remain) 
    115                 poolNb = rankSndServers/(procsPerPool+1); 
    116               else 
    117               { 
    118                 poolNb = remain + 1; 
    119                 rankSndServers -= (procsPerPool + 1) * remain; 
    120                 rankSndServers -= procsPerPool; 
    121                 poolNb += rankSndServers/procsPerPool; 
    122               } 
    123             } 
    124             strTmp += boost::lexical_cast<string>(poolNb+1);  // add 1 to avoid hashing zero 
    125             hashServer = hashString(strTmp); 
    126             hashServer2 = hashString(strTmp); 
     103            serverLevel = 1; 
     104          } 
     105          else 
     106          { 
     107            serverLevel = 2; 
     108            poolId = serverRank - serverSize + nbPools; 
     109            myColor = rank; 
    127110          } 
    128111        } 
    129112 
    130         if (nbSndSrvPools > 1) 
    131         { 
    132           myColor = size; 
    133           MPI_Comm_split(MPI_COMM_WORLD, myColor, rank, &serversInterComm) ; 
    134         } 
    135         else 
    136         { 
    137           myColor=colors[hashServer] ; 
    138           MPI_Comm_split(MPI_COMM_WORLD, myColor, rank, &intraComm) ; 
    139         } 
    140  
    141         if (nbSndSrvPools > 1) 
    142         { 
    143           int sizeServers; 
    144 //          int rankServers; 
    145 //          MPI_Comm_rank(serversInterComm, &rankServers) ; 
    146           MPI_Comm_size(serversInterComm, &sizeServers) ; 
    147           hashAllServers=new unsigned long[sizeServers] ; 
    148           MPI_Allgather(&hashServer, 1, MPI_LONG, hashAllServers, 1, MPI_LONG, serversInterComm) ; 
    149  
    150           for(i=0, c=0; i<sizeServers; i++) 
    151           { 
    152             if (colorsServers.find(hashAllServers[i])==colorsServers.end()) 
    153             { 
    154               colorsServers[hashAllServers[i]]=c ; 
    155 //              leadersServers[hashAllServers[i]]= leaders[hashServer1] + i ; 
    156               leadersServers.push_back( leaders[hashServer1] + i ); 
    157               c++ ; 
    158             } 
    159           } 
    160           myColor=colorsServers[hashServer] ; 
    161           MPI_Comm_split(serversInterComm, myColor, rank, &intraComm) ; 
    162         } 
    163  
    164  
    165         if (CXios::serverLevel == 0) 
     113        MPI_Comm_split(CXios::globalComm, myColor, rank, &intraComm) ; 
     114 
     115        if (serverLevel == 0) 
    166116        { 
    167117          int clientLeader; 
     
    183133          } 
    184134        } 
    185         else 
    186         { 
    187           if ((CXios::serverLevel == 1)) 
     135        else if (serverLevel == 1) 
     136        { 
     137          int clientLeader, srvPrmLeader, srvSndLeader; 
     138          for (it=leaders.begin();it!=leaders.end();it++) 
    188139          { 
    189             // Creating interComm with client (interCommLeft) 
    190             int clientLeader; 
    191             int srvSndLeader; 
    192             for(it=leaders.begin();it!=leaders.end();it++) 
     140            if (it->first != hashServer) 
    193141            { 
    194               if (it->first != hashServer2) 
    195               { 
    196                 if (it->first != hashServer1) 
    197                 { 
    198                   clientLeader=it->second ; 
    199                   int intraCommSize, intraCommRank ; 
    200                   MPI_Comm_size(intraComm, &intraCommSize) ; 
    201                   MPI_Comm_rank(intraComm, &intraCommRank) ; 
    202                   info(50)<<"intercommCreate::server "<<rank<<" intraCommSize : "<<intraCommSize 
    203                            <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ; 
    204                   MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 
    205                   interCommLeft.push_back(newComm) ; 
    206                   interComm.push_back(newComm) ; 
    207                 } 
    208               } 
    209               else 
    210               { 
    211                 srvSndLeader = it->second; 
    212               } 
    213             } 
    214  
    215             // Creating interComm with secondary server pool(s) (interCommRight) 
    216 //            if (nbSndSrvPools < 1) 
    217             if (nbSndSrvPools < 2) 
    218             { 
    219               CClient::initializeClientOnServer(rank, intraComm, srvSndLeader); 
    220               interCommRight.push_back(CClient::getInterComm()); 
    221               interComm.push_back(CClient::getInterComm()); 
     142              clientLeader=it->second ; 
     143              int intraCommSize, intraCommRank ; 
     144              MPI_Comm_size(intraComm, &intraCommSize) ; 
     145              MPI_Comm_rank(intraComm, &intraCommRank) ; 
     146              info(50)<<"intercommCreate::server "<<rank<<" intraCommSize : "<<intraCommSize 
     147                       <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ; 
     148              MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 
     149              interCommLeft.push_back(newComm) ; 
     150              interComm.push_back(newComm) ; 
    222151            } 
    223152            else 
    224             { 
    225 //              for(it=leadersServers.begin();it!=leadersServers.end();it++) 
    226 //              { 
    227 //                if (it->first != hashServer) 
    228 //                { 
    229 //                  srvSndLeader = it->second; 
    230 //                  CClient::initializeClientOnServer(rank, intraComm, srvSndLeader); 
    231 //                  interCommRight.push_back(CClient::getInterComm()); 
    232 //                  interComm.push_back(CClient::getInterComm()); 
    233 //                } 
    234 //              } 
    235  
    236               for(int i = 1; i < leadersServers.size(); ++i) 
    237               { 
    238                 srvSndLeader = leadersServers[i]; 
    239                 CClient::initializeClientOnServer(rank, intraComm, srvSndLeader); 
    240                 interCommRight.push_back(CClient::getInterComm()); 
    241                 interComm.push_back(CClient::getInterComm()); 
    242               } 
    243             } 
    244           } // primary server 
    245  
    246           else // secondary server pool(s) 
     153              srvPrmLeader = it->second; 
     154          } 
     155 
     156          for (int i = 0; i < nbPools; ++i) 
    247157          { 
    248             int clientLeader; 
    249             if (nbSndSrvPools < 2) 
    250 //            if (nbSndSrvPools < 1) 
    251             { 
    252               for(it=leaders.begin();it!=leaders.end();it++) 
    253               { 
    254                 if (it->first == hashServer1) 
    255                 { 
    256                   clientLeader=it->second ; 
    257                   int intraCommSize, intraCommRank ; 
    258                   MPI_Comm_size(intraComm, &intraCommSize) ; 
    259                   MPI_Comm_rank(intraComm, &intraCommRank) ; 
    260                   info(50)<<"intercommCreate::server "<<rank<<" intraCommSize : "<<intraCommSize 
    261                            <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ; 
    262  
    263                   MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 
    264                   interCommLeft.push_back(newComm) ; 
    265                   interComm.push_back(newComm) ; 
    266  
    267                   break; 
    268                 } 
    269               } 
    270             } 
    271             else 
    272             { 
    273 //              for(it=leadersServers.begin();it!=leadersServers.end();it++) 
    274               { 
    275  //               if (it->first == hashServer1) 
    276                 { 
    277 //                  clientLeader=it->second ; 
    278                   clientLeader = leadersServers[0]; 
    279                   int intraCommSize, intraCommRank ; 
    280                   MPI_Comm_size(intraComm, &intraCommSize) ; 
    281                   MPI_Comm_rank(intraComm, &intraCommRank) ; 
    282                   info(50)<<"intercommCreate::server "<<rank<<" intraCommSize : "<<intraCommSize 
    283                            <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ; 
    284  
    285                   MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 
    286                   interCommLeft.push_back(newComm) ; 
    287                   interComm.push_back(newComm) ; 
    288                 } 
    289               } 
    290             } 
    291           } // secondary server 
    292         } // CXios::serverLevel != 0 
    293  
    294         if (nbSndSrvPools > 1) delete [] hashAllServers; 
     158            srvSndLeader = srvPrmLeader + serverSize - nbPools + i; 
     159//            CClient::initializeClientOnServer(rank, serversComm, srvSndLeader); 
     160            CClient::initializeClientOnServer(rank, intraComm, srvSndLeader); 
     161            interCommRight.push_back(CClient::getInterComm()); 
     162            interComm.push_back(CClient::getInterComm()); 
     163          } 
     164        } // primary server 
     165        else 
     166        { 
     167          int clientLeader; 
     168          clientLeader = leaders[hashString(CXios::xiosCodeId)]; 
     169          int intraCommSize, intraCommRank ; 
     170          MPI_Comm_size(intraComm, &intraCommSize) ; 
     171          MPI_Comm_rank(intraComm, &intraCommRank) ; 
     172          info(50)<<"intercommCreate::server "<<rank<<" intraCommSize : "<<intraCommSize 
     173                   <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ; 
     174 
     175          MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 
     176          interCommLeft.push_back(newComm) ; 
     177          interComm.push_back(newComm) ; 
     178        } // secondary server 
     179 
    295180        delete [] hashAll ; 
    296181 
     
    416301             { 
    417302               MPI_Send(&msg,1,MPI_INT,0,0,*itr) ; 
    418  
    419303//               MPI_Comm_free(&(*itr)); 
    420304//               interCommRight.erase(itr) ; 
     
    612496       contextInterComms.push_back(contextInterComm); 
    613497 
    614        if (CXios::serverLevel == 1) 
     498       if (serverLevel == 1) 
    615499       { 
    616500//         CClient::registerContext(contextId, intraComm); 
    617          CClient::registerContextOnSrvPools(contextId, intraComm); 
     501         CClient::registerContextByClienOfServer(contextId, intraComm); 
    618502       } 
    619503 
     
    657541      int numDigit = 0; 
    658542      int size = 0; 
    659       int mpiRank; 
     543      int id; 
    660544      MPI_Comm_size(CXios::globalComm, &size); 
    661545      while (size) 
     
    665549      } 
    666550 
    667       if (nbSndSrvPools < 2) 
    668         mpiRank = getRank(); 
     551      if (!CXios::usingServer2) 
     552        id = getRank(); 
    669553      else 
    670         mpiRank = rankSndServers; 
    671       fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << mpiRank << ext; 
     554      { 
     555        if (serverLevel == 1) 
     556          id = getRank(); 
     557        else 
     558          id = poolId; 
     559      } 
     560      fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << id << ext; 
    672561      fb->open(fileNameClient.str().c_str(), std::ios::out); 
    673562      if (!fb->is_open()) 
  • XIOS/dev/dev_olga/src/server.hpp

    r1009 r1021  
    3333        static CEventScheduler* eventScheduler; 
    3434 
    35         static int nbSndSrvPools;   // number of secondary server pools 
    36         static int poolNb;          // for secondary servers; stores the pool number 
     35        static int serverLevel ; 
     36 
     37//        static int nbSndSrvPools;   // number of secondary server pools 
     38//        static int poolNb;          // for secondary servers; stores the pool number 
    3739 
    3840        struct contextMessage 
     
    6870      private: 
    6971        static int rank; 
    70         static int rankSndServers; 
     72        static int serverSize;  //!< Number of procs dedicated to server 
     73        static int nbPools;     //!< Number of secondary-server pools 
     74        static int poolId;      //!< ID of a secondary-server pool 
    7175        static StdOFStream m_infoStream; 
    7276        static StdOFStream m_errorStream; 
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.cpp

    r978 r1021  
    4848 
    4949CDomainAlgorithmInterpolate::CDomainAlgorithmInterpolate(CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain) 
    50 : CDomainAlgorithmTransformation(domainDestination, domainSource), interpDomain_(interpDomain) 
    51 { 
     50: CDomainAlgorithmTransformation(domainDestination, domainSource), interpDomain_(interpDomain), writeToFile_(false), readFromFile_(false) 
     51{ 
     52  CContext* context = CContext::getCurrent(); 
    5253  interpDomain_->checkValid(domainSource); 
     54  fileToReadWrite_ = "xios_interpolation_weights_"; 
     55 
     56  if (interpDomain_->weight_filename.isEmpty()) 
     57  { 
     58    fileToReadWrite_ += context->getId() + "_" +  
     59                    domainSource->getDomainOutputName() + "_" +  
     60                    domainDestination->getDomainOutputName() + ".nc";     
     61  } 
     62  else  
     63    fileToReadWrite_ = interpDomain_->weight_filename; 
     64 
     65  ifstream f(fileToReadWrite_.c_str());   
     66  switch (interpDomain_->mode) 
     67  { 
     68    case CInterpolateDomain::mode_attr::read: 
     69      readFromFile_ = true;       
     70      break; 
     71    case CInterpolateDomain::mode_attr::compute: 
     72      readFromFile_ = false; 
     73      break; 
     74    case CInterpolateDomain::mode_attr::read_or_compute:       
     75      if (!f.good()) 
     76        readFromFile_ = false; 
     77      else 
     78        readFromFile_ = true; 
     79      break; 
     80    default: 
     81      break; 
     82  }  
     83 
     84  writeToFile_ = interpDomain_->write_weight;   
     85     
    5386} 
    5487 
     
    351384  } 
    352385 
     386  if (writeToFile_ && !readFromFile_) 
     387     writeRemapInfo(interpMapValue); 
    353388  exchangeRemapInfo(interpMapValue); 
    354389 
     
    434469void CDomainAlgorithmInterpolate::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    435470{ 
    436   if (!interpDomain_->file.isEmpty()) 
     471  if (readFromFile_ && !writeToFile_)   
    437472    readRemapInfo(); 
    438473  else 
    439     computeRemap(); 
     474  { 
     475    computeRemap();  
     476  } 
     477} 
     478 
     479void CDomainAlgorithmInterpolate::writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
     480 
     481  writeInterpolationInfo(fileToReadWrite_, interpMapValue); 
    440482} 
    441483 
    442484void CDomainAlgorithmInterpolate::readRemapInfo() 
    443 { 
    444   CContext* context = CContext::getCurrent(); 
    445   CContextClient* client=context->client; 
    446   int clientRank = client->clientRank; 
    447  
    448   std::string filename = interpDomain_->file.getValue(); 
     485 
    449486  std::map<int,std::vector<std::pair<int,double> > > interpMapValue; 
    450   readInterpolationInfo(filename, interpMapValue); 
     487  readInterpolationInfo(fileToReadWrite_, interpMapValue); 
    451488 
    452489  exchangeRemapInfo(interpMapValue); 
     
    637674  delete [] recvBuff; 
    638675} 
     676  
     677/*! Redefined some functions of CONetCDF4 to make use of them */ 
     678CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, const MPI_Comm comm) 
     679  : CNc4DataOutput(filename, false, false, true, comm, false, true) {} 
     680int CDomainAlgorithmInterpolate::WriteNetCdf::addDimensionWrite(const StdString& name,  
     681                                                                const StdSize size) 
     682{ 
     683  CONetCDF4::addDimension(name, size);   
     684} 
     685 
     686int CDomainAlgorithmInterpolate::WriteNetCdf::addVariableWrite(const StdString& name, nc_type type, 
     687                                                               const std::vector<StdString>& dim) 
     688{ 
     689  CONetCDF4::addVariable(name, type, dim); 
     690} 
     691 
     692void CDomainAlgorithmInterpolate::WriteNetCdf::writeDataIndex(const CArray<int,1>& data, const StdString& name, 
     693                                                              bool collective, StdSize record, 
     694                                                              const std::vector<StdSize>* start, 
     695                                                              const std::vector<StdSize>* count) 
     696{ 
     697  CONetCDF4::writeData<int,1>(data, name, collective, record, start, count); 
     698} 
     699 
     700void CDomainAlgorithmInterpolate::WriteNetCdf::writeDataIndex(const CArray<double,1>& data, const StdString& name, 
     701                                                              bool collective, StdSize record, 
     702                                                              const std::vector<StdSize>* start, 
     703                                                              const std::vector<StdSize>* count) 
     704{ 
     705  CONetCDF4::writeData<double,1>(data, name, collective, record, start, count); 
     706} 
     707 
     708/* 
     709   Write interpolation weights into a file 
     710   \param [in] filename name of output file 
     711   \param interpMapValue mapping of global index of domain destination and domain source as well as the corresponding weight 
     712*/ 
     713void CDomainAlgorithmInterpolate::writeInterpolationInfo(std::string& filename, 
     714                                                         std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
     715{ 
     716  CContext* context = CContext::getCurrent(); 
     717  CContextClient* client=context->client; 
     718 
     719  size_t n_src = domainSrc_->ni_glo * domainSrc_->nj_glo; 
     720  size_t n_dst = domainDest_->ni_glo * domainDest_->nj_glo; 
     721 
     722  long localNbWeight = 0; 
     723  long globalNbWeight; 
     724  long startIndex; 
     725  typedef std::map<int,std::vector<std::pair<int,double> > > IndexRemap; 
     726  IndexRemap::iterator itb = interpMapValue.begin(), it, 
     727                       ite = interpMapValue.end(); 
     728  for (it = itb; it!=ite; ++it) 
     729  { 
     730    localNbWeight += (it->second).size(); 
     731  } 
     732 
     733  CArray<int,1> src_idx(localNbWeight); 
     734  CArray<int,1> dst_idx(localNbWeight); 
     735  CArray<double,1> weights(localNbWeight); 
     736 
     737  int index = 0; 
     738  for (it = itb; it !=ite; ++it) 
     739  { 
     740    std::vector<std::pair<int,double> >& tmp = it->second; 
     741    for (int idx = 0; idx < tmp.size(); ++idx) 
     742    { 
     743      dst_idx(index) = it->first + 1; 
     744      src_idx(index) = tmp[idx].first + 1; 
     745      weights(index) = tmp[idx].second; 
     746      ++index; 
     747    }     
     748  } 
     749 
     750  MPI_Allreduce(&localNbWeight, &globalNbWeight, 1, MPI_LONG, MPI_SUM, client->intraComm); 
     751  MPI_Scan(&localNbWeight, &startIndex, 1, MPI_LONG, MPI_SUM, client->intraComm); 
     752   
     753  std::vector<StdSize> start(1, startIndex - localNbWeight); 
     754  std::vector<StdSize> count(1, localNbWeight); 
     755 
     756  WriteNetCdf netCdfWriter(filename, client->intraComm); 
     757 
     758  // netCdfWriter = CONetCDF4(filename, false, false, true, client->intraComm, false); 
     759 
     760  // Define some dimensions 
     761  netCdfWriter.addDimensionWrite("n_src", n_src); 
     762  netCdfWriter.addDimensionWrite("n_dst", n_dst); 
     763  netCdfWriter.addDimensionWrite("n_weight", globalNbWeight); 
     764   
     765  std::vector<StdString> dims(1,"n_weight"); 
     766 
     767  // Add some variables 
     768  netCdfWriter.addVariableWrite("src_idx", NC_INT, dims); 
     769  netCdfWriter.addVariableWrite("dst_idx", NC_INT, dims); 
     770  netCdfWriter.addVariableWrite("weight", NC_DOUBLE, dims); 
     771 
     772  // // Write variables 
     773  netCdfWriter.writeDataIndex(src_idx, "src_idx", true, 0, &start, &count); 
     774  netCdfWriter.writeDataIndex(dst_idx, "dst_idx", true, 0, &start, &count); 
     775  netCdfWriter.writeDataIndex(weights, "weight", true, 0, &start, &count); 
     776 
     777  netCdfWriter.closeFile(); 
     778} 
    639779 
    640780/*! 
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.hpp

    r933 r1021  
    1212#include "domain_algorithm_transformation.hpp" 
    1313#include "transformation.hpp" 
     14#include "nc4_data_output.hpp" 
    1415 
    1516namespace xios { 
     
    1718class CDomain; 
    1819class CInterpolateDomain; 
     20 
    1921 
    2022/*! 
     
    3537private: 
    3638  void readInterpolationInfo(std::string& filename, std::map<int,std::vector<std::pair<int,double> > >& interpMapValue); 
     39  void writeInterpolationInfo(std::string& filename, std::map<int,std::vector<std::pair<int,double> > >& interpMapValue); 
    3740  void processPole(std::map<int,std::vector<std::pair<int,double> > >& interMapValuePole, 
    3841                   int nbGlobalPointOnPole); 
    3942  void computeRemap(); 
    4043  void readRemapInfo(); 
     44  void writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >&); 
    4145  void exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue); 
     46 
    4247private: 
    4348  CInterpolateDomain* interpDomain_; 
     49  bool writeToFile_; 
     50  bool readFromFile_; 
     51  StdString fileToReadWrite_; 
     52 
     53  // class WriteNetCdf; 
     54  class WriteNetCdf : public CNc4DataOutput 
     55  { 
     56  public: 
     57    WriteNetCdf(const StdString& filename, const MPI_Comm comm); 
     58    int addDimensionWrite(const StdString& name, const StdSize size = UNLIMITED_DIM); 
     59    int addVariableWrite(const StdString& name, nc_type type, 
     60                         const std::vector<StdString>& dim); 
     61    void writeDataIndex(const CArray<int,1>& data, const StdString& name, 
     62                        bool collective, StdSize record, 
     63                        const std::vector<StdSize>* start = NULL, 
     64                        const std::vector<StdSize>* count = NULL); 
     65    void writeDataIndex(const CArray<double,1>& data, const StdString& name, 
     66                        bool collective, StdSize record, 
     67                        const std::vector<StdSize>* start = NULL, 
     68                        const std::vector<StdSize>* count = NULL); 
     69  }; 
     70 
    4471 
    4572private: 
Note: See TracChangeset for help on using the changeset viewer.