From e64c7d086c5b2b240f17bd08927dccf687d3dd20 Mon Sep 17 00:00:00 2001 From: Martin Hierholzer <martin.hierholzer@desy.de> Date: Fri, 30 Apr 2021 18:19:44 +0200 Subject: [PATCH] [#7951] pass unsed variables to Application for optimisation No test yet, hence ticket added on github #63 --- include/DoocsUpdater.h | 2 ++ include/VariableMapper.h | 2 ++ src/eq_create.cc | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/include/DoocsUpdater.h b/include/DoocsUpdater.h index 77cee14..8d74958 100644 --- a/include/DoocsUpdater.h +++ b/include/DoocsUpdater.h @@ -37,6 +37,8 @@ namespace ChimeraTK { void addVariable( ChimeraTK::TransferElementAbstractor variable, EqFct* eq_fct, std::function<void()> updaterFunction); + const std::list<ChimeraTK::TransferElementAbstractor>& getElementsToRead() { return _elementsToRead; } + protected: std::list<ChimeraTK::TransferElementAbstractor> _elementsToRead; boost::thread _syncThread; // we have to use boost thread to use interruption points diff --git a/include/VariableMapper.h b/include/VariableMapper.h index 5dc5c99..ad55133 100644 --- a/include/VariableMapper.h +++ b/include/VariableMapper.h @@ -54,6 +54,8 @@ namespace ChimeraTK { /// Functiont o convert a string into a DataConsistencyGroup::MatchingMode enum value static DataConsistencyGroup::MatchingMode evaluateDataMatching(std::string txt); + const std::set<std::string>& getUsedVariables() const { return _usedInputVariables; } + protected: VariableMapper() = default; diff --git a/src/eq_create.cc b/src/eq_create.cc index d8cdfce..ccdbdc8 100644 --- a/src/eq_create.cc +++ b/src/eq_create.cc @@ -41,6 +41,15 @@ void eq_init_prolog() { ChimeraTK::VariableMapper::getInstance().directImport(pvNames); } + // prepare list of unmapped read variables and pass it to the Application for optimisation + for(auto &p : ChimeraTK::VariableMapper::getInstance().getUsedVariables()) { + auto it = pvNames.find(p); + if(it != pvNames.end()) { + pvNames.erase(it); + } + } + ChimeraTK::ApplicationBase::getInstance().optimiseUnmappedVariables(pvNames); + // activate the advanced archiver to have histories set_arch_mode(1); } -- GitLab