Changeset 1637 for XIOS/trunk/src/filter


Ignore:
Timestamp:
01/14/19 13:33:48 (5 years ago)
Author:
oabramkina
Message:

Merging dev to trunk. Major changes:

(1) Grid mask is applied in the source filter of clients: unmasked values are replaced by NaN. It is not reconstructed any more by servers.

(2) Domain/axis mask has been incorporated into data index, with only data index sent to servers.

Location:
XIOS/trunk/src/filter
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/filter/file_writer_filter.cpp

    r1474 r1637  
    1717  void CFileWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) 
    1818  { 
    19     const bool detectMissingValue = (!field->detect_missing_value.isEmpty() 
    20                                       && !field->default_value.isEmpty() 
    21                                       && field->detect_missing_value == true); 
     19    const bool detectMissingValue = ( !field->default_value.isEmpty() && 
     20                               ( (!field->detect_missing_value.isEmpty() || field->detect_missing_value == true) 
     21                                 || field->hasGridMask()) ); 
    2222 
    2323    CArray<double, 1> dataArray = (detectMissingValue) ? data[0]->data.copy() : data[0]->data; 
  • XIOS/trunk/src/filter/source_filter.cpp

    r1250 r1637  
    77namespace xios 
    88{ 
    9   CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, bool compression,  
     9  CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
     10                               bool compression /*= true*/, bool mask /*= false*/, 
    1011                               const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 
    1112                               bool hasMissingValue /*= false*/, 
     
    1415    , grid(grid) 
    1516    , compression(compression) 
     17    , mask(mask) 
    1618    , offset(offset) 
    1719    , hasMissingValue(hasMissingValue), defaultValue(defaultValue) 
     
    4042    } 
    4143    else 
    42       grid->inputField(data, packet->data); 
    43  
    44      
    45      
    46     // if (compression) grid->inputField(data, packet->data) ; 
    47     // else 
    48     // { 
    49     //   // just make a flat copy 
    50     //   CArray<double, N> data_tmp(data.copy()) ; // supress const attribute 
    51     //   CArray<double,1> dataTmp2(data_tmp.dataFirst(),shape(data.numElements()),neverDeleteData) ; 
    52     //   packet->data = dataTmp2 ; 
    53     // } 
     44    { 
     45      if (mask) 
     46        grid->maskField(data, packet->data); 
     47      else 
     48        grid->inputField(data, packet->data); 
     49    } 
    5450    // Convert missing values to NaN 
    5551    if (hasMissingValue) 
  • XIOS/trunk/src/filter/source_filter.hpp

    r1241 r1637  
    2121       * \param gc the garbage collector associated with this filter 
    2222       * \param grid the grid to which the data is attached 
     23       * \param compression 
     24       * \param mask 
    2325       * \param offset the offset applied to the timestamp of all packets 
    2426       * \param manualTrigger whether the output should be triggered manually 
     
    2729       */ 
    2830      CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
    29                     bool compression=true, 
     31                    bool compression = true, 
     32                    bool mask = false, 
    3033                    const CDuration offset = NoneDu, bool manualTrigger = false, 
    3134                    bool hasMissingValue = false, 
     
    6164 
    6265    private: 
    63       CGrid* grid; //!< The grid attached to the data the filter can accept 
    64       const CDuration offset; //!< The offset applied to the timestamp of all packets 
     66      CGrid* grid;             //!< The grid attached to the data the filter can accept 
     67      const CDuration offset;  //!< The offset applied to the timestamp of all packets 
    6568      const bool hasMissingValue; 
    6669      const double defaultValue; 
    67       const bool compression ; //!< indicate if the data need to be compressed : on client size : true, on server side : false 
     70      const bool compression ; //!< indicates if data need to be compressed : on client side : true, on server side : false 
     71      const bool mask ;        //!< indicates whether grid mask should be applied (true for clients, false for servers) 
    6872  }; // class CSourceFilter 
    6973} // namespace xios 
  • XIOS/trunk/src/filter/spatial_transform_filter.cpp

    r1542 r1637  
    6868      onOutputReady(outputPacket); 
    6969  } 
    70  
    71  
    72  
    73  
    7470 
    7571  CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount) 
     
    201197    const std::list<CGridTransformation::RecvIndexGridDestinationMap>& listLocalIndexToReceive = gridTransformation->getLocalIndexToReceiveOnGridDest(); 
    202198    const std::list<size_t>& listNbLocalIndexToReceive = gridTransformation->getNbLocalIndexToReceiveOnGridDest(); 
    203     const std::list<std::vector<bool> >& listLocalIndexMaskOnDest = gridTransformation->getLocalMaskIndexOnGridDest(); 
    204199    const std::vector<CGenericAlgorithmTransformation*>& listAlgos = gridTransformation->getAlgos(); 
    205200 
     
    210205    std::list<CGridTransformation::RecvIndexGridDestinationMap>::const_iterator itListRecv = listLocalIndexToReceive.begin(); 
    211206    std::list<size_t>::const_iterator itNbListRecv = listNbLocalIndexToReceive.begin(); 
    212     std::list<std::vector<bool> >::const_iterator itLocalMaskIndexOnDest = listLocalIndexMaskOnDest.begin(); 
    213207    std::vector<CGenericAlgorithmTransformation*>::const_iterator itAlgo = listAlgos.begin(); 
    214208 
    215     for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itLocalMaskIndexOnDest, ++itAlgo) 
     209    for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itAlgo) 
    216210    { 
    217211      CArray<double,1> dataCurrentSrc(dataCurrentDest); 
     
    266260 
    267261      dataCurrentDest.resize(*itNbListRecv); 
    268       const std::vector<bool>& localMaskDest = *itLocalMaskIndexOnDest; 
    269       for (int i = 0; i < localMaskDest.size(); ++i) 
    270         if (localMaskDest[i]) dataCurrentDest(i) = 0.0; 
    271         else dataCurrentDest(i) = defaultValue; 
     262      dataCurrentDest = 0.0; 
    272263 
    273264      std::vector<bool> localInitFlag(dataCurrentDest.numElements(), true); 
Note: See TracChangeset for help on using the changeset viewer.