Changeset 1686
- Timestamp:
- 07/31/19 13:51:01 (6 years ago)
- Location:
- XIOS/dev/dev_olga
- Files:
-
- 4 added
- 92 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/bld.cfg
r1654 r1686 46 46 #bld::target test_remap.exe 47 47 bld::target xios_server.exe 48 bld::target generic_testcase.exe 48 49 #bld::target test_regular.exe 49 50 #bld::target test_xios2_cmip6.exe 50 51 #bld::target test_new_features.exe test_unstruct_complete.exe 51 #bld::target test_remap.exe52 #bld::target test_complete.exe53 #bld::target test_client.exe52 bld::target test_remap.exe 53 bld::target test_complete.exe 54 bld::target test_client.exe 54 55 #bld::target test_unstruct_complete.exe 55 56 #bld::target test_unstructured.exe -
XIOS/dev/dev_olga/inputs/COMPLETE/context_atmosphere.xml
r787 r1686 10 10 <file_definition type="multiple_file" par_access="collective" output_freq="6h" sync_freq="6h" output_level="10" enabled=".TRUE."> 11 11 <file id="output_atmosphere" name="output_atmosphere"> 12 <field field_ref="field_A_atm" />12 <field field_ref="field_A_atm" build_workflow_graph=".TRUE." /> 13 13 </file> 14 14 <file id="output_atmosphere_zoom" name="output_atmosphere_zoom"> 15 <field field_ref="field_A_atm_zoom" name="field_A_atm_zoom" />15 <field field_ref="field_A_atm_zoom" name="field_A_atm_zoom" build_workflow_graph=".TRUE."/> 16 16 </file> 17 17 </file_definition> -
XIOS/dev/dev_olga/inputs/COMPLETE/context_surface.xml
r1173 r1686 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=".FALSE."/> 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 --> … … 28 28 <field field_ref="field_A_srf" name="field_A_srf_max" operation="maximum" /> 29 29 <field field_ref="field_A_srf" name="field_A_srf_prec4" prec="8" /> 30 <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" long_name="Average of hourly maximum over 6h" operation="average" freq_op="1h"> @field_A_srf_max </field>30 <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" build_workflow_graph=".FALSE." long_name="Average of hourly maximum over 6h" operation="average" freq_op="1h"> @field_A_srf_max </field> 31 31 <variable id="my_global_attribute" type="string">file_6h</variable> 32 32 </file> 33 33 34 <file type="one_file" id="output_surface_1d" name="output_surface_1d" output_freq="1d" enabled=" TRUE">34 <file type="one_file" id="output_surface_1d" name="output_surface_1d" output_freq="1d" enabled="FALSE"> 35 35 <field field_ref="field_A_srf" indexed_output="TRUE"> 36 36 <variable id="my_attribute1" type="string">surf_att</variable> … … 43 43 <field field_ref="field_A_srf" name="field_A_srf_max" operation="maximum" /> 44 44 <field field_ref="field_A_srf" name="field_A_srf_prec4" prec="8" /> 45 <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" long_name="Average of hourly maximum over 1d" operation="average" freq_op="1h"> @field_A_srf_max </field>45 <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" build_workflow_graph=".TRUE." long_name="Average of hourly maximum over 1d" operation="average" freq_op="1h"> @field_A_srf_max </field> 46 46 <variable id="my_global_attribute" type="string" >file_1d</variable> 47 47 </file> -
XIOS/dev/dev_olga/inputs/REMAP/iodef.xml
r1136 r1686 34 34 <file_group id="write_files" > 35 35 <file id="output_2D" name="output_2D" > 36 <field field_ref="src_field_2D" name="field_src" />37 <field field_ref="src_field_2D" name="field_dst_regular_0" domain_ref="dst_domain_regular_pole" default_value="10.e+5" />38 <field field_ref="dst_field_2D" name="field_dst_regular_1" />39 <field field_ref="dst_field_2D_regular_pole" name="field_dst_regular_2" />40 <field field_ref="dst_field_2D_clone" name="field_dst_regular_3" />36 <field field_ref="src_field_2D" name="field_src" build_workflow_graph=".TRUE." /> 37 <field field_ref="src_field_2D" name="field_dst_regular_0" domain_ref="dst_domain_regular_pole" default_value="10.e+5" build_workflow_graph=".TRUE."/> 38 <field field_ref="dst_field_2D" name="field_dst_regular_1" build_workflow_graph=".TRUE."/> 39 <field field_ref="dst_field_2D_regular_pole" name="field_dst_regular_2" build_workflow_graph=".TRUE."/> 40 <field field_ref="dst_field_2D_clone" name="field_dst_regular_3" build_workflow_graph=".TRUE."/> 41 41 </file> 42 42 <file id="output_3D" name="output_3D" > -
XIOS/dev/dev_olga/inputs/iodef.xml
r1202 r1686 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_olga/src/attribute.hpp
r1612 r1686 42 42 virtual void fromString(const StdString & str) = 0; 43 43 virtual StdString dump(void) const = 0; 44 virtual StdString dump4graph(void) const = 0; 44 45 virtual bool isEqual(const CAttribute& ) = 0; 45 46 -
XIOS/dev/dev_olga/src/attribute_array.hpp
r1612 r1686 56 56 virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } 57 57 virtual string dump(void) const { return _dump();} 58 virtual string dump4graph(void) const { return _dump4graph();} 58 59 59 60 virtual void generateCInterface(ostream& oss,const string& className) ; … … 71 72 StdString _toString(void) const; 72 73 StdString _dump(void) const; 74 StdString _dump4graph(void) const; 73 75 void _fromString(const StdString & str); 74 76 bool _toBuffer (CBufferOut& buffer) const; -
XIOS/dev/dev_olga/src/attribute_array_impl.hpp
r1612 r1686 138 138 } 139 139 140 template <typename T_numtype, int N_rank> 141 StdString CAttributeArray<T_numtype,N_rank>::_dump4graph(void) const 142 { 143 StdOStringStream oss; 144 if (! isEmpty() && this->hasId() && (this->numElements()!=0)) 145 oss << this->getName() << "=" << CArray<T_numtype, N_rank>::dump() << ""; 146 return (oss.str()); 147 } 148 140 149 141 150 template <typename T_numtype, int N_rank> -
XIOS/dev/dev_olga/src/attribute_enum.hpp
r1612 r1686 63 63 virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;} else _fromString(str);} 64 64 virtual StdString dump(void) const { return _toString();} 65 virtual StdString dump4graph(void) const { return _dump4graph();} 65 66 66 67 virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} … … 79 80 bool isEqual_(const CAttributeEnum& attr ); 80 81 StdString _toString(void) const; 82 StdString _dump4graph(void) const; 81 83 void _fromString(const StdString & str); 82 84 bool _toBuffer (CBufferOut& buffer) const; -
XIOS/dev/dev_olga/src/attribute_enum_impl.hpp
r1219 r1686 149 149 } 150 150 151 template <class T> 152 StdString CAttributeEnum<T>::_dump4graph(void) const 153 { 154 StdOStringStream oss; 155 if (!CEnum<T>::isEmpty() && this->hasId()) 156 oss << this->getName() << "=" << CEnum<T>::toString() << "</br>"; 157 return (oss.str()); 158 } 159 151 160 template <class T> 152 161 void CAttributeEnum<T>::_fromString(const StdString & str) -
XIOS/dev/dev_olga/src/attribute_map.cpp
r1612 r1686 48 48 { 49 49 str.append(att.second->dump()); 50 str.append(" "); 51 } 52 else if (str.length() == maxNbChar) 53 { 54 str.append("..."); 55 } 56 } 57 } 58 return str; 59 } 60 61 62 63 StdString CAttributeMap::record4graphXiosAttributes(void) const 64 { 65 int maxNbChar = 250; 66 StdString str; 67 typedef std::pair<StdString, CAttribute*> StdStrAttPair; 68 auto it = SuperClassMap::begin(), end = SuperClassMap::end(); 69 for (; it != end; it++) 70 { 71 const StdStrAttPair& att = *it; 72 if (!att.second->isEmpty()) 73 { 74 if (str.length() < maxNbChar) 75 { 76 str.append(att.second->dump4graph()); 50 77 str.append(" "); 51 78 } -
XIOS/dev/dev_olga/src/attribute_map.hpp
r1612 r1686 39 39 void clearAllAttributes(void); 40 40 StdString dumpXiosAttributes(void) const; 41 StdString record4graphXiosAttributes(void) const; 41 42 42 43 void clearAttribute(const StdString& key); -
XIOS/dev/dev_olga/src/attribute_template.hpp
r1612 r1686 75 75 // virtual void fromBinary(StdIStream & is); 76 76 virtual StdString dump(void) const { return _dump();} 77 virtual StdString dump4graph(void) const { return _dump4graph();} 77 78 78 79 virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} … … 100 101 StdString _toString(void) const; 101 102 StdString _dump(void) const; 103 StdString _dump4graph(void) const; 102 104 void _fromString(const StdString & str); 103 105 bool _toBuffer (CBufferOut& buffer) const; -
XIOS/dev/dev_olga/src/attribute_template_impl.hpp
r1612 r1686 208 208 if (!CType<T>::isEmpty() && this->hasId()) 209 209 oss << this->getName() << "=\"" << CType<T>::dump() << "\""; 210 return (oss.str()); 211 } 212 213 template <class T> 214 StdString CAttributeTemplate<T>::_dump4graph(void) const 215 { 216 StdOStringStream oss; 217 if (!CType<T>::isEmpty() && this->hasId()) 218 oss << this->getName() << "=" << CType<T>::dump() << "</br>"; 210 219 return (oss.str()); 211 220 } -
XIOS/dev/dev_olga/src/config/field_attribute.conf
r1653 r1686 19 19 DECLARE_ATTRIBUTE(bool, indexed_output) 20 20 DECLARE_ATTRIBUTE(bool, check_if_active) 21 DECLARE_ATTRIBUTE(bool, build_workflow_graph)22 21 23 22 DECLARE_ATTRIBUTE(StdString, domain_ref, false) … … 41 40 DECLARE_ATTRIBUTE(StdString, cell_methods) 42 41 DECLARE_ENUM4(cell_methods_mode, overwrite, prefix, suffix, none) 42 43 44 DECLARE_ATTRIBUTE(bool, build_workflow_graph) 45 DECLARE_ATTRIBUTE(CDuration, build_workflow_graph_start) 46 DECLARE_ATTRIBUTE(CDuration, build_workflow_graph_end) -
XIOS/dev/dev_olga/src/cxios.cpp
r1653 r1686 11 11 #include "memtrack.hpp" 12 12 #include "registry.hpp" 13 13 14 #include "graphviz.hpp" 14 15 … … 136 137 globalRegistry->toFile("xios_registry.bin") ; 137 138 delete globalRegistry ; 138 139 CGraphviz::buildStaticWorkflowGraph(); 139 CGraphviz::buildWorkflowGraphVisjs_with_info(); 140 140 } 141 141 -
XIOS/dev/dev_olga/src/distribution_client.cpp
r1596 r1686 608 608 609 609 } // namespace xios 610 -
XIOS/dev/dev_olga/src/filter/binary_arithmetic_filter.cpp
r804 r1686 1 1 #include "binary_arithmetic_filter.hpp" 2 #include "workflow_graph.hpp" 3 #include "yacc_var.hpp" 4 #include "file.hpp" 5 2 6 3 7 namespace xios … … 7 11 , op(operatorExpr.getOpScalarField(op)) 8 12 , value(value) 9 { /* Nothing to do */ }; 13 { 14 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 15 }; 16 17 std::tuple<int, int, int> CScalarFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 18 { 19 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 20 // bool building_graph = true; 21 int unique_filter_id; 22 bool firstround; 23 24 if(building_graph) 25 { 26 CWorkflowGraph::allocNodeEdge(); 27 28 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 29 30 // first round 31 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 32 { 33 firstround = true; 34 this->filterID = InvalidableObject::filterIdGenerator++; 35 int edgeID = InvalidableObject::edgeIdGenerator++; 36 37 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 38 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 39 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 40 41 42 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 43 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 44 45 46 if(CWorkflowGraph::build_begin) 47 { 48 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 49 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 50 51 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 52 } 53 else CWorkflowGraph::build_begin = true; 54 55 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 56 unique_filter_id = this->filterID; 57 } 58 // not first round 59 else 60 { 61 firstround=false; 62 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 63 if(data[0]->src_filterID != unique_filter_id) 64 { 65 int edgeID = InvalidableObject::edgeIdGenerator++; 66 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 67 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 68 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 69 } 70 } 71 } 72 73 return std::make_tuple(building_graph, firstround, unique_filter_id); 74 } 75 10 76 11 77 CDataPacketPtr CScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 16 82 packet->status = data[0]->status; 17 83 84 std::tuple<int, int, int> graph = buildGraph(data); 85 86 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 87 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 88 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 89 90 packet->field = this->field; 91 18 92 if (packet->status == CDataPacket::NO_ERROR) 19 93 packet->data.reference(op(value, data[0]->data)); … … 26 100 , op(operatorExpr.getOpFieldScalar(op)) 27 101 , value(value) 28 { /* Nothing to do */ }; 102 { 103 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 104 }; 105 106 std::tuple<int, int, int> CFieldScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 107 { 108 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 109 // bool building_graph = true; 110 int unique_filter_id; 111 bool firstround; 112 113 if(building_graph) 114 { 115 CWorkflowGraph::allocNodeEdge(); 116 117 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 118 119 // first round 120 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 121 { 122 firstround = true; 123 this->filterID = InvalidableObject::filterIdGenerator++; 124 int edgeID = InvalidableObject::edgeIdGenerator++; 125 126 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 127 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 128 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 129 130 131 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 132 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 133 134 135 if(CWorkflowGraph::build_begin) 136 { 137 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 138 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 139 140 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 141 } 142 else CWorkflowGraph::build_begin = true; 143 144 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 145 unique_filter_id = this->filterID; 146 } 147 // not first round 148 else 149 { 150 firstround=false; 151 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 152 if(data[0]->src_filterID != unique_filter_id) 153 { 154 int edgeID = InvalidableObject::edgeIdGenerator++; 155 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 156 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 157 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 158 } 159 } 160 } 161 162 return std::make_tuple(building_graph, firstround, unique_filter_id); 163 } 29 164 30 165 CDataPacketPtr CFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 35 170 packet->status = data[0]->status; 36 171 172 std::tuple<int, int, int> graph = buildGraph(data); 173 174 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 175 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 176 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 177 178 packet->field = this->field; 179 37 180 if (packet->status == CDataPacket::NO_ERROR) 38 181 packet->data.reference(op(data[0]->data, value)); … … 44 187 : CFilter(gc, 2, this) 45 188 , op(operatorExpr.getOpFieldField(op)) 46 { /* Nothing to do */ }; 189 { 190 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 191 }; 192 193 std::tuple<int, int, int> CFieldFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 194 { 195 bool building_graph = this->tag ? ((data[0]->timestamp >= this->field->field_graph_start && data[0]->timestamp <= this->field->field_graph_end) && (data[0]->timestamp == data[1]->timestamp)) : false; 196 197 int unique_filter_id; 198 199 bool firstround; 200 201 if(building_graph) 202 { 203 CWorkflowGraph::allocNodeEdge(); 204 205 // std::cout<<"CFieldFieldArithmeticFilter::apply filter tag = "<<this->tag<<std::endl; 206 207 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 208 209 // first round 210 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 211 { 212 firstround = true; 213 this->filterID = InvalidableObject::filterIdGenerator++; 214 int edgeID = InvalidableObject::edgeIdGenerator++; 215 216 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 217 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 218 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 219 220 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 221 222 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 223 if(CWorkflowGraph::build_begin) 224 { 225 226 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 227 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 228 229 edgeID = InvalidableObject::edgeIdGenerator++; 230 231 CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 232 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 233 234 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 235 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 236 } 237 CWorkflowGraph::build_begin = true; 238 239 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 240 unique_filter_id = this->filterID; 241 242 } 243 // not first round 244 else 245 { 246 firstround = false; 247 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 248 if(data[0]->src_filterID != unique_filter_id) 249 { 250 int edgeID = InvalidableObject::edgeIdGenerator++; 251 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 252 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 253 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 254 } 255 if(data[1]->src_filterID != unique_filter_id) 256 { 257 int edgeID = InvalidableObject::edgeIdGenerator++; 258 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); 259 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 260 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 261 } 262 263 } 264 } 265 266 return std::make_tuple(building_graph, firstround, unique_filter_id); 267 } 47 268 48 269 CDataPacketPtr CFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 51 272 packet->date = data[0]->date; 52 273 packet->timestamp = data[0]->timestamp; 274 275 std::tuple<int, int, int> graph = buildGraph(data); 276 277 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 278 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 279 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 280 281 packet->field = this->field; 282 53 283 54 284 if (data[0]->status != CDataPacket::NO_ERROR) … … 64 294 return packet; 65 295 } 296 297 StdString CScalarFieldArithmeticFilter::GetName(void) { return StdString("CScalarFieldArithmeticFilter"); } 298 StdString CFieldScalarArithmeticFilter::GetName(void) { return StdString("CFieldScalarArithmeticFilter"); } 299 StdString CFieldFieldArithmeticFilter::GetName(void) { return StdString("CFieldFieldArithmeticFilter"); } 300 301 66 302 } // namespace xios -
XIOS/dev/dev_olga/src/filter/binary_arithmetic_filter.hpp
r1542 r1686 6 6 #include "operator_expr.hpp" 7 7 #include <unordered_map> 8 #include <tuple> 8 9 9 10 namespace xios … … 23 24 */ 24 25 CScalarFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); 26 StdString virtual GetName(void); 27 25 28 26 29 protected: … … 35 38 */ 36 39 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 40 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 41 42 37 43 }; // class CScalarFieldArithmeticFilter 38 44 … … 51 57 */ 52 58 CFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); 59 StdString virtual GetName(void); 60 53 61 54 62 protected: … … 63 71 */ 64 72 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 73 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 65 74 }; // class CFieldScalarArithmeticFilter 66 75 … … 78 87 */ 79 88 CFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op); 89 StdString virtual GetName(void); 90 80 91 81 92 protected: … … 89 100 */ 90 101 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 102 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 91 103 }; // class CFieldFieldArithmeticFilter 92 104 } // namespace xios -
XIOS/dev/dev_olga/src/filter/data_packet.hpp
r1542 r1686 9 9 namespace xios 10 10 { 11 class CField; 11 12 /*! 12 13 * A packet corresponds to a timestamped array of data. … … 26 27 Time timestamp; //!< Timestamp of the data 27 28 StatusCode status; //!< Status of the packet 28 29 int src_filterID; 30 std::vector<int> filterIDoutputs; 31 CField *field; 32 int distance; 33 29 34 /*! 30 35 * Creates a deep copy of the packet. -
XIOS/dev/dev_olga/src/filter/file_server_writer_filter.cpp
r1654 r1686 16 16 void CFileServerWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) 17 17 { 18 field->writeUpdateData(data[0]->data); 18 field->writeUpdateData(data[0]->data); 19 19 } 20 20 … … 28 28 return true; 29 29 } 30 31 int CFileServerWriterFilter::getFilterId(void)32 {33 return filterId;34 }35 36 30 } // namespace xios -
XIOS/dev/dev_olga/src/filter/file_server_writer_filter.hpp
r1653 r1686 37 37 bool virtual isDataExpected(const CDate& date) const; 38 38 39 /*!40 * Returns filter's id needed in case of building workflow graph41 */42 int getFilterId();43 44 39 protected: 45 40 /*! … … 51 46 52 47 private: 53 CField* field; 48 CField* field; //<! The associated field 54 49 std::map<Time, CDataPacketPtr> packets; //<! The stored packets 55 int filterId; //<! Filter's id needed in case of building a workflow56 57 50 }; // class CFileServerWriterFilter 58 51 } // namespace xios -
XIOS/dev/dev_olga/src/filter/file_writer_filter.cpp
r1654 r1686 4 4 #include "utils.hpp" 5 5 #include "workflow_graph.hpp" 6 #include "graphviz.hpp" 6 7 7 8 namespace xios 8 9 { 9 CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field , bool buildWorkflowGraph /* =false */)10 CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field) 10 11 : CInputPin(gc, 1) 11 12 , field(field) … … 14 15 ERROR("CFileWriterFilter::CFileWriterFilter(CField* field)", 15 16 "The field cannot be null."); 16 if (buildWorkflowGraph) 17 } 18 19 void CFileWriterFilter::buildGraph(std::vector<CDataPacketPtr> data) 20 { 21 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph: false; 22 23 if(building_graph) 17 24 { 18 filterId = InvalidableObject::count; 19 InvalidableObject::count++; 25 this->filterID = InvalidableObject::filterIdGenerator++; 26 int edgeID = InvalidableObject::edgeIdGenerator++; 27 28 CWorkflowGraph::allocNodeEdge(); 29 StdString namestring = to_string(this->field->name); 30 namestring.erase(0, 6); 31 namestring.erase(namestring.length()-1, 1); 32 33 CWorkflowGraph::addNode(this->filterID, namestring + "\\n("+this->field->file->getId()+".nc)", 6, 0, 1, data[0]); 34 35 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 36 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 37 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].clusterID =1; 38 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = ++(data[0]->distance); 39 40 if(CXios::isClient && CWorkflowGraph::build_begin) 41 { 42 43 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 44 45 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 46 } 47 else CWorkflowGraph::build_begin=true; 20 48 } 21 49 } … … 23 51 void CFileWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) 24 52 { 53 buildGraph(data); 54 25 55 const bool detectMissingValue = ( !field->default_value.isEmpty() && 26 56 ( (!field->detect_missing_value.isEmpty() || field->detect_missing_value == true) … … 41 71 42 72 field->sendUpdateData(dataArray); 43 44 73 } 45 74 … … 53 82 return true; 54 83 } 55 56 int CFileWriterFilter::getFilterId(void)57 {58 return filterId;59 }60 61 84 } // namespace xios -
XIOS/dev/dev_olga/src/filter/file_writer_filter.hpp
r1654 r1686 3 3 4 4 #include "input_pin.hpp" 5 #include "file.hpp" 6 #include "duration.hpp" 5 7 6 8 namespace xios … … 14 16 { 15 17 public: 18 int tag; 19 Time start_graph; 20 Time end_graph; 21 CField* field; //<! The associated field 22 int filterID; 23 int distance; 24 16 25 /*! 17 26 * Constructs the filter (with one input slot) associated to the specified field … … 20 29 * \param gc the associated garbage collector 21 30 * \param field the associated field 22 * \param[in] buildWorkflowGraph indicates whether the workflow will be visualized23 31 */ 24 CFileWriterFilter(CGarbageCollector& gc, CField* field , bool buildWorkflowGraph = false);32 CFileWriterFilter(CGarbageCollector& gc, CField* field); 25 33 26 inline StdString GetName(void) {return StdString("File writer filter");}; 34 inline StdString GetName(void) {return "File writer filter";}; 35 27 36 28 37 /*! … … 40 49 bool virtual isDataExpected(const CDate& date) const; 41 50 42 /*!43 * Returns filter's id needed in case of building workflow graph44 */45 int getFilterId();46 47 51 protected: 48 52 /*! … … 52 56 */ 53 57 void virtual onInputReady(std::vector<CDataPacketPtr> data); 58 void virtual buildGraph(std::vector<CDataPacketPtr> data); 54 59 55 60 private: 56 CField* field; //<! The associated field57 61 std::map<Time, CDataPacketPtr> packets; //<! The stored packets 58 int filterId; //<! Filter's id needed in case of building a workflow59 60 62 }; // class CFileWriterFilter 61 63 } // namespace xios -
XIOS/dev/dev_olga/src/filter/filter.cpp
r1653 r1686 3 3 namespace xios 4 4 { 5 CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine , bool buildWorkflowGraph /*= false*/)5 CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine) 6 6 : CInputPin(gc, inputSlotsCount) 7 , COutputPin(gc, false , buildWorkflowGraph)7 , COutputPin(gc, false) 8 8 , engine(engine) 9 9 , inputSlotCount(inputSlotCount) -
XIOS/dev/dev_olga/src/filter/filter.hpp
r1653 r1686 23 23 * \param inputSlotsCount the number of input slots 24 24 * \param engine the filter engine 25 * \param buildWorkflowGraph indicates whether data will be visualized26 25 */ 27 CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine , bool buildWorkflowGraph = false);26 CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 28 27 29 28 StdString virtual GetName(void); … … 65 64 bool virtual isDataExpected(const CDate& date) const; 66 65 66 67 68 69 int filterID; 70 StdString expression; 71 67 72 protected: 68 73 IFilterEngine* engine; //!< The filter engine, might be the filter itself -
XIOS/dev/dev_olga/src/filter/garbage_collector.cpp
r1653 r1686 3 3 namespace xios 4 4 { 5 int InvalidableObject::filterIdGenerator = 0; 5 6 6 int InvalidableObject::count = 0; 7 int InvalidableObject::edgeIdGenerator = 0; 8 9 int InvalidableObject::clusterIdGenerator = 0; 7 10 8 11 void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) -
XIOS/dev/dev_olga/src/filter/garbage_collector.hpp
r1653 r1686 21 21 void virtual invalidate(Time timestamp) = 0; 22 22 23 static int count; //!< Counter used to identify a filter in case building workflow graph 23 24 25 static int filterIdGenerator; 26 27 static int edgeIdGenerator; 28 29 static int clusterIdGenerator; 30 31 24 32 25 33 }; // struct InvalidableObject -
XIOS/dev/dev_olga/src/filter/input_pin.cpp
r1653 r1686 12 12 , triggers(slotsCount) 13 13 , hasTriggers(false) 14 { 14 { } 15 15 16 16 StdString CInputPin::GetName(void) … … 83 83 inputs.erase(inputs.begin(), inputs.lower_bound(timestamp)); 84 84 } 85 86 int CInputPin::getFilterId(void)87 {88 return -1;89 }90 91 85 } // namespace xios -
XIOS/dev/dev_olga/src/filter/input_pin.hpp
r1654 r1686 81 81 */ 82 82 void virtual invalidate(Time timestamp); 83 84 /*!85 * Returns filter's id needed in case of building workflow graph86 * This function should never be called from this class, instead functions defined in derived classes or in class COutputPin should be used87 */88 int virtual getFilterId();89 83 90 84 protected: … … 130 124 //! Whether some triggers have been set 131 125 bool hasTriggers; 132 133 126 }; // class CInputPin 134 127 } // namespace xios -
XIOS/dev/dev_olga/src/filter/output_pin.cpp
r1654 r1686 5 5 namespace xios 6 6 { 7 COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/ , bool buildWorkflowGraph /* =false */)7 COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/) 8 8 : gc(gc) 9 9 , manualTrigger(manualTrigger) 10 , buildWorkflowGraph(buildWorkflowGraph) 11 { 12 if (buildWorkflowGraph) 13 { 14 filterId = InvalidableObject::count; 15 InvalidableObject::count++; 16 } 17 } 10 { } 18 11 19 12 StdString COutputPin::GetName(void) … … 40 33 "The packet cannot be null."); 41 34 42 if (buildWorkflowGraph)43 {44 CWorkflowGraph::mapFilterTimestamps[this->getFilterId()].push_back(packet->timestamp);45 CWorkflowGraph::timestamps.insert(packet->timestamp);46 }47 48 35 if (manualTrigger) // Don't use canBeTriggered here, this function is virtual and can be overriden 49 36 { … … 52 39 } 53 40 else 54 {55 41 deliverOuput(packet); 56 }57 42 } 58 43 … … 123 108 } 124 109 125 int COutputPin::getFilterId(void)110 void COutputPin::setParentFiltersTag() 126 111 { 127 return filterId; 112 for(int i=0; i<parent_filters.size(); i++) 113 { 114 115 if(parent_filters[i]->start_graph<0) parent_filters[i]->start_graph = start_graph; 116 else parent_filters[i]->start_graph = min(parent_filters[i]->start_graph, start_graph); 117 118 119 if(parent_filters[i]->end_graph<0) parent_filters[i]->end_graph = end_graph; 120 else parent_filters[i]->end_graph = max(parent_filters[i]->end_graph, end_graph); 121 122 123 parent_filters[i]->tag += tag; 124 parent_filters[i]->setParentFiltersTag(); 125 } 128 126 } 129 127 128 129 130 130 131 } // namespace xios -
XIOS/dev/dev_olga/src/filter/output_pin.hpp
r1654 r1686 4 4 #include "garbage_collector.hpp" 5 5 #include "input_pin.hpp" 6 #include "duration.hpp" 6 7 7 8 namespace xios 8 9 { 10 class CField; 11 class CInputPin; 12 class CFilter; 13 class CDuration; 9 14 /*! 10 15 * An output pin handles the connections with downstream filters. … … 13 18 { 14 19 public: 20 int tag; 21 Time start_graph; 22 Time end_graph; 23 CField *field; 24 int distance; 25 26 27 28 std::vector< std::shared_ptr<COutputPin> > parent_filters; 29 15 30 /*! 16 31 * Constructs an ouput pin with manual or automatic trigger … … 19 34 * \param gc the garbage collector associated with this ouput pin 20 35 * \param slotsCount the number of slots 21 * \param buildWorkflowGraph indicates whether data will be visualized22 36 */ 23 COutputPin(CGarbageCollector& gc, bool manualTrigger = false , bool buildWorkflowGraph = false);37 COutputPin(CGarbageCollector& gc, bool manualTrigger = false); 24 38 25 39 StdString virtual GetName(void); … … 69 83 void virtual invalidate(Time timestamp); 70 84 71 /*! 72 * Returns filter's id needed in case of building workflow graph 73 */ 74 int getFilterId(); 85 void virtual setParentFiltersTag(); 86 75 87 76 88 protected: … … 97 109 CGarbageCollector& gc; //!< The garbage collector associated to the output pin 98 110 99 //! Whether the ouput should be triggered manually111 //!< Whether the ouput should be triggered manually 100 112 bool manualTrigger; 101 113 102 //! The list of connected filters and the corresponding slot numbers114 //!< The list of connected filters and the corresponding slot numbers 103 115 std::vector<std::pair<std::shared_ptr<CInputPin>, size_t> > outputs; 104 116 105 117 //! Output buffer, store the packets until the output is triggered 106 118 std::map<Time, CDataPacketPtr> outputPackets; 107 108 //! Indicates whether the workflow will be visualized109 bool buildWorkflowGraph;110 111 //! Filter's id needed in case of building a workflow graph112 int filterId;113 114 115 119 }; // class COutputPin 116 120 } // namespace xios -
XIOS/dev/dev_olga/src/filter/pass_through_filter.cpp
r1653 r1686 1 1 #include "pass_through_filter.hpp" 2 #include "workflow_graph.hpp" 3 #include "field.hpp" 4 #include "file.hpp" 2 5 3 6 namespace xios 4 7 { 5 CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc, bool buildWorkflowGraph /*= false*/) 6 : CFilter(gc, 1, this, buildWorkflowGraph) 7 { /* Nothing to do */ } 8 CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) 9 : CFilter(gc, 1, this) 10 { 11 } 12 13 void CPassThroughFilter::buildGraph(std::vector<CDataPacketPtr> data) 14 { 15 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 16 // bool building_graph = this->tag ? data[0]->timestamp >= this->field->field_graph_start && data[0]->timestamp <= this->field->field_graph_end : false; 17 18 if(building_graph) 19 { 20 // std::cout<<"CPassThroughFilter::apply field_id = "<<this->field->getId()<<" start = "<<start_graph<<" end = "<<end_graph<<std::endl; 21 this->filterID = InvalidableObject::filterIdGenerator++; 22 int edgeID = InvalidableObject::edgeIdGenerator++; 23 24 CWorkflowGraph::allocNodeEdge(); 25 26 CWorkflowGraph::addNode(this->filterID, "Pass Through Filter\\n("+data[0]->field->getId()+")", 2, 1, 1, data[0]); 27 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = ++(data[0]->distance); 28 29 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 30 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 31 32 33 if(CWorkflowGraph::build_begin) 34 { 35 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 36 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; 37 } 38 else CWorkflowGraph::build_begin = true; 39 40 data[0]->src_filterID=this->filterID; 41 42 } 43 44 data[0]->field = this->field; 45 } 8 46 9 47 CDataPacketPtr CPassThroughFilter::apply(std::vector<CDataPacketPtr> data) 10 48 { 49 if(CXios::isClient) buildGraph(data); 11 50 return data[0]; 12 51 } -
XIOS/dev/dev_olga/src/filter/pass_through_filter.hpp
r1653 r1686 17 17 * 18 18 * \param gc the associated garbage collector 19 * \param buildWorkflowGraph indicates whether data will be visualized20 19 */ 21 CPassThroughFilter(CGarbageCollector& gc , bool buildWorkflowGraph = false);20 CPassThroughFilter(CGarbageCollector& gc); 22 21 23 22 inline StdString GetName(void) {return StdString("Pass through filter");}; … … 31 30 */ 32 31 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 32 void virtual buildGraph(std::vector<CDataPacketPtr> data); 33 33 }; // class CPassThroughFilter 34 34 } // namespace xios -
XIOS/dev/dev_olga/src/filter/source_filter.cpp
r1654 r1686 12 12 const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 13 13 bool hasMissingValue /*= false*/, 14 double defaultValue /*= 0.0*/, 15 bool buildWorkflowGraph /*= false*/) 16 : COutputPin(gc, manualTrigger, buildWorkflowGraph) 14 double defaultValue /*= 0.0*/) 15 : COutputPin(gc, manualTrigger) 17 16 , grid(grid) 18 17 , compression(compression) … … 25 24 "Impossible to construct a source filter without providing a grid."); 26 25 } 27 26 27 void CSourceFilter::buildGraph(CDataPacketPtr packet) 28 { 29 bool building_graph = this->tag ? packet->timestamp >= this->field->field_graph_start && packet->timestamp <= this->field->field_graph_end : false; 30 31 if(building_graph) 32 { 33 this->filterID = InvalidableObject::filterIdGenerator++; 34 packet->src_filterID=this->filterID; 35 packet->field = this->field; 36 packet->distance = 1; 37 38 39 CWorkflowGraph::allocNodeEdge(); 40 41 CWorkflowGraph::addNode(this->filterID, "Source Filter ", 1, 1, 0, packet); 42 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 43 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].field_id = this->field->getId(); 44 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = 1; 45 46 CWorkflowGraph::build_begin = true; 47 } 48 49 } 50 51 28 52 template <int N> 29 53 void CSourceFilter::streamData(CDate date, const CArray<double, N>& data) … … 61 85 } 62 86 } 87 88 if(CXios::isClient) buildGraph(packet); 89 90 63 91 64 92 onOutputReady(packet); -
XIOS/dev/dev_olga/src/filter/source_filter.hpp
r1654 r1686 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 visualized30 29 */ 31 30 CSourceFilter(CGarbageCollector& gc, CGrid* grid, … … 34 33 const CDuration offset = NoneDu, bool manualTrigger = false, 35 34 bool hasMissingValue = false, 36 double defaultValue = 0.0, 37 bool buildWorkflowGraph = false); 35 double defaultValue = 0.0); 38 36 39 37 inline StdString GetName(void) {return StdString("Source filter");}; … … 49 47 template <int N> 50 48 void streamData(CDate date, const CArray<double, N>& data); 49 50 void virtual buildGraph(CDataPacketPtr packet); 51 51 52 52 /*! … … 66 66 */ 67 67 void signalEndOfStream(CDate date); 68 int filterID; 68 69 69 70 private: … … 74 75 const bool compression ; //!< indicates if data need to be compressed : on client side : true, on server side : false 75 76 const bool mask ; //!< indicates whether grid mask should be applied (true for clients, false for servers) 76 77 77 }; // class CSourceFilter 78 78 } // namespace xios -
XIOS/dev/dev_olga/src/filter/spatial_transform_filter.cpp
r1653 r1686 5 5 #include "timer.hpp" 6 6 #include "workflow_graph.hpp" 7 #include "file.hpp" 7 8 8 9 namespace xios 9 10 { 10 CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 11 double outputValue, size_t inputSlotsCount, bool buildWorkflowGraph /*= false*/) 12 : CFilter(gc, inputSlotsCount, engine, buildWorkflowGraph), outputDefaultValue(outputValue) 11 CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount) 12 : CFilter(gc, inputSlotsCount, engine), outputDefaultValue(outputValue) 13 13 { /* Nothing to do */ } 14 14 15 15 std::pair<std::shared_ptr<CSpatialTransformFilter>, std::shared_ptr<CSpatialTransformFilter> > 16 CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double missingValue, 17 bool buildWorkflowGraph) 16 CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double missingValue) 18 17 { 19 18 if (!srcGrid || !destGrid) … … 32 31 double defaultValue = (hasMissingValue) ? std::numeric_limits<double>::quiet_NaN() : 0.0; 33 32 33 34 34 const CGridTransformationSelector::ListAlgoType& algoList = gridTransformation->getAlgoList() ; 35 35 CGridTransformationSelector::ListAlgoType::const_iterator it ; … … 39 39 40 40 std::shared_ptr<CSpatialTransformFilter> filter ; 41 if( isSpatialTemporal) 42 filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTemporalFilter(gc, engine, gridTransformation, defaultValue, inputCount, buildWorkflowGraph)); 43 else 44 filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount, buildWorkflowGraph)); 45 41 if( isSpatialTemporal) filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTemporalFilter(gc, engine, gridTransformation, defaultValue, inputCount)); 42 else filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount)); 43 44 46 45 if (!lastFilter) 47 46 lastFilter = filter; 48 47 else 49 {50 48 filter->connectOutput(firstFilter, 0); 51 if (buildWorkflowGraph)52 {53 int filterOut = (std::static_pointer_cast<COutputPin>(filter))->getFilterId();54 int filterIn = (std::static_pointer_cast<COutputPin>(firstFilter))->getFilterId();55 // PASS field's id here56 CWorkflowGraph::mapFieldToFilters["XXX"].push_back(filterOut);57 CWorkflowGraph::mapFieldToFilters["XXX"].push_back(filterIn);58 CWorkflowGraph::mapFilters[filterOut] = "Spatial transform filter";59 CWorkflowGraph::mapFilters[filterIn] = "Spatial transform filter";60 }61 }62 49 63 50 firstFilter = filter; … … 79 66 { 80 67 CSpatialTransformFilterEngine* spaceFilter = static_cast<CSpatialTransformFilterEngine*>(engine); 81 CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue );68 CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue, this->tag, this->start_graph, this->end_graph, this->field); 82 69 if (outputPacket) 83 70 onOutputReady(outputPacket); 84 71 } 85 72 86 CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 87 CGridTransformation* gridTransformation, double outputValue, 88 size_t inputSlotsCount, bool buildWorkflowGraph) 89 : CSpatialTransformFilter(gc, engine, outputValue, inputSlotsCount, buildWorkflowGraph), record(0) 73 CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount) 74 : CSpatialTransformFilter(gc, engine, outputValue, inputSlotsCount), record(0) 90 75 { 91 76 const CGridTransformationSelector::ListAlgoType& algoList = gridTransformation->getAlgoList() ; … … 113 98 { 114 99 CSpatialTransformFilterEngine* spaceFilter = static_cast<CSpatialTransformFilterEngine*>(engine); 115 CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue );100 CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue, this->tag, this->start_graph, this->end_graph, this->field); 116 101 117 102 if (outputPacket) … … 138 123 packet->data.resize(tmpData.numElements()); 139 124 packet->data = tmpData; 125 packet->field = this->field; 140 126 onOutputReady(packet); 141 127 tmpData.resize(0) ; … … 176 162 } 177 163 178 CDataPacketPtr CSpatialTransformFilterEngine::applyFilter(std::vector<CDataPacketPtr> data, double defaultValue) 179 { 164 bool CSpatialTransformFilterEngine::buildGraph(std::vector<CDataPacketPtr> data, int tag, Time start_graph, Time end_graph, CField *field) 165 { 166 bool building_graph = tag ? data[0]->timestamp >= start_graph && data[0]->timestamp <= end_graph : false; 167 if(building_graph) 168 { 169 this->filterID = InvalidableObject::filterIdGenerator++; 170 int edgeID = InvalidableObject::edgeIdGenerator++; 171 172 CWorkflowGraph::allocNodeEdge(); 173 174 CWorkflowGraph::addNode(this->filterID, "Spatial Transform Filter", 4, 1, 1, data[0]); 175 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 176 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = field->record4graphXiosAttributes(); 177 if(field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +field->file->record4graphXiosAttributes(); 178 179 180 if(CWorkflowGraph::build_begin) 181 { 182 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 183 184 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; 185 } 186 else CWorkflowGraph::build_begin = true; 187 } 188 189 return building_graph; 190 } 191 192 CDataPacketPtr CSpatialTransformFilterEngine::applyFilter(std::vector<CDataPacketPtr> data, double defaultValue, int tag, Time start_graph, Time end_graph, CField *field) 193 { 194 195 bool BG = buildGraph(data, tag, start_graph, end_graph, field); 196 180 197 CDataPacketPtr packet(new CDataPacket); 181 198 packet->date = data[0]->date; … … 194 211 if (0 != packet->data.numElements()) 195 212 (packet->data)(0) = defaultValue; 196 apply(data[0]->data, packet->data); 213 if(BG) apply(data[0]->data, packet->data, this->filterID); 214 else apply(data[0]->data, packet->data); 197 215 } 198 216 … … 200 218 } 201 219 202 void CSpatialTransformFilterEngine::apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest )220 void CSpatialTransformFilterEngine::apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest, int filterID) 203 221 { 204 222 CTimer::get("CSpatialTransformFilterEngine::apply").resume(); … … 313 331 const std::vector<std::pair<int,double> >& localIndex_p = itRecv->second; 314 332 int srcRank = itRecv->first; 333 334 if(filterID >=0) // building_graph 335 { 336 (*CWorkflowGraph::mapFilters_ptr_with_info)[filterID].filter_name = (*itAlgo)->getName(); 337 } 315 338 if (srcRank != rank) 316 339 { -
XIOS/dev/dev_olga/src/filter/spatial_transform_filter.hpp
r1653 r1686 3 3 4 4 #include "filter.hpp" 5 #include "field.hpp" 5 6 6 7 namespace xios … … 9 10 class CGridTransformation; 10 11 class CSpatialTransformFilterEngine; 12 13 class CField; 11 14 12 15 /*! … … 23 26 * \param outputValue default value of output pin 24 27 * \param [in] inputSlotsCount number of input, by default there is only one for field src 25 * \param buildWorkflowGraph indicates whether data will be visualized26 28 */ 27 29 CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 28 double outputValue, size_t inputSlotsCount = 1 , bool buildWorkflowGraph = false);30 double outputValue, size_t inputSlotsCount = 1); 29 31 30 32 inline StdString GetName(void) {return StdString("Spatial transform filter");}; … … 38 40 * \param hasMissingValue whether field source has missing value 39 41 * \param defaultValue default value 40 * \param buildWorkflowGraph indicates whether data will be visualized41 42 * \return the first and the last filters of the filter graph 42 43 */ 43 44 static std::pair<std::shared_ptr<CSpatialTransformFilter>, std::shared_ptr<CSpatialTransformFilter> > 44 buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double defaultValue , bool buildWorkflowGraph = false);45 buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double defaultValue); 45 46 46 47 protected: … … 72 73 * \param outputValue default value of output pin 73 74 * \param [in] inputSlotsCount number of input, by default there is only one for field src 74 * \param buildWorkflowGraph indicates whether data will be visualized75 *76 75 */ 77 CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, 78 double outputValue, size_t inputSlotsCount = 1, bool buildWorkflowGraph = false); 76 CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount = 1); 79 77 80 78 … … 101 99 { 102 100 public: 101 102 int filterID; 103 int tag; 104 CField *field; 103 105 /*! 104 106 * Returns the engine wrapping the specified grid transformation. … … 117 119 * \return the result of the grid transformation 118 120 */ 119 CDataPacketPtr applyFilter(std::vector<CDataPacketPtr> data, double defaultValue = 0); 121 CDataPacketPtr applyFilter(std::vector<CDataPacketPtr> data, double defaultValue = 0, int tag=0, Time start_graph=0, Time end_graph=-1, CField *field=0); 122 bool buildGraph(std::vector<CDataPacketPtr> data, int tag=0, Time start_graph=0, Time end_graph=-1, CField *field=0); 120 123 121 124 /*! … … 144 147 * \param dataDest the resulting transformed data 145 148 */ 146 void apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest );149 void apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest, int filterID=-1); 147 150 148 151 CGridTransformation* gridTransformation; //!< The grid transformation used by the engine -
XIOS/dev/dev_olga/src/filter/store_filter.cpp
r1654 r1686 3 3 #include "grid.hpp" 4 4 #include "timer.hpp" 5 #include "file.hpp" 5 6 6 7 namespace xios … … 21 22 ERROR("CStoreFilter::CStoreFilter(CContext* context, CGrid* grid)", 22 23 "Impossible to construct a store filter without providing a grid."); 23 // filterId = InvalidableObject::count;24 // InvalidableObject::count++;25 24 } 26 25 … … 78 77 template CDataPacket::StatusCode CStoreFilter::getData<7>(Time timestamp, CArray<double, 7>& data); 79 78 79 void CStoreFilter::buildGraph(std::vector<CDataPacketPtr> data) 80 { 81 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 82 83 if(building_graph) 84 { 85 this->filterID = InvalidableObject::filterIdGenerator++; 86 int edgeID = InvalidableObject::edgeIdGenerator++; 87 88 CWorkflowGraph::allocNodeEdge(); 89 90 CWorkflowGraph::addNode(this->filterID, "Store Filter", 7, 0, 1, data[0]); 91 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = ++(data[0]->distance); 92 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 93 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 94 95 // if(CXios::isClient) std::cout<<"CStoreFilter::apply filter tag = "<<this->tag<<std::endl; 96 97 if(CXios::isClient && CWorkflowGraph::build_begin) 98 { 99 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]);; 100 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; 101 } 102 else CWorkflowGraph::build_begin = true; 103 } 104 } 105 80 106 void CStoreFilter::onInputReady(std::vector<CDataPacketPtr> data) 81 107 { 108 buildGraph(data); 82 109 83 110 CDataPacketPtr packet; … … 128 155 packets.erase(packets.begin(), packets.lower_bound(timestamp)); 129 156 } 130 131 int CStoreFilter::getFilterId(void)132 {133 return filterId;134 }135 136 157 } // namespace xios -
XIOS/dev/dev_olga/src/filter/store_filter.hpp
r1653 r1686 3 3 4 4 #include "input_pin.hpp" 5 #include "workflow_graph.hpp" 6 5 7 6 8 namespace xios … … 8 10 class CContext; 9 11 class CGrid; 12 class CField; 10 13 11 14 /*! … … 73 76 void virtual invalidate(Time timestamp); 74 77 75 /*! 76 * Returns filter's id needed in case of building workflow graph 77 */ 78 int getFilterId(); 78 int filterID; 79 int tag; 80 Time start_graph; 81 Time end_graph; 82 CField *field; 83 int distance; 84 79 85 80 86 protected: … … 85 91 */ 86 92 void virtual onInputReady(std::vector<CDataPacketPtr> data); 93 void virtual buildGraph(std::vector<CDataPacketPtr> data); 87 94 88 95 private: 89 CGarbageCollector& gc; 90 CContext* context; 91 CGrid* grid; 92 const bool detectMissingValues; 93 const double missingValue; 96 CGarbageCollector& gc; //!< The garbage collector associated to the filter 97 CContext* context; //!< The context to which the data belongs 98 CGrid* grid; //!< The grid attached to the data the filter can accept 99 const bool detectMissingValues; //!< Whether missing values should be detected 100 const double missingValue; //!< The value to use to replace missing values 94 101 std::map<Time, CDataPacketPtr> packets; //<! The stored packets 95 int filterId; //!< Filter's id needed in case of building a workflow96 97 102 }; // class CStoreFilter 98 103 } // namespace xios -
XIOS/dev/dev_olga/src/filter/temporal_filter.cpp
r1653 r1686 2 2 #include "functor_type.hpp" 3 3 #include "calendar_util.hpp" 4 #include "workflow_graph.hpp" 5 #include "file.hpp" 4 6 5 7 namespace xios … … 9 11 CTemporalFilter::CTemporalFilter(CGarbageCollector& gc, const std::string& opId, 10 12 const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, 11 bool ignoreMissingValue /*= false*/ , bool buildWorkflowGraph /*= false*/)12 : CFilter(gc, 1, this , buildWorkflowGraph)13 bool ignoreMissingValue /*= false*/) 14 : CFilter(gc, 1, this) 13 15 , functor(createFunctor(opId, ignoreMissingValue, tmpData)) 14 16 , isOnceOperation(functor->timeType() == func::CFunctor::once) … … 25 27 , nbOperationDates(1) 26 28 , nbSamplingDates(0) 29 // , nextOperationDate(initDate + opFreq + this->samplingOffset) 27 30 , isFirstOperation(true) 31 , temp_op(opId) 28 32 { 29 33 } 30 34 35 36 37 38 39 bool CTemporalFilter::buildGraph(std::vector<CDataPacketPtr> data) 40 { 41 bool building_graph=this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 42 43 if(building_graph) 44 { 45 if(this->filterIDoutputs.size()==0) this->filterID = InvalidableObject::filterIdGenerator++; 46 int edgeID = InvalidableObject::edgeIdGenerator++; 47 48 // std::cout<<"CTemporalFilter::apply filter tag = "<<this->tag<<" start = "<<this->start_graph<<" end = "<<this->end_graph<<std::endl; 49 50 CWorkflowGraph::allocNodeEdge(); 51 52 if(this->filterIDoutputs.size()==0) 53 { 54 CWorkflowGraph::addNode(this->filterID, "Temporal Filter\\n("+this->temp_op+")", 5, 1, 0, data[0]); 55 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].transform_type = this->temp_op; 56 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].inputs_complete = false ; 57 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].clusterID = 1 ; 58 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = (data[0]->distance); 59 60 61 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 62 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 63 } 64 65 if(CWorkflowGraph::build_begin) 66 { 67 68 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 69 70 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 71 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb += 1 ; 72 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = max(data[0]->distance+1, (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance); 73 } 74 75 76 this->filterIDoutputs.push_back(data[0]->src_filterID); 77 } 78 79 return building_graph; 80 } 81 82 31 83 CDataPacketPtr CTemporalFilter::apply(std::vector<CDataPacketPtr> data) 32 84 { 85 bool BG = buildGraph(data); 86 33 87 CDataPacketPtr packet; 34 88 … … 77 131 78 132 isFirstOperation = false; 133 134 packet->field = this->field; 135 136 if(BG) 137 { 138 packet->src_filterID=this->filterID; 139 packet->distance = data[0]->distance+1; 140 this->filterIDoutputs.clear(); 141 CWorkflowGraph::build_begin=true; 142 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].inputs_complete = true ; 143 } 79 144 } 80 145 } … … 90 155 bool CTemporalFilter::isDataExpected(const CDate& date) const 91 156 { 157 // return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); 92 158 return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 93 159 } -
XIOS/dev/dev_olga/src/filter/temporal_filter.hpp
r1653 r1686 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 , bool buildWorkflowGraph = false);31 bool ignoreMissingValue = false); 32 32 33 33 inline StdString GetName(void) {return StdString("Temporal filter");}; … … 40 40 */ 41 41 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 42 bool virtual buildGraph(std::vector<CDataPacketPtr> data); 42 43 43 44 /*! … … 54 55 */ 55 56 bool virtual isDataExpected(const CDate& date) const; 57 std::vector<int > filterIDoutputs; 58 std::vector<std::pair<int, int> > filterIDoutputs_pair; 59 60 StdString temp_op; 56 61 57 62 private: -
XIOS/dev/dev_olga/src/filter/ternary_arithmetic_filter.cpp
r1162 r1686 1 1 #include "ternary_arithmetic_filter.hpp" 2 #include "workflow_graph.hpp" 3 #include "yacc_var.hpp" 4 #include "file.hpp" 2 5 3 6 namespace xios … … 8 11 , value1(value1) 9 12 , value2(value2) 10 { /* Nothing to do */ }; 13 { 14 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 15 /* Nothing to do */ 16 }; 17 18 std::tuple<int, int, int> CScalarScalarFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 19 { 20 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 21 int unique_filter_id; 22 bool firstround; 23 24 if(building_graph) 25 { 26 CWorkflowGraph::allocNodeEdge(); 27 28 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 29 30 // first round 31 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 32 { 33 firstround = true; 34 this->filterID = InvalidableObject::filterIdGenerator++; 35 int edgeID = InvalidableObject::edgeIdGenerator++; 36 37 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 38 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 39 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 40 41 42 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 43 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 44 45 46 if(CWorkflowGraph::build_begin) 47 { 48 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 49 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 50 51 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 52 } 53 else CWorkflowGraph::build_begin = true; 54 55 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 56 unique_filter_id = this->filterID; 57 } 58 // not first round 59 else 60 { 61 firstround=false; 62 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 63 if(data[0]->src_filterID != unique_filter_id) 64 { 65 int edgeID = InvalidableObject::edgeIdGenerator++; 66 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 67 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 68 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 69 } 70 } 71 } 72 73 return std::make_tuple(building_graph, firstround, unique_filter_id); 74 } 11 75 12 76 CDataPacketPtr CScalarScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 16 80 packet->timestamp = data[0]->timestamp; 17 81 packet->status = data[0]->status; 82 83 std::tuple<int, int, int> graph = buildGraph(data); 84 85 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 86 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 87 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 88 89 packet->field = this->field; 18 90 19 91 if (packet->status == CDataPacket::NO_ERROR) … … 28 100 , value1(value1) 29 101 , value2(value2) 30 { /* Nothing to do */ }; 102 { 103 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 104 /* Nothing to do */ 105 }; 106 107 std::tuple<int, int, int> CScalarFieldScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 108 { 109 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 110 int unique_filter_id; 111 bool firstround; 112 113 if(building_graph) 114 { 115 CWorkflowGraph::allocNodeEdge(); 116 117 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 118 119 // first round 120 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 121 { 122 firstround = true; 123 this->filterID = InvalidableObject::filterIdGenerator++; 124 int edgeID = InvalidableObject::edgeIdGenerator++; 125 126 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 127 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 128 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 129 130 131 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 132 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 133 134 135 if(CWorkflowGraph::build_begin) 136 { 137 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 138 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 139 140 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 141 } 142 else CWorkflowGraph::build_begin = true; 143 144 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 145 unique_filter_id = this->filterID; 146 } 147 // not first round 148 else 149 { 150 firstround=false; 151 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 152 if(data[0]->src_filterID != unique_filter_id) 153 { 154 int edgeID = InvalidableObject::edgeIdGenerator++; 155 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 156 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 157 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 158 } 159 } 160 } 161 162 return std::make_tuple(building_graph, firstround, unique_filter_id); 163 } 31 164 32 165 CDataPacketPtr CScalarFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 36 169 packet->timestamp = data[0]->timestamp; 37 170 packet->status = data[0]->status; 171 172 std::tuple<int, int, int> graph = buildGraph(data); 173 174 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 175 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 176 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 177 178 packet->field = this->field; 38 179 39 180 if (packet->status == CDataPacket::NO_ERROR) … … 47 188 , op(operatorExpr.getOpScalarFieldField(op)) 48 189 , value(value) 49 { /* Nothing to do */ }; 190 { 191 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 192 /* Nothing to do */ 193 }; 194 195 std::tuple<int, int, int> CScalarFieldFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 196 { 197 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 198 int unique_filter_id; 199 200 bool firstround; 201 202 if(building_graph) 203 { 204 CWorkflowGraph::allocNodeEdge(); 205 206 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 207 208 // first round 209 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 210 { 211 firstround = true; 212 this->filterID = InvalidableObject::filterIdGenerator++; 213 int edgeID = InvalidableObject::edgeIdGenerator++; 214 215 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 216 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 217 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 218 219 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 220 221 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 222 if(CWorkflowGraph::build_begin) 223 { 224 225 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 226 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 227 228 edgeID = InvalidableObject::edgeIdGenerator++; 229 230 CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 231 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 232 233 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 234 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 235 } 236 CWorkflowGraph::build_begin = true; 237 238 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 239 unique_filter_id = this->filterID; 240 241 } 242 // not first round 243 else 244 { 245 firstround = false; 246 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 247 if(data[0]->src_filterID != unique_filter_id) 248 { 249 int edgeID = InvalidableObject::edgeIdGenerator++; 250 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 251 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 252 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 253 } 254 if(data[1]->src_filterID != unique_filter_id) 255 { 256 int edgeID = InvalidableObject::edgeIdGenerator++; 257 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); 258 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 259 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 260 } 261 262 } 263 } 264 265 return std::make_tuple(building_graph, firstround, unique_filter_id); 266 } 50 267 51 268 CDataPacketPtr CScalarFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 55 272 packet->timestamp = data[0]->timestamp; 56 273 packet->status = data[0]->status; 274 275 std::tuple<int, int, int> graph = buildGraph(data); 276 277 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 278 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 279 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 280 281 packet->field = this->field; 57 282 58 283 if (data[0]->status != CDataPacket::NO_ERROR) … … 75 300 , value1(value1) 76 301 , value2(value2) 77 { /* Nothing to do */ }; 302 { 303 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 304 /* Nothing to do */ 305 }; 306 307 std::tuple<int, int, int> CFieldScalarScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 308 { 309 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 310 int unique_filter_id; 311 bool firstround; 312 313 if(building_graph) 314 { 315 CWorkflowGraph::allocNodeEdge(); 316 317 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 318 319 // first round 320 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 321 { 322 firstround = true; 323 this->filterID = InvalidableObject::filterIdGenerator++; 324 int edgeID = InvalidableObject::edgeIdGenerator++; 325 326 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 327 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 328 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 329 330 331 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 332 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 333 334 335 if(CWorkflowGraph::build_begin) 336 { 337 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 338 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 339 340 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 341 } 342 else CWorkflowGraph::build_begin = true; 343 344 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 345 unique_filter_id = this->filterID; 346 } 347 // not first round 348 else 349 { 350 firstround=false; 351 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 352 if(data[0]->src_filterID != unique_filter_id) 353 { 354 int edgeID = InvalidableObject::edgeIdGenerator++; 355 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 356 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 357 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 358 } 359 } 360 } 361 362 return std::make_tuple(building_graph, firstround, unique_filter_id); 363 } 78 364 79 365 CDataPacketPtr CFieldScalarScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 84 370 packet->status = data[0]->status; 85 371 372 std::tuple<int, int, int> graph = buildGraph(data); 373 374 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 375 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 376 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 377 378 packet->field = this->field; 379 86 380 if (packet->status == CDataPacket::NO_ERROR) 87 381 packet->data.reference(op(data[0]->data, value1, value2)); … … 95 389 , op(operatorExpr.getOpFieldScalarField(op)) 96 390 , value(value) 97 { /* Nothing to do */ }; 391 { 392 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 393 /* Nothing to do */ 394 }; 395 396 std::tuple<int, int, int> CFieldScalarFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 397 { 398 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 399 int unique_filter_id; 400 401 bool firstround; 402 403 if(building_graph) 404 { 405 CWorkflowGraph::allocNodeEdge(); 406 407 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 408 409 // first round 410 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 411 { 412 firstround = true; 413 this->filterID = InvalidableObject::filterIdGenerator++; 414 int edgeID = InvalidableObject::edgeIdGenerator++; 415 416 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 417 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 418 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 419 420 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 421 422 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 423 if(CWorkflowGraph::build_begin) 424 { 425 426 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 427 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 428 429 edgeID = InvalidableObject::edgeIdGenerator++; 430 431 CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 432 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 433 434 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 435 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 436 } 437 CWorkflowGraph::build_begin = true; 438 439 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 440 unique_filter_id = this->filterID; 441 442 } 443 // not first round 444 else 445 { 446 firstround = false; 447 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 448 if(data[0]->src_filterID != unique_filter_id) 449 { 450 int edgeID = InvalidableObject::edgeIdGenerator++; 451 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 452 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 453 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 454 } 455 if(data[1]->src_filterID != unique_filter_id) 456 { 457 int edgeID = InvalidableObject::edgeIdGenerator++; 458 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); 459 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 460 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 461 } 462 463 } 464 } 465 466 return std::make_tuple(building_graph, firstround, unique_filter_id); 467 } 98 468 99 469 CDataPacketPtr CFieldScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 103 473 packet->timestamp = data[0]->timestamp; 104 474 packet->status = data[0]->status; 475 476 std::tuple<int, int, int> graph = buildGraph(data); 477 478 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 479 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 480 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 481 482 packet->field = this->field; 105 483 106 484 if (data[0]->status != CDataPacket::NO_ERROR) … … 120 498 , op(operatorExpr.getOpFieldFieldScalar(op)) 121 499 , value(value) 122 { /* Nothing to do */ }; 500 { 501 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 502 std::cout<<"expression = "<<expression; 503 /* Nothing to do */ 504 }; 505 506 std::tuple<int, int, int> CFieldFieldScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 507 { 508 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 509 int unique_filter_id; 510 511 bool firstround; 512 513 if(building_graph) 514 { 515 CWorkflowGraph::allocNodeEdge(); 516 517 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 518 519 // first round 520 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 521 { 522 firstround = true; 523 this->filterID = InvalidableObject::filterIdGenerator++; 524 int edgeID = InvalidableObject::edgeIdGenerator++; 525 526 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 527 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 528 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 529 530 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 531 532 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 533 if(CWorkflowGraph::build_begin) 534 { 535 536 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 537 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 538 539 edgeID = InvalidableObject::edgeIdGenerator++; 540 541 CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 542 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 543 544 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 545 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 546 } 547 CWorkflowGraph::build_begin = true; 548 549 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 550 unique_filter_id = this->filterID; 551 552 } 553 // not first round 554 else 555 { 556 firstround = false; 557 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 558 if(data[0]->src_filterID != unique_filter_id) 559 { 560 int edgeID = InvalidableObject::edgeIdGenerator++; 561 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 562 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 563 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 564 } 565 if(data[1]->src_filterID != unique_filter_id) 566 { 567 int edgeID = InvalidableObject::edgeIdGenerator++; 568 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); 569 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 570 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 571 } 572 573 } 574 } 575 576 return std::make_tuple(building_graph, firstround, unique_filter_id); 577 } 123 578 124 579 CDataPacketPtr CFieldFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 128 583 packet->timestamp = data[0]->timestamp; 129 584 packet->status = data[0]->status; 585 586 std::tuple<int, int, int> graph = buildGraph(data); 587 588 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 589 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 590 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 591 592 packet->field = this->field; 130 593 131 594 if (data[0]->status != CDataPacket::NO_ERROR) … … 145 608 : CFilter(gc, 3, this) 146 609 , op(operatorExpr.getOpFieldFieldField(op)) 147 { /* Nothing to do */ }; 610 { 611 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 612 /* Nothing to do */ 613 }; 614 615 std::tuple<int, int, int> CFieldFieldFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 616 { 617 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 618 int unique_filter_id; 619 620 bool firstround; 621 622 if(building_graph) 623 { 624 CWorkflowGraph::allocNodeEdge(); 625 626 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 627 628 // first round 629 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 630 { 631 firstround = true; 632 this->filterID = InvalidableObject::filterIdGenerator++; 633 int edgeID = InvalidableObject::edgeIdGenerator++; 634 635 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 636 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 637 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 638 639 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 640 641 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 642 if(CWorkflowGraph::build_begin) 643 { 644 645 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 646 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 647 648 edgeID = InvalidableObject::edgeIdGenerator++; 649 650 CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 651 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 652 653 edgeID = InvalidableObject::edgeIdGenerator++; 654 655 CWorkflowGraph::addEdge(edgeID, this->filterID, data[2]); 656 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 657 658 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 659 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 660 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[2]->src_filterID].filter_filled = 0 ; 661 } 662 CWorkflowGraph::build_begin = true; 663 664 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 665 unique_filter_id = this->filterID; 666 667 } 668 // not first round 669 else 670 { 671 firstround = false; 672 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 673 if(data[0]->src_filterID != unique_filter_id) 674 { 675 int edgeID = InvalidableObject::edgeIdGenerator++; 676 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 677 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 678 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 679 } 680 if(data[1]->src_filterID != unique_filter_id) 681 { 682 int edgeID = InvalidableObject::edgeIdGenerator++; 683 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); 684 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 685 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 686 } 687 if(data[2]->src_filterID != unique_filter_id) 688 { 689 int edgeID = InvalidableObject::edgeIdGenerator++; 690 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[2]); 691 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[2]->src_filterID].filter_filled = 0 ; 692 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 693 } 694 695 } 696 } 697 698 return std::make_tuple(building_graph, firstround, unique_filter_id); 699 } 148 700 149 701 CDataPacketPtr CFieldFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 153 705 packet->timestamp = data[0]->timestamp; 154 706 packet->status = data[0]->status; 707 708 std::tuple<int, int, int> graph = buildGraph(data); 709 710 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 711 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 712 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 713 714 packet->field = this->field; 155 715 156 716 if (data[0]->status != CDataPacket::NO_ERROR) -
XIOS/dev/dev_olga/src/filter/ternary_arithmetic_filter.hpp
r1162 r1686 5 5 #include <string> 6 6 #include "operator_expr.hpp" 7 #include <tuple> 7 8 8 9 namespace xios … … 36 37 */ 37 38 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 39 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 38 40 }; // class CScalarScalarFieldArithmeticFilter 39 41 … … 67 69 */ 68 70 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 71 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 69 72 }; // class CScalarScalarFieldArithmeticFilter 70 73 … … 95 98 */ 96 99 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 100 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 97 101 }; // class CScalarScalarFieldArithmeticFilter 98 102 … … 127 131 */ 128 132 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 133 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 129 134 }; // class CFieldScalarScalarArithmeticFilter 130 135 … … 156 161 */ 157 162 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 163 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 158 164 }; // class CFieldScalarFieldArithmeticFilter 159 165 … … 185 191 */ 186 192 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 193 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 187 194 }; // class CFieldFielScalardArithmeticFilter 188 195 … … 212 219 */ 213 220 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 221 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 214 222 }; // class CFieldFielFieldArithmeticFilter 215 223 -
XIOS/dev/dev_olga/src/filter/unary_arithmetic_filter.cpp
r643 r1686 1 1 #include "unary_arithmetic_filter.hpp" 2 #include "workflow_graph.hpp" 3 #include "yacc_var.hpp" 4 #include "file.hpp" 2 5 3 6 namespace xios … … 6 9 : CFilter(gc, 1, this) 7 10 , op(operatorExpr.getOpField(op)) 8 { /* Nothing to do */ }; 11 { 12 expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 13 }; 14 15 std::tuple<int, int, int> CUnaryArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 16 { 17 bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 18 int unique_filter_id; 19 bool firstround; 20 21 if(building_graph) 22 { 23 CWorkflowGraph::allocNodeEdge(); 24 size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 25 26 // first round 27 if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 28 { 29 firstround=true; 30 this->filterID = InvalidableObject::filterIdGenerator++; 31 int edgeID = InvalidableObject::edgeIdGenerator++; 32 33 CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 34 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 35 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 36 37 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 38 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 39 40 if(CWorkflowGraph::build_begin) 41 { 42 43 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 44 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 45 46 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 47 } 48 else CWorkflowGraph::build_begin = true; 49 50 (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; 51 unique_filter_id = this->filterID; 52 } 53 else 54 { 55 firstround=false; 56 unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 57 if(data[0]->src_filterID != unique_filter_id) 58 { 59 int edgeID = InvalidableObject::edgeIdGenerator++; 60 CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); 61 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 62 (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 63 } 64 } 65 66 } 67 68 return std::make_tuple(building_graph, firstround, unique_filter_id); 69 } 9 70 10 71 CDataPacketPtr CUnaryArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 15 76 packet->status = data[0]->status; 16 77 78 std::tuple<int, int, int> graph = buildGraph(data); 79 80 if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 81 if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 82 if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 83 84 packet->field = this->field; 85 17 86 if (packet->status == CDataPacket::NO_ERROR) 18 87 packet->data.reference(op(data[0]->data)); -
XIOS/dev/dev_olga/src/filter/unary_arithmetic_filter.hpp
r642 r1686 34 34 */ 35 35 CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 36 std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 36 37 }; // class CUnaryArithmeticFilter 37 38 } // namespace xios -
XIOS/dev/dev_olga/src/graphviz.cpp
r1653 r1686 11 11 * 12 12 */ 13 void CGraphviz::build StaticWorkflowGraph()13 void CGraphviz::buildWorkflowGraphDot() 14 14 TRY 15 15 { 16 if ( !CWorkflowGraph::mapFieldToFilters.empty())16 if (CWorkflowGraph::mapFieldToFilters_ptr_with_info !=0 && !CWorkflowGraph::mapFieldToFilters_ptr_with_info->empty()) 17 17 { 18 18 CWorkflowGraph::buildStaticWorkflow(); … … 58 58 boost::make_label_writer(get(edge_name, g)), 59 59 boost::make_graph_attributes_writer(graph_attr, vertex_attr, edge_attr)); 60 60 61 } 61 62 } 62 63 CATCH 64 65 66 67 68 void CGraphviz::buildWorkflowGraphVisjs_with_info() 69 TRY 70 { 71 if (CWorkflowGraph::mapFilters_ptr_with_info !=0 && !CWorkflowGraph::mapFilters_ptr_with_info->empty()) 72 { 73 CWorkflowGraph::buildStaticWorkflow_with_info(); 74 75 StdString color_table[7] = {"black", "red", "blue", "green", "purple", "yellow", "gray"}; 76 77 std::ofstream fs_json; 78 fs_json.open ("graph_data.json", std::fstream::out); 79 80 fs_json << "{\"nodes\":["<<std::endl<<" "; 81 static bool firstnode=true; 82 static bool firstedge=true; 83 84 for (auto it=CWorkflowGraph::mapFilters_ptr_with_info->begin(); it != CWorkflowGraph::mapFilters_ptr_with_info->end(); it++) 85 { 86 if(firstnode) 87 { 88 fs_json << "{\"id\": "<<it->first +1<<", "<<std::endl; 89 firstnode = false; 90 } 91 else 92 { 93 fs_json << ",{\"id\": "<<it->first +1<<", "<<std::endl; 94 } 95 if(it->second.filter_class == 1) // source filter 96 fs_json << " \"label\": \""<<it->second.filter_name<<"\\n("<<it->second.field_id<<")\", "<<std::endl; 97 else 98 fs_json << " \"label\": \""<<it->second.filter_name<<"\", "<<std::endl; 99 fs_json << " \"class\": "<<it->second.filter_class<<", "<<std::endl; 100 fs_json << " \"filled\": "<<it->second.filter_filled<<", "<<std::endl; 101 fs_json << " \"type\": \""<<it->second.transform_type<<"\", "<<std::endl; 102 fs_json << " \"entry\": "<<it->second.expected_entry_nb<<", "<<std::endl; 103 fs_json << " \"inputs\": "<<it->second.inputs_complete<<", "<<std::endl; 104 fs_json << " \"tag\": "<<it->second.filter_tag<<", "<<std::endl; 105 fs_json << " \"cid\": "<<it->second.clusterID<<", "<<std::endl; 106 fs_json << " \"distance\": "<<it->second.distance<<", "<<std::endl; 107 fs_json << " \"attributes\": \""<<it->second.attributes<<"\"}"<<std::endl<<" "; 108 } 109 fs_json << " ],"<<std::endl; 110 111 112 fs_json << " \"edges\" : ["<<std::endl<<" "; 113 114 for (auto it=CWorkflowGraph::mapFieldToFilters_ptr_with_info->begin(); it != CWorkflowGraph::mapFieldToFilters_ptr_with_info->end(); it++) 115 { 116 if(firstedge) 117 { 118 fs_json << "{\"id\": "<<it->first +1<<", "<<std::endl; 119 firstedge = false; 120 } 121 else 122 { 123 fs_json << ",{\"id\": "<<it->first +1<<", "<<std::endl; 124 } 125 fs_json << " \"from\": "<<it->second.from+1<<", "<<std::endl; 126 fs_json << " \"to\": "<<it->second.to+1<<", "<<std::endl; 127 fs_json << " \"label\": \""<<it->second.field_id<<"\\n"<<it->second.date<<"\", "<<std::endl; 128 // fs_json << " \"title\": \""<<"Show more information about this field"<<"\", "<<std::endl; 129 // fs_json << " \"fid\": \""<<it->second.field_id<<"\", "<<std::endl; 130 // fs_json << " \"fname\": \""<<it->second.field_name<<"\", "<<std::endl; 131 // fs_json << " \"gid\": \""<<it->second.grid_id<<"\", "<<std::endl; 132 fs_json << " \"date\": \""<<it->second.date<<"\", "<<std::endl; 133 fs_json << " \"attributes\": \"id = "<<it->second.field_id<<"</br>"<<it->second.attributes<<"\"}"<<std::endl<<" "; 134 135 } 136 fs_json << " ]}"<<std::endl; 137 138 fs_json.close(); 139 } 140 } 141 CATCH 142 143 144 145 void CGraphviz::showStaticWorkflowGraph() 146 TRY 147 { 148 CWorkflowGraph::showStaticWorkflow(); 149 } 150 CATCH 63 151 } -
XIOS/dev/dev_olga/src/graphviz.hpp
r1653 r1686 16 16 17 17 CGraphviz(); 18 static void buildStaticWorkflowGraph(); 18 static void buildWorkflowGraphDot(); 19 static void buildWorkflowGraphVisjs_with_info(); 20 static void showStaticWorkflowGraph(); 19 21 20 22 private: -
XIOS/dev/dev_olga/src/interface/fortran/ixios.F90
r1590 r1686 8 8 xios(get_year_length_in_seconds), xios(get_day_length_in_seconds) 9 9 10 USE icontext, ONLY : txios(context), xios(set_current_context), xios( is_valid_context)10 USE icontext, ONLY : txios(context), xios(set_current_context), xios(get_current_context), xios(is_valid_context) 11 11 12 12 USE icontext_attr, ONLY : xios(set_context_attr), xios(get_context_attr), xios(is_defined_context_attr) -
XIOS/dev/dev_olga/src/io/onetcdf4_impl.hpp
r1653 r1686 76 76 memset (PtrArrayStr,' ',stringArrayLen*data.numElements()); 77 77 size_t offset=0 ; 78 79 // pb with iterator with blitz++ string array with recent compiler 80 /* 78 81 Array<StdString,1>::const_iterator it, itb=data.begin(), ite=data.end() ; 79 82 for(it=itb;it!=ite;++it, offset+=stringArrayLen) … … 82 85 PtrArrayStr[offset+it->size()]='\0' ; 83 86 } 84 87 */ 88 for(int i=0;i<data.numElements();i++,offset+=stringArrayLen) 89 { 90 data(i).copy(PtrArrayStr+offset,data(i).size()) ; 91 PtrArrayStr[offset+data(i).size()]='\0' ; 92 } 85 93 CTimer::get("CONetCDF4::writeData writeData_").resume(); 86 94 this->writeData_(grpid, varid, sstart, scount, PtrArrayStr); -
XIOS/dev/dev_olga/src/node/axis.cpp
r1612 r1686 345 345 Check the validity of data, fill in values if any, and apply mask. 346 346 */ 347 348 347 void CAxis::checkData() 349 348 TRY … … 848 847 849 848 numberWrittenIndexes_[writtenCommSize] = nbWritten; 850 if (isDistributed()) 849 850 bool distributed_glo, distributed=isDistributed() ; 851 MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, writtenComm) ; 852 if (distributed_glo) 851 853 { 852 854 -
XIOS/dev/dev_olga/src/node/domain.cpp
r1612 r1686 226 226 bool distributed = !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || 227 227 (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); 228 bool distributed_glo ; 228 229 distributed |= (1 == CContext::getCurrent()->client->clientSize); 229 230 … … 2061 2062 2062 2063 numberWrittenIndexes_[writtenCommSize] = nbWritten; 2063 if (isDistributed()) 2064 bool distributed_glo, distributed=isDistributed() ; 2065 MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, writtenComm) ; 2066 2067 if (distributed_glo) 2064 2068 { 2065 2069 -
XIOS/dev/dev_olga/src/node/field.cpp
r1654 r1686 46 46 , mustAutoTrigger(false) 47 47 , isEOF(false), nstepMaxRead(false) 48 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 48 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); 49 field_graph_start = -2; 50 field_graph_end = -2; 51 } 49 52 50 53 CField::CField(const StdString& id) … … 64 67 , mustAutoTrigger(false) 65 68 , isEOF(false), nstepMaxRead(false) 66 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 69 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); 70 field_graph_start = -2; 71 field_graph_end = -2; 72 } 73 67 74 68 75 CField::~CField(void) … … 1107 1114 * read by the client or/and written to a file 1108 1115 */ 1109 void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput )1116 void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput, Time start_graph, Time end_graph) 1110 1117 TRY 1111 1118 { 1112 1113 1119 if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 1120 if (!isGridChecked) checkGridOfEnabledFields(); 1114 1121 1115 1122 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1123 1116 1124 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1125 1126 1117 1127 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1118 1128 1119 1129 CContext* context = CContext::getCurrent(); 1130 1131 Time filter_start; 1132 if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 1133 else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 1134 else filter_start = -1; 1135 1136 Time filter_end; 1137 if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 1138 else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 1139 else filter_end = -1; 1140 1141 if(this->field_graph_start==-2) this->field_graph_start = filter_start; 1142 if(this->field_graph_end==-2) this->field_graph_end = filter_end; // init 1143 1144 // if(CXios::isClient) std::cout<<"****************** buildFilterGraph : field_id = "<<this->getId()<<" BEFORE: this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 1145 1146 if(start_graph == -1) 1147 { 1148 //nothing 1149 // if(CXios::isClient) std::cout<<"buildFilterGraph field_id = "<<this->getId()<<" case1: this->field_graph_start = "<<this->field_graph_start<<std::endl; 1150 } 1151 else //if(start_graph != -1) 1152 { 1153 if(this->field_graph_start == -1) this->field_graph_start = start_graph; 1154 else this->field_graph_start = min(this->field_graph_start, start_graph); 1155 1156 // if(CXios::isClient) std::cout<<"buildFilterGraph field_id = "<<this->getId()<<" case2: this->field_graph_start = "<<this->field_graph_start<<std::endl; 1157 } 1158 1159 1160 if(end_graph == -1) 1161 { 1162 //nothing 1163 // if(CXios::isClient) std::cout<<"buildFilterGraph field_id = "<<this->getId()<<" case1: this->field_graph_end = "<<this->field_graph_end<<std::endl; 1164 } 1165 else 1166 { 1167 if(this->field_graph_end == -1) this->field_graph_end = end_graph; 1168 else this->field_graph_end = max(this->field_graph_end, end_graph); 1169 1170 // if(CXios::isClient) std::cout<<"buildFilterGraph field_id = "<<this->getId()<<" case2: this->field_graph_end = "<<this->field_graph_end<<std::endl; 1171 } 1172 1173 1174 filter_start = this->field_graph_start; 1175 filter_end = this->field_graph_end; 1176 1177 1178 // if(CXios::isClient) std::cout<<"****************** buildFilterGraph : field_id = "<<this->getId()<<" AFTER: this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 1179 1180 1181 1182 1183 1120 1184 bool hasWriterServer = context->hasServer && !context->hasClient; 1121 1185 bool hasIntermediateServer = context->hasServer && context->hasClient; … … 1124 1188 { 1125 1189 if (!instantDataFilter) 1126 {1127 1190 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false)); 1128 } 1191 1129 1192 1130 1193 // If the field data is to be read by the client or/and written to a file … … 1141 1204 { 1142 1205 if (!instantDataFilter) 1143 {1144 1206 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, false)); 1145 } 1207 1146 1208 // If the field data is to be read by the client or/and written to a file 1147 1209 if (enableOutput && !storeFilter && !fileWriterFilter) … … 1163 1225 { 1164 1226 boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0')); 1165 std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this );1227 std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this, filter_start, filter_end); 1166 1228 1167 1229 // Check if a spatial transformation is needed 1168 1230 if (!field_ref.isEmpty()) 1169 1231 { 1170 CField* fieldRef = CField::get(field_ref); 1171 fieldRef->build_workflow_graph.setValue(buildWorkflowGraph); 1172 CGrid* gridRef = fieldRef->grid; 1232 CGrid* gridRef = CField::get(field_ref)->grid; 1173 1233 1174 1234 if (grid && grid != gridRef && grid->hasTransform()) 1175 1235 { 1176 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, 1177 detectMissingValues, defaultValue, buildWorkflowGraph); 1236 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); 1178 1237 1179 1238 filter->connectOutput(filters.first, 0); 1180 1181 if (buildWorkflowGraph)1182 {1183 int filterOut = filter->getFilterId();1184 int filterIn = (std::static_pointer_cast<COutputPin>(filters.second))->getFilterId();1185 CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut);1186 CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn);1187 CWorkflowGraph::mapFilters[filterOut] = filter->GetName();1188 CWorkflowGraph::mapFilters[filterIn] = filters.second->GetName();1189 }1190 1239 filter = filters.second; 1191 1240 } … … 1193 1242 1194 1243 instantDataFilter = filter; 1244 instantDataFilter->field = this; 1245 filter->tag = buildWorkflowGraph; 1246 1247 filter->start_graph = filter_start; 1248 filter->end_graph = filter_end; 1249 1250 for(int i=0; i<filter->parent_filters.size(); i++) 1251 { 1252 filter->tag = filter->tag || filter->parent_filters[i]->tag; 1253 } 1195 1254 } 1196 1255 // Check if we have a reference on another field 1197 1256 else if (!field_ref.isEmpty()) 1198 1257 { 1199 CField::get(field_ref)->build_workflow_graph.setValue(buildWorkflowGraph); 1200 instantDataFilter = getFieldReference(gc); 1258 instantDataFilter = getFieldReference(gc, filter_start, filter_end); 1259 instantDataFilter->tag = buildWorkflowGraph; 1260 instantDataFilter->start_graph = filter_start; 1261 instantDataFilter->end_graph = filter_end; 1201 1262 } 1202 1263 // Check if the data is to be read from a file … … 1205 1266 checkTimeAttributes(); 1206 1267 instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 1207 detectMissingValues, defaultValue, buildWorkflowGraph)); 1268 detectMissingValues, defaultValue)); 1269 instantDataFilter->tag = buildWorkflowGraph; 1270 instantDataFilter->start_graph = filter_start; 1271 instantDataFilter->end_graph = filter_end; 1272 instantDataFilter->field = this; 1273 1208 1274 } 1209 1275 else // The data might be passed from the model … … 1211 1277 if (check_if_active.isEmpty()) check_if_active = false; 1212 1278 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 1213 detectMissingValues, defaultValue, buildWorkflowGraph)); 1214 if (buildWorkflowGraph) CWorkflowGraph::mapFilters[instantDataFilter->getFilterId()] = instantDataFilter->GetName(); 1279 detectMissingValues, defaultValue)); 1280 instantDataFilter->tag = buildWorkflowGraph; 1281 instantDataFilter->start_graph = filter_start; 1282 instantDataFilter->end_graph = filter_end; 1283 instantDataFilter->field = this; 1284 // if(CXios::isClient) std::cout<<"***********************buildFilterGraph init source filter : field_id = "<<this->getId()<<" sourcefilter->start_graph = "<<clientSourceFilter->start_graph<<" sourcefilter->end_graph = "<<clientSourceFilter->end_graph<<std::endl; 1215 1285 } 1216 1286 } … … 1224 1294 detectMissingValues, defaultValue)); 1225 1295 instantDataFilter->connectOutput(storeFilter, 0); 1296 1297 storeFilter->tag = (instantDataFilter->tag || buildWorkflowGraph); 1298 instantDataFilter->start_graph = filter_start; 1299 instantDataFilter->end_graph = filter_end; 1300 1301 instantDataFilter->setParentFiltersTag(); 1302 storeFilter->start_graph = filter_start; 1303 storeFilter->end_graph = filter_end; 1304 storeFilter->field = this; 1305 storeFilter->distance = instantDataFilter->distance+1; 1226 1306 } 1227 1307 1228 1308 if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 1229 1309 { 1230 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this , buildWorkflowGraph));1310 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 1231 1311 getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 1232 if (buildWorkflowGraph) 1233 { 1234 int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId(); 1235 int filterIn = fileWriterFilter->getFilterId(); 1236 CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 1237 CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 1238 CWorkflowGraph::mapFilters[filterOut] = "Temporal filter"; 1239 CWorkflowGraph::mapFilters[filterIn] = fileWriterFilter->GetName(); 1240 } 1312 1313 fileWriterFilter->tag = (getTemporalDataFilter(gc, file->output_freq)->tag || buildWorkflowGraph); 1314 getTemporalDataFilter(gc, file->output_freq)->start_graph = filter_start; 1315 getTemporalDataFilter(gc, file->output_freq)->end_graph = filter_end; 1316 getTemporalDataFilter(gc, file->output_freq)->tag = buildWorkflowGraph; 1317 getTemporalDataFilter(gc, file->output_freq)->setParentFiltersTag(); 1318 fileWriterFilter->start_graph = filter_start; 1319 fileWriterFilter->end_graph = filter_end; 1320 fileWriterFilter->distance = getTemporalDataFilter(gc, file->output_freq)->distance+1; 1321 1322 // std::cout<<"CFileWriterFilter filter start = "<<filter_start<<" end = "<<filter_end<<" field = "<<this->getId()<<std::endl; 1323 1241 1324 } 1242 1325 } … … 1252 1335 * \return the output pin corresponding to the field reference 1253 1336 */ 1254 std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc )1337 std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc, Time start_graph, Time end_graph) 1255 1338 TRY 1256 1339 { … … 1260 1343 1261 1344 CField* fieldRef = CField::get(field_ref); 1262 fieldRef->buildFilterGraph(gc, false); 1263 bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1345 fieldRef->buildFilterGraph(gc, false, start_graph, end_graph); 1346 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1347 1348 CContext* context = CContext::getCurrent(); 1349 1350 Time filter_start; 1351 if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 1352 else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 1353 else filter_start = -1; 1354 1355 Time filter_end; 1356 if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 1357 else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 1358 else filter_end = -1; 1359 1360 if(this->field_graph_start==-2) this->field_graph_start = filter_start; 1361 if(this->field_graph_end==-2) this->field_graph_end = filter_end; // init 1362 1363 // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" BEFORE: this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 1364 1365 if(start_graph == -1) 1366 { 1367 //nothing 1368 // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" case1: this->field_graph_start = "<<this->field_graph_start<<std::endl; 1369 } 1370 else //if(start_graph != -1) 1371 { 1372 if(this->field_graph_start == -1) this->field_graph_start = start_graph; 1373 else this->field_graph_start = min(this->field_graph_start, start_graph); 1374 1375 // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" case2: this->field_graph_start = "<<this->field_graph_start<<std::endl; 1376 } 1377 1378 if(end_graph == -1) 1379 { 1380 //nothing 1381 // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" case1: this->field_graph_end = "<<this->field_graph_end<<std::endl; 1382 } 1383 else 1384 { 1385 if(this->field_graph_end == -1) this->field_graph_end = end_graph; 1386 else this->field_graph_end = max(this->field_graph_end, end_graph); 1387 1388 // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" case2: this->field_graph_end = "<<this->field_graph_end<<std::endl; 1389 } 1390 1391 filter_start = this->field_graph_start; 1392 filter_end = this->field_graph_end; 1393 1394 // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" AFTER: this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 1395 1264 1396 1265 1397 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; … … 1269 1401 bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1270 1402 double defaultValue = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1271 filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue, buildWorkflowGraph); 1403 filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue); 1404 1405 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 1406 1407 1408 1409 filters.second->parent_filters.resize(1); 1410 filters.second->parent_filters[0]= fieldRef->getInstantDataFilter(); 1411 1412 filters.second->tag = (buildWorkflowGraph || filters.second->parent_filters[0]->tag); 1413 1414 filters.second->start_graph = filter_start; 1415 filters.second->end_graph = filter_end; 1416 filters.second->field = this; 1417 1272 1418 } 1273 1419 else 1274 1420 { 1275 filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc, buildWorkflowGraph)); 1276 } 1277 1278 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 1279 1280 if (buildWorkflowGraph) 1281 { 1282 int filterOut = fieldRef->instantDataFilter->getFilterId(); 1283 int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId(); 1284 CWorkflowGraph::mapFieldToFilters[fieldRef->getId()].push_back(filterOut); 1285 CWorkflowGraph::mapFieldToFilters[fieldRef->getId()].push_back(filterIn); 1286 CWorkflowGraph::mapFilters[filterOut] = fieldRef->getInstantDataFilter()->GetName(); 1287 CWorkflowGraph::mapFilters[filterIn] = filters.first->GetName(); 1288 } 1421 filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 1422 1423 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 1424 1425 1426 filters.second->parent_filters.resize(1); 1427 filters.second->parent_filters[0]= fieldRef->getInstantDataFilter(); 1428 1429 filters.second->tag = (buildWorkflowGraph || filters.second->parent_filters[0]->tag); 1430 1431 filters.second->start_graph = filter_start; 1432 filters.second->end_graph = filter_end; 1433 filters.second->field = this; 1434 1435 } 1436 1289 1437 return filters.second; 1290 1438 } … … 1300 1448 * \return the output pin corresponding to a self reference 1301 1449 */ 1302 std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 1303 TRY 1304 { 1450 std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc, Time start_graph, Time end_graph) 1451 TRY 1452 { 1453 if(CXios::isClient) std::cout<<"getSelfReference field_id = "<<this->getId()<<" start_graph = "<<start_graph<<" end_graph = "<<end_graph<<std::endl; 1454 1305 1455 if (instantDataFilter || !hasExpression()) 1306 1456 ERROR("COutputPin* CField::getSelfReference(CGarbageCollector& gc)", 1307 1457 "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); 1458 1459 bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1308 1460 1309 1461 if (!selfReferenceFilter) … … 1342 1494 } 1343 1495 1496 selfReferenceFilter->tag = buildWorkflowGraph; 1497 selfReferenceFilter->field = this; 1344 1498 return selfReferenceFilter; 1345 1499 } … … 1361 1515 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1362 1516 1517 CContext* context = CContext::getCurrent(); 1518 1519 // Time filter_start; 1520 // if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 1521 // else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 1522 // else filter_start = -1; 1523 1524 // Time filter_end; 1525 // if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 1526 // else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 1527 // else filter_end = -1; 1528 1529 // filter_start = this->field_graph_start; 1530 // filter_end = this->field_graph_end; 1531 1532 // if(CXios::isClient) std::cout<<"getTemporalDataFilter field_id = "<<this->getId()<<" this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 1533 1363 1534 if (it == temporalDataFilters.end()) 1364 1535 { … … 1370 1541 1371 1542 const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 1372 std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, CContext::getCurrent()->getCalendar()->getInitDate(),1373 freq_op, freq_offset, outFreq,1374 detectMissingValues, buildWorkflowGraph));1543 std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 1544 CContext::getCurrent()->getCalendar()->getInitDate(), 1545 freq_op, freq_offset, outFreq, detectMissingValues)); 1375 1546 1376 1547 instantDataFilter->connectOutput(temporalFilter, 0); 1377 1378 if (buildWorkflowGraph) 1379 { 1380 int filterOut = instantDataFilter->getFilterId(); 1381 int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 1382 CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 1383 CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 1384 CWorkflowGraph::mapFilters[filterOut] = getInstantDataFilter()->GetName(); 1385 CWorkflowGraph::mapFilters[filterIn] = temporalFilter->GetName(); 1386 } 1548 // temporalFilter->tag = buildWorkflowGraph; 1549 1550 temporalFilter->parent_filters.resize(1); 1551 temporalFilter->parent_filters[0] = instantDataFilter; 1552 1553 1554 if(temporalFilter->parent_filters[0]->tag) temporalFilter->tag=true; 1555 1556 // temporalFilter->start_graph = filter_start; 1557 // temporalFilter->end_graph = filter_end; 1558 temporalFilter->field = this; 1387 1559 1388 1560 it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; 1389 1561 } 1562 1390 1563 return it->second; 1391 1564 } … … 1419 1592 1420 1593 const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 1421 constbool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true);1594 bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1422 1595 std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 1423 CContext::getCurrent()->getCalendar()->getInitDate(), 1424 freq_op, freq_offset, outFreq, 1425 detectMissingValues, buildWorkflowGraph)); 1596 CContext::getCurrent()->getCalendar()->getInitDate(), 1597 freq_op, freq_offset, outFreq, detectMissingValues)); 1426 1598 1427 1599 selfReferenceFilter->connectOutput(temporalFilter, 0); 1428 if (buildWorkflowGraph) 1429 1430 { 1431 int filterOut = selfReferenceFilter->getFilterId(); 1432 int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 1433 CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 1434 CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 1435 CWorkflowGraph::mapFilters[filterOut] = selfReferenceFilter->GetName(); 1436 CWorkflowGraph::mapFilters[filterIn] = temporalFilter->GetName(); 1437 } 1600 temporalFilter->tag = buildWorkflowGraph; 1601 temporalFilter->field = this; 1438 1602 1439 1603 return temporalFilter ; -
XIOS/dev/dev_olga/src/node/field.hpp
r1653 r1686 140 140 void checkTimeAttributes(CDuration* freqOp=NULL); 141 141 142 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput );142 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput, Time start_graph=-1, Time end_graph=-1); 143 143 size_t getGlobalWrittenSize(void) ; 144 144 145 145 146 std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc );147 std::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc );146 std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc, Time start_graph=-1, Time end_graph=-1); 147 std::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc, Time start_graph=-1, Time end_graph=-1); 148 148 std::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 149 149 std::shared_ptr<COutputPin> getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); … … 244 244 bool hasTimeCentered; 245 245 246 Time field_graph_start; 247 Time field_graph_end; 248 249 246 250 DECLARE_REF_FUNC(Field,field) 247 251 -
XIOS/dev/dev_olga/src/parse_expr/filter_expr_node.cpp
r1577 r1686 12 12 13 13 14 std::shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField ) const14 std::shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 15 15 { 16 16 std::shared_ptr<COutputPin> outputPin; … … 40 40 << "Use the keyword \"this\" if you want to reference the input data sent to this field."); 41 41 42 field->buildFilterGraph(gc, false); 42 // field->buildFilterGraph(gc, false); 43 field->buildFilterGraph(gc, false, start_graph, end_graph); 43 44 outputPin = field->getInstantDataFilter(); 44 45 } … … 55 56 56 57 57 std::shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField ) const58 std::shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 58 59 { 59 60 std::shared_ptr<COutputPin> outputPin; … … 104 105 } 105 106 106 std::shared_ptr<COutputPin> CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 107 { 107 std::shared_ptr<COutputPin> CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 108 { 109 std::shared_ptr<COutputPin> ch = child->reduce(gc, thisField, start_graph, end_graph); 110 108 111 std::shared_ptr<CUnaryArithmeticFilter> filter(new CUnaryArithmeticFilter(gc, opId)); 109 child->reduce(gc, thisField)->connectOutput(filter, 0); 112 ch->connectOutput(filter, 0); 113 114 (filter->parent_filters).resize(1); 115 (filter->parent_filters)[0] = ch; 116 117 filter->tag = ch->tag; 118 filter->start_graph = ch->start_graph; 119 filter->end_graph = ch->end_graph; 120 filter->field = &thisField; 121 122 110 123 return filter; 111 124 } … … 121 134 } 122 135 123 std::shared_ptr<COutputPin> CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 124 { 136 std::shared_ptr<COutputPin> CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 137 { 138 std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 125 139 std::shared_ptr<CScalarFieldArithmeticFilter> filter(new CScalarFieldArithmeticFilter(gc, opId, child1->reduce())); 126 child2->reduce(gc, thisField)->connectOutput(filter, 0); 140 ch2->connectOutput(filter, 0); 141 142 (filter->parent_filters).resize(1); 143 (filter->parent_filters)[0] = ch2; 144 145 filter->tag = ch2->tag; 146 filter->start_graph = ch2->start_graph; 147 filter->end_graph = ch2->end_graph; 148 filter->field = &thisField; 149 127 150 return filter; 128 151 } … … 138 161 } 139 162 140 std::shared_ptr<COutputPin> CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 141 { 163 std::shared_ptr<COutputPin> CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 164 { 165 std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 166 142 167 std::shared_ptr<CFieldScalarArithmeticFilter> filter(new CFieldScalarArithmeticFilter(gc, opId, child2->reduce())); 143 child1->reduce(gc, thisField)->connectOutput(filter, 0); 168 ch1->connectOutput(filter, 0); 169 170 (filter->parent_filters).resize(1); 171 (filter->parent_filters)[0] = ch1; 172 173 filter->tag = ch1->tag; 174 filter->start_graph = ch1->start_graph; 175 filter->end_graph = ch1->end_graph; 176 filter->field = &thisField; 177 144 178 return filter; 145 179 } … … 155 189 } 156 190 157 std::shared_ptr<COutputPin> CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 158 { 191 std::shared_ptr<COutputPin> CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 192 { 193 std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 194 std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 195 159 196 std::shared_ptr<CFieldFieldArithmeticFilter> filter(new CFieldFieldArithmeticFilter(gc, opId)); 160 child1->reduce(gc, thisField)->connectOutput(filter, 0); 161 child2->reduce(gc, thisField)->connectOutput(filter, 1); 197 ch1->connectOutput(filter, 0); 198 ch2->connectOutput(filter, 1); 199 200 (filter->parent_filters).resize(2); 201 (filter->parent_filters)[0] = ch1; 202 (filter->parent_filters)[1] = ch2; 203 204 filter->tag = (ch1->tag || ch2->tag); 205 filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: -1); 206 filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: -1); 207 208 filter->field = &thisField; 209 210 162 211 return filter; 163 212 } … … 177 226 } 178 227 179 std::shared_ptr<COutputPin> CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 180 { 228 std::shared_ptr<COutputPin> CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 229 { 230 std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); 231 181 232 std::shared_ptr<CScalarScalarFieldArithmeticFilter> filter(new CScalarScalarFieldArithmeticFilter(gc, opId, child1->reduce(),child2->reduce())); 182 child3->reduce(gc, thisField)->connectOutput(filter, 0); 233 ch3->connectOutput(filter, 0); 234 235 (filter->parent_filters).resize(1); 236 (filter->parent_filters)[0] = ch3; 237 238 filter->tag = ch3->tag; 239 filter->start_graph = ch3->start_graph; 240 filter->end_graph = ch3->end_graph; 241 filter->field = &thisField; 242 183 243 return filter; 184 244 } … … 196 256 } 197 257 198 std::shared_ptr<COutputPin> CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 199 { 258 std::shared_ptr<COutputPin> CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 259 { 260 std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 261 200 262 std::shared_ptr<CScalarFieldScalarArithmeticFilter> filter(new CScalarFieldScalarArithmeticFilter(gc, opId, child1->reduce(),child3->reduce())); 201 child2->reduce(gc, thisField)->connectOutput(filter, 0); 263 ch2->connectOutput(filter, 0); 264 265 (filter->parent_filters).resize(1); 266 (filter->parent_filters)[0] = ch2; 267 268 filter->tag = ch2->tag; 269 filter->start_graph = ch2->start_graph; 270 filter->end_graph = ch2->end_graph; 271 filter->field = &thisField; 272 202 273 return filter; 203 274 } … … 215 286 } 216 287 217 std::shared_ptr<COutputPin> CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 218 { 288 std::shared_ptr<COutputPin> CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 289 { 290 std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 291 std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); 292 219 293 std::shared_ptr<CScalarFieldFieldArithmeticFilter> filter(new CScalarFieldFieldArithmeticFilter(gc, opId, child1->reduce())); 220 child2->reduce(gc, thisField)->connectOutput(filter, 0); 221 child3->reduce(gc, thisField)->connectOutput(filter, 1); 294 ch2->connectOutput(filter, 0); 295 ch3->connectOutput(filter, 1); 296 297 (filter->parent_filters).resize(2); 298 (filter->parent_filters)[0] = ch2; 299 (filter->parent_filters)[1] = ch3; 300 301 filter->tag = (ch3->tag || ch2->tag); 302 filter->start_graph = ch3->tag? ch3->start_graph : (ch2->tag? ch2->start_graph: -1); 303 filter->end_graph = ch3->tag? ch3->end_graph : (ch2->tag? ch2->end_graph: -1); 304 filter->field = &thisField; 305 222 306 return filter; 223 307 } … … 236 320 } 237 321 238 std::shared_ptr<COutputPin> CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 239 { 322 std::shared_ptr<COutputPin> CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 323 { 324 std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 325 240 326 std::shared_ptr<CFieldScalarScalarArithmeticFilter> filter(new CFieldScalarScalarArithmeticFilter(gc, opId, child2->reduce(),child3->reduce())); 241 child1->reduce(gc, thisField)->connectOutput(filter, 0); 327 ch1->connectOutput(filter, 0); 328 329 (filter->parent_filters).resize(1); 330 (filter->parent_filters)[0] = ch1; 331 332 filter->tag = ch1->tag; 333 filter->start_graph = ch1->start_graph; 334 filter->end_graph = ch1->end_graph; 335 filter->field = &thisField; 336 242 337 return filter; 243 338 } … … 256 351 } 257 352 258 std::shared_ptr<COutputPin> CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 259 { 353 std::shared_ptr<COutputPin> CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 354 { 355 std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 356 std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); 357 260 358 std::shared_ptr<CFieldScalarFieldArithmeticFilter> filter(new CFieldScalarFieldArithmeticFilter(gc, opId, child2->reduce())); 261 child1->reduce(gc, thisField)->connectOutput(filter, 0); 262 child3->reduce(gc, thisField)->connectOutput(filter, 1); 359 ch1->connectOutput(filter, 0); 360 ch3->connectOutput(filter, 1); 361 362 (filter->parent_filters).resize(2); 363 (filter->parent_filters)[0] = ch1; 364 (filter->parent_filters)[1] = ch3; 365 366 filter->tag = (ch3->tag || ch1->tag); 367 filter->start_graph = ch3->tag? ch3->start_graph : (ch1->tag? ch1->start_graph: -1); 368 filter->end_graph = ch3->tag? ch3->end_graph : (ch1->tag? ch1->end_graph: -1); 369 filter->field = &thisField; 370 263 371 return filter; 264 372 } … … 277 385 } 278 386 279 std::shared_ptr<COutputPin> CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 280 { 387 std::shared_ptr<COutputPin> CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 388 { 389 std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 390 std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 391 281 392 std::shared_ptr<CFieldFieldScalarArithmeticFilter> filter(new CFieldFieldScalarArithmeticFilter(gc, opId, child3->reduce())); 282 child1->reduce(gc, thisField)->connectOutput(filter, 0); 283 child2->reduce(gc, thisField)->connectOutput(filter, 1); 393 ch1->connectOutput(filter, 0); 394 ch2->connectOutput(filter, 1); 395 396 (filter->parent_filters).resize(2); 397 (filter->parent_filters)[0] = ch1; 398 (filter->parent_filters)[1] = ch2; 399 400 filter->tag = (ch2->tag || ch1->tag); 401 filter->start_graph = ch2->tag? ch2->start_graph : (ch1->tag? ch1->start_graph: -1); 402 filter->end_graph = ch2->tag? ch2->end_graph : (ch1->tag? ch1->end_graph: -1); 403 filter->field = &thisField; 284 404 return filter; 285 405 } … … 297 417 } 298 418 299 std::shared_ptr<COutputPin> CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 300 { 419 std::shared_ptr<COutputPin> CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 420 { 421 std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 422 std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 423 std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); 424 301 425 std::shared_ptr<CFieldFieldFieldArithmeticFilter> filter(new CFieldFieldFieldArithmeticFilter(gc, opId)); 302 child1->reduce(gc, thisField)->connectOutput(filter, 0); 303 child2->reduce(gc, thisField)->connectOutput(filter, 1); 304 child3->reduce(gc, thisField)->connectOutput(filter, 2); 426 std::cout<<"std::shared_ptr<CFieldFieldFieldArithmeticFilter> filter(new CFieldFieldFieldArithmeticFilter(gc, opId))" <<std::endl; 427 ch1->connectOutput(filter, 0); 428 ch2->connectOutput(filter, 1); 429 ch3->connectOutput(filter, 2); 430 431 (filter->parent_filters).resize(3); 432 (filter->parent_filters)[0] = ch1; 433 (filter->parent_filters)[1] = ch2; 434 (filter->parent_filters)[2] = ch3; 435 436 437 filter->tag = (ch1->tag || ch1->tag || ch3->tag); 438 filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: (ch3->tag? ch3->start_graph: -1)); 439 filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: (ch3->tag? ch3->end_graph: -1)); 440 filter->field = &thisField; 441 442 305 443 return filter; 306 444 } -
XIOS/dev/dev_olga/src/parse_expr/filter_expr_node.hpp
r1542 r1686 5 5 #include <boost/smart_ptr/scoped_ptr.hpp> 6 6 #include "scalar_expr_node.hpp" 7 8 #include "duration.hpp" 7 9 8 10 namespace xios … … 25 27 * \return the output pin of the filter producing the result of the expression 26 28 */ 27 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const = 0;29 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const = 0; 28 30 }; 29 31 … … 42 44 CFilterFieldExprNode(const std::string& fieldId); 43 45 44 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;46 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 45 47 46 48 private: … … 63 65 CFilterTemporalFieldExprNode(const std::string& fieldId); 64 66 65 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;67 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 66 68 67 69 private: … … 86 88 CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child); 87 89 88 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;90 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 89 91 90 92 private: … … 111 113 CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2); 112 114 113 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;115 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 114 116 115 117 private: … … 137 139 CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2); 138 140 139 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;141 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 140 142 141 143 private: … … 162 164 CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2); 163 165 164 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;166 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 165 167 166 168 private: … … 190 192 CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); 191 193 192 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;194 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 193 195 194 196 private: … … 219 221 CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); 220 222 221 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;223 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 222 224 223 225 private: … … 248 250 CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); 249 251 250 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;252 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 251 253 252 254 private: … … 278 280 CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3); 279 281 280 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;282 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 281 283 282 284 private: … … 307 309 CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); 308 310 309 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;311 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 310 312 311 313 private: … … 335 337 CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); 336 338 337 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;339 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 338 340 339 341 private: … … 364 366 CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); 365 367 366 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField ) const;368 virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 367 369 368 370 private: -
XIOS/dev/dev_olga/src/parse_expr/yacc_parser.cpp
r1158 r1686 70 70 #include "exception.hpp" 71 71 72 #include "yacc_var.hpp" 73 72 74 using namespace std; 73 75 using namespace xios; … … 84 86 size_t globalReadOffset = 0; 85 87 88 std::string *xios::yacc_globalInputText_ptr = 0; 89 86 90 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 87 91 { 92 yacc_globalInputText_ptr = &globalInputText; 93 //*yacc_globalInputText_ptr = globalInputText; 94 95 std::cout<<"========= yacc_globalInputText_ptr = "<<*yacc_globalInputText_ptr<<std::endl; 96 88 97 size_t numBytesToRead = maxBytesToRead; 89 98 size_t bytesRemaining = globalInputText.length()-globalReadOffset; -
XIOS/dev/dev_olga/src/test/test_client.f90
r1202 r1686 132 132 PRINT*,"field field_A is active ? ",xios_field_is_active("field_A") 133 133 ! CALL xios_recv_field("field", scalar) 134 DO ts=1, 4134 DO ts=1,24 135 135 CALL xios_update_calendar(ts) 136 136 CALL xios_send_field("field_A",field_A) 137 CALL xios_send_field("field_Axis",axisValue) 137 CALL xios_send_field("field_B",field_A) 138 CALL xios_send_field("field_C",field_A) 139 ! CALL xios_send_field("field_Axis",axisValue) 138 140 ! CALL xios_send_field("field_Axis",lval) 139 CALL xios_send_field("field_Domain",field_domain)140 CALL xios_send_field("field_Scalar",scalar)141 ! CALL xios_send_field("field_Domain",field_domain) 142 ! CALL xios_send_field("field_Scalar",scalar) 141 143 CALL wait_us(5000) ; 142 144 ENDDO -
XIOS/dev/dev_olga/src/tracer.cpp
r501 r1686 1 1 #include "tracer.hpp" 2 #ifdef VTRACE 2 3 #if defined(VTRACE) 4 3 5 #include <vt_user.h> 6 7 #elif defined(SCOREP) 8 9 #include <scorep/SCOREP_User.h> 10 11 #elif defined(ITAC) 12 13 #include <VT.h> 14 4 15 #endif 16 5 17 #include <string> 18 #include <map> 19 #include <iostream> 6 20 7 21 namespace xios 8 22 { 9 23 using namespace std ; 24 25 std::map<std::string,int> regionId ; 26 int count=0 ; 10 27 11 28 void traceOn(void) 12 29 { 13 #if def VTRACE30 #if defined(VTRACE) 14 31 VT_ON() ; 32 #elif defined(SCOREP) 33 SCOREP_RECORDING_ON() ; 34 #elif defined(ITAC) 35 VT_traceon() ; 15 36 #endif 16 37 } … … 18 39 void traceOff(void) 19 40 { 20 #if def VTRACE41 #if defined(VTRACE) 21 42 VT_OFF() ; 43 #elif defined(SCOREP) 44 SCOREP_RECORDING_OFF() 45 #elif defined(ITAC) 46 VT_traceoff() ; 22 47 #endif 23 48 } … … 25 50 void traceBegin(const string& name) 26 51 { 27 #if def VTRACE52 #if defined(VTRACE) 28 53 VT_USER_START(name.c_str()) ; 54 #elif defined(SCOREP) 55 SCOREP_USER_REGION_BY_NAME_BEGIN(name.c_str(),SCOREP_USER_REGION_TYPE_COMMON) 56 57 #elif defined(ITAC) 58 int classhandle ; 59 auto it = regionId.find(name); 60 if (it==regionId.end()) 61 { 62 classhandle=count ; 63 count++ ; 64 VT_symdef (classhandle, name.c_str(), "XIOS") ; 65 regionId[name]=classhandle; 66 } 67 else classhandle = it->second ; 68 VT_begin(classhandle) ; 69 cout<<"VT_begin "<<name<<" "<<classhandle<<endl ; 70 29 71 #endif 72 30 73 } 31 74 32 75 void traceEnd(const string& name) 33 76 { 34 #if def VTRACE77 #if defined (VTRACE) 35 78 VT_USER_END(name.c_str()) ; 79 #elif defined(SCOREP) 80 SCOREP_USER_REGION_BY_NAME_END(name.c_str()) 81 #elif defined(ITAC) 82 int classhandle ; 83 auto it = regionId.find(name); 84 if (it==regionId.end()) 85 { 86 return ; 87 VT_classdef (name.c_str(), &classhandle) ; 88 regionId[name]=classhandle; 89 } 90 else classhandle = it->second ; 91 VT_end(classhandle) ; 92 cout<<"VT_end "<<name<<" "<<classhandle<<endl ; 93 36 94 #endif 37 95 } 38 96 97 39 98 // void marker(const string& name,const string& text) ; 40 99 -
XIOS/dev/dev_olga/src/transformation/Functions/average_reduction.hpp
r1260 r1686 33 33 virtual ~CAverageReductionAlgorithm() {} 34 34 35 virtual StdString getName() {return "Average reduction";} 36 35 37 protected: 36 38 CArray<double,1> weights_; -
XIOS/dev/dev_olga/src/transformation/Functions/extract.hpp
r1260 r1686 31 31 virtual ~CExtractReductionAlgorithm() {} 32 32 33 virtual StdString getName() {return "Extract reduction";} 34 33 35 public: 34 36 static bool registerTrans(); -
XIOS/dev/dev_olga/src/transformation/Functions/max_reduction.hpp
r1260 r1686 31 31 virtual ~CMaxReductionAlgorithm() {} 32 32 33 virtual StdString getName() {return "Max reduction";} 34 33 35 public: 34 36 static bool registerTrans(); -
XIOS/dev/dev_olga/src/transformation/Functions/min_reduction.hpp
r1260 r1686 31 31 virtual ~CMinReductionAlgorithm() {} 32 32 33 virtual StdString getName() {return "Min reduction";} 34 33 35 public: 34 36 static bool registerTrans(); -
XIOS/dev/dev_olga/src/transformation/Functions/reduction.hpp
r1260 r1686 57 57 virtual ~CReductionAlgorithm() {} 58 58 59 virtual StdString getName() {return "Reduction";} 60 59 61 protected: 60 62 typedef CReductionAlgorithm* (*CreateOperationCallBack)(); -
XIOS/dev/dev_olga/src/transformation/Functions/sum_reduction.hpp
r1260 r1686 31 31 virtual ~CSumReductionAlgorithm() {} 32 32 33 virtual StdString getName() {return "Sum reduction";} 34 33 35 public: 34 36 static bool registerTrans(); -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_duplicate_scalar.hpp
r1314 r1686 33 33 static bool registerTrans(); 34 34 35 virtual StdString getName() {return "Axis Trans. Filter \\n Duplicate Scalar";} 36 35 37 protected: 36 38 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_extract.hpp
r1558 r1686 27 27 28 28 static bool registerTrans(); 29 30 virtual StdString getName() {return "Axis Trans. Filter \\n Extract";} 31 29 32 protected: 30 33 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_extract_domain.hpp
r1260 r1686 39 39 40 40 static bool registerTrans(); 41 42 virtual StdString getName() {return "Axis Trans. Filter \\n Extract Domain";} 43 41 44 protected: 42 45 enum ExtractDirection { -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_interpolate.hpp
r933 r1686 32 32 33 33 static bool registerTrans(); 34 35 virtual StdString getName() {return "Axis Trans. Filter \\n Interpolation";} 36 34 37 protected: 35 38 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_inverse.hpp
r933 r1686 31 31 static bool registerTrans(); 32 32 33 virtual StdString getName() {return "Axis Trans. Filter \\n Inverse";} 34 33 35 protected: 34 36 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_reduce_axis.hpp
r1314 r1686 39 39 40 40 static bool registerTrans(); 41 42 virtual StdString getName() {return "Axis Trans. Filter \\n Reduce Axis";} 41 43 protected: 42 44 -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_reduce_domain.hpp
r1299 r1686 40 40 41 41 static bool registerTrans(); 42 43 virtual StdString getName() {return "Axis Trans. Filter \\n Reduce Domain";} 44 42 45 protected: 43 46 enum ReduceDirection { -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_temporal_splitting.hpp
r1275 r1686 34 34 static bool registerTrans(); 35 35 36 virtual StdString getName() {return "Axis Trans. Filter \\n Temporal Splitting";} 37 36 38 protected: 37 39 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_transformation.hpp
r1275 r1686 31 31 virtual ~CAxisAlgorithmTransformation(); 32 32 33 virtual StdString getName() {return "Axis Trans. Filter \\n Transformation";} 34 33 35 protected: 34 36 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_zoom.hpp
r1559 r1686 27 27 28 28 static bool registerTrans(); 29 30 virtual StdString getName() {return "Axis Trans. Filter \\n Zoom";} 31 29 32 protected: 30 33 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_compute_connectivity.hpp
r944 r1686 28 28 29 29 static bool registerTrans(); 30 31 virtual StdString getName() {return "Domain Trans. Filter \\n Compute Connectivity";} 32 30 33 protected: 31 34 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_expand.hpp
r1158 r1686 28 28 29 29 static bool registerTrans(); 30 31 virtual StdString getName() {return "Domain Trans. Filter \\n Expand";} 30 32 31 33 protected: -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_extract.hpp
r1549 r1686 23 23 24 24 static bool registerTrans(); 25 26 virtual StdString getName() {return "Domain Trans. Filter \\n Extract";} 25 27 protected: 26 28 void updateDomainAttributes(); -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_generate_rectilinear.hpp
r1410 r1686 33 33 virtual ~CDomainAlgorithmGenerateRectilinear() {} 34 34 35 virtual StdString getName() {return "Domain Trans. Filter \\n Generate Rectilinear";} 36 35 37 protected: 36 38 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.hpp
r1480 r1686 39 39 40 40 static bool registerTrans(); 41 42 virtual StdString getName() {return "Domain Trans. Filter \\n Interpolation";} 43 41 44 protected: 42 45 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_reorder.hpp
r1457 r1686 26 26 static bool registerTrans(); 27 27 28 virtual StdString getName() {return "Domain Trans. Filter \\n Reorder";} 29 28 30 protected: 29 31 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_transformation.hpp
r888 r1686 27 27 virtual ~CDomainAlgorithmTransformation(); 28 28 29 virtual StdString getName() {return "Domain Trans. Filter \\n Transformation";} 30 29 31 protected: 30 32 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&); -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_zoom.hpp
r1553 r1686 23 23 24 24 static bool registerTrans(); 25 26 virtual StdString getName() {return "Domain Trans. Filter \\n Zoom";} 25 27 protected: 26 28 void updateDomainAttributes(); -
XIOS/dev/dev_olga/src/transformation/generic_algorithm_transformation.hpp
r1653 r1686 73 73 std::vector<bool>& flagInitial, 74 74 bool ignoreMissingValue, bool firstPass); 75 76 virtual StdString getName() {return "Generic Trans. Filter";} 75 77 76 78 /*! -
XIOS/dev/dev_olga/src/transformation/scalar_algorithm_extract_axis.hpp
r1260 r1686 39 39 static bool registerTrans(); 40 40 41 virtual StdString getName() {return "Scalar Trans. Filter \\n Extract Axis";} 42 41 43 protected: 42 44 int pos_; -
XIOS/dev/dev_olga/src/transformation/scalar_algorithm_reduce_axis.cpp
r1612 r1686 13 13 #include "grid.hpp" 14 14 #include "grid_transformation_factory_impl.hpp" 15 #include "reduction.hpp"16 15 17 16 #include "reduction.hpp" -
XIOS/dev/dev_olga/src/transformation/scalar_algorithm_reduce_axis.hpp
r1260 r1686 40 40 41 41 static bool registerTrans(); 42 43 virtual StdString getName() {return "Scalar Trans. Filter \\n Reduce Axis";} 44 42 45 protected: 43 46 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/scalar_algorithm_reduce_domain.hpp
r1313 r1686 40 40 41 41 static bool registerTrans(); 42 43 virtual StdString getName() {return "Scalar Trans. Filter \\n Reduce Domain";} 44 42 45 protected: 43 46 bool local ; -
XIOS/dev/dev_olga/src/transformation/scalar_algorithm_reduce_scalar.hpp
r1314 r1686 35 35 36 36 static bool registerTrans(); 37 38 virtual StdString getName() {return "Scalar Trans. Filter \\n Reduce Scalar";} 39 37 40 protected: 38 41 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/transformation/scalar_algorithm_transformation.hpp
r888 r1686 31 31 virtual ~CScalarAlgorithmTransformation(); 32 32 33 virtual StdString getName() {return "Scalar Trans. Filter \\n Transformation";} 34 33 35 protected: 34 36 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); -
XIOS/dev/dev_olga/src/workflow_graph.cpp
r1654 r1686 4 4 { 5 5 6 std::unordered_map <StdString, vector <int > > CWorkflowGraph::mapFieldToFilters; 7 std::unordered_map <int, StdString> CWorkflowGraph::mapFilters; 8 std::unordered_map <int,vector<Time> > CWorkflowGraph::mapFilterTimestamps; 9 set<Time> CWorkflowGraph::timestamps; 6 std::unordered_map <int, graph_info_box_node> *CWorkflowGraph::mapFilters_ptr_with_info = 0; 7 8 std::unordered_map <int, graph_info_box_edge > *CWorkflowGraph::mapFieldToFilters_ptr_with_info = 0; 9 10 std::unordered_map <size_t, int> *CWorkflowGraph::mapHashFilterID_ptr = 0; 11 10 12 11 13 vector <StdString> CWorkflowGraph::filters; 12 14 vector <StdString> CWorkflowGraph::fields; 13 15 vector <pair<int, int> > CWorkflowGraph::fieldsToFilters; 16 17 bool CWorkflowGraph::build_begin = false; 14 18 15 19 CWorkflowGraph::CWorkflowGraph() … … 22 26 TRY 23 27 { 24 // Create a list of filters (graph nodes) 25 size_t filterIdx = 0; 26 filters.resize(mapFilters.size()); 27 for (auto it=mapFilters.begin(); it != mapFilters.end(); it++) 28 29 if(mapFilters_ptr_with_info==0 || mapFieldToFilters_ptr_with_info==0) 30 std::cout<<"No graph information provided"<<std::endl; 31 32 else // Create a list of filters (graph nodes) 28 33 { 29 filters[it->first]=it->second; 30 } 34 size_t filterIdx = 0; 35 filters.resize(mapFilters_ptr_with_info->size()); 36 fieldsToFilters.clear(); 37 fields.clear(); 38 for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) 39 { 40 filters[it->first]=it->second.filter_name; 41 } 31 42 32 // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) 33 for (auto it=mapFieldToFilters.begin(); it != mapFieldToFilters.end(); it++) 34 { 35 for (size_t i = 0; i < (it->second.size() - 1); i+=2) 43 // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) 44 for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) 36 45 { 37 fieldsToFilters.push_back(make_pair(it->second [i],it->second[i+1]));38 fields.push_back(it-> first);46 fieldsToFilters.push_back(make_pair(it->second.from,it->second.to)); 47 fields.push_back(it->second.field_id + " "+it->second.date.toString()); 39 48 } 40 49 } … … 42 51 CATCH 43 52 53 54 55 56 /*! 57 * Reorganize information collected by XIOS for visualization. 58 */ 59 void CWorkflowGraph::buildStaticWorkflow_with_info() 60 TRY 61 { 62 // showStaticWorkflow(); 63 64 if(mapFilters_ptr_with_info==0 || mapFieldToFilters_ptr_with_info==0) 65 std::cout<<"No graph information provided"<<std::endl; 66 67 else // Create a list of filters (graph nodes) 68 { 69 size_t filterIdx = 0; 70 filters.resize(mapFilters_ptr_with_info->size()); 71 fieldsToFilters.clear(); 72 fields.clear(); 73 for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) 74 { 75 // std::cout<<"it->first = "<<it->first<<std::endl; 76 filters[it->first]=it->second.filter_name; 77 } 78 79 // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) 80 for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) 81 { 82 fieldsToFilters.push_back(make_pair(it->second.from,it->second.to)); 83 fields.push_back(it->second.field_id + " "+it->second.date.toString()); 84 } 85 } 86 } 87 CATCH 88 89 90 91 void CWorkflowGraph::showStaticWorkflow() 92 TRY 93 { 94 if(mapFilters_ptr_with_info!=0 && !mapFilters_ptr_with_info->empty()) 95 for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) 96 { 97 std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].filter_name="<<it->second.filter_name<<std::endl; 98 std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].filter_class="<<it->second.filter_class<<std::endl; 99 std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].filter_fillled="<<it->second.filter_filled<<std::endl; 100 std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].expected_entry_nb="<<it->second.expected_entry_nb<<std::endl; 101 std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].date="<<it->second.date<<std::endl; 102 std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].timestamp="<<it->second.timestamp<<std::endl; 103 std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].transform_type="<<it->second.transform_type<<std::endl; 104 } 105 else std::cout<<"mapFilters_ptr_with_info empty"<<std::endl; 106 107 if(mapFieldToFilters_ptr_with_info!=0 && !mapFieldToFilters_ptr_with_info->empty()) 108 for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) 109 { 110 std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].from = "<<it->second.from<<std::endl; 111 std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].to = "<<it->second.to<<std::endl; 112 std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].field_id = "<<it->second.field_id<<std::endl; 113 std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].field_name = "<<it->second.field_name<<std::endl; 114 std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].date = "<<it->second.date<<std::endl; 115 116 } 117 else std::cout<<"mapFieldToFilters_ptr_with_info empty"<<std::endl; 118 119 120 } 121 CATCH 122 123 124 void CWorkflowGraph::addNode(int nodeID, StdString filterName, int filterClass, bool filterFilled, int entry_nb, CDataPacketPtr packet) 125 TRY 126 { 127 (*mapFilters_ptr_with_info)[nodeID].filter_name = filterName; 128 (*mapFilters_ptr_with_info)[nodeID].filter_class = filterClass; 129 (*mapFilters_ptr_with_info)[nodeID].filter_filled = filterFilled; 130 (*mapFilters_ptr_with_info)[nodeID].expected_entry_nb = entry_nb; 131 (*mapFilters_ptr_with_info)[nodeID].date = packet->date; 132 (*mapFilters_ptr_with_info)[nodeID].timestamp = packet->timestamp; 133 } 134 CATCH 135 136 137 138 void CWorkflowGraph::addEdge(int edgeID, int toID, CDataPacketPtr packet) 139 TRY 140 { 141 (*mapFieldToFilters_ptr_with_info)[edgeID].from = packet->src_filterID; 142 (*mapFieldToFilters_ptr_with_info)[edgeID].to = toID; 143 (*mapFieldToFilters_ptr_with_info)[edgeID].field_id = packet->field->getId(); 144 (*mapFieldToFilters_ptr_with_info)[edgeID].field_name = packet->field->name; 145 (*mapFieldToFilters_ptr_with_info)[edgeID].grid_id = packet->field->grid->getId(); 146 (*mapFieldToFilters_ptr_with_info)[edgeID].date = packet->date; 147 (*mapFieldToFilters_ptr_with_info)[edgeID].timestamp = packet->timestamp; 148 (*mapFieldToFilters_ptr_with_info)[edgeID].field = packet->field; 149 (*mapFieldToFilters_ptr_with_info)[edgeID].attributes = packet->field->record4graphXiosAttributes(); 150 } 151 CATCH 152 153 154 void CWorkflowGraph::allocNodeEdge() 155 TRY 156 { 157 if(mapFilters_ptr_with_info==0) mapFilters_ptr_with_info = new std::unordered_map <int, graph_info_box_node>; 158 if(mapFieldToFilters_ptr_with_info==0) mapFieldToFilters_ptr_with_info = new std::unordered_map <int, graph_info_box_edge >; 159 if(mapHashFilterID_ptr==0) mapHashFilterID_ptr = new std::unordered_map <size_t, int >; 160 } 161 CATCH 162 44 163 } -
XIOS/dev/dev_olga/src/workflow_graph.hpp
r1653 r1686 4 4 #include "xios_spl.hpp" 5 5 #include "field.hpp" 6 #include "grid.hpp" 6 7 #include "garbage_collector.hpp" 8 #include "date.hpp" 9 #include "duration.hpp" 10 7 11 8 12 namespace xios 9 13 { 14 class CField; 15 16 struct graph_info_box_node 17 { 18 19 StdString filter_name; 20 int filter_class; 21 bool filter_filled; 22 int expected_entry_nb; 23 CDate date; 24 Time timestamp; 25 StdString transform_type; 26 StdString attributes; 27 StdString field_id; 28 bool inputs_complete; 29 int filter_tag; 30 int clusterID; 31 int distance; 32 }; 33 34 struct graph_info_box_edge 35 { 36 int from; 37 int to; 38 StdString field_id; 39 StdString field_name; 40 StdString grid_id; 41 CDate date; 42 Time timestamp; 43 CField *field; 44 StdString attributes; 45 46 }; 10 47 11 48 class CWorkflowGraph … … 21 58 * It is filled up during reconstruction of a workflow (in function CField::buildFilterGraph()). 22 59 */ 23 static std::unordered_map <StdString, vector <int> > mapFieldToFilters; 60 // static std::unordered_map <StdString, vector <int> > *mapFieldToFilters_ptr; 61 // #pragma omp threadprivate(mapFieldToFilters_ptr) 24 62 25 /*! Map between filter ids and filter types.26 * It is filled up during reconstruction of a workflow (in function CField::buildFilterGraph()).27 */28 static std::unordered_map <int, StdString> mapFilters;29 63 30 /*! Map between filters and timestamps.31 * Timestamps are added into the map at the exit of a filter (in function COutputPin::onOutputReady)32 */33 static std::unordered_map <int, vector<Time> > mapFilterTimestamps;34 64 35 /*! List of timestamps. 36 * Timestamps are added at the exit of a filter (in function COutputPin::onOutputReady) 37 */ 38 static set<Time> timestamps; 65 static std::unordered_map <int, graph_info_box_node> *mapFilters_ptr_with_info; 66 67 static std::unordered_map <int, graph_info_box_edge> *mapFieldToFilters_ptr_with_info; 68 69 static std::unordered_map <size_t, int> *mapHashFilterID_ptr; 70 71 72 static bool build_begin; 73 74 static void addNode(int nodeID, StdString filterName, int filter_class, bool filter_filled, int entry_nb, CDataPacketPtr packet); 75 static void addEdge(int edgeID, int toID, CDataPacketPtr packet); 76 static void allocNodeEdge(); 39 77 40 78 private: … … 50 88 51 89 static void buildStaticWorkflow(); 90 static void buildStaticWorkflow_with_info(); 91 static void showStaticWorkflow(); 92 93 52 94 53 95
Note: See TracChangeset
for help on using the changeset viewer.