- Timestamp:
- 01/22/21 12:00:29 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_graph/src/filter/ternary_arithmetic_filter.cpp
r1686 r2019 1 1 #include "ternary_arithmetic_filter.hpp" 2 #include "workflow_graph.hpp"3 #include "yacc_var.hpp"4 #include "file.hpp"5 2 6 3 namespace xios … … 11 8 , value1(value1) 12 9 , value2(value2) 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 } 10 { /* Nothing to do */ }; 75 11 76 12 CDataPacketPtr CScalarScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 80 16 packet->timestamp = data[0]->timestamp; 81 17 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;90 18 91 19 if (packet->status == CDataPacket::NO_ERROR) … … 100 28 , value1(value1) 101 29 , value2(value2) 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 } 30 { /* Nothing to do */ }; 164 31 165 32 CDataPacketPtr CScalarFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 169 36 packet->timestamp = data[0]->timestamp; 170 37 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;179 38 180 39 if (packet->status == CDataPacket::NO_ERROR) … … 188 47 , op(operatorExpr.getOpScalarFieldField(op)) 189 48 , value(value) 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 } 49 { /* Nothing to do */ }; 267 50 268 51 CDataPacketPtr CScalarFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 272 55 packet->timestamp = data[0]->timestamp; 273 56 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;282 57 283 58 if (data[0]->status != CDataPacket::NO_ERROR) … … 300 75 , value1(value1) 301 76 , value2(value2) 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 } 77 { /* Nothing to do */ }; 364 78 365 79 CDataPacketPtr CFieldScalarScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 369 83 packet->timestamp = data[0]->timestamp; 370 84 packet->status = data[0]->status; 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 85 380 86 if (packet->status == CDataPacket::NO_ERROR) … … 389 95 , op(operatorExpr.getOpFieldScalarField(op)) 390 96 , value(value) 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 } 97 { /* Nothing to do */ }; 468 98 469 99 CDataPacketPtr CFieldScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 473 103 packet->timestamp = data[0]->timestamp; 474 104 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;483 105 484 106 if (data[0]->status != CDataPacket::NO_ERROR) … … 498 120 , op(operatorExpr.getOpFieldFieldScalar(op)) 499 121 , value(value) 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 } 122 { /* Nothing to do */ }; 578 123 579 124 CDataPacketPtr CFieldFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 583 128 packet->timestamp = data[0]->timestamp; 584 129 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;593 130 594 131 if (data[0]->status != CDataPacket::NO_ERROR) … … 608 145 : CFilter(gc, 3, this) 609 146 , op(operatorExpr.getOpFieldFieldField(op)) 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 } 147 { /* Nothing to do */ }; 700 148 701 149 CDataPacketPtr CFieldFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) … … 705 153 packet->timestamp = data[0]->timestamp; 706 154 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;715 155 716 156 if (data[0]->status != CDataPacket::NO_ERROR)
Note: See TracChangeset
for help on using the changeset viewer.