Index: /XIOS/trunk/inputs/Version2/iodef.xml
===================================================================
--- /XIOS/trunk/inputs/Version2/iodef.xml	(revision 889)
+++ /XIOS/trunk/inputs/Version2/iodef.xml	(revision 890)
@@ -15,4 +15,5 @@
      <field id="field_Domain_transformed_Interpolated"  operation="average" freq_op="3600s" field_ref="field_A" grid_ref="grid_Domain_tranformed_Interpolated" />
      <field id="field_Scalar" operation="average" freq_op="3600s" grid_ref="ScalarGrid" />
+     <field id="field_ReduceScalar" operation="average" field_ref="field_A" freq_op="3600s" grid_ref="ScalarReduceGrid" />
      <field id="field_Value"  operation="average" freq_op="3600s" grid_ref="grid_A" />
    </field_definition>
@@ -43,4 +44,7 @@
         <field field_ref="field_Scalar" />
      </file>
+     <file id="output_ReduceScalar" name="output_ReduceScalar" type="one_file">
+        <field field_ref="field_ReduceScalar" />
+     </file>
    </file_definition>
 
@@ -61,4 +65,10 @@
    </axis_definition>
 
+   <scalar_definition>
+     <scalar id="scalar" value="10.0">
+       <reduce_axis operation="max"/>
+     </scalar>
+   </scalar_definition>
+
    <domain_definition>
      <domain id="domain_A" />
@@ -72,5 +82,5 @@
        <grid id="grid_A">
          <domain domain_ref="domain_A" />
-         <axis axis_ref="axis_C" />
+         <axis axis_ref="axis_C" positive="up"/>
        </grid>
        <grid id="grid_Axis">
@@ -97,5 +107,10 @@
          <axis axis_ref="axis_E" />
        </grid>
+       <grid id="ScalarReduceGrid">
+        <domain domain_ref="domain_A" />
+        <scalar scalar_ref="scalar"/>
+       </grid>
        <grid id="ScalarGrid">
+        <scalar scalar_ref="scalar"/>
        </grid>
      </grid_group>
Index: /XIOS/trunk/src/distribution_client.cpp
===================================================================
--- /XIOS/trunk/src/distribution_client.cpp	(revision 889)
+++ /XIOS/trunk/src/distribution_client.cpp	(revision 890)
@@ -188,7 +188,5 @@
       nZoomEnd_.at((indexMap_[idx]+1))   = domList[domIndex]->global_zoom_jbegin + domList[domIndex]->global_zoom_nj-1;
 
-      dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); //(2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1;
-//      dataIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->data_j_index);
-//      infoIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->j_index);
+      dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue();
       dataIndex_.at(indexMap_[idx]+1).reference(domList[domIndex]->data_j_index);
       infoIndex_.at(indexMap_[idx]+1).reference(domList[domIndex]->j_index);
@@ -203,6 +201,4 @@
 
       dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue();
-//      dataIndex_.at(indexMap_[idx]) = &(domList[domIndex]->data_i_index);
-//      infoIndex_.at(indexMap_[idx]) = &(domList[domIndex]->i_index);
       dataIndex_.at(indexMap_[idx]).reference(domList[domIndex]->data_i_index);
       infoIndex_.at(indexMap_[idx]).reference(domList[domIndex]->i_index);
@@ -227,6 +223,4 @@
 
       dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue();
-//      dataIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->data_index);
-//      infoIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->index);
       dataIndex_.at(indexMap_[idx]).reference(axisList[axisIndex]->data_index);
       infoIndex_.at(indexMap_[idx]).reference(axisList[axisIndex]->index);
Index: /XIOS/trunk/src/node/grid.cpp
===================================================================
--- /XIOS/trunk/src/node/grid.cpp	(revision 889)
+++ /XIOS/trunk/src/node/grid.cpp	(revision 890)
@@ -34,5 +34,5 @@
       , transformations_(0), isTransformed_(false)
       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false)
-      , gridSrc_(), hasTransform_(false), order_(), globalIndexOnServer_()
+      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_()
    {
      setVirtualDomainGroup();
@@ -52,5 +52,5 @@
       , transformations_(0), isTransformed_(false)
       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false)
-      , gridSrc_(), hasTransform_(false), order_(), globalIndexOnServer_()
+      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_()
    {
      setVirtualDomainGroup();
@@ -707,38 +707,4 @@
    }
 
-//   CGrid* CGrid::createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
-//                            const CArray<int,1>& axisDomainOrder)
-//   {
-//      if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size()))
-//        ERROR("CGrid* CGrid::createGrid(...)",
-//              << "The size of axisDomainOrder (" << axisDomainOrder.numElements()
-//              << ") is not coherent with the number of elements (" << domains.size() + axis.size() <<").");
-//
-//      CGrid* grid = CGridGroup::get("grid_definition")->createChild(id);
-//      grid->setDomainList(domains);
-//      grid->setAxisList(axis);
-//
-//      // By default, domains are always the first elements of a grid
-//      if (0 == axisDomainOrder.numElements())
-//      {
-//        int size = domains.size() + axis.size();
-//        grid->axis_domain_order.resize(size);
-//        for (int i = 0; i < size; ++i)
-//        {
-//          if (i < domains.size()) grid->axis_domain_order(i) = 2;
-//          else grid->axis_domain_order(i) = 1;
-//        }
-//      }
-//      else
-//      {
-//        grid->axis_domain_order.resize(axisDomainOrder.numElements());
-//        grid->axis_domain_order = axisDomainOrder;
-//      }
-//
-//      grid->solveDomainAxisRefInheritance(true);
-//
-//      return grid;
-//   }
-
    CGrid* CGrid::createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                             const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder)
@@ -1040,6 +1006,4 @@
     list<CMessage> listMsg;
     list<CArray<size_t,1> > listOutIndex;
-//    const CClientServerMapping::GlobalIndexMap& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer();
-//    const CClientServerMapping::GlobalIndexMap& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer();
     const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer();
     CDistributionClient::GlobalLocalDataMap::const_iterator itIndex = globalLocalIndexSendToServer.begin(),
@@ -1735,6 +1699,19 @@
     }
 
+    if (isGenerated()) return;
+    setGenerated();
+
     CGridGenerate gridGenerate(this, transformGridSrc);
     gridGenerate.completeGrid();
+  }
+
+  bool CGrid::isGenerated()
+  {
+    return isGenerated_;
+  }
+
+  void CGrid::setGenerated()
+  {
+    isGenerated_ = true;
   }
 
Index: /XIOS/trunk/src/node/grid.hpp
===================================================================
--- /XIOS/trunk/src/node/grid.hpp	(revision 889)
+++ /XIOS/trunk/src/node/grid.hpp	(revision 890)
@@ -120,12 +120,8 @@
          static CGrid* createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                                   const CArray<int,1>& axisDomainOrder = CArray<int,1>());
-//         static CGrid* createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
-//                                  const CArray<int,1>& axisDomainOrder = CArray<int,1>());
          static CGrid* createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                                   const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>());
          static CGrid* createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                                   const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder);
-//         static StdString generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
-//                                     const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>());
          static StdString generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                                      const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>());
@@ -206,4 +202,6 @@
          bool isTransformed();
          void setTransformed();
+         bool isGenerated();
+         void setGenerated();
          void addTransGridSource(CGrid* gridSrc);
          std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource();
@@ -283,4 +281,5 @@
 
         bool isTransformed_;
+        bool isGenerated_;
         std::vector<int> axisPositionInGrid_;
         CGridTransformation* transformations_;
Index: /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp
===================================================================
--- /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp	(revision 889)
+++ /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp	(revision 890)
@@ -8,7 +8,4 @@
  */
 #include "scalar_algorithm_reduce_axis.hpp"
-//#include "context.hpp"
-//#include "context_client.hpp"
-//#include "client_client_dht_template.hpp"
 #include "axis.hpp"
 #include "scalar.hpp"
