Index: XIOS/dev/dev_olga/src/node/field.cpp
===================================================================
--- XIOS/dev/dev_olga/src/node/field.cpp	(revision 1166)
+++ XIOS/dev/dev_olga/src/node/field.cpp	(revision 1201)
@@ -131,52 +131,52 @@
 
     CContext* context = CContext::getCurrent();
-      CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient();
-
-      CEventClient event(getType(), EVENT_ID_UPDATE_DATA);
-
-      map<int, CArray<int,1> >::iterator it;
-      list<CMessage> list_msg;
-      list<CArray<double,1> > list_data;
-
-      if (!grid->doGridHaveDataDistributed())
+    CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient();
+
+    CEventClient event(getType(), EVENT_ID_UPDATE_DATA);
+
+    map<int, CArray<int,1> >::iterator it;
+    list<CMessage> list_msg;
+    list<CArray<double,1> > list_data;
+
+    if (!grid->doGridHaveDataDistributed())
+    {
+       if (client->isServerLeader())
+       {
+          for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++)
+          {
+            int rank = it->first;
+            CArray<int,1>& index = it->second;
+
+            list_msg.push_back(CMessage());
+            list_data.push_back(CArray<double,1>(index.numElements()));
+
+            CArray<double,1>& data_tmp = list_data.back();
+            for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n));
+
+            list_msg.back() << getId() << data_tmp;
+            event.push(rank, 1, list_msg.back());
+          }
+          client->sendEvent(event);
+        }
+      else client->sendEvent(event);
+    }
+    else
+    {
+      for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++)
       {
-         if (client->isServerLeader())
-         {
-            for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++)
-            {
-              int rank = it->first;
-              CArray<int,1>& index = it->second;
-
-              list_msg.push_back(CMessage());
-              list_data.push_back(CArray<double,1>(index.numElements()));
-
-              CArray<double,1>& data_tmp = list_data.back();
-              for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n));
-
-              list_msg.back() << getId() << data_tmp;
-              event.push(rank, 1, list_msg.back());
-            }
-            client->sendEvent(event);
-         }
-         else client->sendEvent(event);
-      }
-      else
-      {
-        for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++)
-        {
-          int rank = it->first;
-          CArray<int,1>& index = it->second;
-
-          list_msg.push_back(CMessage());
-          list_data.push_back(CArray<double,1>(index.numElements()));
-
-          CArray<double,1>& data_tmp = list_data.back();
-          for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n));
-
-          list_msg.back() << getId() << data_tmp;
-          event.push(rank, grid->nbSenders[0][rank], list_msg.back());
-        }
-        client->sendEvent(event);
-      }    
+        int rank = it->first;
+        CArray<int,1>& index = it->second;
+
+        list_msg.push_back(CMessage());
+        list_data.push_back(CArray<double,1>(index.numElements()));
+
+        CArray<double,1>& data_tmp = list_data.back();
+        for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n));
+
+        list_msg.back() << getId() << data_tmp;
+        event.push(rank, grid->nbSenders[0][rank], list_msg.back());
+      }
+      client->sendEvent(event);
+    }
 
     CTimer::get("Field : send data").suspend();
@@ -276,6 +276,6 @@
   {
     CContext* context = CContext::getCurrent();
+//    CContextClient* client = context->client;
     CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient();
-
 
     lastDataRequestedFromServer = tsDataRequested;
@@ -336,4 +336,5 @@
     CContext* context = CContext::getCurrent();
     CContextClient* client = context->client;
+//    CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient();
 
     CEventClient event(getType(), EVENT_ID_READ_DATA_READY);
@@ -854,4 +855,8 @@
    {     
     if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform();
+
+     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
+     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0);
+
      CContext* context = CContext::getCurrent();
      bool hasWriterServer = context->hasServer && !context->hasClient;
@@ -906,7 +911,5 @@
              if (grid && grid != gridRef && 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);
-               std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, hasMissingValue, defaultValue);
+                 std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); 
 
                filter->connectOutput(filters.first, 0);
@@ -924,11 +927,11 @@
            instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,
                                                                                                        freq_offset.isEmpty() ? NoneDu : freq_offset,
-                                                                                                       true));
+                                                                                                       true,
+                                                                                                       detectMissingValues, defaultValue));
          else // The data might be passed from the model
          {
-            bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
-            double defaultValue  = ignoreMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);
+            if (check_if_active.isEmpty()) check_if_active = false; 
             instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, NoneDu, false,
-                                                                                                        ignoreMissingValue, defaultValue));
+                                                                                                        detectMissingValues, defaultValue));
          }
        }
@@ -937,15 +940,13 @@
        if (enableOutput && !storeFilter && !fileWriterFilter)
        {
-         if (!read_access.isEmpty() && read_access)
-         {
-           storeFilter = boost::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid));
-           instantDataFilter->connectOutput(storeFilter, 0);
-         }
-
-         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
-         {
-           fileWriterFilter = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));
-           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0);
-         }
+         storeFilter = boost::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 = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));
+         getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0);
        }
      }
@@ -1001,4 +1002,7 @@
      if (!selfReferenceFilter)
      {
+       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
+       const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0);
+
        if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read)
        {
@@ -1006,5 +1010,7 @@
            serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,
                                                                                    freq_offset.isEmpty() ? NoneDu : freq_offset,
-                                                                                   true));
+                                                                                   true,
+                                                                                   detectMissingValues, defaultValue));
+
          selfReferenceFilter = serverSourceFilter;
        }
@@ -1019,8 +1025,7 @@
          if (!clientSourceFilter)
          {
-           bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
-           double defaultValue  = ignoreMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
+           if (check_if_active.isEmpty()) check_if_active = false;
            clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, NoneDu, false,
-                                                                                   ignoreMissingValue, defaultValue));
+                                                                                   detectMissingValues, defaultValue));
          }
 
@@ -1056,10 +1061,10 @@
          freq_offset.setValue(NoneDu);
 
-       const bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
-
+       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
+       
        boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation,
                                                                              CContext::getCurrent()->getCalendar()->getInitDate(),
                                                                              freq_op, freq_offset, outFreq,
-                                                                             ignoreMissingValue, ignoreMissingValue ? default_value : 0.0));
+                                                                             detectMissingValues, detectMissingValues ? default_value : 0.0));
        instantDataFilter->connectOutput(temporalFilter, 0);
 
@@ -1096,10 +1101,10 @@
        if (freq_offset.isEmpty()) freq_offset.setValue(NoneDu);
 
-       const bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
+       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true);
 
        boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation,
                                                                              CContext::getCurrent()->getCalendar()->getInitDate(),
                                                                              freq_op, freq_offset, outFreq,
-                                                                             ignoreMissingValue, ignoreMissingValue ? default_value : 0.0));
+                                                                             detectMissingValues, detectMissingValues ? default_value : 0.0));
        selfReferenceFilter->connectOutput(temporalFilter, 0);
        return temporalFilter ;
