Index: XIOS/trunk/src/node/grid.cpp
===================================================================
--- XIOS/trunk/src/node/grid.cpp	(revision 632)
+++ XIOS/trunk/src/node/grid.cpp	(revision 650)
@@ -21,5 +21,5 @@
    CGrid::CGrid(void)
       : CObjectTemplate<CGrid>(), CGridAttributes()
-      , isChecked(false), isDomainAxisChecked(false), storeIndex(1)
+      , isChecked(false), isDomainAxisChecked(false)
       , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false)
       , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_()
@@ -31,7 +31,7 @@
    }
 
-   CGrid::CGrid(const StdString & id)
+   CGrid::CGrid(const StdString& id)
       : CObjectTemplate<CGrid>(id), CGridAttributes()
-      , isChecked(false), isDomainAxisChecked(false), storeIndex(1)
+      , isChecked(false), isDomainAxisChecked(false)
       , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false)
       , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_()
@@ -45,9 +45,4 @@
    CGrid::~CGrid(void)
    {
-    deque< CArray<int, 1>* >::iterator it ;
-
-    for(deque< CArray<int,1>* >::iterator it=storeIndex.begin(); it!=storeIndex.end();it++)  delete *it ;
-    for(map<int,CArray<size_t,1>* >::iterator it=outIndexFromClient.begin();it!=outIndexFromClient.end();++it) delete (it->second);
-
     if (0 != clientDistribution_) delete clientDistribution_;
     if (0 != serverDistribution_) delete serverDistribution_;
@@ -58,113 +53,17 @@
    ///---------------------------------------------------------------
 
-   StdString CGrid::GetName(void)    { return (StdString("grid")); }
-   StdString CGrid::GetDefName(void) { return (CGrid::GetName()); }
-   ENodeType CGrid::GetType(void)    { return (eGrid); }
-
-   //----------------------------------------------------------------
-
-   const std::deque< CArray<int,1>* > & CGrid::getStoreIndex(void) const
-   {
-      return (this->storeIndex );
-   }
+   StdString CGrid::GetName(void)    { return StdString("grid"); }
+   StdString CGrid::GetDefName(void) { return CGrid::GetName(); }
+   ENodeType CGrid::GetType(void)    { return eGrid; }
 
    //---------------------------------------------------------------
-//
-//   const std::deque< CArray<int,1>* > & CGrid::getOutIIndex(void)  const
-//   {
-//      return (this->out_i_index );
-//   }
-//
-//   //---------------------------------------------------------------
-//
-//   const std::deque< CArray<int,1>* > & CGrid::getOutJIndex(void)  const
-//   {
-//      return (this->out_j_index );
-//   }
-//
-//   //---------------------------------------------------------------
-//
-//   const std::deque< CArray<int,1>* > & CGrid::getOutLIndex(void)  const
-//   {
-//      return (this->out_l_index );
-//   }
-//
-//   //---------------------------------------------------------------
-//
-//   const CAxis*   CGrid::getRelAxis  (void) const
-//   {
-//      return (this->axis );
-//   }
-
-//   //---------------------------------------------------------------
-//
-//   const CDomain* CGrid::getRelDomain(void) const
-//   {
-//      return (this->domain );
-//   }
+
+   StdSize CGrid::getDimension(void) const
+   {
+      return globalDim_.size();
+   }
 
    //---------------------------------------------------------------
 
-//   bool CGrid::hasAxis(void) const
-//   {
-//      return (this->withAxis);
-//   }
-
-   //---------------------------------------------------------------
-
-   StdSize CGrid::getDimension(void) const
-   {
-      return (globalDim_.size());
-   }
-
-   //---------------------------------------------------------------
-
-/*
-   std::vector<StdSize> CGrid::getLocalShape(void) const
-   {
-      std::vector<StdSize> retvalue;
-      retvalue.push_back(domain->zoom_ni_loc.getValue());
-      retvalue.push_back(domain->zoom_nj_loc.getValue());
-      if (this->withAxis)
-         retvalue.push_back(this->axis->zoom_size.getValue());
-      return (retvalue);
-   }
-*/
-   //---------------------------------------------------------------
-
-/*
-   StdSize CGrid::getLocalSize(void) const
-   {
-      StdSize retvalue = 1;
-      std::vector<StdSize> shape_ = this->getLocalShape();
-      for (StdSize s = 0; s < shape_.size(); s++)
-         retvalue *= shape_[s];
-      return (retvalue);
-   }
-*/
-   //---------------------------------------------------------------
-/*
-   std::vector<StdSize> CGrid::getGlobalShape(void) const
-   {
-      std::vector<StdSize> retvalue;
-      retvalue.push_back(domain->ni.getValue());
-      retvalue.push_back(domain->nj.getValue());
-      if (this->withAxis)
-         retvalue.push_back(this->axis->size.getValue());
-      return (retvalue);
-   }
-*/
-   //---------------------------------------------------------------
-
-/*
-   StdSize CGrid::getGlobalSize(void) const
-   {
-      StdSize retvalue = 1;
-      std::vector<StdSize> shape_ = this->getGlobalShape();
-      for (StdSize s = 0; s < shape_.size(); s++)
-         retvalue *= shape_[s];
-      return (retvalue);
-   }
-*/
    StdSize CGrid::getDataSize(void) const
    {
@@ -228,6 +127,6 @@
    void CGrid::checkMaskIndex(bool doSendingIndex)
    {
-     CContext* context = CContext::getCurrent() ;
-     CContextClient* client=context->client ;
+     CContext* context = CContext::getCurrent();
+     CContextClient* client=context->client;
 
      if (isScalarGrid())
@@ -253,7 +152,6 @@
      if (context->hasClient)
      {
-        checkMask() ;
-        this->computeIndex() ;
-        this->storeIndex.push_front(new CArray<int,1>() );
+        checkMask();
+        this->computeIndex();
      }
      this->isChecked = true;
@@ -382,6 +280,6 @@
    void CGrid::computeIndex(void)
    {
-     CContext* context = CContext::getCurrent() ;
-     CContextClient* client=context->client ;
+     CContext* context = CContext::getCurrent();
+     CContextClient* client = context->client;
 
      // First of all, compute distribution on client side
@@ -477,5 +375,5 @@
       CGrid* grid = createGrid(vecDom, vecAxis, axisDomainOrder);
 
-      return (grid);
+      return grid;
    }
 
@@ -487,5 +385,5 @@
       CGrid* grid = createGrid(vecDom, vecAxis, axisDomainOrder);
 
-      return (grid);
+      return grid;
    }
 
@@ -494,9 +392,9 @@
       StdString new_id = StdString("__");
       if (!domains.empty()) for (int i = 0; i < domains.size(); ++i) new_id += domains[i]->getId() + StdString("_");
-      if (!axis.empty()) for (int i = 0; i < axis.size(); ++i) new_id += axis[i]->getId() + StdString("_") ;
+      if (!axis.empty()) for (int i = 0; i < axis.size(); ++i) new_id += axis[i]->getId() + StdString("_");
       if (domains.empty() && axis.empty()) new_id += StdString("scalar_grid");
       new_id += StdString("_");
 
-      CGrid* grid = CGridGroup::get("grid_definition")->createChild(new_id) ;
+      CGrid* grid = CGridGroup::get("grid_definition")->createChild(new_id);
       grid->setDomainList(domains);
       grid->setAxisList(axis);
@@ -521,24 +419,24 @@
       grid->computeGridGlobalDimension(domains, axis, grid->axis_domain_order);
 
-      return (grid);
+      return grid;
    }
 
    CDomainGroup* CGrid::getVirtualDomainGroup() const
    {
-     return (this->vDomainGroup_);
+     return this->vDomainGroup_;
    }
 
    CAxisGroup* CGrid::getVirtualAxisGroup() const
    {
-     return (this->vAxisGroup_);
+     return this->vAxisGroup_;
    }
 
    void CGrid::outputField(int rank, const CArray<double, 1>& stored, double* field)
    {
-     CArray<size_t,1>& out_i=*outIndexFromClient[rank];
+     const CArray<size_t,1>& out_i = outIndexFromClient[rank];
      StdSize numElements = stored.numElements();
      for (StdSize n = 0; n < numElements; ++n)
      {
-       *(field+out_i(n)) = stored(n);
+       field[out_i(n)] = stored(n);
      }
    }
@@ -546,9 +444,9 @@
    void CGrid::inputField(int rank, const double* const field, CArray<double,1>& stored)
    {
-     CArray<size_t,1>& out_i = *outIndexFromClient[rank];
+     const CArray<size_t,1>& out_i = outIndexFromClient[rank];
      StdSize numElements = stored.numElements();
      for (StdSize n = 0; n < numElements; ++n)
      {
-       stored(n) = *(field+out_i(n));
+       stored(n) = field[out_i(n)];
      }
    }
@@ -556,20 +454,17 @@
    //----------------------------------------------------------------
 
-
-   void CGrid::storeField_arr
-      (const double * const data, CArray<double, 1>& stored) const
-   {
-      const StdSize size = storeIndex_client.numElements() ;
-
-      stored.resize(size) ;
-      for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)] ;
-   }
-
-   void CGrid::restoreField_arr
-      (const CArray<double, 1>& stored, double * const data) const
-   {
-      const StdSize size = storeIndex_client.numElements() ;
-
-      for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i) ;
+   void CGrid::storeField_arr(const double* const data, CArray<double, 1>& stored) const
+   {
+      const StdSize size = storeIndex_client.numElements();
+
+      stored.resize(size);
+      for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)];
+   }
+
+   void CGrid::restoreField_arr(const CArray<double, 1>& stored, double* const data) const
+   {
+      const StdSize size = storeIndex_client.numElements();
+
+      for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i);
    }
 
@@ -591,10 +486,11 @@
   void CGrid::sendIndexScalarGrid()
   {
-    CContext* context = CContext::getCurrent() ;
-    CContextClient* client=context->client ;
-
-    CEventClient event(getType(),EVENT_ID_INDEX);
-    list<shared_ptr<CMessage> > list_msg ;
-    list< CArray<size_t,1>* > listOutIndex;
+    CContext* context = CContext::getCurrent();
+    CContextClient* client = context->client;
+
+    CEventClient event(getType(), EVENT_ID_INDEX);
+    list<CMessage> listMsg;
+    list<CArray<size_t,1> > listOutIndex;
+
     if (0 == client->clientRank)
     {
@@ -602,6 +498,10 @@
       {
         int nb = 1;
-        CArray<size_t, 1> outGlobalIndexOnServer(nb);
-        CArray<int, 1> outLocalIndexToServer(nb);
+        storeIndex_toSrv.insert(std::make_pair(rank, CArray<int,1>(nb)));
+        listOutIndex.push_back(CArray<size_t,1>(nb));
+
+        CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv[rank];
+        CArray<size_t, 1>& outGlobalIndexOnServer = listOutIndex.back();
+
         for (int k = 0; k < nb; ++k)
         {
@@ -610,29 +510,25 @@
         }
 
-        storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(outLocalIndexToServer) ));
-        listOutIndex.push_back(new CArray<size_t,1>(outGlobalIndexOnServer));
-
-        list_msg.push_back(shared_ptr<CMessage>(new CMessage));
-        *list_msg.back()<<getId()<<isDataDistributed_<<*listOutIndex.back();
-
-        event.push(rank, 1, *list_msg.back());
-      }
+        listMsg.push_back(CMessage());
+        listMsg.back() << getId( )<< isDataDistributed_ << listOutIndex.back();
+
+        event.push(rank, 1, listMsg.back());
+      }
+
       client->sendEvent(event);
     }
     else
       client->sendEvent(event);
-
-    for(list<CArray<size_t,1>* >::iterator it=listOutIndex.begin();it!=listOutIndex.end();++it) delete *it ;
   }
 
   void CGrid::sendIndex(void)
   {
-    CContext* context = CContext::getCurrent() ;
-    CContextClient* client=context->client ;
-
-    CEventClient event(getType(),EVENT_ID_INDEX) ;
-    int rank ;
-    list<shared_ptr<CMessage> > list_msg ;
-    list< CArray<size_t,1>* > listOutIndex;
+    CContext* context = CContext::getCurrent();
+    CContextClient* client = context->client;
+
+    CEventClient event(getType(), EVENT_ID_INDEX);
+    int rank;
+    list<CMessage> listMsg;
+    list<CArray<size_t,1> > listOutIndex;
     const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer();
     const CArray<int,1>& localIndexSendToServer = clientDistribution_->getLocalDataIndexSendToServer();
@@ -643,16 +539,18 @@
       if (0 == client->clientRank)
       {
-        CArray<size_t, 1> outGlobalIndexOnServer = globalIndexSendToServer;
-        CArray<int,1> outLocalIndexToServer = localIndexSendToServer;
+        const CArray<size_t, 1>& outGlobalIndexOnServer = globalIndexSendToServer;
+        const CArray<int,1>& outLocalIndexToServer = localIndexSendToServer;
+
         for (rank = 0; rank < client->serverSize; ++rank)
         {
-          storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(outLocalIndexToServer)));
-          listOutIndex.push_back(new CArray<size_t,1>(outGlobalIndexOnServer));
-
-          list_msg.push_back(shared_ptr<CMessage>(new CMessage));
-          *list_msg.back()<<getId()<<isDataDistributed_<<*listOutIndex.back();
-
-          event.push(rank, 1, *list_msg.back());
-        }
+          storeIndex_toSrv.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer)));
+          listOutIndex.push_back(CArray<size_t,1>(outGlobalIndexOnServer));
+
+          listMsg.push_back(CMessage());
+          listMsg.back() << getId() << isDataDistributed_ << listOutIndex.back();
+
+          event.push(rank, 1, listMsg.back());
+        }
+
         client->sendEvent(event);
       }
@@ -669,4 +567,5 @@
       std::map<int,std::vector<int> >localIndexTmp;
       std::map<int,std::vector<size_t> > globalIndexTmp;
+
       for (; itGlobalMap != iteGlobalMap; ++itGlobalMap)
       {
@@ -691,6 +590,10 @@
           nb = globalIndexTmp[rank].size();
 
-        CArray<size_t, 1> outGlobalIndexOnServer(nb);
-        CArray<int, 1> outLocalIndexToServer(nb);
+        storeIndex_toSrv.insert(make_pair(rank, CArray<int,1>(nb)));
+        listOutIndex.push_back(CArray<size_t,1>(nb));
+
+        CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv[rank];
+        CArray<size_t, 1>& outGlobalIndexOnServer = listOutIndex.back();
+
         for (int k = 0; k < nb; ++k)
         {
@@ -699,17 +602,12 @@
         }
 
-        storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(outLocalIndexToServer) ));
-        listOutIndex.push_back(new CArray<size_t,1>(outGlobalIndexOnServer));
-
-        list_msg.push_back(shared_ptr<CMessage>(new CMessage));
-        *list_msg.back()<<getId()<<isDataDistributed_<<*listOutIndex.back();
-
-        event.push(rank, nbSenders[rank], *list_msg.back());
+        listMsg.push_back(CMessage());
+        listMsg.back() << getId() << isDataDistributed_ << listOutIndex.back();
+
+        event.push(rank, nbSenders[rank], listMsg.back());
       }
 
       client->sendEvent(event);
     }
-
-    for(list<CArray<size_t,1>* >::iterator it=listOutIndex.begin();it!=listOutIndex.end();++it) delete *it ;
   }
 
@@ -721,5 +619,5 @@
 
     list<CEventServer::SSubEvent>::iterator it;
-    for (it=event.subEvents.begin();it!=event.subEvents.end();++it)
+    for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it)
     {
       ranks.push_back(it->rank);
@@ -728,5 +626,5 @@
       buffers.push_back(buffer);
     }
-    get(gridId)->recvIndex(ranks, buffers) ;
+    get(gridId)->recvIndex(ranks, buffers);
   }
 
@@ -768,15 +666,8 @@
     Verify whether one server need to write data
     There are some cases on which one server has nodata to write. For example, when we
-  just only want to zoom on a domain.
+    just only want to zoom on a domain.
   */
   bool CGrid::doGridHaveDataToWrite()
   {
-//    size_t ssize = 0;
-//    for (map<int, CArray<size_t, 1>* >::const_iterator it = outIndexFromClient.begin();
-//                                                       it != outIndexFromClient.end(); ++it)
-//    {
-//      ssize += (it->second)->numElements();
-//    }
-//    return (0 != ssize);
      return (0 != writtenDataSize_);
   }
@@ -785,6 +676,6 @@
     Return size of data which is written on each server
     Whatever dimension of a grid, data which are written on server must be presented as
-  an one dimension array.
-  \return size of data written on server
+    an one dimension array.
+    \return size of data written on server
   */
   size_t CGrid::getWrittenDataSize() const
@@ -828,5 +719,5 @@
         CArray<size_t,1> outIndex;
         buffer >> outIndex;
-        outIndexFromClient.insert(std::pair<int, CArray<size_t,1>* >(rank, new CArray<size_t,1>(outIndex)));
+        outIndexFromClient.insert(std::make_pair(rank, outIndex));
         std::vector<int> nZoomBegin(1,0), nZoomSize(1,1), nGlob(1,1), nZoomBeginGlobal(1,0);
         serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize,
@@ -899,5 +790,5 @@
       writtenDataSize_ += dataSize;
 
-      outIndexFromClient.insert(std::pair<int, CArray<size_t,1>* >(rank, new CArray<size_t,1>(outIndex)));
+      outIndexFromClient.insert(std::make_pair(rank, outIndex));
       connectedDataSize_[rank] = outIndex.numElements();
     }
@@ -916,5 +807,5 @@
   {
 
-    if (SuperClass::dispatchEvent(event)) return true ;
+    if (SuperClass::dispatchEvent(event)) return true;
     else
     {
@@ -922,57 +813,35 @@
       {
         case EVENT_ID_INDEX :
-          recvIndex(event) ;
-          return true ;
-          break ;
+          recvIndex(event);
+          return true;
+          break;
 
          case EVENT_ID_ADD_DOMAIN :
-           recvAddDomain(event) ;
-           return true ;
-           break ;
+           recvAddDomain(event);
+           return true;
+           break;
 
          case EVENT_ID_ADD_AXIS :
-           recvAddAxis(event) ;
-           return true ;
-           break ;
+           recvAddAxis(event);
+           return true;
+           break;
         default :
           ERROR("bool CDomain::dispatchEvent(CEventServer& event)",
-                <<"Unknown Event") ;
-          return false ;
-      }
-    }
-  }
-
-   void CGrid::inputFieldServer(const std::deque< CArray<double, 1>* > storedClient, CArray<double, 1>&  storedServer) const
-   {
-      if ((this->storeIndex.size()-1 ) != storedClient.size())
-         ERROR("void CGrid::inputFieldServer(const std::deque< CArray<double, 1>* > storedClient, CArray<double, 1>&  storedServer) const",
-                << "[ Expected received field = " << (this->storeIndex.size()-1) << ", "
-                << "[ received fiedl = "    << storedClient.size() << "] "
-                << "Data from clients are missing!") ;
-      storedServer.resize(storeIndex[0]->numElements());
-
-      for (StdSize i = 0, n = 0; i < storedClient.size(); i++)
-         for (StdSize j = 0; j < storedClient[i]->numElements(); j++)
-            storedServer(n++) = (*storedClient[i])(j);
-   }
-
-   void CGrid::outputFieldToServer(CArray<double,1>& fieldIn, int rank, CArray<double,1>& fieldOut)
-   {
-     CArray<int,1>& index = *storeIndex_toSrv[rank] ;
-     int nb=index.numElements() ;
-     fieldOut.resize(nb) ;
-
-     for(int k=0;k<nb;k++) fieldOut(k)=fieldIn(index(k)) ;
-    }
+                << "Unknown Event");
+          return false;
+      }
+    }
+  }
+
    ///---------------------------------------------------------------
 
    CDomain* CGrid::addDomain(const std::string& id)
    {
-     return vDomainGroup_->createChild(id) ;
+     return vDomainGroup_->createChild(id);
    }
 
    CAxis* CGrid::addAxis(const std::string& id)
    {
-     return vAxisGroup_->createChild(id) ;
+     return vAxisGroup_->createChild(id);
    }
 
@@ -1008,22 +877,22 @@
    void CGrid::sendAddDomain(const string& id)
    {
-    CContext* context=CContext::getCurrent() ;
+    CContext* context=CContext::getCurrent();
 
     if (! context->hasServer )
     {
-       CContextClient* client=context->client ;
-
-       CEventClient event(this->getType(),EVENT_ID_ADD_DOMAIN) ;
+       CContextClient* client=context->client;
+
+       CEventClient event(this->getType(),EVENT_ID_ADD_DOMAIN);
        if (client->isServerLeader())
        {
-         CMessage msg ;
-         msg<<this->getId() ;
-         msg<<id ;
+         CMessage msg;
+         msg<<this->getId();
+         msg<<id;
          const std::list<int>& ranks = client->getRanksServerLeader();
          for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
            event.push(*itRank,1,msg);
-         client->sendEvent(event) ;
+         client->sendEvent(event);
        }
-       else client->sendEvent(event) ;
+       else client->sendEvent(event);
     }
    }
@@ -1035,22 +904,22 @@
    void CGrid::sendAddAxis(const string& id)
    {
-    CContext* context=CContext::getCurrent() ;
+    CContext* context=CContext::getCurrent();
 
     if (! context->hasServer )
     {
-       CContextClient* client=context->client ;
-
-       CEventClient event(this->getType(),EVENT_ID_ADD_AXIS) ;
+       CContextClient* client=context->client;
+
+       CEventClient event(this->getType(),EVENT_ID_ADD_AXIS);
        if (client->isServerLeader())
        {
-         CMessage msg ;
-         msg<<this->getId() ;
-         msg<<id ;
+         CMessage msg;
+         msg<<this->getId();
+         msg<<id;
          const std::list<int>& ranks = client->getRanksServerLeader();
          for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
            event.push(*itRank,1,msg);
-         client->sendEvent(event) ;
+         client->sendEvent(event);
        }
-       else client->sendEvent(event) ;
+       else client->sendEvent(event);
     }
    }
@@ -1063,8 +932,8 @@
    {
 
-      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      CBufferIn* buffer = event.subEvents.begin()->buffer;
       string id;
-      *buffer>>id ;
-      get(id)->recvAddDomain(*buffer) ;
+      *buffer >> id;
+      get(id)->recvAddDomain(*buffer);
    }
 
@@ -1075,7 +944,7 @@
    void CGrid::recvAddDomain(CBufferIn& buffer)
    {
-      string id ;
-      buffer>>id ;
-      addDomain(id) ;
+      string id;
+      buffer >> id;
+      addDomain(id);
    }
 
@@ -1087,8 +956,8 @@
    {
 
-      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      CBufferIn* buffer = event.subEvents.begin()->buffer;
       string id;
-      *buffer>>id ;
-      get(id)->recvAddAxis(*buffer) ;
+      *buffer >> id;
+      get(id)->recvAddAxis(*buffer);
    }
 
@@ -1099,7 +968,7 @@
    void CGrid::recvAddAxis(CBufferIn& buffer)
    {
-      string id ;
-      buffer>>id ;
-      addAxis(id) ;
+      string id;
+      buffer >> id;
+      addAxis(id);
    }
 
@@ -1169,6 +1038,6 @@
       ERROR("CGrid::transformGrid(CGrid* transformGridSrc)",
            << "Two grids have different dimension size"
-           << "Dimension of grid destination " <<this->getId() << " is " << axis_domain_order.numElements() << std::endl
-           << "Dimension of grid source " <<transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements());
+           << "Dimension of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl
+           << "Dimension of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements());
     }
     else
@@ -1178,5 +1047,5 @@
         if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i))
           ERROR("CGrid::transformGrid(CGrid* transformGridSrc)",
-                << "Grids " <<this->getId() <<" and " << transformGridSrc->getId()
+                << "Grids " << this->getId() << " and " << transformGridSrc->getId()
                 << " don't have elements in the same order");
     }
@@ -1229,5 +1098,5 @@
       int sizeDom = domList.size();
       domList_.resize(sizeDom);
-      for (int i = 0 ; i < sizeDom; ++i)
+      for (int i = 0; i < sizeDom; ++i)
       {
         domList_[i] = domList[i]->getId();
@@ -1302,5 +1171,5 @@
   }
 
-  void CGrid::parse(xml::CXMLNode & node)
+  void CGrid::parse(xml::CXMLNode& node)
   {
     SuperClass::parse(node);
@@ -1323,5 +1192,5 @@
           this->getVirtualAxisGroup()->parseChild(node);
         }
-      } while (node.goToNextElement()) ;
+      } while (node.goToNextElement());
       node.goToParentElement();
     }
@@ -1340,4 +1209,3 @@
     setAxisList();
    }
-
 } // namespace xios
