Changeset 1872
- Timestamp:
- 04/23/20 16:04:22 (5 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_output.cpp
r1871 r1872 2144 2144 2145 2145 if (field->compression_level.isEmpty()) 2146 field->compression_level = field-> file->compression_level.isEmpty() ? 0 : field->file->compression_level;2146 field->compression_level = field->getRelFile()->compression_level.isEmpty() ? 0 : field->getRelFile()->compression_level; 2147 2147 SuperClassWriter::setCompressionLevel(fieldid, field->compression_level); 2148 2148 … … 2374 2374 if (!field->wasWritten()) 2375 2375 { 2376 if (appendMode && field-> file->record_offset.isEmpty() &&2376 if (appendMode && field->getRelFile()->record_offset.isEmpty() && 2377 2377 field->getOperationTimeType() != func::CFunctor::once) 2378 2378 { 2379 2379 double factorUnit; 2380 if (!field-> file->time_units.isEmpty() && field->file->time_units==CFile::time_units_attr::days)2380 if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) 2381 2381 factorUnit=context->getCalendar()->getDayLengthInSeconds() ; 2382 2382 else factorUnit=1 ; … … 2439 2439 } 2440 2440 2441 if (!field-> file->time_units.isEmpty() && field->file->time_units==CFile::time_units_attr::days)2441 if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) 2442 2442 { 2443 2443 double secByDay=context->getCalendar()->getDayLengthInSeconds() ; … … 2678 2678 2679 2679 StdString strTimeUnits ; 2680 if (!field-> file->time_units.isEmpty() && field->file->time_units==CFile::time_units_attr::days) strTimeUnits="days since " ;2680 if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) strTimeUnits="days since " ; 2681 2681 else strTimeUnits="seconds since " ; 2682 2682 … … 2685 2685 2686 2686 2687 if (field-> file->time_counter.isEmpty())2687 if (field->getRelFile()->time_counter.isEmpty()) 2688 2688 { 2689 2689 if (timeCounterType==none) createTimeCounterAxis=true ; … … 2699 2699 } 2700 2700 } 2701 else if (field-> file->time_counter==CFile::time_counter_attr::instant)2701 else if (field->getRelFile()->time_counter==CFile::time_counter_attr::instant) 2702 2702 { 2703 2703 if (field->hasTimeCentered) … … 2712 2712 } 2713 2713 } 2714 else if (field-> file->time_counter==CFile::time_counter_attr::centered)2714 else if (field->getRelFile()->time_counter==CFile::time_counter_attr::centered) 2715 2715 { 2716 2716 if (field->hasTimeCentered) … … 2725 2725 } 2726 2726 } 2727 else if (field-> file->time_counter==CFile::time_counter_attr::instant_exclusive)2727 else if (field->getRelFile()->time_counter==CFile::time_counter_attr::instant_exclusive) 2728 2728 { 2729 2729 if (field->hasTimeCentered) … … 2737 2737 } 2738 2738 } 2739 else if (field-> file->time_counter==CFile::time_counter_attr::centered_exclusive)2739 else if (field->getRelFile()->time_counter==CFile::time_counter_attr::centered_exclusive) 2740 2740 { 2741 2741 if (field->hasTimeCentered) … … 2749 2749 } 2750 2750 } 2751 else if (field-> file->time_counter==CFile::time_counter_attr::exclusive)2751 else if (field->getRelFile()->time_counter==CFile::time_counter_attr::exclusive) 2752 2752 { 2753 2753 if (field->hasTimeCentered) … … 2770 2770 } 2771 2771 } 2772 else if (field-> file->time_counter==CFile::time_counter_attr::none)2772 else if (field->getRelFile()->time_counter==CFile::time_counter_attr::none) 2773 2773 { 2774 2774 if (field->hasTimeCentered) … … 2781 2781 } 2782 2782 } 2783 else if (field-> file->time_counter==CFile::time_counter_attr::record)2783 else if (field->getRelFile()->time_counter==CFile::time_counter_attr::record) 2784 2784 { 2785 2785 if (timeCounterType==none) createTimeCounterAxis=true ; … … 2852 2852 SuperClassWriter::addAttribute("axis", string("T"), &axisId); 2853 2853 2854 if (field-> file->time_counter.isEmpty() ||2855 (field-> file->time_counter != CFile::time_counter_attr::record))2854 if (field->getRelFile()->time_counter.isEmpty() || 2855 (field->getRelFile()->time_counter != CFile::time_counter_attr::record)) 2856 2856 { 2857 2857 CDate timeOrigin = cal->getTimeOrigin(); … … 2865 2865 2866 2866 // Adding time_counter_bound dimension 2867 if (field-> file->time_counter.isEmpty() || (field->file->time_counter != CFile::time_counter_attr::record))2867 if (field->getRelFile()->time_counter.isEmpty() || (field->getRelFile()->time_counter != CFile::time_counter_attr::record)) 2868 2868 { 2869 2869 if (!SuperClassWriter::varExist(axisBoundId)) -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp
r1871 r1872 383 383 for (int i = 0; i < data_n; ++i) 384 384 { 385 if ((i+data_begin) >= 0 && (i+data_begin<n) && !mask(i+data_begin))386 data_index(i) = -1;385 if (data_index(i) >= 0 && data_index(i)<n) 386 if (!mask(data_index(i))) data_index(i) = -1; 387 387 } 388 388 } … … 1281 1281 nonCompressedData = -1; 1282 1282 // Mask is incorporated into data_index and is not sent/received anymore 1283 mask.res ize(0);1283 mask.reset(); 1284 1284 if (hasValue) 1285 1285 value.resize(nbData); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
r1871 r1872 1091 1091 else if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledWriteModeFiles) file->setContextClient(client) ; 1092 1092 1093 if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledReadModeFiles) file->setContextClient(client) ; 1093 1094 1094 1095 // workflow endpoint => sent to IO/SERVER … … 1152 1153 field->connectToServerInput(garbageCollector) ; // connect the field to server filter 1153 1154 field->computeGridIndexToFileServer() ; // compute grid index for transfer to the server context 1154 field->sendFieldTo FileServer() ;1155 field->sendFieldToInputFileServer() ; 1155 1156 } 1156 1157 } … … 1164 1165 1165 1166 if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) this->sendCloseDefinition(); 1166 if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) createFileHeader(); 1167 if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) 1168 { 1169 createFileHeader(); 1170 } 1171 1167 1172 if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 1168 1173 … … 2627 2632 vector<CFile*>::const_iterator it; 2628 2633 2629 for (it=enabledFiles.begin(); it != enabledFiles.end(); it++)2630 //for (it=enabledWriteModeFiles.begin(); it != enabledWriteModeFiles.end(); it++)2634 //for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) 2635 for (it=enabledWriteModeFiles.begin(); it != enabledWriteModeFiles.end(); it++) 2631 2636 { 2632 2637 (*it)->initWrite(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
r1871 r1872 33 33 CField::CField(void) 34 34 : CObjectTemplate<CField>(), CFieldAttributes() 35 , file()36 35 , written(false) 37 36 , nstep(0), nstepMax(0) … … 51 50 CField::CField(const StdString& id) 52 51 : CObjectTemplate<CField>(id), CFieldAttributes() 53 , file()54 52 , written(false) 55 53 , nstep(0), nstepMax(0) … … 360 358 info(20) << "currentDate : " << currentDate << endl ; 361 359 info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; 362 info(20) << "file ->output_freq.getValue() : " << file->output_freq.getValue() << endl ;363 info(20) << "lastDataRequestedFromServer + file ->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ;364 365 dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file ->output_freq, file->getContextClient());360 info(20) << "fileIn_->output_freq.getValue() : " << fileIn_->output_freq.getValue() << endl ; 361 info(20) << "lastDataRequestedFromServer + fileIn_->output_freq.getValue() : " << lastDataRequestedFromServer + fileIn_->output_freq << endl ; 362 363 dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + fileIn_->output_freq, fileIn_->getContextClient()); 366 364 } 367 365 … … 580 578 581 579 if (wasDataAlreadyReceivedFromServer) 582 lastDataReceivedFromServer = lastDataReceivedFromServer + file ->output_freq;580 lastDataReceivedFromServer = lastDataReceivedFromServer + fileIn_->output_freq; 583 581 else 584 582 { … … 616 614 do 617 615 { 618 const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + file ->output_freq) : context->getCalendar()->getInitDate();616 const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + fileIn_->output_freq) : context->getCalendar()->getInitDate(); 619 617 isDataLate = (nextDataDue <= currentDate); 620 618 … … 659 657 660 658 //---------------------------------------------------------------- 661 659 /* 662 660 void CField::setRelFile(CFile* _file) 663 661 TRY … … 667 665 } 668 666 CATCH_DUMP_ATTR 669 667 */ 670 668 //---------------------------------------------------------------- 671 669 … … 688 686 TRY 689 687 { 690 return this->file; 688 if (hasFileIn()) return this->fileIn_; 689 else if (hasFileOut()) return this->fileOut_ ; 690 else return nullptr ; 691 691 } 692 692 CATCH … … 1098 1098 CContext* context = CContext::getCurrent(); 1099 1099 1100 if (context->getServiceType()==CServicesManager::CLIENT || !hasOutputFile) return;1101 1102 1100 if (freq_op.isEmpty()) freq_op.setValue(TimeStep); 1103 1101 1104 1102 if (freq_offset.isEmpty()) freq_offset.setValue(NoneDu); 1105 1103 1106 freq_operation_srv = file ->output_freq.getValue();1107 freq_write_srv = file ->output_freq.getValue();1104 freq_operation_srv = fileOut_->output_freq.getValue(); 1105 freq_write_srv = fileOut_->output_freq.getValue(); 1108 1106 1109 1107 lastlast_Write_srv = context->getCalendar()->getInitDate(); … … 1234 1232 } 1235 1233 1234 if (hasFileOut()) 1235 { 1236 if (fileOut_->isServerSide()) 1237 { 1238 this->solveServerOperation() ; 1239 } 1240 } 1241 1236 1242 buildWorkflowGraphDone_ = true ; 1237 1243 workflowEnabled_ = true ; … … 1288 1294 void CField::connectToServerInput(CGarbageCollector& gc) 1289 1295 { 1290 serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid_, false, false)); 1296 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1297 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 1298 1299 checkTimeAttributes(); 1300 serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid_, true, false, freq_offset, true, 1301 detectMissingValues, defaultValue)); 1302 //serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid_, false, false)); 1291 1303 serverSourceFilter -> connectOutput(inputFilter,0) ; 1292 1304 } … … 1382 1394 if (enableOutput && !storeFilter && !fileWriterFilter) 1383 1395 { 1384 if ( file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))1396 if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write)) 1385 1397 { 1386 1398 fileServerWriterFilter = std::shared_ptr<CFileServerWriterFilter>(new CFileServerWriterFilter(gc, this)); … … 1397 1409 if (enableOutput && !storeFilter && !fileWriterFilter) 1398 1410 { 1399 if ( file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))1411 if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write)) 1400 1412 { 1401 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, file->getContextClient()));1413 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, getRelFile()->getContextClient())); 1402 1414 instantDataFilter->connectOutput(fileWriterFilter, 0); 1403 1415 } … … 1433 1445 else if (!field_ref.isEmpty()) instantDataFilter = getFieldReference(gc); 1434 1446 // Check if the data is to be read from a file 1435 else if ( file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read)1447 else if (getRelFile() && !getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::read) 1436 1448 { 1437 1449 checkTimeAttributes(); … … 1457 1469 } 1458 1470 1459 if ( file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write))1471 if (getRelFile() && (getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write)) 1460 1472 { 1461 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, file->getContextClient()));1462 getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0);1473 fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, getRelFile()->getContextClient())); 1474 getTemporalDataFilter(gc, getRelFile()->output_freq)->connectOutput(fileWriterFilter, 0); 1463 1475 } 1464 1476 } … … 2001 2013 if (context->getServiceType()==CServicesManager::GATHERER) 2002 2014 { 2003 if ( file->mode.isEmpty() || (!file->mode.isEmpty() && file->mode == CFile::mode_attr::write))2015 if (getRelFile()->mode.isEmpty() || (!getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::write)) 2004 2016 grid_->setContextClient(contextClient); 2005 2017 } … … 2020 2032 { 2021 2033 CContext::getCurrent()->sendContextToFileServer(client); 2022 fileOut_->sendFileToFileServer(client);2034 getRelFile()->sendFileToFileServer(client); 2023 2035 grid_->sendGridToFileServer(client); 2036 this->sendAllAttributesToServer(client); 2037 this->sendAddAllVariables(client); 2038 } 2039 2040 void CField::sendFieldToInputFileServer(void) 2041 { 2042 CContext::getCurrent()->sendContextToFileServer(client); 2043 getRelFile()->sendFileToFileServer(client); 2044 grid_->sendGridToFileServer(client); 2045 read_access=true ; // not the best solution, but on server side, the field must be a starting point of the workflow 2046 // must be replace by a better solution when implementing filters for reading and send to client 2047 // on server side 2024 2048 this->sendAllAttributesToServer(client); 2025 2049 this->sendAddAllVariables(client); … … 2121 2145 TRY 2122 2146 { 2123 bool isFieldRead = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read;2124 bool isFieldWrite = file && ( file->mode.isEmpty() || file->mode == CFile::mode_attr::write);2147 bool isFieldRead = getRelFile() && !getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::read; 2148 bool isFieldWrite = getRelFile() && ( getRelFile()->mode.isEmpty() || getRelFile()->mode == CFile::mode_attr::write); 2125 2149 if (isFieldRead && !(operation.getValue() == "instant" || operation.getValue() == "once") ) 2126 2150 ERROR("void CField::checkTimeAttributes(void)", … … 2132 2156 if (operation.getValue() == "instant") 2133 2157 { 2134 if (isFieldRead || isFieldWrite) freq_op.setValue( file->output_freq.getValue());2158 if (isFieldRead || isFieldWrite) freq_op.setValue(getRelFile()->output_freq.getValue()); 2135 2159 else freq_op=*freqOp ; 2136 2160 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp
r1871 r1872 144 144 145 145 void sendFieldToFileServer(void) ; 146 void sendFieldToInputFileServer(void) ; 146 147 147 148 /// Vérifications /// … … 248 249 249 250 CGrid* grid_=nullptr; 250 CFile* file;251 // CFile* file; 251 252 252 253 CFile* fileIn_ = nullptr ; //<! pointer to input related file 253 bool hasFileIn(void) { return fileIn_==nullptr ? false : true ;}254 bool hasFileIn(void) const { return fileIn_==nullptr ? false : true ;} 254 255 CFile* getFileIn(void) {return fileIn_;} 255 256 void setFileIn(CFile* fileIn) { fileIn_ = fileIn ;} … … 257 258 258 259 CFile* fileOut_ = nullptr ; //<! pointer to output related file 259 bool hasFileOut(void) { return fileOut_==nullptr ? false : true ;}260 bool hasFileOut(void) const { return fileOut_==nullptr ? false : true ;} 260 261 CFile* getFileOut(void) {return fileOut_;} 261 262 void setFileOut(CFile* fileOut) { fileOut_ = fileOut ;} … … 263 264 264 265 CCouplerIn* couplerIn_ = nullptr ; //<!pointer to input related coupler 265 bool hasCouplerIn(void) { return couplerIn_==nullptr ? false : true ;}266 bool hasCouplerIn(void) const { return couplerIn_==nullptr ? false : true ;} 266 267 CCouplerIn* getCouplerIn(void) {return couplerIn_;} 267 268 void setCouplerIn(CCouplerIn* couplerIn) { couplerIn_ = couplerIn ;} … … 269 270 270 271 CCouplerOut* couplerOut_ = nullptr ; //<!pointer to output related coupler 271 bool hasCouplerOut(void) { return couplerOut_==nullptr ? false : true ;}272 bool hasCouplerOut(void) const { return couplerOut_==nullptr ? false : true ;} 272 273 CCouplerOut* getCouplerOut(void) {return couplerOut_;} 273 274 void setCouplerOut(CCouplerOut* couplerOut) { couplerOut_ = couplerOut ;} -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/file.cpp
r1871 r1872 276 276 TRY 277 277 { 278 CContext* context = CContext::getCurrent(); 278 279 if (checkRead) return; 279 createSubComFile(); 280 //createSubComFile(); 281 allZoneEmpty = false; 282 MPI_Comm_dup(context->intraComm_, &fileComm) ; 280 283 checkRead = true; 281 284 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
r1871 r1872 253 253 bool computeServerDistribution_done_=false ; 254 254 public: 255 CDistributionServer* getServerDistribution(void) { if ( computeServerDistribution_done_) computeServerDistribution() ; return serverDistribution_ ;}255 CDistributionServer* getServerDistribution(void) { if (!computeServerDistribution_done_) computeServerDistribution() ; return serverDistribution_ ;} 256 256 257 257
Note: See TracChangeset
for help on using the changeset viewer.