Changeset 1358
- Timestamp:
- 12/06/17 08:34:41 (6 years ago)
- Location:
- XIOS
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/filter/file_server_writer_filter.cpp
r1158 r1358 19 19 } 20 20 21 bool CFileServerWriterFilter::mustAutoTrigger() const 22 { 23 return true; 24 } 25 21 26 bool CFileServerWriterFilter::isDataExpected(const CDate& date) const 22 27 { -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/file_server_writer_filter.hpp
r1158 r1358 23 23 CFileServerWriterFilter(CGarbageCollector& gc, CField* field); 24 24 25 /*! 26 * Tests if the filter must auto-trigger. 27 * 28 * \return true if the filter must auto-trigger 29 */ 30 bool virtual mustAutoTrigger() const; 31 32 /*! 33 * Tests whether data is expected for the specified date. 34 * 35 * \param date the date associated to the data 36 */ 25 37 bool virtual isDataExpected(const CDate& date) const; 38 26 39 protected: 27 40 /*! -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/file_writer_filter.cpp
r1251 r1358 37 37 } 38 38 39 bool CFileWriterFilter::mustAutoTrigger() const 40 { 41 return true; 42 } 43 39 44 bool CFileWriterFilter::isDataExpected(const CDate& date) const 40 45 { -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/file_writer_filter.hpp
r1158 r1358 24 24 25 25 /*! 26 * Tests if the filter must auto-trigger. 27 * 28 * \return true if the filter must auto-trigger 29 */ 30 bool virtual mustAutoTrigger() const; 31 32 /*! 26 33 * Tests whether data is expected for the specified date. 27 34 * -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/filter.cpp
r1158 r1358 41 41 } 42 42 43 bool CFilter::mustAutoTrigger() const 44 { 45 return COutputPin::mustAutoTrigger(); 46 } 47 43 48 bool CFilter::isDataExpected(const CDate& date) const 44 49 { -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/filter.hpp
r1158 r1358 49 49 50 50 /*! 51 * Tests if the filter must auto-trigger. 52 * 53 * \return true if the filter must auto-trigger 54 */ 55 bool virtual mustAutoTrigger() const; 56 57 /*! 51 58 * Tests whether data is expected for the specified date. 52 59 * -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/input_pin.hpp
r1158 r1358 60 60 61 61 /*! 62 * Tests if the pin must auto-trigger. 63 * 64 * \return true if the pin must auto-trigger 65 */ 66 bool virtual mustAutoTrigger() const = 0; 67 68 /*! 62 69 * Tests whether data is expected for the specified date. 63 70 * -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/output_pin.cpp
r1158 r1358 66 66 } 67 67 68 bool COutputPin::mustAutoTrigger() const 69 { 70 std::vector<std::pair<boost::shared_ptr<CInputPin>, size_t> >::const_iterator it, itEnd; 71 for (it = outputs.begin(), itEnd = outputs.end(); it != itEnd; ++it) 72 { 73 if (it->first->mustAutoTrigger()) 74 return true; 75 } 76 77 return false; 78 } 79 68 80 void COutputPin::setOutputTriggers() 69 81 { -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/output_pin.hpp
r1158 r1358 44 44 */ 45 45 bool virtual canBeTriggered() const; 46 47 /*! 48 * Tests if the pin must auto-trigger. 49 * 50 * \return true if the pin must auto-trigger 51 */ 52 bool virtual mustAutoTrigger() const; 46 53 47 54 /*! -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/store_filter.cpp
r1252 r1358 111 111 } 112 112 113 bool CStoreFilter::mustAutoTrigger() const 114 { 115 return false; 116 } 117 113 118 bool CStoreFilter::isDataExpected(const CDate& date) const 114 119 { -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/store_filter.hpp
r1201 r1358 53 53 54 54 /*! 55 * Tests if the filter must auto-trigger. 56 * 57 * \return true if the filter must auto-trigger 58 */ 59 bool virtual mustAutoTrigger() const; 60 61 /*! 55 62 * Tests whether data is expected for the specified date. 56 63 * -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.cpp
r1302 r1358 84 84 } 85 85 86 bool CTemporalFilter::mustAutoTrigger() const 87 { 88 return true; 89 } 90 86 91 bool CTemporalFilter::isDataExpected(const CDate& date) const 87 92 { -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.hpp
r1302 r1358 41 41 42 42 /*! 43 * Tests if the filter must auto-trigger. 44 * 45 * \return true if the filter must auto-trigger 46 */ 47 bool virtual mustAutoTrigger() const; 48 49 /*! 43 50 * Tests whether data is expected for the specified date. 44 51 * -
XIOS/dev/XIOS_DEV_CMIP6/src/node/context.cpp
r1357 r1358 665 665 { 666 666 buildFilterGraphOfFieldsWithReadAccess(); 667 postProcessFilterGraph(); 667 668 } 668 669 … … 782 783 } 783 784 785 void CContext::postProcessFilterGraph() 786 { 787 int size = enabledFiles.size(); 788 for (int i = 0; i < size; ++i) 789 { 790 enabledFiles[i]->postProcessFilterGraph(); 791 } 792 } 793 784 794 void CContext::startPrefetchingOfEnabledReadModeFiles() 785 795 { … … 788 798 { 789 799 enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 800 } 801 } 802 803 void CContext::doPreTimestepOperationsForEnabledReadModeFiles() 804 { 805 int size = enabledReadModeFiles.size(); 806 for (int i = 0; i < size; ++i) 807 { 808 enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields(); 790 809 } 791 810 } … … 1837 1856 if (prevStep < step) 1838 1857 { 1858 if (hasClient && !hasServer) // For now we only use server level 1 to read data 1859 { 1860 doPreTimestepOperationsForEnabledReadModeFiles(); 1861 } 1862 1839 1863 info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 1840 1864 calendar->update(step); -
XIOS/dev/XIOS_DEV_CMIP6/src/node/context.hpp
r1349 r1358 120 120 void solveOnlyRefOfEnabledFields(bool sendToServer); 121 121 void buildFilterGraphOfEnabledFields(); 122 void postProcessFilterGraph(); 122 123 void startPrefetchingOfEnabledReadModeFiles(); 124 void doPreTimestepOperationsForEnabledReadModeFiles(); 123 125 void doPostTimestepOperationsForEnabledReadModeFiles(); 124 126 void findFieldsWithReadAccess(void); -
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp
r1344 r1358 42 42 , wasDataRequestedFromServer(false) 43 43 , wasDataAlreadyReceivedFromServer(false) 44 , mustAutoTrigger(false) 44 45 , isEOF(false), nstepMaxRead(false) 45 46 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } … … 58 59 , wasDataRequestedFromServer(false) 59 60 , wasDataAlreadyReceivedFromServer(false) 61 , mustAutoTrigger(false) 60 62 , isEOF(false), nstepMaxRead(false) 61 63 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } … … 569 571 570 572 // Check if data previously requested has been received as expected 571 if (wasDataRequestedFromServer && (!isEOF || currentDate <= dateEOF))573 if (wasDataRequestedFromServer && !isEOF) 572 574 { 573 575 CTimer timer("CField::checkForLateDataFromServer"); … … 577 579 { 578 580 const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + file->output_freq) : context->getCalendar()->getInitDate(); 579 isDataLate = nextDataDue < currentDate;581 isDataLate = (nextDataDue <= currentDate); 580 582 581 583 if (isDataLate) … … 594 596 << "Late data at timestep = " << currentDate); 595 597 } 598 } 599 600 void CField::checkIfMustAutoTrigger(void) 601 { 602 mustAutoTrigger = serverSourceFilter ? serverSourceFilter->mustAutoTrigger() : false; 603 } 604 605 void CField::autoTriggerIfNeeded(void) 606 { 607 if (mustAutoTrigger) 608 serverSourceFilter->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); 596 609 } 597 610 -
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.hpp
r1330 r1358 174 174 void recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers); 175 175 void checkForLateDataFromServer(void); 176 void checkIfMustAutoTrigger(void); 177 void autoTriggerIfNeeded(void); 176 178 void outputField(CArray<double,3>& fieldOut); 177 179 void outputField(CArray<double,2>& fieldOut); … … 221 223 CDate lastDataRequestedFromServer, lastDataReceivedFromServer, dateEOF; 222 224 bool wasDataRequestedFromServer, wasDataAlreadyReceivedFromServer; 225 bool mustAutoTrigger; 223 226 224 227 map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; -
XIOS/dev/XIOS_DEV_CMIP6/src/node/file.cpp
r1318 r1358 854 854 855 855 /*! 856 * Post-process the filter graph for each active field. 857 */ 858 void CFile::postProcessFilterGraph() 859 { 860 int size = this->enabledFields.size(); 861 for (int i = 0; i < size; ++i) 862 { 863 this->enabledFields[i]->checkIfMustAutoTrigger(); 864 } 865 } 866 867 /*! 856 868 Prefetching the data for enabled fields read from file. 857 869 */ … … 867 879 868 880 /*! 881 Do all pre timestep operations for enabled fields in read mode: 882 - Check that the data excepted from server has been received 883 - Check if some filters must auto-trigger 884 */ 885 void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 886 { 887 if (mode.isEmpty() || mode.getValue() != mode_attr::read) 888 return; 889 890 int size = this->enabledFields.size(); 891 for (int i = 0; i < size; ++i) 892 { 893 this->enabledFields[i]->checkForLateDataFromServer(); 894 this->enabledFields[i]->autoTriggerIfNeeded(); 895 } 896 } 897 898 /*! 869 899 Do all post timestep operations for enabled fields in read mode: 870 900 - Prefetch the data read from file when needed 871 - Check that the data excepted from server has been received872 901 */ 873 902 void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) … … 879 908 for (int i = 0; i < size; ++i) 880 909 { 881 this->enabledFields[i]->checkForLateDataFromServer();882 910 this->enabledFields[i]->sendReadDataRequestIfNeeded(); 883 911 } -
XIOS/dev/XIOS_DEV_CMIP6/src/node/file.hpp
r1318 r1358 110 110 111 111 void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); 112 void postProcessFilterGraph(); 112 113 void prefetchEnabledReadModeFields(); 114 void doPreTimestepOperationsForEnabledReadModeFields(); 113 115 void doPostTimestepOperationsForEnabledReadModeFields(); 114 116 -
XIOS/trunk/src/filter/file_writer_filter.cpp
r1253 r1358 37 37 } 38 38 39 bool CFileWriterFilter::mustAutoTrigger() const 40 { 41 return true; 42 } 43 39 44 bool CFileWriterFilter::isDataExpected(const CDate& date) const 40 45 { -
XIOS/trunk/src/filter/file_writer_filter.hpp
r1119 r1358 24 24 25 25 /*! 26 * Tests if the filter must auto-trigger. 27 * 28 * \return true if the filter must auto-trigger 29 */ 30 bool virtual mustAutoTrigger() const; 31 32 /*! 26 33 * Tests whether data is expected for the specified date. 27 34 * -
XIOS/trunk/src/filter/filter.cpp
r1119 r1358 41 41 } 42 42 43 bool CFilter::mustAutoTrigger() const 44 { 45 return COutputPin::mustAutoTrigger(); 46 } 47 43 48 bool CFilter::isDataExpected(const CDate& date) const 44 49 { -
XIOS/trunk/src/filter/filter.hpp
r1119 r1358 49 49 50 50 /*! 51 * Tests if the filter must auto-trigger. 52 * 53 * \return true if the filter must auto-trigger 54 */ 55 bool virtual mustAutoTrigger() const; 56 57 /*! 51 58 * Tests whether data is expected for the specified date. 52 59 * -
XIOS/trunk/src/filter/input_pin.hpp
r1119 r1358 60 60 61 61 /*! 62 * Tests if the pin must auto-trigger. 63 * 64 * \return true if the pin must auto-trigger 65 */ 66 bool virtual mustAutoTrigger() const = 0; 67 68 /*! 62 69 * Tests whether data is expected for the specified date. 63 70 * -
XIOS/trunk/src/filter/output_pin.cpp
r1119 r1358 66 66 } 67 67 68 bool COutputPin::mustAutoTrigger() const 69 { 70 std::vector<std::pair<boost::shared_ptr<CInputPin>, size_t> >::const_iterator it, itEnd; 71 for (it = outputs.begin(), itEnd = outputs.end(); it != itEnd; ++it) 72 { 73 if (it->first->mustAutoTrigger()) 74 return true; 75 } 76 77 return false; 78 } 79 68 80 void COutputPin::setOutputTriggers() 69 81 { -
XIOS/trunk/src/filter/output_pin.hpp
r1119 r1358 44 44 */ 45 45 bool virtual canBeTriggered() const; 46 47 /*! 48 * Tests if the pin must auto-trigger. 49 * 50 * \return true if the pin must auto-trigger 51 */ 52 bool virtual mustAutoTrigger() const; 46 53 47 54 /*! -
XIOS/trunk/src/filter/store_filter.cpp
r1253 r1358 111 111 } 112 112 113 bool CStoreFilter::mustAutoTrigger() const 114 { 115 return false; 116 } 117 113 118 bool CStoreFilter::isDataExpected(const CDate& date) const 114 119 { -
XIOS/trunk/src/filter/store_filter.hpp
r1186 r1358 53 53 54 54 /*! 55 * Tests if the filter must auto-trigger. 56 * 57 * \return true if the filter must auto-trigger 58 */ 59 bool virtual mustAutoTrigger() const; 60 61 /*! 55 62 * Tests whether data is expected for the specified date. 56 63 * -
XIOS/trunk/src/filter/temporal_filter.cpp
r1286 r1358 76 76 } 77 77 78 bool CTemporalFilter::mustAutoTrigger() const 79 { 80 return true; 81 } 82 78 83 bool CTemporalFilter::isDataExpected(const CDate& date) const 79 84 { -
XIOS/trunk/src/filter/temporal_filter.hpp
r1183 r1358 41 41 42 42 /*! 43 * Tests if the filter must auto-trigger. 44 * 45 * \return true if the filter must auto-trigger 46 */ 47 bool virtual mustAutoTrigger() const; 48 49 /*! 43 50 * Tests whether data is expected for the specified date. 44 51 * -
XIOS/trunk/src/node/context.cpp
r1357 r1358 438 438 buildFilterGraphOfFieldsWithReadAccess(); 439 439 this->solveAllRefOfEnabledFields(true); 440 postProcessFilterGraph(); 440 441 } 441 442 … … 505 506 } 506 507 508 void CContext::postProcessFilterGraph() 509 { 510 int size = enabledFiles.size(); 511 for (int i = 0; i < size; ++i) 512 { 513 enabledFiles[i]->postProcessFilterGraph(); 514 } 515 } 516 507 517 void CContext::startPrefetchingOfEnabledReadModeFiles() 508 518 { … … 511 521 { 512 522 enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 523 } 524 } 525 526 void CContext::doPreTimestepOperationsForEnabledReadModeFiles() 527 { 528 int size = enabledReadModeFiles.size(); 529 for (int i = 0; i < size; ++i) 530 { 531 enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields(); 513 532 } 514 533 } … … 1206 1225 if (prevStep < step) 1207 1226 { 1227 if (hasClient) 1228 { 1229 doPreTimestepOperationsForEnabledReadModeFiles(); 1230 } 1231 1208 1232 info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 1209 1233 calendar->update(step); -
XIOS/trunk/src/node/context.hpp
r1318 r1358 114 114 void solveAllRefOfEnabledFields(bool sendToServer); 115 115 void buildFilterGraphOfEnabledFields(); 116 void postProcessFilterGraph(); 116 117 void startPrefetchingOfEnabledReadModeFiles(); 118 void doPreTimestepOperationsForEnabledReadModeFiles(); 117 119 void doPostTimestepOperationsForEnabledReadModeFiles(); 118 120 void findFieldsWithReadAccess(void); -
XIOS/trunk/src/node/field.cpp
r1326 r1358 40 40 , wasDataRequestedFromServer(false) 41 41 , wasDataAlreadyReceivedFromServer(false) 42 , mustAutoTrigger(false) 42 43 , isEOF(false) 43 44 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } … … 55 56 , wasDataRequestedFromServer(false) 56 57 , wasDataAlreadyReceivedFromServer(false) 58 , mustAutoTrigger(false) 57 59 , isEOF(false) 58 60 { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } … … 479 481 480 482 // Check if data previously requested has been received as expected 481 if (wasDataRequestedFromServer && (!isEOF || currentDate <= dateEOF))483 if (wasDataRequestedFromServer && !isEOF) 482 484 { 483 485 CTimer timer("CField::checkForLateDataFromServer"); … … 487 489 { 488 490 const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + file->output_freq) : context->getCalendar()->getInitDate(); 489 isDataLate = nextDataDue < currentDate;491 isDataLate = (nextDataDue <= currentDate); 490 492 491 493 if (isDataLate) … … 504 506 << "Late data at timestep = " << currentDate); 505 507 } 508 } 509 510 void CField::checkIfMustAutoTrigger(void) 511 { 512 mustAutoTrigger = serverSourceFilter ? serverSourceFilter->mustAutoTrigger() : false; 513 } 514 515 void CField::autoTriggerIfNeeded(void) 516 { 517 if (mustAutoTrigger) 518 serverSourceFilter->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); 506 519 } 507 520 -
XIOS/trunk/src/node/field.hpp
r1318 r1358 151 151 void recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers); 152 152 void checkForLateDataFromServer(void); 153 void checkIfMustAutoTrigger(void); 154 void autoTriggerIfNeeded(void); 153 155 void outputField(CArray<double,3>& fieldOut); 154 156 void outputField(CArray<double,2>& fieldOut); … … 200 202 CDate lastDataRequestedFromServer, lastDataReceivedFromServer, dateEOF; 201 203 bool wasDataRequestedFromServer, wasDataAlreadyReceivedFromServer; 204 bool mustAutoTrigger; 202 205 203 206 map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; -
XIOS/trunk/src/node/file.cpp
r1318 r1358 770 770 771 771 /*! 772 * Post-process the filter graph for each active field. 773 */ 774 void CFile::postProcessFilterGraph() 775 { 776 int size = this->enabledFields.size(); 777 for (int i = 0; i < size; ++i) 778 { 779 this->enabledFields[i]->checkIfMustAutoTrigger(); 780 } 781 } 782 783 /*! 772 784 Prefetching the data for enabled fields read from file. 773 785 */ … … 783 795 784 796 /*! 785 Do all post timestep operations for enabled fields in read mode: 786 - Prefetch the data read from file when needed 797 Do all pre timestep operations for enabled fields in read mode: 787 798 - Check that the data excepted from server has been received 788 */ 789 void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 799 - Check if some filters must auto-trigger 800 */ 801 void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 790 802 { 791 803 if (mode.isEmpty() || mode.getValue() != mode_attr::read) … … 796 808 { 797 809 this->enabledFields[i]->checkForLateDataFromServer(); 810 this->enabledFields[i]->autoTriggerIfNeeded(); 811 } 812 } 813 814 /*! 815 Do all post timestep operations for enabled fields in read mode: 816 - Prefetch the data read from file when needed 817 */ 818 void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 819 { 820 if (mode.isEmpty() || mode.getValue() != mode_attr::read) 821 return; 822 823 int size = this->enabledFields.size(); 824 for (int i = 0; i < size; ++i) 825 { 798 826 this->enabledFields[i]->sendReadDataRequestIfNeeded(); 799 827 } -
XIOS/trunk/src/node/file.hpp
r1318 r1358 106 106 void solveAllRefOfEnabledFields(bool sendToServer); 107 107 void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); 108 void postProcessFilterGraph(); 108 109 void prefetchEnabledReadModeFields(); 110 void doPreTimestepOperationsForEnabledReadModeFields(); 109 111 void doPostTimestepOperationsForEnabledReadModeFields(); 110 112
Note: See TracChangeset
for help on using the changeset viewer.