Changeset 1653 for XIOS/dev/dev_olga/src/node/field.cpp
- Timestamp:
- 03/06/19 12:11:10 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/field.cpp
r1612 r1653 24 24 #include "spatial_transform_filter.hpp" 25 25 #include "file_server_writer_filter.hpp" 26 #include "workflow_graph.hpp" 26 27 27 28 namespace xios{ … … 1109 1110 TRY 1110 1111 { 1111 if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform();1112 if (!isGridChecked) checkGridOfEnabledFields();1112 if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 1113 if (!isGridChecked) checkGridOfEnabledFields(); 1113 1114 1114 1115 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); 1115 1117 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1116 1118 … … 1122 1124 { 1123 1125 if (!instantDataFilter) 1126 { 1124 1127 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false)); 1125 1128 } 1126 1129 1127 1130 // If the field data is to be read by the client or/and written to a file … … 1138 1141 { 1139 1142 if (!instantDataFilter) 1143 { 1140 1144 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, false)); 1141 1145 } 1142 1146 // If the field data is to be read by the client or/and written to a file 1143 1147 if (enableOutput && !storeFilter && !fileWriterFilter) … … 1164 1168 if (!field_ref.isEmpty()) 1165 1169 { 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; 1167 1173 1168 1174 if (grid && grid != gridRef && grid->hasTransform()) 1169 1175 { 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); 1171 1178 1172 1179 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 } 1173 1190 filter = filters.second; 1174 1191 } … … 1179 1196 // Check if we have a reference on another field 1180 1197 else if (!field_ref.isEmpty()) 1198 { 1199 CField::get(field_ref)->build_workflow_graph.setValue(buildWorkflowGraph); 1181 1200 instantDataFilter = getFieldReference(gc); 1201 } 1182 1202 // Check if the data is to be read from a file 1183 1203 else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) … … 1185 1205 checkTimeAttributes(); 1186 1206 instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 1187 detectMissingValues, defaultValue ));1207 detectMissingValues, defaultValue, buildWorkflowGraph)); 1188 1208 } 1189 1209 else // The data might be passed from the model … … 1191 1211 if (check_if_active.isEmpty()) check_if_active = false; 1192 1212 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 1193 detectMissingValues, defaultValue));1213 detectMissingValues, defaultValue, buildWorkflowGraph)); 1194 1214 } 1195 1215 } … … 1209 1229 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 1210 1230 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 } 1211 1240 } 1212 1241 } … … 1231 1260 CField* fieldRef = CField::get(field_ref); 1232 1261 fieldRef->buildFilterGraph(gc, false); 1262 bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1233 1263 1234 1264 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; … … 1238 1268 bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1239 1269 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); 1241 1271 } 1242 1272 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 } 1244 1276 1245 1277 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 1246 1278 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 } 1247 1288 return filters.second; 1248 1289 } … … 1317 1358 { 1318 1359 std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 1360 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1319 1361 1320 1362 if (it == temporalDataFilters.end()) … … 1327 1369 1328 1370 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)); 1332 1374 1333 1375 instantDataFilter->connectOutput(temporalFilter, 0); 1334 1376 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 1335 1387 it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; 1336 1388 } 1337 1338 1389 return it->second; 1339 1390 } … … 1367 1418 1368 1419 const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 1420 const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 1369 1421 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)); 1372 1425 1373 1426 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 1374 1438 return temporalFilter ; 1375 1439 }
Note: See TracChangeset
for help on using the changeset viewer.