Index: XIOS/trunk/src/transformation/Functions/average_reduction.cpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/average_reduction.cpp	(revision 979)
+++ XIOS/trunk/src/transformation/Functions/average_reduction.cpp	(revision 979)
@@ -0,0 +1,62 @@
+/*!
+   \file average.cpp
+   \author Ha NGUYEN
+   \since 8 Sep 2016
+   \date 8 Sep 2016
+
+   \brief average reduction
+ */
+#include "average_reduction.hpp"
+
+namespace xios {
+
+CAverageReductionAlgorithm::CAverageReductionAlgorithm()
+  : CReductionAlgorithm(), resetWeight_(true)
+{
+}
+
+CReductionAlgorithm* CAverageReductionAlgorithm::create()
+{
+  return (new CAverageReductionAlgorithm());
+}
+
+bool CAverageReductionAlgorithm::registerTrans()
+{
+  return registerOperation(TRANS_REDUCE_AVERAGE, CAverageReductionAlgorithm::create);
+}
+
+void CAverageReductionAlgorithm::apply(const std::vector<std::pair<int,double> >& localIndex,
+                                       const double* dataInput,
+                                       CArray<double,1>& dataOut,
+                                       std::vector<bool>& flagInitial)
+{
+  if (resetWeight_) { weights_.resize(flagInitial.size()); weights_ = 1.0; resetWeight_ = false; }
+
+  int nbLocalIndex = localIndex.size();
+  int currentlocalIndex = 0;
+  double currentWeight  = 0.0;
+  for (int idx = 0; idx < nbLocalIndex; ++idx)
+  {
+    currentlocalIndex = localIndex[idx].first;
+    currentWeight     = localIndex[idx].second;
+
+    if (flagInitial[currentlocalIndex])
+    {
+      dataOut(currentlocalIndex) = *(dataInput + idx);
+      flagInitial[currentlocalIndex] = false;
+    }
+    else
+    {
+      dataOut(currentlocalIndex)  += *(dataInput + idx);
+      weights_(currentlocalIndex) += 1.0;
+    }
+  }
+}
+
+void CAverageReductionAlgorithm::updateData(CArray<double,1>& dataOut)
+{
+  dataOut /= weights_;
+  resetWeight_ = true;
+}
+
+}
Index: XIOS/trunk/src/transformation/Functions/average_reduction.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/average_reduction.hpp	(revision 979)
+++ XIOS/trunk/src/transformation/Functions/average_reduction.hpp	(revision 979)
@@ -0,0 +1,46 @@
+/*!
+   \file average.hpp
+   \author Ha NGUYEN
+   \since 8 Sep 2016
+   \date 8 Sep 2016
+
+   \brief Average reduction
+ */
+#ifndef __XIOS_REDUCTION_AVERAGE_ALGORITHM_HPP__
+#define __XIOS_REDUCTION_AVERAGE_ALGORITHM_HPP__
+
+#include "reduction.hpp"
+
+namespace xios {
+
+/*!
+  \class CAverageReductionAlgorithm
+  Interface for all reduction alogrithms.
+*/
+class CAverageReductionAlgorithm : public CReductionAlgorithm
+{
+public:
+  CAverageReductionAlgorithm();
+
+  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
+                     const double* dataInput,
+                     CArray<double,1>& dataOut,
+                     std::vector<bool>& flagInitial);
+
+  virtual void updateData(CArray<double,1>& dataOut);
+
+  virtual ~CAverageReductionAlgorithm() {}
+
+protected:
+  CArray<double,1> weights_;
+  bool resetWeight_;
+
+public:
+  static bool registerTrans();
+
+protected:
+  static CReductionAlgorithm* create();
+};
+
+}
+#endif // __XIOS_REDUCTION_AVERAGE_ALGORITHM_HPP__
Index: XIOS/trunk/src/transformation/Functions/max.cpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/max.cpp	(revision 978)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*!
-   \file max.cpp
-   \author Ha NGUYEN
-   \since 27 June 2016
-   \date 27 June 2016
-
-   \brief max reduction
- */
-#include "max.hpp"
-
-namespace xios {
-
-CMaxReductionAlgorithm::CMaxReductionAlgorithm()
-  : CReductionAlgorithm()
-{
-}
-
-CReductionAlgorithm* CMaxReductionAlgorithm::create()
-{
-  return (new CMaxReductionAlgorithm());
-}
-
-bool CMaxReductionAlgorithm::registerTrans()
-{
-  return registerOperation(TRANS_REDUCE_MAX, CMaxReductionAlgorithm::create);
-}
-
-void CMaxReductionAlgorithm::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                   const double* dataInput,
-                                   CArray<double,1>& dataOut,
-                                   std::vector<bool>& flagInitial)
-{
-  int nbLocalIndex = localIndex.size();
-  int currentlocalIndex = 0;
-  double currentWeight  = 0.0;
-  for (int idx = 0; idx < nbLocalIndex; ++idx)
-  {
-    currentlocalIndex = localIndex[idx].first;
-    currentWeight     = localIndex[idx].second;
-    if (flagInitial[currentlocalIndex])
-    {
-      dataOut(currentlocalIndex) = *(dataInput + idx);
-      flagInitial[currentlocalIndex] = false;
-    }
-    else
-    {
-      dataOut(currentlocalIndex) = std::max(*(dataInput + idx), dataOut(currentlocalIndex));
-    }
-  }
-}
-
-}
Index: XIOS/trunk/src/transformation/Functions/max.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/max.hpp	(revision 978)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*!
-   \file max.hpp
-   \author Ha NGUYEN
-   \since 27 June 2016
-   \date 27 June 2016
-
-   \brief Max reduction
- */
-#ifndef __XIOS_REDUCTION_MAX_ALGORITHM_HPP__
-#define __XIOS_REDUCTION_MAX_ALGORITHM_HPP__
-
-#include "reduction.hpp"
-
-namespace xios {
-
-/*!
-  \class CMaxReductionAlgorithm
-  Interface for all reduction alogrithms.
-*/
-class CMaxReductionAlgorithm : public CReductionAlgorithm
-{
-public:
-  CMaxReductionAlgorithm();
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial);
-
-  virtual ~CMaxReductionAlgorithm() {}
-
-public:
-  static bool registerTrans();
-
-protected:
-  static CReductionAlgorithm* create();
-};
-
-}
-#endif // __XIOS_REDUCTION_MAX_ALGORITHM_HPP__
Index: XIOS/trunk/src/transformation/Functions/max_reduction.cpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/max_reduction.cpp	(revision 979)
+++ XIOS/trunk/src/transformation/Functions/max_reduction.cpp	(revision 979)
@@ -0,0 +1,52 @@
+/*!
+   \file max.cpp
+   \author Ha NGUYEN
+   \since 27 June 2016
+   \date 27 June 2016
+
+   \brief max reduction
+ */
+#include "max_reduction.hpp"
+
+namespace xios {
+
+CMaxReductionAlgorithm::CMaxReductionAlgorithm()
+  : CReductionAlgorithm()
+{
+}
+
+CReductionAlgorithm* CMaxReductionAlgorithm::create()
+{
+  return (new CMaxReductionAlgorithm());
+}
+
+bool CMaxReductionAlgorithm::registerTrans()
+{
+  return registerOperation(TRANS_REDUCE_MAX, CMaxReductionAlgorithm::create);
+}
+
+void CMaxReductionAlgorithm::apply(const std::vector<std::pair<int,double> >& localIndex,
+                                   const double* dataInput,
+                                   CArray<double,1>& dataOut,
+                                   std::vector<bool>& flagInitial)
+{
+  int nbLocalIndex = localIndex.size();
+  int currentlocalIndex = 0;
+  double currentWeight  = 0.0;
+  for (int idx = 0; idx < nbLocalIndex; ++idx)
+  {
+    currentlocalIndex = localIndex[idx].first;
+    currentWeight     = localIndex[idx].second;
+    if (flagInitial[currentlocalIndex])
+    {
+      dataOut(currentlocalIndex) = *(dataInput + idx);
+      flagInitial[currentlocalIndex] = false;
+    }
+    else
+    {
+      dataOut(currentlocalIndex) = std::max(*(dataInput + idx), dataOut(currentlocalIndex));
+    }
+  }
+}
+
+}
Index: XIOS/trunk/src/transformation/Functions/max_reduction.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/max_reduction.hpp	(revision 979)
+++ XIOS/trunk/src/transformation/Functions/max_reduction.hpp	(revision 979)
@@ -0,0 +1,40 @@
+/*!
+   \file max.hpp
+   \author Ha NGUYEN
+   \since 27 June 2016
+   \date 27 June 2016
+
+   \brief Max reduction
+ */
+#ifndef __XIOS_REDUCTION_MAX_ALGORITHM_HPP__
+#define __XIOS_REDUCTION_MAX_ALGORITHM_HPP__
+
+#include "reduction.hpp"
+
+namespace xios {
+
+/*!
+  \class CMaxReductionAlgorithm
+  Interface for all reduction alogrithms.
+*/
+class CMaxReductionAlgorithm : public CReductionAlgorithm
+{
+public:
+  CMaxReductionAlgorithm();
+
+  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
+                     const double* dataInput,
+                     CArray<double,1>& dataOut,
+                     std::vector<bool>& flagInitial);
+
+  virtual ~CMaxReductionAlgorithm() {}
+
+public:
+  static bool registerTrans();
+
+protected:
+  static CReductionAlgorithm* create();
+};
+
+}
+#endif // __XIOS_REDUCTION_MAX_ALGORITHM_HPP__
Index: XIOS/trunk/src/transformation/Functions/min.cpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/min.cpp	(revision 978)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*!
-   \file min.cpp
-   \author Ha NGUYEN
-   \since 27 June 2016
-   \date 27 June 2016
-
-   \brief min reduction
- */
-#include "min.hpp"
-
-namespace xios {
-
-CMinReductionAlgorithm::CMinReductionAlgorithm()
-  : CReductionAlgorithm()
-{
-}
-
-CReductionAlgorithm* CMinReductionAlgorithm::create()
-{
-  return (new CMinReductionAlgorithm());
-}
-
-bool CMinReductionAlgorithm::registerTrans()
-{
-  return registerOperation(TRANS_REDUCE_MIN, CMinReductionAlgorithm::create);
-}
-
-void CMinReductionAlgorithm::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                   const double* dataInput,
-                                   CArray<double,1>& dataOut,
-                                   std::vector<bool>& flagInitial)
-{
-  int nbLocalIndex = localIndex.size();
-  int currentlocalIndex = 0;
-  for (int idx = 0; idx < nbLocalIndex; ++idx)
-  {
-    currentlocalIndex = localIndex[idx].first;
-    if (flagInitial[currentlocalIndex])
-    {
-      dataOut(currentlocalIndex) = *(dataInput + idx);
-      flagInitial[currentlocalIndex] = false;
-    }
-    else
-    {
-      dataOut(currentlocalIndex) = std::min(*(dataInput + idx), dataOut(currentlocalIndex));
-    }
-  }
-}
-
-}
Index: XIOS/trunk/src/transformation/Functions/min.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/min.hpp	(revision 978)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*!
-   \file min.hpp
-   \author Ha NGUYEN
-   \since 27 June 2016
-   \date 27 June 2016
-
-   \brief Min reduction
- */
-#ifndef __XIOS_REDUCTION_MIN_ALGORITHM_HPP__
-#define __XIOS_REDUCTION_MIN_ALGORITHM_HPP__
-
-#include "reduction.hpp"
-
-namespace xios {
-
-/*!
-  \class CMinReductionAlgorithm
-  Interface for all reduction alogrithms.
-*/
-class CMinReductionAlgorithm : public CReductionAlgorithm
-{
-public:
-  CMinReductionAlgorithm();
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial);
-
-  virtual ~CMinReductionAlgorithm() {}
-
-public:
-  static bool registerTrans();
-
-protected:
-  static CReductionAlgorithm* create();
-};
-
-}
-#endif // __XIOS_REDUCTION_MIN_ALGORITHM_HPP__
Index: XIOS/trunk/src/transformation/Functions/min_reduction.cpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/min_reduction.cpp	(revision 979)
+++ XIOS/trunk/src/transformation/Functions/min_reduction.cpp	(revision 979)
@@ -0,0 +1,50 @@
+/*!
+   \file min.cpp
+   \author Ha NGUYEN
+   \since 27 June 2016
+   \date 27 June 2016
+
+   \brief min reduction
+ */
+#include "min_reduction.hpp"
+
+namespace xios {
+
+CMinReductionAlgorithm::CMinReductionAlgorithm()
+  : CReductionAlgorithm()
+{
+}
+
+CReductionAlgorithm* CMinReductionAlgorithm::create()
+{
+  return (new CMinReductionAlgorithm());
+}
+
+bool CMinReductionAlgorithm::registerTrans()
+{
+  return registerOperation(TRANS_REDUCE_MIN, CMinReductionAlgorithm::create);
+}
+
+void CMinReductionAlgorithm::apply(const std::vector<std::pair<int,double> >& localIndex,
+                                   const double* dataInput,
+                                   CArray<double,1>& dataOut,
+                                   std::vector<bool>& flagInitial)
+{
+  int nbLocalIndex = localIndex.size();
+  int currentlocalIndex = 0;
+  for (int idx = 0; idx < nbLocalIndex; ++idx)
+  {
+    currentlocalIndex = localIndex[idx].first;
+    if (flagInitial[currentlocalIndex])
+    {
+      dataOut(currentlocalIndex) = *(dataInput + idx);
+      flagInitial[currentlocalIndex] = false;
+    }
+    else
+    {
+      dataOut(currentlocalIndex) = std::min(*(dataInput + idx), dataOut(currentlocalIndex));
+    }
+  }
+}
+
+}
Index: XIOS/trunk/src/transformation/Functions/min_reduction.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/min_reduction.hpp	(revision 979)
+++ XIOS/trunk/src/transformation/Functions/min_reduction.hpp	(revision 979)
@@ -0,0 +1,40 @@
+/*!
+   \file min.hpp
+   \author Ha NGUYEN
+   \since 27 June 2016
+   \date 27 June 2016
+
+   \brief Min reduction
+ */
+#ifndef __XIOS_REDUCTION_MIN_ALGORITHM_HPP__
+#define __XIOS_REDUCTION_MIN_ALGORITHM_HPP__
+
+#include "reduction.hpp"
+
+namespace xios {
+
+/*!
+  \class CMinReductionAlgorithm
+  Interface for all reduction alogrithms.
+*/
+class CMinReductionAlgorithm : public CReductionAlgorithm
+{
+public:
+  CMinReductionAlgorithm();
+
+  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
+                     const double* dataInput,
+                     CArray<double,1>& dataOut,
+                     std::vector<bool>& flagInitial);
+
+  virtual ~CMinReductionAlgorithm() {}
+
+public:
+  static bool registerTrans();
+
+protected:
+  static CReductionAlgorithm* create();
+};
+
+}
+#endif // __XIOS_REDUCTION_MIN_ALGORITHM_HPP__
Index: XIOS/trunk/src/transformation/Functions/reduction.cpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/reduction.cpp	(revision 978)
+++ XIOS/trunk/src/transformation/Functions/reduction.cpp	(revision 979)
@@ -1,7 +1,8 @@
 #include "reduction.hpp"
-#include "sum.hpp"
-#include "min.hpp"
-#include "max.hpp"
+#include "sum_reduction.hpp"
+#include "min_reduction.hpp"
+#include "max_reduction.hpp"
 #include "extract.hpp"
+#include "average_reduction.hpp"
 
 namespace xios {
@@ -23,4 +24,7 @@
   m["extract"] = TRANS_REDUCE_EXTRACT;
   CExtractReductionAlgorithm::registerTrans();
+
+  m["average"] = TRANS_REDUCE_AVERAGE;
+  CAverageReductionAlgorithm::registerTrans();
 }
 
Index: XIOS/trunk/src/transformation/Functions/reduction.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/reduction.hpp	(revision 978)
+++ XIOS/trunk/src/transformation/Functions/reduction.hpp	(revision 979)
@@ -40,5 +40,5 @@
     \param [in] dataInput Pointer to the first element of data input array (in form of buffer)
     \param [in/out] dataOut Array contains local data
-    \param [in/out] flagInitial vector of boolean to mark the local index already initialized. True means there is a need for initalization
+    \param [in/out] flagInitial vector of boolean to mark the local index already initialized. True means there is a need for initialization
   */
   virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
@@ -46,4 +46,10 @@
                      CArray<double,1>& dataOut,
                      std::vector<bool>& flagInitial) = 0;
+  /*!
+    Update local data 
+    In some case (e.g average) we need global information (e.g weights) then update data with this information
+    \param [in] dataOut local data output
+  */
+  virtual void updateData(CArray<double,1>& dataOut) {}
 
   virtual ~CReductionAlgorithm() {}
Index: XIOS/trunk/src/transformation/Functions/reduction_types.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/reduction_types.hpp	(revision 978)
+++ XIOS/trunk/src/transformation/Functions/reduction_types.hpp	(revision 979)
@@ -17,5 +17,6 @@
     TRANS_REDUCE_MIN = 1,
     TRANS_REDUCE_MAX = 2,
-    TRANS_REDUCE_EXTRACT = 3
+    TRANS_REDUCE_EXTRACT = 3,
+    TRANS_REDUCE_AVERAGE = 4
   } EReductionType;
 
Index: XIOS/trunk/src/transformation/Functions/sum.cpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/sum.cpp	(revision 978)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*!
-   \file sum.cpp
-   \author Ha NGUYEN
-   \since 27 June 2016
-   \date 27 June 2016
-
-   \brief sum reduction
- */
-#include "sum.hpp"
-
-namespace xios {
-
-CSumReductionAlgorithm::CSumReductionAlgorithm()
-  : CReductionAlgorithm()
-{
-}
-
-CReductionAlgorithm* CSumReductionAlgorithm::create()
-{
-  return (new CSumReductionAlgorithm());
-}
-
-bool CSumReductionAlgorithm::registerTrans()
-{
-  return registerOperation(TRANS_REDUCE_SUM, CSumReductionAlgorithm::create);
-}
-
-void CSumReductionAlgorithm::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                   const double* dataInput,
-                                   CArray<double,1>& dataOut,
-                                   std::vector<bool>& flagInitial)
-{
-  int nbLocalIndex = localIndex.size();
-  int currentlocalIndex = 0;
-  double currentWeight  = 0.0;
-  for (int idx = 0; idx < nbLocalIndex; ++idx)
-  {
-    currentlocalIndex = localIndex[idx].first;
-    currentWeight     = localIndex[idx].second;
-    if (flagInitial[currentlocalIndex])
-    {
-      dataOut(currentlocalIndex) = *(dataInput + idx);
-      flagInitial[currentlocalIndex] = false;
-    }
-    else
-    {
-      dataOut(currentlocalIndex) += *(dataInput + idx);
-    }
-  }
-}
-
-}
Index: XIOS/trunk/src/transformation/Functions/sum.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/sum.hpp	(revision 978)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*!
-   \file sum.hpp
-   \author Ha NGUYEN
-   \since 27 June 2016
-   \date 27 June 2016
-
-   \brief Sum reduction
- */
-#ifndef __XIOS_REDUCTION_SUM_ALGORITHM_HPP__
-#define __XIOS_REDUCTION_SUM_ALGORITHM_HPP__
-
-#include "reduction.hpp"
-
-namespace xios {
-
-/*!
-  \class CSumReductionAlgorithm
-  Interface for all reduction alogrithms.
-*/
-class CSumReductionAlgorithm : public CReductionAlgorithm
-{
-public:
-  CSumReductionAlgorithm();
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial);
-
-  virtual ~CSumReductionAlgorithm() {}
-
-public:
-  static bool registerTrans();
-
-protected:
-  static CReductionAlgorithm* create();
-};
-
-}
-#endif // __XIOS_REDUCTION_SUM_ALGORITHM_HPP__
Index: XIOS/trunk/src/transformation/Functions/sum_reduction.cpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/sum_reduction.cpp	(revision 979)
+++ XIOS/trunk/src/transformation/Functions/sum_reduction.cpp	(revision 979)
@@ -0,0 +1,52 @@
+/*!
+   \file sum.cpp
+   \author Ha NGUYEN
+   \since 27 June 2016
+   \date 27 June 2016
+
+   \brief sum reduction
+ */
+#include "sum_reduction.hpp"
+
+namespace xios {
+
+CSumReductionAlgorithm::CSumReductionAlgorithm()
+  : CReductionAlgorithm()
+{
+}
+
+CReductionAlgorithm* CSumReductionAlgorithm::create()
+{
+  return (new CSumReductionAlgorithm());
+}
+
+bool CSumReductionAlgorithm::registerTrans()
+{
+  return registerOperation(TRANS_REDUCE_SUM, CSumReductionAlgorithm::create);
+}
+
+void CSumReductionAlgorithm::apply(const std::vector<std::pair<int,double> >& localIndex,
+                                   const double* dataInput,
+                                   CArray<double,1>& dataOut,
+                                   std::vector<bool>& flagInitial)
+{
+  int nbLocalIndex = localIndex.size();
+  int currentlocalIndex = 0;
+  double currentWeight  = 0.0;
+  for (int idx = 0; idx < nbLocalIndex; ++idx)
+  {
+    currentlocalIndex = localIndex[idx].first;
+    currentWeight     = localIndex[idx].second;
+    if (flagInitial[currentlocalIndex])
+    {
+      dataOut(currentlocalIndex) = *(dataInput + idx);
+      flagInitial[currentlocalIndex] = false;
+    }
+    else
+    {
+      dataOut(currentlocalIndex) += *(dataInput + idx);
+    }
+  }
+}
+
+}
Index: XIOS/trunk/src/transformation/Functions/sum_reduction.hpp
===================================================================
--- XIOS/trunk/src/transformation/Functions/sum_reduction.hpp	(revision 979)
+++ XIOS/trunk/src/transformation/Functions/sum_reduction.hpp	(revision 979)
@@ -0,0 +1,40 @@
+/*!
+   \file sum.hpp
+   \author Ha NGUYEN
+   \since 27 June 2016
+   \date 27 June 2016
+
+   \brief Sum reduction
+ */
+#ifndef __XIOS_REDUCTION_SUM_ALGORITHM_HPP__
+#define __XIOS_REDUCTION_SUM_ALGORITHM_HPP__
+
+#include "reduction.hpp"
+
+namespace xios {
+
+/*!
+  \class CSumReductionAlgorithm
+  Interface for all reduction alogrithms.
+*/
+class CSumReductionAlgorithm : public CReductionAlgorithm
+{
+public:
+  CSumReductionAlgorithm();
+
+  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
+                     const double* dataInput,
+                     CArray<double,1>& dataOut,
+                     std::vector<bool>& flagInitial);
+
+  virtual ~CSumReductionAlgorithm() {}
+
+public:
+  static bool registerTrans();
+
+protected:
+  static CReductionAlgorithm* create();
+};
+
+}
+#endif // __XIOS_REDUCTION_SUM_ALGORITHM_HPP__
Index: XIOS/trunk/src/transformation/axis_algorithm_extract_domain.cpp
===================================================================
--- XIOS/trunk/src/transformation/axis_algorithm_extract_domain.cpp	(revision 978)
+++ XIOS/trunk/src/transformation/axis_algorithm_extract_domain.cpp	(revision 979)
@@ -13,5 +13,4 @@
 #include "grid.hpp"
 #include "grid_transformation_factory_impl.hpp"
-
 #include "reduction.hpp"
 
Index: XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.cpp
===================================================================
--- XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.cpp	(revision 978)
+++ XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.cpp	(revision 979)
@@ -13,5 +13,4 @@
 #include "grid.hpp"
 #include "grid_transformation_factory_impl.hpp"
-
 #include "reduction.hpp"
 
@@ -59,4 +58,9 @@
 {
   reduction_->apply(localIndex, dataInput, dataOut, flagInitial);
+}
+
+void CAxisAlgorithmReduceDomain::updateData(CArray<double,1>& dataOut)
+{
+  reduction_->updateData(dataOut);
 }
 
Index: XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.hpp
===================================================================
--- XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.hpp	(revision 978)
+++ XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.hpp	(revision 979)
@@ -35,4 +35,6 @@
                      const double& defaultValue);
 
+  virtual void updateData(CArray<double,1>& dataOut);
+  
   virtual ~CAxisAlgorithmReduceDomain();
 
@@ -47,6 +49,6 @@
   ReduceDirection dir_;
 protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
+  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
+  
 protected:
   CReductionAlgorithm* reduction_;
Index: XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
===================================================================
--- XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 978)
+++ XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 979)
@@ -18,4 +18,9 @@
    idAuxInputs_(), type_(ELEMENT_NO_MODIFICATION_WITH_DATA)
 {
+}
+
+void CGenericAlgorithmTransformation::updateData(CArray<double,1>& dataOut)
+{
+
 }
 
Index: XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
===================================================================
--- XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 978)
+++ XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 979)
@@ -70,4 +70,11 @@
                      const double& defaultValue);
 
+  /*!
+   * Update whole dataOut (on necessary).
+   * (Example:  Impose a weight, whose value is only known after being applied an operation, on dataOut)
+   * \param [in/out] dataOut dataOut
+   */
+  virtual void updateData(CArray<double,1>& dataOut);
+
   std::vector<StdString> getIdAuxInputs();
   AlgoTransType type();
@@ -129,5 +136,4 @@
   AlgoTransType type_;
 
-
   std::map<int, int> elementPositionInGridSrc2AxisPosition_, elementPositionInGridSrc2DomainPosition_, elementPositionInGridSrc2ScalarPosition_;
   std::map<int, int> elementPositionInGridDst2AxisPosition_, elementPositionInGridDst2DomainPosition_, elementPositionInGridDst2ScalarPosition_;
Index: XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp
===================================================================
--- XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp	(revision 978)
+++ XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp	(revision 979)
@@ -13,4 +13,5 @@
 #include "grid.hpp"
 #include "grid_transformation_factory_impl.hpp"
+#include "reduction.hpp"
 
 #include "reduction.hpp"
@@ -70,4 +71,9 @@
 }
 
+void CScalarAlgorithmReduceScalar::updateData(CArray<double,1>& dataOut)
+{
+  reduction_->updateData(dataOut);
+}
+
 CScalarAlgorithmReduceScalar::~CScalarAlgorithmReduceScalar()
 {
Index: XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.hpp
===================================================================
--- XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.hpp	(revision 978)
+++ XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.hpp	(revision 979)
@@ -35,4 +35,6 @@
                      const double& defaultValue);
 
+  virtual void updateData(CArray<double,1>& dataOut);
+  
   virtual ~CScalarAlgorithmReduceScalar();
 
Index: XIOS/trunk/src/transformation/scalar_algorithm_reduce_domain.cpp
===================================================================
--- XIOS/trunk/src/transformation/scalar_algorithm_reduce_domain.cpp	(revision 978)
+++ XIOS/trunk/src/transformation/scalar_algorithm_reduce_domain.cpp	(revision 979)
@@ -87,4 +87,9 @@
 }
 
+void CScalarAlgorithmReduceDomain::updateData(CArray<double,1>& dataOut)
+{
+  reduction_->updateData(dataOut);
+}
+
 CScalarAlgorithmReduceDomain::~CScalarAlgorithmReduceDomain()
 {
Index: XIOS/trunk/src/transformation/scalar_algorithm_reduce_domain.hpp
===================================================================
--- XIOS/trunk/src/transformation/scalar_algorithm_reduce_domain.hpp	(revision 978)
+++ XIOS/trunk/src/transformation/scalar_algorithm_reduce_domain.hpp	(revision 979)
@@ -35,4 +35,6 @@
                      const double& defaultValue);
 
+  virtual void updateData(CArray<double,1>& dataOut);
+  
   virtual ~CScalarAlgorithmReduceDomain();
 
