Changeset 1021
- Timestamp:
- 01/10/17 14:36:29 (6 years ago)
- Location:
- XIOS/dev/dev_olga
- Files:
-
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/bld.cfg
r1009 r1021 35 35 bld::target xios_server.exe 36 36 bld::target xios_server1.exe xios_server2.exe 37 bld::target test_regular.exe37 #bld::target test_regular.exe 38 38 #bld::target test_new_features.exe test_unstruct_complete.exe 39 39 #bld::target test_client.exe test_complete.exe -
XIOS/dev/dev_olga/src/client.cpp
r1009 r1021 57 57 58 58 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); 60 61 unsigned long* hashAll ; 61 62 int size ; … … 88 89 for (i=0; i < size; ++i) 89 90 { 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))) 93 94 { 94 95 CXios::setUsingServer(); … … 103 104 { 104 105 int clientLeader=leaders[hashClient] ; 105 // serverLeader=leaders[hashServer] ;106 106 serverLeader.push_back(leaders[hashServer]) ; 107 107 int intraCommSize, intraCommRank ; … … 111 111 <<" intraCommRank :"<<intraCommRank<<" clientLeader "<< serverLeader.back()<<endl ; 112 112 MPI_Intercomm_create(intraComm, 0, CXios::globalComm, serverLeader.back(), 0, &interComm) ; 113 // info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize114 // <<" intraCommRank :"<<intraCommRank<<" clientLeader "<< serverLeader<<endl ;115 // MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ;116 113 } 117 114 else … … 181 178 /*! 182 179 * \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. 184 181 * \param [in] id id of context. 185 182 * \param [in] contextComm. 183 * Function is only called by client. 186 184 */ 187 185 void CClient::registerContext(const string& id, MPI_Comm contextComm) … … 250 248 } 251 249 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) 260 260 { 261 261 CContext::setCurrent(id) ; -
XIOS/dev/dev_olga/src/client.hpp
r1009 r1021 15 15 static void finalize(void); 16 16 static void registerContext(const string& id, MPI_Comm contextComm); 17 static void registerContext OnSrvPools(const string& id, MPI_Comm contextComm);17 static void registerContextByClienOfServer(const string& id, MPI_Comm contextComm); 18 18 19 19 static MPI_Comm intraComm; -
XIOS/dev/dev_olga/src/config/field_attribute.conf
r887 r1021 11 11 DECLARE_ATTRIBUTE(int, level) 12 12 DECLARE_ATTRIBUTE(int, prec) 13 DECLARE_ATTRIBUTE(StdString, expr) 13 14 14 15 DECLARE_ATTRIBUTE(bool, enabled) … … 33 34 DECLARE_ATTRIBUTE(bool, ts_enabled) 34 35 DECLARE_ATTRIBUTE(CDuration, ts_split_freq) 36 37 DECLARE_ATTRIBUTE(StdString, cell_methods) 38 DECLARE_ENUM4(cell_methods_mode, overwrite, prefix, suffix, none) -
XIOS/dev/dev_olga/src/config/interpolate_domain_attribute.conf
r846 r1021 3 3 DECLARE_ATTRIBUTE(int, order) 4 4 DECLARE_ATTRIBUTE(bool, renormalize) 5 6 /* Write interpolation weights into file */ 7 DECLARE_ENUM3(mode,compute,read,read_or_compute) 8 DECLARE_ATTRIBUTE(StdString, weight_filename) 9 DECLARE_ATTRIBUTE(bool, write_weight) -
XIOS/dev/dev_olga/src/context_client.cpp
r983 r1021 50 50 for (int i = 0; i < serverByClient; i++) 51 51 ranksServerLeader.push_back(rankStart + i); 52 } 52 53 ranksServerNotLeader.resize(0); } 53 54 else 54 55 { … … 60 61 if (clientRank % (clientByServer + 1) == 0) 61 62 ranksServerLeader.push_back(clientRank / (clientByServer + 1)); 63 else 64 ranksServerNotLeader.push_back(clientRank / (clientByServer + 1)); 62 65 } 63 66 else … … 66 69 if (rank % clientByServer == 0) 67 70 ranksServerLeader.push_back(remain + rank / clientByServer); 71 else 72 ranksServerNotLeader.push_back(remain + rank / clientByServer); 68 73 } 69 74 } … … 244 249 + 1; // the other local buffer might contain only one event 245 250 } 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 } 246 269 247 270 /*! -
XIOS/dev/dev_olga/src/context_client.hpp
r917 r1021 41 41 42 42 bool isServerLeader(void) const; 43 bool isServerNotLeader(void) const; 43 44 const std::list<int>& getRanksServerLeader(void) const; 45 const std::list<int>& getRanksServerNotLeader(void) const; 44 46 45 47 bool isAttachedModeEnabled() const; … … 80 82 std::list<int> ranksServerLeader; 81 83 84 //! List of server ranks for which the client is not leader 85 std::list<int> ranksServerNotLeader; 86 82 87 public: // Some function should be removed in the future 83 88 // void registerEvent(CEventClient& event); -
XIOS/dev/dev_olga/src/context_server.cpp
r1009 r1021 44 44 } 45 45 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 // } 67 67 void CContextServer::setPendingEvent(void) 68 68 { -
XIOS/dev/dev_olga/src/cxios.cpp
r983 r1021 16 16 string CXios::rootFile="./iodef.xml" ; 17 17 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" ; 20 20 string CXios::clientFile="./xios_client"; 21 21 string CXios::serverFile="./xios_server"; 22 string CXios::serverPr imFile="./xios_server1";23 string CXios::serverS cndFile="./xios_server2";22 string CXios::serverPrmFile="./xios_server1"; 23 string CXios::serverSndFile="./xios_server2"; 24 24 25 25 bool CXios::isClient ; 26 26 bool CXios::isServer ; 27 int CXios::serverLevel = 0 ;27 // int CXios::serverLevel = 0 ; 28 28 MPI_Comm CXios::globalComm ; 29 29 bool CXios::usingOasis ; 30 30 bool CXios::usingServer = false; 31 bool CXios::usingServer2 = false; 32 int CXios::ratioServer2 = 50; 31 33 double CXios::bufferSizeFactor = 1.0; 32 34 const double CXios::defaultBufferSizeFactor = 1.0; … … 52 54 usingOasis=getin<bool>("using_oasis",false) ; 53 55 usingServer=getin<bool>("using_server",false) ; 56 usingServer2=getin<bool>("using_server2",false) ; 57 ratioServer2=getin<int>("ratio_server2",50); 54 58 info.setLevel(getin<int>("info_level",0)) ; 55 59 report.setLevel(getin<int>("info_level",50)); … … 135 139 { 136 140 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) 138 156 isClient = true; 139 157 else 140 158 isClient = false; 141 159 142 isServer = true;143 serverLevel = serverLvl;144 145 // Initialize all aspects MPI146 CServer::initialize();147 160 if (CServer::getRank()==0) globalRegistry = new CRegistry(CServer::intraComm) ; 148 161 149 162 if (printLogs2Files) 150 163 { 151 if (CXios::serverLevel == 0) 164 if (CServer::serverLevel == 0) 165 // if (CXios::serverLevel == 0) 152 166 { 153 167 CServer::openInfoStream(serverFile); 154 168 CServer::openErrorStream(serverFile); 155 169 } 156 else if (CXios::serverLevel == 1) 170 else if (CServer::serverLevel == 1) 171 // else if (CXios::serverLevel == 1) 157 172 { 158 CServer::openInfoStream(serverPr imFile);159 CServer::openErrorStream(serverPr imFile);173 CServer::openInfoStream(serverPrmFile); 174 CServer::openErrorStream(serverPrmFile); 160 175 } 161 176 else 162 177 { 163 CServer::openInfoStream(serverS cndFile);164 CServer::openErrorStream(serverS cndFile);178 CServer::openInfoStream(serverSndFile); 179 CServer::openErrorStream(serverSndFile); 165 180 } 166 181 } … … 197 212 } 198 213 199 //! Set using secondary server200 // void CXios::setUsingSecondaryServer()201 // {202 // usingSecondaryServer = true;203 // }204 205 214 //! Unset using server 206 215 void CXios::setNotUsingServer() -
XIOS/dev/dev_olga/src/cxios.hpp
r992 r1021 29 29 static string rootFile ; //!< Configuration filename 30 30 static string xiosCodeId ; //!< Identity for XIOS 31 static string xiosCodeIdPrm ; //!< Identity for XIOS primary server32 static string xiosCodeIdSnd ; //!< Identity for XIOS secondary server31 // static string xiosCodeIdPrm ; //!< Identity for XIOS primary server 32 // static string xiosCodeIdSnd ; //!< Identity for XIOS secondary server 33 33 static string clientFile; //!< Filename template for client 34 34 static string serverFile; //!< Filename template for server 35 static string serverPr imFile; //!< Filename template for primary server in case of two server groups36 static string serverS cndFile; //!< Filename template for secondary server in case of two server groups35 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 37 37 38 38 static bool isClient ; //!< Check if xios is client 39 39 static bool isServer ; //!< Check if xios is server 40 40 41 static int serverLevel ; // 41 // static int serverLevel ; 42 42 43 43 static MPI_Comm globalComm ; //!< Global communicator … … 46 46 static bool usingOasis ; //!< Using Oasis 47 47 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 48 50 static double bufferSizeFactor; //!< Factor used to tune the buffer size 49 51 static const double defaultBufferSizeFactor; //!< Default factor value … … 55 57 //! Setting xios to use server mode 56 58 static void setUsingServer(); 57 58 //! Setting xios to use secondary server mode59 // static void setUsingSecondaryServer();60 59 61 60 //! Setting xios NOT to use server mode -
XIOS/dev/dev_olga/src/distribution_client.cpp
r992 r1021 24 24 , elementZoomMask_(), elementNLocal_(), elementNGlobal_() 25 25 { 26 // numElement_ = globalLocalIndex.size(); !!! numElement_ should be calculated (?)27 26 isComputed_ = true; 28 27 localDataIndex_.resize(globalLocalIndex.size()); -
XIOS/dev/dev_olga/src/filter/filter.cpp
r827 r1021 5 5 CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine) 6 6 : CInputPin(gc, inputSlotsCount) 7 , COutputPin( )7 , COutputPin(gc) 8 8 , engine(engine) 9 9 , inputSlotCount(inputSlotCount) … … 14 14 CDataPacketPtr outputPacket = engine->apply(data); 15 15 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()); 17 41 } 18 42 } // namespace xios -
XIOS/dev/dev_olga/src/filter/filter.hpp
r827 r1021 26 26 CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 27 27 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 28 50 protected: 29 51 IFilterEngine* engine; //!< The filter engine, might be the filter itself -
XIOS/dev/dev_olga/src/filter/garbage_collector.cpp
r639 r1021 3 3 namespace xios 4 4 { 5 void CGarbageCollector::register Filter(CInputPin* inputPin, Time timestamp)5 void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) 6 6 { 7 registered Filters[timestamp].insert(inputPin);7 registeredObjects[timestamp].insert(Object); 8 8 } 9 9 10 void CGarbageCollector::unregister Filter(CInputPin* inputPin, Time timestamp)10 void CGarbageCollector::unregisterObject(InvalidableObject* Object, Time timestamp) 11 11 { 12 std::map<Time, std::set< CInputPin*> >::iterator it = registeredFilters.find(timestamp);13 if (it != registered Filters.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); 15 15 } 16 16 17 17 void CGarbageCollector::invalidate(Time timestamp) 18 18 { 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); 21 21 for (; it != itEnd; ++it) 22 22 { 23 std::set< CInputPin*>::iterator itFilter= it->second.begin(),24 itFilterEnd = it->second.end();25 for (; it Filter != itFilterEnd; ++itFilter)26 (*it Filter)->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); 27 27 } 28 registered Filters.erase(registeredFilters.begin(), itEnd);28 registeredObjects.erase(registeredObjects.begin(), itEnd); 29 29 } 30 30 } // namespace xios -
XIOS/dev/dev_olga/src/filter/garbage_collector.hpp
r639 r1021 5 5 #include <set> 6 6 7 #include " input_pin.hpp"7 #include "date.hpp" 8 8 9 9 namespace xios 10 10 { 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 11 24 /*! 12 25 * A basic garbage collector which ensures no old packets linger in the filter graph. … … 22 35 23 36 /*! 24 * Registers a filterfor a specified timestamp.37 * Registers an object for a specified timestamp. 25 38 * 26 * \param inputPin the input pin of the filterto register27 * \param timestamp the timestamp for which the filteris registered39 * \param object the object to register 40 * \param timestamp the timestamp for which the object is registered 28 41 */ 29 void register Filter(CInputPin* inputPin, Time timestamp);42 void registerObject(InvalidableObject* object, Time timestamp); 30 43 31 44 /*! 32 * Removes a filterpreviously registered for a specified timestamp.45 * Removes a object previously registered for a specified timestamp. 33 46 * 34 * \param inputPin the input pin of the filterto unregister35 * \param timestamp the timestamp for which the filteris unregistered47 * \param object the object to unregister 48 * \param timestamp the timestamp for which the object is unregistered 36 49 */ 37 void unregister Filter(CInputPin* inputPin, Time timestamp);50 void unregisterObject(InvalidableObject* object, Time timestamp); 38 51 39 52 /*! 40 * Ensures all registered filters invalidate packets older than the specified timestamp.53 * Ensures all registered objects invalidate packets older than the specified timestamp. 41 54 * 42 55 * \param timestamp the timestamp used for invalidation … … 48 61 CGarbageCollector& operator=(const CGarbageCollector&); 49 62 50 std::map<Time, std::set< CInputPin*> > registeredFilters; //!< Currently registered filters63 std::map<Time, std::set<InvalidableObject*> > registeredObjects; //!< Currently registered objects 51 64 }; // class CGarbageCollector 52 65 } // namespace xios -
XIOS/dev/dev_olga/src/filter/input_pin.cpp
r639 r1021 1 1 #include "input_pin.hpp" 2 #include "output_pin.hpp" 2 3 #include "garbage_collector.hpp" 3 4 #include "exception.hpp" … … 8 9 : gc(gc) 9 10 , slotsCount(slotsCount) 11 , triggers(slotsCount) 12 , hasTriggers(false) 10 13 { /* Nothing to do */ } 11 14 … … 23 26 { 24 27 it = inputs.insert(std::make_pair(packet->timestamp, InputBuffer(slotsCount))).first; 25 gc.register Filter(this, packet->timestamp);28 gc.registerObject(this, packet->timestamp); 26 29 } 27 30 it->second.slotsFilled++; … … 31 34 { 32 35 // Unregister before calling onInputReady in case the filter registers again 33 gc.unregister Filter(this, packet->timestamp);36 gc.unregisterObject(this, packet->timestamp); 34 37 onInputReady(it->second.packets); 35 38 inputs.erase(it); 36 39 } 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; 37 73 } 38 74 -
XIOS/dev/dev_olga/src/filter/input_pin.hpp
r639 r1021 5 5 #include <map> 6 6 7 #include "garbage_collector.hpp" 7 8 #include "data_packet.hpp" 8 9 9 10 namespace xios 10 11 { 11 class C GarbageCollector;12 class COutputPin; 12 13 13 14 /*! 14 15 * An input pin handles the data packets received by a filter. 15 16 */ 16 class CInputPin 17 class CInputPin : public InvalidableObject 17 18 { 18 19 public: … … 27 28 28 29 /*! 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 /*! 29 38 * Receives a data packet from an upstream filter on 30 39 * the specified input slot. … … 37 46 38 47 /*! 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 /*! 39 62 * Removes all pending packets which are older than the specified timestamp. 40 63 * … … 44 67 45 68 protected: 46 CGarbageCollector& gc; //!< The garbage collector associated to the input pin47 48 69 /*! 49 70 * Function triggered when all slots have been filled for a specific timestamp. … … 75 96 }; 76 97 98 CGarbageCollector& gc; //!< The garbage collector associated to the input pin 99 77 100 size_t slotsCount; //!< The number of slots 78 101 79 102 //! Input buffer, store the packets until all slots are full for a timestep 80 103 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; 81 110 }; // class CInputPin 82 111 } // namespace xios -
XIOS/dev/dev_olga/src/filter/output_pin.cpp
r637 r1021 4 4 namespace xios 5 5 { 6 COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/) 7 : gc(gc) 8 , manualTrigger(manualTrigger) 9 { /* Nothing to do */ } 10 6 11 void COutputPin::connectOutput(boost::shared_ptr<CInputPin> inputPin, size_t inputSlot) 7 12 { … … 11 16 12 17 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); 13 36 } 14 37 … … 23 46 it->first->setInput(it->second, packet); 24 47 } 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 } 25 79 } // namespace xios -
XIOS/dev/dev_olga/src/filter/output_pin.hpp
r637 r1021 2 2 #define __XIOS_COutputPin__ 3 3 4 #include "garbage_collector.hpp" 4 5 #include "input_pin.hpp" 5 6 … … 9 10 * An output pin handles the connections with downstream filters. 10 11 */ 11 class COutputPin 12 class COutputPin : public InvalidableObject 12 13 { 13 14 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 14 24 /*! 15 25 * Connects to a specific slot of the input pin of a downstream filter. … … 21 31 void connectOutput(boost::shared_ptr<CInputPin> inputPin, size_t inputSlot); 22 32 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 23 54 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: 24 68 /*! 25 69 * Delivers an output packet to the downstreams filter. … … 29 73 void deliverOuput(CDataPacketPtr packet); 30 74 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 32 80 //!< The list of connected filters and the corresponding slot numbers 33 81 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; 34 85 }; // class COutputPin 35 86 } // namespace xios -
XIOS/dev/dev_olga/src/filter/source_filter.cpp
r932 r1021 6 6 namespace xios 7 7 { 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) 10 12 , offset(offset) 11 13 { … … 28 30 grid->inputField(data, packet->data); 29 31 30 deliverOuput(packet);32 onOutputReady(packet); 31 33 } 32 34 … … 48 50 packet->status = CDataPacket::NO_ERROR; 49 51 50 if (data.size() != grid->storeIndex_toSrv.size()) 52 // if (data.size() != grid->storeIndex_toSrv.size()) 53 if (data.size() != grid->storeIndex_fromSrv.size()) 51 54 ERROR("CSourceFilter::streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data)", 52 55 << "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."); 54 57 55 58 packet->data.resize(grid->storeIndex_client.numElements()); … … 57 60 for (it = data.begin(); it != itEnd; it++) 58 61 { 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]; 61 64 for (int n = 0; n < index.numElements(); n++) 62 65 packet->data(index(n)) = it->second(n); 63 66 } 64 67 65 deliverOuput(packet);68 onOutputReady(packet); 66 69 } 67 70 … … 72 75 packet->timestamp = date; 73 76 packet->status = CDataPacket::END_OF_STREAM; 74 deliverOuput(packet);77 onOutputReady(packet); 75 78 } 76 79 } // namespace xios -
XIOS/dev/dev_olga/src/filter/source_filter.hpp
r756 r1021 19 19 * Constructs a source filter accepting data attached to the specified grid. 20 20 * 21 * \param gc the garbage collector associated with this filter 21 22 * \param grid the grid to which the data is attached 22 23 * \param offset the offset applied to the timestamp of all packets 24 * \param manualTrigger whether the output should be triggered manually 23 25 */ 24 CSourceFilter(CGrid* grid, const CDuration offset = NoneDu); 26 CSourceFilter(CGarbageCollector& gc, CGrid* grid, 27 const CDuration offset = NoneDu, bool manualTrigger = false); 25 28 26 29 /*! -
XIOS/dev/dev_olga/src/filter/spatial_transform_filter.cpp
r979 r1021 53 53 CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue); 54 54 if (outputPacket) 55 deliverOuput(outputPacket);55 onOutputReady(outputPacket); 56 56 } 57 57 … … 218 218 if (dataCurrentDest.numElements() != dataDest.numElements()) 219 219 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()); 223 223 224 224 dataDest = dataCurrentDest; -
XIOS/dev/dev_olga/src/filter/store_filter.cpp
r932 r1021 8 8 CStoreFilter::CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid) 9 9 : CInputPin(gc, 1) 10 , gc(gc) 10 11 , context(context) 11 12 , grid(grid) … … 23 24 CTimer timer("CStoreFilter::getPacket"); 24 25 CConstDataPacketPtr packet; 25 const double timeout = 10 ; // 10 seconds timeout26 const double timeout = 10 ; // 10 seconds timeout 26 27 27 28 do 28 29 { 30 if (canBeTriggered()) 31 trigger(timestamp); 32 29 33 timer.resume(); 30 34 … … 39 43 40 44 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 ; 41 50 ERROR("CConstDataPacketPtr CStoreFilter::getPacket(Time timestamp) const", 42 51 << "Impossible to get the packet with timestamp = " << timestamp); 43 52 } 44 53 return packet; 45 54 } … … 69 78 // The packet is always destroyed by the garbage collector 70 79 // so we register but never unregister 71 gc.register Filter(this, data[0]->timestamp);80 gc.registerObject(this, data[0]->timestamp); 72 81 } 73 82 -
XIOS/dev/dev_olga/src/filter/store_filter.hpp
r639 r1021 65 65 66 66 private: 67 CGarbageCollector& gc; //!< The garbage collector associated to the filter 67 68 CContext* context; //!< The context to which the data belongs 68 69 CGrid* grid; //!< The grid attached to the data the filter can accept -
XIOS/dev/dev_olga/src/group_template.hpp
r1009 r1021 6 6 #include "event_server.hpp" 7 7 #include "object_template.hpp" 8 #include "context_client.hpp" 8 9 9 10 namespace xios … … 72 73 static bool dispatchEvent(CEventServer& event) ; 73 74 void sendCreateChild(const string& id="") ; 74 void sendCreateChild(const string& id, const int srvPool) ;75 void sendCreateChild(const string& id, CContextClient* client) ; 75 76 void sendCreateChildGroup(const string& id="") ; 76 77 static void recvCreateChild(CEventServer& event) ; -
XIOS/dev/dev_olga/src/group_template_impl.hpp
r1009 r1021 8 8 #include "context.hpp" 9 9 #include "event_client.hpp" 10 #include "context_client.hpp"11 10 #include "message.hpp" 12 11 #include "type.hpp" … … 419 418 420 419 } 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 { 427 424 428 425 CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ; 429 if (c ontextClientTmp->isServerLeader())426 if (client->isServerLeader()) 430 427 { 431 428 CMessage msg ; 432 429 msg<<this->getId() ; 433 430 msg<<id ; 434 const std::list<int>& ranks = c ontextClientTmp->getRanksServerLeader();431 const std::list<int>& ranks = client->getRanksServerLeader(); 435 432 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 436 433 event.push(*itRank,1,msg) ; 437 c ontextClientTmp->sendEvent(event) ;434 client->sendEvent(event) ; 438 435 } 439 else contextClientTmp->sendEvent(event) ; 440 } 436 else client->sendEvent(event) ; 437 } 438 441 439 442 440 template <class U, class V, class W> … … 444 442 { 445 443 CContext* context=CContext::getCurrent() ; 446 447 // if (! context->hasServer )448 444 if (context->hasClient) 449 445 { 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 452 447 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 453 448 for (int i = 0; i < nbSrvPools; ++i) -
XIOS/dev/dev_olga/src/interface/c_attr/icfield_attr.cpp
r891 r1021 67 67 68 68 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 69 121 void cxios_set_field_compression_level(field_Ptr field_hdl, int compression_level) 70 122 { … … 180 232 CTimer::get("XIOS").resume(); 181 233 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(); 182 260 CTimer::get("XIOS").suspend(); 183 261 return isDefined; -
XIOS/dev/dev_olga/src/interface/c_attr/icfieldgroup_attr.cpp
r891 r1021 67 67 68 68 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 69 121 void cxios_set_fieldgroup_compression_level(fieldgroup_Ptr fieldgroup_hdl, int compression_level) 70 122 { … … 180 232 CTimer::get("XIOS").resume(); 181 233 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(); 182 260 CTimer::get("XIOS").suspend(); 183 261 return isDefined; -
XIOS/dev/dev_olga/src/interface/c_attr/icinterpolate_domain_attr.cpp
r891 r1021 39 39 CTimer::get("XIOS").resume(); 40 40 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(); 41 67 CTimer::get("XIOS").suspend(); 42 68 return isDefined; … … 88 114 return isDefined; 89 115 } 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 } 90 165 } -
XIOS/dev/dev_olga/src/interface/fortran_attr/field_interface_attr.F90
r891 r1021 50 50 51 51 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 52 94 SUBROUTINE cxios_set_field_compression_level(field_hdl, compression_level) BIND(C) 53 95 USE ISO_C_BINDING … … 147 189 148 190 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 149 212 SUBROUTINE cxios_set_field_field_ref(field_hdl, field_ref, field_ref_size) BIND(C) 150 213 USE ISO_C_BINDING -
XIOS/dev/dev_olga/src/interface/fortran_attr/fieldgroup_interface_attr.F90
r891 r1021 50 50 51 51 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 52 94 SUBROUTINE cxios_set_fieldgroup_compression_level(fieldgroup_hdl, compression_level) BIND(C) 53 95 USE ISO_C_BINDING … … 147 189 148 190 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 149 212 SUBROUTINE cxios_set_fieldgroup_field_ref(fieldgroup_hdl, field_ref, field_ref_size) BIND(C) 150 213 USE ISO_C_BINDING -
XIOS/dev/dev_olga/src/interface/fortran_attr/ifield_attr.F90
r966 r1021 12 12 13 13 SUBROUTINE xios(set_field_attr) & 14 ( field_id, add_offset, axis_ref, c ompression_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 ) 18 18 19 19 IMPLICIT NONE … … 22 22 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset 23 23 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref 24 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods 25 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode 24 26 INTEGER , OPTIONAL, INTENT(IN) :: compression_level 25 27 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value … … 29 31 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 30 32 LOGICAL (KIND=C_BOOL) :: enabled_tmp 33 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr 31 34 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref 32 35 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset … … 56 59 (field_id,field_hdl) 57 60 CALL xios(set_field_attr_hdl_) & 58 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 62 65 63 66 END SUBROUTINE xios(set_field_attr) 64 67 65 68 SUBROUTINE xios(set_field_attr_hdl) & 66 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 70 73 71 74 IMPLICIT NONE … … 73 76 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset 74 77 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref 78 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods 79 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode 75 80 INTEGER , OPTIONAL, INTENT(IN) :: compression_level 76 81 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value … … 80 85 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 81 86 LOGICAL (KIND=C_BOOL) :: enabled_tmp 87 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr 82 88 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref 83 89 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset … … 105 111 106 112 CALL xios(set_field_attr_hdl_) & 107 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 111 117 112 118 END SUBROUTINE xios(set_field_attr_hdl) 113 119 114 120 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 ) 119 126 120 127 IMPLICIT NONE … … 122 129 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset_ 123 130 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref_ 131 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_ 132 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode_ 124 133 INTEGER , OPTIONAL, INTENT(IN) :: compression_level_ 125 134 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value_ … … 129 138 LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ 130 139 LOGICAL (KIND=C_BOOL) :: enabled__tmp 140 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr_ 131 141 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref_ 132 142 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset_ … … 163 173 ENDIF 164 174 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 165 185 IF (PRESENT(compression_level_)) THEN 166 186 CALL cxios_set_field_compression_level & … … 190 210 ENDIF 191 211 212 IF (PRESENT(expr_)) THEN 213 CALL cxios_set_field_expr & 214 (field_hdl%daddr, expr_, len(expr_)) 215 ENDIF 216 192 217 IF (PRESENT(field_ref_)) THEN 193 218 CALL cxios_set_field_field_ref & … … 296 321 297 322 SUBROUTINE xios(get_field_attr) & 298 ( field_id, add_offset, axis_ref, c ompression_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 ) 302 327 303 328 IMPLICIT NONE … … 306 331 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset 307 332 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref 333 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods 334 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode 308 335 INTEGER , OPTIONAL, INTENT(OUT) :: compression_level 309 336 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value … … 313 340 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled 314 341 LOGICAL (KIND=C_BOOL) :: enabled_tmp 342 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr 315 343 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref 316 344 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset … … 340 368 (field_id,field_hdl) 341 369 CALL xios(get_field_attr_hdl_) & 342 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 346 374 347 375 END SUBROUTINE xios(get_field_attr) 348 376 349 377 SUBROUTINE xios(get_field_attr_hdl) & 350 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 354 382 355 383 IMPLICIT NONE … … 357 385 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset 358 386 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref 387 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods 388 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode 359 389 INTEGER , OPTIONAL, INTENT(OUT) :: compression_level 360 390 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value … … 364 394 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled 365 395 LOGICAL (KIND=C_BOOL) :: enabled_tmp 396 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr 366 397 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref 367 398 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset … … 389 420 390 421 CALL xios(get_field_attr_hdl_) & 391 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 395 426 396 427 END SUBROUTINE xios(get_field_attr_hdl) 397 428 398 429 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 ) 403 435 404 436 IMPLICIT NONE … … 406 438 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset_ 407 439 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref_ 440 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_ 441 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode_ 408 442 INTEGER , OPTIONAL, INTENT(OUT) :: compression_level_ 409 443 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value_ … … 413 447 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled_ 414 448 LOGICAL (KIND=C_BOOL) :: enabled__tmp 449 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr_ 415 450 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref_ 416 451 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset_ … … 447 482 ENDIF 448 483 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 449 494 IF (PRESENT(compression_level_)) THEN 450 495 CALL cxios_get_field_compression_level & … … 474 519 ENDIF 475 520 521 IF (PRESENT(expr_)) THEN 522 CALL cxios_get_field_expr & 523 (field_hdl%daddr, expr_, len(expr_)) 524 ENDIF 525 476 526 IF (PRESENT(field_ref_)) THEN 477 527 CALL cxios_get_field_field_ref & … … 580 630 581 631 SUBROUTINE xios(is_defined_field_attr) & 582 ( field_id, add_offset, axis_ref, c ompression_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 ) 586 636 587 637 IMPLICIT NONE … … 592 642 LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref 593 643 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 594 648 LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 595 649 LOGICAL(KIND=C_BOOL) :: compression_level_tmp … … 602 656 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 603 657 LOGICAL(KIND=C_BOOL) :: enabled_tmp 658 LOGICAL, OPTIONAL, INTENT(OUT) :: expr 659 LOGICAL(KIND=C_BOOL) :: expr_tmp 604 660 LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref 605 661 LOGICAL(KIND=C_BOOL) :: field_ref_tmp … … 646 702 (field_id,field_hdl) 647 703 CALL xios(is_defined_field_attr_hdl_) & 648 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 652 708 653 709 END SUBROUTINE xios(is_defined_field_attr) 654 710 655 711 SUBROUTINE xios(is_defined_field_attr_hdl) & 656 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 660 716 661 717 IMPLICIT NONE … … 665 721 LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref 666 722 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 667 727 LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 668 728 LOGICAL(KIND=C_BOOL) :: compression_level_tmp … … 675 735 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 676 736 LOGICAL(KIND=C_BOOL) :: enabled_tmp 737 LOGICAL, OPTIONAL, INTENT(OUT) :: expr 738 LOGICAL(KIND=C_BOOL) :: expr_tmp 677 739 LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref 678 740 LOGICAL(KIND=C_BOOL) :: field_ref_tmp … … 717 779 718 780 CALL xios(is_defined_field_attr_hdl_) & 719 ( field_hdl, add_offset, axis_ref, c ompression_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 ) 723 785 724 786 END SUBROUTINE xios(is_defined_field_attr_hdl) 725 787 726 788 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 ) 731 794 732 795 IMPLICIT NONE … … 736 799 LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref_ 737 800 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 738 805 LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level_ 739 806 LOGICAL(KIND=C_BOOL) :: compression_level__tmp … … 746 813 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled_ 747 814 LOGICAL(KIND=C_BOOL) :: enabled__tmp 815 LOGICAL, OPTIONAL, INTENT(OUT) :: expr_ 816 LOGICAL(KIND=C_BOOL) :: expr__tmp 748 817 LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref_ 749 818 LOGICAL(KIND=C_BOOL) :: field_ref__tmp … … 799 868 ENDIF 800 869 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 801 882 IF (PRESENT(compression_level_)) THEN 802 883 compression_level__tmp = cxios_is_defined_field_compression_level & … … 829 910 ENDIF 830 911 912 IF (PRESENT(expr_)) THEN 913 expr__tmp = cxios_is_defined_field_expr & 914 (field_hdl%daddr) 915 expr_ = expr__tmp 916 ENDIF 917 831 918 IF (PRESENT(field_ref_)) THEN 832 919 field_ref__tmp = cxios_is_defined_field_field_ref & -
XIOS/dev/dev_olga/src/interface/fortran_attr/ifieldgroup_attr.F90
r966 r1021 12 12 13 13 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 ) 18 19 19 20 IMPLICIT NONE … … 22 23 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset 23 24 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref 25 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods 26 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode 24 27 INTEGER , OPTIONAL, INTENT(IN) :: compression_level 25 28 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value … … 29 32 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 30 33 LOGICAL (KIND=C_BOOL) :: enabled_tmp 34 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr 31 35 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref 32 36 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset … … 57 61 (fieldgroup_id,fieldgroup_hdl) 58 62 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 ) 63 68 64 69 END SUBROUTINE xios(set_fieldgroup_attr) 65 70 66 71 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 ) 71 77 72 78 IMPLICIT NONE … … 74 80 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset 75 81 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref 82 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods 83 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode 76 84 INTEGER , OPTIONAL, INTENT(IN) :: compression_level 77 85 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value … … 81 89 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 82 90 LOGICAL (KIND=C_BOOL) :: enabled_tmp 91 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr 83 92 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref 84 93 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset … … 107 116 108 117 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 ) 113 123 114 124 END SUBROUTINE xios(set_fieldgroup_attr_hdl) 115 125 116 126 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_ ) 121 132 122 133 IMPLICIT NONE … … 124 135 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset_ 125 136 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref_ 137 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_ 138 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode_ 126 139 INTEGER , OPTIONAL, INTENT(IN) :: compression_level_ 127 140 REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value_ … … 131 144 LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ 132 145 LOGICAL (KIND=C_BOOL) :: enabled__tmp 146 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr_ 133 147 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref_ 134 148 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset_ … … 166 180 ENDIF 167 181 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 168 192 IF (PRESENT(compression_level_)) THEN 169 193 CALL cxios_set_fieldgroup_compression_level & … … 193 217 ENDIF 194 218 219 IF (PRESENT(expr_)) THEN 220 CALL cxios_set_fieldgroup_expr & 221 (fieldgroup_hdl%daddr, expr_, len(expr_)) 222 ENDIF 223 195 224 IF (PRESENT(field_ref_)) THEN 196 225 CALL cxios_set_fieldgroup_field_ref & … … 304 333 305 334 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 ) 310 340 311 341 IMPLICIT NONE … … 314 344 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset 315 345 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref 346 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods 347 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode 316 348 INTEGER , OPTIONAL, INTENT(OUT) :: compression_level 317 349 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value … … 321 353 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled 322 354 LOGICAL (KIND=C_BOOL) :: enabled_tmp 355 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr 323 356 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref 324 357 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset … … 349 382 (fieldgroup_id,fieldgroup_hdl) 350 383 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 ) 355 389 356 390 END SUBROUTINE xios(get_fieldgroup_attr) 357 391 358 392 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 ) 363 398 364 399 IMPLICIT NONE … … 366 401 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset 367 402 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref 403 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods 404 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode 368 405 INTEGER , OPTIONAL, INTENT(OUT) :: compression_level 369 406 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value … … 373 410 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled 374 411 LOGICAL (KIND=C_BOOL) :: enabled_tmp 412 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr 375 413 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref 376 414 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset … … 399 437 400 438 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 ) 405 444 406 445 END SUBROUTINE xios(get_fieldgroup_attr_hdl) 407 446 408 447 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_ ) 413 453 414 454 IMPLICIT NONE … … 416 456 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset_ 417 457 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref_ 458 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_ 459 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode_ 418 460 INTEGER , OPTIONAL, INTENT(OUT) :: compression_level_ 419 461 REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value_ … … 423 465 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled_ 424 466 LOGICAL (KIND=C_BOOL) :: enabled__tmp 467 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr_ 425 468 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref_ 426 469 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset_ … … 458 501 ENDIF 459 502 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 460 513 IF (PRESENT(compression_level_)) THEN 461 514 CALL cxios_get_fieldgroup_compression_level & … … 485 538 ENDIF 486 539 540 IF (PRESENT(expr_)) THEN 541 CALL cxios_get_fieldgroup_expr & 542 (fieldgroup_hdl%daddr, expr_, len(expr_)) 543 ENDIF 544 487 545 IF (PRESENT(field_ref_)) THEN 488 546 CALL cxios_get_fieldgroup_field_ref & … … 596 654 597 655 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 ) 602 661 603 662 IMPLICIT NONE … … 608 667 LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref 609 668 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 610 673 LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 611 674 LOGICAL(KIND=C_BOOL) :: compression_level_tmp … … 618 681 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 619 682 LOGICAL(KIND=C_BOOL) :: enabled_tmp 683 LOGICAL, OPTIONAL, INTENT(OUT) :: expr 684 LOGICAL(KIND=C_BOOL) :: expr_tmp 620 685 LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref 621 686 LOGICAL(KIND=C_BOOL) :: field_ref_tmp … … 664 729 (fieldgroup_id,fieldgroup_hdl) 665 730 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 ) 670 736 671 737 END SUBROUTINE xios(is_defined_fieldgroup_attr) 672 738 673 739 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 ) 678 745 679 746 IMPLICIT NONE … … 683 750 LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref 684 751 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 685 756 LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 686 757 LOGICAL(KIND=C_BOOL) :: compression_level_tmp … … 693 764 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 694 765 LOGICAL(KIND=C_BOOL) :: enabled_tmp 766 LOGICAL, OPTIONAL, INTENT(OUT) :: expr 767 LOGICAL(KIND=C_BOOL) :: expr_tmp 695 768 LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref 696 769 LOGICAL(KIND=C_BOOL) :: field_ref_tmp … … 737 810 738 811 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 ) 743 817 744 818 END SUBROUTINE xios(is_defined_fieldgroup_attr_hdl) 745 819 746 820 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_ ) 751 826 752 827 IMPLICIT NONE … … 756 831 LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref_ 757 832 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 758 837 LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level_ 759 838 LOGICAL(KIND=C_BOOL) :: compression_level__tmp … … 766 845 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled_ 767 846 LOGICAL(KIND=C_BOOL) :: enabled__tmp 847 LOGICAL, OPTIONAL, INTENT(OUT) :: expr_ 848 LOGICAL(KIND=C_BOOL) :: expr__tmp 768 849 LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref_ 769 850 LOGICAL(KIND=C_BOOL) :: field_ref__tmp … … 821 902 ENDIF 822 903 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 823 916 IF (PRESENT(compression_level_)) THEN 824 917 compression_level__tmp = cxios_is_defined_fieldgroup_compression_level & … … 851 944 ENDIF 852 945 946 IF (PRESENT(expr_)) THEN 947 expr__tmp = cxios_is_defined_fieldgroup_expr & 948 (fieldgroup_hdl%daddr) 949 expr_ = expr__tmp 950 ENDIF 951 853 952 IF (PRESENT(field_ref_)) THEN 854 953 field_ref__tmp = cxios_is_defined_fieldgroup_field_ref & -
XIOS/dev/dev_olga/src/interface/fortran_attr/iinterpolate_domain_attr.F90
r966 r1021 12 12 13 13 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 ) 15 15 16 16 IMPLICIT NONE … … 18 18 CHARACTER(LEN=*), INTENT(IN) ::interpolate_domain_id 19 19 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: file 20 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode 20 21 INTEGER , OPTIONAL, INTENT(IN) :: order 21 22 LOGICAL , OPTIONAL, INTENT(IN) :: renormalize 22 23 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 23 27 24 28 CALL xios(get_interpolate_domain_handle) & 25 29 (interpolate_domain_id,interpolate_domain_hdl) 26 30 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 ) 28 32 29 33 END SUBROUTINE xios(set_interpolate_domain_attr) 30 34 31 35 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 ) 33 37 34 38 IMPLICIT NONE 35 39 TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl 36 40 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: file 41 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode 37 42 INTEGER , OPTIONAL, INTENT(IN) :: order 38 43 LOGICAL , OPTIONAL, INTENT(IN) :: renormalize 39 44 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 40 48 41 49 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 ) 43 51 44 52 END SUBROUTINE xios(set_interpolate_domain_attr_hdl) 45 53 46 54 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 ) 48 57 49 58 IMPLICIT NONE 50 59 TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl 51 60 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: file_ 61 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode_ 52 62 INTEGER , OPTIONAL, INTENT(IN) :: order_ 53 63 LOGICAL , OPTIONAL, INTENT(IN) :: renormalize_ 54 64 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 55 68 56 69 IF (PRESENT(file_)) THEN 57 70 CALL cxios_set_interpolate_domain_file & 58 71 (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_)) 59 77 ENDIF 60 78 … … 70 88 ENDIF 71 89 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 72 101 END SUBROUTINE xios(set_interpolate_domain_attr_hdl_) 73 102 74 103 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 ) 76 105 77 106 IMPLICIT NONE … … 79 108 CHARACTER(LEN=*), INTENT(IN) ::interpolate_domain_id 80 109 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: file 110 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode 81 111 INTEGER , OPTIONAL, INTENT(OUT) :: order 82 112 LOGICAL , OPTIONAL, INTENT(OUT) :: renormalize 83 113 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 84 117 85 118 CALL xios(get_interpolate_domain_handle) & 86 119 (interpolate_domain_id,interpolate_domain_hdl) 87 120 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 ) 89 122 90 123 END SUBROUTINE xios(get_interpolate_domain_attr) 91 124 92 125 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 ) 94 127 95 128 IMPLICIT NONE 96 129 TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl 97 130 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: file 131 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode 98 132 INTEGER , OPTIONAL, INTENT(OUT) :: order 99 133 LOGICAL , OPTIONAL, INTENT(OUT) :: renormalize 100 134 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 101 138 102 139 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 ) 104 141 105 142 END SUBROUTINE xios(get_interpolate_domain_attr_hdl) 106 143 107 144 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 ) 109 147 110 148 IMPLICIT NONE 111 149 TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl 112 150 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: file_ 151 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode_ 113 152 INTEGER , OPTIONAL, INTENT(OUT) :: order_ 114 153 LOGICAL , OPTIONAL, INTENT(OUT) :: renormalize_ 115 154 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 116 158 117 159 IF (PRESENT(file_)) THEN 118 160 CALL cxios_get_interpolate_domain_file & 119 161 (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_)) 120 167 ENDIF 121 168 … … 131 178 ENDIF 132 179 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 133 191 END SUBROUTINE xios(get_interpolate_domain_attr_hdl_) 134 192 135 193 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 ) 137 195 138 196 IMPLICIT NONE … … 141 199 LOGICAL, OPTIONAL, INTENT(OUT) :: file 142 200 LOGICAL(KIND=C_BOOL) :: file_tmp 201 LOGICAL, OPTIONAL, INTENT(OUT) :: mode 202 LOGICAL(KIND=C_BOOL) :: mode_tmp 143 203 LOGICAL, OPTIONAL, INTENT(OUT) :: order 144 204 LOGICAL(KIND=C_BOOL) :: order_tmp 145 205 LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize 146 206 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 147 211 148 212 CALL xios(get_interpolate_domain_handle) & 149 213 (interpolate_domain_id,interpolate_domain_hdl) 150 214 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 ) 152 216 153 217 END SUBROUTINE xios(is_defined_interpolate_domain_attr) 154 218 155 219 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 ) 157 221 158 222 IMPLICIT NONE … … 160 224 LOGICAL, OPTIONAL, INTENT(OUT) :: file 161 225 LOGICAL(KIND=C_BOOL) :: file_tmp 226 LOGICAL, OPTIONAL, INTENT(OUT) :: mode 227 LOGICAL(KIND=C_BOOL) :: mode_tmp 162 228 LOGICAL, OPTIONAL, INTENT(OUT) :: order 163 229 LOGICAL(KIND=C_BOOL) :: order_tmp 164 230 LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize 165 231 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 166 236 167 237 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 ) 169 239 170 240 END SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl) 171 241 172 242 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 ) 174 245 175 246 IMPLICIT NONE … … 177 248 LOGICAL, OPTIONAL, INTENT(OUT) :: file_ 178 249 LOGICAL(KIND=C_BOOL) :: file__tmp 250 LOGICAL, OPTIONAL, INTENT(OUT) :: mode_ 251 LOGICAL(KIND=C_BOOL) :: mode__tmp 179 252 LOGICAL, OPTIONAL, INTENT(OUT) :: order_ 180 253 LOGICAL(KIND=C_BOOL) :: order__tmp 181 254 LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize_ 182 255 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 183 260 184 261 IF (PRESENT(file_)) THEN … … 188 265 ENDIF 189 266 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 190 273 IF (PRESENT(order_)) THEN 191 274 order__tmp = cxios_is_defined_interpolate_domain_order & … … 200 283 ENDIF 201 284 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 202 297 END SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl_) 203 298 -
XIOS/dev/dev_olga/src/interface/fortran_attr/interpolate_domain_interface_attr.F90
r891 r1021 29 29 INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl 30 30 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 31 52 32 53 … … 68 89 END FUNCTION cxios_is_defined_interpolate_domain_renormalize 69 90 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 70 131 END INTERFACE 71 132 -
XIOS/dev/dev_olga/src/io/nc4_data_output.cpp
r973 r1021 1675 1675 for (vector<CVariable*>::iterator it = listVars.begin() ;it != listVars.end(); it++) writeAttribute_(*it, fieldid) ; 1676 1676 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 1677 1708 1678 1709 if (wtime) … … 1687 1718 SuperClassWriter::addAttribute("interval_write", freqOut.toStringUDUnits(), &fieldid); 1688 1719 1689 StdString cellMethods = "time: ";1720 StdString cellMethods(cellMethodsPrefix + "time: "); 1690 1721 if (field->operation.getValue() == "instant") cellMethods += "point"; 1691 1722 else if (field->operation.getValue() == "average") cellMethods += "mean"; … … 1694 1725 if (freqOp.resolve(*context->calendar) != freqOut.resolve(*context->calendar)) 1695 1726 cellMethods += " (interval: " + freqOpStr + ")"; 1696 SuperClassWriter::addAttribute("cell_methods", cellMethods, &fieldid); 1727 cellMethods += cellMethodsSuffix; 1728 if (!alreadyAddCellMethod) 1729 SuperClassWriter::addAttribute("cell_methods", cellMethods, &fieldid); 1697 1730 } 1698 1731 … … 1928 1961 if (!field->wasWritten()) 1929 1962 { 1930 if (appendMode && field->file->record_offset.isEmpty()) 1963 if (appendMode && field->file->record_offset.isEmpty() && 1964 field->getOperationTimeType() != func::CFunctor::once) 1931 1965 { 1932 1966 field->resetNStep(getRecordFromTime(field->last_Write_srv) + 1); -
XIOS/dev/dev_olga/src/node/context.cpp
r1009 r1021 247 247 248 248 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 250 252 { 251 253 client = new CContextClient(this, intraComm, interComm, cxtServer); 252 254 server = new CContextServer(this, intraComm, interComm); 253 255 } 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 { 258 259 clientPrimServer.push_back(new CContextClient(this, intraComm, interComm)); 259 260 serverPrimServer.push_back(new CContextServer(this, intraComm, interComm)); … … 376 377 bool CContext::eventLoop(void) 377 378 { 378 if (C Xios::serverLevel == 0)379 if (CServer::serverLevel == 0) 379 380 { 380 381 return server->eventLoop(); 381 382 } 382 else if (C Xios::serverLevel == 1)383 else if (CServer::serverLevel == 1) 383 384 { 384 385 bool serverFinished = server->eventLoop(); … … 399 400 bool CContext::checkBuffersAndListen(void) 400 401 { 401 if (C Xios::serverLevel == 0)402 if (CServer::serverLevel == 0) 402 403 { 403 404 client->checkBuffers(); 404 405 return server->eventLoop(); 405 406 } 406 else if (C Xios::serverLevel == 1)407 else if (CServer::serverLevel == 1) 407 408 { 408 409 client->checkBuffers(); … … 417 418 return ( serverFinished && serverPrimFinished); 418 419 } 419 else if (C Xios::serverLevel == 2)420 else if (CServer::serverLevel == 2) 420 421 { 421 422 client->checkBuffers(); … … 430 431 { 431 432 finalized = true; 432 //if (hasClient) sendRegistry() ;433 if (hasClient) sendRegistry() ; 433 434 434 435 if ((hasClient) && (hasServer)) … … 487 488 // There is nothing client need to send to server 488 489 if (hasClient) 489 // if (hasClient && !hasServer)490 490 { 491 491 // After xml is parsed, there are some more works with post processing … … 495 495 setClientServerBuffer(); 496 496 497 // if (hasClient && !hasServer)498 497 if (hasClient) 499 498 { … … 505 504 506 505 // 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(); 519 511 520 512 // At last, we have all info of domain and axis, then send them 521 513 sendRefDomainsAxis(); 522 // After that, send all grid (if any) 514 515 // After that, send all grid (if any) 523 516 sendRefGrid(); 517 524 518 // We have a xml tree on the server side and now, it should be also processed 525 519 sendPostProcessing(); 526 520 } 527 521 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 533 524 if (hasClient) this->sendCloseDefinition(); 534 525 535 526 // There are some processings that should be done after all of above. For example: check mask or index 536 527 if (hasClient && !hasServer) 537 // if (hasClient)538 528 { 539 529 this->buildFilterGraphOfEnabledFields(); // references are resolved here (access xml file) … … 692 682 DEBUG(<<"Aucun fichier ne va être sorti dans le contexte nommé \"" 693 683 << 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 } 694 699 } 695 700 … … 769 774 { 770 775 // Use correct context client to send message 771 // CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[0] : client;772 776 int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 773 777 for (int i = 0; i < nbSrvPools; ++i) … … 883 887 { 884 888 // Use correct context client to send message 885 // CContextClient* contextClientTmp = (0 != clientPrimServer) ? clientPrimServer : client;886 889 int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 887 890 for (int i = 0; i < nbSrvPools; ++i) … … 958 961 { 959 962 // Use correct context client to send message 960 // CContextClient* contextClientTmp = (0 != clientPrimServer) ? clientPrimServer : client;961 963 int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 962 964 for (int i = 0; i < nbSrvPools; ++i) … … 1077 1079 // Check if some automatic time series should be generated 1078 1080 // Warning: This must be done after solving the inheritance and before the rest of post-processing 1079 prepareTimeseries(); 1081 if (!hasServer) 1082 prepareTimeseries(); 1080 1083 1081 1084 //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. … … 1204 1207 for (int i = 0; i < size; ++i) 1205 1208 { 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()); 1231 1212 } 1232 1213 } … … 1238 1219 for (int i = 0; i < size; ++i) 1239 1220 { 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()); 1251 1222 } 1252 1223 } … … 1361 1332 //! Client side: Send information of reference domain and axis of active fields 1362 1333 void CContext::sendRefDomainsAxis() 1363 {1364 std::set<StdString> domainIds, axisIds, scalarIds;1365 1366 // Find all reference domain and axis of all active fields1367 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 side1382 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 side1410 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 fields1423 void CContext::sendRefDomainsAxis(const int nbPools)1424 1334 { 1425 1335 std::set<StdString> domainIds, axisIds, scalarIds; … … 1569 1479 1570 1480 // Use correct context client to send message 1571 // CContextClient* contextClientTmp = (0 != clientPrimServer) ? clientPrimServer : client;1572 1481 int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 1573 1482 for (int i = 0; i < nbSrvPools; ++i) … … 1575 1484 CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; 1576 1485 CEventClient event(CContext::GetType(), CContext::EVENT_ID_SEND_REGISTRY); 1577 1486 if (contextClientTmp->isServerLeader()) 1578 1487 { 1579 1488 CMessage msg ; … … 1583 1492 msg<<this->getIdServer(); 1584 1493 if (contextClientTmp->clientRank==0) msg<<*registryOut ; 1585 const std::list<int>& ranks = c lient->getRanksServerLeader();1494 const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 1586 1495 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1587 1496 event.push(*itRank,1,msg); -
XIOS/dev/dev_olga/src/node/context.hpp
r1009 r1021 133 133 void sendCreateFileHeader(void); 134 134 void sendEnabledFiles(); 135 void sendEnabledFiles(const int nbPools);136 135 void sendEnabledFields(); 137 void sendEnabledFields(const int nbPools);138 136 void sendRefDomainsAxis(); 139 void sendRefDomainsAxis(const int nbPools);140 137 void sendRefGrid(); 141 138 void sendPostProcessing(); -
XIOS/dev/dev_olga/src/node/field.cpp
r1009 r1021 36 36 , domAxisScalarIds_(vector<StdString>(3,"")), areAllReferenceSolved(false), isReferenceSolved(false) 37 37 , useCompressedOutput(false) 38 , isReadDataRequestPending(false)38 , wasDataAlreadyReceivedFromServer(false) 39 39 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 40 40 … … 47 47 , domAxisScalarIds_(vector<StdString>(3,"")), areAllReferenceSolved(false), isReferenceSolved(false) 48 48 , useCompressedOutput(false) 49 , isReadDataRequestPending(false)49 , wasDataAlreadyReceivedFromServer(false) 50 50 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 51 51 … … 179 179 } 180 180 181 void CField::sendUpdateData(const CArray<double,1>& data, const int srvPool)181 void CField::sendUpdateData(const CArray<double,1>& data, CContextClient* client) 182 182 { 183 183 CTimer::get("XIOS Send Data").resume(); 184 185 CContext* context = CContext::getCurrent();186 CContextClient* client = context->clientPrimServer[srvPool];187 184 188 185 CEventClient event(getType(), EVENT_ID_UPDATE_DATA); … … 312 309 int fileIdx = std::find(context->enabledFiles.begin(), context->enabledFiles.end(), this->file) - context->enabledFiles.begin(); 313 310 int srvId = fileIdx % context->clientPrimServer.size(); 314 sendUpdateData(fieldData, srvId);311 sendUpdateData(fieldData, context->clientPrimServer[srvId]); 315 312 } 316 313 if (!context->hasClient && context->hasServer) … … 348 345 } 349 346 350 void CField::sendReadDataRequest( void)347 void CField::sendReadDataRequest(const CDate& tsDataRequested) 351 348 { 352 349 CContext* context = CContext::getCurrent(); 353 350 CContextClient* client = context->client; 354 351 355 lastDataRequestedFromServer = context->getCalendar()->getCurrentDate(); 356 isReadDataRequestPending = true; 352 lastDataRequestedFromServer = tsDataRequested; 357 353 358 354 CEventClient event(getType(), EVENT_ID_READ_DATA); … … 377 373 const CDate& currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate(); 378 374 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; 392 388 } 393 389 … … 411 407 412 408 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 } 425 479 } 426 480 … … 494 548 } 495 549 550 if (wasDataAlreadyReceivedFromServer) 551 lastDataReceivedFromServer = lastDataReceivedFromServer + file->output_freq; 552 else 553 { 554 lastDataReceivedFromServer = context->getCalendar()->getInitDate(); 555 wasDataAlreadyReceivedFromServer = true; 556 } 557 496 558 if (isEOF) 497 serverSourceFilter->signalEndOfStream(lastDataRe questedFromServer);559 serverSourceFilter->signalEndOfStream(lastDataReceivedFromServer); 498 560 else 499 serverSourceFilter->streamDataFromServer(lastDataRequestedFromServer, data); 500 501 isReadDataRequestPending = false; 561 serverSourceFilter->streamDataFromServer(lastDataReceivedFromServer, data); 502 562 } 503 563 … … 749 809 solveGridDomainAxisRef(doSending2Server); 750 810 751 if (context->hasClient && !context->has Client)811 if (context->hasClient && !context->hasServer) 752 812 { 753 813 solveTransformedGrid(); … … 831 891 { 832 892 // 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; 837 914 } 838 915 // Check if we have a reference on another field … … 841 918 // Check if the data is to be read from a file 842 919 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)); 845 923 else // The data might be passed from the model 846 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(g rid));924 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid)); 847 925 } 848 926 … … 863 941 } 864 942 } 943 865 944 866 945 /*! … … 871 950 * \return the output pin corresponding to the field reference 872 951 */ 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 } 898 975 899 976 /*! … … 908 985 boost::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 909 986 { 910 if (instantDataFilter || content.empty())987 if (instantDataFilter || !hasExpression()) 911 988 ERROR("COutputPin* CField::getSelfReference(CGarbageCollector& gc)", 912 989 "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); … … 917 994 { 918 995 if (!serverSourceFilter) 919 serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(g rid,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)); 922 999 selfReferenceFilter = serverSourceFilter; 923 1000 } 924 1001 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 } 926 1007 else 927 1008 { 928 1009 if (!clientSourceFilter) 929 clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(g rid));1010 clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid)); 930 1011 931 1012 selfReferenceFilter = clientSourceFilter; … … 1126 1207 else if (grid && grid->hasTransform() && !grid->isTransformed()) 1127 1208 { 1128 grid->transformGrid(grid); 1209 // Temporarily deactivate the self-transformation of grid 1210 //grid->transformGrid(grid); 1129 1211 } 1130 1212 } … … 1325 1407 } 1326 1408 1327 void CField::sendAddAllVariables( const int srvPool)1409 void CField::sendAddAllVariables(CContextClient* client) 1328 1410 { 1329 1411 std::vector<CVariable*> allVar = getAllVariables(); … … 1333 1415 for (; it != itE; ++it) 1334 1416 { 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); 1338 1420 } 1339 1421 } … … 1363 1445 } 1364 1446 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 1365 1471 void CField::sendAddVariableGroup(const string& id) 1366 1472 { … … 1418 1524 } 1419 1525 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 1420 1547 DEFINE_REF_FUNC(Field,field) 1421 1548 } // namespace xios -
XIOS/dev/dev_olga/src/node/field.hpp
r1009 r1021 16 16 #include "transformation_enum.hpp" 17 17 #include "variable.hpp" 18 #include "context_client.hpp" 18 19 19 20 … … 124 125 boost::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc); 125 126 boost::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 127 boost::shared_ptr<COutputPin> getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 126 128 127 129 // virtual void fromBinary(StdIStream& is); … … 139 141 static bool dispatchEvent(CEventServer& event); 140 142 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); 142 144 static void recvUpdateData(CEventServer& event); 143 145 void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers); 144 146 void writeField(void); 145 void sendReadDataRequest( void);147 void sendReadDataRequest(const CDate& tsDataRequested); 146 148 bool sendReadDataRequestIfNeeded(void); 147 149 static void recvReadDataRequest(CEventServer& event); … … 169 171 CVariableGroup* addVariableGroup(const string& id = ""); 170 172 void sendAddVariable(const string& id = ""); 171 void sendAddVariable(const string& id, const int srvPool);173 void sendAddVariable(const string& id, CContextClient* client); 172 174 void sendAddVariableGroup(const string& id = ""); 173 175 static void recvAddVariable(CEventServer& event); … … 176 178 void recvAddVariableGroup(CBufferIn& buffer); 177 179 void sendAddAllVariables(); 178 void sendAddAllVariables(const int srvPool); 179 180 void sendAddAllVariables(CContextClient* client); 180 181 181 182 const std::vector<StdString>& getRefDomainAxisIds(); 183 184 const string& getExpression(void); 185 bool hasExpression(void) const; 182 186 183 187 public: … … 194 198 bool isEOF; 195 199 CDate lastlast_Write_srv, last_Write_srv, last_operation_srv; 196 CDate lastDataRequestedFromServer; 200 CDate lastDataRequestedFromServer, lastDataReceivedFromServer; 201 bool wasDataAlreadyReceivedFromServer; 197 202 198 203 map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; … … 204 209 bool isReferenceSolved; 205 210 std::vector<StdString> domAxisScalarIds_; 206 bool isReadDataRequestPending;207 211 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; 208 216 209 217 DECLARE_REF_FUNC(Field,field) -
XIOS/dev/dev_olga/src/node/field_impl.hpp
r645 r1021 20 20 if (clientSourceFilter) 21 21 clientSourceFilter->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); 22 else if ( !field_ref.isEmpty() || !content.empty())22 else if (instantDataFilter) 23 23 ERROR("void CField::setData(const CArray<double, N>& _data)", 24 24 << "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 14 14 #include "type.hpp" 15 15 #include "xios_spl.hpp" 16 #include "context_client.hpp"17 16 #include "mpi.hpp" 18 17 … … 376 375 { 377 376 middlePart=filename.substr(pos1,pos2-pos1) ; 378 cout<<pos2<<endl ;379 377 pos2+=strEndDate.size() ; 380 378 lastPart=filename.substr(pos2,filename.size()-pos2) ; … … 746 744 int size = this->enabledFields.size(); 747 745 for (int i = 0; i < size; ++i) 748 this->enabledFields[i]->sendReadDataRequest( );746 this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 749 747 } 750 748 … … 822 820 { 823 821 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; 824 832 } 825 833 … … 853 861 } 854 862 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); 858 866 // CContext* context = CContext::getCurrent(); 859 867 … … 974 982 } 975 983 976 void CFile::sendAddAllVariables( const int srvPool)984 void CFile::sendAddAllVariables(CContextClient* client) 977 985 { 978 986 std::vector<CVariable*> allVar = getAllVariables(); … … 982 990 for (; it != itE; ++it) 983 991 { 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); 987 995 } 988 996 } … … 1046 1054 } 1047 1055 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); 1051 1059 // CContext* context = CContext::getCurrent(); 1052 1060 … … 1126 1134 Remark: This function must be called AFTER all active (enabled) files have been created on the server side 1127 1135 */ 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) 1129 1155 { 1130 1156 size_t size = this->enabledFields.size(); … … 1132 1158 { 1133 1159 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); 1137 1163 } 1138 1164 } 1139 1165 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 }1151 1166 1152 1167 /*! -
XIOS/dev/dev_olga/src/node/file.hpp
r1009 r1021 11 11 #include "attribute_enum.hpp" 12 12 #include "attribute_enum_impl.hpp" 13 #include "context_client.hpp" 13 14 #include "mpi.hpp" 14 15 … … 114 115 CVariable* addVariable(const string& id = ""); 115 116 CVariableGroup* addVariableGroup(const string& id = ""); 117 void setContextClient(CContextClient* newContextClient); 118 CContextClient* getContextClient(); 116 119 117 120 // Send info to server 118 void sendEnabledFields();119 void sendEnabledFields( const int srvPool);121 // void sendEnabledFields(); 122 void sendEnabledFields(CContextClient* client); 120 123 void sendAddField(const string& id = ""); 121 void sendAddField(const string& id, const int srvPool);124 void sendAddField(const string& id, CContextClient* client); 122 125 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); 127 130 void sendAddVariableGroup(const string& id = ""); 128 131 … … 169 172 boost::shared_ptr<CDataInput> data_in; 170 173 std::vector<CField*> enabledFields; 174 CContextClient* client; 171 175 172 176 public: -
XIOS/dev/dev_olga/src/node/grid.cpp
r1009 r1021 299 299 } 300 300 301 this->isChecked = true; 301 // this->isChecked = true; 302 if (!(this->hasTransform() && !this->isTransformed())) 303 this->isChecked = true; 302 304 return; 303 305 } … … 316 318 this->computeIndex(); 317 319 } 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; 319 326 } 320 327 } … … 1094 1101 } 1095 1102 1103 storeIndex_fromSrv.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 1096 1104 listMsg.push_back(CMessage()); 1097 1105 listMsg.back() << getId( )<< isDataDistributed_ << isCompressible_ << listOutIndex.back(); … … 1102 1110 } 1103 1111 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 } 1104 1125 client->sendEvent(event); 1126 } 1105 1127 } 1106 1128 } … … 1136 1158 } 1137 1159 1138 //int nbClient = client->clientSize; // This stupid variable signals the servers the number of client connect to them1139 1160 const std::list<int>& ranks = client->getRanksServerLeader(); 1140 1161 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1141 1162 { 1142 1163 storeIndex_toSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 1164 storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 1143 1165 listOutIndex.push_back(CArray<size_t,1>(outGlobalIndexOnServer)); 1144 1166 … … 1151 1173 } 1152 1174 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 } 1154 1190 } 1155 1191 else … … 1177 1213 } 1178 1214 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) 1181 1217 { 1182 1218 rank = connectedServerRank_[ns]; … … 1197 1233 } 1198 1234 1235 storeIndex_fromSrv.insert(make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 1199 1236 listMsg.push_back(CMessage()); 1200 1237 listMsg.back() << getId() << isDataDistributed_ << isCompressible_ << listOutIndex.back(); -
XIOS/dev/dev_olga/src/node/grid.hpp
r976 r1021 221 221 222 222 map<int, CArray<int, 1> > storeIndex_toSrv; 223 map<int, CArray<int, 1> > storeIndex_fromSrv; 223 224 map<int,int> nbSenders; 224 225 -
XIOS/dev/dev_olga/src/node/interpolate_domain.cpp
r836 r1021 47 47 << "Please define a correct one") ; 48 48 } 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 49 91 } 50 92 -
XIOS/dev/dev_olga/src/node/interpolate_domain.hpp
r836 r1021 50 50 virtual ~CInterpolateDomain(void); 51 51 52 virtual void checkValid(CDomain* axisDest);52 virtual void checkValid(CDomain* domainSource); 53 53 54 54 /// Accesseurs statiques /// -
XIOS/dev/dev_olga/src/node/variable.cpp
r1009 r1021 127 127 } 128 128 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 { 133 131 CEventClient event(this->getType(),EVENT_ID_VARIABLE_VALUE) ; 134 if (c ontextClientTmp->isServerLeader())132 if (client->isServerLeader()) 135 133 { 136 134 CMessage msg ; 137 135 msg<<this->getId() ; 138 136 msg<<content ; 139 const std::list<int>& ranks = c ontextClientTmp->getRanksServerLeader();137 const std::list<int>& ranks = client->getRanksServerLeader(); 140 138 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 141 139 event.push(*itRank,1,msg); 142 c ontextClientTmp->sendEvent(event) ;140 client->sendEvent(event) ; 143 141 } 144 else c ontextClientTmp->sendEvent(event) ;142 else client->sendEvent(event) ; 145 143 } 146 144 -
XIOS/dev/dev_olga/src/node/variable.hpp
r1009 r1021 79 79 //! Sending a request to set up variable data 80 80 void sendValue(); 81 void sendValue( const int srvPool);81 void sendValue(CContextClient* client); 82 82 83 83 static void recvValue(CEventServer& event) ; -
XIOS/dev/dev_olga/src/object_template.hpp
r1009 r1021 9 9 #include "event_server.hpp" 10 10 #include "attribute.hpp" 11 #include "context_client.hpp" 11 12 12 13 namespace xios … … 56 57 std::map<int, size_t> getMinimumBufferSizeForAttributes(); 57 58 void sendAttributToServer(const string& id); 58 void sendAttributToServer(const string& id, const int srvPool);59 void sendAttributToServer(const string& id, CContextClient* client); 59 60 void sendAttributToServer(CAttribute& attr) ; 60 void sendAttributToServer(CAttribute& attr, const int srvPool) ;61 void sendAttributToServer(CAttribute& attr, CContextClient* client) ; 61 62 void sendAllAttributesToServer(); 62 void sendAllAttributesToServer( const int srvPool);63 void sendAllAttributesToServer(CContextClient* client); 63 64 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); 65 66 static void recvAttributFromClient(CEventServer& event) ; 66 67 static bool dispatchEvent(CEventServer& event) ; -
XIOS/dev/dev_olga/src/object_template_impl.hpp
r1009 r1021 164 164 std::map<int, size_t> CObjectTemplate<T>::getMinimumBufferSizeForAttributes() 165 165 { 166 // CContextClient* client = CContext::getCurrent()->client;166 // Use correct context client to send message 167 167 CContext* context = CContext::getCurrent(); 168 169 // Use correct context client to send message170 // CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client;171 168 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 172 169 for (int i = 0; i < nbSrvPools; ++i) … … 244 241 245 242 template<typename T> 246 void CObjectTemplate<T>::sendAllAttributesToServer( const int srvPool)243 void CObjectTemplate<T>::sendAllAttributesToServer(CContextClient* client) 247 244 { 248 245 CAttributeMap& attrMap = *this; … … 250 247 for (; it != itE; ++it) 251 248 { 252 if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second), srvPool);249 if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second), client); 253 250 } 254 251 } … … 263 260 264 261 template <class T> 265 void CObjectTemplate<T>::sendAttributToServer(const string& id, const int srvPool)262 void CObjectTemplate<T>::sendAttributToServer(const string& id, CContextClient* client) 266 263 { 267 264 CAttributeMap & attrMap = *this; 268 265 CAttribute* attr=attrMap[id]; 269 sendAttributToServer(*attr, srvPool);266 sendAttributToServer(*attr, client); 270 267 } 271 268 … … 273 270 void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr) 274 271 { 272 // Use correct context client to send message 275 273 CContext* context=CContext::getCurrent(); 276 277 // Use correct context client to send message278 // CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client;279 274 if (context->hasClient) 280 275 { … … 283 278 { 284 279 CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 285 // CContextClient* contextClientTmp=context->contextClientTmp;286 287 280 CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); 288 281 if (contextClientTmp->isServerLeader()) 289 282 { 290 283 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(); 299 285 msg << attr.getName(); 300 286 msg << attr; … … 331 317 332 318 template <class T> 333 void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr, const int srvPool)319 void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr, CContextClient* client) 334 320 { 335 CContext* context=CContext::getCurrent();336 CContextClient* contextClientTmp = context->clientPrimServer[srvPool];337 321 CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); 338 if (c ontextClientTmp->isServerLeader())322 if (client->isServerLeader()) 339 323 { 340 324 CMessage msg; … … 342 326 msg << attr.getName(); 343 327 msg << attr; 344 const std::list<int>& ranks = c ontextClientTmp->getRanksServerLeader();328 const std::list<int>& ranks = client->getRanksServerLeader(); 345 329 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 346 330 event.push(*itRank,1,msg); 347 c ontextClientTmp->sendEvent(event);331 client->sendEvent(event); 348 332 } 349 else c ontextClientTmp->sendEvent(event);333 else client->sendEvent(event); 350 334 } 351 352 335 353 336 /*! … … 364 347 if (context->hasClient) 365 348 { 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 368 350 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 369 351 for (int i = 0; i < nbSrvPools; ++i) … … 387 369 388 370 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) 390 372 { 391 CContext* context = CContext::getCurrent();392 373 typedef typename T::EEventId ItemType; 393 CContextClient* contextClientTmp = context->clientPrimServer[srvPool];394 374 CEventClient event(this->getType(),ItemType(itemType)); 395 if (c ontextClientTmp->isServerLeader())375 if (client->isServerLeader()) 396 376 { 397 377 CMessage msg; 398 378 msg << this->getId(); 399 379 msg << id; 400 const std::list<int>& ranks = c ontextClientTmp->getRanksServerLeader();380 const std::list<int>& ranks = client->getRanksServerLeader(); 401 381 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 402 382 event.push(*itRank,1,msg); 403 c ontextClientTmp->sendEvent(event);383 client->sendEvent(event); 404 384 } 405 else c ontextClientTmp->sendEvent(event);385 else client->sendEvent(event); 406 386 } 387 407 388 408 389 template <class T> -
XIOS/dev/dev_olga/src/server.cpp
r1009 r1021 22 22 list<MPI_Comm> CServer::interComm ; 23 23 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; 26 28 bool CServer::isRoot = false ; 27 29 int CServer::rank = INVALID_RANK; 28 int CServer::rankSndServers = 0;29 30 StdOFStream CServer::m_infoStream; 30 31 StdOFStream CServer::m_errorStream; … … 37 38 /*! 38 39 * \fn void CServer::initialize(void) 39 * Function creates intra and inter comm for each initialized server pool40 * Creates intraComm and interComm for a server pool (primary or secondary). 40 41 */ 41 42 void CServer::initialize(void) … … 46 47 else is_MPI_Initialized=false ; 47 48 48 49 49 // Not using OASIS 50 50 if (!CXios::usingOasis) … … 58 58 59 59 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); 63 64 64 65 unsigned long* hashAll ; 65 unsigned long* hashAllServers ;66 // unsigned long* hashAllServers ; 66 67 67 68 // int rank ; … … 69 70 int myColor ; 70 71 int i,c ; 71 MPI_Comm newComm, servers InterComm;72 MPI_Comm newComm, serversComm; 72 73 73 74 MPI_Comm_size(CXios::globalComm, &size) ; … … 77 78 MPI_Allgather(&hashServer, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ; 78 79 79 map<unsigned long, int> colors , colorsServers;80 map<unsigned long, int> colors ; 80 81 map<unsigned long, int> leaders ; 81 82 map<unsigned long, int>::iterator it ; 82 // map<unsigned long, int> leadersServers ;83 vector<int> leadersServers;84 83 85 84 for(i=0,c=0;i<size;i++) … … 93 92 } 94 93 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) ) 101 102 { 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; 127 110 } 128 111 } 129 112 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) 166 116 { 167 117 int clientLeader; … … 183 133 } 184 134 } 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++) 188 139 { 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) 193 141 { 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) ; 222 151 } 223 152 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) 247 157 { 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 295 180 delete [] hashAll ; 296 181 … … 416 301 { 417 302 MPI_Send(&msg,1,MPI_INT,0,0,*itr) ; 418 419 303 // MPI_Comm_free(&(*itr)); 420 304 // interCommRight.erase(itr) ; … … 612 496 contextInterComms.push_back(contextInterComm); 613 497 614 if ( CXios::serverLevel == 1)498 if (serverLevel == 1) 615 499 { 616 500 // CClient::registerContext(contextId, intraComm); 617 CClient::registerContext OnSrvPools(contextId, intraComm);501 CClient::registerContextByClienOfServer(contextId, intraComm); 618 502 } 619 503 … … 657 541 int numDigit = 0; 658 542 int size = 0; 659 int mpiRank;543 int id; 660 544 MPI_Comm_size(CXios::globalComm, &size); 661 545 while (size) … … 665 549 } 666 550 667 if ( nbSndSrvPools <2)668 mpiRank= getRank();551 if (!CXios::usingServer2) 552 id = getRank(); 669 553 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; 672 561 fb->open(fileNameClient.str().c_str(), std::ios::out); 673 562 if (!fb->is_open()) -
XIOS/dev/dev_olga/src/server.hpp
r1009 r1021 33 33 static CEventScheduler* eventScheduler; 34 34 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 37 39 38 40 struct contextMessage … … 68 70 private: 69 71 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 71 75 static StdOFStream m_infoStream; 72 76 static StdOFStream m_errorStream; -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.cpp
r978 r1021 48 48 49 49 CDomainAlgorithmInterpolate::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(); 52 53 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 53 86 } 54 87 … … 351 384 } 352 385 386 if (writeToFile_ && !readFromFile_) 387 writeRemapInfo(interpMapValue); 353 388 exchangeRemapInfo(interpMapValue); 354 389 … … 434 469 void CDomainAlgorithmInterpolate::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 435 470 { 436 if ( !interpDomain_->file.isEmpty())471 if (readFromFile_ && !writeToFile_) 437 472 readRemapInfo(); 438 473 else 439 computeRemap(); 474 { 475 computeRemap(); 476 } 477 } 478 479 void CDomainAlgorithmInterpolate::writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 480 { 481 writeInterpolationInfo(fileToReadWrite_, interpMapValue); 440 482 } 441 483 442 484 void 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 { 449 486 std::map<int,std::vector<std::pair<int,double> > > interpMapValue; 450 readInterpolationInfo(file name, interpMapValue);487 readInterpolationInfo(fileToReadWrite_, interpMapValue); 451 488 452 489 exchangeRemapInfo(interpMapValue); … … 637 674 delete [] recvBuff; 638 675 } 676 677 /*! Redefined some functions of CONetCDF4 to make use of them */ 678 CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, const MPI_Comm comm) 679 : CNc4DataOutput(filename, false, false, true, comm, false, true) {} 680 int CDomainAlgorithmInterpolate::WriteNetCdf::addDimensionWrite(const StdString& name, 681 const StdSize size) 682 { 683 CONetCDF4::addDimension(name, size); 684 } 685 686 int CDomainAlgorithmInterpolate::WriteNetCdf::addVariableWrite(const StdString& name, nc_type type, 687 const std::vector<StdString>& dim) 688 { 689 CONetCDF4::addVariable(name, type, dim); 690 } 691 692 void 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 700 void 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 */ 713 void 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 } 639 779 640 780 /*! -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.hpp
r933 r1021 12 12 #include "domain_algorithm_transformation.hpp" 13 13 #include "transformation.hpp" 14 #include "nc4_data_output.hpp" 14 15 15 16 namespace xios { … … 17 18 class CDomain; 18 19 class CInterpolateDomain; 20 19 21 20 22 /*! … … 35 37 private: 36 38 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); 37 40 void processPole(std::map<int,std::vector<std::pair<int,double> > >& interMapValuePole, 38 41 int nbGlobalPointOnPole); 39 42 void computeRemap(); 40 43 void readRemapInfo(); 44 void writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >&); 41 45 void exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue); 46 42 47 private: 43 48 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 44 71 45 72 private:
Note: See TracChangeset
for help on using the changeset viewer.