Ignore:
Timestamp:
01/25/17 16:25:17 (7 years ago)
Author:
yushan
Message:

initialize the branch

File:
1 edited

Legend:

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

    r1018 r1037  
    33#include "exception.hpp" 
    44#include "calendar_util.hpp" 
    5 #include <limits>  
    65 
    76namespace xios 
    87{ 
    9   CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
    10                                const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 
    11                                bool hasMissingValue /*= false*/, 
    12                                double defaultValue /*= 0.0*/) 
    13     : COutputPin(gc, manualTrigger) 
    14     , grid(grid) 
     8  CSourceFilter::CSourceFilter(CGrid* grid, const CDuration offset /*= NoneDu*/) 
     9    : grid(grid) 
    1510    , offset(offset) 
    16     , hasMissingValue(hasMissingValue), defaultValue(defaultValue) 
    1711  { 
    1812    if (!grid) 
     
    3226 
    3327    packet->data.resize(grid->storeIndex_client.numElements()); 
     28 
    3429    grid->inputField(data, packet->data); 
    3530 
    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     } 
    47  
    48     onOutputReady(packet); 
     31    deliverOuput(packet); 
    4932  } 
    5033 
     
    6649    packet->status = CDataPacket::NO_ERROR; 
    6750 
    68     // if (data.size() != grid->storeIndex_toSrv.size()) 
    69     if (data.size() != grid->storeIndex_fromSrv.size()) 
     51    if (data.size() != grid->storeIndex_toSrv.size()) 
    7052      ERROR("CSourceFilter::streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data)", 
    7153            << "Incoherent data received from servers," 
    72             << " expected " << grid->storeIndex_fromSrv.size() << " chunks but " << data.size() << " were given."); 
     54            << " expected " << grid->storeIndex_toSrv.size() << " chunks but " << data.size() << " were given."); 
    7355 
    7456    packet->data.resize(grid->storeIndex_client.numElements()); 
     
    7658    for (it = data.begin(); it != itEnd; it++) 
    7759    { 
    78       // CArray<int,1>& index = grid->storeIndex_toSrv[it->first]; 
    79       CArray<int,1>& index = grid->storeIndex_fromSrv[it->first]; 
     60      CArray<int,1>& index = grid->storeIndex_toSrv[it->first]; 
     61 
    8062      for (int n = 0; n < index.numElements(); n++) 
    8163        packet->data(index(n)) = it->second(n); 
    8264    } 
    8365 
    84     onOutputReady(packet); 
     66    deliverOuput(packet); 
    8567  } 
    8668 
     
    9173    packet->timestamp = date; 
    9274    packet->status = CDataPacket::END_OF_STREAM; 
    93     onOutputReady(packet); 
     75    deliverOuput(packet); 
    9476  } 
    9577} // namespace xios 
Note: See TracChangeset for help on using the changeset viewer.