Ignore:
Timestamp:
01/31/19 12:12:52 (5 years ago)
Author:
yushan
Message:

branch merged with trunk @1645. arch file (ep&mpi) added for ADA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/src/node/file.cpp

    r1601 r1646  
    5353 
    5454   const StdString CFile::getFileOutputName(void) const 
     55   TRY 
    5556   { 
    5657     return (name.isEmpty() ? getId() : name) + (name_suffix.isEmpty() ? StdString("") :  name_suffix.getValue()); 
    5758   } 
     59   CATCH 
    5860 
    5961   //---------------------------------------------------------------- 
     
    6567   */ 
    6668   std::shared_ptr<CDataOutput> CFile::getDataOutput(void) const 
     69   TRY 
    6770   { 
    6871      return data_out; 
    6972   } 
     73   CATCH 
    7074 
    7175   /*! 
     
    7680   */ 
    7781   std::shared_ptr<CDataInput> CFile::getDataInput(void) const 
     82   TRY 
    7883   { 
    7984      return data_in; 
    8085   } 
     86   CATCH 
    8187 
    8288   /*! 
     
    8894   */ 
    8995   CFieldGroup* CFile::getVirtualFieldGroup(void) const 
     96   TRY 
    9097   { 
    9198      return (this->vFieldGroup); 
    9299   } 
     100   CATCH 
    93101 
    94102   /*! 
     
    100108   */ 
    101109   CVariableGroup* CFile::getVirtualVariableGroup(void) const 
     110   TRY 
    102111   { 
    103112      return (this->vVariableGroup); 
    104113   } 
     114   CATCH 
    105115 
    106116   //! Get all fields of a file 
    107117   std::vector<CField*> CFile::getAllFields(void) const 
     118   TRY 
    108119   { 
    109120      return (this->vFieldGroup->getAllChildren()); 
    110121   } 
     122   CATCH 
    111123 
    112124   //! Get all variables of a file 
    113125   std::vector<CVariable*> CFile::getAllVariables(void) const 
     126   TRY 
    114127   { 
    115128      return (this->vVariableGroup->getAllChildren()); 
    116129   } 
     130   CATCH 
    117131 
    118132   //---------------------------------------------------------------- 
     
    129143                                                int default_level, 
    130144                                                bool default_enabled) 
     145   TRY 
    131146   { 
    132147      if (!this->enabledFields.empty()) 
     
    145160         { 
    146161            if (! (*it)->enabled.getValue()) continue; 
    147 //            { it--; this->enabledFields.erase(it+1); continue; } 
    148162         } 
    149163         else // Si l'attribut 'enabled' n'est pas dfini ... 
    150164         { 
    151165            if (!default_enabled) continue; 
    152 //            { it--; this->enabledFields.erase(it+1); continue; } 
    153166         } 
    154167 
     
    156169         { 
    157170            if ((*it)->level.getValue() > _outputlevel) continue; 
    158 //            { it--; this->enabledFields.erase(it+1); continue; } 
    159171         } 
    160172         else // Si l'attribut 'level' n'est pas dfini ... 
    161173         { 
    162174            if (default_level > _outputlevel) continue; 
    163 //            { it--; this->enabledFields.erase(it+1); continue; } 
    164175         } 
    165176 
    166 //         CField* field_tmp=(*it).get(); 
    167 //         shared_ptr<CField> sptfield=*it; 
    168 //         field_tmp->refObject.push_back(sptfield); 
    169177         newEnabledFields.push_back(*it); 
    170          // Le champ est finalement actif, on y ajoute sa propre reference. 
    171 //         (*it)->refObject.push_back(*it); 
    172178         // Le champ est finalement actif, on y ajoute la rfrence au champ de base. 
    173179         (*it)->setRelFile(CFile::get(this)); 
     
    177183      return (this->enabledFields); 
    178184   } 
     185   CATCH_DUMP_ATTR 
    179186 
    180187   //---------------------------------------------------------------- 
    181188   //! Change virtual field group to a new one 
    182189   void CFile::setVirtualFieldGroup(CFieldGroup* newVFieldGroup) 
     190   TRY 
    183191   { 
    184192      this->vFieldGroup = newVFieldGroup; 
    185193   } 
     194   CATCH_DUMP_ATTR 
    186195 
    187196   //! Change virtual variable group to new one 
    188197   void CFile::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) 
     198   TRY 
    189199   { 
    190200      this->vVariableGroup = newVVariableGroup; 
    191201   } 
     202   CATCH_DUMP_ATTR 
    192203 
    193204   //---------------------------------------------------------------- 
    194205   bool CFile::isSyncTime(void) 
     206   TRY 
    195207   { 
    196208     CContext* context = CContext::getCurrent(); 
     
    206218      return false; 
    207219    } 
     220    CATCH_DUMP_ATTR 
    208221 
    209222   //! Initialize a file in order to write into it 
    210223   void CFile::initWrite(void) 
     224   TRY 
    211225   { 
    212226      CContext* context = CContext::getCurrent(); 
     
    261275      if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; 
    262276    } 
     277    CATCH_DUMP_ATTR 
    263278 
    264279    //! Initialize a file in order to write into it 
    265280    void CFile::initRead(void) 
     281    TRY 
    266282    { 
    267283      if (checkRead) return; 
     
    269285      checkRead = true; 
    270286    } 
     287    CATCH_DUMP_ATTR 
    271288 
    272289    /*! 
     
    274291    */ 
    275292    void CFile::createSubComFile() 
     293    TRY 
    276294    { 
    277295      CContext* context = CContext::getCurrent(); 
     
    292310      if (allZoneEmpty) ep_lib::MPI_Comm_free(&fileComm); 
    293311    } 
     312    CATCH_DUMP_ATTR 
    294313 
    295314    /* 
     
    299318    */ 
    300319    void CFile::checkWriteFile(void) 
     320    TRY 
    301321    { 
    302322      CContext* context = CContext::getCurrent(); 
     
    315335      } 
    316336    } 
     337    CATCH_DUMP_ATTR 
    317338 
    318339    /* 
     
    323344    */ 
    324345    void CFile::checkReadFile(void) 
     346    TRY 
    325347    { 
    326348      CContext* context = CContext::getCurrent(); 
     
    340362      } 
    341363    } 
     364    CATCH_DUMP_ATTR 
    342365 
    343366    /*! 
     
    346369    */ 
    347370    bool CFile::isEmptyZone() 
     371    TRY 
    348372    { 
    349373      return allZoneEmpty; 
    350374    } 
     375    CATCH_DUMP_ATTR 
    351376 
    352377    /*! 
     
    357382    */ 
    358383   bool CFile::checkSync(void) 
     384   TRY 
    359385   { 
    360386     CContext* context = CContext::getCurrent(); 
     
    371397      return false; 
    372398    } 
     399   CATCH_DUMP_ATTR 
    373400 
    374401    /*! 
     
    379406    */ 
    380407    bool CFile::checkSplit(void) 
     408    TRY 
    381409    { 
    382410      CContext* context = CContext::getCurrent(); 
     
    402430      return false; 
    403431    } 
     432    CATCH_DUMP_ATTR 
    404433 
    405434   /*! 
     
    408437   */ 
    409438   void CFile::createHeader(void) 
     439   TRY 
    410440   { 
    411441      CContext* context = CContext::getCurrent(); 
     
    517547         if (!multifile) 
    518548         { 
    519             info(0) << "!!! Warning -> Using non parallel version of netcdf, switching in multiple_file mode for file : " << filename << " ..." << endl; 
     549            #pragma omp critical (_output) 
     550            { 
     551              info(0) << "!!! Warning -> Using non parallel version of netcdf, switching in multiple_file mode for file : " << filename << " ..." << endl; 
     552            } 
    520553            multifile = true; 
    521554          } 
     
    594627      } 
    595628   } 
     629   CATCH_DUMP_ATTR 
    596630 
    597631  /*! 
     
    599633  */ 
    600634  void CFile::openInReadMode() 
     635  TRY 
    601636  { 
    602637    CContext* context = CContext::getCurrent(); 
     
    638673      if (!multifile) 
    639674      { 
    640         info(0) << "!!! Warning -> Using non parallel version of netcdf, switching in multiple_file mode for file : " << filename << " ..." << endl; 
     675        #pragma omp critical (_output) 
     676        { 
     677          info(0) << "!!! Warning -> Using non parallel version of netcdf, switching in multiple_file mode for file : " << filename << " ..." << endl; 
     678        } 
    641679        multifile = true; 
    642680      } 
     
    675713    } 
    676714  } 
     715  CATCH_DUMP_ATTR 
    677716 
    678717   //! Close file 
    679718   void CFile::close(void) 
     719   TRY 
    680720   { 
    681721     if (!allZoneEmpty) 
     
    690730      //if (fileComm != MPI_COMM_NULL) MPI_Comm_free(&fileComm); 
    691731   } 
     732   CATCH_DUMP_ATTR 
     733 
    692734   //---------------------------------------------------------------- 
    693735 
    694736   void CFile::readAttributesOfEnabledFieldsInReadMode() 
     737   TRY 
    695738   { 
    696739     if (enabledFields.empty()) return; 
     
    723766     close(); 
    724767   } 
    725  
     768   CATCH_DUMP_ATTR 
    726769 
    727770   /*! 
     
    730773   */ 
    731774   void CFile::parse(xml::CXMLNode & node) 
     775   TRY 
    732776   { 
    733777      SuperClass::parse(node); 
     
    742786        node.goToParentElement(); 
    743787      } 
    744  
    745    } 
     788   } 
     789   CATCH_DUMP_ATTR 
     790 
    746791   //---------------------------------------------------------------- 
    747792 
     
    751796   */ 
    752797   StdString CFile::toString(void) const 
     798   TRY 
    753799   { 
    754800      StdOStringStream oss; 
     
    763809      return (oss.str()); 
    764810   } 
     811   CATCH 
    765812 
    766813   //---------------------------------------------------------------- 
     
    773820   */ 
    774821   void CFile::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
     822   TRY 
    775823   { 
    776824      SuperClassAttribute::setAttributes(parent,apply); 
     
    778826      this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 
    779827   } 
     828   CATCH_DUMP_ATTR 
    780829 
    781830   //---------------------------------------------------------------- 
     
    790839   */ 
    791840   void CFile::solveOnlyRefOfEnabledFields(bool sendToServer) 
     841   TRY 
    792842   { 
    793843     int size = this->enabledFields.size(); 
     
    797847     } 
    798848   } 
     849   CATCH_DUMP_ATTR 
    799850 
    800851   void CFile::checkGridOfEnabledFields() 
     852   TRY 
    801853   {  
    802854     int size = this->enabledFields.size(); 
     
    806858     } 
    807859   } 
     860   CATCH_DUMP_ATTR 
    808861 
    809862   void CFile::sendGridComponentOfEnabledFields() 
     863   TRY 
    810864   {  
    811865     int size = this->enabledFields.size(); 
     
    815869     } 
    816870   } 
     871   CATCH_DUMP_ATTR 
    817872 
    818873   /*! 
     
    821876   */ 
    822877   void CFile::sortEnabledFieldsForUgrid() 
     878   TRY 
    823879   { 
    824880     int size = this->enabledFields.size(); 
     
    869925     } 
    870926   } 
     927   CATCH_DUMP_ATTR 
    871928 
    872929   void CFile::sendGridOfEnabledFields() 
     930   TRY 
    873931   {  
    874932     int size = this->enabledFields.size(); 
     
    878936     } 
    879937   } 
     938   CATCH_DUMP_ATTR 
    880939 
    881940   void CFile::generateNewTransformationGridDest() 
     941   TRY 
    882942   { 
    883943     int size = this->enabledFields.size(); 
     
    887947     } 
    888948   } 
     949   CATCH_DUMP_ATTR 
    889950 
    890951   /*! 
     
    897958   */ 
    898959   void CFile::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) 
     960   TRY 
    899961   { 
    900962     int size = this->enabledFields.size(); 
     
    904966     } 
    905967   } 
     968   CATCH_DUMP_ATTR 
    906969 
    907970   /*! 
     
    911974    */ 
    912975   void CFile::buildFilterGraphOfEnabledFields(CGarbageCollector& gc) 
     976   TRY 
    913977   { 
    914978     int size = this->enabledFields.size(); 
     
    918982     } 
    919983   } 
     984   CATCH_DUMP_ATTR 
    920985 
    921986   /*! 
     
    923988    */ 
    924989   void CFile::postProcessFilterGraph() 
     990   TRY 
    925991   { 
    926992     int size = this->enabledFields.size(); 
     
    930996     } 
    931997   } 
     998   CATCH_DUMP_ATTR 
    932999 
    9331000   /*! 
     
    9351002   */ 
    9361003   void CFile::prefetchEnabledReadModeFields(void) 
     1004   TRY 
    9371005   { 
    9381006     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     
    9431011       this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    9441012   } 
     1013   CATCH_DUMP_ATTR 
    9451014 
    9461015   /*! 
     
    9501019   */ 
    9511020   void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 
     1021   TRY 
    9521022   { 
    9531023     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     
    9611031     } 
    9621032   } 
     1033   CATCH_DUMP_ATTR 
    9631034 
    9641035   /*! 
     
    9671038   */ 
    9681039   void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 
     1040   TRY 
    9691041   { 
    9701042     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     
    9771049     } 
    9781050   } 
     1051   CATCH_DUMP_ATTR 
    9791052 
    9801053   void CFile::solveFieldRefInheritance(bool apply) 
     1054   TRY 
    9811055   { 
    9821056      // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. 
     
    9851059         allF[i]->solveRefInheritance(apply); 
    9861060   } 
     1061   CATCH_DUMP_ATTR 
    9871062 
    9881063   //---------------------------------------------------------------- 
     
    9971072   */ 
    9981073   CField* CFile::addField(const string& id) 
     1074   TRY 
    9991075   { 
    10001076     return vFieldGroup->createChild(id); 
    10011077   } 
     1078   CATCH_DUMP_ATTR 
    10021079 
    10031080   /*! 
     
    10091086   */ 
    10101087   CFieldGroup* CFile::addFieldGroup(const string& id) 
     1088   TRY 
    10111089   { 
    10121090     return vFieldGroup->createChildGroup(id); 
    10131091   } 
     1092   CATCH_DUMP_ATTR 
    10141093 
    10151094   /*! 
     
    10241103   */ 
    10251104   CVariable* CFile::addVariable(const string& id) 
     1105   TRY 
    10261106   { 
    10271107     return vVariableGroup->createChild(id); 
    10281108   } 
     1109   CATCH_DUMP_ATTR 
    10291110 
    10301111   /*! 
     
    10361117   */ 
    10371118   CVariableGroup* CFile::addVariableGroup(const string& id) 
     1119   TRY 
    10381120   { 
    10391121     return vVariableGroup->createChildGroup(id); 
    10401122   } 
     1123   CATCH_DUMP_ATTR 
    10411124 
    10421125   void CFile::setContextClient(CContextClient* newContextClient) 
     1126   TRY 
    10431127   { 
    10441128     client = newContextClient; 
     
    10491133     } 
    10501134   } 
     1135   CATCH_DUMP_ATTR 
    10511136 
    10521137   CContextClient* CFile::getContextClient() 
     1138   TRY 
    10531139   { 
    10541140     return client; 
    10551141   } 
     1142   CATCH_DUMP_ATTR 
    10561143 
    10571144   void CFile::setReadContextClient(CContextClient* readContextclient) 
     1145   TRY 
    10581146   { 
    10591147     read_client = readContextclient; 
    10601148   } 
     1149   CATCH_DUMP_ATTR 
    10611150 
    10621151   CContextClient* CFile::getReadContextClient() 
     1152   TRY 
    10631153   { 
    10641154     return read_client; 
    10651155   } 
     1156   CATCH_DUMP_ATTR 
    10661157 
    10671158   /*! 
     
    10701161   */ 
    10711162   void CFile::sendAddField(const string& id, CContextClient* client) 
     1163   TRY 
    10721164   { 
    10731165      sendAddItem(id, EVENT_ID_ADD_FIELD, client); 
    10741166   } 
     1167   CATCH_DUMP_ATTR 
    10751168 
    10761169   /*! 
     
    10791172   */ 
    10801173   void CFile::sendAddFieldGroup(const string& id, CContextClient* client) 
     1174   TRY 
    10811175   { 
    10821176      sendAddItem(id, (int)EVENT_ID_ADD_FIELD_GROUP, client); 
    10831177   } 
     1178   CATCH_DUMP_ATTR 
    10841179 
    10851180   /*! 
     
    10881183   */ 
    10891184   void CFile::recvAddField(CEventServer& event) 
     1185   TRY 
    10901186   { 
    10911187 
     
    10951191      get(id)->recvAddField(*buffer); 
    10961192   } 
     1193   CATCH 
    10971194 
    10981195   /*! 
     
    11011198   */ 
    11021199   void CFile::recvAddField(CBufferIn& buffer) 
     1200   TRY 
    11031201   { 
    11041202      string id; 
     
    11061204      addField(id); 
    11071205   } 
     1206   CATCH_DUMP_ATTR 
    11081207 
    11091208   /*! 
     
    11121211   */ 
    11131212   void CFile::recvAddFieldGroup(CEventServer& event) 
     1213   TRY 
    11141214   { 
    11151215 
     
    11191219      get(id)->recvAddFieldGroup(*buffer); 
    11201220   } 
     1221   CATCH 
    11211222 
    11221223   /*! 
     
    11251226   */ 
    11261227   void CFile::recvAddFieldGroup(CBufferIn& buffer) 
     1228   TRY 
    11271229   { 
    11281230      string id; 
     
    11301232      addFieldGroup(id); 
    11311233   } 
     1234   CATCH_DUMP_ATTR 
    11321235 
    11331236   /*! 
     
    11381241   */ 
    11391242   void CFile::sendAddAllVariables(CContextClient* client) 
     1243   TRY 
    11401244   { 
    11411245     std::vector<CVariable*> allVar = getAllVariables(); 
     
    11501254     } 
    11511255   } 
     1256   CATCH_DUMP_ATTR 
    11521257 
    11531258   /*! 
     
    11571262   */ 
    11581263   void CFile::sendAddVariableGroup(const string& id, CContextClient* client) 
     1264   TRY 
    11591265   { 
    11601266      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 
    11611267   } 
     1268   CATCH_DUMP_ATTR 
    11621269 
    11631270   /* 
     
    11671274   */ 
    11681275   void CFile::sendAddVariable(const string& id, CContextClient* client) 
     1276   TRY 
    11691277   { 
    11701278      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 
    11711279   } 
     1280   CATCH_DUMP_ATTR 
    11721281 
    11731282   /*! 
     
    11761285   */ 
    11771286   void CFile::recvAddVariable(CEventServer& event) 
    1178    { 
    1179  
     1287   TRY 
     1288   { 
    11801289      CBufferIn* buffer = event.subEvents.begin()->buffer; 
    11811290      string id; 
     
    11831292      get(id)->recvAddVariable(*buffer); 
    11841293   } 
     1294   CATCH 
    11851295 
    11861296   /*! 
     
    11891299   */ 
    11901300   void CFile::recvAddVariable(CBufferIn& buffer) 
     1301   TRY 
    11911302   { 
    11921303      string id; 
     
    11941305      addVariable(id); 
    11951306   } 
     1307   CATCH_DUMP_ATTR 
    11961308 
    11971309   /*! 
     
    12001312   */ 
    12011313   void CFile::recvAddVariableGroup(CEventServer& event) 
     1314   TRY 
    12021315   { 
    12031316 
     
    12071320      get(id)->recvAddVariableGroup(*buffer); 
    12081321   } 
     1322   CATCH 
    12091323 
    12101324   /*! 
     
    12131327   */ 
    12141328   void CFile::recvAddVariableGroup(CBufferIn& buffer) 
     1329   TRY 
    12151330   { 
    12161331      string id; 
     
    12181333      addVariableGroup(id); 
    12191334   } 
     1335   CATCH_DUMP_ATTR 
    12201336 
    12211337   /*! 
     
    12271343   */ 
    12281344   void CFile::sendEnabledFields(CContextClient* client) 
     1345   TRY 
    12291346   { 
    12301347     size_t size = this->enabledFields.size(); 
     
    12381355     } 
    12391356   } 
    1240  
     1357   CATCH_DUMP_ATTR 
    12411358 
    12421359   /*! 
     
    12481365   */ 
    12491366   bool CFile::dispatchEvent(CEventServer& event) 
     1367   TRY 
    12501368   { 
    12511369      if (SuperClass::dispatchEvent(event)) return true; 
     
    12791397      } 
    12801398   } 
    1281  
    1282  
    1283  
     1399   CATCH 
     1400 
     1401   ///-------------------------------------------------------------- 
     1402   /*! 
     1403   */ 
     1404   StdString CFile::dumpClassAttributes(void) 
     1405   { 
     1406     StdString str; 
     1407     CContext* context = CContext::getCurrent(); 
     1408     str.append("context=\""); 
     1409     str.append(context->getId()); 
     1410     str.append("\""); 
     1411     str.append(" enabled fields=\""); 
     1412     int size = this->enabledFields.size(); 
     1413     for (int i = 0; i < size; ++i) 
     1414     { 
     1415       str.append(this->enabledFields[i]->getId()); 
     1416       str.append(" "); 
     1417     } 
     1418     str.append("\""); 
     1419     return str; 
     1420   } 
    12841421 
    12851422   ///--------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.