Index: XIOS/dev/dev_trunk_omp/src/node/field.cpp
===================================================================
--- XIOS/dev/dev_trunk_omp/src/node/field.cpp	(revision 1669)
+++ XIOS/dev/dev_trunk_omp/src/node/field.cpp	(revision 1670)
@@ -1197,12 +1197,14 @@
                if (buildWorkflowGraph)
                {
-                 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;
-                 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;
+                 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >;
+                 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >;
                  int filterOut = filter->getFilterId();
                  int filterIn = (std::static_pointer_cast<COutputPin>(filters.second))->getFilterId();
-                 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterOut);
-                 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterIn);
-                 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = filter->GetName();
-                 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = filters.second->GetName();
+                 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut);
+                 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn);
+                 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = filter->GetName();
+                 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = filters.second->GetName();
+                 std::cout<<"CField::buildFilterGraph1 filterIn["<<filterIn<< "] = "<<filters.second->GetName()<< std::endl;
+                 std::cout<<"CField::buildFilterGraph1 filterOut["<<filterOut<< "] = "<<filter->GetName()<< std::endl;
                }
                filter = filters.second;
@@ -1232,6 +1234,8 @@
             if (buildWorkflowGraph) 
             {
-              if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;
-              (*CWorkflowGraph::mapFilters_ptr)[instantDataFilter->getFilterId()] = instantDataFilter->GetName();
+              //CWorkflowGraph::my_filename = file->name;
+              if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >;
+              (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][instantDataFilter->getFilterId()] = instantDataFilter->GetName();
+              std::cout<<"CField::buildFilterGraph1.else filter["<<instantDataFilter->getFilterId()<< "] = "<<instantDataFilter->GetName()<< std::endl;
             }  
          }
@@ -1254,13 +1258,15 @@
            if (buildWorkflowGraph)
            {
-             if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;
-             if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;
+             CWorkflowGraph::my_filename = file->name;
+             if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >;
+             if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >;
              int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId();
              int filterIn = fileWriterFilter->getFilterId();
-             (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterOut);
-             (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterIn);
-             (*CWorkflowGraph::mapFilters_ptr)[filterOut] = "Temporal filter";
-             (*CWorkflowGraph::mapFilters_ptr)[filterIn] = fileWriterFilter->GetName();
-             std::cout<<"CField::buildFilterGraph this->getId() = "<<this->getId() <<" ; this->getOId() = "<<this->getOId()<< std::endl;
+             (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut);
+             (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn);
+             (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = "Temporal filter";
+             (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = fileWriterFilter->GetName();
+             std::cout<<"CField::buildFilterGraph2 filterIn["<<filterIn<< "] = "<<fileWriterFilter->GetName()<< std::endl;
+             std::cout<<"CField::buildFilterGraph2 filterOut["<<filterOut<< "] = "<<"Temporal filter"<< std::endl;
            }
          }
@@ -1270,4 +1276,158 @@
    CATCH_DUMP_ATTR
 
+   void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput, StdString output_filename)
+   TRY
+   {     
+    CWorkflowGraph::my_filename = output_filename;
+    if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform();
+    if (!isGridChecked) checkGridOfEnabledFields();
+
+     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
+     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true);
+     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0);
+
+     CContext* context = CContext::getCurrent();
+     bool hasWriterServer = context->hasServer && !context->hasClient;
+     bool hasIntermediateServer = context->hasServer && context->hasClient;
+
+     if (hasWriterServer)
+     {
+        if (!instantDataFilter)
+          instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false));
+
+
+       // If the field data is to be read by the client or/and written to a file
+       if (enableOutput && !storeFilter && !fileWriterFilter)
+       {
+         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
+         {
+           fileServerWriterFilter = std::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this));
+           instantDataFilter->connectOutput(fileServerWriterFilter, 0);
+         }
+       }
+     }
+     else if (hasIntermediateServer)
+     {
+       if (!instantDataFilter)
+         instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, false));
+
+             // If the field data is to be read by the client or/and written to a file
+       if (enableOutput && !storeFilter && !fileWriterFilter)
+       {
+         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
+         {
+           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));
+           instantDataFilter->connectOutput(fileWriterFilter, 0);
+         }
+       }
+     }
+     else
+     {
+       // Start by building a filter which can provide the field's instant data
+       if (!instantDataFilter)
+       {
+         // Check if we have an expression to parse
+         if (hasExpression())
+         {
+           boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0'));
+           std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this);
+
+           // Check if a spatial transformation is needed
+           if (!field_ref.isEmpty())
+           {
+             CField* fieldRef = CField::get(field_ref);
+             fieldRef->build_workflow_graph.setValue(buildWorkflowGraph);
+             CGrid* gridRef = fieldRef->grid;
+
+             if (grid && grid != gridRef && grid->hasTransform())
+             {
+               std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid,
+                                                                                         detectMissingValues, defaultValue, buildWorkflowGraph);
+
+               filter->connectOutput(filters.first, 0);
+
+               if (buildWorkflowGraph)
+               { 
+                 CWorkflowGraph::my_filename = output_filename;
+                 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >;
+                 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >;
+                 int filterOut = filter->getFilterId();
+                 int filterIn = (std::static_pointer_cast<COutputPin>(filters.second))->getFilterId();
+                 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut);
+                 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn);
+                 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = filter->GetName();
+                 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = filters.second->GetName();
+                 std::cout<<"***CField::buildFilterGraph1 filterIn["<<filterIn<< "] = "<<filters.second->GetName()<< std::endl;
+                 std::cout<<"***CField::buildFilterGraph1 filterOut["<<filterOut<< "] = "<<filter->GetName()<< std::endl;
+               }
+               filter = filters.second;
+             }
+           }
+
+           instantDataFilter = filter;
+         }
+         // Check if we have a reference on another field
+         else if (!field_ref.isEmpty())
+         {
+           CField::get(field_ref)->build_workflow_graph.setValue(buildWorkflowGraph);
+           //instantDataFilter = getFieldReference2(gc, output_filename);
+           instantDataFilter = getFieldReference(gc, output_filename);
+         }
+         // Check if the data is to be read from a file
+         else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read)
+         {
+           checkTimeAttributes();
+           instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true,
+                                                                                                       detectMissingValues, defaultValue, buildWorkflowGraph));
+         }
+         else // The data might be passed from the model
+         {
+            if (check_if_active.isEmpty()) check_if_active = false; 
+            instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false,
+                                                                                                      detectMissingValues, defaultValue, buildWorkflowGraph));
+            if (buildWorkflowGraph) 
+            {
+              CWorkflowGraph::my_filename = output_filename;//CWorkflowGraph::my_filename = file->name;
+              printf("*** *** my_filename = %s\n", CWorkflowGraph::my_filename.c_str());
+              if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >;
+              (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][instantDataFilter->getFilterId()] = instantDataFilter->GetName();
+              std::cout<<"***CField::buildFilterGraph1.else filter["<<instantDataFilter->getFilterId()<< "] = "<<instantDataFilter->GetName()<< std::endl;
+            }  
+         }
+       }
+
+       // If the field data is to be read by the client or/and written to a file
+       if (enableOutput && !storeFilter && !fileWriterFilter)
+       {
+         if (!read_access.isEmpty() && read_access)
+         {
+           storeFilter = std::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid,
+                                                                          detectMissingValues, defaultValue));
+           instantDataFilter->connectOutput(storeFilter, 0);
+         }
+
+         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
+         {
+           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, buildWorkflowGraph));
+           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0);
+           if (buildWorkflowGraph)
+           {
+             CWorkflowGraph::my_filename = output_filename;//CWorkflowGraph::my_filename = file->name;
+             if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >;
+             if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >;
+             int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId();
+             int filterIn = fileWriterFilter->getFilterId();
+             (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut);
+             (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn);
+             (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = "Temporal filter";
+             (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = fileWriterFilter->GetName();
+             std::cout<<"***CField::buildFilterGraph2 filterIn["<<filterIn<< "] = "<<fileWriterFilter->GetName()<< std::endl;
+             std::cout<<"***CField::buildFilterGraph2 filterOut["<<filterOut<< "] = "<<"Temporal filter"<< std::endl;
+           }
+         }
+       }
+     }
+   }
+   CATCH_DUMP_ATTR
    /*!
     * Returns the filter needed to handle the field reference.
@@ -1305,17 +1465,65 @@
      if (buildWorkflowGraph)
      {
-       if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;
-       if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;
+       CWorkflowGraph::my_filename = file->name;
+       if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map<StdString, std::unordered_map <int, StdString> >;
+       if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 
        int filterOut = fieldRef->instantDataFilter->getFilterId();
        int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId();
-       (*CWorkflowGraph::mapFieldToFilters_ptr)[fieldRef->getOId()].push_back(filterOut);
-       (*CWorkflowGraph::mapFieldToFilters_ptr)[fieldRef->getOId()].push_back(filterIn);
-       (*CWorkflowGraph::mapFilters_ptr)[filterOut] = fieldRef->getInstantDataFilter()->GetName();
-       (*CWorkflowGraph::mapFilters_ptr)[filterIn] = filters.first->GetName();
+       (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][fieldRef->getOId()].push_back(filterOut);
+       (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][fieldRef->getOId()].push_back(filterIn);
+       (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = fieldRef->getInstantDataFilter()->GetName();
+       (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = filters.first->GetName();
+       std::cout<<"CField::getFieldReference filterIn["<<filterIn<< "] = "<<filters.first->GetName()<< std::endl;
+       std::cout<<"CField::getFieldReference filterOut["<<filterOut<< "] = "<<fieldRef->getInstantDataFilter()->GetName()<< std::endl;
      }
      return filters.second;
    }
    CATCH_DUMP_ATTR
-
+  
+   std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc, StdString output_filename)
+   TRY
+   {
+     CWorkflowGraph::my_filename = output_filename;
+     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->buildFilterGraph2(gc, false, output_filename);
+     fieldRef->buildFilterGraph(gc, false, output_filename);
+     bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true);
+
+     std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters;
+     // Check if a spatial transformation is needed
+     if (grid && grid != fieldRef->grid && grid->hasTransform())
+     {       
+       bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
+       double defaultValue  = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);                                
+       filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue, buildWorkflowGraph);
+     }
+     else
+     {
+       filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc, buildWorkflowGraph));
+     }
+
+     fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0);
+
+     if (buildWorkflowGraph)
+     {
+       CWorkflowGraph::my_filename = output_filename;
+       if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map<StdString, std::unordered_map <int, StdString> >;
+       if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 
+       int filterOut = fieldRef->instantDataFilter->getFilterId();
+       int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId();
+       (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][fieldRef->getOId()].push_back(filterOut);
+       (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][fieldRef->getOId()].push_back(filterIn);
+       (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = fieldRef->getInstantDataFilter()->GetName();
+       (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = filters.first->GetName();
+       std::cout<<"CField::getFieldReference filterIn["<<filterIn<< "] = "<<filters.first->GetName()<< std::endl;
+       std::cout<<"CField::getFieldReference filterOut["<<filterOut<< "] = "<<fieldRef->getInstantDataFilter()->GetName()<< std::endl;
+     }
+     return filters.second;
+   }
+   CATCH_DUMP_ATTR
    /*!
     * Returns the filter needed to handle a self reference in the field's expression.
@@ -1405,12 +1613,14 @@
        if (buildWorkflowGraph)
        {
-         if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;
-         if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;
+         if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >;
+         if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map<StdString, std::unordered_map <StdString, vector <int> > >;
          int filterOut = instantDataFilter->getFilterId();
          int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId();
-         (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterOut);
-         (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterIn);
-         (*CWorkflowGraph::mapFilters_ptr)[filterOut] = getInstantDataFilter()->GetName();
-         (*CWorkflowGraph::mapFilters_ptr)[filterIn] = temporalFilter->GetName();
+         (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut);
+         (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn);
+         (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = getInstantDataFilter()->GetName();
+         (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = temporalFilter->GetName();
+         std::cout<<"CField::getTemporalDataFilter filterIn["<<filterIn<< "] = "<<temporalFilter->GetName()<< std::endl;
+         std::cout<<"CField::getTemporalDataFilter filterOut["<<filterOut<< "] = "<<getInstantDataFilter()->GetName()<< std::endl;
        }
 
@@ -1459,12 +1669,14 @@
 
        {
-         if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;
-         if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;
+         if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map<StdString, std::unordered_map <int, StdString> >;
+         if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >;
          int filterOut = selfReferenceFilter->getFilterId();
          int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId();
-         (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterOut);
-         (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterIn);
-         (*CWorkflowGraph::mapFilters_ptr)[filterOut] = selfReferenceFilter->GetName();
-         (*CWorkflowGraph::mapFilters_ptr)[filterIn] = temporalFilter->GetName();
+         (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut);
+         (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn);
+         (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = selfReferenceFilter->GetName();
+         (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = temporalFilter->GetName();
+         std::cout<<"CField::getSelfTemporalDataFilter filterIn["<<filterIn<< "] = "<<temporalFilter->GetName()<< std::endl;
+         std::cout<<"CField::getSelfTemporalDataFilter filterOut["<<filterOut<< "] = "<<selfReferenceFilter->GetName()<< std::endl;
        }
 
@@ -1993,2 +2205,3 @@
    DEFINE_REF_FUNC(Field,field)
 } // namespace xios
+
Index: XIOS/dev/dev_trunk_omp/src/node/field.hpp
===================================================================
--- XIOS/dev/dev_trunk_omp/src/node/field.hpp	(revision 1669)
+++ XIOS/dev/dev_trunk_omp/src/node/field.hpp	(revision 1670)
@@ -143,8 +143,10 @@
 
          void buildFilterGraph(CGarbageCollector& gc, bool enableOutput);
+         void buildFilterGraph(CGarbageCollector& gc, bool enableOutput, StdString out_filename);
          size_t getGlobalWrittenSize(void) ;
          
          
          std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc);
+         std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc, StdString out_filename);
          std::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc);
          std::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq);
@@ -295,2 +297,3 @@
 
 #endif // __XIOS_CField__
+
Index: XIOS/dev/dev_trunk_omp/src/node/file.cpp
===================================================================
--- XIOS/dev/dev_trunk_omp/src/node/file.cpp	(revision 1669)
+++ XIOS/dev/dev_trunk_omp/src/node/file.cpp	(revision 1670)
@@ -983,5 +983,7 @@
      for (int i = 0; i < size; ++i)
      {
-       this->enabledFields[i]->buildFilterGraph(gc, true);
+       //this->enabledFields[i]->buildFilterGraph(gc, true);
+       //this->enabledFields[i]->buildFilterGraph2(gc, true, this->name);
+      this->enabledFields[i]->buildFilterGraph(gc, true, this->name);
      }
    }
