Changeset 1681 for XIOS/dev/dev_trunk_omp/src/filter/source_filter.cpp
- Timestamp:
- 07/19/19 15:28:33 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_omp/src/filter/source_filter.cpp
r1680 r1681 25 25 } 26 26 27 28 template <int N> 29 void CSourceFilter::streamData(CDate date, const CArray<double, N>& data, const StdString field_id) 27 void CSourceFilter::buildGraph(CDataPacketPtr packet) 30 28 { 31 date = date + offset; // this is a temporary solution, it should be part of a proper temporal filter 32 33 CDataPacketPtr packet(new CDataPacket); 34 packet->date = date; 35 packet->timestamp = date; 36 packet->status = CDataPacket::NO_ERROR; 37 38 packet->data.resize(grid->storeIndex_client.numElements()); 29 bool building_graph = this->tag ? packet->timestamp >= this->field->field_graph_start && packet->timestamp <= this->field->field_graph_end : false; 30 // bool building_graph = this->tag ? packet->timestamp >= this->start_graph && packet->timestamp <= this->end_graph : false; 39 31 40 if (compression) 41 { 42 packet->data = defaultValue; 43 grid->uncompressField(data, packet->data); 44 } 45 else 46 { 47 if (mask) 48 grid->maskField(data, packet->data); 49 else 50 grid->inputField(data, packet->data); 51 } 52 // Convert missing values to NaN 53 if (hasMissingValue) 54 { 55 const double nanValue = std::numeric_limits<double>::quiet_NaN(); 56 const size_t nbData = packet->data.numElements(); 57 for (size_t idx = 0; idx < nbData; ++idx) 58 { 59 if (defaultValue == packet->data(idx)) 60 packet->data(idx) = nanValue; 61 } 62 } 63 64 65 bool building_graph = this->tag ? packet->timestamp >= this->start_graph && packet->timestamp <= this->end_graph : false; 32 // std::cout<<"************************************************source filter 1 : field_id = "<<this->field->getId()<<" this->start_graph = "<<this->start_graph<<" this->end_graph = "<<this->end_graph<<std::endl; 33 // std::cout<<"************************************************source filter 2 : field_id = "<<this->field->getId()<<" this->field->field_graph_start = "<<this->field->field_graph_start<<" this->field->field_graph_end = "<<this->field->field_graph_end<<std::endl; 66 34 67 35 if(building_graph) … … 70 38 packet->src_filterID=this->filterID; 71 39 packet->field = this->field; 40 packet->distance = 1; 72 41 73 if(CXios::isClient) std::cout<<"source filter tag = "<<this->tag<<" start = "<<start_graph<<" end = "<<end_graph<<std::endl;42 // if(CXios::isClient) std::cout<<"source filter tag = "<<this->tag<<" start = "<<start_graph<<" end = "<<end_graph<<std::endl; 74 43 75 44 CWorkflowGraph::allocNodeEdge(); 76 45 77 46 CWorkflowGraph::addNode(this->filterID, "Source Filter ", 1, 1, 0, packet); 78 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record XiosAttributes();47 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 79 48 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].field_id = this->field->getId(); 49 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = 1; 80 50 81 51 CWorkflowGraph::build_begin = true; 82 52 } 83 53 84 85 onOutputReady(packet); 54 // if(building_graph) std::cout<<packet->timestamp<<"************************************************ source filter : field_id = "<<this->field->getId()<<" start = "<<this->field->field_graph_start<<" end_graph = "<<this->field->field_graph_end<<std::endl; 86 55 } 87 88 template void CSourceFilter::streamData<1>(CDate date, const CArray<double, 1>& data, const StdString field_id);89 template void CSourceFilter::streamData<2>(CDate date, const CArray<double, 2>& data, const StdString field_id);90 template void CSourceFilter::streamData<3>(CDate date, const CArray<double, 3>& data, const StdString field_id);91 template void CSourceFilter::streamData<4>(CDate date, const CArray<double, 4>& data, const StdString field_id);92 template void CSourceFilter::streamData<5>(CDate date, const CArray<double, 5>& data, const StdString field_id);93 template void CSourceFilter::streamData<6>(CDate date, const CArray<double, 6>& data, const StdString field_id);94 template void CSourceFilter::streamData<7>(CDate date, const CArray<double, 7>& data, const StdString field_id);95 56 96 57 … … 130 91 } 131 92 } 132 this->filterID = InvalidableObject::filterIdGenerator++;133 packet->src_filterID=this->filterID;134 93 135 if(CXios::isClient) std::cout<<"source filter filter tag = "<<this->tag<<std::endl; 94 if(CXios::isClient) buildGraph(packet); 95 96 136 97 137 98 onOutputReady(packet);
Note: See TracChangeset
for help on using the changeset viewer.