From ec7e793bea27257cedb9db2b61f6827a268bfc4e Mon Sep 17 00:00:00 2001 From: kraus <christof.kraus@psi.ch> Date: Sun, 31 Jan 2021 11:46:09 +0000 Subject: [PATCH] Merge branch '635-get-correct-output-of-value-option-autophase' into 'master' Resolve "Get correct output of VALUE, OPTION->AUTOPHASE" Closes #635 See merge request OPAL/src!472 (cherry picked from commit 49fc5b281286529726f5b6a8c01671c1b873a6de) 64a1faee update the attribute values of OPTION --- src/BasicActions/Option.cpp | 14 +++++++++++++- src/BasicActions/Option.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/BasicActions/Option.cpp b/src/BasicActions/Option.cpp index bb80d744a..80fa7dd3a 100644 --- a/src/BasicActions/Option.cpp +++ b/src/BasicActions/Option.cpp @@ -18,6 +18,7 @@ // along with OPAL. If not, see <https://www.gnu.org/licenses/>. // #include "BasicActions/Option.h" +#include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" #include "Parser/FileStream.h" #include "Utilities/Options.h" @@ -65,7 +66,7 @@ namespace { AUTOPHASE, SURFDUMPFREQ, NUMBLOCKS, - RECYCLEBLOCKS, + RECYCLEBLOCKS, NLHS, CZERO, RNGTYPE, @@ -491,6 +492,11 @@ void Option::execute() { if(Attributes::getBool(itsAttr[TELL])) { *gmsg << "\nCurrent settings of options:\n" << *this << endl; } + + Option* main = dynamic_cast<Option*>(OpalData::getInstance()->find("OPTION")); + if (main) { + main->update(itsAttr); + } } void Option::handlePsDumpFrame(const std::string &dumpFrame) { @@ -518,4 +524,10 @@ std::string DumpFrameToString(DumpFrame df) { default: return std::string("GLOBAL"); } +} + +void Option::update(const std::vector<Attribute>& othersAttributes) { + for (int i = 0; i < SIZE; ++ i) { + itsAttr[i] = othersAttributes[i]; + } } \ No newline at end of file diff --git a/src/BasicActions/Option.h b/src/BasicActions/Option.h index e88187aac..63c43ac70 100644 --- a/src/BasicActions/Option.h +++ b/src/BasicActions/Option.h @@ -39,6 +39,7 @@ public: private: void handlePsDumpFrame(const std::string &dumpFrame); + void update(const std::vector<Attribute>&); // Not implemented. Option(const Option &); -- GitLab