Ignore:
Timestamp:
06/06/17 17:58:16 (7 years ago)
Author:
oabramkina
Message:

Two server levels: merging with trunk r1137.
There are bugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/filter/source_filter.cpp

    r1021 r1158  
    33#include "exception.hpp" 
    44#include "calendar_util.hpp" 
     5#include <limits>  
    56 
    67namespace xios 
    78{ 
    89  CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
    9                                const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/) 
     10                               const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 
     11                               bool hasMissingValue /*= false*/, 
     12                               double defaultValue /*= 0.0*/) 
    1013    : COutputPin(gc, manualTrigger) 
    1114    , grid(grid) 
    1215    , offset(offset) 
     16    , hasMissingValue(hasMissingValue), defaultValue(defaultValue) 
    1317  { 
    1418    if (!grid) 
     
    2933    packet->data.resize(grid->storeIndex_client.numElements()); 
    3034    grid->inputField(data, packet->data); 
     35 
     36    // Convert missing values to NaN 
     37    if (hasMissingValue) 
     38    { 
     39      double nanValue = std::numeric_limits<double>::quiet_NaN(); 
     40      size_t nbData = packet->data.numElements(); 
     41      for (size_t idx = 0; idx < nbData; ++idx) 
     42      { 
     43        if (defaultValue == packet->data(idx)) 
     44          packet->data(idx) = nanValue; 
     45      } 
     46    } 
    3147 
    3248    onOutputReady(packet); 
Note: See TracChangeset for help on using the changeset viewer.