Index: XIOS/dev/dev_olga/src/node/context.cpp
===================================================================
--- XIOS/dev/dev_olga/src/node/context.cpp	(revision 1567)
+++ XIOS/dev/dev_olga/src/node/context.cpp	(revision 1612)
@@ -33,4 +33,5 @@
       , idServer_(), client(0), server(0)
       , allProcessed(false), countChildCtx_(0)
+
    { /* Ne rien faire de plus */ }
 
@@ -65,8 +66,10 @@
    */
    CContextGroup* CContext::getRoot(void)
+   TRY
    {
       if (root.get()==NULL) root=std::shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName()));
       return root.get();
    }
+   CATCH
 
    //----------------------------------------------------------------
@@ -77,7 +80,9 @@
    */
    std::shared_ptr<CCalendar> CContext::getCalendar(void) const
+   TRY
    {
       return (this->calendar);
    }
+   CATCH
 
    //----------------------------------------------------------------
@@ -88,7 +93,9 @@
    */
    void CContext::setCalendar(std::shared_ptr<CCalendar> newCalendar)
+   TRY
    {
       this->calendar = newCalendar;
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
@@ -98,4 +105,5 @@
    */
    void CContext::parse(xml::CXMLNode & node)
+   TRY
    {
       CContext::SuperClass::parse(node);
@@ -152,8 +160,10 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
    //! Show tree structure of context
    void CContext::ShowTree(StdOStream & out)
+   TRY
    {
       StdString currentContextId = CContext::getCurrent() -> getId();
@@ -176,5 +186,5 @@
       CContext::setCurrent(currentContextId);
    }
-
+   CATCH
 
    //----------------------------------------------------------------
@@ -182,4 +192,5 @@
    //! Convert context object into string (to print)
    StdString CContext::toString(void) const
+   TRY
    {
       StdOStringStream oss;
@@ -201,9 +212,8 @@
 
       }
-
       oss << "</" << CContext::GetName() << " >";
-
       return (oss.str());
    }
+   CATCH
 
    //----------------------------------------------------------------
@@ -216,4 +226,5 @@
    */
    void CContext::solveDescInheritance(bool apply, const CAttributeMap * const UNUSED(parent))
+   TRY
    {
 #define DECLARE_NODE(Name_, name_)    \
@@ -223,4 +234,5 @@
 #include "node_type.conf"
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
@@ -228,4 +240,5 @@
    //! Verify if all root definition in the context have child.
    bool CContext::hasChild(void) const
+   TRY
    {
       return (
@@ -236,8 +249,10 @@
       false);
 }
+   CATCH
 
    //----------------------------------------------------------------
 
    void CContext::CleanTree(void)
+   TRY
    {
 #define DECLARE_NODE(Name_, name_) C##Name_##Definition::ClearAllAttributes();
@@ -245,8 +260,11 @@
 #include "node_type.conf"
    }
+   CATCH
+
    ///---------------------------------------------------------------
 
    //! Initialize client side
    void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer /*= 0*/)
+   TRY
    {
 
@@ -298,4 +316,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -306,4 +325,5 @@
   */
    void CContext::setClientServerBuffer(CContextClient* contextClient, bool bufferForWriting)
+   TRY
    {
       // Estimated minimum event size for small events (10 is an arbitrary constant just for safety)
@@ -352,14 +372,17 @@
      }
      contextClient->setBufferSize(bufferSize, maxEventSize);
-
-   }
+   }
+   CATCH_DUMP_ATTR
 
    //! Verify whether a context is initialized
    bool CContext::isInitialized(void)
+   TRY
    {
      return hasClient;
    }
+   CATCH_DUMP_ATTR
 
    void CContext::initServer(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtClient /*= 0*/)
+   TRY
    {
      hasServer=true;
@@ -394,7 +417,9 @@
      client = new CContextClient(this,intraCommClient,interCommClient, cxtClient);
    }
+   CATCH_DUMP_ATTR
 
    //! Try to send the buffers and receive possible answers
   bool CContext::checkBuffersAndListen(bool enableEventsProcessing /*= true*/)
+  TRY
   {
     bool clientReady, serverFinished;
@@ -434,7 +459,9 @@
     }
   }
+   CATCH_DUMP_ATTR
 
    //! Terminate a context
    void CContext::finalize(void)
+   TRY
    {
       if (hasClient && !hasServer) // For now we only use server level 1 to read data
@@ -527,7 +554,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Free internally allocated communicators
    void CContext::freeComms(void)
+   TRY
    {
      for (std::list<MPI_Comm>::iterator it = comms.begin(); it != comms.end(); ++it)
@@ -535,7 +564,9 @@
      comms.clear();
    }
+   CATCH_DUMP_ATTR
 
    //! Deallocate buffers allocated by clientContexts
    void CContext::releaseClientBuffers(void)
+   TRY
    {
      client->releaseBuffers();
@@ -543,6 +574,8 @@
        clientPrimServer[i]->releaseBuffers();
    }
+   CATCH_DUMP_ATTR
 
    void CContext::postProcessingGlobalAttributes()
+   TRY
    {
      if (allProcessed) return;  
@@ -608,6 +641,8 @@
      allProcessed = true;
    }
+   CATCH_DUMP_ATTR
 
    void CContext::sendPostProcessingGlobalAttributes()
+   TRY
    {
       // Use correct context client to send message
@@ -634,6 +669,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::recvPostProcessingGlobalAttributes(CEventServer& event)
+   TRY
    {
       CBufferIn* buffer=event.subEvents.begin()->buffer;
@@ -642,9 +679,12 @@
       get(id)->recvPostProcessingGlobalAttributes(*buffer);
    }
+   CATCH
 
    void CContext::recvPostProcessingGlobalAttributes(CBufferIn& buffer)
+   TRY
    {      
       postProcessingGlobalAttributes();
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -657,5 +697,7 @@
    and the active fields (fields will be written onto active files)
    */
+
    void CContext::closeDefinition(void)
+   TRY
    {
     CTimer::get("Context : close definition").resume() ;
@@ -688,18 +730,24 @@
     CTimer::get("Context : close definition").suspend() ;
    }
+   CATCH_DUMP_ATTR
 
    void CContext::findAllEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles)
+   TRY
    {
      for (unsigned int i = 0; i < activeFiles.size(); i++)
      (void)activeFiles[i]->getEnabledFields();
    }
+   CATCH_DUMP_ATTR
 
    void CContext::readAttributesOfEnabledFieldsInReadModeFiles()
+   TRY
    {
       for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i)
         (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode();
    }
+   CATCH_DUMP_ATTR
 
    void CContext::sendGridComponentEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles)
+   TRY
    {
      int size = activeFiles.size();
@@ -709,4 +757,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -715,4 +764,5 @@
    */
    void CContext::sendGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles)
+   TRY
    {
      int size = activeFiles.size();
@@ -722,6 +772,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::checkGridEnabledFields()
+   TRY
    {
      int size = enabledFiles.size();
@@ -731,4 +783,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -737,4 +790,5 @@
    */
    void CContext::checkGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles)
+   TRY
    {
      int size = activeFiles.size();
@@ -744,4 +798,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
     /*!
@@ -751,4 +806,5 @@
    */
    void CContext::solveOnlyRefOfEnabledFields(bool sendToServer)
+   TRY
    {
      int size = this->enabledFiles.size();
@@ -763,4 +819,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
     /*!
@@ -771,4 +828,5 @@
    */
    void CContext::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer)
+   TRY
    {
      int size = this->enabledFiles.size();
@@ -778,6 +836,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::buildFilterGraphOfEnabledFields()
+   TRY
    {
      int size = this->enabledFiles.size();
@@ -787,6 +847,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::postProcessFilterGraph()
+   TRY
    {
      int size = enabledFiles.size();
@@ -796,6 +858,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::startPrefetchingOfEnabledReadModeFiles()
+   TRY
    {
      int size = enabledReadModeFiles.size();
@@ -805,6 +869,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::doPreTimestepOperationsForEnabledReadModeFiles()
+   TRY
    {
      int size = enabledReadModeFiles.size();
@@ -814,6 +880,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::doPostTimestepOperationsForEnabledReadModeFiles()
+   TRY
    {
      int size = enabledReadModeFiles.size();
@@ -823,6 +891,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
   void CContext::findFieldsWithReadAccess(void)
+  TRY
   {
     fieldsWithReadAccess.clear();
@@ -838,18 +908,24 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   void CContext::solveAllRefOfFieldsWithReadAccess()
+  TRY
   {
     for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i)
       fieldsWithReadAccess[i]->solveAllReferenceEnabledField(false);
   }
+  CATCH_DUMP_ATTR
 
   void CContext::buildFilterGraphOfFieldsWithReadAccess()
+  TRY
   {
     for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i)
       fieldsWithReadAccess[i]->buildFilterGraph(garbageCollector, true);
   }
+  CATCH_DUMP_ATTR
 
    void CContext::solveAllInheritance(bool apply)
+   TRY
    {
      // RÃ©solution des hÃ©ritages descendants (cÃ d des hÃ©ritages de groupes)
@@ -874,6 +950,8 @@
 
    }
+  CATCH_DUMP_ATTR
 
    void CContext::findEnabledFiles(void)
+   TRY
    {
       const std::vector<CFile*> allFiles = CFile::getAll();
@@ -924,6 +1002,8 @@
 
    }
+   CATCH_DUMP_ATTR
 
    void CContext::distributeFiles(void)
+   TRY
    {
      bool distFileMemory=false ;
@@ -933,7 +1013,8 @@
      else distributeFileOverBandwith() ;
    }
-
+   CATCH_DUMP_ATTR
 
    void CContext::distributeFileOverBandwith(void)
+   TRY
    {
      double eps=std::numeric_limits<double>::epsilon()*10 ;
@@ -1015,6 +1096,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::distributeFileOverMemoryBandwith(void)
+   TRY
    {
      // If primary server
@@ -1107,6 +1190,5 @@
    }
 }
-
-
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1114,4 +1196,5 @@
    */
    void CContext::findEnabledWriteModeFiles(void)
+   TRY
    {
      int size = this->enabledFiles.size();
@@ -1123,4 +1206,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1128,4 +1212,5 @@
    */
    void CContext::findEnabledReadModeFiles(void)
+   TRY
    {
      int size = this->enabledFiles.size();
@@ -1136,6 +1221,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CContext::closeAllFile(void)
+   TRY
    {
      std::vector<CFile*>::const_iterator
@@ -1148,4 +1235,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1157,4 +1245,5 @@
    */
    bool CContext::dispatchEvent(CEventServer& event)
+   TRY
    {
 
@@ -1198,7 +1287,9 @@
       }
    }
+   CATCH
 
    //! Client side: Send a message to server to make it close
    void CContext::sendCloseDefinition(void)
+   TRY
    {
      // Use correct context client to send message
@@ -1223,7 +1314,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Server side: Receive a message of client announcing a context close
    void CContext::recvCloseDefinition(CEventServer& event)
+   TRY
    {
       CBufferIn* buffer=event.subEvents.begin()->buffer;
@@ -1232,7 +1325,9 @@
       get(id)->closeDefinition();
    }
+   CATCH
 
    //! Client side: Send a message to update calendar in each time step
    void CContext::sendUpdateCalendar(int step)
+   TRY
    {
      // Use correct context client to send message
@@ -1258,7 +1353,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Server side: Receive a message of client annoucing calendar update
    void CContext::recvUpdateCalendar(CEventServer& event)
+   TRY
    {
       CBufferIn* buffer=event.subEvents.begin()->buffer;
@@ -1267,7 +1364,9 @@
       get(id)->recvUpdateCalendar(*buffer);
    }
+   CATCH
 
    //! Server side: Receive a message of client annoucing calendar update
    void CContext::recvUpdateCalendar(CBufferIn& buffer)
+   TRY
    {
       int step;
@@ -1279,7 +1378,9 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //! Client side: Send a message to create header part of netcdf file
    void CContext::sendCreateFileHeader(void)
+   TRY
    {
      // Use correct context client to send message
@@ -1306,7 +1407,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Server side: Receive a message of client annoucing the creation of header part of netcdf file
    void CContext::recvCreateFileHeader(CEventServer& event)
+   TRY
    {
       CBufferIn* buffer=event.subEvents.begin()->buffer;
@@ -1315,14 +1418,18 @@
       get(id)->recvCreateFileHeader(*buffer);
    }
+   CATCH
 
    //! Server side: Receive a message of client annoucing the creation of header part of netcdf file
    void CContext::recvCreateFileHeader(CBufferIn& buffer)
+   TRY
    {
       if (!hasClient && hasServer) 
         createFileHeader();
    }
+   CATCH_DUMP_ATTR
 
    //! Client side: Send a message to do some post processing on server
    void CContext::sendProcessingGridOfEnabledFields()
+   TRY
    {
       // Use correct context client to send message
@@ -1348,7 +1455,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Server side: Receive a message to do some post processing
    void CContext::recvProcessingGridOfEnabledFields(CEventServer& event)
+   TRY
    {
       CBufferIn* buffer=event.subEvents.begin()->buffer;
@@ -1356,7 +1465,9 @@
       *buffer>>id;      
    }
+   CATCH
 
    //! Client side: Send a message to do some post processing on server
    void CContext::sendPostProcessing()
+   TRY
    {
       // Use correct context client to send message
@@ -1382,7 +1493,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Server side: Receive a message to do some post processing
    void CContext::recvPostProcessing(CEventServer& event)
+   TRY
    {
       CBufferIn* buffer=event.subEvents.begin()->buffer;
@@ -1391,13 +1504,17 @@
       get(id)->recvPostProcessing(*buffer);
    }
+   CATCH
 
    //! Server side: Receive a message to do some post processing
    void CContext::recvPostProcessing(CBufferIn& buffer)
+   TRY
    {
       CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar();
       postProcessing();
    }
+   CATCH_DUMP_ATTR
 
    const StdString& CContext::getIdServer()
+   TRY
    {
       if (hasClient)
@@ -1409,6 +1526,8 @@
       if (hasServer) return (this->getId());
    }
+   CATCH_DUMP_ATTR
 
    const StdString& CContext::getIdServer(const int i)
+   TRY
    {
      idServer_ = this->getId();
@@ -1417,5 +1536,5 @@
      return idServer_;
    }
-
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1426,4 +1545,5 @@
    */
    void CContext::postProcessing()
+   TRY
    {
      if (isPostProcessed) return;
@@ -1488,4 +1608,5 @@
       isPostProcessed = true;
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1498,4 +1619,5 @@
    std::map<int, StdSize> CContext::getAttributesBufferSize(std::map<int, StdSize>& maxEventSize,
                                                            CContextClient* contextClient, bool bufferForWriting /*= "false"*/)
+   TRY
    {
 	 // As calendar attributes are sent even if there are no active files or fields, maps are initialized according the size of calendar attributes
@@ -1529,4 +1651,5 @@
      return attributesSize;
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1539,4 +1662,5 @@
    std::map<int, StdSize> CContext::getDataBufferSize(std::map<int, StdSize>& maxEventSize,
                                                       CContextClient* contextClient, bool bufferForWriting /*= "false"*/)
+   TRY
    {
      std::map<int, StdSize> dataSize;
@@ -1547,5 +1671,4 @@
      for (size_t i = 0; i < numEnabledFiles; ++i)
      {
-//       CFile* file = this->enabledFiles[i];
        CFile* file = fileList[i];
        if (file->getContextClient() == contextClient)
@@ -1575,7 +1698,9 @@
      return dataSize;
    }
+   CATCH_DUMP_ATTR
 
    //! Client side: Send infomation of active files (files are enabled to write out)
    void CContext::sendEnabledFiles(const std::vector<CFile*>& activeFiles)
+   TRY
    {
      int size = activeFiles.size();
@@ -1595,7 +1720,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Client side: Send information of active fields (ones are written onto files)
    void CContext::sendEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles)
+   TRY
    {
      int size = activeFiles.size();
@@ -1605,7 +1732,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Client side: Check if the defined axis, domains and grids are eligible for compressed indexed output
    void CContext::checkAxisDomainsGridsEligibilityForCompressedOutput()
+   TRY
    {
      if (!hasClient) return;
@@ -1623,7 +1752,9 @@
        (*it)->checkEligibilityForCompressedOutput();
    }
+   CATCH_DUMP_ATTR
 
    //! Client side: Prepare the timeseries by adding the necessary files
    void CContext::prepareTimeseries()
+   TRY
    {
      if (!hasClient) return;
@@ -1723,7 +1854,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Client side: Send information of reference grid of active fields
    void CContext::sendRefGrid(const std::vector<CFile*>& activeFiles)
+   TRY
    {
      std::set<StdString> gridIds;
@@ -1757,7 +1890,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Client side: Send information of reference domain, axis and scalar of active fields
    void CContext::sendRefDomainsAxisScalars(const std::vector<CFile*>& activeFiles)
+   TRY
    {
      std::set<StdString> domainIds, axisIds, scalarIds;
@@ -1818,7 +1953,9 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    //! Update calendar in each time step
    void CContext::updateCalendar(int step)
+   TRY
    {
       int prevStep = calendar->getStep();
@@ -1850,6 +1987,8 @@
               << "Illegal calendar update: previous step was " << prevStep << ", new step " << step << "is in the past!")
    }
+   CATCH_DUMP_ATTR
 
    void CContext::initReadFiles(void)
+   TRY
    {
       vector<CFile*>::const_iterator it;
@@ -1860,7 +1999,9 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //! Server side: Create header of netcdf file
    void CContext::createFileHeader(void)
+   TRY
    {
       vector<CFile*>::const_iterator it;
@@ -1872,10 +2013,13 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //! Get current context
    CContext* CContext::getCurrent(void)
+   TRY
    {
      return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()).get();
    }
+   CATCH
 
    /*!
@@ -1884,8 +2028,10 @@
    */
    void CContext::setCurrent(const string& id)
+   TRY
    {
      CObjectFactory::SetCurrentContextId(id);
      CGroupFactory::SetCurrentContextId(id);
    }
+   CATCH
 
   /*!
@@ -1895,4 +2041,5 @@
   */
   CContext* CContext::create(const StdString& id)
+  TRY
   {
     CContext::setCurrent(id);
@@ -1910,8 +2057,9 @@
     return (context);
   }
-
+  CATCH
 
      //! Server side: Receive a message to do some post processing
   void CContext::recvRegistry(CEventServer& event)
+  TRY
   {
     CBufferIn* buffer=event.subEvents.begin()->buffer;
@@ -1920,6 +2068,8 @@
     get(id)->recvRegistry(*buffer);
   }
+  CATCH
 
   void CContext::recvRegistry(CBufferIn& buffer)
+  TRY
   {
     if (server->intraCommRank==0)
@@ -1930,6 +2080,8 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   void CContext::sendRegistry(void)
+  TRY
   {
     registryOut->hierarchicalGatherRegistry() ;
@@ -1957,4 +2109,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -1963,7 +2116,23 @@
   */
   bool CContext::isFinalized(void)
+  TRY
   {
     return finalized;
   }
+  CATCH_DUMP_ATTR
+  ///--------------------------------------------------------------
+  StdString CContext::dumpClassAttributes(void)
+  {
+    StdString str;
+    str.append("enabled files=\"");
+    int size = this->enabledFiles.size();
+    for (int i = 0; i < size; ++i)
+    {
+      str.append(enabledFiles[i]->getId());
+      str.append(" ");
+    }
+    str.append("\"");
+    return str;
+  }
 
 } // namespace xios
