Ignore:
Timestamp:
03/06/19 12:11:10 (5 years ago)
Author:
oabramkina
Message:

Developments for visualization of XIOS workflow.

Branch is spawned from trunk r1649.

Boost library is used for producing Graphviz DOT files. Current results: a DOT file representing a static workflow. For a complete proof of concept, DOT files for each timestamp should be generated. The necessary information has been collected by XIOS, it only requires rearranging the information for graphing (changes in classes CWorkflowGraph and CGraphviz).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/node/field.cpp

    r1612 r1653  
    2424#include "spatial_transform_filter.hpp" 
    2525#include "file_server_writer_filter.hpp" 
     26#include "workflow_graph.hpp" 
    2627 
    2728namespace xios{ 
     
    11091110   TRY 
    11101111   {      
    1111     if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
    1112     if (!isGridChecked) checkGridOfEnabledFields(); 
     1112     if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
     1113     if (!isGridChecked) checkGridOfEnabledFields(); 
    11131114 
    11141115     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1116     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    11151117     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
    11161118 
     
    11221124     { 
    11231125        if (!instantDataFilter) 
     1126        { 
    11241127          instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false)); 
    1125  
     1128        } 
    11261129 
    11271130       // If the field data is to be read by the client or/and written to a file 
     
    11381141     { 
    11391142       if (!instantDataFilter) 
     1143       { 
    11401144         instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, false)); 
    1141  
     1145       } 
    11421146             // If the field data is to be read by the client or/and written to a file 
    11431147       if (enableOutput && !storeFilter && !fileWriterFilter) 
     
    11641168           if (!field_ref.isEmpty()) 
    11651169           { 
    1166              CGrid* gridRef = CField::get(field_ref)->grid; 
     1170             CField* fieldRef = CField::get(field_ref); 
     1171             fieldRef->build_workflow_graph.setValue(buildWorkflowGraph); 
     1172             CGrid* gridRef = fieldRef->grid; 
    11671173 
    11681174             if (grid && grid != gridRef && grid->hasTransform()) 
    11691175             { 
    1170                  std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue);  
     1176               std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, 
     1177                                                                                         detectMissingValues, defaultValue, buildWorkflowGraph); 
    11711178 
    11721179               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               } 
    11731190               filter = filters.second; 
    11741191             } 
     
    11791196         // Check if we have a reference on another field 
    11801197         else if (!field_ref.isEmpty()) 
     1198         { 
     1199           CField::get(field_ref)->build_workflow_graph.setValue(buildWorkflowGraph); 
    11811200           instantDataFilter = getFieldReference(gc); 
     1201         } 
    11821202         // Check if the data is to be read from a file 
    11831203         else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 
     
    11851205           checkTimeAttributes(); 
    11861206           instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 
    1187                                                                                                        detectMissingValues, defaultValue)); 
     1207                                                                                                       detectMissingValues, defaultValue, buildWorkflowGraph)); 
    11881208         } 
    11891209         else // The data might be passed from the model 
     
    11911211            if (check_if_active.isEmpty()) check_if_active = false;  
    11921212            instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 
    1193                                                                                                         detectMissingValues, defaultValue)); 
     1213                                                                                                      detectMissingValues, defaultValue, buildWorkflowGraph)); 
    11941214         } 
    11951215       } 
     
    12091229           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
    12101230           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
     1231           if (buildWorkflowGraph) 
     1232           { 
     1233             int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId(); 
     1234             int filterIn = fileWriterFilter->getFilterId(); 
     1235             CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 
     1236             CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 
     1237             CWorkflowGraph::mapFilters[filterOut] = "Temporal filter"; 
     1238             CWorkflowGraph::mapFilters[filterIn] = fileWriterFilter->GetName(); 
     1239           } 
    12111240         } 
    12121241       } 
     
    12311260     CField* fieldRef = CField::get(field_ref); 
    12321261     fieldRef->buildFilterGraph(gc, false); 
     1262     bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    12331263 
    12341264     std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; 
     
    12381268       bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    12391269       double defaultValue  = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);                                 
    1240        filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue); 
     1270       filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue, buildWorkflowGraph); 
    12411271     } 
    12421272     else 
    1243        filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 
     1273     { 
     1274       filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc, buildWorkflowGraph)); 
     1275     } 
    12441276 
    12451277     fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
    12461278 
     1279     if (buildWorkflowGraph) 
     1280     { 
     1281       int filterOut = fieldRef->instantDataFilter->getFilterId(); 
     1282       int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId(); 
     1283       CWorkflowGraph::mapFieldToFilters[fieldRef->getId()].push_back(filterOut); 
     1284       CWorkflowGraph::mapFieldToFilters[fieldRef->getId()].push_back(filterIn); 
     1285       CWorkflowGraph::mapFilters[filterOut] = fieldRef->getInstantDataFilter()->GetName(); 
     1286       CWorkflowGraph::mapFilters[filterIn] = filters.first->GetName(); 
     1287     } 
    12471288     return filters.second; 
    12481289   } 
     
    13171358   { 
    13181359     std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 
     1360     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    13191361 
    13201362     if (it == temporalDataFilters.end()) 
     
    13271369 
    13281370       const bool detectMissingValues = (!detect_missing_value.isEmpty()  && detect_missing_value == true); 
    1329        std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    1330                                                                              CContext::getCurrent()->getCalendar()->getInitDate(), 
    1331                                                                              freq_op, freq_offset, outFreq, detectMissingValues)); 
     1371       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, CContext::getCurrent()->getCalendar()->getInitDate(), 
     1372                                                                             freq_op, freq_offset, outFreq, 
     1373                                                                             detectMissingValues, buildWorkflowGraph)); 
    13321374 
    13331375       instantDataFilter->connectOutput(temporalFilter, 0); 
    13341376 
     1377       if (buildWorkflowGraph) 
     1378       { 
     1379         int filterOut = instantDataFilter->getFilterId(); 
     1380         int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 
     1381         CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 
     1382         CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 
     1383         CWorkflowGraph::mapFilters[filterOut] = getInstantDataFilter()->GetName(); 
     1384         CWorkflowGraph::mapFilters[filterIn] = temporalFilter->GetName(); 
     1385       } 
     1386 
    13351387       it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; 
    13361388     } 
    1337  
    13381389     return it->second; 
    13391390   } 
     
    13671418 
    13681419       const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 
     1420       const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    13691421       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    1370                                                                              CContext::getCurrent()->getCalendar()->getInitDate(), 
    1371                                                                              freq_op, freq_offset, outFreq, detectMissingValues)); 
     1422                                                                           CContext::getCurrent()->getCalendar()->getInitDate(), 
     1423                                                                           freq_op, freq_offset, outFreq, 
     1424                                                                           detectMissingValues, buildWorkflowGraph)); 
    13721425 
    13731426       selfReferenceFilter->connectOutput(temporalFilter, 0); 
     1427       if (buildWorkflowGraph) 
     1428 
     1429       { 
     1430         int filterOut = selfReferenceFilter->getFilterId(); 
     1431         int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 
     1432         CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 
     1433         CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 
     1434         CWorkflowGraph::mapFilters[filterOut] = selfReferenceFilter->GetName(); 
     1435         CWorkflowGraph::mapFilters[filterIn] = temporalFilter->GetName(); 
     1436       } 
     1437 
    13741438       return temporalFilter ; 
    13751439     } 
Note: See TracChangeset for help on using the changeset viewer.