Index: XIOS/trunk/inputs/REMAP/iodef.xml
===================================================================
--- XIOS/trunk/inputs/REMAP/iodef.xml	(revision 774)
+++ XIOS/trunk/inputs/REMAP/iodef.xml	(revision 775)
@@ -8,8 +8,9 @@
    <field_definition level="1" >
      <field id="src_field" operation="instant" domain_ref="src_domain"/>
-     <field id="dst_field" operation="instant" field_ref="src_field" domain_ref="dst_domain"/>
-     <field id="tmp_field" operation="instant" domain_ref="src_domain_regular"/>
+<!--     <field id="dst_field" operation="instant" field_ref="src_field" domain_ref="dst_domain"/>-->
+     <field id="tmp_field" operation="instant" domain_ref="src_domain_regular_tmp"/>
+     <field id="tmp_field_1" operation="instant" grid_ref="src_grid_curvilinear" />
      <field id="dst_field_regular" operation="instant" field_ref="tmp_field" domain_ref="dst_domain_regular" read_access="true"/>
-     <field id="dst_field_regular_pole" operation="instant" field_ref="src_field" domain_ref="dst_domain_regular_pole" read_access="true"/>
+<!--     <field id="dst_field_regular_pole" operation="instant" field_ref="src_field" domain_ref="dst_domain_regular_pole" read_access="true"/>-->
    </field_definition>
 
@@ -17,20 +18,29 @@
    <file_definition type="one_file" par_access="collective" output_freq="1ts" output_level="10" enabled=".TRUE.">
      <file id="output" name="output">
-        <field field_ref="src_field" name="field" />
+<!--        <field field_ref="src_field" name="field" />-->
      </file>
      <file id="output_dst" name="output_dst" type="one_file">
-        <field field_ref="dst_field" name="field" />
+<!--        <field field_ref="dst_field" name="field" />-->
      </file>
      <file id="out_dst_regular_pole" name="out_dst_regular_pole" type="one_file">
-        <field field_ref="dst_field_regular_pole" name="field" />
+<!--        <field field_ref="dst_field_regular_pole" name="field" />-->
      </file>
      <file id="output_dst_regular" name="output_dst_regular" type="one_file">
         <field field_ref="dst_field_regular" name="field" />
      </file>
+     <file id="output_dst_curvilinear" name="output_dst_curvilinear" type="one_file">
+        <field field_ref="tmp_field_1" operation="instant"/>
+     </file>
+
      <file id="output_src_regular" name="output_src_regular" mode="read" type="multiple_file">
-        <field id="src_field_regular" name="field" domain_ref="src_domain_regular" operation="instant"/>
+<!--        <field id="src_field_regular" name="field" domain_ref="src_domain_regular" operation="instant"/>-->
      </file>
-     <file id="output_src_regular_tmp" name="output_src_regular_tmp">
-<!--        <field field_ref="tmp_field"/>-->
+     <file id="output_src_regular_tmp" name="output_src_regular_tmp" mode="read" type="one_file">
+        <field id="src_field_regular_tmp" name="field" domain_ref="src_domain_regular_tmp" operation="instant"/>
+     </file>
+
+     <file id="output_src_curvilinear" name="output_src_curvilinear" mode="read" type="one_file">
+<!--        <field id="src_field_curvilinear" name="field_A" domain_ref="src_domain_curvilinear" axis_ref="src_axis_curvilinear" operation="instant"/>-->
+        <field id="src_field_curvilinear" name="field_A" grid_ref="src_grid_curvilinear" operation="instant"/>
      </file>
    </file_definition>
@@ -38,4 +48,5 @@
 
    <axis_definition>
+     <axis id="src_axis_curvilinear" />
    </axis_definition>
 
@@ -49,5 +60,6 @@
        <interpolate_domain/>
      </domain>
-     <domain id="dst_domain_regular" domain_src="src_domain_regular" ni_glo="90" nj_glo="45" type="rectilinear">
+<!--     <domain id="dst_domain_regular" domain_src="src_domain_regular" ni_glo="90" nj_glo="45" type="rectilinear">-->
+     <domain id="dst_domain_regular" domain_src="src_domain_regular_tmp" ni_glo="90" nj_glo="45" type="rectilinear">
        <generate_rectilinear_domain />
        <interpolate_domain/>
@@ -56,7 +68,19 @@
        <generate_rectilinear_domain lat_start="-90" lat_end="90" lon_start="2" lon_end="360" />
      </domain>
+     <domain id="src_domain_regular_tmp" type="rectilinear">
+       <generate_rectilinear_domain />
+     </domain>
+     <domain id="src_domain_curvilinear" type="rectilinear">
+       <generate_rectilinear_domain />
+     </domain>
    </domain_definition>
+
+  <grid_definition>
+    <grid id="src_grid_curvilinear">
+      <domain domain_ref="src_domain_curvilinear"/>
+      <axis axis_ref="src_axis_curvilinear" />
+    </grid>
+  </grid_definition>
   </context>
-
 
   <context id="xios">
Index: XIOS/trunk/inputs/Version2/iodef.xml
===================================================================
--- XIOS/trunk/inputs/Version2/iodef.xml	(revision 774)
+++ XIOS/trunk/inputs/Version2/iodef.xml	(revision 775)
@@ -33,6 +33,6 @@
 <!--        <field field_ref="field_Axis_transformed_Interpolated" />-->
      </file>
-     <file id="output_Domain_transformed_interpolated" name="output_Domain_transformed_interpolated">
-<!--        <field field_ref="field_Domain_transformed_Interpolated" />-->
+     <file id="output_Domain_transformed_interpolated" name="output_Domain_transformed_interpolated" type="one_file">
+        <field field_ref="field_Domain_transformed_Interpolated" />
      </file>
      <file id="output_Scalar" name="output_Scalar" type="one_file">
Index: XIOS/trunk/src/attribute_array.hpp
===================================================================
--- XIOS/trunk/src/attribute_array.hpp	(revision 774)
+++ XIOS/trunk/src/attribute_array.hpp	(revision 775)
@@ -9,5 +9,5 @@
 #include "buffer_out.hpp"
 #include "array_new.hpp"
-
+#include "attribute_public.hpp"
 
 namespace xios
@@ -15,5 +15,5 @@
       /// ////////////////////// DÃ©clarations ////////////////////// ///
       template <typename T_numtype, int N_rank>
-         class CAttributeArray : public CAttribute, public CArray<T_numtype, N_rank>
+         class CAttributeArray : public CAttribute, public CArray<T_numtype, N_rank>, public PublicAttributes
       {
         public :
@@ -21,10 +21,10 @@
            using CArray<T_numtype,N_rank>::operator = ;
 //           using Array<T_numtype,N_rank>::operator = ;
-           
+
             /// Constructeurs ///
             explicit CAttributeArray(const StdString & id);
             CAttributeArray(const StdString & id, xios_map<StdString, CAttribute*> & umap);
             CAttributeArray(const StdString & id, const CArray<T_numtype, N_rank>& value);
-            CAttributeArray(const StdString & id, const CArray<T_numtype, N_rank>& value, 
+            CAttributeArray(const StdString & id, const CArray<T_numtype, N_rank>& value,
                            xios_map<StdString, CAttribute*> & umap);
 
@@ -36,9 +36,9 @@
             void set(const CAttribute& attr) ;
             void set(const CAttributeArray& attr) ;
-            void reset(void) ;            
+            void reset(void) ;
             void setInheritedValue(const CAttributeArray& attr );
             void setInheritedValue(const CAttribute& attr );
             CArray<T_numtype, N_rank> getInheritedValue(void) const ;
-            bool hasInheritedValue(void) const;            
+            bool hasInheritedValue(void) const;
 
             /// Destructeur ///
@@ -49,7 +49,7 @@
             virtual string toString(void) const { return _toString();}
             virtual void fromString(const StdString & str) { _fromString(str);}
-            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);} 
-            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } 
-            
+            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);}
+            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); }
+
             virtual void generateCInterface(ostream& oss,const string& className) ;
             virtual void generateFortran2003Interface(ostream& oss,const string& className) ;
@@ -61,5 +61,5 @@
             virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ;
 
-      
+
          protected :
 
@@ -72,5 +72,5 @@
           bool _toBuffer  (CBufferOut& buffer) const;
           bool _fromBuffer(CBufferIn& buffer) ;
-      }; // class CAttributeEnum    
+      }; // class CAttributeEnum
 } // namespace xios
 
Index: XIOS/trunk/src/attribute_array_impl.hpp
===================================================================
--- XIOS/trunk/src/attribute_array_impl.hpp	(revision 774)
+++ XIOS/trunk/src/attribute_array_impl.hpp	(revision 775)
@@ -7,5 +7,5 @@
 #include "attribute_array.hpp"
 
-  
+
 namespace xios
 {
@@ -47,5 +47,5 @@
         inheritedValue.reset() ;
       }
-      
+
       template <typename T_numtype, int N_rank>
       CArray<T_numtype,N_rank> CAttributeArray<T_numtype, N_rank>::getValue(void) const
@@ -65,5 +65,5 @@
     {
       this->set(dynamic_cast<const CAttributeArray<T_numtype,N_rank>& >(attr)) ;
-    } 
+    }
 
     template <typename T_numtype, int N_rank>
@@ -71,22 +71,22 @@
     {
       this->setValue(attr) ;
-    } 
-    
-    
+    }
+
+
     template <typename T_numtype, int N_rank>
     void CAttributeArray<T_numtype,N_rank>::setInheritedValue(const CAttribute& attr)
     {
       this->setInheritedValue(dynamic_cast<const CAttributeArray<T_numtype,N_rank>& >(attr)) ;
-    } 
+    }
 
     template <typename T_numtype, int N_rank>
     void CAttributeArray<T_numtype,N_rank>::setInheritedValue(const CAttributeArray& attr)
     {
-      if (this->isEmpty() && attr.hasInheritedValue()) 
+      if (this->isEmpty() && attr.hasInheritedValue())
       {
         inheritedValue.resize(attr.shape()) ;
         inheritedValue=attr ;
       }
-    } 
+    }
 
     template <typename T_numtype, int N_rank>
@@ -95,12 +95,12 @@
       if (this->isEmpty()) return inheritedValue.copy() ;
       else return getValue() ;
-    } 
-    
+    }
+
     template <typename T_numtype, int N_rank>
     bool CAttributeArray<T_numtype,N_rank>::hasInheritedValue(void) const
     {
       return !this->isEmpty() || !inheritedValue.isEmpty() ;
-    } 
-    
+    }
+
 
     template <typename T_numtype, int N_rank>
@@ -133,23 +133,27 @@
       void CAttributeArray<T_numtype, N_rank>::generateCInterface(ostream& oss,const string& className)
       {
-        CInterface::AttributeCInterface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeCInterface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
       }
-      
+
       template <typename T_numtype, int N_rank>
       void CAttributeArray<T_numtype, N_rank>::generateFortran2003Interface(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortran2003Interface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortran2003Interface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
       }
-      
+
       template <typename T_numtype, int N_rank>
       void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceDeclaration_(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ;
       }
- 
+
       template <typename T_numtype, int N_rank>
       void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceBody_(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
       }
 
@@ -157,17 +161,20 @@
       void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceDeclaration(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
       }
-      
+
       template <typename T_numtype, int N_rank>
       void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ;
       }
- 
+
       template <typename T_numtype, int N_rank>
       void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetBody_(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceGetBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceGetBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
       }
 
@@ -175,5 +182,6 @@
       void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetDeclaration(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ;
       }
 } // namespace xios
Index: XIOS/trunk/src/attribute_public.hpp
===================================================================
--- XIOS/trunk/src/attribute_public.hpp	(revision 775)
+++ XIOS/trunk/src/attribute_public.hpp	(revision 775)
@@ -0,0 +1,25 @@
+/*!
+   \file attribute_public.hpp
+   \author Ha NGUYEN
+   \since 27 Oct 2015
+   \date 27 Oct 2015
+
+   \brief Class for public attributes
+ */
+
+#ifndef __XIOS_ATTRIBUTE_PUBLIC_HPP__
+#define __XIOS_ATTRIBUTE_PUBLIC_HPP__
+
+namespace xios
+{
+/*!
+  This class allows to chose whether to expose the attributes in config file to C interface and Fortran Interface
+*/
+class PublicAttributes
+{
+public:
+  virtual bool isAttributePublic() {return true;}
+};
+}
+
+#endif // __UTILS_HPP__
Index: XIOS/trunk/src/attribute_template.hpp
===================================================================
--- XIOS/trunk/src/attribute_template.hpp	(revision 774)
+++ XIOS/trunk/src/attribute_template.hpp	(revision 775)
@@ -12,5 +12,5 @@
 #include "buffer_out.hpp"
 #include "type.hpp"
-
+#include "attribute_public.hpp"
 
 namespace xios
@@ -18,5 +18,5 @@
       /// ////////////////////// DÃ©clarations ////////////////////// ///
       template <class T>
-         class CAttributeTemplate : public CAttribute, public CType<T>
+         class CAttributeTemplate : public CAttribute, public CType<T>, public PublicAttributes
       {
             typedef CAttribute SuperClass;
@@ -45,5 +45,5 @@
             /// Mutateurs ///
             void setValue(const ValueType & value);
-            
+
             void set(const CAttribute& attr) ;
             void set(const CAttributeTemplate& attr) ;
@@ -54,5 +54,5 @@
             T getInheritedValue(void) const ;
             bool hasInheritedValue(void) const;
-            
+
             /// Destructeur ///
             virtual ~CAttributeTemplate(void) { }
@@ -66,8 +66,8 @@
 //            virtual CAttributeTemplate* clone() const {}
 //            virtual void toBinary  (StdOStream & os) const;
-//            virtual void fromBinary(StdIStream & is);            
+//            virtual void fromBinary(StdIStream & is);
 
-            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);} 
-            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } 
+            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);}
+            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); }
 //            virtual size_t size(void) const;
             virtual void generateCInterface(ostream& oss,const string& className) ;
@@ -83,5 +83,5 @@
 //            virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ;
 
-      
+
          protected :
 
@@ -93,11 +93,11 @@
           bool _toBuffer  (CBufferOut& buffer) const;
           bool _fromBuffer(CBufferIn& buffer) ;
-          
+
           CType<T> inheritedValue ;
-      }; // class CAttribute    
-      
-   
+      }; // class CAttribute
+
+
    template <class T>  void FromBinary(StdIStream & is, T & obj);
-   
+
 } // namespace xios
 
Index: XIOS/trunk/src/attribute_template_impl.hpp
===================================================================
--- XIOS/trunk/src/attribute_template_impl.hpp	(revision 774)
+++ XIOS/trunk/src/attribute_template_impl.hpp	(revision 775)
@@ -8,5 +8,5 @@
 #include "attribute_template.hpp"
 
-  
+
 namespace xios
 {
@@ -54,5 +54,5 @@
       template <class T>
       CAttributeTemplate<T>::~CAttributeTemplate(void)
-      { 
+      {
 //         this->CType<T>::reset() ;
 //         this->clear();
@@ -108,5 +108,5 @@
     {
       this->set(dynamic_cast<const CAttributeTemplate<T>& >(attr)) ;
-    } 
+    }
 
    template <class T>
@@ -114,5 +114,5 @@
     {
       CType<T>::set(attr) ;
-    } 
+    }
 
     template <class T>
@@ -120,5 +120,5 @@
     {
       this->setInheritedValue(dynamic_cast<const CAttributeTemplate<T>& >(attr)) ;
-    } 
+    }
 
     template <class T>
@@ -126,5 +126,5 @@
     {
       if (this->isEmpty() && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()) ;
-    } 
+    }
 
     template <class T>
@@ -133,12 +133,12 @@
       if (this->isEmpty()) return inheritedValue.get() ;
       else return getValue() ;
-    } 
-    
+    }
+
     template <class T>
     bool CAttributeTemplate<T>::hasInheritedValue(void) const
     {
       return !this->isEmpty() || !inheritedValue.isEmpty() ;
-    } 
-    
+    }
+
       //---------------------------------------------------------------
 
@@ -188,5 +188,5 @@
       {
          return CType<T>::toBuffer(buffer) ;
-/*         
+/*
          if (isEmpty()) return buffer.put(true) ;
          else
@@ -205,9 +205,9 @@
       {
         return CType<T>::fromBuffer(buffer) ;
-/*        
+/*
         bool empty ;
         bool ret=true ;
         ret&=buffer.get(empty) ;
-        if (empty) 
+        if (empty)
         {
           clear() ;
@@ -230,7 +230,7 @@
       template <class T>
       size_t CAttributeTemplate<T>::size(void) const
-      { 
+      {
         return CType<T>::size() ;*/
-/*        
+/*
         if (isEmpty()) return sizeof(bool) ;
         else
@@ -245,25 +245,29 @@
       void CAttributeTemplate<T>::generateCInterface(ostream& oss,const string& className)
       {
-        CInterface::AttributeCInterface<T>(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeCInterface<T>(oss, className, this->getName()) ;
 //        CInterface::AttributeIsDefinedCInterface(oss, className, this->getName()) ;
       }
-      
+
       template <typename T>
       void CAttributeTemplate<T>::generateFortran2003Interface(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortran2003Interface<T>(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortran2003Interface<T>(oss, className, this->getName()) ;
 //        CInterface::AttributeIsDefinedFortran2003Interface(oss, className, this->getName()) ;
       }
-      
+
       template <typename T>
       void CAttributeTemplate<T>::generateFortranInterfaceDeclaration_(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceDeclaration<T>(oss, className, this->getName()+"_") ;
-      }
- 
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceDeclaration<T>(oss, className, this->getName()+"_") ;
+      }
+
       template <typename T>
       void CAttributeTemplate<T>::generateFortranInterfaceBody_(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceBody<T>(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceBody<T>(oss, className, this->getName()) ;
       }
 
@@ -271,18 +275,21 @@
       void CAttributeTemplate<T>::generateFortranInterfaceDeclaration(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceDeclaration<T>(oss, className, this->getName()) ;
-      }
-      
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceDeclaration<T>(oss, className, this->getName()) ;
+      }
+
       template <typename T>
       void CAttributeTemplate<T>::generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceGetDeclaration<T>(oss, className, this->getName()+"_") ;
-      }
- 
- 
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceGetDeclaration<T>(oss, className, this->getName()+"_") ;
+      }
+
+
       template <typename T>
       void CAttributeTemplate<T>::generateFortranInterfaceGetBody_(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceGetBody<T>(oss, className, this->getName()) ;
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceGetBody<T>(oss, className, this->getName()) ;
       }
 
@@ -290,12 +297,13 @@
       void CAttributeTemplate<T>::generateFortranInterfaceGetDeclaration(ostream& oss,const string& className)
       {
-        CInterface::AttributeFortranInterfaceGetDeclaration<T>(oss, className, this->getName()) ;
-      }
-
- 
-/*      
-      //---------------------------------------------------------------
-
-      // SpÃ©cialisations des templates pour la fonction [toString] 
+        if (this->isAttributePublic())
+          CInterface::AttributeFortranInterfaceGetDeclaration<T>(oss, className, this->getName()) ;
+      }
+
+
+/*
+      //---------------------------------------------------------------
+
+      // SpÃ©cialisations des templates pour la fonction [toString]
 
       template <>
@@ -304,5 +312,5 @@
       //---------------------------------------------------------------
 
-      // SpÃ©cialisations des templates pour la fonction [fromString] 
+      // SpÃ©cialisations des templates pour la fonction [fromString]
 
       template <> // ChaÃ®ne de caractÃšres.
@@ -333,5 +341,5 @@
       template <> // BoolÃ©en
          void CAttributeTemplate<bool>::toBinary(StdOStream & os) const;
-         
+
       template <> // Double
          void CAttributeTemplate<double>::toBinary(StdOStream & os) const;
@@ -349,10 +357,10 @@
       template <> // BoolÃ©en
          void CAttributeTemplate<bool>::fromBinary(StdIStream & is);
-         
+
       template <> // Double
          void CAttributeTemplate<double>::fromBinary(StdIStream & is);
 
       ///--------------------------------------------------------------
-*/      
+*/
 } // namespace xios
 
Index: XIOS/trunk/src/config/axis_attribute.conf
===================================================================
--- XIOS/trunk/src/config/axis_attribute.conf	(revision 774)
+++ XIOS/trunk/src/config/axis_attribute.conf	(revision 775)
@@ -7,4 +7,7 @@
 DECLARE_ATTRIBUTE(int,       n_glo)
 DECLARE_ENUM2(positive, up, down)
+
+/* GLOBAL */
+DECLARE_ATTRIBUTE(int,       n_distributed_partition)
 
 /* LOCAL */
Index: XIOS/trunk/src/config/domain_attribute_private.conf
===================================================================
--- XIOS/trunk/src/config/domain_attribute_private.conf	(revision 775)
+++ XIOS/trunk/src/config/domain_attribute_private.conf	(revision 775)
@@ -0,0 +1,14 @@
+/* PRIVATE ATTRIBUTES */
+DECLARE_ATTRIBUTE_PRIVATE(double,  lon_start)
+DECLARE_ATTRIBUTE_PRIVATE(double,  lon_end)
+DECLARE_ATTRIBUTE_PRIVATE(double,  lat_start)
+DECLARE_ATTRIBUTE_PRIVATE(double,  lat_end)
+
+DECLARE_ATTRIBUTE_PRIVATE(double,  bounds_lon_start)
+DECLARE_ATTRIBUTE_PRIVATE(double,  bounds_lon_end)
+DECLARE_ATTRIBUTE_PRIVATE(double,  bounds_lat_start)
+DECLARE_ATTRIBUTE_PRIVATE(double,  bounds_lat_end)
+
+// Array contain whole value (non distributed) of longitude and latitude read from a file
+DECLARE_ARRAY_PRIVATE(double, 1, lonvalue_rectilinear_read_from_file)
+DECLARE_ARRAY_PRIVATE(double, 1, latvalue_rectilinear_read_from_file)
Index: XIOS/trunk/src/data_input.cpp
===================================================================
--- XIOS/trunk/src/data_input.cpp	(revision 774)
+++ XIOS/trunk/src/data_input.cpp	(revision 775)
@@ -30,3 +30,13 @@
     this->closeFile_();
   }
+
+  void CDataInput::readFieldAttributesMetaData(CField* field)
+  {
+    this->readFieldAttributes_(field, false);
+  }
+
+  void CDataInput::readFieldAttributesValues(CField* field)
+  {
+    this->readFieldAttributes_(field, true);
+  }
 } // namespace xios
Index: XIOS/trunk/src/data_input.hpp
===================================================================
--- XIOS/trunk/src/data_input.hpp	(revision 774)
+++ XIOS/trunk/src/data_input.hpp	(revision 775)
@@ -19,4 +19,6 @@
       StdSize getFieldNbRecords(CField* field);
       void readFieldData(CField* field);
+      void readFieldAttributesMetaData(CField* field);
+      void readFieldAttributesValues(CField* field);
       void closeFile(void);
 
@@ -26,4 +28,5 @@
       virtual StdSize getFieldNbRecords_(CField* field) = 0;
       virtual void readFieldData_(CField* field) = 0;
+      virtual void readFieldAttributes_(CField* field, bool readAttributeValues) = 0;
       virtual void closeFile_(void) = 0;
 
Index: XIOS/trunk/src/declare_attribute.hpp
===================================================================
--- XIOS/trunk/src/declare_attribute.hpp	(revision 774)
+++ XIOS/trunk/src/declare_attribute.hpp	(revision 775)
@@ -3,5 +3,4 @@
 
 /// ///////////////////////////// Macros ///////////////////////////// ///
-
 #define DECLARE_ATTRIBUTE(type, name)                             \
    class name##_attr : public CAttributeTemplate<type>            \
@@ -18,4 +17,20 @@
    } name;
 
+#define DECLARE_ATTRIBUTE_PRIVATE(type, name)                    \
+   class name##_attr : public CAttributeTemplate<type>           \
+   {                                                              \
+      public :                                                    \
+         name##_attr(void)                                          \
+            : CAttributeTemplate<type>                            \
+            (#name, *CAttributeMap::Current)                      \
+         { /* Ne rien faire de plus */ }                          \
+         type operator=(const type & value)                       \
+         { return (CAttributeTemplate<type>::operator=(value)); } \
+         virtual bool isAttributePublic()                         \
+         { return false; }                                        \
+         virtual ~name##_attr(void)                               \
+         { /* Ne rien faire de plus */ }                          \
+   } name;
+
 #define DECLARE_ARRAY(T_num, T_rank, name)                        \
    class name##_attr : public CAttributeArray<T_num, T_rank>      \
@@ -26,5 +41,16 @@
          virtual ~name##_attr(void) {}                            \
    } name;
-   
+
+#define DECLARE_ARRAY_PRIVATE(T_num, T_rank, name)                        \
+   class name##_attr : public CAttributeArray<T_num, T_rank>      \
+   {                                                              \
+      public :                                                    \
+         using CAttributeArray<T_num, T_rank>::operator = ;       \
+         name##_attr(void) : CAttributeArray<T_num, T_rank> (#name, *CAttributeMap::Current) {} \
+         virtual bool isAttributePublic()                         \
+         { return false; }                                        \
+         virtual ~name##_attr(void) {}                            \
+   } name;
+
 #define DECLARE_CLASS_ENUM(name)                                   \
    class name##_attr : public CAttributeEnum<Enum_##name>          \
@@ -34,5 +60,5 @@
          virtual ~name##_attr(void) {}                           \
    } name;
-   
+
 #define DECLARE_ENUM2(name,arg1,arg2)                             \
    class Enum_##name                                              \
@@ -44,5 +70,5 @@
    } ;                                                            \
    DECLARE_CLASS_ENUM(name)
-   
+
 #define DECLARE_ENUM3(name,arg1,arg2,arg3)                             \
    class Enum_##name                                              \
@@ -113,5 +139,5 @@
      int getSize(void) const { return 9 ; }                       \
    } ;                                                            \
-   DECLARE_CLASS_ENUM(name) 
+   DECLARE_CLASS_ENUM(name)
 
   #define DECLARE_TYPE(name)                                      \
Index: XIOS/trunk/src/declare_ref_func.hpp
===================================================================
--- XIOS/trunk/src/declare_ref_func.hpp	(revision 774)
+++ XIOS/trunk/src/declare_ref_func.hpp	(revision 775)
@@ -19,4 +19,5 @@
   C##type* getDirect##type##Reference(void) const;          \
   const StdString& get##type##OutputName(void) const;       \
+  void setAttributesBaseReference(bool apply = true);       \
 
 // Definitions
@@ -43,4 +44,9 @@
     SuperClassAttribute::setAttributes(refer_ptr, apply);              \
   }                                                                    \
+}                                                                      \
+                                                                       \
+void C##type::setAttributesBaseReference(bool apply)                   \
+{                                                                      \
+  baseRefObject->setAttributes(this, apply);                           \
 }                                                                      \
                                                                        \
Index: XIOS/trunk/src/io/nc4_data_input.cpp
===================================================================
--- XIOS/trunk/src/io/nc4_data_input.cpp	(revision 774)
+++ XIOS/trunk/src/io/nc4_data_input.cpp	(revision 775)
@@ -3,4 +3,7 @@
 #include "context.hpp"
 #include "context_server.hpp"
+#include "context_client.hpp"
+#include "domain.hpp"
+#include "axis.hpp"
 
 namespace xios
@@ -12,4 +15,6 @@
     , filename(filename)
     , isCollective(isCollective)
+    , readMetaDataDomains_(), readValueDomains_()
+    , readMetaDataAxis_(), readValueAxis_()
   {
     SuperClass::type = multifile ? MULTI_FILE : ONE_FILE;
@@ -126,4 +131,201 @@
   }
 
+  void CNc4DataInput::readFieldAttributes_(CField* field, bool readAttributeValues)
+  {
+    StdString fieldId = !field->name.isEmpty() ? field->name.getValue() : field->getBaseFieldReference()->getId();
+
+    CGrid* grid = field->grid;
+
+    std::vector<CDomain*> domainP = grid->getDomains();
+    std::vector<CAxis*> axisP = grid->getAxis();
+    int gridDim = domainP.size() * 2 + axisP.size();
+
+    // Verify the compatibility of dimension of declared grid and real grid in file
+    int realGridDim = 1;
+    std::map<StdString, StdSize> dimSizeMap = SuperClassWriter::getDimensions(&fieldId);
+    realGridDim = SuperClassWriter::isTemporal(fieldId) ? dimSizeMap.size() - 1 : dimSizeMap.size();
+
+    if (gridDim != realGridDim)
+       ERROR("CNc4DataInput::readFieldAttributes_(CField* field, bool readAttributeValues)",
+        << "Field '" << fieldId << "' has incorrect dimension " << std::endl
+        << "Verify dimension of grid defined by 'grid_ref' or 'domain_ref'/'axis_ref' and dimension of grid in read file.");
+
+    // Remove unlimited dimension from the map, we dont need it anymore
+    if (SuperClassWriter::isTemporal(fieldId)) dimSizeMap.erase(SuperClassWriter::getUnlimitedDimensionName());
+    int mapSize = dimSizeMap.size() - 1;
+
+    // Now process domain and axis
+    CArray<bool,1> axisDomainOrder = grid->axis_domain_order;
+    int numElement = domainP.size() + axisP.size();
+    int elementPosition = 0;
+    int idxDomain = 0, idxAxis = 0;
+
+    std::pair<std::set<StdString>::iterator,bool> it;
+    for (int i = 0; i < numElement; ++i)
+    {
+      if(axisDomainOrder(i))
+      {
+        if (readAttributeValues)
+        {
+           it = readValueDomains_.insert(domainP[idxDomain]->getId());
+           if (it.second) readDomainAttributeValueFromFile(domainP[idxDomain], dimSizeMap, mapSize - 1 - elementPosition, fieldId);
+        }
+        else
+        {
+          it = readMetaDataDomains_.insert(domainP[idxDomain]->getId());
+          if (it.second) readDomainAttributesFromFile(domainP[idxDomain], dimSizeMap, mapSize - 1 - elementPosition, fieldId);
+        }
+        ++idxDomain;
+        elementPosition += 2;
+      }
+      else
+      {
+        if (readAttributeValues)
+        {
+          it = readValueAxis_.insert(axisP[idxAxis]->getId());
+          if (it.second) readAxisAttributeValueFromFile(axisP[idxAxis], dimSizeMap, mapSize - elementPosition, fieldId);
+        }
+        else
+        {
+          it = readMetaDataAxis_.insert(axisP[idxAxis]->getId());
+          if (it.second) readAxisAttributesFromFile(axisP[idxAxis], dimSizeMap, mapSize - elementPosition, fieldId);
+        }
+        ++idxAxis;
+        ++elementPosition;
+      }
+    }
+  }
+
+  /*!
+    Read attributes of a domain from a file
+    \param [in] domain domain whose attributes are read from the file
+    \param [in] dimSizeMap Dimensions and and their corresponding names and size read from file
+    \param [in] emelentPosition position of domain in grid
+  */
+  void CNc4DataInput::readDomainAttributeValueFromFile(CDomain* domain, std::map<StdString, StdSize>& dimSizeMap,
+                                                       int elementPosition, const StdString& fieldId)
+  {
+    // There are some optional attributes of a domain to retrieve from file    // + lon lat?
+    std::map<StdString, StdSize>::const_iterator itMapNj = dimSizeMap.begin(), itMapNi,
+                                                 iteMap  = dimSizeMap.end();
+
+    for (int i = 0; i < elementPosition; ++i, ++itMapNj) {}
+    itMapNi = itMapNj; ++itMapNi;
+
+    if (this->isRectilinear(fieldId))
+    {
+      // Ok, try to read some f.. attributes such as longitude and latitude
+      domain->latvalue_rectilinear_read_from_file.resize(itMapNj->second);
+      std::vector<StdSize> nBeginLat(1, 0), nSizeLat(1, itMapNj->second);
+      readFieldVariableValue(domain->latvalue_rectilinear_read_from_file, itMapNj->first, nBeginLat, nSizeLat, true);
+
+      domain->lonvalue_rectilinear_read_from_file.resize(itMapNi->second);
+      std::vector<StdSize> nBeginLon(1, 0), nSizeLon(1, itMapNi->second);
+      readFieldVariableValue(domain->lonvalue_rectilinear_read_from_file, itMapNi->first, nBeginLon, nSizeLon, true);
+      domain->fillInRectilinearLonLat();
+    }
+    else if (this->isCurvilinear(fieldId))
+    {
+
+    }
+    else if (this->isUnstructured(fieldId))
+    {
+
+    }
+  }
+
+  /*!
+    Read attributes of a domain from a file
+    \param [in] domain domain whose attributes are read from the file
+    \param [in] dimSizeMap Dimensions and and their corresponding names and size read from file
+    \param [in] emelentPosition position of domain in grid
+  */
+  void CNc4DataInput::readDomainAttributesFromFile(CDomain* domain, std::map<StdString, StdSize>& dimSizeMap,
+                                                   int elementPosition, const StdString& fieldId)
+  {
+    // There are some mandatory attributes of a domain to retrieve from file
+    // + ni_glo, nj_glo
+    std::map<StdString, StdSize>::const_iterator itMapNj = dimSizeMap.begin(), itMapNi,
+                                                 iteMap  = dimSizeMap.end();
+    for (int i = 0; i < elementPosition; ++i, ++itMapNj) {}
+    itMapNi = itMapNj; ++itMapNi;
+
+    if (this->isRectilinear(fieldId))
+    {
+      domain->nj_glo.setValue(itMapNj->second);
+      domain->ni_glo.setValue((itMapNi)->second);
+    }
+    else if (this->isCurvilinear(fieldId))
+    {
+
+    }
+    else if (this->isUnstructured(fieldId))
+    {
+
+    }
+  }
+
+  /*!
+    Read attributes of an axis from a file
+    \param [in] axis axis whose attributes are read from the file
+    \param [in] dimSizeMap Dimensions and and their corresponding names and size read from file
+    \param [in] emelentPosition position of axis in grid
+  */
+  void CNc4DataInput::readAxisAttributesFromFile(CAxis* axis, std::map<StdString, StdSize>& dimSizeMap,
+                                                 int elementPosition, const StdString& fieldId)
+  {
+    std::map<StdString, StdSize>::const_iterator itMapN = dimSizeMap.begin(),
+                                                 iteMap  = dimSizeMap.end();
+    for (int i = 0; i < elementPosition; ++i, ++itMapN) {}
+    axis->n_glo.setValue(itMapN->second);
+  }
+
+  /*!
+    Read attributes of an axis from a file
+    \param [in] axis axis whose attributes are read from the file
+    \param [in] dimSizeMap Dimensions and and their corresponding names and size read from file
+    \param [in] emelentPosition position of axis in grid
+  */
+  void CNc4DataInput::readAxisAttributeValueFromFile(CAxis* axis, std::map<StdString, StdSize>& dimSizeMap,
+                                                    int elementPosition, const StdString& fieldId)
+  {
+    std::map<StdString, StdSize>::const_iterator itMapN = dimSizeMap.begin(),
+                                                 iteMap  = dimSizeMap.end();
+    for (int i = 0; i < elementPosition; ++i, ++itMapN) {}
+
+    { // Read axis value
+      std::vector<StdSize> nBegin(1, 0), nSize(1, itMapN->second);
+      CArray<double,1> readAxisValue(itMapN->second);
+      readFieldVariableValue(readAxisValue, itMapN->first, nBegin, nSize, true);
+      int begin = 0, n = itMapN->second;
+      if (!axis->begin.isEmpty()) begin = axis->begin.getValue();
+      if (!axis->n.isEmpty()) n = axis->n.getValue();
+      axis->value.resize(n);
+      for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i);
+    }
+  }
+
+  void CNc4DataInput::readFieldVariableValue(CArray<double,1>& var, const StdString& varId,
+                                             const std::vector<StdSize>& nBegin,
+                                             const std::vector<StdSize>& nSize,
+                                             bool forceIndependent)
+  {
+    if (SuperClass::type==MULTI_FILE || !isCollective) return;
+
+    bool openCollective = isCollective;
+    if (forceIndependent) openCollective = !isCollective;
+    switch (SuperClass::type)
+    {
+      case MULTI_FILE:
+        SuperClassWriter::getData(var, varId, openCollective, 0);
+        break;
+      case ONE_FILE:
+      {
+        SuperClassWriter::getData(var, varId, openCollective, 0, &nBegin, &nSize);
+        break;
+      }
+    }
+  }
+
   void CNc4DataInput::closeFile_(void)
   {
Index: XIOS/trunk/src/io/nc4_data_input.hpp
===================================================================
--- XIOS/trunk/src/io/nc4_data_input.hpp	(revision 774)
+++ XIOS/trunk/src/io/nc4_data_input.hpp	(revision 775)
@@ -9,4 +9,7 @@
 namespace xios
 {
+  class CDomain;
+  class CAxis;
+
   class CNc4DataInput
     : protected CINetCDF4
@@ -33,5 +36,26 @@
     virtual StdSize getFieldNbRecords_(CField* field);
     virtual void readFieldData_(CField* field);
+    virtual void readFieldAttributes_(CField* field, bool readAttributeValues);
     virtual void closeFile_(void);
+
+  private:
+    void readDomainAttributesFromFile(CDomain* domain, std::map<StdString, StdSize>& dimSizeMap,
+                                      int elementPosition, const StdString& fieldId);
+    void readDomainAttributeValueFromFile(CDomain* domain, std::map<StdString, StdSize>& dimSizeMap,
+                                          int elementPosition, const StdString& fieldId);
+
+    void readAxisAttributesFromFile(CAxis* axis, std::map<StdString, StdSize>& dimSizeMap,
+                                    int elementPosition, const StdString& fieldId);
+    void readAxisAttributeValueFromFile(CAxis* axis, std::map<StdString, StdSize>& dimSizeMap,
+                                        int elementPosition, const StdString& fieldId);
+
+    void readFieldVariableValue(CArray<double,1>& var, const StdString& varId,
+                                const std::vector<StdSize>& nBegin,
+                                const std::vector<StdSize>& nSize,
+                                bool forceIndependent = false);
+
+  private:
+    std::set<StdString> readMetaDataDomains_, readValueDomains_;
+    std::set<StdString> readMetaDataAxis_, readValueAxis_;
 
   private:
Index: XIOS/trunk/src/node/axis.cpp
===================================================================
--- XIOS/trunk/src/node/axis.cpp	(revision 774)
+++ XIOS/trunk/src/node/axis.cpp	(revision 775)
@@ -185,4 +185,9 @@
      CAxis* axis = CAxisGroup::get("axis_definition")->createChild();
      return axis;
+   }
+
+   void CAxis::fillInValues(const CArray<double,1>& values)
+   {
+     this->value = values;
    }
 
Index: XIOS/trunk/src/node/axis.hpp
===================================================================
--- XIOS/trunk/src/node/axis.hpp	(revision 774)
+++ XIOS/trunk/src/node/axis.hpp	(revision 775)
@@ -111,4 +111,5 @@
          void solveInheritanceTransformation();
          TransMapTypes getAllTransformations();
+         void fillInValues(const CArray<double,1>& values);
 
       public:
Index: XIOS/trunk/src/node/context.cpp
===================================================================
--- XIOS/trunk/src/node/context.cpp	(revision 774)
+++ XIOS/trunk/src/node/context.cpp	(revision 775)
@@ -313,5 +313,5 @@
      registryOut=new CRegistry(intraComm) ;
      registryOut->setPath(getId()) ;
- 
+
      MPI_Comm intraCommClient, interCommClient;
      if (cxtClient) // Attached mode
@@ -362,5 +362,5 @@
           if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ;
         }
-        
+
         for (std::list<MPI_Comm>::iterator it = comms.begin(); it != comms.end(); ++it)
           MPI_Comm_free(&(*it));
@@ -439,4 +439,16 @@
      for (unsigned int i = 0; i < this->enabledFiles.size(); i++)
      (void)this->enabledFiles[i]->getEnabledFields();
+   }
+
+   void CContext::findAllEnabledFieldsInReadModeFiles(void)
+   {
+     for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i)
+     (void)this->enabledReadModeFiles[i]->getEnabledFields();
+   }
+
+   void CContext::readAttributesOfEnabledFieldsInReadModeFiles()
+   {
+      for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i)
+        (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode();
    }
 
@@ -785,5 +797,11 @@
       // Find all enabled fields of each file
       this->findAllEnabledFields();
-
+      this->findAllEnabledFieldsInReadModeFiles();
+
+     if (hasClient && !hasServer)
+     {
+      // Try to read attributes of fields in file then fill in corresponding grid (or domain, axis)
+      this->readAttributesOfEnabledFieldsInReadModeFiles();
+     }
       // Search and rebuild all reference object of enabled fields
       this->solveAllRefOfEnabledFields(false);
@@ -1053,5 +1071,5 @@
       if (hasClient)
       {
-        checkPrefetchingOfEnabledReadModeFiles();
+        //checkPrefetchingOfEnabledReadModeFiles();
         garbageCollector.invalidate(calendar->getCurrentDate());
       }
Index: XIOS/trunk/src/node/context.hpp
===================================================================
--- XIOS/trunk/src/node/context.hpp	(revision 774)
+++ XIOS/trunk/src/node/context.hpp	(revision 775)
@@ -103,4 +103,6 @@
          // Some functions to process context
          void findAllEnabledFields(void);
+         void findAllEnabledFieldsInReadModeFiles(void);
+         void readAttributesOfEnabledFieldsInReadModeFiles();
          void solveAllInheritance(bool apply=true);
          void findEnabledFiles(void);
@@ -218,7 +220,7 @@
          // Concrete contex client
          CContextClient* client;
-         CRegistry* registryIn ;  //!< input registry which is read from file 
+         CRegistry* registryIn ;  //!< input registry which is read from file
          CRegistry* registryOut ; //!< output registry which will be wrote on file at the finalize
-         
+
       private:
          bool isPostProcessed;
Index: XIOS/trunk/src/node/domain.cpp
===================================================================
--- XIOS/trunk/src/node/domain.cpp	(revision 774)
+++ XIOS/trunk/src/node/domain.cpp	(revision 775)
@@ -339,45 +339,68 @@
    void CDomain::fillInRectilinearLonLat()
    {
-     if (!lonvalue_2d.isEmpty()) lonvalue_2d.free();
-     if (!latvalue_2d.isEmpty()) latvalue_1d.free();
-     lonvalue_1d.resize(ni);
-     latvalue_1d.resize(nj);
-
-     double lonRange = lon_end - lon_start;
-     double latRange = lat_end - lat_start;
-
-     double lonStep = (1 == ni_glo.getValue()) ? lonRange : lonRange/double(ni_glo.getValue()-1);
-     double latStep = (1 == nj_glo.getValue()) ? latRange : latRange/double(nj_glo.getValue()-1);
-
-     // Assign lon value
-     for (int i = 0; i < ni; ++i)
-     {
-       if (0 == (ibegin + i))
+     if (!lonvalue_rectilinear_read_from_file.isEmpty())
+     {
+       lonvalue_1d.resize(ni);
+       for (int idx = 0; idx < ni; ++idx)
+         lonvalue_1d(idx) = lonvalue_rectilinear_read_from_file(idx+ibegin);
+       lon_start.setValue(lonvalue_rectilinear_read_from_file(0));
+       lon_end.setValue(lonvalue_rectilinear_read_from_file(ni_glo-1));
+     }
+     else
+     {
+       if (!lonvalue_2d.isEmpty()) lonvalue_2d.free();
+       lonvalue_1d.resize(ni);
+       double lonRange = lon_end - lon_start;
+       double lonStep = (1 == ni_glo.getValue()) ? lonRange : lonRange/double(ni_glo.getValue()-1);
+
+        // Assign lon value
+       for (int i = 0; i < ni; ++i)
        {
-         lonvalue_1d(i) = lon_start;
+         if (0 == (ibegin + i))
+         {
+           lonvalue_1d(i) = lon_start;
+         }
+         else if (ni_glo == (ibegin + i + 1))
+         {
+           lonvalue_1d(i) = lon_end;
+         }
+         else
+         {
+           lonvalue_1d(i) = (ibegin + i) * lonStep  + lon_start;
+         }
        }
-       else if (ni_glo == (ibegin + i + 1))
+     }
+
+
+     if (!latvalue_rectilinear_read_from_file.isEmpty())
+     {
+       latvalue_1d.resize(nj);
+       for (int idx = 0; idx < nj; ++idx)
+         latvalue_1d(idx) = latvalue_rectilinear_read_from_file(idx+jbegin);
+       lat_start.setValue(latvalue_rectilinear_read_from_file(0));
+       lat_end.setValue(latvalue_rectilinear_read_from_file(nj_glo-1));
+     }
+     else
+     {
+       if (!latvalue_2d.isEmpty()) latvalue_1d.free();
+       latvalue_1d.resize(nj);
+
+       double latRange = lat_end - lat_start;
+       double latStep = (1 == nj_glo.getValue()) ? latRange : latRange/double(nj_glo.getValue()-1);
+
+       for (int j = 0; j < nj; ++j)
        {
-         lonvalue_1d(i) = lon_end;
-       }
-       else
-       {
-         lonvalue_1d(i) = (ibegin + i) * lonStep  + lon_start;
-       }
-     }
-
-     for (int j = 0; j < nj; ++j)
-     {
-       if (0 == (jbegin + j))
-       {
-          latvalue_1d(j) = lat_start;
-       }
-       else if (nj_glo == (jbegin + j + 1))
-       {
-          latvalue_1d(j) = lat_end;
-       }
-       else
-       {
-         latvalue_1d(j) =  (jbegin + j) * latStep + lat_start;
+         if (0 == (jbegin + j))
+         {
+            latvalue_1d(j) = lat_start;
+         }
+         else if (nj_glo == (jbegin + j + 1))
+         {
+            latvalue_1d(j) = lat_end;
+         }
+         else
+         {
+           latvalue_1d(j) =  (jbegin + j) * latStep + lat_start;
+         }
        }
      }
@@ -389,65 +412,82 @@
      int i,j,k;
      const int nvertexValue = 4;
-
-     double boundsLonRange = bounds_lon_end - bounds_lon_start;
-     double boundsLatRange = bounds_lat_end - bounds_lat_start;
-
      boundsLon.resize(nvertexValue,ni*nj);
+
+     if (!lonvalue_rectilinear_read_from_file.isEmpty())
+     {
+       double lonStepStart = lonvalue_rectilinear_read_from_file(1)-lonvalue_rectilinear_read_from_file(0);
+       bounds_lon_start.setValue(lonvalue_rectilinear_read_from_file(0) - lonStepStart/2);
+       double lonStepEnd = (lonvalue_rectilinear_read_from_file(ni_glo-1)-lonvalue_rectilinear_read_from_file(ni_glo-2));
+       bounds_lon_end.setValue(lonvalue_rectilinear_read_from_file(ni_glo-1) + lonStepEnd/2);
+       double errorBoundsLon = std::abs(360-std::abs(bounds_lon_end-bounds_lon_start));
+       if (errorBoundsLon > NumTraits<double>::epsilon()) bounds_lon_end.setValue(bounds_lon_start+360);
+       for(j=0;j<nj;++j)
+         for(i=0;i<ni;++i)
+         {
+           k=j*ni+i;
+           boundsLon(0,k) = boundsLon(1,k) = (0 == (ibegin + i)) ? bounds_lon_start
+                                                                 : (lonvalue_rectilinear_read_from_file(ibegin + i)+lonvalue_rectilinear_read_from_file(ibegin + i-1))/2;
+           boundsLon(2,k) = boundsLon(3,k) = ((ibegin + i + 1) == ni_glo) ? bounds_lon_end
+                                                                          : (lonvalue_rectilinear_read_from_file(ibegin + i + 1)+lonvalue_rectilinear_read_from_file(ibegin + i))/2;
+         }
+     }
+     else
+     {
+       double boundsLonRange = bounds_lon_end - bounds_lon_start;
+       double lonStep = boundsLonRange/double(ni_glo.getValue());
+       for(j=0;j<nj;++j)
+         for(i=0;i<ni;++i)
+         {
+           k=j*ni+i;
+           boundsLon(0,k) = boundsLon(1,k) = (0 != (ibegin + i)) ? (ibegin + i) * lonStep + bounds_lon_start
+                                                                 : bounds_lon_start;
+           boundsLon(2,k) = boundsLon(3,k) = ((ibegin + i + 1) != ni_glo) ? (ibegin + i +1) * lonStep + bounds_lon_start
+                                                                          : bounds_lon_end;
+         }
+     }
+
      boundsLat.resize(nvertexValue,nj*ni);
-
-     double lonStep = boundsLonRange/double(ni_glo.getValue());
-     double latStep = boundsLatRange/double(nj_glo.getValue());
-
-     for(j=0;j<nj;++j)
-       for(i=0;i<ni;++i)
-       {
-         k=j*ni+i;
-         boundsLon(0,k) = boundsLon(1,k) = (0 != (ibegin + i)) ? (ibegin + i) * lonStep + bounds_lon_start
-                                                               : bounds_lon_start;
-         boundsLon(2,k) = boundsLon(3,k) = ((ibegin + i + 1) != ni_glo) ? (ibegin + i +1) * lonStep + bounds_lon_start
-                                                                        : bounds_lon_end;
-       }
-
-     double bounds_lat_start_pole = bounds_lat_start;
-     double bounds_lat_end_pole   = bounds_lat_end;
-     if (isNorthPole) bounds_lat_start_pole = lat_start;
-     if (isSouthPole) bounds_lat_end_pole   = lat_end;
-
-     for(j=0;j<nj;++j)
-       for(i=0;i<ni;++i)
-       {
-         k=j*ni+i;
-         boundsLat(1,k) = boundsLat(2,k) = (0 != (jbegin + j)) ? (jbegin + j) * latStep + bounds_lat_start
-                                                               : bounds_lat_start_pole;
-         boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) != nj_glo) ? (jbegin + j +1) * latStep + bounds_lat_start
-                                                               : bounds_lat_end_pole;
-       }
-   }
-
-   /*!
-     Temporary function to verify whether a rectilinear domain is created automatically.
-   The domain is distributed into number of parts which are equal to number of clients (intracomm)
-   */
-   void CDomain::checkGenerate()
-   {
-     TransMapTypes trans = this->getAllTransformations();
-     TransMapTypes::const_iterator it = trans.begin(), ite = trans.end();
-     int transOrder = 0;
-     for (; it != ite; ++it, ++transOrder)
-     {
-       ETranformationType transType = it->first;
-       if ((TRANS_GENERATE_RECTILINEAR_DOMAIN == transType) && (0 == transOrder))
-       {
-         CContext* context = CContext::getCurrent();
-         CContextClient* client = context->client;
-         int nbClient;
-         MPI_Comm_size(client->intraComm,&nbClient);
-         it->second->checkValid(this);
-         this->redistribute(nbClient);
-         break;
-       }
-     }
-   }
-
+     if (!latvalue_rectilinear_read_from_file.isEmpty())
+     {
+       double latStepStart = latvalue_rectilinear_read_from_file(1)-latvalue_rectilinear_read_from_file(0);
+       bounds_lat_start.setValue(latvalue_rectilinear_read_from_file(0) - latStepStart/2);
+       double latStepEnd = (latvalue_rectilinear_read_from_file(nj_glo-1)-latvalue_rectilinear_read_from_file(nj_glo-2));
+       bounds_lat_end.setValue(latvalue_rectilinear_read_from_file(nj_glo-1) + latStepEnd/2);
+       double bounds_lat_start_pole = bounds_lat_start;
+       double bounds_lat_end_pole   = bounds_lat_end;
+       if (isNorthPole) bounds_lat_start_pole = lat_start;
+       if (isSouthPole) bounds_lat_end_pole   = lat_end;
+
+       for(j=0;j<nj;++j)
+         for(i=0;i<ni;++i)
+         {
+           k=j*ni+i;
+           boundsLat(1,k) = boundsLat(2,k) = (0 == (jbegin + j)) ? bounds_lat_start_pole
+                                                                 : (latvalue_rectilinear_read_from_file(jbegin + j)+latvalue_rectilinear_read_from_file(jbegin + j-1))/2;
+           boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) == nj_glo) ? bounds_lat_end_pole
+                                                                 : (latvalue_rectilinear_read_from_file(jbegin + j + 1)+latvalue_rectilinear_read_from_file(jbegin + j))/2;
+         }
+     }
+     else
+     {
+       double boundsLatRange = bounds_lat_end - bounds_lat_start;
+       double latStep = boundsLatRange/double(nj_glo.getValue());
+       double bounds_lat_start_pole = bounds_lat_start;
+       double bounds_lat_end_pole   = bounds_lat_end;
+       if (isNorthPole) bounds_lat_start_pole = lat_start;
+       if (isSouthPole) bounds_lat_end_pole   = lat_end;
+
+       for(j=0;j<nj;++j)
+         for(i=0;i<ni;++i)
+         {
+           k=j*ni+i;
+           boundsLat(1,k) = boundsLat(2,k) = (0 != (jbegin + j)) ? (jbegin + j) * latStep + bounds_lat_start
+                                                                 : bounds_lat_start_pole;
+           boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) != nj_glo) ? (jbegin + j +1) * latStep + bounds_lat_start
+                                                                 : bounds_lat_end_pole;
+         }
+     }
+
+   }
 
    void CDomain::checkDomain(void)
@@ -1029,5 +1069,4 @@
      CContext* context=CContext::getCurrent();
 
-      this->checkGenerate();
       this->checkDomain();
       this->checkBounds();
Index: XIOS/trunk/src/node/domain.hpp
===================================================================
--- XIOS/trunk/src/node/domain.hpp	(revision 774)
+++ XIOS/trunk/src/node/domain.hpp	(revision 775)
@@ -30,4 +30,5 @@
    BEGIN_DECLARE_ATTRIBUTE_MAP(CDomain)
 #  include "domain_attribute.conf"
+#  include "domain_attribute_private.conf"
    END_DECLARE_ATTRIBUTE_MAP(CDomain)
 
@@ -105,9 +106,4 @@
          int nj_srv,jbegin_srv,jend_srv ;
          int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ;
-
-         double bounds_lon_start, bounds_lon_end;
-         double bounds_lat_start, bounds_lat_end;
-         double lon_start, lon_end;
-         double lat_start, lat_end;
 
          CArray<double, 1> lonvalue_srv, latvalue_srv ;
@@ -133,4 +129,5 @@
          void fillInRectilinearBoundLonLat(CArray<double,2>& boundsLon, CArray<double,2>& boundsLat,
                                            bool isNorthPole = false, bool isSouthPole = false);
+         void fillInRectilinearLonLat();
 
          static bool dispatchEvent(CEventServer& event);
@@ -172,10 +169,8 @@
          void checkArea(void);
          void checkLonLat();
-         void checkGenerate();
 
          void checkTransformations();
          void setTransformations(const TransMapTypes&);
          void computeNGlobDomain();
-         void fillInRectilinearLonLat();
 
          void sendIndex();
Index: XIOS/trunk/src/node/field.cpp
===================================================================
--- XIOS/trunk/src/node/field.cpp	(revision 774)
+++ XIOS/trunk/src/node/field.cpp	(revision 775)
@@ -826,4 +826,12 @@
      if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid)
        grid->completeGrid(getDirectFieldReference()->grid);
+     else
+       grid->completeGrid();
+   }
+
+   void CField::solveGridDomainAxisBaseRef()
+   {
+     grid->solveDomainAxisRef(false);
+     grid->solveDomainAxisBaseRef();
    }
 
Index: XIOS/trunk/src/node/field.hpp
===================================================================
--- XIOS/trunk/src/node/field.hpp	(revision 774)
+++ XIOS/trunk/src/node/field.hpp	(revision 775)
@@ -114,4 +114,5 @@
          void solveTransformedGrid();
          void solveGenerateGrid();
+         void solveGridDomainAxisBaseRef();
 
          void buildFilterGraph(CGarbageCollector& gc, bool enableOutput);
Index: XIOS/trunk/src/node/file.cpp
===================================================================
--- XIOS/trunk/src/node/file.cpp	(revision 774)
+++ XIOS/trunk/src/node/file.cpp	(revision 775)
@@ -24,4 +24,5 @@
       : CObjectTemplate<CFile>(), CFileAttributes()
       , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL)
+      , allDomainEmpty(false), isOpen(false)
    {
      setVirtualFieldGroup();
@@ -32,4 +33,5 @@
       : CObjectTemplate<CFile>(id), CFileAttributes()
       , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL)
+      , allDomainEmpty(false), isOpen(false)
     {
       setVirtualFieldGroup();
@@ -543,4 +545,38 @@
    //----------------------------------------------------------------
 
+   void CFile::readAttributesOfEnabledFieldsInReadMode()
+   {
+     if (enabledFields.empty()) return;
+
+     // Just check file and try to open it
+     CContext* context = CContext::getCurrent();
+     CContextClient* client=context->client;
+
+     MPI_Comm_dup(client->intraComm, &fileComm);
+     checkFile();
+     for (int idx = 0; idx < enabledFields.size(); ++idx)
+     {
+        // First of all, find out which domain and axis associated with this field
+        enabledFields[idx]->solveGridReference();
+
+        // Read attributes of domain and axis from this file
+        this->data_in->readFieldAttributesMetaData(enabledFields[idx]);
+
+        // Now complete domain and axis associated with this field
+        enabledFields[idx]->solveGenerateGrid();
+
+        // Read necessary value from file
+        this->data_in->readFieldAttributesValues(enabledFields[idx]);
+
+        // Fill attributes for base reference
+        enabledFields[idx]->solveGridDomainAxisBaseRef();
+     }
+
+     // Now everything is ok, close it
+     close();
+
+   }
+
+
    /*!
    \brief Parse xml file and write information into file object
Index: XIOS/trunk/src/node/file.hpp
===================================================================
--- XIOS/trunk/src/node/file.hpp	(revision 774)
+++ XIOS/trunk/src/node/file.hpp	(revision 775)
@@ -101,4 +101,5 @@
          void openInReadMode(void);
          void close(void);
+         void readAttributesOfEnabledFieldsInReadMode();
 
          // Some processing on file
Index: XIOS/trunk/src/node/generate_rectilinear_domain.cpp
===================================================================
--- XIOS/trunk/src/node/generate_rectilinear_domain.cpp	(revision 774)
+++ XIOS/trunk/src/node/generate_rectilinear_domain.cpp	(revision 775)
@@ -89,8 +89,8 @@
       double boundsLonRange = bounds_lon_end - bounds_lon_start;
       double boundsLonStep = boundsLonRange/(double(niGlo));
-      domainDst->bounds_lon_start = bounds_lon_start;
-      domainDst->bounds_lon_end   = bounds_lon_end;
-      domainDst->lon_start = bounds_lon_start + boundsLonStep/2;
-      domainDst->lon_end   = bounds_lon_end   - boundsLonStep/2;
+      domainDst->bounds_lon_start.setValue(bounds_lon_start);
+      domainDst->bounds_lon_end.setValue(bounds_lon_end);
+      domainDst->lon_start.setValue(bounds_lon_start + boundsLonStep/2);
+      domainDst->lon_end.setValue( bounds_lon_end   - boundsLonStep/2);
     }
 
@@ -101,8 +101,8 @@
       double boundsLatRange = bounds_lat_end - bounds_lat_start;
       double boundsLatStep = boundsLatRange/(double(njGlo));
-      domainDst->bounds_lat_start = bounds_lat_start;
-      domainDst->bounds_lat_end   = bounds_lat_end;
-      domainDst->lat_start = bounds_lat_start + boundsLatStep/2;
-      domainDst->lat_end   = bounds_lat_end   - boundsLatStep/2;
+      domainDst->bounds_lat_start.setValue(bounds_lat_start);
+      domainDst->bounds_lat_end.setValue(bounds_lat_end);
+      domainDst->lat_start.setValue(bounds_lat_start + boundsLatStep/2);
+      domainDst->lat_end.setValue(bounds_lat_end   - boundsLatStep/2);
     }
 
@@ -115,8 +115,8 @@
       double lonRange = lon_end - lon_start;
       double lonStep = (1 == niGlo) ? lonRange : lonRange/(double(niGlo)-1);
-      domainDst->lon_start = lon_start;
-      domainDst->lon_end   = lon_end;
-      domainDst->bounds_lon_start = lon_start - lonStep/2;
-      domainDst->bounds_lon_end   = lon_end   + lonStep/2;
+      domainDst->lon_start.setValue(lon_start);
+      domainDst->lon_end.setValue(lon_end);
+      domainDst->bounds_lon_start.setValue(lon_start - lonStep/2);
+      domainDst->bounds_lon_end.setValue(lon_end   + lonStep/2);
     }
 
@@ -127,8 +127,8 @@
       double latRange = lat_end - lat_start;
       double latStep = (1 == njGlo) ? latRange : latRange/(double(njGlo)-1);
-      domainDst->lat_start = lat_start;
-      domainDst->lat_end   = lat_end;
-      domainDst->bounds_lat_start = lat_start - latStep/2;
-      domainDst->bounds_lat_end   = lat_end   + latStep/2;
+      domainDst->lat_start.setValue(lat_start);
+      domainDst->lat_end.setValue(lat_end);
+      domainDst->bounds_lat_start.setValue(lat_start - latStep/2);
+      domainDst->bounds_lat_end.setValue(lat_end   + latStep/2);
     }
   }
Index: XIOS/trunk/src/node/grid.cpp
===================================================================
--- XIOS/trunk/src/node/grid.cpp	(revision 774)
+++ XIOS/trunk/src/node/grid.cpp	(revision 775)
@@ -31,5 +31,5 @@
       , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false)
       , transformations_(0), isTransformed_(false)
-      , axisPositionInGrid_(), positionDimensionDistributed_(1)
+      , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false)
    {
      setVirtualDomainGroup();
@@ -45,5 +45,5 @@
       , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false)
       , transformations_(0), isTransformed_(false)
-      , axisPositionInGrid_(), positionDimensionDistributed_(1)
+      , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false)
    {
      setVirtualDomainGroup();
@@ -203,4 +203,25 @@
      computeGridGlobalDimension(getDomains(), getAxis(), axis_domain_order);
      this->isDomainAxisChecked = areAttributesChecked;
+   }
+
+   void CGrid::solveDomainAxisBaseRef()
+   {
+     if (this->hasDomainAxisBaseRef_) return;
+     // Account for the axis attributes
+     std::vector<CAxis*> axisList = getAxis();
+     for (size_t i = 0; i < axisList.size(); ++i)
+     {
+       axisList[i]->solveBaseReference();
+       axisList[i]->setAttributesBaseReference();
+     }
+
+     // Account for the domain attributes
+     std::vector<CDomain*> domList = getDomains();
+     for (size_t i = 0; i < domList.size(); ++i)
+     {
+       domList[i]->solveBaseReference();
+       domList[i]->setAttributesBaseReference();
+     }
+     this->hasDomainAxisBaseRef_ = true;
    }
 
@@ -1260,23 +1281,22 @@
   void CGrid::completeGrid(CGrid* transformGridSrc)
   {
-    if (!transformGridSrc)
-      ERROR("CGrid::completeGrid(CGrid* transformGridSrc)",
-            << "Impossible to complete grid '" << getId() << "', the source grid is null.");
-
-    if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements())
-    {
-      ERROR("CGrid::completeGrid(CGrid* transformGridSrc)",
-           << "Two grids have different dimension size"
-           << "Dimension of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl
-           << "Dimension of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements());
-    }
-    else
-    {
-      int ssize = axis_domain_order.numElements();
-      for (int i = 0; i < ssize; ++i)
-        if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i))
-          ERROR("CGrid::completeGrid(CGrid* transformGridSrc)",
-                << "Grids " << this->getId() << " and " << transformGridSrc->getId()
-                << " don't have elements in the same order");
+    if (0 != transformGridSrc)
+    {
+      if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements())
+      {
+        ERROR("CGrid::completeGrid(CGrid* transformGridSrc)",
+             << "Two grids have different dimension size"
+             << "Dimension of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl
+             << "Dimension of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements());
+      }
+      else
+      {
+        int ssize = axis_domain_order.numElements();
+        for (int i = 0; i < ssize; ++i)
+          if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i))
+            ERROR("CGrid::completeGrid(CGrid* transformGridSrc)",
+                  << "Grids " << this->getId() << " and " << transformGridSrc->getId()
+                  << " don't have elements in the same order");
+      }
     }
 
Index: XIOS/trunk/src/node/grid.hpp
===================================================================
--- XIOS/trunk/src/node/grid.hpp	(revision 774)
+++ XIOS/trunk/src/node/grid.hpp	(revision 775)
@@ -144,4 +144,5 @@
          void solveDomainAxisRefInheritance(bool apply = true);
          void solveTransformations();
+         void solveDomainAxisBaseRef();
 
          void sendAddDomain(const std::string& id="");
@@ -186,5 +187,5 @@
 
          void transformGrid(CGrid* transformGridSrc);
-         void completeGrid(CGrid* transformGridSrc);
+         void completeGrid(CGrid* transformGridSrc = 0);
          void doAutoDistribution(CGrid* transformGridSrc);
          bool isTransformed();
@@ -263,4 +264,5 @@
         std::vector<int> axisPositionInGrid_;
         CGridTransformation* transformations_;
+        bool hasDomainAxisBaseRef_;
    }; // class CGrid
 
Index: XIOS/trunk/src/test/test_new_features.f90
===================================================================
--- XIOS/trunk/src/test/test_new_features.f90	(revision 774)
+++ XIOS/trunk/src/test/test_new_features.f90	(revision 775)
@@ -15,6 +15,6 @@
   CHARACTER(len=15) :: calendar_type
   TYPE(xios_context) :: ctx_hdl
-  INTEGER,PARAMETER :: ni_glo=10
-  INTEGER,PARAMETER :: nj_glo=10
+  INTEGER,PARAMETER :: ni_glo=100
+  INTEGER,PARAMETER :: nj_glo=100
   INTEGER,PARAMETER :: llm=2
   INTEGER,PARAMETER :: llmInterPolated=5
Index: XIOS/trunk/src/test/test_remap.f90
===================================================================
--- XIOS/trunk/src/test/test_remap.f90	(revision 774)
+++ XIOS/trunk/src/test/test_remap.f90	(revision 775)
@@ -20,9 +20,10 @@
   DOUBLE PRECISION,ALLOCATABLE :: src_boundslon(:,:), dst_boundslon(:,:)
   DOUBLE PRECISION,ALLOCATABLE :: src_boundslat(:,:), dst_boundslat(:,:)
-  DOUBLE PRECISION,ALLOCATABLE :: src_field(:), tmp_field(:)
+  DOUBLE PRECISION,ALLOCATABLE :: src_field(:), tmp_field(:), tmp_field_1(:)
   INTEGER :: src_ni_glo, dst_ni_glo;
   INTEGER :: src_nvertex, dst_nvertex;
   INTEGER :: src_ibegin, dst_ibegin;
   INTEGER :: src_ni, dst_ni;
+  INTEGER :: src_tmp_ni, src_tmp_nj, src_tmp_n;
   CHARACTER(LEN=*),PARAMETER :: src_file="h14.nc"
   CHARACTER(LEN=*),PARAMETER :: dst_file="r180x90.nc"
@@ -119,15 +120,23 @@
                             bounds_lon_1D=dst_boundslon, bounds_lat_1D=dst_boundslat, nvertex=dst_nvertex)
 
-  ALLOCATE(tmp_field(180*90/2))
+
   dtime%second = 3600
   CALL xios_set_timestep(dtime)
 
   CALL xios_close_context_definition()
+  CALL xios_get_domain_attr("src_domain_regular_tmp", ni=src_tmp_ni, nj=src_tmp_nj)
+  ALLOCATE(tmp_field(src_tmp_ni*src_tmp_nj))
+
+  CALL xios_get_axis_attr("src_axis_curvilinear", n=src_tmp_n)
+  CALL xios_get_domain_attr("src_domain_curvilinear", ni=src_tmp_ni, nj=src_tmp_nj)
+  ALLOCATE(tmp_field_1(src_tmp_ni*src_tmp_nj*src_tmp_n))
 
   DO ts=1,1
-    CALL xios_recv_field("src_field_regular", tmp_field)
+    CALL xios_recv_field("src_field_regular_tmp", tmp_field)
+    CALL xios_recv_field("src_field_curvilinear", tmp_field_1)
     CALL xios_update_calendar(ts)
     CALL xios_send_field("src_field",src_field)
     CALL xios_send_field("tmp_field",tmp_field)
+    CALL xios_send_field("tmp_field_1",tmp_field_1)
     CALL wait_us(5000) ;
   ENDDO
Index: XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp
===================================================================
--- XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp	(revision 774)
+++ XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp	(revision 775)
@@ -17,9 +17,14 @@
 
 CDomainAlgorithmGenerateRectilinear::CDomainAlgorithmGenerateRectilinear(CDomain* domainDestination, CDomain* domainSource,
-                                                                         CGrid* gridSource, CGenerateRectilinearDomain* genRectDomain)
-: CDomainAlgorithmTransformation(domainDestination, domainSource), gridSrc_(gridSource), nbDomainDistributedPart_(0)
+                                                                         CGrid* gridDest, CGrid* gridSource,
+                                                                         CGenerateRectilinearDomain* genRectDomain)
+: CDomainAlgorithmTransformation(domainDestination, domainSource), nbDomainDistributedPart_(0)
 {
   genRectDomain->checkValid(domainDestination);
-  computeDistributionGridSource();
+  if (0 != gridSource) computeDistributionGridSource(gridSource);
+  else
+  {
+    computeDistributionGridDestination(gridDest);
+  }
   fillInAttributesDomainDestination();
 }
@@ -36,11 +41,11 @@
   Calculate the number of distributed parts on domain source
 */
-void CDomainAlgorithmGenerateRectilinear::computeDistributionGridSource()
+void CDomainAlgorithmGenerateRectilinear::computeDistributionGridSource(CGrid* gridSrc)
 {
   CContext* context = CContext::getCurrent();
   CContextClient* client = context->client;
 
-  std::vector<CDomain*> domListSrcP = gridSrc_->getDomains();
-  std::vector<CAxis*> axisListSrcP = gridSrc_->getAxis();
+  std::vector<CDomain*> domListSrcP = gridSrc->getDomains();
+  std::vector<CAxis*> axisListSrcP = gridSrc->getAxis();
 
   for (int i = 0; i < domListSrcP.size(); ++i) // support we have only domain, more than one, for now, dont know how to process
@@ -50,5 +55,5 @@
     else
     {
-      gridSrc_->solveAxisRef(false);
+      gridSrc->solveAxisRef(false);
       int nbAxis = axisListSrcP.size();
       std::vector<int> nbLocalAxis(nbAxis, 0);
@@ -90,4 +95,31 @@
 
 /*!
+  Compute the distribution of the domain destination by using available information provided by user such as n_distributed_partition of axis
+*/
+void CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest)
+{
+  // For now, just suppose that the grid contains only one domain
+  std::vector<CAxis*> axisListDestP = gridDest->getAxis();
+  int nbPartition = 1, idx = 0;
+  for (int i = 0; i < gridDest->axis_domain_order.numElements(); ++i)
+  {
+    if (false == (gridDest->axis_domain_order)(i))
+    {
+      nbPartition *= (axisListDestP[idx]->n_distributed_partition.isEmpty()) ? 1: (axisListDestP[idx]->n_distributed_partition.getValue());
+      ++idx;
+    }
+  }
+
+  CContext* context = CContext::getCurrent();
+  CContextClient* client = context->client;
+  int modPart = (client->clientSize) % nbPartition;
+  if (0 != modPart)
+    ERROR("CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest)",
+       << "The grid " <<gridDest->getId() << " is not well-distributed. There is an incompatibility between distribution of axis and domain.");
+  nbDomainDistributedPart_ = client->clientSize/nbPartition;
+
+}
+
+/*!
   Fill in all necessary attributes of domain destination and their values
 */
Index: XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.hpp
===================================================================
--- XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.hpp	(revision 774)
+++ XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.hpp	(revision 775)
@@ -27,5 +27,7 @@
 {
 public:
-  CDomainAlgorithmGenerateRectilinear(CDomain* domainDestination, CDomain* domainSource, CGrid* gridSource, CGenerateRectilinearDomain* zoomDomain);
+  CDomainAlgorithmGenerateRectilinear(CDomain* domainDestination, CDomain* domainSource,
+                                      CGrid* gridDest, CGrid* gridSource,
+                                      CGenerateRectilinearDomain* zoomDomain);
 
   virtual ~CDomainAlgorithmGenerateRectilinear() {}
@@ -34,9 +36,9 @@
 
 private:
-  void computeDistributionGridSource();
+  void computeDistributionGridSource(CGrid* gridSrc);
+  void computeDistributionGridDestination(CGrid* gridDest);
   void fillInAttributesDomainDestination();
 
 private:
-  CGrid* gridSrc_;
   int nbDomainDistributedPart_; //! Number of local domain.
 
Index: XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp
===================================================================
--- XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp	(revision 774)
+++ XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp	(revision 775)
@@ -78,6 +78,6 @@
     bool isNorthPole = false;
     bool isSouthPole = false;
-    if (poleValue == std::abs(domainSrc_->lat_start)) isNorthPole = true;
-    if (poleValue == std::abs(domainSrc_->lat_end)) isSouthPole = true;
+    if (std::abs(poleValue - std::abs(domainSrc_->lat_start)) < NumTraits<double>::epsilon()) isNorthPole = true;
+    if (std::abs(poleValue - std::abs(domainSrc_->lat_end)) < NumTraits<double>::epsilon()) isSouthPole = true;
 
     nVertexSrc = constNVertex;
@@ -121,6 +121,6 @@
     bool isNorthPole = false;
     bool isSouthPole = false;
-    if (poleValue == std::abs(domainDest_->lat_start)) isNorthPole = true;
-    if (poleValue == std::abs(domainDest_->lat_end)) isSouthPole = true;
+    if (std::abs(poleValue - std::abs(domainDest_->lat_start)) < NumTraits<double>::epsilon()) isNorthPole = true;
+    if (std::abs(poleValue - std::abs(domainDest_->lat_end)) < NumTraits<double>::epsilon()) isSouthPole = true;
     if (isNorthPole && (0 == domainDest_->jbegin.getValue()))
     {
Index: XIOS/trunk/src/transformation/grid_generate.cpp
===================================================================
--- XIOS/trunk/src/transformation/grid_generate.cpp	(revision 774)
+++ XIOS/trunk/src/transformation/grid_generate.cpp	(revision 775)
@@ -17,19 +17,22 @@
 : gridSource_(source), gridDestination_(destination), algoTypes_()
 {
-  //Verify the compatibity between two grids
-  int numElement = gridDestination_->axis_domain_order.numElements();
-  if (numElement != gridSource_->axis_domain_order.numElements())
-    ERROR("CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source)",
-       << "Two grids have different number of elements"
-       << "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);
-
-  for (int i = 0; i < numElement; ++i)
-  {
-    if (gridDestination_->axis_domain_order(i) != gridSource_->axis_domain_order(i))
+  if (0 != source)
+  {
+    //Verify the compatibity between two grids
+    int numElement = gridDestination_->axis_domain_order.numElements();
+    if (numElement != gridSource_->axis_domain_order.numElements())
       ERROR("CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source)",
-         << "Transformed grid and its grid source have incompatible elements"
-         << "Grid source " <<gridSource_->getId() << std::endl
-         << "Grid destination " <<gridDestination_->getId());
+         << "Two grids have different number of elements"
+         << "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);
+
+    for (int i = 0; i < numElement; ++i)
+    {
+      if (gridDestination_->axis_domain_order(i) != gridSource_->axis_domain_order(i))
+        ERROR("CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source)",
+           << "Transformed grid and its grid source have incompatible elements"
+           << "Grid source " <<gridSource_->getId() << std::endl
+           << "Grid destination " <<gridDestination_->getId());
+    }
   }
 
@@ -179,5 +182,4 @@
 {
   std::vector<CAxis*> axisListDestP = gridDestination_->getAxis();
-  std::vector<CAxis*> axisListSrcP = gridSource_->getAxis();
 
   int axisIndex =  elementPosition2AxisPositionInGrid_[elementPositionInGrid];
@@ -207,5 +209,6 @@
 {
   std::vector<CDomain*> domainListDestP = gridDestination_->getDomains();
-  std::vector<CDomain*> domainListSrcP = gridSource_->getDomains();
+  std::vector<CDomain*> domainListSrcP(domainListDestP.size());
+  if (0 != gridSource_) domainListSrcP = gridSource_->getDomains();
 
   int domainIndex =  elementPosition2DomainPositionInGrid_[elementPositionInGrid];
@@ -223,5 +226,6 @@
       {
         genRectDomain = dynamic_cast<CGenerateRectilinearDomain*> (it->second);
-        algo = new CDomainAlgorithmGenerateRectilinear(domainListDestP[domainIndex], domainListSrcP[domainIndex], gridSource_, genRectDomain);
+        algo = new CDomainAlgorithmGenerateRectilinear(domainListDestP[domainIndex], domainListSrcP[domainIndex],
+                                                       gridDestination_, gridSource_, genRectDomain);
       }
       else
Index: XIOS/trunk/src/transformation/grid_generate.hpp
===================================================================
--- XIOS/trunk/src/transformation/grid_generate.hpp	(revision 774)
+++ XIOS/trunk/src/transformation/grid_generate.hpp	(revision 775)
@@ -32,5 +32,5 @@
 public:
   /** Default constructor */
-  CGridGenerate(CGrid* destination, CGrid* source);
+  CGridGenerate(CGrid* destination, CGrid* source = 0);
   ~CGridGenerate();
 
Index: XIOS/trunk/src/utils.hpp
===================================================================
--- XIOS/trunk/src/utils.hpp	(revision 774)
+++ XIOS/trunk/src/utils.hpp	(revision 775)
@@ -225,4 +225,10 @@
     return std::numeric_limits<Scalar>::max();
   }
+  static inline Scalar sflowest() {
+    return -(std::numeric_limits<Scalar>::max());
+  }
+  static inline Scalar epsilon() {
+    return std::numeric_limits<Scalar>::epsilon();
+  }
 };
 
@@ -238,4 +244,10 @@
   static inline Scalar sfmax() {
     return std::numeric_limits<Scalar>::max();
+  }
+  static inline Scalar sflowest() {
+    return -(std::numeric_limits<Scalar>::max());
+  }
+  static inline Scalar epsilon() {
+    return std::numeric_limits<Scalar>::epsilon();
   }
 };
