Changeset 1668 for XIOS/dev/dev_trunk_omp
- Timestamp:
- 05/22/19 17:26:47 (5 years ago)
- Location:
- XIOS/dev/dev_trunk_omp
- Files:
-
- 4 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_omp/inputs/COMPLETE/context_surface.xml
r1173 r1668 20 20 <variable id="my_attribute5" type="double">100.201</variable> 21 21 </field> 22 <field field_ref="field_A_srf_K" />22 <field field_ref="field_A_srf_K" build_workflow_graph=".TRUE." /> 23 23 <field field_ref="field_A_srf_K_2" name="field_A_srf_K_2" /> <!-- Should be identical to field_A_srf_K --> 24 24 <field field_ref="field_A_srf_K" name="field_A_srf_K_3">field_A_srf_K</field> <!-- Should be identical to field_A_srf_K --> -
XIOS/dev/dev_trunk_omp/inputs/iodef.xml
r1646 r1668 18 18 <file id="output" name="output" enabled=".TRUE."> 19 19 <!-- <field field_ref="field_Domain" name="field_A" /> --> 20 <field field_ref="field_A" name="field_A" />20 <field field_ref="field_A" name="field_A" build_workflow_graph=".TRUE." /> 21 21 <field field_ref="field_A_zoom" name="field_B" /> 22 22 </file> -
XIOS/dev/dev_trunk_omp/src/config/field_attribute.conf
r1524 r1668 19 19 DECLARE_ATTRIBUTE(bool, indexed_output) 20 20 DECLARE_ATTRIBUTE(bool, check_if_active) 21 DECLARE_ATTRIBUTE(bool, build_workflow_graph) 21 22 22 23 DECLARE_ATTRIBUTE(StdString, domain_ref, false) -
XIOS/dev/dev_trunk_omp/src/cxios.cpp
r1665 r1668 15 15 using namespace ep_lib; 16 16 #endif 17 17 #include "graphviz.hpp" 18 18 namespace xios 19 19 { … … 172 172 globalRegistry->toFile("xios_registry.bin") ; 173 173 delete globalRegistry ; 174 175 CGraphviz::buildStaticWorkflowGraph(); 174 176 } 175 177 -
XIOS/dev/dev_trunk_omp/src/filter/file_server_writer_filter.cpp
r1358 r1668 28 28 return true; 29 29 } 30 31 int CFileServerWriterFilter::getFilterId(void) 32 { 33 return filterId; 34 } 35 30 36 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/file_server_writer_filter.hpp
r1358 r1668 37 37 bool virtual isDataExpected(const CDate& date) const; 38 38 39 /*! 40 * Returns filter's id needed in case of building workflow graph 41 */ 42 int getFilterId(); 43 39 44 protected: 40 45 /*! … … 48 53 CField* field; //<! The associated field 49 54 std::map<Time, CDataPacketPtr> packets; //<! The stored packets 55 int filterId; //<! Filter's id needed in case of building a workflow 56 50 57 }; // class CFileServerWriterFilter 51 58 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/file_writer_filter.cpp
r1646 r1668 3 3 #include "field.hpp" 4 4 #include "utils.hpp" 5 #include "workflow_graph.hpp" 5 6 6 7 namespace xios 7 8 { 8 CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field )9 CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field, bool buildWorkflowGraph /* =false */) 9 10 : CInputPin(gc, 1) 10 11 , field(field) … … 13 14 ERROR("CFileWriterFilter::CFileWriterFilter(CField* field)", 14 15 "The field cannot be null."); 16 if (buildWorkflowGraph) 17 { 18 filterId = InvalidableObject::count; 19 InvalidableObject::count++; 20 } 15 21 } 16 22 … … 46 52 return true; 47 53 } 54 55 int CFileWriterFilter::getFilterId(void) 56 { 57 return filterId; 58 } 59 48 60 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/file_writer_filter.hpp
r1358 r1668 20 20 * \param gc the associated garbage collector 21 21 * \param field the associated field 22 * \param[in] buildWorkflowGraph indicates whether the workflow will be visualized 22 23 */ 23 CFileWriterFilter(CGarbageCollector& gc, CField* field); 24 CFileWriterFilter(CGarbageCollector& gc, CField* field, bool buildWorkflowGraph = false); 25 26 inline StdString GetName(void) {return StdString("File writer filter");}; 24 27 25 28 /*! … … 37 40 bool virtual isDataExpected(const CDate& date) const; 38 41 42 /*! 43 * Returns filter's id needed in case of building workflow graph 44 */ 45 int getFilterId(); 46 39 47 protected: 40 48 /*! … … 48 56 CField* field; //<! The associated field 49 57 std::map<Time, CDataPacketPtr> packets; //<! The stored packets 58 int filterId; //<! Filter's id needed in case of building a workflow 59 50 60 }; // class CFileWriterFilter 51 61 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/filter.cpp
r1358 r1668 3 3 namespace xios 4 4 { 5 CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine )5 CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine, bool buildWorkflowGraph /*= false*/) 6 6 : CInputPin(gc, inputSlotsCount) 7 , COutputPin(gc )7 , COutputPin(gc, false, buildWorkflowGraph) 8 8 , engine(engine) 9 9 , inputSlotCount(inputSlotCount) 10 10 { /* Nothing to do */ } 11 12 StdString CFilter::GetName(void) { return StdString("Filter"); } 11 13 12 14 void CFilter::onInputReady(std::vector<CDataPacketPtr> data) -
XIOS/dev/dev_trunk_omp/src/filter/filter.hpp
r1358 r1668 23 23 * \param inputSlotsCount the number of input slots 24 24 * \param engine the filter engine 25 * \param buildWorkflowGraph indicates whether data will be visualized 25 26 */ 26 CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 27 CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine, bool buildWorkflowGraph = false); 28 29 StdString virtual GetName(void); 27 30 28 31 /*! -
XIOS/dev/dev_trunk_omp/src/filter/garbage_collector.cpp
r1021 r1668 3 3 namespace xios 4 4 { 5 6 int InvalidableObject::count = 0; 7 #pragma omp threadprivate(InvalidableObject::count) 8 5 9 void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) 6 10 { -
XIOS/dev/dev_trunk_omp/src/filter/garbage_collector.hpp
r1021 r1668 20 20 */ 21 21 void virtual invalidate(Time timestamp) = 0; 22 23 static int count; //!< Counter used to identify a filter in case building workflow graph 24 #pragma omp threadprivate(count) 25 22 26 }; // struct InvalidableObject 23 27 -
XIOS/dev/dev_trunk_omp/src/filter/input_pin.cpp
r1021 r1668 3 3 #include "garbage_collector.hpp" 4 4 #include "exception.hpp" 5 #include "workflow_graph.hpp" 5 6 6 7 namespace xios … … 11 12 , triggers(slotsCount) 12 13 , hasTriggers(false) 13 { /* Nothing to do */ } 14 { } 15 16 StdString CInputPin::GetName(void) 17 { 18 return StdString("Input pin"); 19 } 14 20 15 21 void CInputPin::setInput(size_t inputSlot, CDataPacketPtr packet) … … 77 83 inputs.erase(inputs.begin(), inputs.lower_bound(timestamp)); 78 84 } 85 86 int CInputPin::getFilterId(void) 87 { 88 return -1; 89 } 90 79 91 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/input_pin.hpp
r1358 r1668 26 26 */ 27 27 CInputPin(CGarbageCollector& gc, size_t slotsCount); 28 29 StdString virtual GetName(void); 28 30 29 31 /*! … … 79 81 */ 80 82 void virtual invalidate(Time timestamp); 83 84 /*! 85 * Returns filter's id needed in case of building workflow graph 86 * This function should never be called from this class, instead functions defined in derived classes or in class COutputPin should be used 87 */ 88 int virtual getFilterId(); 81 89 82 90 protected: -
XIOS/dev/dev_trunk_omp/src/filter/output_pin.cpp
r1542 r1668 1 1 #include "output_pin.hpp" 2 2 #include "exception.hpp" 3 #include "workflow_graph.hpp" 3 4 4 5 namespace xios 5 6 { 6 COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/ )7 COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/, bool buildWorkflowGraph /* =false */) 7 8 : gc(gc) 8 9 , manualTrigger(manualTrigger) 9 { /* Nothing to do */ } 10 , buildWorkflowGraph(buildWorkflowGraph) 11 { 12 if (buildWorkflowGraph) 13 { 14 filterId = InvalidableObject::count; 15 InvalidableObject::count++; 16 } 17 } 18 19 StdString COutputPin::GetName(void) 20 { 21 return StdString("Output pin"); 22 } 10 23 11 24 void COutputPin::connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot) … … 26 39 ERROR("void COutputPin::onOutputReady(CDataPacketPtr packet)", 27 40 "The packet cannot be null."); 41 42 if (buildWorkflowGraph) 43 { 44 if(CWorkflowGraph::mapFilterTimestamps_ptr==0) CWorkflowGraph::mapFilterTimestamps_ptr = new std::unordered_map <int, vector<Time> >; 45 if(CWorkflowGraph::timestamps_ptr==0) CWorkflowGraph::timestamps_ptr = new set<Time>; 46 (*CWorkflowGraph::mapFilterTimestamps_ptr)[this->getFilterId()].push_back(packet->timestamp); 47 CWorkflowGraph::timestamps_ptr->insert(packet->timestamp); 48 } 28 49 29 50 if (manualTrigger) // Don't use canBeTriggered here, this function is virtual and can be overriden … … 101 122 outputPackets.erase(outputPackets.begin(), outputPackets.lower_bound(timestamp)); 102 123 } 124 125 int COutputPin::getFilterId(void) 126 { 127 return filterId; 128 } 129 103 130 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/output_pin.hpp
r1542 r1668 19 19 * \param gc the garbage collector associated with this ouput pin 20 20 * \param slotsCount the number of slots 21 * \param buildWorkflowGraph indicates whether data will be visualized 21 22 */ 22 COutputPin(CGarbageCollector& gc, bool manualTrigger = false );23 COutputPin(CGarbageCollector& gc, bool manualTrigger = false, bool buildWorkflowGraph = false); 23 24 25 StdString virtual GetName(void); 26 24 27 /*! 25 28 * Connects to a specific slot of the input pin of a downstream filter. … … 66 69 void virtual invalidate(Time timestamp); 67 70 71 /*! 72 * Returns filter's id needed in case of building workflow graph 73 */ 74 int getFilterId(); 75 68 76 protected: 69 77 /*! … … 97 105 //! Output buffer, store the packets until the output is triggered 98 106 std::map<Time, CDataPacketPtr> outputPackets; 107 108 //! Indicates whether the workflow will be visualized 109 bool buildWorkflowGraph; 110 111 //! Filter's id needed in case of building a workflow graph 112 int filterId; 113 114 99 115 }; // class COutputPin 100 116 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/pass_through_filter.cpp
r641 r1668 3 3 namespace xios 4 4 { 5 CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc )6 : CFilter(gc, 1, this )5 CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc, bool buildWorkflowGraph /*= false*/) 6 : CFilter(gc, 1, this, buildWorkflowGraph) 7 7 { /* Nothing to do */ } 8 8 -
XIOS/dev/dev_trunk_omp/src/filter/pass_through_filter.hpp
r641 r1668 17 17 * 18 18 * \param gc the associated garbage collector 19 * \param buildWorkflowGraph indicates whether data will be visualized 19 20 */ 20 CPassThroughFilter(CGarbageCollector& gc); 21 CPassThroughFilter(CGarbageCollector& gc, bool buildWorkflowGraph = false); 22 23 inline StdString GetName(void) {return StdString("Pass through filter");}; 21 24 22 25 protected: -
XIOS/dev/dev_trunk_omp/src/filter/source_filter.cpp
r1646 r1668 4 4 #include "calendar_util.hpp" 5 5 #include <limits> 6 #include "workflow_graph.hpp" 6 7 7 8 namespace xios … … 11 12 const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 12 13 bool hasMissingValue /*= false*/, 13 double defaultValue /*= 0.0*/) 14 : COutputPin(gc, manualTrigger) 14 double defaultValue /*= 0.0*/, 15 bool buildWorkflowGraph /*= false*/) 16 : COutputPin(gc, manualTrigger, buildWorkflowGraph) 15 17 , grid(grid) 16 18 , compression(compression) -
XIOS/dev/dev_trunk_omp/src/filter/source_filter.hpp
r1646 r1668 27 27 * \param hasMissingValue whether data has missing value 28 28 * \param defaultValue missing value to detect 29 * \param[in] buildWorkflowGraph indicates whether the workflow will be visualized 29 30 */ 30 31 CSourceFilter(CGarbageCollector& gc, CGrid* grid, … … 33 34 const CDuration offset = NoneDu, bool manualTrigger = false, 34 35 bool hasMissingValue = false, 35 double defaultValue = 0.0); 36 double defaultValue = 0.0, 37 bool buildWorkflowGraph = false); 38 39 inline StdString GetName(void) {return StdString("Source filter");}; 36 40 37 41 /*! -
XIOS/dev/dev_trunk_omp/src/filter/spatial_transform_filter.cpp
r1661 r1668 8 8 using namespace ep_lib; 9 9 #endif 10 10 #include "workflow_graph.hpp" 11 11 namespace xios 12 12 { 13 CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount) 14 : CFilter(gc, inputSlotsCount, engine), outputDefaultValue(outputValue) 13 CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 14 double outputValue, size_t inputSlotsCount, bool buildWorkflowGraph /*= false*/) 15 : CFilter(gc, inputSlotsCount, engine, buildWorkflowGraph), outputDefaultValue(outputValue) 15 16 { /* Nothing to do */ } 16 17 17 18 std::pair<std::shared_ptr<CSpatialTransformFilter>, std::shared_ptr<CSpatialTransformFilter> > 18 CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double missingValue) 19 CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double missingValue, 20 bool buildWorkflowGraph) 19 21 { 20 22 if (!srcGrid || !destGrid) … … 41 43 42 44 std::shared_ptr<CSpatialTransformFilter> filter ; 43 if( isSpatialTemporal) filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTemporalFilter(gc, engine, gridTransformation, defaultValue, inputCount)); 44 else filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount)); 45 if( isSpatialTemporal) 46 filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTemporalFilter(gc, engine, gridTransformation, defaultValue, inputCount, buildWorkflowGraph)); 47 else 48 filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount, buildWorkflowGraph)); 45 49 46 50 … … 48 52 lastFilter = filter; 49 53 else 54 { 50 55 filter->connectOutput(firstFilter, 0); 56 if (buildWorkflowGraph) 57 { 58 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 59 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 60 int filterOut = (std::static_pointer_cast<COutputPin>(filter))->getFilterId(); 61 int filterIn = (std::static_pointer_cast<COutputPin>(firstFilter))->getFilterId(); 62 // PASS field's id here 63 (*CWorkflowGraph::mapFieldToFilters_ptr)["XXX"].push_back(filterOut); 64 (*CWorkflowGraph::mapFieldToFilters_ptr)["XXX"].push_back(filterIn); 65 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = "Spatial transform filter"; 66 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = "Spatial transform filter"; 67 } 68 } 51 69 52 70 firstFilter = filter; … … 73 91 } 74 92 75 CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount) 76 : CSpatialTransformFilter(gc, engine, outputValue, inputSlotsCount), record(0) 93 CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 94 CGridTransformation* gridTransformation, double outputValue, 95 size_t inputSlotsCount, bool buildWorkflowGraph) 96 : CSpatialTransformFilter(gc, engine, outputValue, inputSlotsCount, buildWorkflowGraph), record(0) 77 97 { 78 98 const CGridTransformationSelector::ListAlgoType& algoList = gridTransformation->getAlgoList() ; -
XIOS/dev/dev_trunk_omp/src/filter/spatial_transform_filter.hpp
r1601 r1668 23 23 * \param outputValue default value of output pin 24 24 * \param [in] inputSlotsCount number of input, by default there is only one for field src 25 * \param buildWorkflowGraph indicates whether data will be visualized 25 26 */ 26 CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount = 1); 27 CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 28 double outputValue, size_t inputSlotsCount = 1, bool buildWorkflowGraph = false); 29 30 inline StdString GetName(void) {return StdString("Spatial transform filter");}; 27 31 28 32 /*! … … 34 38 * \param hasMissingValue whether field source has missing value 35 39 * \param defaultValue default value 40 * \param buildWorkflowGraph indicates whether data will be visualized 36 41 * \return the first and the last filters of the filter graph 37 42 */ 38 43 static std::pair<std::shared_ptr<CSpatialTransformFilter>, std::shared_ptr<CSpatialTransformFilter> > 39 buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double defaultValue );44 buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double defaultValue, bool buildWorkflowGraph = false); 40 45 41 46 protected: … … 67 72 * \param outputValue default value of output pin 68 73 * \param [in] inputSlotsCount number of input, by default there is only one for field src 74 * \param buildWorkflowGraph indicates whether data will be visualized 75 * 69 76 */ 70 CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount = 1); 77 CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, 78 double outputValue, size_t inputSlotsCount = 1, bool buildWorkflowGraph = false); 71 79 72 80 -
XIOS/dev/dev_trunk_omp/src/filter/store_filter.cpp
r1646 r1668 138 138 packets.erase(packets.begin(), packets.lower_bound(timestamp)); 139 139 } 140 141 int CStoreFilter::getFilterId(void) 142 { 143 return filterId; 144 } 145 140 146 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/store_filter.hpp
r1358 r1668 73 73 void virtual invalidate(Time timestamp); 74 74 75 /*! 76 * Returns filter's id needed in case of building workflow graph 77 */ 78 int getFilterId(); 79 75 80 protected: 76 81 /*! … … 88 93 const double missingValue; //!< The value to use to replace missing values 89 94 std::map<Time, CDataPacketPtr> packets; //<! The stored packets 95 int filterId; //!< Filter's id needed in case of building a workflow 96 90 97 }; // class CStoreFilter 91 98 } // namespace xios -
XIOS/dev/dev_trunk_omp/src/filter/temporal_filter.cpp
r1601 r1668 9 9 CTemporalFilter::CTemporalFilter(CGarbageCollector& gc, const std::string& opId, 10 10 const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, 11 bool ignoreMissingValue /*= false*/ )12 : CFilter(gc, 1, this )11 bool ignoreMissingValue /*= false*/, bool buildWorkflowGraph /*= false*/) 12 : CFilter(gc, 1, this, buildWorkflowGraph) 13 13 , functor(createFunctor(opId, ignoreMissingValue, tmpData)) 14 14 , isOnceOperation(functor->timeType() == func::CFunctor::once) -
XIOS/dev/dev_trunk_omp/src/filter/temporal_filter.hpp
r1473 r1668 29 29 CTemporalFilter(CGarbageCollector& gc, const std::string& opId, 30 30 const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, 31 bool ignoreMissingValue = false); 31 bool ignoreMissingValue = false, bool buildWorkflowGraph = false); 32 33 inline StdString GetName(void) {return StdString("Temporal filter");}; 32 34 33 35 /*! -
XIOS/dev/dev_trunk_omp/src/node/field.cpp
r1665 r1668 24 24 #include "spatial_transform_filter.hpp" 25 25 #include "file_server_writer_filter.hpp" 26 #include "workflow_graph.hpp" 26 27 27 28 namespace xios{ … … 1120 1121 1121 1122 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1123 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1122 1124 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1123 1125 … … 1171 1173 if (!field_ref.isEmpty()) 1172 1174 { 1173 CGrid* gridRef = CField::get(field_ref)->grid; 1175 CField* fieldRef = CField::get(field_ref); 1176 fieldRef->build_workflow_graph.setValue(buildWorkflowGraph); 1177 CGrid* gridRef = fieldRef->grid; 1174 1178 1175 1179 if (grid && grid != gridRef && grid->hasTransform()) 1176 1180 { 1177 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); 1181 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, 1182 detectMissingValues, defaultValue, buildWorkflowGraph); 1178 1183 1179 1184 filter->connectOutput(filters.first, 0); 1185 1186 if (buildWorkflowGraph) 1187 { 1188 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1189 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 1190 int filterOut = filter->getFilterId(); 1191 int filterIn = (std::static_pointer_cast<COutputPin>(filters.second))->getFilterId(); 1192 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterOut); 1193 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterIn); 1194 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = filter->GetName(); 1195 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = filters.second->GetName(); 1196 } 1180 1197 filter = filters.second; 1181 1198 } … … 1186 1203 // Check if we have a reference on another field 1187 1204 else if (!field_ref.isEmpty()) 1205 { 1206 CField::get(field_ref)->build_workflow_graph.setValue(buildWorkflowGraph); 1188 1207 instantDataFilter = getFieldReference(gc); 1208 } 1189 1209 // Check if the data is to be read from a file 1190 1210 else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) … … 1192 1212 checkTimeAttributes(); 1193 1213 instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 1194 detectMissingValues, defaultValue ));1214 detectMissingValues, defaultValue, buildWorkflowGraph)); 1195 1215 } 1196 1216 else // The data might be passed from the model … … 1198 1218 if (check_if_active.isEmpty()) check_if_active = false; 1199 1219 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 1200 detectMissingValues, defaultValue)); 1220 detectMissingValues, defaultValue, buildWorkflowGraph)); 1221 if (buildWorkflowGraph) 1222 { 1223 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1224 (*CWorkflowGraph::mapFilters_ptr)[instantDataFilter->getFilterId()] = instantDataFilter->GetName(); 1225 } 1201 1226 } 1202 1227 } … … 1214 1239 if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 1215 1240 { 1216 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this ));1241 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, buildWorkflowGraph)); 1217 1242 getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 1243 if (buildWorkflowGraph) 1244 { 1245 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1246 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 1247 int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId(); 1248 int filterIn = fileWriterFilter->getFilterId(); 1249 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterOut); 1250 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterIn); 1251 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = "Temporal filter"; 1252 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = fileWriterFilter->GetName(); 1253 } 1218 1254 } 1219 1255 } … … 1238 1274 CField* fieldRef = CField::get(field_ref); 1239 1275 fieldRef->buildFilterGraph(gc, false); 1276 bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1240 1277 1241 1278 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; … … 1245 1282 bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1246 1283 double defaultValue = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1247 filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue );1284 filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue, buildWorkflowGraph); 1248 1285 } 1249 1286 else 1250 filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 1287 { 1288 filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc, buildWorkflowGraph)); 1289 } 1251 1290 1252 1291 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 1253 1292 1293 if (buildWorkflowGraph) 1294 { 1295 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1296 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 1297 int filterOut = fieldRef->instantDataFilter->getFilterId(); 1298 int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId(); 1299 (*CWorkflowGraph::mapFieldToFilters_ptr)[fieldRef->getId()].push_back(filterOut); 1300 (*CWorkflowGraph::mapFieldToFilters_ptr)[fieldRef->getId()].push_back(filterIn); 1301 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = fieldRef->getInstantDataFilter()->GetName(); 1302 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = filters.first->GetName(); 1303 } 1254 1304 return filters.second; 1255 1305 } … … 1324 1374 { 1325 1375 std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 1376 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1326 1377 1327 1378 if (it == temporalDataFilters.end()) … … 1334 1385 1335 1386 const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 1336 std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 1337 CContext::getCurrent()->getCalendar()->getInitDate(),1338 freq_op, freq_offset, outFreq, detectMissingValues));1387 std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, CContext::getCurrent()->getCalendar()->getInitDate(), 1388 freq_op, freq_offset, outFreq, 1389 detectMissingValues, buildWorkflowGraph)); 1339 1390 1340 1391 instantDataFilter->connectOutput(temporalFilter, 0); 1392 1393 if (buildWorkflowGraph) 1394 { 1395 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1396 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 1397 int filterOut = instantDataFilter->getFilterId(); 1398 int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 1399 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterOut); 1400 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterIn); 1401 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = getInstantDataFilter()->GetName(); 1402 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = temporalFilter->GetName(); 1403 } 1341 1404 1342 1405 it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; … … 1374 1437 1375 1438 const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 1439 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1376 1440 std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 1377 CContext::getCurrent()->getCalendar()->getInitDate(), 1378 freq_op, freq_offset, outFreq, detectMissingValues)); 1441 CContext::getCurrent()->getCalendar()->getInitDate(), 1442 freq_op, freq_offset, outFreq, 1443 detectMissingValues, buildWorkflowGraph)); 1379 1444 1380 1445 selfReferenceFilter->connectOutput(temporalFilter, 0); 1446 if (buildWorkflowGraph) 1447 1448 { 1449 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1450 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 1451 int filterOut = selfReferenceFilter->getFilterId(); 1452 int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 1453 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterOut); 1454 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterIn); 1455 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = selfReferenceFilter->GetName(); 1456 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = temporalFilter->GetName(); 1457 } 1458 1381 1459 return temporalFilter ; 1382 1460 } -
XIOS/dev/dev_trunk_omp/src/node/field.hpp
r1646 r1668 7 7 #include "functor.hpp" 8 8 #include "functor_type.hpp" 9 #include "filter.hpp" 9 10 #include "duration.hpp" 10 11 #include "date.hpp"
Note: See TracChangeset
for help on using the changeset viewer.