Index: XIOS/trunk/src/filter/spatial_transform_filter.cpp
===================================================================
--- XIOS/trunk/src/filter/spatial_transform_filter.cpp	(revision 854)
+++ XIOS/trunk/src/filter/spatial_transform_filter.cpp	(revision 873)
@@ -6,10 +6,10 @@
 namespace xios
 {
-  CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, size_t inputSlotsCount)
-    : CFilter(gc, inputSlotsCount, engine)
+  CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount)
+    : CFilter(gc, inputSlotsCount, engine), outputDefaultValue(outputValue)
   { /* Nothing to do */ }
 
   std::pair<boost::shared_ptr<CSpatialTransformFilter>, boost::shared_ptr<CSpatialTransformFilter> >
-  CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid)
+  CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, double defaultValue)
   {
     if (!srcGrid || !destGrid)
@@ -26,5 +26,5 @@
       const std::vector<StdString>& auxInputs = gridTransformation->getAuxInputs();
       size_t inputCount = 1 + (auxInputs.empty() ? 0 : auxInputs.size());
-      boost::shared_ptr<CSpatialTransformFilter> filter(new CSpatialTransformFilter(gc, engine, inputCount));
+      boost::shared_ptr<CSpatialTransformFilter> filter(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount));
 
       if (!lastFilter)
@@ -48,4 +48,12 @@
   }
 
+  void CSpatialTransformFilter::onInputReady(std::vector<CDataPacketPtr> data)
+  {
+    CSpatialTransformFilterEngine* spaceFilter = static_cast<CSpatialTransformFilterEngine*>(engine);
+    CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue);
+    if (outputPacket)
+      deliverOuput(outputPacket);
+  }
+
   CSpatialTransformFilterEngine::CSpatialTransformFilterEngine(CGridTransformation* gridTransformation)
     : gridTransformation(gridTransformation)
@@ -75,4 +83,9 @@
 
   CDataPacketPtr CSpatialTransformFilterEngine::apply(std::vector<CDataPacketPtr> data)
+  {
+    /* Nothing to do */
+  }
+
+  CDataPacketPtr CSpatialTransformFilterEngine::applyFilter(std::vector<CDataPacketPtr> data, double defaultValue)
   {
     CDataPacketPtr packet(new CDataPacket);
@@ -90,4 +103,5 @@
       }
       packet->data.resize(gridTransformation->getGridDestination()->storeIndex_client.numElements());
+      packet->data = defaultValue;
       apply(data[0]->data, packet->data);
     }
@@ -99,8 +113,13 @@
   {
     CContextClient* client = CContext::getCurrent()->client;
+
+    // Get default value for output data
+    double defaultValue = 0.0;
+    if (0 != dataDest.numElements()) defaultValue = dataDest(0);
 
     const std::list<CGridTransformation::SendingIndexGridSourceMap>& listLocalIndexSend = gridTransformation->getLocalIndexToSendFromGridSource();
     const std::list<CGridTransformation::RecvIndexGridDestinationMap>& listLocalIndexToReceive = gridTransformation->getLocalIndexToReceiveOnGridDest();
     const std::list<size_t>& listNbLocalIndexToReceive = gridTransformation->getNbLocalIndexToReceiveOnGridDest();
+    const std::list<std::vector<bool> >& listLocalIndexMaskOnDest = gridTransformation->getLocalMaskIndexOnGridDest();
 
     CArray<double,1> dataCurrentDest(dataSrc.copy());
@@ -110,6 +129,7 @@
     std::list<CGridTransformation::RecvIndexGridDestinationMap>::const_iterator itListRecv = listLocalIndexToReceive.begin();
     std::list<size_t>::const_iterator itNbListRecv = listNbLocalIndexToReceive.begin();
-
-    for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv)
+    std::list<std::vector<bool> >::const_iterator itLocalMaskIndexOnDest = listLocalIndexMaskOnDest.begin();
+
+    for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itLocalMaskIndexOnDest)
     {
       CArray<double,1> dataCurrentSrc(dataCurrentDest);
@@ -164,5 +184,9 @@
 
       dataCurrentDest.resize(*itNbListRecv);
-      dataCurrentDest = 0.0;
+      const std::vector<bool>& localMaskDest = *itLocalMaskIndexOnDest;
+      for (int i = 0; i < localMaskDest.size(); ++i)
+        if (localMaskDest[i]) dataCurrentDest(i) = 0.0;
+        else dataCurrentDest(i) = defaultValue;
+
       currentBuff = 0;
       for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv)
Index: XIOS/trunk/src/filter/spatial_transform_filter.hpp
===================================================================
--- XIOS/trunk/src/filter/spatial_transform_filter.hpp	(revision 854)
+++ XIOS/trunk/src/filter/spatial_transform_filter.hpp	(revision 873)
@@ -21,7 +21,8 @@
        * \param gc the associated garbage collector
        * \param engine the engine defining the spatial transformation
+       * \param outputValue default value of output pin
        * \param [in] inputSlotsCount number of input, by default there is only one for field src
        */
-      CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, size_t inputSlotsCount = 1);
+      CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount = 1);
 
       /*!
@@ -34,5 +35,15 @@
        */
       static std::pair<boost::shared_ptr<CSpatialTransformFilter>, boost::shared_ptr<CSpatialTransformFilter> >
-      buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid);
+      buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, double defaultValue);
+
+    protected:
+      /*!
+        Overriding this function to process transformations with auxillary inputs
+      */
+      void virtual onInputReady(std::vector<CDataPacketPtr> data);
+
+    protected:
+      //! Default value of output pin
+      double outputDefaultValue;
   }; // class CSpatialTransformFilter
 
@@ -56,7 +67,18 @@
        *
        * \param data a vector of packets corresponding to each slot (one in this case)
+       * \param [in] defaultValue default value of output data
+       * \return the result of the grid transformation
+       */
+      CDataPacketPtr applyFilter(std::vector<CDataPacketPtr> data, double defaultValue = 0);
+
+       /*!
+       * Applies the grid transformation to the input data and returns the result.
+       *
+       * \param data a vector of packets corresponding to each slot (one in this case)
        * \return the result of the grid transformation
        */
       CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
+
+
 
     protected:
