Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp	(revision 1871)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp	(revision 1872)
@@ -33,5 +33,4 @@
   CField::CField(void)
     : CObjectTemplate<CField>(), CFieldAttributes()
-    , file()
     , written(false)
     , nstep(0), nstepMax(0)
@@ -51,5 +50,4 @@
   CField::CField(const StdString& id)
     : CObjectTemplate<CField>(id), CFieldAttributes()
-    , file()
     , written(false)
     , nstep(0), nstepMax(0)
@@ -360,8 +358,8 @@
       info(20) << "currentDate : " << currentDate << endl ;
       info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ;
-      info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ;
-      info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ;
-
-      dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq, file->getContextClient());
+      info(20) << "fileIn_->output_freq.getValue() : " << fileIn_->output_freq.getValue() << endl ;
+      info(20) << "lastDataRequestedFromServer + fileIn_->output_freq.getValue() : " << lastDataRequestedFromServer + fileIn_->output_freq << endl ;
+
+      dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + fileIn_->output_freq, fileIn_->getContextClient());
     }
 
@@ -580,5 +578,5 @@
 
     if (wasDataAlreadyReceivedFromServer)
-      lastDataReceivedFromServer = lastDataReceivedFromServer + file->output_freq;
+      lastDataReceivedFromServer = lastDataReceivedFromServer + fileIn_->output_freq;
     else
     {
@@ -616,5 +614,5 @@
       do
       {
-        const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + file->output_freq) : context->getCalendar()->getInitDate();
+        const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + fileIn_->output_freq) : context->getCalendar()->getInitDate();
         isDataLate = (nextDataDue <= currentDate);
 
@@ -659,5 +657,5 @@
 
   //----------------------------------------------------------------
-
+/*
   void CField::setRelFile(CFile* _file)
   TRY
@@ -667,5 +665,5 @@
   }
   CATCH_DUMP_ATTR
-
+*/
   //----------------------------------------------------------------
 
@@ -688,5 +686,7 @@
   TRY
   {
-    return this->file;
+    if (hasFileIn()) return this->fileIn_;
+    else if (hasFileOut()) return this->fileOut_ ;
+    else return nullptr ;
   }
   CATCH
@@ -1098,12 +1098,10 @@
     CContext* context = CContext::getCurrent();
 
-    if (context->getServiceType()==CServicesManager::CLIENT || !hasOutputFile) return;
-
     if (freq_op.isEmpty()) freq_op.setValue(TimeStep);
 
     if (freq_offset.isEmpty()) freq_offset.setValue(NoneDu);
 
-    freq_operation_srv = file->output_freq.getValue();
-    freq_write_srv     = file->output_freq.getValue();
+    freq_operation_srv = fileOut_->output_freq.getValue();
+    freq_write_srv     = fileOut_->output_freq.getValue();
 
     lastlast_Write_srv = context->getCalendar()->getInitDate();
@@ -1234,4 +1232,12 @@
     }
     
+    if (hasFileOut())
+    {
+      if (fileOut_->isServerSide())
+      {
+        this->solveServerOperation() ;
+      }
+    }
+
     buildWorkflowGraphDone_ = true ;
     workflowEnabled_ = true ;
@@ -1288,5 +1294,11 @@
   void CField::connectToServerInput(CGarbageCollector& gc)
   {
-    serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc,  grid_, false, false));
+    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);
+
+    checkTimeAttributes();
+    serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid_, true, false, freq_offset, true,
+                                                                          detectMissingValues, defaultValue));
+    //serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc,  grid_, false, false));
     serverSourceFilter -> connectOutput(inputFilter,0) ;
   } 
@@ -1382,5 +1394,5 @@
       if (enableOutput && !storeFilter && !fileWriterFilter)
       {
-        if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
+        if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write))
         {
           fileServerWriterFilter = std::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this));
@@ -1397,7 +1409,7 @@
       if (enableOutput && !storeFilter && !fileWriterFilter)
       {
-        if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
+        if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write))
         {
-          fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, file->getContextClient()));
+          fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, getRelFile()->getContextClient()));
           instantDataFilter->connectOutput(fileWriterFilter, 0);
         }
@@ -1433,5 +1445,5 @@
         else if (!field_ref.isEmpty()) 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)
+        else if (getRelFile() && !getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::read)
         {
           checkTimeAttributes();
@@ -1457,8 +1469,8 @@
         }
 
-        if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))
+        if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write))
         {
-          fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, file->getContextClient()));
-          getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0);
+          fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, getRelFile()->getContextClient()));
+          getTemporalDataFilter(gc, getRelFile()->output_freq)->connectOutput(fileWriterFilter, 0);
         }
       }
@@ -2001,5 +2013,5 @@
     if (context->getServiceType()==CServicesManager::GATHERER)
     {
-      if (file->mode.isEmpty() || (!file->mode.isEmpty() && file->mode == CFile::mode_attr::write))
+      if (getRelFile()->mode.isEmpty() || (!getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::write))
         grid_->setContextClient(contextClient);
     }
@@ -2020,6 +2032,18 @@
   {
     CContext::getCurrent()->sendContextToFileServer(client);
-    fileOut_->sendFileToFileServer(client);
+    getRelFile()->sendFileToFileServer(client);
     grid_->sendGridToFileServer(client);
+    this->sendAllAttributesToServer(client);
+    this->sendAddAllVariables(client);
+  }
+  
+  void CField::sendFieldToInputFileServer(void)
+  {
+    CContext::getCurrent()->sendContextToFileServer(client);
+    getRelFile()->sendFileToFileServer(client);
+    grid_->sendGridToFileServer(client);
+    read_access=true ; // not the best solution, but on server side, the field must be a starting point of the workflow
+                       // must be replace by a better solution when implementing filters for reading and send to client
+                       // on server side
     this->sendAllAttributesToServer(client);
     this->sendAddAllVariables(client);
@@ -2121,6 +2145,6 @@
   TRY
   {
-    bool isFieldRead  = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read;
-    bool isFieldWrite = file && ( file->mode.isEmpty() ||  file->mode == CFile::mode_attr::write);
+    bool isFieldRead  = getRelFile() && !getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::read;
+    bool isFieldWrite = getRelFile() && ( getRelFile()->mode.isEmpty() ||  getRelFile()->mode == CFile::mode_attr::write);
     if (isFieldRead && !(operation.getValue() == "instant" || operation.getValue() == "once") )     
       ERROR("void CField::checkTimeAttributes(void)",
@@ -2132,5 +2156,5 @@
       if (operation.getValue() == "instant")
       {
-        if (isFieldRead || isFieldWrite) freq_op.setValue(file->output_freq.getValue());
+        if (isFieldRead || isFieldWrite) freq_op.setValue(getRelFile()->output_freq.getValue());
         else freq_op=*freqOp ;
       }
