Index: XIOS/dev/branch_openmp/src/interface/c/icdata.cpp
===================================================================
--- XIOS/dev/branch_openmp/src/interface/c/icdata.cpp	(revision 1545)
+++ XIOS/dev/branch_openmp/src/interface/c/icdata.cpp	(revision 1642)
@@ -9,7 +9,7 @@
 #include <iostream>
 
-#include "mpi_std.hpp"
+
 #include "xios.hpp"
-//#include "oasis_cinterface.hpp"
+#include "oasis_cinterface.hpp"
 
 #include "attribute_template.hpp"
@@ -23,5 +23,5 @@
 #include "context.hpp"
 #include "context_client.hpp"
-
+#include "mpi.hpp"
 #include "timer.hpp"
 #include "array_new.hpp"
@@ -43,14 +43,19 @@
    // it is only used from the parse_xml.exe standalone test tool.
    void cxios_init(void)
+   TRY
    {
      CXios::initialize();
    }
+   CATCH_DUMP_STACK
 
    void cxios_init_server(void)
+   TRY
    {
      CXios::initServerSide();
    }
+   CATCH_DUMP_STACK
 
    void cxios_init_client(const char* client_id , int len_client_id, MPI_Fint* f_local_comm, MPI_Fint* f_return_comm )
+   TRY
    {
       std::string str;
@@ -61,27 +66,25 @@
 
       int initialized;
-      MPI_Initialized(&initialized);
+      ep_lib::MPI_Initialized(&initialized);
       #ifdef _usingMPI
       if (initialized) local_comm=MPI_Comm_f2c(*f_local_comm);
       else local_comm=MPI_COMM_NULL;
       #elif _usingEP
-      ep_lib::fc_comm_map.clear();
-      if (initialized) local_comm=ep_lib::EP_Comm_f2c((f_local_comm));
-      else local_comm=MPI_COMM_NULL;
+      if (initialized) local_comm=EP_Comm_f2c(f_local_comm);
+      else local_comm=EP_COMM_NULL;
       #endif
-      
-
-
       CXios::initClientSide(str, local_comm, return_comm);
       #ifdef _usingMPI
       *f_return_comm=MPI_Comm_c2f(return_comm);
       #elif _usingEP
-      *f_return_comm=*static_cast<MPI_Fint*>(ep_lib::EP_Comm_c2f(return_comm));
+      *f_return_comm=*static_cast<MPI_Fint* >(EP_Comm_c2f(return_comm));
       #endif
       CTimer::get("XIOS init").suspend();
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_context_initialize(const char* context_id , int len_context_id, MPI_Fint* f_comm)
+   TRY
    {
      std::string str;
@@ -94,5 +97,5 @@
      comm=MPI_Comm_f2c(*f_comm);
      #elif _usingEP
-     comm = ep_lib::EP_Comm_f2c(f_comm);
+     comm=EP_Comm_f2c(f_comm);
      #endif
      CClient::registerContext(str, comm);
@@ -100,6 +103,17 @@
      CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
+
+   void cxios_oasis_enddef()
+   TRY
+   {
+     CTimer::get("XIOS").resume();
+     CClient::callOasisEnddef();
+     CTimer::get("XIOS").suspend();
+   }
+   CATCH_DUMP_STACK
 
    void cxios_context_is_initialized(const char* context_id , int len_context_id, bool* initialized)
+   TRY
    {
      std::string str;
@@ -111,6 +125,8 @@
      CTimer::get("XIOS").suspend();
    }
-
-    void cxios_context_close_definition()
+   CATCH_DUMP_STACK
+
+   void cxios_context_close_definition()
+   TRY
    {
      CTimer::get("XIOS").resume();
@@ -121,6 +137,8 @@
      CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_context_finalize()
+   TRY
    {
      CTimer::get("XIOS").resume();
@@ -131,6 +149,8 @@
      CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_finalize()
+   TRY
    {
      CTimer::get("XIOS").resume();
@@ -138,6 +158,8 @@
      CXios::clientFinalize();
    }
+   CATCH_DUMP_STACK
 
    void cxios_solve_inheritance()
+   TRY
    {
      CTimer::get("XIOS").resume();
@@ -146,4 +168,5 @@
      CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    /*! \brief This group of functions retrieve variable information from the configuration file (.xml)
@@ -158,4 +181,5 @@
    */
    void cxios_get_variable_data_k8(const char* varId, int varIdSize, double* data, bool* isVarExisted)
+   TRY
    {
       std::string varIdStr;
@@ -176,6 +200,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_get_variable_data_k4(const char* varId, int varIdSize, float* data, bool* isVarExisted)
+   TRY
    {
       std::string varIdStr;
@@ -196,6 +222,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_get_variable_data_int(const char* varId, int varIdSize, int* data, bool* isVarExisted)
+   TRY
    {
       std::string varIdStr;
@@ -216,6 +244,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_get_variable_data_logic(const char* varId, int varIdSize, bool* data, bool* isVarExisted)
+   TRY
    {
       std::string varIdStr;
@@ -236,6 +266,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_get_variable_data_char(const char* varId, int varIdSize, char* data, int dataSizeIn, bool* isVarExisted)
+   TRY
    {
       std::string varIdStr;
@@ -257,4 +289,5 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    /*! \brief This group of functions write information into existing variable in the configuration file (.xml)
@@ -269,5 +302,6 @@
    */
    void cxios_set_variable_data_k8(const char* varId, int varIdSize, double data, bool* isVarExisted)
-   {
+   TRY
+  {
       std::string varIdStr;
       if (!cstr2string(varId, varIdSize, varIdStr)) return;
@@ -288,6 +322,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_set_variable_data_k4(const char* varId, int varIdSize, float data, bool* isVarExisted)
+   TRY
    {
       std::string varIdStr;
@@ -309,6 +345,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_set_variable_data_int(const char* varId, int varIdSize, int data, bool* isVarExisted)
+   TRY
    {
       std::string varIdStr;
@@ -331,6 +369,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_set_variable_data_logic(const char* varId, int varIdSize, bool data, bool* isVarExisted)
+   TRY
    {
       std::string varIdStr;
@@ -352,7 +392,9 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_set_variable_data_char(const char* varId, int varIdSize, const char* data, int dataSizeIn, bool* isVarExisted)
-   {
+   TRY
+  {
       std::string varIdStr, dataStr;
       if (!cstr2string(varId, varIdSize, varIdStr)) return;
@@ -378,9 +420,10 @@
       CTimer::get("XIOS").suspend();
    }
-
+   CATCH_DUMP_STACK
 
    // ---------------------- Ecriture des donnÃ©es ------------------------------
 
    void cxios_write_data_k80(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize)
+   TRY
    {
       std::string fieldid_str;
@@ -397,6 +440,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k81(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize)
+   TRY
    {
       std::string fieldid_str;
@@ -416,6 +461,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k82(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int data_Ysize)
+   TRY
    {
       std::string fieldid_str;
@@ -435,6 +482,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k83(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int data_Ysize, int data_Zsize)
+   TRY
    {
       std::string fieldid_str;
@@ -454,6 +503,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k84(const char* fieldid, int fieldid_size, double* data_k8, int data_0size, int data_1size, int data_2size, int data_3size)
+   TRY
    {
       std::string fieldid_str;
@@ -473,8 +524,10 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k85(const char* fieldid, int fieldid_size, double* data_k8,
                              int data_0size, int data_1size, int data_2size,
                              int data_3size, int data_4size)
+   TRY
    {
       std::string fieldid_str;
@@ -494,8 +547,10 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k86(const char* fieldid, int fieldid_size, double* data_k8,
                              int data_0size, int data_1size, int data_2size,
                              int data_3size, int data_4size, int data_5size)
+   TRY
    {
       std::string fieldid_str;
@@ -515,4 +570,5 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k87(const char* fieldid, int fieldid_size, double* data_k8,
@@ -520,4 +576,5 @@
                              int data_3size, int data_4size, int data_5size,
                              int data_6size)
+   TRY
    {
       std::string fieldid_str;
@@ -537,6 +594,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k40(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize)
+   TRY
    {
       std::string fieldid_str;
@@ -556,6 +615,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k41(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize)
+   TRY
    {
       std::string fieldid_str;
@@ -577,6 +638,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k42(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int data_Ysize)
+   TRY
    {
       std::string fieldid_str;
@@ -598,6 +661,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k43(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int data_Ysize, int data_Zsize)
+   TRY
    {
       std::string fieldid_str;
@@ -619,8 +684,10 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k44(const char* fieldid, int fieldid_size, float* data_k4,
                              int data_0size, int data_1size, int data_2size,
                              int data_3size)
+   TRY
    {
       std::string fieldid_str;
@@ -642,8 +709,10 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k45(const char* fieldid, int fieldid_size, float* data_k4,
                              int data_0size, int data_1size, int data_2size,
                              int data_3size, int data_4size)
+   TRY
    {
       std::string fieldid_str;
@@ -665,8 +734,10 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k46(const char* fieldid, int fieldid_size, float* data_k4,
                              int data_0size, int data_1size, int data_2size,
                              int data_3size, int data_4size, int data_5size)
+   TRY
    {
       std::string fieldid_str;
@@ -688,4 +759,5 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    void cxios_write_data_k47(const char* fieldid, int fieldid_size, float* data_k4,
@@ -693,4 +765,5 @@
                              int data_3size, int data_4size, int data_5size,
                              int data_6size)
+   TRY
    {
       std::string fieldid_str;
@@ -712,8 +785,10 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    // ---------------------- Lecture des donnÃ©es ------------------------------
 
    void cxios_read_data_k80(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize)
+   TRY
    {
       std::string fieldid_str;
@@ -733,6 +808,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k81(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize)
+   TRY
    {
       std::string fieldid_str;
@@ -752,6 +829,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k82(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int data_Ysize)
+   TRY
    {
       std::string fieldid_str;
@@ -771,6 +850,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k83(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int data_Ysize, int data_Zsize)
+   TRY
    {
       std::string fieldid_str;
@@ -790,8 +871,10 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k84(const char* fieldid, int fieldid_size, double* data_k8,
                             int data_0size, int data_1size, int data_2size,
                             int data_3size)
+   TRY
    {
       std::string fieldid_str;
@@ -811,8 +894,10 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k85(const char* fieldid, int fieldid_size, double* data_k8,
                             int data_0size, int data_1size, int data_2size,
                             int data_3size, int data_4size)
+   TRY
    {
       std::string fieldid_str;
@@ -832,8 +917,10 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k86(const char* fieldid, int fieldid_size, double* data_k8,
                             int data_0size, int data_1size, int data_2size,
                             int data_3size, int data_4size, int data_5size)
+   TRY
    {
       std::string fieldid_str;
@@ -853,4 +940,5 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k87(const char* fieldid, int fieldid_size, double* data_k8,
@@ -858,4 +946,5 @@
                             int data_3size, int data_4size, int data_5size,
                             int data_6size)
+   TRY
    {
       std::string fieldid_str;
@@ -875,6 +964,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k40(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize)
+   TRY
    {
       std::string fieldid_str;
@@ -896,6 +987,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k41(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize)
+   TRY
    {
       std::string fieldid_str;
@@ -917,6 +1010,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k42(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int data_Ysize)
+   TRY
    {
       std::string fieldid_str;
@@ -938,6 +1033,8 @@
       CTimer::get("XIOS").suspend();
    }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k43(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int data_Ysize, int data_Zsize)
+   TRY
    {
       std::string fieldid_str;
@@ -959,8 +1056,10 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k44(const char* fieldid, int fieldid_size, float* data_k4,
                             int data_0size, int data_1size, int data_2size,
                             int data_3size)
+   TRY
    {
       std::string fieldid_str;
@@ -982,8 +1081,10 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k45(const char* fieldid, int fieldid_size, float* data_k4,
                             int data_0size, int data_1size, int data_2size,
                             int data_3size, int data_4size)
+   TRY
    {
       std::string fieldid_str;
@@ -1005,8 +1106,10 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k46(const char* fieldid, int fieldid_size, float* data_k4,
                             int data_0size, int data_1size, int data_2size,
                             int data_3size, int data_4size, int data_5size)
+   TRY
    {
       std::string fieldid_str;
@@ -1028,4 +1131,5 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 
    void cxios_read_data_k47(const char* fieldid, int fieldid_size, float* data_k4,
@@ -1033,4 +1137,5 @@
                             int data_3size, int data_4size, int data_5size,
                             int data_6size)
+   TRY
    {
       std::string fieldid_str;
@@ -1052,3 +1157,4 @@
       CTimer::get("XIOS").suspend();
     }
+   CATCH_DUMP_STACK
 } // extern "C"
