Index: /XIOS/trunk/src/transformation/axis_algorithm_extract_domain.cpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_extract_domain.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_extract_domain.cpp	(revision 933)
@@ -11,8 +11,36 @@
 #include "axis.hpp"
 #include "domain.hpp"
+#include "grid.hpp"
+#include "grid_transformation_factory_impl.hpp"
 
 #include "sum.hpp"
 
 namespace xios {
+CGenericAlgorithmTransformation* CAxisAlgorithmExtractDomain::create(CGrid* gridDst, CGrid* gridSrc,
+                                                                     CTransformation<CAxis>* transformation,
+                                                                     int elementPositionInGrid,
+                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
+  std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();
+
+  CExtractDomainToAxis* extractDomain = dynamic_cast<CExtractDomainToAxis*> (transformation);
+  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
+  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
+
+  return (new CAxisAlgorithmExtractDomain(axisListDestP[axisDstIndex], domainListSrcP[domainSrcIndex], extractDomain));
+}
+
+//bool CAxisAlgorithmExtractDomain::_dummyRegistered = CAxisAlgorithmExtractDomain::registerTrans();
+bool CAxisAlgorithmExtractDomain::registerTrans()
+{
+  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, create);
+}
+
 
 CAxisAlgorithmExtractDomain::CAxisAlgorithmExtractDomain(CAxis* axisDestination, CDomain* domainSource, CExtractDomainToAxis* algo)
Index: /XIOS/trunk/src/transformation/axis_algorithm_extract_domain.hpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_extract_domain.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_extract_domain.hpp	(revision 933)
@@ -11,4 +11,5 @@
 
 #include "axis_algorithm_transformation.hpp"
+#include "transformation.hpp"
 
 namespace xios {
@@ -18,4 +19,5 @@
 class CExtractDomainToAxis;
 class CReductionAlgorithm;
+
 
 /*!
@@ -36,4 +38,5 @@
   virtual ~CAxisAlgorithmExtractDomain();
 
+  static bool registerTrans();
 protected:
   enum ExtractDirection {
@@ -51,4 +54,14 @@
   CReductionAlgorithm* reduction_;
 
+private:
+  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
+                                                CTransformation<CAxis>* transformation,
+                                                int elementPositionInGrid,
+                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
 };
 
Index: /XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp	(revision 933)
@@ -8,4 +8,6 @@
  */
 #include "axis_algorithm_interpolate.hpp"
+#include "axis.hpp"
+#include "interpolate_axis.hpp"
 #include <algorithm>
 #include "context.hpp"
@@ -13,7 +15,33 @@
 #include "utils.hpp"
 #include "grid.hpp"
+#include "grid_transformation_factory_impl.hpp"
 #include "distribution_client.hpp"
 
 namespace xios {
+CGenericAlgorithmTransformation* CAxisAlgorithmInterpolate::create(CGrid* gridDst, CGrid* gridSrc,
+                                                                   CTransformation<CAxis>* transformation,
+                                                                   int elementPositionInGrid,
+                                                                   std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                                   std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                                   std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                                   std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                                   std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                                   std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
+  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
+
+  CInterpolateAxis* interpolateAxis = dynamic_cast<CInterpolateAxis*> (transformation);
+  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
+  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
+
+  return (new CAxisAlgorithmInterpolate(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], interpolateAxis));
+}
+
+bool CAxisAlgorithmInterpolate::registerTrans()
+{
+  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_INTERPOLATE_AXIS, create);
+}
+
 
 CAxisAlgorithmInterpolate::CAxisAlgorithmInterpolate(CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis)
Index: /XIOS/trunk/src/transformation/axis_algorithm_interpolate.hpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_interpolate.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_interpolate.hpp	(revision 933)
@@ -11,8 +11,12 @@
 
 #include "axis_algorithm_transformation.hpp"
-#include "axis.hpp"
-#include "interpolate_axis.hpp"
+#include "transformation.hpp"
 
 namespace xios {
+
+class CAxis;
+class CGrid;
+class CInterpolateAxis;
+
 /*!
   \class CAxisAlgorithmInterpolate
@@ -27,4 +31,5 @@
   virtual ~CAxisAlgorithmInterpolate() {}
 
+  static bool registerTrans();
 protected:
   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
@@ -43,4 +48,15 @@
   StdString coordinate_;
   std::vector<std::vector<int> > transPosition_;
+
+private:
+  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
+                                                CTransformation<CAxis>* transformation,
+                                                int elementPositionInGrid,
+                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
 };
 
Index: /XIOS/trunk/src/transformation/axis_algorithm_inverse.cpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_inverse.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_inverse.cpp	(revision 933)
@@ -11,9 +11,38 @@
 #include "context_client.hpp"
 #include "axis.hpp"
+#include "grid.hpp"
+#include "grid_transformation_factory_impl.hpp"
+#include "inverse_axis.hpp"
 #include "client_client_dht_template.hpp"
 
 namespace xios {
 
-CAxisAlgorithmInverse::CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource)
+CGenericAlgorithmTransformation* CAxisAlgorithmInverse::create(CGrid* gridDst, CGrid* gridSrc,
+                                                               CTransformation<CAxis>* transformation,
+                                                               int elementPositionInGrid,
+                                                               std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                               std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                               std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                               std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                               std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                               std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
+  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
+
+  CInverseAxis* inverseAxis = dynamic_cast<CInverseAxis*> (transformation);
+  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
+  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
+
+  return (new CAxisAlgorithmInverse(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], inverseAxis));
+}
+
+bool CAxisAlgorithmInverse::registerTrans()
+{
+  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_INVERSE_AXIS, create);
+}
+
+
+CAxisAlgorithmInverse::CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource, CInverseAxis* inverseAxis)
  : CAxisAlgorithmTransformation(axisDestination, axisSource)
 {
Index: /XIOS/trunk/src/transformation/axis_algorithm_inverse.hpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_inverse.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_inverse.hpp	(revision 933)
@@ -11,8 +11,11 @@
 
 #include "axis_algorithm_transformation.hpp"
+#include "transformation.hpp"
 
 namespace xios {
 
-  class CAxis;
+class CAxis;
+class CInverseAxis;
+
 /*!
   \class CAxisAlgorithmInverse
@@ -22,7 +25,9 @@
 {
 public:
-  CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource);
+  CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource, CInverseAxis* inverseAxis);
 
   virtual ~CAxisAlgorithmInverse() {}
+
+  static bool registerTrans();
 
 protected:
@@ -31,4 +36,15 @@
 private:
   void updateAxisValue();
+
+private:
+  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
+                                                CTransformation<CAxis>* transformation,
+                                                int elementPositionInGrid,
+                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
 };
 
Index: /XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.cpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.cpp	(revision 933)
@@ -11,8 +11,35 @@
 #include "axis.hpp"
 #include "domain.hpp"
+#include "grid.hpp"
+#include "grid_transformation_factory_impl.hpp"
 
 #include "sum.hpp"
 
 namespace xios {
+CGenericAlgorithmTransformation* CAxisAlgorithmReduceDomain::create(CGrid* gridDst, CGrid* gridSrc,
+                                                                   CTransformation<CAxis>* transformation,
+                                                                   int elementPositionInGrid,
+                                                                   std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                                   std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                                   std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                                   std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                                   std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                                   std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
+  std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();
+
+  CReduceDomainToAxis* reduceDomain = dynamic_cast<CReduceDomainToAxis*> (transformation);
+  int axisDstIndex   = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
+  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
+
+  return (new CAxisAlgorithmReduceDomain(axisListDestP[axisDstIndex], domainListSrcP[domainSrcIndex], reduceDomain));
+}
+
+bool CAxisAlgorithmReduceDomain::registerTrans()
+{
+  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, create);
+}
+
 
 CAxisAlgorithmReduceDomain::CAxisAlgorithmReduceDomain(CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo)
Index: /XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.hpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.hpp	(revision 933)
@@ -11,4 +11,5 @@
 
 #include "axis_algorithm_transformation.hpp"
+#include "transformation.hpp"
 
 namespace xios {
@@ -36,4 +37,5 @@
   virtual ~CAxisAlgorithmReduceDomain();
 
+  static bool registerTrans();
 protected:
   enum ReduceDirection {
@@ -50,4 +52,14 @@
   CReductionAlgorithm* reduction_;
 
+private:
+  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
+                                                CTransformation<CAxis>* transformation,
+                                                int elementPositionInGrid,
+                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
 };
 
Index: /XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp	(revision 933)
@@ -8,6 +8,33 @@
  */
 #include "axis_algorithm_zoom.hpp"
+#include "axis.hpp"
+#include "grid.hpp"
+#include "grid_transformation_factory_impl.hpp"
+#include "zoom_axis.hpp"
 
 namespace xios {
+CGenericAlgorithmTransformation* CAxisAlgorithmZoom::create(CGrid* gridDst, CGrid* gridSrc,
+                                                           CTransformation<CAxis>* transformation,
+                                                           int elementPositionInGrid,
+                                                           std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                           std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                           std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                           std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                           std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                           std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
+  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
+
+  CZoomAxis* zoomAxis = dynamic_cast<CZoomAxis*> (transformation);
+  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
+  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
+
+  return (new CAxisAlgorithmZoom(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], zoomAxis));
+}
+bool CAxisAlgorithmZoom::registerTrans()
+{
+  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_ZOOM_AXIS, create);
+}
 
 CAxisAlgorithmZoom::CAxisAlgorithmZoom(CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis)
@@ -26,6 +53,4 @@
            << "Zoom size is " << zoomSize_ );
   }
-
-//  computeIndexSourceMapping();
 }
 
Index: /XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp	(revision 933)
@@ -11,12 +11,14 @@
 
 #include "axis_algorithm_transformation.hpp"
-#include "axis.hpp"
-#include "zoom_axis.hpp"
+#include "transformation.hpp"
 
 namespace xios {
+class CAxis;
+class CZoomAxis;
+
 /*!
   \class CAxisAlgorithmZoom
   Implementing zoom on axis
-  A zoomed region can be considered as region that isnt masked.
+  A zoomed region can be considered as region that isn't masked.
   Only this zoomed region is extracted to write on Netcdf.
 */
@@ -28,4 +30,5 @@
   virtual ~CAxisAlgorithmZoom() {}
 
+  static bool registerTrans();
 protected:
   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
@@ -44,4 +47,16 @@
   //! Global zoom size on axis
   StdSize zoomSize_;
+
+private:
+
+  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
+                                                CTransformation<CAxis>* transformation,
+                                                int elementPositionInGrid,
+                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
 };
 
Index: /XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp	(revision 933)
@@ -21,4 +21,5 @@
 : CDomainAlgorithmTransformation(domainDestination, domainSource), nbDomainDistributedPart_(0)
 {
+  type_ = ELEMENT_GENERATION;
   genRectDomain->checkValid(domainDestination);
   if (0 != gridSource) computeDistributionGridSource(gridSource);
Index: /XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp	(revision 933)
@@ -16,6 +16,34 @@
 #include "mapper.hpp"
 #include "mpi_tag.hpp"
+#include "domain.hpp"
+#include "grid_transformation_factory_impl.hpp"
+#include "interpolate_domain.hpp"
+#include "grid.hpp"
 
 namespace xios {
+CGenericAlgorithmTransformation* CDomainAlgorithmInterpolate::create(CGrid* gridDst, CGrid* gridSrc,
+                                                                     CTransformation<CDomain>* transformation,
+                                                                     int elementPositionInGrid,
+                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
+  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
+
+  CInterpolateDomain* interpolateDomain = dynamic_cast<CInterpolateDomain*> (transformation);
+  int domainDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
+  int domainSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
+
+  return (new CDomainAlgorithmInterpolate(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], interpolateDomain));
+}
+
+bool CDomainAlgorithmInterpolate::registerTrans()
+{
+  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_INTERPOLATE_DOMAIN, create);
+}
 
 CDomainAlgorithmInterpolate::CDomainAlgorithmInterpolate(CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain)
Index: /XIOS/trunk/src/transformation/domain_algorithm_interpolate.hpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_interpolate.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/domain_algorithm_interpolate.hpp	(revision 933)
@@ -11,8 +11,11 @@
 
 #include "domain_algorithm_transformation.hpp"
-#include "domain.hpp"
-#include "interpolate_domain.hpp"
+#include "transformation.hpp"
 
 namespace xios {
+
+class CDomain;
+class CInterpolateDomain;
+
 /*!
   \class CDomainAlgorithmInterpolate
@@ -26,4 +29,5 @@
   virtual ~CDomainAlgorithmInterpolate() {}
 
+  static bool registerTrans();
 protected:
   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
@@ -39,4 +43,15 @@
   CInterpolateDomain* interpDomain_;
 
+private:
+
+  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
+                                                CTransformation<CDomain>* transformation,
+                                                int elementPositionInGrid,
+                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
 };
 
Index: /XIOS/trunk/src/transformation/domain_algorithm_zoom.cpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_zoom.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/domain_algorithm_zoom.cpp	(revision 933)
@@ -8,6 +8,34 @@
  */
 #include "domain_algorithm_zoom.hpp"
+#include "zoom_domain.hpp"
+#include "domain.hpp"
+#include "grid.hpp"
+#include "grid_transformation_factory_impl.hpp"
 
 namespace xios {
+CGenericAlgorithmTransformation* CDomainAlgorithmZoom::create(CGrid* gridDst, CGrid* gridSrc,
+                                                             CTransformation<CDomain>* transformation,
+                                                             int elementPositionInGrid,
+                                                             std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                             std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                             std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                             std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                             std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                             std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
+  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
+
+  CZoomDomain* zoomDomain = dynamic_cast<CZoomDomain*> (transformation);
+  int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid];
+  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
+
+  return (new CDomainAlgorithmZoom(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], zoomDomain));
+}
+
+bool CDomainAlgorithmZoom::registerTrans()
+{
+  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_ZOOM_DOMAIN, create);
+}
 
 CDomainAlgorithmZoom::CDomainAlgorithmZoom(CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain)
@@ -39,6 +67,4 @@
            << "Zoom size is " << zoomNj_ );
   }
-
-//  computeIndexSourceMapping();
 }
 
@@ -75,6 +101,4 @@
   TransformationWeightMap& transWeight = this->transformationWeight_[0];
 
-//  std::map<int, std::vector<int> >& transMap = this->transformationMapping_;
-//  std::map<int, std::vector<double> >& transWeight = this->transformationWeight_;
   int domainGlobalIndex;
   for (int j = 0; j < nj; ++j)
Index: /XIOS/trunk/src/transformation/domain_algorithm_zoom.hpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_zoom.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/domain_algorithm_zoom.hpp	(revision 933)
@@ -11,8 +11,11 @@
 
 #include "domain_algorithm_transformation.hpp"
-#include "zoom_domain.hpp"
-#include "domain.hpp"
+#include "transformation.hpp"
 
 namespace xios {
+
+class CDomain;
+class CZoomDomain;
+
 /*!
   \class CDomainAlgorithmZoom
@@ -28,4 +31,5 @@
   virtual ~CDomainAlgorithmZoom() {}
 
+  static bool registerTrans();
 protected:
   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
@@ -47,4 +51,16 @@
   int zoomNi_;
   int zoomNj_;
+
+private:
+
+  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
+                                                CTransformation<CDomain>* transformation,
+                                                int elementPositionInGrid,
+                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
 };
 
Index: /XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
===================================================================
--- /XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 933)
@@ -15,5 +15,6 @@
 
 CGenericAlgorithmTransformation::CGenericAlgorithmTransformation()
- : transformationMapping_(), transformationWeight_(), transformationPosition_(), idAuxInputs_()
+ : transformationMapping_(), transformationWeight_(), transformationPosition_(),
+   idAuxInputs_(), type_(ELEMENT_NO_MODIFICATION_WITH_DATA)
 {
 }
@@ -658,3 +659,8 @@
 }
 
-}
+CGenericAlgorithmTransformation::AlgoTransType CGenericAlgorithmTransformation::type()
+{
+  return type_;
+}
+
+}
Index: /XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
===================================================================
--- /XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 933)
@@ -23,15 +23,19 @@
   /*!
   \class CGenericAlgorithmTransformation
-  This class defines the interface for all other inherted algorithms class
+  This class defines the interface for all other inherited algorithms class
   */
 class CGenericAlgorithmTransformation
 {
-protected:
-  typedef std::vector<std::pair<int, std::pair<size_t,double> > > DestinationGlobalIndex;
 public:
-  // Stupid global index map, it must be replaced by tuple
+  enum AlgoTransType {
+    ELEMENT_GENERATION = 0,
+    ELEMENT_MODIFICATION_WITHOUT_DATA = 1,
+    ELEMENT_MODIFICATION_WITH_DATA = 2,
+    ELEMENT_NO_MODIFICATION_WITH_DATA = 3,
+    ELEMENT_NO_MODIFICATION_WITHOUT_DATA = 4
+  } ;
+
+public:
   // Mapping between global index map of DESTINATION and its local index with pair of global index of SOURCE and weights
-  typedef boost::unordered_map<size_t, DestinationGlobalIndex> DestinationIndexMap;
-  //
   typedef boost::unordered_map<int, boost::unordered_map<size_t, std::vector<std::pair<size_t,double> > > > SourceDestinationIndexMap;
 
@@ -54,5 +58,5 @@
 
     /*!
-    Apply a reduction operation on local data.
+    Apply a operation on local data.
     \param [in] localIndex vector contains local index of local data output and the corresponding weight
     \param [in] dataInput Pointer to the first element of data input array (in form of buffer)
@@ -67,5 +71,5 @@
 
   std::vector<StdString> getIdAuxInputs();
-
+  AlgoTransType type();
   /*!
   Compute global index mapping from one element of destination grid to the corresponding element of source grid
@@ -123,4 +127,6 @@
   //! Id of auxillary inputs which helps doing transformation dynamically
   std::vector<StdString> idAuxInputs_;
+  AlgoTransType type_;
+
 
   std::map<int, int> elementPositionInGridSrc2AxisPosition_, elementPositionInGridSrc2DomainPosition_, elementPositionInGridSrc2ScalarPosition_;
Index: /XIOS/trunk/src/transformation/grid_transformation.cpp
===================================================================
--- /XIOS/trunk/src/transformation/grid_transformation.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/grid_transformation.cpp	(revision 933)
@@ -8,4 +8,5 @@
  */
 #include "grid_transformation.hpp"
+#include "grid_transformation_factory_impl.hpp"
 #include "algo_types.hpp"
 #include "context.hpp"
@@ -30,5 +31,5 @@
 
 /*!
-  Select algorithm of a scalar correspoding to its transformation type and its position in each element
+  Select algorithm of a scalar corresponding to its transformation type and its position in each element
   \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 0 and position of axis is 1
   \param [in] transType transformation type, for now we have
@@ -37,10 +38,5 @@
 void CGridTransformation::selectScalarAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder)
 {
-  int scalarSrcIndex = -1, axisSrcIndex = -1, domainSrcIndex = -1;
   std::vector<CScalar*> scaListDestP = gridDestination_->getScalars();
-  std::vector<CScalar*> scaListSrcP  = gridSource_->getScalars();
-  std::vector<CAxis*> axisListSrcP   = gridSource_->getAxis();
-  std::vector<CDomain*> domainListSrcP = gridSource_->getDomains();
-
   int scalarDstIndex =  elementPositionInGridDst2ScalarPosition_[elementPositionInGrid];
   CScalar::TransMapTypes trans = scaListDestP[scalarDstIndex]->getAllTransformations();
@@ -48,22 +44,21 @@
 
   for (int i = 0; i < transformationOrder; ++i, ++it) {}  // Find the correct transformation
-
-  CReduceAxisToScalar* reduceAxis = 0;
   CGenericAlgorithmTransformation* algo = 0;
-  switch (transType)
-  {
-    case TRANS_REDUCE_AXIS_TO_SCALAR:
-      reduceAxis = dynamic_cast<CReduceAxisToScalar*> (it->second);
-      axisSrcIndex = elementPositionInGridSrc2AxisPosition_[elementPositionInGrid];
-      algo = new CScalarAlgorithmReduceScalar(scaListDestP[scalarDstIndex], axisListSrcP[axisSrcIndex], reduceAxis);
-      break;
-    default:
-      break;
-  }
+  algo = CGridTransformationFactory<CScalar>::createTransformation(transType,
+                                                                  gridDestination_,
+                                                                  gridSource_,
+                                                                  it->second,
+                                                                  elementPositionInGrid,
+                                                                  elementPositionInGridSrc2ScalarPosition_,
+                                                                  elementPositionInGridSrc2AxisPosition_,
+                                                                  elementPositionInGridSrc2DomainPosition_,
+                                                                  elementPositionInGridDst2ScalarPosition_,
+                                                                  elementPositionInGridDst2AxisPosition_,
+                                                                  elementPositionInGridDst2DomainPosition_);
   algoTransformation_.push_back(algo);
 }
 
 /*!
-  Select algorithm of an axis correspoding to its transformation type and its position in each element
+  Select algorithm of an axis corresponding to its transformation type and its position in each element
   \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 0 and position of axis is 1
   \param [in] transType transformation type, for now we have zoom_axis, inverse_axis, interpolate_axis
@@ -72,54 +67,27 @@
 void CGridTransformation::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder)
 {
-  int axisSrcIndex = -1, domainSrcIndex = -1;
   std::vector<CAxis*> axisListDestP = gridDestination_->getAxis();
-  std::vector<CAxis*> axisListSrcP = gridSource_->getAxis();
-  std::vector<CDomain*> domainListSrcP = gridSource_->getDomains();
-
   int axisDstIndex =  elementPositionInGridDst2AxisPosition_[elementPositionInGrid];
   CAxis::TransMapTypes trans = axisListDestP[axisDstIndex]->getAllTransformations();
   CAxis::TransMapTypes::const_iterator it = trans.begin();
-
   for (int i = 0; i < transformationOrder; ++i, ++it) {}  // Find the correct transformation
 
-  CZoomAxis* zoomAxis = 0;
-  CInterpolateAxis* interpAxis = 0;
-  CReduceDomainToAxis* reduceDomain = 0;
-  CExtractDomainToAxis* extractDomain = 0;
   CGenericAlgorithmTransformation* algo = 0;
-  switch (transType)
-  {
-    case TRANS_INTERPOLATE_AXIS:
-      interpAxis = dynamic_cast<CInterpolateAxis*> (it->second);
-      axisSrcIndex = elementPositionInGridSrc2AxisPosition_[elementPositionInGrid];
-      algo = new CAxisAlgorithmInterpolate(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], interpAxis);
-      break;
-    case TRANS_ZOOM_AXIS:
-      zoomAxis = dynamic_cast<CZoomAxis*> (it->second);
-      axisSrcIndex = elementPositionInGridSrc2AxisPosition_[elementPositionInGrid];
-      algo = new CAxisAlgorithmZoom(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], zoomAxis);
-      break;
-    case TRANS_INVERSE_AXIS:
-      axisSrcIndex = elementPositionInGridSrc2AxisPosition_[elementPositionInGrid];
-      algo = new CAxisAlgorithmInverse(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex]);
-      break;
-    case TRANS_REDUCE_DOMAIN_TO_AXIS:
-      reduceDomain = dynamic_cast<CReduceDomainToAxis*> (it->second);
-      domainSrcIndex = elementPositionInGridSrc2DomainPosition_[elementPositionInGrid];
-      algo = new CAxisAlgorithmReduceDomain(axisListDestP[axisDstIndex], domainListSrcP[domainSrcIndex], reduceDomain);
-      break;
-    case TRANS_EXTRACT_DOMAIN_TO_AXIS:
-      extractDomain = dynamic_cast<CExtractDomainToAxis*> (it->second);
-      domainSrcIndex = elementPositionInGridSrc2DomainPosition_[elementPositionInGrid];
-      algo = new CAxisAlgorithmExtractDomain(axisListDestP[axisDstIndex], domainListSrcP[domainSrcIndex], extractDomain);
-      break;
-    default:
-      break;
-  }
+  algo = CGridTransformationFactory<CAxis>::createTransformation(transType,
+                                                                 gridDestination_,
+                                                                 gridSource_,
+                                                                 it->second,
+                                                                 elementPositionInGrid,
+                                                                 elementPositionInGridSrc2ScalarPosition_,
+                                                                 elementPositionInGridSrc2AxisPosition_,
+                                                                 elementPositionInGridSrc2DomainPosition_,
+                                                                 elementPositionInGridDst2ScalarPosition_,
+                                                                 elementPositionInGridDst2AxisPosition_,
+                                                                 elementPositionInGridDst2DomainPosition_);
   algoTransformation_.push_back(algo);
 }
 
 /*!
-  Select algorithm of a domain correspoding to its transformation type and its position in each element
+  Select algorithm of a domain corresponding to its transformation type and its position in each element
   \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 0 and position of axis is 1
   \param [in] transType transformation type, for now we have zoom_domain, interpolate_domain
@@ -129,28 +97,21 @@
 {
   std::vector<CDomain*> domainListDestP = gridDestination_->getDomains();
-  std::vector<CDomain*> domainListSrcP = gridSource_->getDomains();
-
   int domainIndex =  elementPositionInGridDst2DomainPosition_[elementPositionInGrid];
   CDomain::TransMapTypes trans = domainListDestP[domainIndex]->getAllTransformations();
   CDomain::TransMapTypes::const_iterator it = trans.begin();
-
   for (int i = 0; i < transformationOrder; ++i, ++it) {}  // Find the correct transformation
 
-  CZoomDomain* zoomDomain = 0;
-  CInterpolateDomain* interpFileDomain = 0;
   CGenericAlgorithmTransformation* algo = 0;
-  switch (transType)
-  {
-    case TRANS_INTERPOLATE_DOMAIN:
-      interpFileDomain = dynamic_cast<CInterpolateDomain*> (it->second);
-      algo = new CDomainAlgorithmInterpolate(domainListDestP[domainIndex], domainListSrcP[domainIndex],interpFileDomain);
-      break;
-    case TRANS_ZOOM_DOMAIN:
-      zoomDomain = dynamic_cast<CZoomDomain*> (it->second);
-      algo = new CDomainAlgorithmZoom(domainListDestP[domainIndex], domainListSrcP[domainIndex], zoomDomain);
-      break;
-    default:
-      break;
-  }
+  algo = CGridTransformationFactory<CDomain>::createTransformation(transType,
+                                                                   gridDestination_,
+                                                                   gridSource_,
+                                                                   it->second,
+                                                                   elementPositionInGrid,
+                                                                   elementPositionInGridSrc2ScalarPosition_,
+                                                                   elementPositionInGridSrc2AxisPosition_,
+                                                                   elementPositionInGridSrc2DomainPosition_,
+                                                                   elementPositionInGridDst2ScalarPosition_,
+                                                                   elementPositionInGridDst2AxisPosition_,
+                                                                   elementPositionInGridDst2DomainPosition_);
   algoTransformation_.push_back(algo);
 }
@@ -162,5 +123,5 @@
   \param [in] transType transformation type
 */
-void CGridTransformation::setUpGridDestination(int elementPositionInGrid, ETranformationType transType, int nbTransformation)
+void CGridTransformation::setUpGridDestination(int elementPositionInGrid, ETranformationType transType, AlgoType algoType)
 {
   if (isSpecialTransformation(transType)) return;
@@ -184,20 +145,13 @@
 
   int scalarIndex = -1, axisIndex = -1, domainIndex = -1;
-  switch (transType)
-  {
-    case TRANS_INTERPOLATE_DOMAIN:
-    case TRANS_ZOOM_DOMAIN:
+  switch (algoType)
+  {
+    case domainType:
       domainIndex = elementPositionInGridDst2DomainPosition_[elementPositionInGrid];
       break;
-
-    case TRANS_INTERPOLATE_AXIS:
-    case TRANS_ZOOM_AXIS:
-    case TRANS_INVERSE_AXIS:
-    case TRANS_REDUCE_DOMAIN_TO_AXIS:
-    case TRANS_EXTRACT_DOMAIN_TO_AXIS:
+    case axisType:
       axisIndex =  elementPositionInGridDst2AxisPosition_[elementPositionInGrid];
       break;
-
-    case TRANS_REDUCE_AXIS_TO_SCALAR:
+    case scalarType:
       scalarIndex = elementPositionInGridDst2ScalarPosition_[elementPositionInGrid];
       break;
@@ -244,5 +198,5 @@
   \param [in] transType transformation type
 */
-void CGridTransformation::setUpGridSource(int elementPositionInGrid, ETranformationType transType, int nbTransformation)
+void CGridTransformation::setUpGridSource(int elementPositionInGrid, AlgoType algoType)
 {
   if (!tempGridSrcs_.empty() && (getNbAlgo()-1) == tempGridSrcs_.size())
@@ -264,20 +218,13 @@
   int axisIndex = -1, domainIndex = -1, scalarIndex = -1;
   int axisListIndex = 0, domainListIndex = 0, scalarListIndex = 0;
-  switch (transType)
-  {
-    case TRANS_INTERPOLATE_DOMAIN:
-    case TRANS_ZOOM_DOMAIN:
+  switch (algoType)
+  {
+    case domainType:
       domainIndex = elementPositionInGridDst2DomainPosition_[elementPositionInGrid];
       break;
-
-    case TRANS_INTERPOLATE_AXIS:
-    case TRANS_ZOOM_AXIS:
-    case TRANS_INVERSE_AXIS:
-    case TRANS_REDUCE_DOMAIN_TO_AXIS:
-    case TRANS_EXTRACT_DOMAIN_TO_AXIS:
+    case axisType:
       axisIndex =  elementPositionInGridDst2AxisPosition_[elementPositionInGrid];
       break;
-
-    case TRANS_REDUCE_AXIS_TO_SCALAR:
+    case scalarType:
       scalarIndex = elementPositionInGridDst2ScalarPosition_[elementPositionInGrid];
       break;
@@ -378,13 +325,14 @@
     int transformationOrder = (it->second).second;
     SourceDestinationIndexMap globaIndexWeightFromSrcToDst;
+    AlgoType algoType = algoTypes_[std::distance(itb, it)];
 
     // Create a temporary grid destination which contains transformed element of grid destination and
-    // non-transformed elements fo grid source
-    setUpGridDestination(elementPositionInGrid, transType, nbAgloTransformation);
+    // non-transformed elements to grid source
+    setUpGridDestination(elementPositionInGrid, transType, algoType);
 
     // First of all, select an algorithm
     if (!dynamicalTransformation_ || (algoTransformation_.size() < listAlgos_.size()))
     {
-      selectAlgo(elementPositionInGrid, transType, transformationOrder, algoTypes_[std::distance(itb, it)]);
+      selectAlgo(elementPositionInGrid, transType, transformationOrder, algoType);
       algo = algoTransformation_.back();
     }
@@ -392,5 +340,5 @@
       algo = algoTransformation_[std::distance(itb, it)];
 
-    if (0 != algo) // Only registered transformation can be executed
+    if ((0 != algo) && (CGenericAlgorithmTransformation::ELEMENT_NO_MODIFICATION_WITH_DATA == algo->type())) // Only registered transformation can be executed
     {
       algo->computeIndexSourceMapping(dataAuxInputs);
@@ -409,5 +357,5 @@
       {
         // Now grid destination becomes grid source in a new transformation
-        if (nbAgloTransformation != (nbNormalAlgos_-1)) setUpGridSource(elementPositionInGrid, transType, nbAgloTransformation);
+        if (nbAgloTransformation != (nbNormalAlgos_-1)) setUpGridSource(elementPositionInGrid, algoType);
       }
       ++nbAgloTransformation;
Index: /XIOS/trunk/src/transformation/grid_transformation.hpp
===================================================================
--- /XIOS/trunk/src/transformation/grid_transformation.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/grid_transformation.hpp	(revision 933)
@@ -37,4 +37,5 @@
   typedef std::map<int,std::vector<std::pair<int,double> > > RecvIndexGridDestinationMap;
   typedef CGenericAlgorithmTransformation::SourceDestinationIndexMap SourceDestinationIndexMap;
+  typedef CGenericAlgorithmTransformation::AlgoTransType AlgoTransType;
 
 public:
@@ -60,6 +61,6 @@
   virtual void selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder);
 
-  void setUpGridSource(int elementPositionInGrid, ETranformationType transType, int nbTransformation);
-  void setUpGridDestination(int elementPositionInGrid, ETranformationType transType, int nbTransformation);
+  void setUpGridSource(int elementPositionInGrid, AlgoType);
+  void setUpGridDestination(int elementPositionInGrid, ETranformationType, AlgoType);
   void computeTransformationMapping(const SourceDestinationIndexMap& globalIndexWeightFromSrcToDest);
 
@@ -71,5 +72,5 @@
 
 protected:
-  //! Mapping of (grid) global index representing tranformation.
+  //! Mapping of (grid) global index representing transformation.
   std::map<size_t, std::set<size_t> > globaIndexMapFromDestToSource_;
 
Index: /XIOS/trunk/src/transformation/grid_transformation_factory_decl.cpp
===================================================================
--- /XIOS/trunk/src/transformation/grid_transformation_factory_decl.cpp	(revision 933)
+++ /XIOS/trunk/src/transformation/grid_transformation_factory_decl.cpp	(revision 933)
@@ -0,0 +1,23 @@
+/*!
+   \file grid_transformation.cpp
+   \author Ha NGUYEN
+   \since 14 May 2015
+   \date 02 Jul 2015
+
+   \brief Interface for all transformations.
+ */
+#include "grid_transformation_factory_impl.hpp"
+#include "scalar.hpp"
+#include "axis.hpp"
+#include "domain.hpp"
+
+namespace xios
+{
+
+template class CGridTransformationFactory<CScalar>;
+template class CGridTransformationFactory<CAxis>;
+template class CGridTransformationFactory<CDomain>;
+
+}
+
+
Index: /XIOS/trunk/src/transformation/grid_transformation_factory_impl.hpp
===================================================================
--- /XIOS/trunk/src/transformation/grid_transformation_factory_impl.hpp	(revision 933)
+++ /XIOS/trunk/src/transformation/grid_transformation_factory_impl.hpp	(revision 933)
@@ -0,0 +1,114 @@
+/*!
+   \file grid_transformation_factory_impl.hpp
+   \author Ha NGUYEN
+   \since 23 June 2016
+   \date 23 June 2016
+
+   \brief Helper class to create different transformations.
+ */
+#ifndef __XIOS_GRID_TRANSFORMATION_FACTORY_HPP__
+#define __XIOS_GRID_TRANSFORMATION_FACTORY_HPP__
+
+#include "xios_spl.hpp"
+#include "exception.hpp"
+#include "transformation.hpp"
+
+namespace xios {
+
+class CGrid;
+class CGenericAlgorithmTransformation;
+
+
+/*!
+  \class CGridTransformationFactory
+  This class is a helper class to chose a algorithm (transformation) from the alogrithm list of
+specific grid.
+*/
+template<typename T>
+class CGridTransformationFactory
+{
+public:
+  /** Default constructor */
+  CGridTransformationFactory() {}
+  virtual ~CGridTransformationFactory() {}
+
+  static CGenericAlgorithmTransformation* createTransformation(ETranformationType transType,
+                                                               CGrid* gridDst, CGrid* gridSrc,
+                                                               CTransformation<T>* transformation,
+                                                               int elementPositionInGrid,
+                                                               std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                               std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                               std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                               std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                               std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                               std::map<int, int>& elementPositionInGridDst2DomainPosition);
+
+public:
+  typedef CGenericAlgorithmTransformation* (*CreateTransformationCallBack)(CGrid* gridDst, CGrid* gridSrc,
+                                                                           CTransformation<T>* transformation,
+                                                                           int elementPositionInGrid,
+                                                                           std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                                           std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                                           std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                                           std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                                           std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                                           std::map<int, int>& elementPositionInGridDst2DomainPosition);
+
+  typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap;
+  static CallBackMap* transformationCreationCallBacks_;
+  static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn);
+  static bool unregisterTransformation(ETranformationType transType);
+  static bool initializeTransformation_;
+};
+
+template<typename T>
+typename CGridTransformationFactory<T>::CallBackMap* CGridTransformationFactory<T>::transformationCreationCallBacks_ = 0;
+template<typename T>
+bool CGridTransformationFactory<T>::initializeTransformation_ = false;
+
+template<typename T>
+CGenericAlgorithmTransformation* CGridTransformationFactory<T>::createTransformation(ETranformationType transType,
+                                                                               CGrid* gridDst, CGrid* gridSrc,
+                                                                               CTransformation<T>* transformation,
+                                                                               int elementPositionInGrid,
+                                                                               std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                                               std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                                               std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                                               std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                                               std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                                               std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  typename CallBackMap::const_iterator it = (*transformationCreationCallBacks_).find(transType);
+  if ((*transformationCreationCallBacks_).end() == it)
+  {
+     ERROR("CGridTransformationFactory::createTransformation(ETranformationType transType)",
+           << "Transformation type " << transType
+           << "doesn't exist. Please define.");
+  }
+  return (it->second)(gridDst, gridSrc, transformation, elementPositionInGrid,
+                      elementPositionInGridSrc2ScalarPosition,
+                      elementPositionInGridSrc2AxisPosition,
+                      elementPositionInGridSrc2DomainPosition,
+                      elementPositionInGridDst2ScalarPosition,
+                      elementPositionInGridDst2AxisPosition,
+                      elementPositionInGridDst2DomainPosition);
+}
+
+template<typename T>
+bool CGridTransformationFactory<T>::registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn)
+{
+  if (0 == transformationCreationCallBacks_)
+    transformationCreationCallBacks_ = new CallBackMap();
+
+  return (*transformationCreationCallBacks_).insert(make_pair(transType, createFn)).second;
+}
+
+template<typename T>
+bool CGridTransformationFactory<T>::unregisterTransformation(ETranformationType transType)
+{
+  return (1 == (*transformationCreationCallBacks_).erase(transType));
+}
+
+
+}
+#endif // __XIOS_GRID_TRANSFORMATION_FACTORY_HPP__
Index: /XIOS/trunk/src/transformation/grid_transformation_selector.cpp
===================================================================
--- /XIOS/trunk/src/transformation/grid_transformation_selector.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/grid_transformation_selector.cpp	(revision 933)
@@ -9,5 +9,5 @@
 #include "grid_transformation_selector.hpp"
 #include "grid.hpp"
-//#include <boost/unordered_map.hpp>
+#include "algo_types.hpp"
 
 namespace xios {
@@ -27,4 +27,5 @@
        << "Number of elements of grid source " <<gridSource_->getId() << " is " << gridSource_->axis_domain_order.numElements()  << std::endl
        << "Number of elements of grid destination " <<gridDestination_->getId() << " is " << numElement);
+  registerTransformations();
   initializeTransformations(type);
 }
@@ -306,3 +307,23 @@
 }
 
-}
+
+void CGridTransformationSelector::registerTransformations()
+{
+  //! Scalar
+  CScalarAlgorithmReduceScalar::registerTrans();
+
+  //! Axis
+  CAxisAlgorithmZoom::registerTrans();
+  CAxisAlgorithmExtractDomain::registerTrans();
+  CAxisAlgorithmInterpolate::registerTrans();
+  CAxisAlgorithmInverse::registerTrans();
+  CAxisAlgorithmReduceDomain::registerTrans();
+
+  //! Domain
+//  CDomainAlgorithmComputeConnectivity::registerTrans();
+  CDomainAlgorithmInterpolate::registerTrans();
+  CDomainAlgorithmZoom::registerTrans();
+
+}
+
+}
Index: /XIOS/trunk/src/transformation/grid_transformation_selector.hpp
===================================================================
--- /XIOS/trunk/src/transformation/grid_transformation_selector.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/grid_transformation_selector.hpp	(revision 933)
@@ -22,5 +22,5 @@
 /*!
   \class CGridTransformationSelector
-  This class is a helper class to chose a algorithm (transformation) from the alogrithm list of
+  This class is a helper class to chose a algorithm (transformation) from the algorithm list of
 specific grid.
 */
@@ -57,4 +57,5 @@
   void selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, AlgoType algo);
   bool isSpecialTransformation(ETranformationType transType);
+  void registerTransformations();
 
 protected:
Index: /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp
===================================================================
--- /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp	(revision 932)
+++ /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp	(revision 933)
@@ -12,6 +12,32 @@
 #include "reduce_axis_to_scalar.hpp"
 #include "sum.hpp"
+#include "grid.hpp"
+#include "grid_transformation_factory_impl.hpp"
 
 namespace xios {
+CGenericAlgorithmTransformation* CScalarAlgorithmReduceScalar::create(CGrid* gridDst, CGrid* gridSrc,
+                                                                     CTransformation<CScalar>* transformation,
+                                                                     int elementPositionInGrid,
+                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
+{
+  std::vector<CScalar*> scalarListDestP = gridDst->getScalars();
+  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
+
+  CReduceAxisToScalar* reduceAxis = dynamic_cast<CReduceAxisToScalar*> (transformation);
+  int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid];
+  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
+
+  return (new CScalarAlgorithmReduceScalar(scalarListDestP[scalarDstIndex], axisListSrcP[axisSrcIndex], reduceAxis));
+}
+
+bool CScalarAlgorithmReduceScalar::registerTrans()
+{
+  CGridTransformationFactory<CScalar>::registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, create);
+}
 
 CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo)
Index: /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.hpp
===================================================================
--- /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.hpp	(revision 932)
+++ /XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.hpp	(revision 933)
@@ -11,4 +11,5 @@
 
 #include "scalar_algorithm_transformation.hpp"
+#include "transformation.hpp"
 
 namespace xios {
@@ -21,5 +22,5 @@
 /*!
   \class CScalarAlgorithmReduceScalar
-  Inversing an axis to a scalar
+  Reducing an axis to a scalar
 */
 class CScalarAlgorithmReduceScalar : public CScalarAlgorithmTransformation
@@ -36,4 +37,5 @@
   virtual ~CScalarAlgorithmReduceScalar();
 
+  static bool registerTrans();
 protected:
   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
@@ -42,4 +44,15 @@
   CReductionAlgorithm* reduction_;
 
+private:
+
+  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
+                                                CTransformation<CScalar>* transformation,
+                                                int elementPositionInGrid,
+                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
+                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
+                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
+                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
 };
 
