source: XIOS/dev/dev_trunk_graph/src/filter/transform_filter.cpp @ 2019

Last change on this file since 2019 was 2019, checked in by yushan, 3 years ago

Graph intermedia commit to a tmp branch

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#include "transform_filter.hpp"
2#include "grid_algorithm.hpp"
3
4namespace xios
5{
6 
7  CTransformFilter::CTransformFilter( CGarbageCollector& gc, int slots, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue) 
8                                    : CFilter(gc, slots, this), algorithm_(algo), 
9                                      detectMissingValues_(detectMissingValues), defaultValue_(defaultValue)
10  {
11
12  }
13
14  CDataPacketPtr CTransformFilter::apply(std::vector<CDataPacketPtr> data)
15  {
16    // for now, no auxilliairy field
17    CDataPacketPtr packet(new CDataPacket);
18    packet->date = data[0]->date;
19    packet->timestamp = data[0]->timestamp;
20    packet->status = data[0]->status;
21
22    if (packet->status == CDataPacket::NO_ERROR) 
23    {
24      if (data.size()>1)
25      {
26        vector<CArray<double,1>> auxData(data.size()-1); 
27        for(int i=0;i<data.size()-1 ;i++) auxData[i].reference(data[i+1]->data) ;
28        algorithm_->apply(data[0]->data, auxData, packet->data);
29      }
30      else algorithm_->apply(data[0]->data, packet->data);
31    }
32    return packet;
33  }
34
35
36
37}
Note: See TracBrowser for help on using the repository browser.