- Timestamp:
- 05/29/19 13:58:48 (5 years ago)
- Location:
- XIOS/dev/dev_trunk_omp/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_omp/src/cxios.cpp
r1669 r1670 357 357 } 358 358 } 359 -
XIOS/dev/dev_trunk_omp/src/filter/file_writer_filter.cpp
r1668 r1670 16 16 if (buildWorkflowGraph) 17 17 { 18 filterId = InvalidableObject::count; 19 InvalidableObject::count++; 18 if(InvalidableObject::count_ptr == 0) InvalidableObject::count_ptr = new std::map< StdString, int>; 19 if(InvalidableObject::count_ptr->find(CWorkflowGraph::my_filename) == InvalidableObject::count_ptr->end()) 20 { 21 (*InvalidableObject::count_ptr)[CWorkflowGraph::my_filename] = 0; 22 } 23 //filterId = InvalidableObject::count; 24 filterId = (*InvalidableObject::count_ptr)[CWorkflowGraph::my_filename]; 25 printf("file_writer_filter ================ filterId = %d\n", (*InvalidableObject::count_ptr)[CWorkflowGraph::my_filename]); 26 (*InvalidableObject::count_ptr)[CWorkflowGraph::my_filename]++; 27 //InvalidableObject::count++; 20 28 } 21 29 } -
XIOS/dev/dev_trunk_omp/src/filter/garbage_collector.hpp
r1668 r1670 20 20 */ 21 21 void virtual invalidate(Time timestamp) = 0; 22 23 static std::map<StdString, int> *count_ptr; 24 #pragma omp threadprivate(count_ptr) 22 25 23 26 static int count; //!< Counter used to identify a filter in case building workflow graph -
XIOS/dev/dev_trunk_omp/src/filter/output_pin.cpp
r1668 r1670 12 12 if (buildWorkflowGraph) 13 13 { 14 filterId = InvalidableObject::count; 15 InvalidableObject::count++; 14 if(InvalidableObject::count_ptr == 0) InvalidableObject::count_ptr = new std::map< StdString, int>; 15 if(InvalidableObject::count_ptr->find(CWorkflowGraph::my_filename) == InvalidableObject::count_ptr->end()) 16 { 17 (*InvalidableObject::count_ptr)[CWorkflowGraph::my_filename] = 0; 18 } 19 20 filterId = (*InvalidableObject::count_ptr)[CWorkflowGraph::my_filename]; 21 printf("output_pin ================ filterId = %d, CWorkflowGraph::my_filename = %s\n", (*InvalidableObject::count_ptr)[CWorkflowGraph::my_filename], CWorkflowGraph::my_filename.c_str()); 22 (*InvalidableObject::count_ptr)[CWorkflowGraph::my_filename]++; 23 24 //filterId = InvalidableObject::count; 25 //InvalidableObject::count++; 16 26 } 17 27 } … … 42 52 if (buildWorkflowGraph) 43 53 { 44 if(CWorkflowGraph::mapFilterTimestamps_ptr==0) CWorkflowGraph::mapFilterTimestamps_ptr = new std::unordered_map <int, vector<Time> >;45 if(CWorkflowGraph::timestamps_ptr==0) CWorkflowGraph::timestamps_ptr = new s et<Time>;46 (*CWorkflowGraph::mapFilterTimestamps_ptr)[ this->getFilterId()].push_back(packet->timestamp);47 CWorkflowGraph::timestamps_ptr->insert(packet->timestamp);54 if(CWorkflowGraph::mapFilterTimestamps_ptr==0) CWorkflowGraph::mapFilterTimestamps_ptr = new std::unordered_map<StdString, std::unordered_map <int, vector<Time> > >; 55 if(CWorkflowGraph::timestamps_ptr==0) CWorkflowGraph::timestamps_ptr = new std::unordered_map< StdString, set<Time> >; 56 (*CWorkflowGraph::mapFilterTimestamps_ptr)[CWorkflowGraph::my_filename][this->getFilterId()].push_back(packet->timestamp); 57 (*CWorkflowGraph::timestamps_ptr)[CWorkflowGraph::my_filename].insert(packet->timestamp); 48 58 } 49 59 -
XIOS/dev/dev_trunk_omp/src/filter/spatial_transform_filter.cpp
r1669 r1670 56 56 if (buildWorkflowGraph) 57 57 { 58 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;59 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;58 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >; 59 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 60 60 int filterOut = (std::static_pointer_cast<COutputPin>(filter))->getFilterId(); 61 61 int filterIn = (std::static_pointer_cast<COutputPin>(firstFilter))->getFilterId(); 62 62 // PASS field's id here 63 (*CWorkflowGraph::mapFieldToFilters_ptr)[ "XXX"].push_back(filterOut);64 (*CWorkflowGraph::mapFieldToFilters_ptr)[ "XXX"].push_back(filterIn);65 (*CWorkflowGraph::mapFilters_ptr)[ filterOut] = "Spatial transform filter";66 (*CWorkflowGraph::mapFilters_ptr)[ filterIn] = "Spatial transform filter";67 std::cout<<"CSpatialTransformFilter::CSpatialTransformFilter CWorkflowGraph::mapFieldToFilters_ptr->size = "<<CWorkflowGraph::mapFieldToFilters_ptr->size()<<std::endl;63 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename]["XXX"].push_back(filterOut); 64 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename]["XXX"].push_back(filterIn); 65 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = "Spatial transform filter"; 66 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = "Spatial transform filter"; 67 //std::cout<<"CSpatialTransformFilter::CSpatialTransformFilter CWorkflowGraph::mapFieldToFilters_ptr->size = "<<CWorkflowGraph::mapFieldToFilters_ptr->size()<<std::endl; 68 68 } 69 69 } -
XIOS/dev/dev_trunk_omp/src/graphviz.cpp
r1669 r1670 11 11 * 12 12 */ 13 14 13 15 void CGraphviz::buildStaticWorkflowGraph() 14 16 TRY … … 16 18 if (CWorkflowGraph::mapFieldToFilters_ptr !=0 && !CWorkflowGraph::mapFieldToFilters_ptr->empty()) 17 19 { 18 CWorkflowGraph::buildStaticWorkflow(); 20 int NB_graph_files = CWorkflowGraph::mapFieldToFilters_ptr->size(); 21 std::unordered_map < StdString, std::unordered_map <StdString, vector <int> > >::iterator it; 22 for(it=CWorkflowGraph::mapFieldToFilters_ptr->begin(); it!=CWorkflowGraph::mapFieldToFilters_ptr->end(); it++) 23 { 24 CWorkflowGraph::buildStaticWorkflow_forfile(it->first); 19 25 20 typedef boost::property<boost::edge_name_t, std::string> EdgeProperty;21 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::no_property, EdgeProperty> Graph;26 typedef boost::property<boost::edge_name_t, std::string> EdgeProperty; 27 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::no_property, EdgeProperty> Graph; 22 28 23 // Input 1: nodes (=filters)24 vector<StdString>& nodes = CWorkflowGraph::filters;25 const int nbNodes = nodes.size();29 // Input 1: nodes (=filters) 30 vector<StdString>& nodes = CWorkflowGraph::filters; 31 const int nbNodes = nodes.size(); 26 32 27 // Input 2: edges (=fields)28 vector<StdString>& edges = CWorkflowGraph::fields;33 // Input 2: edges (=fields) 34 vector<StdString>& edges = CWorkflowGraph::fields; 29 35 30 // Input 3: nodes to edges connectivity31 vector<pair<int, int> >& nodesToEdges = CWorkflowGraph::fieldsToFilters;32 const int nbEdges = nodesToEdges.size();36 // Input 3: nodes to edges connectivity 37 vector<pair<int, int> >& nodesToEdges = CWorkflowGraph::fieldsToFilters; 38 const int nbEdges = nodesToEdges.size(); 33 39 34 // Declare a graph object, adding the edges and edge properties35 Graph g(nbNodes);36 for (int j = 0; j < nbEdges; ++j)37 {38 graph_traits<Graph>::edge_descriptor e;39 bool inserted;40 boost::tie(e, inserted) = boost::add_edge(nodesToEdges[j].first, nodesToEdges[j].second, edges[j], g);41 }40 // Declare a graph object, adding the edges and edge properties 41 Graph g(nbNodes); 42 for (int j = 0; j < nbEdges; ++j) 43 { 44 graph_traits<Graph>::edge_descriptor e; 45 bool inserted; 46 boost::tie(e, inserted) = boost::add_edge(nodesToEdges[j].first, nodesToEdges[j].second, edges[j], g); 47 } 42 48 43 std::for_each(vertices(g).first, vertices(g).second, exercise_vertex<Graph>(g));49 std::for_each(vertices(g).first, vertices(g).second, exercise_vertex<Graph>(g)); 44 50 45 std::map<std::string,std::string> graph_attr, vertex_attr, edge_attr;46 graph_attr["size"] = "5,5";47 graph_attr["rankdir"] = "LR";48 graph_attr["ratio"] = "fill";49 vertex_attr["shape"] = "record";50 vertex_attr["width"] = "2.2";51 vertex_attr["fontsize"] = "16";51 std::map<std::string,std::string> graph_attr, vertex_attr, edge_attr; 52 graph_attr["size"] = "5,5"; 53 graph_attr["rankdir"] = "LR"; 54 graph_attr["ratio"] = "fill"; 55 vertex_attr["shape"] = "record"; 56 vertex_attr["width"] = "2.2"; 57 vertex_attr["fontsize"] = "16"; 52 58 53 const std::string filename = "graph.dot";54 std::ofstream file (filename.c_str());59 const std::string filename = it->first + ".static_graph.dot"; 60 std::ofstream file (filename.c_str()); 55 61 56 boost::write_graphviz(file, g,62 boost::write_graphviz(file, g, 57 63 boost::make_label_writer(&nodes[0]), 58 64 boost::make_label_writer(get(edge_name, g)), 59 65 boost::make_graph_attributes_writer(graph_attr, vertex_attr, edge_attr)); 60 66 } 61 67 } 62 68 } … … 72 78 CATCH 73 79 } 80 -
XIOS/dev/dev_trunk_omp/src/graphviz.hpp
r1669 r1670 33 33 34 34 #endif 35 -
XIOS/dev/dev_trunk_omp/src/node/field.cpp
r1669 r1670 1197 1197 if (buildWorkflowGraph) 1198 1198 { 1199 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;1200 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;1199 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >; 1200 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 1201 1201 int filterOut = filter->getFilterId(); 1202 1202 int filterIn = (std::static_pointer_cast<COutputPin>(filters.second))->getFilterId(); 1203 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterOut); 1204 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterIn); 1205 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = filter->GetName(); 1206 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = filters.second->GetName(); 1203 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut); 1204 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn); 1205 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = filter->GetName(); 1206 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = filters.second->GetName(); 1207 std::cout<<"CField::buildFilterGraph1 filterIn["<<filterIn<< "] = "<<filters.second->GetName()<< std::endl; 1208 std::cout<<"CField::buildFilterGraph1 filterOut["<<filterOut<< "] = "<<filter->GetName()<< std::endl; 1207 1209 } 1208 1210 filter = filters.second; … … 1232 1234 if (buildWorkflowGraph) 1233 1235 { 1234 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1235 (*CWorkflowGraph::mapFilters_ptr)[instantDataFilter->getFilterId()] = instantDataFilter->GetName(); 1236 //CWorkflowGraph::my_filename = file->name; 1237 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >; 1238 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][instantDataFilter->getFilterId()] = instantDataFilter->GetName(); 1239 std::cout<<"CField::buildFilterGraph1.else filter["<<instantDataFilter->getFilterId()<< "] = "<<instantDataFilter->GetName()<< std::endl; 1236 1240 } 1237 1241 } … … 1254 1258 if (buildWorkflowGraph) 1255 1259 { 1256 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1257 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 1260 CWorkflowGraph::my_filename = file->name; 1261 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >; 1262 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 1258 1263 int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId(); 1259 1264 int filterIn = fileWriterFilter->getFilterId(); 1260 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterOut); 1261 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterIn); 1262 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = "Temporal filter"; 1263 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = fileWriterFilter->GetName(); 1264 std::cout<<"CField::buildFilterGraph this->getId() = "<<this->getId() <<" ; this->getOId() = "<<this->getOId()<< std::endl; 1265 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut); 1266 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn); 1267 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = "Temporal filter"; 1268 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = fileWriterFilter->GetName(); 1269 std::cout<<"CField::buildFilterGraph2 filterIn["<<filterIn<< "] = "<<fileWriterFilter->GetName()<< std::endl; 1270 std::cout<<"CField::buildFilterGraph2 filterOut["<<filterOut<< "] = "<<"Temporal filter"<< std::endl; 1265 1271 } 1266 1272 } … … 1270 1276 CATCH_DUMP_ATTR 1271 1277 1278 void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput, StdString output_filename) 1279 TRY 1280 { 1281 CWorkflowGraph::my_filename = output_filename; 1282 if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 1283 if (!isGridChecked) checkGridOfEnabledFields(); 1284 1285 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1286 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1287 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1288 1289 CContext* context = CContext::getCurrent(); 1290 bool hasWriterServer = context->hasServer && !context->hasClient; 1291 bool hasIntermediateServer = context->hasServer && context->hasClient; 1292 1293 if (hasWriterServer) 1294 { 1295 if (!instantDataFilter) 1296 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false)); 1297 1298 1299 // If the field data is to be read by the client or/and written to a file 1300 if (enableOutput && !storeFilter && !fileWriterFilter) 1301 { 1302 if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 1303 { 1304 fileServerWriterFilter = std::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this)); 1305 instantDataFilter->connectOutput(fileServerWriterFilter, 0); 1306 } 1307 } 1308 } 1309 else if (hasIntermediateServer) 1310 { 1311 if (!instantDataFilter) 1312 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, false)); 1313 1314 // If the field data is to be read by the client or/and written to a file 1315 if (enableOutput && !storeFilter && !fileWriterFilter) 1316 { 1317 if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 1318 { 1319 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 1320 instantDataFilter->connectOutput(fileWriterFilter, 0); 1321 } 1322 } 1323 } 1324 else 1325 { 1326 // Start by building a filter which can provide the field's instant data 1327 if (!instantDataFilter) 1328 { 1329 // Check if we have an expression to parse 1330 if (hasExpression()) 1331 { 1332 boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0')); 1333 std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this); 1334 1335 // Check if a spatial transformation is needed 1336 if (!field_ref.isEmpty()) 1337 { 1338 CField* fieldRef = CField::get(field_ref); 1339 fieldRef->build_workflow_graph.setValue(buildWorkflowGraph); 1340 CGrid* gridRef = fieldRef->grid; 1341 1342 if (grid && grid != gridRef && grid->hasTransform()) 1343 { 1344 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, 1345 detectMissingValues, defaultValue, buildWorkflowGraph); 1346 1347 filter->connectOutput(filters.first, 0); 1348 1349 if (buildWorkflowGraph) 1350 { 1351 CWorkflowGraph::my_filename = output_filename; 1352 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >; 1353 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 1354 int filterOut = filter->getFilterId(); 1355 int filterIn = (std::static_pointer_cast<COutputPin>(filters.second))->getFilterId(); 1356 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut); 1357 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn); 1358 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = filter->GetName(); 1359 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = filters.second->GetName(); 1360 std::cout<<"***CField::buildFilterGraph1 filterIn["<<filterIn<< "] = "<<filters.second->GetName()<< std::endl; 1361 std::cout<<"***CField::buildFilterGraph1 filterOut["<<filterOut<< "] = "<<filter->GetName()<< std::endl; 1362 } 1363 filter = filters.second; 1364 } 1365 } 1366 1367 instantDataFilter = filter; 1368 } 1369 // Check if we have a reference on another field 1370 else if (!field_ref.isEmpty()) 1371 { 1372 CField::get(field_ref)->build_workflow_graph.setValue(buildWorkflowGraph); 1373 //instantDataFilter = getFieldReference2(gc, output_filename); 1374 instantDataFilter = getFieldReference(gc, output_filename); 1375 } 1376 // Check if the data is to be read from a file 1377 else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 1378 { 1379 checkTimeAttributes(); 1380 instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 1381 detectMissingValues, defaultValue, buildWorkflowGraph)); 1382 } 1383 else // The data might be passed from the model 1384 { 1385 if (check_if_active.isEmpty()) check_if_active = false; 1386 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 1387 detectMissingValues, defaultValue, buildWorkflowGraph)); 1388 if (buildWorkflowGraph) 1389 { 1390 CWorkflowGraph::my_filename = output_filename;//CWorkflowGraph::my_filename = file->name; 1391 printf("*** *** my_filename = %s\n", CWorkflowGraph::my_filename.c_str()); 1392 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >; 1393 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][instantDataFilter->getFilterId()] = instantDataFilter->GetName(); 1394 std::cout<<"***CField::buildFilterGraph1.else filter["<<instantDataFilter->getFilterId()<< "] = "<<instantDataFilter->GetName()<< std::endl; 1395 } 1396 } 1397 } 1398 1399 // If the field data is to be read by the client or/and written to a file 1400 if (enableOutput && !storeFilter && !fileWriterFilter) 1401 { 1402 if (!read_access.isEmpty() && read_access) 1403 { 1404 storeFilter = std::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid, 1405 detectMissingValues, defaultValue)); 1406 instantDataFilter->connectOutput(storeFilter, 0); 1407 } 1408 1409 if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 1410 { 1411 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, buildWorkflowGraph)); 1412 getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 1413 if (buildWorkflowGraph) 1414 { 1415 CWorkflowGraph::my_filename = output_filename;//CWorkflowGraph::my_filename = file->name; 1416 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >; 1417 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 1418 int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId(); 1419 int filterIn = fileWriterFilter->getFilterId(); 1420 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut); 1421 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn); 1422 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = "Temporal filter"; 1423 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = fileWriterFilter->GetName(); 1424 std::cout<<"***CField::buildFilterGraph2 filterIn["<<filterIn<< "] = "<<fileWriterFilter->GetName()<< std::endl; 1425 std::cout<<"***CField::buildFilterGraph2 filterOut["<<filterOut<< "] = "<<"Temporal filter"<< std::endl; 1426 } 1427 } 1428 } 1429 } 1430 } 1431 CATCH_DUMP_ATTR 1272 1432 /*! 1273 1433 * Returns the filter needed to handle the field reference. … … 1305 1465 if (buildWorkflowGraph) 1306 1466 { 1307 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 1308 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 1467 CWorkflowGraph::my_filename = file->name; 1468 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map<StdString, std::unordered_map <int, StdString> >; 1469 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 1309 1470 int filterOut = fieldRef->instantDataFilter->getFilterId(); 1310 1471 int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId(); 1311 (*CWorkflowGraph::mapFieldToFilters_ptr)[fieldRef->getOId()].push_back(filterOut); 1312 (*CWorkflowGraph::mapFieldToFilters_ptr)[fieldRef->getOId()].push_back(filterIn); 1313 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = fieldRef->getInstantDataFilter()->GetName(); 1314 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = filters.first->GetName(); 1472 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][fieldRef->getOId()].push_back(filterOut); 1473 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][fieldRef->getOId()].push_back(filterIn); 1474 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = fieldRef->getInstantDataFilter()->GetName(); 1475 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = filters.first->GetName(); 1476 std::cout<<"CField::getFieldReference filterIn["<<filterIn<< "] = "<<filters.first->GetName()<< std::endl; 1477 std::cout<<"CField::getFieldReference filterOut["<<filterOut<< "] = "<<fieldRef->getInstantDataFilter()->GetName()<< std::endl; 1315 1478 } 1316 1479 return filters.second; 1317 1480 } 1318 1481 CATCH_DUMP_ATTR 1319 1482 1483 std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc, StdString output_filename) 1484 TRY 1485 { 1486 CWorkflowGraph::my_filename = output_filename; 1487 if (instantDataFilter || field_ref.isEmpty()) 1488 ERROR("COutputPin* CField::getFieldReference(CGarbageCollector& gc)", 1489 "Impossible to get the field reference for a field which has already been parsed or which does not have a field_ref."); 1490 1491 CField* fieldRef = CField::get(field_ref); 1492 //fieldRef->buildFilterGraph2(gc, false, output_filename); 1493 fieldRef->buildFilterGraph(gc, false, output_filename); 1494 bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1495 1496 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; 1497 // Check if a spatial transformation is needed 1498 if (grid && grid != fieldRef->grid && grid->hasTransform()) 1499 { 1500 bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1501 double defaultValue = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1502 filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue, buildWorkflowGraph); 1503 } 1504 else 1505 { 1506 filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc, buildWorkflowGraph)); 1507 } 1508 1509 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 1510 1511 if (buildWorkflowGraph) 1512 { 1513 CWorkflowGraph::my_filename = output_filename; 1514 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map<StdString, std::unordered_map <int, StdString> >; 1515 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 1516 int filterOut = fieldRef->instantDataFilter->getFilterId(); 1517 int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId(); 1518 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][fieldRef->getOId()].push_back(filterOut); 1519 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][fieldRef->getOId()].push_back(filterIn); 1520 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = fieldRef->getInstantDataFilter()->GetName(); 1521 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = filters.first->GetName(); 1522 std::cout<<"CField::getFieldReference filterIn["<<filterIn<< "] = "<<filters.first->GetName()<< std::endl; 1523 std::cout<<"CField::getFieldReference filterOut["<<filterOut<< "] = "<<fieldRef->getInstantDataFilter()->GetName()<< std::endl; 1524 } 1525 return filters.second; 1526 } 1527 CATCH_DUMP_ATTR 1320 1528 /*! 1321 1529 * Returns the filter needed to handle a self reference in the field's expression. … … 1405 1613 if (buildWorkflowGraph) 1406 1614 { 1407 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;1408 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;1615 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map< StdString, std::unordered_map <int, StdString> >; 1616 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map<StdString, std::unordered_map <StdString, vector <int> > >; 1409 1617 int filterOut = instantDataFilter->getFilterId(); 1410 1618 int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 1411 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterOut); 1412 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterIn); 1413 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = getInstantDataFilter()->GetName(); 1414 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = temporalFilter->GetName(); 1619 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut); 1620 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn); 1621 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = getInstantDataFilter()->GetName(); 1622 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = temporalFilter->GetName(); 1623 std::cout<<"CField::getTemporalDataFilter filterIn["<<filterIn<< "] = "<<temporalFilter->GetName()<< std::endl; 1624 std::cout<<"CField::getTemporalDataFilter filterOut["<<filterOut<< "] = "<<getInstantDataFilter()->GetName()<< std::endl; 1415 1625 } 1416 1626 … … 1459 1669 1460 1670 { 1461 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>;1462 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >;1671 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map<StdString, std::unordered_map <int, StdString> >; 1672 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map< StdString, std::unordered_map <StdString, vector <int> > >; 1463 1673 int filterOut = selfReferenceFilter->getFilterId(); 1464 1674 int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 1465 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterOut); 1466 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getOId()].push_back(filterIn); 1467 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = selfReferenceFilter->GetName(); 1468 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = temporalFilter->GetName(); 1675 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterOut); 1676 (*CWorkflowGraph::mapFieldToFilters_ptr)[CWorkflowGraph::my_filename][this->getOId()].push_back(filterIn); 1677 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterOut] = selfReferenceFilter->GetName(); 1678 (*CWorkflowGraph::mapFilters_ptr)[CWorkflowGraph::my_filename][filterIn] = temporalFilter->GetName(); 1679 std::cout<<"CField::getSelfTemporalDataFilter filterIn["<<filterIn<< "] = "<<temporalFilter->GetName()<< std::endl; 1680 std::cout<<"CField::getSelfTemporalDataFilter filterOut["<<filterOut<< "] = "<<selfReferenceFilter->GetName()<< std::endl; 1469 1681 } 1470 1682 … … 1993 2205 DEFINE_REF_FUNC(Field,field) 1994 2206 } // namespace xios 2207 -
XIOS/dev/dev_trunk_omp/src/node/field.hpp
r1669 r1670 143 143 144 144 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput); 145 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput, StdString out_filename); 145 146 size_t getGlobalWrittenSize(void) ; 146 147 147 148 148 149 std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc); 150 std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc, StdString out_filename); 149 151 std::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc); 150 152 std::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); … … 295 297 296 298 #endif // __XIOS_CField__ 299 -
XIOS/dev/dev_trunk_omp/src/node/file.cpp
r1665 r1670 983 983 for (int i = 0; i < size; ++i) 984 984 { 985 this->enabledFields[i]->buildFilterGraph(gc, true); 985 //this->enabledFields[i]->buildFilterGraph(gc, true); 986 //this->enabledFields[i]->buildFilterGraph2(gc, true, this->name); 987 this->enabledFields[i]->buildFilterGraph(gc, true, this->name); 986 988 } 987 989 } -
XIOS/dev/dev_trunk_omp/src/test/test_omp.f90
r1665 r1670 169 169 PRINT*,"field field_A is active ? ",xios_field_is_active("field_A") 170 170 171 DO ts=1, 4171 DO ts=1,1 172 172 CALL xios_update_calendar(ts) 173 173 CALL xios_send_field("field_A",field_A) -
XIOS/dev/dev_trunk_omp/src/workflow_graph.cpp
r1669 r1670 4 4 { 5 5 6 std::unordered_map < StdString, vector <int >> *CWorkflowGraph::mapFieldToFilters_ptr = 0;6 std::unordered_map < StdString, std::unordered_map <StdString, vector <int> > > *CWorkflowGraph::mapFieldToFilters_ptr = 0; 7 7 #pragma omp threadprivate(CWorkflowGraph::mapFieldToFilters_ptr) 8 8 9 std::unordered_map < int, StdString> *CWorkflowGraph::mapFilters_ptr = 0;9 std::unordered_map < StdString, std::unordered_map <int, StdString> > *CWorkflowGraph::mapFilters_ptr = 0; 10 10 #pragma omp threadprivate(CWorkflowGraph::mapFilters_ptr) 11 11 12 std::unordered_map < int,vector<Time>> *CWorkflowGraph::mapFilterTimestamps_ptr = 0;12 std::unordered_map < StdString, std::unordered_map <int, vector<Time> > > *CWorkflowGraph::mapFilterTimestamps_ptr = 0; 13 13 #pragma omp threadprivate(CWorkflowGraph::mapFilterTimestamps_ptr) 14 14 15 s et<Time> *CWorkflowGraph::timestamps_ptr = 0;15 std::unordered_map< StdString, set<Time> > *CWorkflowGraph::timestamps_ptr = 0; 16 16 #pragma omp threadprivate(CWorkflowGraph::timestamps_ptr) 17 17 … … 19 19 vector <StdString> CWorkflowGraph::fields; 20 20 vector <pair<int, int> > CWorkflowGraph::fieldsToFilters; 21 22 StdString CWorkflowGraph::my_filename = "my_filename"; 23 #pragma omp threadprivate(CWorkflowGraph::my_filename) 24 25 std::map< StdString, int> *InvalidableObject::count_ptr=0; 26 #pragma omp threadprivate(InvalidableObject::count_ptr) 21 27 22 28 CWorkflowGraph::CWorkflowGraph() … … 26 32 * Reorganize information collected by XIOS for visualization. 27 33 */ 34 /* 35 28 36 void CWorkflowGraph::buildStaticWorkflow() 29 37 TRY … … 50 58 } 51 59 CATCH 60 */ 61 62 void CWorkflowGraph::buildStaticWorkflow_forfile(StdString filename) 63 TRY 64 { 65 // Create a list of filters (graph nodes) 66 //if(mapFilters_ptr==0) mapFilters_ptr = new std::unordered_map <int, StdString>; 67 //if(mapFieldToFilters_ptr==0) mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int > >; 68 size_t filterIdx = 0; 69 filters.resize((*mapFilters_ptr)[filename].size()); 70 fieldsToFilters.clear(); 71 fields.clear(); 72 73 74 for (std::unordered_map <int, StdString>::iterator it=(*mapFilters_ptr)[filename].begin(); it != (*mapFilters_ptr)[filename].end(); it++) 75 { 76 filters[it->first]=it->second; 77 } 78 79 // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) 80 for (std::unordered_map <StdString, vector <int > >::iterator it=(*mapFieldToFilters_ptr)[filename].begin(); it != (*mapFieldToFilters_ptr)[filename].end(); it++) 81 { 82 for (size_t i = 0; i < (it->second.size() - 1); i+=2) 83 { 84 fieldsToFilters.push_back(make_pair(it->second[i],it->second[i+1])); 85 fields.push_back(it->first); 86 } 87 } 88 } 89 CATCH 52 90 53 91 … … 58 96 for (auto it=mapFilters_ptr->begin(); it != mapFilters_ptr->end(); it++) 59 97 { 60 std::cout<<"mapFilters_ptr["<<it->first<<"]="<<it->second<<std::endl; 98 for (auto it2=mapFilters_ptr->at(it->first).begin(); it2 != mapFilters_ptr->at(it->first).end(); it2++) 99 std::cout<<"mapFilters_ptr["<<it->first<<"]="<<it2->first<<" "<<it2->second<<std::endl; 61 100 } 62 101 else std::cout<<"mapFilters_ptr empty"<<std::endl; … … 65 104 for (auto it=mapFieldToFilters_ptr->begin(); it != mapFieldToFilters_ptr->end(); it++) 66 105 { 67 for ( size_t i = 0; i < it->second.size(); i++)106 for (auto it2=mapFieldToFilters_ptr->at(it->first).begin(); it2 != mapFieldToFilters_ptr->at(it->first).end(); it2++) 68 107 { 69 std::cout<<"mapFieldToFilters_ptr["<<it->first<<"]["<<i<<"] = "<<it->second[i]<<std::endl; 108 for (size_t i = 0; i < it2->second.size(); i++) 109 std::cout<<"mapFieldToFilters_ptr["<<it->first<<"]["<<it2->first<<"]["<<i<<"] = "<<it2->second[i]<<std::endl; 70 110 } 71 111 } 72 112 else std::cout<<"mapFieldToFilters_ptr empty"<<mapFieldToFilters_ptr<<std::endl; 73 113 /* 74 114 if(mapFilterTimestamps_ptr!=0 && !mapFilterTimestamps_ptr->empty()) 75 115 for (auto it=mapFilterTimestamps_ptr->begin(); it != mapFilterTimestamps_ptr->end(); it++) … … 88 128 } 89 129 else std::cout<<"timestamps_ptr empty"<<std::endl; 90 130 */ 91 131 } 92 132 CATCH 93 133 94 134 } 135 -
XIOS/dev/dev_trunk_omp/src/workflow_graph.hpp
r1669 r1670 21 21 * It is filled up during reconstruction of a workflow (in function CField::buildFilterGraph()). 22 22 */ 23 static std::unordered_map < StdString, vector <int> >*mapFieldToFilters_ptr;23 static std::unordered_map < StdString, std::unordered_map <StdString, vector <int> > > *mapFieldToFilters_ptr; 24 24 #pragma omp threadprivate(mapFieldToFilters_ptr) 25 25 … … 27 27 * It is filled up during reconstruction of a workflow (in function CField::buildFilterGraph()). 28 28 */ 29 static std::unordered_map < int, StdString>*mapFilters_ptr;29 static std::unordered_map < StdString, std::unordered_map <int, StdString> > *mapFilters_ptr; 30 30 #pragma omp threadprivate(mapFilters_ptr) 31 31 … … 33 33 * Timestamps are added into the map at the exit of a filter (in function COutputPin::onOutputReady) 34 34 */ 35 static std::unordered_map < int, vector<Time>> *mapFilterTimestamps_ptr;35 static std::unordered_map < StdString, std::unordered_map <int, vector<Time> > > *mapFilterTimestamps_ptr; 36 36 #pragma omp threadprivate(mapFilterTimestamps_ptr) 37 37 … … 39 39 * Timestamps are added at the exit of a filter (in function COutputPin::onOutputReady) 40 40 */ 41 static s et<Time> *timestamps_ptr;41 static std::unordered_map< StdString, set<Time> > *timestamps_ptr; 42 42 #pragma omp threadprivate(timestamps_ptr) 43 44 static StdString my_filename; 45 #pragma omp threadprivate(my_filename) 43 46 44 47 private: … … 54 57 55 58 static void buildStaticWorkflow(); 59 static void buildStaticWorkflow_forfile(StdString filename); 56 60 static void showStaticWorkflow(); 57 61 … … 61 65 62 66 #endif 67
Note: See TracChangeset
for help on using the changeset viewer.