Changeset 1545 for XIOS/dev/branch_openmp/src/node/field.cpp
- Timestamp:
- 06/18/18 20:32:55 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/node/field.cpp
r1482 r1545 219 219 // Gather all data from different clients 220 220 recvDataSrv.resize(storeClient.numElements()); 221 recvFoperationSrv = boost::shared_ptr<func::CFunctor>(new func::CInstant(recvDataSrv));221 recvFoperationSrv = std::shared_ptr<func::CFunctor>(new func::CInstant(recvDataSrv)); 222 222 } 223 223 … … 505 505 if (!nstepMaxRead) 506 506 { 507 //MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm);508 507 MPI_Allreduce(&nstepMax, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm); 509 508 nstepMaxRead = true; … … 720 719 //---------------------------------------------------------------- 721 720 722 boost::shared_ptr<COutputPin> CField::getInstantDataFilter()721 std::shared_ptr<COutputPin> CField::getInstantDataFilter() 723 722 { 724 723 return instantDataFilter; … … 988 987 << "An operation must be defined for field \"" << getId() << "\"."); 989 988 990 boost::shared_ptr<func::CFunctor> functor;989 std::shared_ptr<func::CFunctor> functor; 991 990 CArray<double, 1> dummyData; 992 991 … … 1031 1030 { 1032 1031 if (!instantDataFilter) 1033 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true));1032 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true)); 1034 1033 1035 1034 … … 1039 1038 if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 1040 1039 { 1041 fileServerWriterFilter = boost::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this));1040 fileServerWriterFilter = std::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this)); 1042 1041 instantDataFilter->connectOutput(fileServerWriterFilter, 0); 1043 1042 } … … 1047 1046 { 1048 1047 if (!instantDataFilter) 1049 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true));1048 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true)); 1050 1049 1051 1050 // If the field data is to be read by the client or/and written to a file … … 1054 1053 if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 1055 1054 { 1056 fileWriterFilter = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));1055 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 1057 1056 instantDataFilter->connectOutput(fileWriterFilter, 0); 1058 1057 } … … 1068 1067 { 1069 1068 boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0')); 1070 boost::shared_ptr<COutputPin> filter = expr->reduce(gc, *this);1069 std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this); 1071 1070 1072 1071 // Check if a spatial transformation is needed … … 1077 1076 if (grid && grid != gridRef && grid->hasTransform()) 1078 1077 { 1079 std::pair< boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue);1078 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); 1080 1079 1081 1080 filter->connectOutput(filters.first, 0); … … 1093 1092 { 1094 1093 checkTimeAttributes(); 1095 instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true,1094 instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true, 1096 1095 detectMissingValues, defaultValue)); 1097 1096 } … … 1099 1098 { 1100 1099 if (check_if_active.isEmpty()) check_if_active = false; 1101 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false,1100 instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 1102 1101 detectMissingValues, defaultValue)); 1103 1102 } … … 1109 1108 if (!read_access.isEmpty() && read_access) 1110 1109 { 1111 storeFilter = boost::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid,1110 storeFilter = std::shared_ptr<CStoreFilter>(new CStoreFilter(gc, CContext::getCurrent(), grid, 1112 1111 detectMissingValues, defaultValue)); 1113 1112 instantDataFilter->connectOutput(storeFilter, 0); … … 1116 1115 if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 1117 1116 { 1118 fileWriterFilter = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this));1117 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 1119 1118 getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 1120 1119 } … … 1130 1129 * \return the output pin corresponding to the field reference 1131 1130 */ 1132 boost::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc)1131 std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 1133 1132 { 1134 1133 if (instantDataFilter || field_ref.isEmpty()) … … 1139 1138 fieldRef->buildFilterGraph(gc, false); 1140 1139 1141 std::pair< boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters;1140 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; 1142 1141 // Check if a spatial transformation is needed 1143 1142 if (grid && grid != fieldRef->grid && grid->hasTransform()) … … 1148 1147 } 1149 1148 else 1150 filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc));1149 filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 1151 1150 1152 1151 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); … … 1164 1163 * \return the output pin corresponding to a self reference 1165 1164 */ 1166 boost::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc)1165 std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 1167 1166 { 1168 1167 if (instantDataFilter || !hasExpression()) … … 1180 1179 { 1181 1180 checkTimeAttributes(); 1182 serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true,1181 serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true, 1183 1182 detectMissingValues, defaultValue)); 1184 1183 } … … 1197 1196 { 1198 1197 if (check_if_active.isEmpty()) check_if_active = false; 1199 clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, NoneDu, false,1198 clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, NoneDu, false, 1200 1199 detectMissingValues, defaultValue)); 1201 1200 } … … 1217 1216 * \return the output pin corresponding to the requested temporal filter 1218 1217 */ 1219 boost::shared_ptr<COutputPin> CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)1220 { 1221 std::map<CDuration, boost::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq);1218 std::shared_ptr<COutputPin> CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) 1219 { 1220 std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 1222 1221 1223 1222 if (it == temporalDataFilters.end()) … … 1230 1229 1231 1230 const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 1232 boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation,1231 std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 1233 1232 CContext::getCurrent()->getCalendar()->getInitDate(), 1234 1233 freq_op, freq_offset, outFreq, detectMissingValues)); … … 1251 1250 */ 1252 1251 1253 boost::shared_ptr<COutputPin> CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)1252 std::shared_ptr<COutputPin> CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) 1254 1253 { 1255 1254 if (instantDataFilter || !hasExpression()) … … 1268 1267 1269 1268 const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 1270 boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation,1269 std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 1271 1270 CContext::getCurrent()->getCalendar()->getInitDate(), 1272 1271 freq_op, freq_offset, outFreq, detectMissingValues)); … … 1319 1318 std::vector<CScalar*> vecScalar; 1320 1319 std::vector<int> axisDomainOrderTmp; 1320 1321 std::vector<CDomain*> vecDomRef; 1322 std::vector<CAxis*> vecAxisRef; 1323 std::vector<CScalar*> vecScalarRef; 1324 1321 1325 1322 1326 if (!domain_ref.isEmpty()) … … 1326 1330 { 1327 1331 vecDom.push_back(CDomain::get(domain_ref)); 1332 vecDomRef.push_back(CDomain::createDomain()); 1333 vecDomRef.back()->domain_ref=domain_ref; 1328 1334 axisDomainOrderTmp.push_back(2); 1329 1335 } 1330 else 1331 ERROR("CField::solveGridReference(void)", 1332 << "Invalid reference to domain '" << domain_ref.getValue() << "'."); 1336 else ERROR("CField::solveGridReference(void)", 1337 << "Invalid reference to domain '" << domain_ref.getValue() << "'."); 1333 1338 } 1334 1339 … … 1338 1343 { 1339 1344 vecAxis.push_back(CAxis::get(axis_ref)); 1345 vecAxisRef.push_back(CAxis::createAxis()); 1346 vecAxisRef.back()->axis_ref=axis_ref; 1340 1347 axisDomainOrderTmp.push_back(1); 1341 1348 } 1342 else 1343 ERROR("CField::solveGridReference(void)", 1344 << "Invalid reference to axis '" << axis_ref.getValue() << "'."); 1349 else ERROR("CField::solveGridReference(void)", 1350 << "Invalid reference to axis '" << axis_ref.getValue() << "'."); 1345 1351 } 1346 1352 … … 1350 1356 { 1351 1357 vecScalar.push_back(CScalar::get(scalar_ref)); 1358 vecScalarRef.push_back(CScalar::createScalar()); 1359 vecScalarRef.back()->scalar_ref=scalar_ref; 1352 1360 axisDomainOrderTmp.push_back(0); 1353 1361 } 1354 else 1355 ERROR("CField::solveGridReference(void)", 1356 << "Invalid reference to scalar '" << scalar_ref.getValue() << "'."); 1362 else ERROR("CField::solveGridReference(void)", 1363 << "Invalid reference to scalar '" << scalar_ref.getValue() << "'."); 1357 1364 } 1358 1365 … … 1365 1372 // Warning: the gridId shouldn't be set as the grid_ref since it could be inherited 1366 1373 StdString gridId = CGrid::generateId(vecDom, vecAxis, vecScalar,axisDomainOrder); 1367 if (CGrid::has(gridId)) 1368 this->grid = CGrid::get(gridId); 1369 else 1370 this->grid = CGrid::createGrid(gridId, vecDom, vecAxis, vecScalar,axisDomainOrder); 1374 if (CGrid::has(gridId)) this->grid = CGrid::get(gridId); 1375 else this->grid = CGrid::createGrid(gridId, vecDomRef, vecAxisRef, vecScalarRef,axisDomainOrder); 1371 1376 } 1372 1377 else 1373 1378 { 1374 if (CGrid::has(grid_ref)) 1375 this->grid = CGrid::get(grid_ref); 1376 else 1377 ERROR("CField::solveGridReference(void)", 1378 << "Invalid reference to grid '" << grid_ref.getValue() << "'."); 1379 if (CGrid::has(grid_ref)) this->grid = CGrid::get(grid_ref); 1380 else ERROR("CField::solveGridReference(void)", 1381 << "Invalid reference to grid '" << grid_ref.getValue() << "'."); 1379 1382 } 1380 1383 } … … 1621 1624 } 1622 1625 1626 1627 /*! 1628 * Send all Attributes to server. This method is overloaded, since only grid_ref attribute 1629 * must be sent to server and not domain_ref/axis_ref/scalar_ref. 1630 */ 1631 1632 void CField::sendAllAttributesToServer(CContextClient* client) 1633 { 1634 if (grid_ref.isEmpty()) 1635 { 1636 grid_ref=grid->getId() ; 1637 SuperClass::sendAllAttributesToServer(client) ; 1638 grid_ref.reset(); 1639 } 1640 else SuperClass::sendAllAttributesToServer(client) ; 1641 } 1642 1623 1643 void CField::sendAddVariable(const string& id, CContextClient* client) 1624 1644 { … … 1670 1690 bool isFieldRead = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read; 1671 1691 bool isFieldWrite = file && ( file->mode.isEmpty() || file->mode == CFile::mode_attr::write); 1672 if (isFieldRead && operation.getValue() != "instant")1692 if (isFieldRead && !(operation.getValue() == "instant" || operation.getValue() == "once") ) 1673 1693 ERROR("void CField::checkTimeAttributes(void)", 1674 1694 << "Unsupported operation for field '" << getFieldOutputName() << "'." << std::endl
Note: See TracChangeset
for help on using the changeset viewer.