Ignore:
Timestamp:
07/02/19 11:42:27 (5 years ago)
Author:
yushan
Message:

MARK: Dynamic workflow graph developement. Branch up to date with trunk @1676. Using vis.js

File:
1 edited

Legend:

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

    r1677 r1679  
    11331133 
    11341134     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1135      
    11351136     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1137 
     1138      
    11361139     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
    11371140 
    11381141     CContext* context = CContext::getCurrent(); 
     1142     Time filter_start; 
     1143     if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 
     1144     else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 
     1145     else filter_start = -1; 
     1146 
     1147     Time filter_end; 
     1148     if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 
     1149     else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 
     1150     else filter_end = -1; 
     1151      
     1152 
    11391153     bool hasWriterServer = context->hasServer && !context->hasClient; 
    11401154     bool hasIntermediateServer = context->hasServer && context->hasClient; 
     
    11811195           boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0')); 
    11821196           std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this); 
    1183            filter->output_field_id = this->getId(); 
    11841197 
    11851198           // Check if a spatial transformation is needed 
     
    11931206             { 
    11941207               std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, 
    1195                                                                                          detectMissingValues, defaultValue, buildWorkflowGraph); 
     1208                                                                                         detectMissingValues, defaultValue); 
    11961209 
    11971210               filter->connectOutput(filters.first, 0); 
    1198                filters.second->output_field_id = this->getId(); 
    11991211 
    12001212 
     
    12051217 
    12061218           instantDataFilter = filter; 
    1207            instantDataFilter->output_field_id = this->getId(); 
    1208            filter->output_field_id = this->getId(); 
     1219           instantDataFilter->field = this; 
    12091220           filter->tag = buildWorkflowGraph; 
    1210            // std::cout<<"=====1============= output_field_id = "<<this->getId()<<" =========== tag="<<filter->tag<<std::endl; 
     1221            
     1222           filter->start_graph = filter_start; 
     1223           filter->end_graph = filter_end; 
     1224 
    12111225           for(int i=0; i<filter->parent_filters.size(); i++) 
    12121226           { 
    1213              // std::cout<<"transforme filter cout= "<<std::shared_ptr<COutputPin>(filter)<<" parent filter = "<<filter->parent_filters[i]<<std::endl;  
    12141227             filter->tag = filter->tag || filter->parent_filters[i]->tag; 
    12151228           } 
     
    12261239           instantDataFilter = getFieldReference(gc); 
    12271240           instantDataFilter->tag = buildWorkflowGraph; 
     1241           instantDataFilter->start_graph = filter_start; 
     1242           instantDataFilter->end_graph = filter_end; 
    12281243         } 
    12291244         // Check if the data is to be read from a file 
     
    12321247           checkTimeAttributes(); 
    12331248           instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 
    1234                                                                                                        detectMissingValues, defaultValue, buildWorkflowGraph)); 
     1249                                                                                                       detectMissingValues, defaultValue)); 
    12351250           instantDataFilter->tag = buildWorkflowGraph; 
     1251           instantDataFilter->start_graph = filter_start; 
     1252           instantDataFilter->end_graph = filter_end; 
     1253           instantDataFilter->field = this; 
     1254 
    12361255         } 
    12371256         else // The data might be passed from the model 
     
    12391258            if (check_if_active.isEmpty()) check_if_active = false;  
    12401259            instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 
    1241                                                                                                       detectMissingValues, defaultValue, buildWorkflowGraph));  
     1260                                                                                                      detectMissingValues, defaultValue));  
    12421261            instantDataFilter->tag = buildWorkflowGraph; 
    1243             // std::cout<<"=====4============= output_field_id = "<<this->getId()<<" =========== tag="<<instantDataFilter->tag<<std::endl; 
    1244             // std::cout<<"Source filter cout = "<<std::shared_ptr<COutputPin>(clientSourceFilter)<<std::endl; 
     1262            instantDataFilter->start_graph = filter_start; 
     1263            instantDataFilter->end_graph = filter_end; 
     1264            instantDataFilter->field = this; 
    12451265         } 
    12461266       } 
     
    12561276 
    12571277           storeFilter->tag = (instantDataFilter->tag || buildWorkflowGraph); 
     1278           instantDataFilter->start_graph = filter_start; 
     1279           instantDataFilter->end_graph = filter_end; 
     1280 
    12581281           instantDataFilter->setParentFiltersTag(); 
     1282           storeFilter->start_graph = filter_start; 
     1283           storeFilter->end_graph = filter_end; 
     1284           storeFilter->field = this; 
    12591285         } 
    12601286 
    12611287         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
    12621288         { 
    1263            fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, buildWorkflowGraph)); 
     1289           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
    12641290           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
    1265            std::cout<<"=====10============= output_field_id = "<<this->name<<std::endl; 
    1266            // std::cout<<"CFileWriterFilter filter = "<<fileWriterFilter<<" parent filter = "<<std::shared_ptr<COutputPin>(getTemporalDataFilter(gc, file->output_freq))<<std::endl; 
    12671291            
    12681292           fileWriterFilter->tag = (getTemporalDataFilter(gc, file->output_freq)->tag || buildWorkflowGraph); 
    1269            fileWriterFilter->output_field_id = this->name; 
     1293           getTemporalDataFilter(gc, file->output_freq)->start_graph = filter_start; 
     1294           getTemporalDataFilter(gc, file->output_freq)->end_graph = filter_end; 
    12701295           getTemporalDataFilter(gc, file->output_freq)->setParentFiltersTag(); 
     1296           fileWriterFilter->start_graph = filter_start; 
     1297           fileWriterFilter->end_graph = filter_end; 
     1298 
     1299           std::cout<<"CFileWriterFilter filter start = "<<filter_start<<" end = "<<filter_end<<std::endl; 
     1300 
    12711301         } 
    12721302       } 
     
    12911321     CField* fieldRef = CField::get(field_ref); 
    12921322     fieldRef->buildFilterGraph(gc, false); 
    1293      bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1323     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1324 
     1325     CContext* context = CContext::getCurrent(); 
     1326 
     1327     Time filter_start; 
     1328     if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 
     1329     else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 
     1330     else filter_start = -1; 
     1331 
     1332     Time filter_end; 
     1333     if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 
     1334     else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 
     1335     else filter_end = -1; 
     1336 
    12941337 
    12951338     std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; 
     
    12991342       bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    13001343       double defaultValue  = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);                                 
    1301        filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue, buildWorkflowGraph); 
     1344       filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue); 
    13021345 
    13031346       fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
    13041347 
    1305        filters.second->output_field_id = this->getId(); 
    13061348      
    13071349 
     
    13101352 
    13111353       filters.second->tag = (buildWorkflowGraph || filters.second->parent_filters[0]->tag); 
    1312  
    1313        // std::cout<<"=====5============= output_field_id = "<<this->getId()<<std::endl; 
    1314        // std::cout<<"CSpatialTransformFilter first filter cout = "<<std::shared_ptr<COutputPin>(filters.first)<<"  second filter cout = "<<std::shared_ptr<COutputPin>(filters.second)<< " parent filter = "<<fieldRef->getInstantDataFilter()<<std::endl; 
    13151354        
     1355       filters.second->start_graph = filter_start; 
     1356       filters.second->end_graph = filter_end; 
     1357       filters.second->field = this; 
     1358        
    13161359     } 
    13171360     else 
    13181361     { 
    1319        filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc, buildWorkflowGraph)); 
     1362       filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 
    13201363 
    13211364       fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
    1322        filters.second->output_field_id = this->getId(); 
    13231365      
    13241366 
     
    13281370       filters.second->tag = buildWorkflowGraph || filters.second->parent_filters[0]->tag; 
    13291371 
    1330        // std::cout<<"=====6============= output_field_id = "<<this->getId()<<" =========== tag="<<filters.second->tag<<std::endl; 
    1331        // std::cout<<"Pass through filter cout = "<<std::shared_ptr<COutputPin>(filters.second)<<" parent filter = "<<filters.second->parent_filters[0]<<std::endl; 
     1372       filters.second->start_graph = filter_start; 
     1373       filters.second->end_graph = filter_end; 
     1374       filters.second->field = this; 
    13321375 
    13331376     } 
     
    13911434 
    13921435     selfReferenceFilter->tag = buildWorkflowGraph; 
     1436     selfReferenceFilter->field = this; 
    13931437     return selfReferenceFilter; 
    13941438   } 
     
    14081452   { 
    14091453     std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 
    1410      bool buildWorkflowGraph = buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1454     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1455 
     1456     CContext* context = CContext::getCurrent(); 
     1457 
     1458     Time filter_start; 
     1459     if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 
     1460     else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 
     1461     else filter_start = -1; 
     1462 
     1463     Time filter_end; 
     1464     if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 
     1465     else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 
     1466     else filter_end = -1; 
     1467 
     1468 
    14111469 
    14121470     if (it == temporalDataFilters.end()) 
     
    14211479       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, CContext::getCurrent()->getCalendar()->getInitDate(), 
    14221480                                                                             freq_op, freq_offset, outFreq, 
    1423                                                                              detectMissingValues, buildWorkflowGraph)); 
     1481                                                                             detectMissingValues)); 
    14241482 
    14251483       instantDataFilter->connectOutput(temporalFilter, 0); 
    1426        temporalFilter->output_field_id = this->getId(); 
    14271484       temporalFilter->tag = buildWorkflowGraph; 
    14281485        
     
    14311488        
    14321489 
    1433        // std::cout<<"=====8============= output_field_id = "<<this->getId()<<" =========== tag="<<temporalFilter->tag<<std::endl; 
    1434        // std::cout<<"Temporal filter cout = "<<std::shared_ptr<COutputPin>(temporalFilter)<<" parent filter = "<<temporalFilter->parent_filters[0]<<std::endl; 
    14351490       if(temporalFilter->parent_filters[0]->tag) temporalFilter->tag=true; 
     1491 
     1492       temporalFilter->start_graph = filter_start; 
     1493       temporalFilter->end_graph = filter_end; 
     1494       temporalFilter->field = this; 
    14361495 
    14371496       it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; 
     
    14731532                                                                           CContext::getCurrent()->getCalendar()->getInitDate(), 
    14741533                                                                           freq_op, freq_offset, outFreq, 
    1475                                                                            detectMissingValues, buildWorkflowGraph)); 
     1534                                                                           detectMissingValues)); 
    14761535 
    14771536       selfReferenceFilter->connectOutput(temporalFilter, 0); 
    1478        temporalFilter->output_field_id = this->getId(); 
    14791537       temporalFilter->tag = buildWorkflowGraph; 
    1480        // std::cout<<"=====9============= output_field_id = "<<this->getId()<<" =========== tag="<<temporalFilter->tag<<std::endl; 
     1538       temporalFilter->field = this; 
    14811539 
    14821540       return temporalFilter ; 
Note: See TracChangeset for help on using the changeset viewer.