Index: XIOS/dev/branch_openmp/src/node/field.cpp
===================================================================
--- XIOS/dev/branch_openmp/src/node/field.cpp	(revision 1482)
+++ XIOS/dev/branch_openmp/src/node/field.cpp	(revision 1545)
@@ -219,5 +219,5 @@
       // Gather all data from different clients      
       recvDataSrv.resize(storeClient.numElements());
-      recvFoperationSrv = boost::shared_ptr<func::CFunctor>(new func::CInstant(recvDataSrv));
+      recvFoperationSrv = std::shared_ptr<func::CFunctor>(new func::CInstant(recvDataSrv));
     }
 
@@ -505,5 +505,4 @@
     if (!nstepMaxRead)
     {
-       //MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm);
        MPI_Allreduce(&nstepMax, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm);
        nstepMaxRead = true;
@@ -720,5 +719,5 @@
    //----------------------------------------------------------------
 
-   boost::shared_ptr<COutputPin> CField::getInstantDataFilter()
+   std::shared_ptr<COutputPin> CField::getInstantDataFilter()
    {
      return instantDataFilter;
@@ -988,5 +987,5 @@
               << "An operation must be defined for field \"" << getId() << "\".");
 
-      boost::shared_ptr<func::CFunctor> functor;
+      std::shared_ptr<func::CFunctor> functor;
       CArray<double, 1> dummyData;
 
@@ -1031,5 +1030,5 @@
      {
         if (!instantDataFilter)
-          instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true));
+          instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true));
 
 
@@ -1039,5 +1038,5 @@
          if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
          {
-           fileServerWriterFilter = boost::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this));
+           fileServerWriterFilter = std::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this));
            instantDataFilter->connectOutput(fileServerWriterFilter, 0);
          }
@@ -1047,5 +1046,5 @@
      {
        if (!instantDataFilter)
-         instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true));
+         instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true));
 
              // If the field data is to be read by the client or/and written to a file
@@ -1054,5 +1053,5 @@
          if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
          {
-           fileWriterFilter = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));
+           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));
            instantDataFilter->connectOutput(fileWriterFilter, 0);
          }
@@ -1068,5 +1067,5 @@
          {
            boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0'));
-           boost::shared_ptr<COutputPin> filter = expr->reduce(gc, *this);
+           std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this);
 
            // Check if a spatial transformation is needed
@@ -1077,5 +1076,5 @@
              if (grid && grid != gridRef && grid->hasTransform())
              {
-                 std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); 
+                 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); 
 
                filter->connectOutput(filters.first, 0);
@@ -1093,5 +1092,5 @@
          {
            checkTimeAttributes();
-           instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true,
+           instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true,
                                                                                                        detectMissingValues, defaultValue));
          }
@@ -1099,5 +1098,5 @@
          {
             if (check_if_active.isEmpty()) check_if_active = false; 
-            instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false,
+            instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false,
                                                                                                         detectMissingValues, defaultValue));
          }
@@ -1109,5 +1108,5 @@
          if (!read_access.isEmpty() && read_access)
          {
-           storeFilter = boost::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid,
+           storeFilter = std::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid,
                                                                           detectMissingValues, defaultValue));
            instantDataFilter->connectOutput(storeFilter, 0);
@@ -1116,5 +1115,5 @@
          if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
          {
-           fileWriterFilter = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));
+           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));
            getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0);
          }
@@ -1130,5 +1129,5 @@
     * \return the output pin corresponding to the field reference
     */
-   boost::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc)
+   std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc)
    {
      if (instantDataFilter || field_ref.isEmpty())
@@ -1139,5 +1138,5 @@
      fieldRef->buildFilterGraph(gc, false);
 
-     std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters;
+     std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters;
      // Check if a spatial transformation is needed
      if (grid && grid != fieldRef->grid && grid->hasTransform())
@@ -1148,5 +1147,5 @@
      }
      else
-       filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc));
+       filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc));
 
      fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0);
@@ -1164,5 +1163,5 @@
     * \return the output pin corresponding to a self reference
     */
-   boost::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc)
+   std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc)
    {
      if (instantDataFilter || !hasExpression())
@@ -1180,5 +1179,5 @@
          {
            checkTimeAttributes();
-           serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true,
+           serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true,
                                                                                    detectMissingValues, defaultValue));
          }
@@ -1197,5 +1196,5 @@
          {
            if (check_if_active.isEmpty()) check_if_active = false;
-           clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, NoneDu, false,
+           clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, NoneDu, false,
                                                                                    detectMissingValues, defaultValue));
          }
@@ -1217,7 +1216,7 @@
     * \return the output pin corresponding to the requested temporal filter
     */
-   boost::shared_ptr<COutputPin> CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)
-   {
-     std::map<CDuration, boost::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq);
+   std::shared_ptr<COutputPin> CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)
+   {
+     std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq);
 
      if (it == temporalDataFilters.end())
@@ -1230,5 +1229,5 @@
 
        const bool detectMissingValues = (!detect_missing_value.isEmpty()  && detect_missing_value == true);
-       boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation,
+       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation,
                                                                              CContext::getCurrent()->getCalendar()->getInitDate(),
                                                                              freq_op, freq_offset, outFreq, detectMissingValues));
@@ -1251,5 +1250,5 @@
     */
    
-   boost::shared_ptr<COutputPin> CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)
+   std::shared_ptr<COutputPin> CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)
    {
      if (instantDataFilter || !hasExpression())
@@ -1268,5 +1267,5 @@
 
        const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true);
-       boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation,
+       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation,
                                                                              CContext::getCurrent()->getCalendar()->getInitDate(),
                                                                              freq_op, freq_offset, outFreq, detectMissingValues));
@@ -1319,4 +1318,9 @@
         std::vector<CScalar*> vecScalar;
         std::vector<int> axisDomainOrderTmp;
+
+        std::vector<CDomain*> vecDomRef;
+        std::vector<CAxis*> vecAxisRef;
+        std::vector<CScalar*> vecScalarRef;
+
         
         if (!domain_ref.isEmpty())
@@ -1326,9 +1330,10 @@
           {
             vecDom.push_back(CDomain::get(domain_ref));
+            vecDomRef.push_back(CDomain::createDomain());
+            vecDomRef.back()->domain_ref=domain_ref;
             axisDomainOrderTmp.push_back(2);
           }
-          else
-            ERROR("CField::solveGridReference(void)",
-                  << "Invalid reference to domain '" << domain_ref.getValue() << "'.");
+          else  ERROR("CField::solveGridReference(void)",
+                      << "Invalid reference to domain '" << domain_ref.getValue() << "'.");
         }
 
@@ -1338,9 +1343,10 @@
           {
             vecAxis.push_back(CAxis::get(axis_ref));
+            vecAxisRef.push_back(CAxis::createAxis());
+            vecAxisRef.back()->axis_ref=axis_ref;
             axisDomainOrderTmp.push_back(1);
           }
-          else
-            ERROR("CField::solveGridReference(void)",
-                  << "Invalid reference to axis '" << axis_ref.getValue() << "'.");
+          else  ERROR("CField::solveGridReference(void)",
+                      << "Invalid reference to axis '" << axis_ref.getValue() << "'.");
         }
 
@@ -1350,9 +1356,10 @@
           {
             vecScalar.push_back(CScalar::get(scalar_ref));
+            vecScalarRef.push_back(CScalar::createScalar());
+            vecScalarRef.back()->scalar_ref=scalar_ref;
             axisDomainOrderTmp.push_back(0);
           }
-          else
-            ERROR("CField::solveGridReference(void)",
-                  << "Invalid reference to scalar '" << scalar_ref.getValue() << "'.");
+          else ERROR("CField::solveGridReference(void)",
+                     << "Invalid reference to scalar '" << scalar_ref.getValue() << "'.");
         }
         
@@ -1365,16 +1372,12 @@
         // Warning: the gridId shouldn't be set as the grid_ref since it could be inherited
         StdString gridId = CGrid::generateId(vecDom, vecAxis, vecScalar,axisDomainOrder);
-        if (CGrid::has(gridId))
-          this->grid = CGrid::get(gridId);
-        else
-          this->grid = CGrid::createGrid(gridId, vecDom, vecAxis, vecScalar,axisDomainOrder);
+        if (CGrid::has(gridId)) this->grid = CGrid::get(gridId);
+        else  this->grid = CGrid::createGrid(gridId, vecDomRef, vecAxisRef, vecScalarRef,axisDomainOrder);
       }
       else
       {
-        if (CGrid::has(grid_ref))
-          this->grid = CGrid::get(grid_ref);
-        else
-          ERROR("CField::solveGridReference(void)",
-                << "Invalid reference to grid '" << grid_ref.getValue() << "'.");
+        if (CGrid::has(grid_ref)) this->grid = CGrid::get(grid_ref);
+        else  ERROR("CField::solveGridReference(void)",
+                     << "Invalid reference to grid '" << grid_ref.getValue() << "'.");
       }
    }
@@ -1621,4 +1624,21 @@
    }
 
+
+   /*!
+    * Send all Attributes to server. This method is overloaded, since only grid_ref attribute
+    * must be sent to server and not domain_ref/axis_ref/scalar_ref. 
+    */
+    
+   void CField::sendAllAttributesToServer(CContextClient* client)
+   {
+     if (grid_ref.isEmpty())
+     {
+       grid_ref=grid->getId() ;
+       SuperClass::sendAllAttributesToServer(client) ;
+       grid_ref.reset();
+     }
+     else SuperClass::sendAllAttributesToServer(client) ;
+   }
+    
    void CField::sendAddVariable(const string& id, CContextClient* client)
    {
@@ -1670,5 +1690,5 @@
      bool isFieldRead  = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read;
      bool isFieldWrite = file && ( file->mode.isEmpty() ||  file->mode == CFile::mode_attr::write);
-     if (isFieldRead && operation.getValue() != "instant")
+     if (isFieldRead && !(operation.getValue() == "instant" || operation.getValue() == "once") )     
        ERROR("void CField::checkTimeAttributes(void)",
              << "Unsupported operation for field '" << getFieldOutputName() << "'." << std::endl
