Index: XIOS/trunk/src/node/field.cpp
===================================================================
--- XIOS/trunk/src/node/field.cpp	(revision 736)
+++ XIOS/trunk/src/node/field.cpp	(revision 737)
@@ -608,18 +608,5 @@
        // Check if we have a reference on another field
        else if (!field_ref.isEmpty())
-       {
-         CField* fieldRef = CField::get(field_ref);
-         fieldRef->buildFilterGraph(gc, false);
-
-         std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters;
-         // Check if a spatial transformation is needed
-         if (!grid_ref.isEmpty() && !fieldRef->grid_ref.isEmpty() && grid_ref.getValue() != fieldRef->grid_ref.getValue())
-           filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid);
-         else
-           filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc));
-
-         fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0);
-         instantDataFilter = filters.second;
-       }
+         instantDataFilter = getFieldReference(gc);
        // Check if the data is to be read from a file
        else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read)
@@ -647,6 +634,34 @@
 
    /*!
-    * Returns the source filter to handle a self reference in the field's expression.
-    * If the needed source filter does not exist, it is created, otherwise it is reused.
+    * Returns the filter needed to handle the field reference.
+    * This method should only be called when building the filter graph corresponding to the field.
+    *
+    * \param gc the garbage collector to use
+    * \return the output pin corresponding to the field reference
+    */
+   boost::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc)
+   {
+     if (instantDataFilter || field_ref.isEmpty())
+       ERROR("COutputPin* CField::getFieldReference(CGarbageCollector& gc)",
+             "Impossible to get the field reference for a field which has already been parsed or which does not have a field_ref.");
+
+     CField* fieldRef = CField::get(field_ref);
+     fieldRef->buildFilterGraph(gc, false);
+
+     std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters;
+     // Check if a spatial transformation is needed
+     if (!grid_ref.isEmpty() && !fieldRef->grid_ref.isEmpty() && grid_ref.getValue() != fieldRef->grid_ref.getValue())
+       filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid);
+     else
+       filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc));
+
+     fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0);
+
+     return filters.second;
+   }
+
+   /*!
+    * Returns the filter needed to handle a self reference in the field's expression.
+    * If the needed filter does not exist, it is created, otherwise it is reused.
     * This method should only be called when building the filter graph corresponding
     * to the field's expression.
@@ -661,8 +676,18 @@
              "Impossible to add a self reference to a field which has already been parsed or which does not have an expression.");
 
-     if (!clientSourceFilter)
-       clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid));
-
-     return clientSourceFilter;
+     if (!selfReferenceFilter)
+     {
+       if (!field_ref.isEmpty())
+         selfReferenceFilter = getFieldReference(gc);
+       else
+       {
+         if (!clientSourceFilter)
+           clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid));
+
+         selfReferenceFilter = clientSourceFilter;
+       }
+     }
+
+     return selfReferenceFilter;
    }
 
Index: XIOS/trunk/src/node/field.hpp
===================================================================
--- XIOS/trunk/src/node/field.hpp	(revision 736)
+++ XIOS/trunk/src/node/field.hpp	(revision 737)
@@ -116,4 +116,5 @@
 
          void buildFilterGraph(CGarbageCollector& gc, bool enableOutput);
+         boost::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc);
          boost::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc);
          boost::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq);
@@ -208,4 +209,6 @@
          //! The output pin of the filters providing the result of the field's temporal operation
          std::map<CDuration, boost::shared_ptr<COutputPin>, DurationFakeLessComparator> temporalDataFilters;
+         //! The output pin of the filter providing the instant data for self references
+         boost::shared_ptr<COutputPin> selfReferenceFilter;
          //! The source filter for data provided by the client
          boost::shared_ptr<CSourceFilter> clientSourceFilter;
