Changeset 2002
- Timestamp:
- 01/05/21 10:12:00 (2 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src
- Files:
-
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/spatial_transform_filter.cpp
r1875 r2002 50 50 { 51 51 CField* fieldAuxInput = CField::get(auxInputs[idx]); 52 fieldAuxInput->buildFilterGraph(gc, false);52 //ym fieldAuxInput->buildFilterGraph(gc, false); 53 53 fieldAuxInput->getInstantDataFilter()->connectOutput(firstFilter,idx+1); 54 54 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
r1988 r2002 1243 1243 for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) 1244 1244 (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); 1245 }1246 CATCH_DUMP_ATTR1247 1248 /*!1249 Go up the hierachical tree via field_ref and do check of attributes of fields1250 This can be done in a client then all computed information will be sent from this client to others1251 \param [in] sendToServer Flag to indicate whether calculated information will be sent1252 */1253 void CContext::solveOnlyRefOfEnabledFields(void)1254 TRY1255 {1256 int size = this->enabledFiles.size();1257 for (int i = 0; i < size; ++i)1258 {1259 this->enabledFiles[i]->solveOnlyRefOfEnabledFields();1260 }1261 1262 for (int i = 0; i < size; ++i)1263 {1264 this->enabledFiles[i]->generateNewTransformationGridDest();1265 }1266 1267 size = this->enabledCouplerOut.size();1268 for (int i = 0; i < size; ++i)1269 {1270 this->enabledCouplerOut[i]->solveOnlyRefOfEnabledFields();1271 }1272 1273 for (int i = 0; i < size; ++i)1274 {1275 this->enabledCouplerOut[i]->generateNewTransformationGridDest();1276 }1277 }1278 CATCH_DUMP_ATTR1279 1280 /*!1281 Go up the hierachical tree via field_ref and do check of attributes of fields.1282 The transformation can be done in this step.1283 All computed information will be sent from this client to others.1284 \param [in] sendToServer Flag to indicate whether calculated information will be sent1285 */1286 void CContext::solveAllRefOfEnabledFieldsAndTransform(void)1287 TRY1288 {1289 int size = this->enabledFiles.size();1290 for (int i = 0; i < size; ++i)1291 {1292 this->enabledFiles[i]->solveAllRefOfEnabledFieldsAndTransform();1293 }1294 1295 size = this->enabledCouplerOut.size();1296 for (int i = 0; i < size; ++i)1297 {1298 this->enabledCouplerOut[i]->solveAllRefOfEnabledFieldsAndTransform();1299 }1300 1301 1245 } 1302 1246 CATCH_DUMP_ATTR -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp
r1984 r2002 138 138 void initReadFiles(void); 139 139 void prepareTimeseries(void); 140 void solveOnlyRefOfEnabledFields(void);141 140 void postProcessFilterGraph(); 142 141 void startPrefetchingOfEnabledReadModeFiles(); … … 145 144 void findFieldsWithReadAccess(void); 146 145 void triggerLateFields(void) ; 147 void solveAllRefOfEnabledFieldsAndTransform(void); 148 146 149 147 std::map<int, StdSize> getAttributesBufferSize(std::map<int, StdSize>& maxEventSize, CContextClient* contextClient, bool bufferForWriting = false); 150 148 std::map<int, StdSize> getDataBufferSize(std::map<int, StdSize>& maxEventSize, CContextClient* contextClient, bool bufferForWriting = false); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/coupler_out.cpp
r1875 r2002 161 161 CATCH_DUMP_ATTR 162 162 163 164 void CCouplerOut::solveOnlyRefOfEnabledFields(void)165 TRY166 {167 int size = this->enabledFields.size();168 for (int i = 0; i < size; ++i)169 {170 this->enabledFields[i]->solveOnlyReferenceEnabledField();171 }172 }173 CATCH_DUMP_ATTR174 175 void CCouplerOut::generateNewTransformationGridDest(void)176 TRY177 {178 int size = this->enabledFields.size();179 for (int i = 0; i < size; ++i)180 {181 this->enabledFields[i]->generateNewTransformationGridDest();182 }183 }184 CATCH_DUMP_ATTR185 186 void CCouplerOut::solveAllRefOfEnabledFieldsAndTransform(void)187 TRY188 {189 int size = this->enabledFields.size();190 for (int i = 0; i < size; ++i)191 {192 this->enabledFields[i]->solveAllEnabledFieldsAndTransform();193 }194 }195 CATCH_DUMP_ATTR196 197 /*!198 * Constructs the filter graph for each active field.199 *200 * \param gc the garbage collector to use when building the filter graph201 */202 void CCouplerOut::buildFilterGraphOfEnabledFields(CGarbageCollector& gc)203 TRY204 {205 int size = this->enabledFields.size();206 for (int i = 0; i < size; ++i)207 {208 this->enabledFields[i]->buildFilterGraph(gc, true);209 }210 }211 CATCH_DUMP_ATTR212 163 213 164 void CCouplerOut::checkGridOfEnabledFields(void) -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/coupler_out.hpp
r1875 r2002 91 91 void solveFieldRefInheritance(bool apply); 92 92 void createInterCommunicator(void) ; 93 void solveOnlyRefOfEnabledFields(void);94 void generateNewTransformationGridDest(void);95 void solveAllRefOfEnabledFieldsAndTransform() ;96 void buildFilterGraphOfEnabledFields(CGarbageCollector& gc);97 93 void checkGridOfEnabledFields(void) ; 98 94 void assignContext(void) ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
r1999 r2002 394 394 //---------------------------------------------------------------- 395 395 396 /*!397 Build up graph of grids which plays role of destination and source in grid transformation398 This function should be called before \func solveGridReference()399 */400 void CField::buildGridTransformationGraph()401 TRY402 {403 CContext* context = CContext::getCurrent();404 if (context->getServiceType()==CServicesManager::CLIENT)405 {406 if (grid_ && !grid_->isTransformed() && hasDirectFieldReference() && grid_ != getDirectFieldReference()->grid_)407 {408 grid_->addTransGridSource(getDirectFieldReference()->grid_);409 }410 }411 }412 CATCH_DUMP_ATTR413 414 /*!415 Generate a new grid destination if there are more than one grid source pointing to a same grid destination416 */417 void CField::generateNewTransformationGridDest()418 TRY419 {420 CContext* context = CContext::getCurrent();421 if (context->getServiceType()==CServicesManager::CLIENT)422 {423 std::map<CGrid*,std::pair<bool,StdString> >& gridSrcMap = grid_->getTransGridSource();424 if (1 < gridSrcMap.size())425 {426 // Search for grid source427 CGrid* gridSrc = grid_;428 CField* currField = this;429 std::vector<CField*> hieraField;430 while (currField->hasDirectFieldReference() && (gridSrc == grid_))431 {432 hieraField.push_back(currField);433 CField* tmp = currField->getDirectFieldReference();434 currField = tmp;435 gridSrc = currField->grid_;436 }437 438 if (gridSrcMap.end() != gridSrcMap.find(gridSrc))439 {440 CGrid* gridTmp;441 std::pair<bool,StdString> newGridDest = gridSrcMap[gridSrc];442 if (newGridDest.first)443 {444 StdString newIdGridDest = newGridDest.second;445 if (!CGrid::has(newIdGridDest))446 {447 ERROR("CGrid* CGrid::generateNewTransformationGridDest()",448 << " Something wrong happened! Grid whose id " << newIdGridDest449 << "should exist ");450 }451 gridTmp = CGrid::get(newIdGridDest);452 }453 else454 {455 StdString newIdGridDest = CGrid::generateId(gridSrc, grid_);456 gridTmp = CGrid::cloneGrid(newIdGridDest, grid_);457 458 (gridSrcMap[gridSrc]).first = true;459 (gridSrcMap[gridSrc]).second = newIdGridDest;460 }461 462 // Update all descendants463 for (std::vector<CField*>::iterator it = hieraField.begin(); it != hieraField.end(); ++it)464 {465 (*it)->grid_ = gridTmp;466 (*it)->updateRef((*it)->grid_);467 }468 }469 }470 }471 }472 CATCH_DUMP_ATTR473 474 396 void CField::updateRef(CGrid* grid) 475 397 TRY … … 497 419 CATCH_DUMP_ATTR 498 420 499 /*!500 Solve reference of all enabled fields even the source fields .501 In this step, we do transformations.502 */503 void CField::solveAllEnabledFieldsAndTransform()504 TRY505 {506 CContext* context = CContext::getCurrent();507 508 if (!isReferenceSolvedAndTransformed)509 {510 isReferenceSolvedAndTransformed = true;511 512 if (context->getServiceType()==CServicesManager::CLIENT)513 {514 solveRefInheritance(true);515 if (hasDirectFieldReference()) getDirectFieldReference()->solveAllEnabledFieldsAndTransform();516 }517 518 if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER)519 solveServerOperation();520 521 solveGridReference();522 523 if (context->getServiceType()==CServicesManager::CLIENT)524 {525 solveGenerateGrid();526 buildGridTransformationGraph();527 }528 529 solveGridDomainAxisRef(false);530 531 if (context->getServiceType()==CServicesManager::CLIENT)532 {533 solveTransformedGrid();534 }535 536 solveGridDomainAxisRef(false);537 }538 }539 CATCH_DUMP_ATTR540 421 541 422 void CField::checkGridOfEnabledFields() … … 564 445 solveCheckMaskIndex(true); 565 446 } 566 CATCH_DUMP_ATTR567 568 void CField::solveOnlyReferenceEnabledField(void)569 TRY570 {571 CContext* context = CContext::getCurrent();572 if (!isReferenceSolved)573 {574 isReferenceSolved = true;575 576 if (context->getServiceType()==CServicesManager::CLIENT)577 {578 solveRefInheritance(true);579 if (hasDirectFieldReference()) getDirectFieldReference()->solveOnlyReferenceEnabledField();580 }581 582 if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER)583 solveServerOperation();584 585 solveGridReference();586 grid_->solveElementsRefInheritance(true); // make it again to solve grid reading from file587 588 if (context->getServiceType()==CServicesManager::CLIENT)589 {590 solveGenerateGrid();591 buildGridTransformationGraph();592 }593 }594 }595 CATCH_DUMP_ATTR596 597 void CField::solveAllReferenceEnabledField(bool doSending2Server)598 TRY599 {600 CContext* context = CContext::getCurrent();601 solveOnlyReferenceEnabledField();602 603 if (!areAllReferenceSolved)604 {605 areAllReferenceSolved = true;606 607 if (context->getServiceType()==CServicesManager::CLIENT)608 {609 solveRefInheritance(true);610 if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false);611 }612 else if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER)613 solveServerOperation();614 615 solveGridReference();616 }617 618 solveGridDomainAxisRef(doSending2Server);619 620 if (context->getServiceType()==CServicesManager::CLIENT)621 {622 solveTransformedGrid();623 }624 625 }626 447 CATCH_DUMP_ATTR 627 448 … … 1013 834 } 1014 835 1015 /*! 1016 * Constructs the graph filter for the field, enabling or not the data output. 1017 * This method should not be called more than once with enableOutput equal to true. 1018 * 1019 * \param gc the garbage collector to use when building the filter graph 1020 * \param enableOutput must be true when the field data is to be 1021 * read by the client or/and written to a file 1022 */ 1023 // ym obselete : to be removed later.... 1024 void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput) 1025 TRY 1026 { 1027 // ==> before removing, solving dependency in spatial_transform_filter.cpp about auxilairy field 1028 /* 1029 if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 1030 if (!isGridChecked) checkGridOfEnabledFields(); 1031 1032 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1033 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1034 1035 CContext* context = CContext::getCurrent(); 1036 bool hasWriterServer = context->getServiceType()==CServicesManager::OUT_SERVER ; 1037 bool hasIntermediateServer = context->getServiceType()==CServicesManager::GATHERER ; 1038 1039 if (hasWriterServer) 1040 { 1041 if (!instantDataFilter) 1042 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid_, true, false)); 1043 1044 1045 // If the field data is to be read by the client or/and written to a file 1046 if (enableOutput && !clientToModelStoreFilter_ && !fileWriterFilter) 1047 { 1048 if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write)) 1049 { 1050 fileServerWriterFilter = std::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this)); 1051 instantDataFilter->connectOutput(fileServerWriterFilter, 0); 1052 } 1053 } 1054 } 1055 else if (hasIntermediateServer) 1056 { 1057 if (!instantDataFilter) 1058 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid_, false, false)); 1059 1060 // If the field data is to be read by the client or/and written to a file 1061 if (enableOutput && !clientToModelStoreFilter_ && !fileWriterFilter) 1062 { 1063 if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write)) 1064 { 1065 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, getRelFile()->getContextClient())); 1066 instantDataFilter->connectOutput(fileWriterFilter, 0); 1067 } 1068 } 1069 } 1070 else 1071 { 1072 // Start by building a filter which can provide the field's instant data 1073 if (!instantDataFilter) 1074 { 1075 // Check if we have an expression to parse 1076 if (hasExpression()) 1077 { 1078 boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0')); 1079 std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this); 1080 1081 // Check if a spatial transformation is needed 1082 if (!field_ref.isEmpty()) 1083 { 1084 CGrid* gridRef = CField::get(field_ref)->grid_; 1085 if (grid_ && grid_ != gridRef && grid_->hasTransform()) 1086 { 1087 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid_, detectMissingValues, defaultValue); 1088 1089 filter->connectOutput(filters.first, 0); 1090 filter = filters.second; 1091 } 1092 } 1093 1094 instantDataFilter = filter; 1095 } 1096 // Check if we have a reference on another field 1097 else if (!field_ref.isEmpty()) instantDataFilter = getFieldReference(gc); 1098 // Check if the data is to be read from a file 1099 else if (getRelFile() && !getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::read) 1100 { 1101 checkTimeAttributes(); 1102 instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid_, true, false, freq_offset, true, 1103 detectMissingValues, defaultValue)); 1104 } 1105 else // The data might be passed from the model 1106 { 1107 if (check_if_active.isEmpty()) check_if_active = false; 1108 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid_, false, true, NoneDu, false, 1109 detectMissingValues, defaultValue)); 1110 } 1111 } 1112 1113 // If the field data is to be read by the client or/and written to a file 1114 if (enableOutput && !clientToModelStoreFilter_ && !fileWriterFilter) 1115 { 1116 if (!read_access.isEmpty() && read_access) 1117 { 1118 clientToModelStoreFilter_ = std::shared_ptr<CClientToModelStoreFilter>(new CClientToModelStoreFilter(gc, this)); 1119 instantDataFilter->connectOutput(clientToModelStoreFilter_, 0); 1120 } 1121 1122 if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write)) 1123 { 1124 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, getRelFile()->getContextClient())); 1125 getTemporalDataFilter(gc, getRelFile()->output_freq)->connectOutput(fileWriterFilter, 0); 1126 } 1127 } 1128 } 1129 */ 1130 } 1131 CATCH_DUMP_ATTR 1132 1133 /*! 1134 * Returns the filter needed to handle the field reference. 1135 * This method should only be called when building the filter graph corresponding to the field. 1136 * 1137 * \param gc the garbage collector to use 1138 * \return the output pin corresponding to the field reference 1139 */ 1140 std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 1141 TRY 1142 { 1143 if (instantDataFilter || field_ref.isEmpty()) 1144 ERROR("COutputPin* CField::getFieldReference(CGarbageCollector& gc)", 1145 "Impossible to get the field reference for a field which has already been parsed or which does not have a field_ref."); 1146 1147 CField* fieldRef = CField::get(field_ref); 1148 fieldRef->buildFilterGraph(gc, false); 1149 1150 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; 1151 // Check if a spatial transformation is needed 1152 if (grid_ && grid_ != fieldRef->grid_ && grid_->hasTransform()) 1153 { 1154 bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1155 double defaultValue = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1156 filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid_, grid_, hasMissingValue, defaultValue); 1157 } 1158 else 1159 filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 1160 1161 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 1162 1163 return filters.second; 1164 } 1165 CATCH_DUMP_ATTR 1166 836 837 1167 838 /*! 1168 839 * Returns the filter needed to handle a self reference in the field's expression. … … 1463 1134 CATCH_DUMP_ATTR 1464 1135 1465 void CField::solveTransformedGrid() 1466 TRY 1467 { 1468 if (grid_ && !grid_->isTransformed() && hasDirectFieldReference() && grid_ != getDirectFieldReference()->grid_) 1469 { 1470 std::vector<CGrid*> grids; 1471 // Source grid 1472 grids.push_back(getDirectFieldReference()->grid_); 1473 auto gridPath = getGridPath() ; 1474 grids.insert(grids.begin(), gridPath.begin(), gridPath.end()); 1475 1476 for (size_t i = 0, count = grids.size() - 1; i < count; ++i) 1477 { 1478 CGrid *gridSrc = grids[i]; 1479 CGrid *gridDest = grids[i + 1]; 1480 if (!gridDest->isTransformed()) gridDest->transformGrid(gridSrc); 1481 } 1482 } 1483 else if (grid_ && grid_->hasTransform() && !grid_->isTransformed()) 1484 { 1485 // Temporarily deactivate the self-transformation of grid 1486 // grid_->transformGrid(grid_); 1487 } 1488 } 1489 CATCH_DUMP_ATTR 1490 1491 void CField::solveGenerateGrid() 1492 TRY 1493 { 1494 if (grid_ && !grid_->isTransformed() && hasDirectFieldReference() && grid_ != getDirectFieldReference()->grid_) 1495 grid_->completeGrid(getDirectFieldReference()->grid_); 1496 else grid_->completeGrid(); 1497 } 1498 CATCH_DUMP_ATTR 1499 1136 1500 1137 void CField::solveGridDomainAxisBaseRef() 1501 1138 TRY -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp
r1984 r2002 129 129 void solveServerOperation(void); 130 130 void solveCheckMaskIndex(bool doSendingIndex); 131 void solveAllReferenceEnabledField(bool doSending2Server);132 void solveOnlyReferenceEnabledField(void);133 void generateNewTransformationGridDest();134 131 void updateRef(CGrid* grid); 135 void buildGridTransformationGraph();136 132 void solveGridDomainAxisRef(bool checkAtt); 137 void solveTransformedGrid();138 void solveGenerateGrid();139 133 void solveGridDomainAxisBaseRef(); 140 134 141 void solveAllEnabledFieldsAndTransform();142 135 void checkGridOfEnabledFields(); 143 136 void sendGridOfEnabledFields(); … … 158 151 void checkTimeAttributes(CDuration* freqOp=NULL); 159 152 160 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput);161 162 153 bool buildWorkflowGraph(CGarbageCollector& gc) ; 163 154 bool buildWorkflowGraphDone_ = false ; … … 166 157 167 158 168 std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc);169 159 std::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc); 170 160 std::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/file.cpp
r1962 r2002 734 734 735 735 // Now complete domain and axis associated with this field 736 enabledFields[idx]->solveGenerateGrid(); 736 737 //ym => this a problem in wich order are done the grid generation. Probably metadata are read in file and after the grid is ditributed by the filter 738 // => must be checked in detail. But solveGenerated grid is not existing any more with new transformation framework 739 // enabledFields[idx]->solveGenerateGrid(); 737 740 738 741 // Read necessary value from file … … 818 821 819 822 //---------------------------------------------------------------- 820 821 /*!822 \brief Resolve all reference of active fields.823 In order to know exactly which data each active field has, a search for all its824 reference to find its parents or/and its base reference object must be done. Moreover825 during this search, there are some information that can only be sent to server AFTER826 all information of active fields are created on server side, e.g: checking mask or index827 \param [in] sendToServer: Send all info to server (true) or only a part of it (false)828 */829 void CFile::solveOnlyRefOfEnabledFields(void)830 TRY831 {832 int size = this->enabledFields.size();833 for (int i = 0; i < size; ++i)834 {835 this->enabledFields[i]->solveOnlyReferenceEnabledField();836 }837 }838 CATCH_DUMP_ATTR839 823 840 824 void CFile::checkGridOfEnabledFields() … … 927 911 CATCH_DUMP_ATTR 928 912 929 void CFile::generateNewTransformationGridDest()930 TRY931 {932 int size = this->enabledFields.size();933 for (int i = 0; i < size; ++i)934 {935 this->enabledFields[i]->generateNewTransformationGridDest();936 }937 }938 CATCH_DUMP_ATTR939 940 /*!941 \brief Resolve all reference of active fields.942 In order to know exactly which data each active field has, a search for all its943 reference to find its parents or/and its base reference object must be done. Moreover944 during this search, there are some information that can only be sent to server AFTER945 all information of active fields are created on server side, e.g: checking mask or index946 \param [in] sendToServer: Send all info to server (true) or only a part of it (false)947 */948 void CFile::solveAllRefOfEnabledFieldsAndTransform(void)949 TRY950 {951 int size = this->enabledFields.size();952 for (int i = 0; i < size; ++i)953 {954 this->enabledFields[i]->solveAllEnabledFieldsAndTransform();955 }956 }957 CATCH_DUMP_ATTR958 959 /*!960 * Constructs the filter graph for each active field.961 *962 * \param gc the garbage collector to use when building the filter graph963 */964 void CFile::buildFilterGraphOfEnabledFields(CGarbageCollector& gc)965 TRY966 {967 int size = this->enabledFields.size();968 for (int i = 0; i < size; ++i)969 {970 this->enabledFields[i]->buildFilterGraph(gc, true);971 }972 }973 CATCH_DUMP_ATTR974 913 975 914 /*! -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/file.hpp
r1961 r2002 109 109 void solveFieldRefInheritance(bool apply); 110 110 void processEnabledFile(void); 111 void solveOnlyRefOfEnabledFields(void);112 void generateNewTransformationGridDest();113 111 114 void buildFilterGraphOfEnabledFields(CGarbageCollector& gc);115 112 void postProcessFilterGraph(); 116 113 void prefetchEnabledReadModeFields(); … … 118 115 void doPostTimestepOperationsForEnabledReadModeFields(); 119 116 120 void solveAllRefOfEnabledFieldsAndTransform(void);121 117 void checkGridOfEnabledFields(); 122 118 void sendGridOfEnabledFields(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r1999 r2002 17 17 #include "distribution_client.hpp" 18 18 #include "grid_transformation.hpp" 19 #include "grid_generate.hpp"20 19 #include "server.hpp" 21 20 #include "distribution_type.hpp" … … 46 45 , transformations_(0), isTransformed_(false) 47 46 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 48 , gridSrc_(), hasTransform_(false), isGenerated_(false),order_()47 , gridSrc_(), hasTransform_(false), order_() 49 48 , clients() 50 49 { … … 65 64 , transformations_(0), isTransformed_(false) 66 65 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 67 , gridSrc_(), hasTransform_(false), isGenerated_(false),order_()66 , gridSrc_(), hasTransform_(false), order_() 68 67 , clients() 69 68 { … … 838 837 if (this->isChecked) return; 839 838 this->checkElementsAttributes(); 840 841 if (!(this->hasTransform() && !this->isTransformed())) 842 this->isChecked = true; 843 844 if (!(this->hasTransform() && (!this->isGenerated()))) 845 this->isChecked = true; 839 this->isChecked = true; 846 840 } 847 841 CATCH_DUMP_ATTR … … 938 932 939 933 940 /*!941 Compute the global index of grid to send to server as well as the connected server of the current client.942 First of all, from the local data on each element of grid, we can calculate their local index which also allows us to know943 their global index. We can have a map of global index of grid and local index that each client holds944 Then, each client holds a piece of information about the distribution of servers, which permits to compute the connected server(s)945 of the current client.946 */947 // ym obsolete : to be removed....948 void CGrid::computeIndex(void)949 TRY950 {951 // old interface952 CContext* context = CContext::getCurrent();953 if (isScalarGrid())954 {955 //computeClientIndexScalarGrid();956 if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER)957 {958 // ym computeConnectedClientsScalarGrid();959 }960 }961 else962 {963 //computeClientIndex();964 if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER)965 {966 //computeConnectedClients();967 }968 }969 //ym if (CServer::serverLevel==2)970 if (context->getServiceType()==CServicesManager::OUT_SERVER)971 {972 if (clientDistribution_!=0) clientDistribution_->partialClear() ;973 }974 }975 CATCH_DUMP_ATTR976 977 978 979 934 980 935 CGrid* CGrid::cloneGrid(const StdString& idNewGrid, CGrid* gridSrc) … … 1730 1685 CATCH_DUMP_ATTR 1731 1686 1732 bool CGrid::isTransformed() 1733 TRY 1734 { 1735 return isTransformed_; 1736 } 1737 CATCH_DUMP_ATTR 1738 1739 void CGrid::setTransformed() 1740 TRY 1741 { 1742 isTransformed_ = true; 1743 } 1744 CATCH_DUMP_ATTR 1745 1746 CGridTransformation* CGrid::getTransformations() 1747 TRY 1748 { 1749 return transformations_; 1750 } 1751 CATCH_DUMP_ATTR 1752 1753 void CGrid::addTransGridSource(CGrid* gridSrc) 1754 TRY 1755 { 1756 if (gridSrc_.end() == gridSrc_.find(gridSrc)) 1757 gridSrc_.insert(make_pair(gridSrc,make_pair(false,""))); 1758 } 1759 CATCH_DUMP_ATTR 1760 1761 std::map<CGrid*,std::pair<bool,StdString> >& CGrid::getTransGridSource() 1762 TRY 1763 { 1764 return gridSrc_; 1765 } 1766 CATCH_DUMP_ATTR 1767 1768 /*! 1769 Complete all the necessary (and lacking) attributes of a grid 1770 This function is similar to gridTransformation but works only (till now) on generate_rectilinear_domain transformation 1771 */ 1772 void CGrid::completeGrid(CGrid* transformGridSrc) 1773 TRY 1774 { 1775 if (nullptr != transformGridSrc) 1776 { 1777 if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 1778 { 1779 ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 1780 << "Two grids have different number of elements. " << std::endl 1781 << "Number of element of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 1782 << "Number of element of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 1783 } 1784 } 1785 1786 if (isGenerated()) return; 1787 setGenerated(); 1788 1789 CGridGenerate gridGenerate(this, transformGridSrc); 1790 gridGenerate.completeGrid(); 1791 } 1792 CATCH_DUMP_ATTR 1793 1794 bool CGrid::isGenerated() 1795 TRY 1796 { 1797 return isGenerated_; 1798 } 1799 CATCH 1800 1801 void CGrid::setGenerated() 1802 TRY 1803 { 1804 isGenerated_ = true; 1805 } 1806 CATCH_DUMP_ATTR 1807 1808 void CGrid::transformGrid(CGrid* transformGridSrc) 1809 TRY 1810 { 1811 if (!transformGridSrc) 1812 ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 1813 << "Impossible to transform grid '" << getId() << "', the source grid is null."); 1814 1815 if (isTransformed()) return; 1816 setTransformed(); 1817 if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 1818 { 1819 ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 1820 << "Two grids have different number of elements. " << std::endl 1821 << "Number of element of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 1822 << "Number of element of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 1823 } 1824 else 1825 { 1826 } 1827 1828 transformations_ = new CGridTransformation(this, transformGridSrc); 1829 transformations_->computeAll(); 1830 if (0 < transformations_->getNbAlgo()) hasTransform_ = true; 1831 1832 } 1833 CATCH_DUMP_ATTR 1834 1835 1836 1837 1838 void CGrid::prepareTransformGrid(CGrid* transformGridSrc) 1839 TRY 1840 { 1841 if (prepareTransformGrid_done_) return ; 1842 1843 if (!transformGridSrc) 1844 ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 1845 << "Impossible to transform grid '" << getId() << "', the source grid is null."); 1846 1847 if (isTransformed()) return; 1848 setTransformed(); 1849 if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 1850 { 1851 ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 1852 << "Two grids have different number of elements. " << std::endl 1853 << "Number of element of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 1854 << "Number of element of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 1855 } 1856 else 1857 { 1858 } 1859 1860 transformations_ = new CGridTransformation(this, transformGridSrc); 1861 if (0 < transformations_->getNbAlgo()) hasTransform_ = true; 1862 1863 prepareTransformGrid_done_ = true; 1864 } 1865 CATCH_DUMP_ATTR 1866 1867 1868 void CGrid::makeTransformGrid(void) 1869 TRY 1870 { 1871 if (makeTransformGrid_done_) return ; 1872 transformations_->computeAll(); 1873 1874 makeTransformGrid_done_ = true ; 1875 } 1876 CATCH_DUMP_ATTR 1877 1687 1878 1688 1879 1689 vector<std::string> CGrid::getAuxInputTransformGrid(void) … … 1881 1691 { 1882 1692 if (transformations_ != nullptr) return transformations_->getAuxInputs() ; 1883 }1884 CATCH_DUMP_ATTR1885 1886 1887 bool CGrid::hasTransform()1888 TRY1889 {1890 if (hasTransform_) return hasTransform_;1891 1892 std::vector<CDomain*> domList = getDomains();1893 std::vector<CAxis*> axisList = getAxis();1894 std::vector<CScalar*> scalarList = getScalars();1895 1896 for (int idx = 0; idx < domList.size(); ++idx) hasTransform_ |= domList[idx]->hasTransformation();1897 for (int idx = 0; idx < axisList.size(); ++idx) hasTransform_ |= axisList[idx]->hasTransformation();1898 for (int idx = 0; idx < scalarList.size(); ++idx) hasTransform_ |= scalarList[idx]->hasTransformation();1899 1900 return hasTransform_;1901 1693 } 1902 1694 CATCH_DUMP_ATTR -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
r1999 r2002 149 149 150 150 public: 151 void computeIndex(void);152 void computeIndexScalarGrid();153 151 void solveDomainAxisRef(bool areAttributesChecked); 154 152 void checkElementsAttributes(void) ; … … 219 217 CGridTransformation* getTransformations(); 220 218 221 void transformGrid(CGrid* transformGridSrc);222 223 void prepareTransformGrid(CGrid* transformGridSrc);224 bool prepareTransformGrid_done_ = false ;225 226 void makeTransformGrid(void);227 bool makeTransformGrid_done_ = false ;228 229 219 std::vector<std::string> getAuxInputTransformGrid(void) ; 230 std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource();231 bool hasTransform();232 void addTransGridSource(CGrid* gridSrc);233 void completeGrid(CGrid* transformGridSrc = 0);234 bool isTransformed();235 void setTransformed();236 bool isGenerated();237 void setGenerated();238 220 void setTransformationAlgorithms(); 239 221 pair<shared_ptr<CFilter>, shared_ptr<CFilter> > buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, … … 245 227 CGridAlgorithm* getGridAlgorithm(void) { return gridAlgorithm_ ;} 246 228 private: 247 bool isTransformed_ , isGenerated_;229 bool isTransformed_; 248 230 CGridTransformation* transformations_; 249 231 bool hasTransform_; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algo_types.hpp
r1988 r2002 1 1 /*! 2 \file grid_generate.hpp2 \file algo_type.hpp 3 3 \author Ha NGUYEN 4 4 \since 28 Aug 2015 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_interpolate.cpp
r1998 r2002 48 48 TRY 49 49 { 50 cout<<"REGISTRED"<<endl ; 50 51 return CGridTransformationFactory<CDomain>::registerTransformation(TRANS_INTERPOLATE_DOMAIN, create); 51 52 } … … 116 117 117 118 CContext* context = CContext::getCurrent(); 118 int clientRank = context->intraCommRank_; 119 int clientRank = context->intraCommRank_; 119 120 int i, j, k, idx; 120 121 std::vector<double> srcPole(3,0), dstPole(3,0); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_interpolate.hpp
r1998 r2002 95 95 std::map<int, int>& elementPositionInGridDst2AxisPosition, 96 96 std::map<int, int>& elementPositionInGridDst2DomainPosition); 97 98 CDomain* domainSrc_ ; 99 CDomain* domainDest_ ; 100 101 public: 97 102 static bool dummyRegistered_; 98 103 99 CDomain* domainSrc_ ;100 CDomain* domainDest_ ;101 104 102 105 }; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_path.hpp
r1984 r2002 15 15 private: 16 16 TPath path_ ; 17 std::list<TPath> fullPath_ ;18 17 std::list<TPath> donePath_ ; 19 18 TPath remainPath_ ;
Note: See TracChangeset
for help on using the changeset viewer.