From c36fdd8a39d445d3d23d97731ff4845bb16e66d6 Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Tue, 2 Feb 2016 16:35:55 +0100 Subject: [PATCH] renamed ConfigTreeNew to ConfigTree --- Applications/ApplicationsLib/ProjectData.cpp | 12 +-- Applications/ApplicationsLib/ProjectData.h | 14 +-- BaseLib/ConfigTreeNew-impl.h | 26 ++--- BaseLib/ConfigTreeNew.cpp | 99 ++++++++++--------- BaseLib/ConfigTreeNew.h | 74 +++++++------- BaseLib/ConfigTreeUtil.cpp | 10 +- BaseLib/ConfigTreeUtil.h | 10 +- FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp | 6 +- FileIO/XmlIO/Boost/BoostXmlGmlInterface.h | 10 +- MathLib/LinAlg/Eigen/EigenLinearSolver.cpp | 4 +- MathLib/LinAlg/Eigen/EigenLinearSolver.h | 4 +- .../LinAlg/EigenLis/EigenLisLinearSolver.cpp | 2 +- .../LinAlg/EigenLis/EigenLisLinearSolver.h | 2 +- MathLib/LinAlg/LinearSolverOptions.cpp | 2 +- MathLib/LinAlg/LinearSolverOptions.h | 2 +- MathLib/LinAlg/Lis/LisLinearSolver.cpp | 2 +- MathLib/LinAlg/Lis/LisLinearSolver.h | 2 +- MathLib/LinAlg/Lis/LisOption.h | 2 +- MathLib/LinAlg/PETSc/PETScLinearSolver.cpp | 2 +- MathLib/LinAlg/PETSc/PETScLinearSolver.h | 2 +- MathLib/LinAlg/Solvers/GaussAlgorithm-impl.h | 2 +- MathLib/LinAlg/Solvers/GaussAlgorithm.h | 2 +- .../Algorithms/FixedTimeStepping.cpp | 2 +- .../Algorithms/FixedTimeStepping.h | 2 +- ProcessLib/GroundwaterFlowProcess.h | 2 +- ProcessLib/InitialCondition.cpp | 4 +- ProcessLib/InitialCondition.h | 6 +- ProcessLib/NeumannBcConfig.h | 2 +- ProcessLib/Parameter.cpp | 4 +- ProcessLib/Parameter.h | 4 +- ProcessLib/Process.h | 6 +- ProcessLib/ProcessVariable.cpp | 2 +- ProcessLib/ProcessVariable.h | 2 +- .../UniformDirichletBoundaryCondition.h | 2 +- Tests/AssemblerLib/TestSerialLinearSolver.cpp | 2 +- Tests/BaseLib/TestConfigTree.cpp | 14 +-- Tests/MathLib/TestLinearSolver.cpp | 18 ++-- 37 files changed, 188 insertions(+), 175 deletions(-) diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 326f26c20a7..7289c5fbe33 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -42,7 +42,7 @@ void readGeometry(std::string const& fname, GeoLib::GEOObjects & geo_objects) } -ProjectData::ProjectData(BaseLib::ConfigTreeNew const& project_config, +ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, std::string const& path) { // geometry @@ -174,7 +174,7 @@ bool ProjectData::isMeshNameUniqueAndProvideUniqueName(std::string &name) const } void ProjectData::parseProcessVariables( - BaseLib::ConfigTreeNew const& process_variables_config) + BaseLib::ConfigTree const& process_variables_config) { DBUG("Parse process variables:") if (_geoObjects == nullptr) { @@ -200,7 +200,7 @@ void ProjectData::parseProcessVariables( } } -void ProjectData::parseParameters(BaseLib::ConfigTreeNew const& parameters_config) +void ProjectData::parseParameters(BaseLib::ConfigTree const& parameters_config) { using namespace ProcessLib; @@ -233,7 +233,7 @@ void ProjectData::parseParameters(BaseLib::ConfigTreeNew const& parameters_confi } } -void ProjectData::parseProcesses(BaseLib::ConfigTreeNew const& processes_config) +void ProjectData::parseProcesses(BaseLib::ConfigTree const& processes_config) { DBUG("Reading processes:"); for (auto process_config : processes_config.getConfSubtreeList("process")) { @@ -244,7 +244,7 @@ void ProjectData::parseProcesses(BaseLib::ConfigTreeNew const& processes_config) } } -void ProjectData::parseOutput(BaseLib::ConfigTreeNew const& output_config, +void ProjectData::parseOutput(BaseLib::ConfigTree const& output_config, std::string const& path) { output_config.checkConfParam("type", "VTK"); @@ -255,7 +255,7 @@ void ProjectData::parseOutput(BaseLib::ConfigTreeNew const& output_config, _output_file_prefix = path + file; } -void ProjectData::parseTimeStepping(BaseLib::ConfigTreeNew const& timestepping_config) +void ProjectData::parseTimeStepping(BaseLib::ConfigTree const& timestepping_config) { using namespace ProcessLib; diff --git a/Applications/ApplicationsLib/ProjectData.h b/Applications/ApplicationsLib/ProjectData.h index 7fee59d6515..6850837e749 100644 --- a/Applications/ApplicationsLib/ProjectData.h +++ b/Applications/ApplicationsLib/ProjectData.h @@ -45,7 +45,7 @@ public: /// Constructs project data by parsing provided configuration. /// The additional path is used to find files referenced in the /// configuration. - ProjectData(BaseLib::ConfigTreeNew const& config_tree, + ProjectData(BaseLib::ConfigTree const& config_tree, std::string const& path); ProjectData(ProjectData&) = delete; @@ -174,22 +174,22 @@ private: /// Parses the process variables configuration and creates new variables for /// each variable entry passing the corresponding subtree to the process /// variable constructor. - void parseProcessVariables(BaseLib::ConfigTreeNew const& process_variables_config); + void parseProcessVariables(BaseLib::ConfigTree const& process_variables_config); /// Parses the parameters configuration and saves them in a list. /// Checks if a parameter has name tag. - void parseParameters(BaseLib::ConfigTreeNew const& parameters_config); + void parseParameters(BaseLib::ConfigTree const& parameters_config); /// Parses the processes configuration and creates new processes for each /// process entry passing the corresponding subtree to the process /// constructor. - void parseProcesses(BaseLib::ConfigTreeNew const& process_config); + void parseProcesses(BaseLib::ConfigTree const& process_config); /// Parses the output configuration. /// Parses the file tag and sets output file prefix. - void parseOutput(BaseLib::ConfigTreeNew const& output_config, std::string const& path); + void parseOutput(BaseLib::ConfigTree const& output_config, std::string const& path); - void parseTimeStepping(BaseLib::ConfigTreeNew const& timestepping_config); + void parseTimeStepping(BaseLib::ConfigTree const& timestepping_config); private: GeoLib::GEOObjects *_geoObjects = new GeoLib::GEOObjects(); @@ -199,7 +199,7 @@ private: std::vector<ProcessLib::ProcessVariable> _process_variables; /// Buffer for each process' config used in the process building function. - std::vector<BaseLib::ConfigTreeNew> _process_configs; + std::vector<BaseLib::ConfigTree> _process_configs; /// Buffer for each parameter config passed to the process. std::vector<std::unique_ptr<ProcessLib::ParameterBase>> _parameters; diff --git a/BaseLib/ConfigTreeNew-impl.h b/BaseLib/ConfigTreeNew-impl.h index 7b3fbda29ab..55ca2fe37af 100644 --- a/BaseLib/ConfigTreeNew-impl.h +++ b/BaseLib/ConfigTreeNew-impl.h @@ -30,7 +30,7 @@ private: template<typename T> T -ConfigTreeNew:: +ConfigTree:: getConfParam(std::string const& param) const { if (auto p = getConfParamOptional<T>(param)) @@ -41,7 +41,7 @@ getConfParam(std::string const& param) const template<typename T> T -ConfigTreeNew:: +ConfigTree:: getConfParam(std::string const& param, T const& default_value) const { if (auto p = getConfParamOptional<T>(param)) @@ -52,7 +52,7 @@ getConfParam(std::string const& param, T const& default_value) const template<typename T> boost::optional<T> -ConfigTreeNew:: +ConfigTree:: getConfParamOptional(std::string const& param) const { checkUnique(param); @@ -64,8 +64,8 @@ getConfParamOptional(std::string const& param) const } template<typename T> -Range<ConfigTreeNew::ValueIterator<T> > -ConfigTreeNew:: +Range<ConfigTree::ValueIterator<T> > +ConfigTree:: getConfParamList(std::string const& param) const { checkUnique(param); @@ -79,7 +79,7 @@ getConfParamList(std::string const& param) const template<typename T> T -ConfigTreeNew:: +ConfigTree:: peekConfParam(std::string const& param) const { checkKeyname(param); @@ -98,7 +98,7 @@ peekConfParam(std::string const& param) const template<typename T> void -ConfigTreeNew:: +ConfigTree:: checkConfParam(std::string const& param, T const& value) const { if (getConfParam<T>(param) != value) { @@ -108,7 +108,7 @@ checkConfParam(std::string const& param, T const& value) const template<typename Ch> void -ConfigTreeNew:: +ConfigTree:: checkConfParam(std::string const& param, Ch const* value) const { if (getConfParam<std::string>(param) != value) { @@ -118,7 +118,7 @@ checkConfParam(std::string const& param, Ch const* value) const template<typename T> T -ConfigTreeNew:: +ConfigTree:: getValue() const { if (_have_read_data) { @@ -137,7 +137,7 @@ getValue() const template<typename T> T -ConfigTreeNew:: +ConfigTree:: getConfAttribute(std::string const& attr) const { if (auto a = getConfAttributeOptional<T>(attr)) @@ -148,7 +148,7 @@ getConfAttribute(std::string const& attr) const template<typename T> boost::optional<T> -ConfigTreeNew:: +ConfigTree:: getConfAttributeOptional(std::string const& attr) const { checkUniqueAttr(attr); @@ -171,8 +171,8 @@ getConfAttributeOptional(std::string const& attr) const } template<typename T> -ConfigTreeNew::CountType& -ConfigTreeNew:: +ConfigTree::CountType& +ConfigTree:: markVisited(std::string const& key, Attr const is_attr, bool const peek_only) const { diff --git a/BaseLib/ConfigTreeNew.cpp b/BaseLib/ConfigTreeNew.cpp index edee21f2b7a..76712ac3775 100644 --- a/BaseLib/ConfigTreeNew.cpp +++ b/BaseLib/ConfigTreeNew.cpp @@ -10,15 +10,20 @@ #include <logog/include/logog.hpp> #include "ConfigTreeNew.h" +// Explicitly instantiate the boost::property_tree::ptree which is a typedef to +// the following basic_ptree. +template class boost::property_tree::basic_ptree<std::string, std::string, + std::less<std::string>>; + namespace BaseLib { -const char ConfigTreeNew::pathseparator = '/'; -const std::string ConfigTreeNew::key_chars_start = "abcdefghijklmnopqrstuvwxyz"; -const std::string ConfigTreeNew::key_chars = key_chars_start + "_0123456789"; +const char ConfigTree::pathseparator = '/'; +const std::string ConfigTree::key_chars_start = "abcdefghijklmnopqrstuvwxyz"; +const std::string ConfigTree::key_chars = key_chars_start + "_0123456789"; -ConfigTreeNew:: -ConfigTreeNew(PTree const& tree, +ConfigTree:: +ConfigTree(PTree const& tree, std::string const& filename, Callback const& error_cb, Callback const& warning_cb) @@ -34,8 +39,8 @@ ConfigTreeNew(PTree const& tree, } } -ConfigTreeNew:: -ConfigTreeNew(PTree const& tree, ConfigTreeNew const& parent, +ConfigTree:: +ConfigTree(PTree const& tree, ConfigTree const& parent, std::string const& root) : _tree(&tree), _path(joinPaths(parent._path, root)), _filename(parent._filename), @@ -44,8 +49,8 @@ ConfigTreeNew(PTree const& tree, ConfigTreeNew const& parent, checkKeyname(root); } -ConfigTreeNew:: -ConfigTreeNew(ConfigTreeNew && other) +ConfigTree:: +ConfigTree(ConfigTree && other) : _tree (other._tree) , _path (std::move(other._path)) , _filename (std::move(other._filename)) @@ -57,14 +62,14 @@ ConfigTreeNew(ConfigTreeNew && other) other._tree = nullptr; } -ConfigTreeNew::~ConfigTreeNew() +ConfigTree::~ConfigTree() { checkAndInvalidate(); } -ConfigTreeNew& -ConfigTreeNew:: -operator=(ConfigTreeNew&& other) +ConfigTree& +ConfigTree:: +operator=(ConfigTree&& other) { checkAndInvalidate(); @@ -80,8 +85,8 @@ operator=(ConfigTreeNew&& other) return *this; } -ConfigTreeNew -ConfigTreeNew:: +ConfigTree +ConfigTree:: getConfParam(std::string const& root) const { auto ct = getConfSubtree(root); @@ -90,8 +95,8 @@ getConfParam(std::string const& root) const return ct; } -boost::optional<ConfigTreeNew> -ConfigTreeNew:: +boost::optional<ConfigTree> +ConfigTree:: getConfParamOptional(std::string const& root) const { auto ct = getConfSubtreeOptional(root); @@ -100,8 +105,8 @@ getConfParamOptional(std::string const& root) const return ct; } -Range<ConfigTreeNew::ParameterIterator> -ConfigTreeNew:: +Range<ConfigTree::ParameterIterator> +ConfigTree:: getConfParamList(const std::string ¶m) const { checkUnique(param); @@ -114,8 +119,8 @@ getConfParamList(const std::string ¶m) const ParameterIterator(p.second, param, *this)); } -ConfigTreeNew -ConfigTreeNew:: +ConfigTree +ConfigTree:: getConfSubtree(std::string const& root) const { if (auto t = getConfSubtreeOptional(root)) { @@ -125,23 +130,23 @@ getConfSubtree(std::string const& root) const } } -boost::optional<ConfigTreeNew> -ConfigTreeNew:: +boost::optional<ConfigTree> +ConfigTree:: getConfSubtreeOptional(std::string const& root) const { checkUnique(root); if (auto subtree = _tree->get_child_optional(root)) { markVisited(root, Attr::TAG, false); - return ConfigTreeNew(*subtree, *this, root); + return ConfigTree(*subtree, *this, root); } else { markVisited(root, Attr::TAG, true); return boost::none; } } -Range<ConfigTreeNew::SubtreeIterator> -ConfigTreeNew:: +Range<ConfigTree::SubtreeIterator> +ConfigTree:: getConfSubtreeList(std::string const& root) const { checkUnique(root); @@ -154,7 +159,7 @@ getConfSubtreeList(std::string const& root) const SubtreeIterator(p.second, root, *this)); } -void ConfigTreeNew::ignoreConfParam(const std::string ¶m) const +void ConfigTree::ignoreConfParam(const std::string ¶m) const { checkUnique(param); // if not found, peek only @@ -162,7 +167,7 @@ void ConfigTreeNew::ignoreConfParam(const std::string ¶m) const markVisited(param, Attr::TAG, peek_only); } -void ConfigTreeNew::ignoreConfAttribute(const std::string &attr) const +void ConfigTree::ignoreConfAttribute(const std::string &attr) const { checkUniqueAttr(attr); @@ -173,7 +178,7 @@ void ConfigTreeNew::ignoreConfAttribute(const std::string &attr) const markVisited(attr, Attr::ATTR, peek_only); } -void ConfigTreeNew::ignoreConfParamAll(const std::string ¶m) const +void ConfigTree::ignoreConfParamAll(const std::string ¶m) const { checkUnique(param); auto& ct = markVisited(param, Attr::TAG, true); @@ -185,19 +190,19 @@ void ConfigTreeNew::ignoreConfParamAll(const std::string ¶m) const } -void ConfigTreeNew::error(const std::string& message) const +void ConfigTree::error(const std::string& message) const { _onerror(_filename, _path, message); std::abort(); } -void ConfigTreeNew::warning(const std::string& message) const +void ConfigTree::warning(const std::string& message) const { _onwarning(_filename, _path, message); } -void ConfigTreeNew::onerror(const std::string& filename, const std::string& path, +void ConfigTree::onerror(const std::string& filename, const std::string& path, const std::string& message) { ERR("ConfigTree: In file `%s' at path <%s>: %s", @@ -205,14 +210,14 @@ void ConfigTreeNew::onerror(const std::string& filename, const std::string& path std::abort(); } -void ConfigTreeNew::onwarning(const std::string& filename, const std::string& path, +void ConfigTree::onwarning(const std::string& filename, const std::string& path, const std::string& message) { WARN("ConfigTree: In file `%s' at path <%s>: %s", filename.c_str(), path.c_str(), message.c_str()); } -std::string ConfigTreeNew::shortString(const std::string &s) +std::string ConfigTree::shortString(const std::string &s) { const std::size_t maxlen = 100; @@ -222,7 +227,7 @@ std::string ConfigTreeNew::shortString(const std::string &s) } -void ConfigTreeNew::checkKeyname(std::string const& key) const +void ConfigTree::checkKeyname(std::string const& key) const { if (key.empty()) { error("Search for empty key."); @@ -239,7 +244,7 @@ void ConfigTreeNew::checkKeyname(std::string const& key) const } } -std::string ConfigTreeNew:: +std::string ConfigTree:: joinPaths( const std::string &p1, const std::string &p2) const { if (p2.empty()) { @@ -251,7 +256,7 @@ joinPaths( const std::string &p1, const std::string &p2) const return p1 + pathseparator + p2; } -void ConfigTreeNew::checkUnique(const std::string &key) const +void ConfigTree::checkUnique(const std::string &key) const { checkKeyname(key); @@ -260,7 +265,7 @@ void ConfigTreeNew::checkUnique(const std::string &key) const } } -void ConfigTreeNew::checkUniqueAttr(const std::string &attr) const +void ConfigTree::checkUniqueAttr(const std::string &attr) const { // Workaround for handling attributes with xml namespaces and uppercase letters. if (attr.find(':') != attr.npos) { @@ -285,15 +290,15 @@ void ConfigTreeNew::checkUniqueAttr(const std::string &attr) const } } -ConfigTreeNew::CountType& -ConfigTreeNew:: +ConfigTree::CountType& +ConfigTree:: markVisited(std::string const& key, Attr const is_attr, bool const peek_only) const { - return markVisited<ConfigTreeNew>(key, is_attr, peek_only); + return markVisited<ConfigTree>(key, is_attr, peek_only); } void -ConfigTreeNew:: +ConfigTree:: markVisitedDecrement(Attr const is_attr, std::string const& key) const { auto const type = std::type_index(typeid(nullptr)); @@ -308,7 +313,7 @@ markVisitedDecrement(Attr const is_attr, std::string const& key) const } bool -ConfigTreeNew::hasChildren() const +ConfigTree::hasChildren() const { auto const& tree = *_tree; if (tree.begin() == tree.end()) @@ -321,7 +326,7 @@ ConfigTreeNew::hasChildren() const } void -ConfigTreeNew::checkAndInvalidate() +ConfigTree::checkAndInvalidate() { if (!_tree) return; @@ -378,17 +383,17 @@ ConfigTreeNew::checkAndInvalidate() } -void checkAndInvalidate(ConfigTreeNew &conf) +void checkAndInvalidate(ConfigTree &conf) { conf.checkAndInvalidate(); } -void checkAndInvalidate(ConfigTreeNew* const conf) +void checkAndInvalidate(ConfigTree* const conf) { if (conf) conf->checkAndInvalidate(); } -void checkAndInvalidate(std::unique_ptr<ConfigTreeNew> const& conf) +void checkAndInvalidate(std::unique_ptr<ConfigTree> const& conf) { if (conf) conf->checkAndInvalidate(); } diff --git a/BaseLib/ConfigTreeNew.h b/BaseLib/ConfigTreeNew.h index 3b27e3847ce..e776b28ef77 100644 --- a/BaseLib/ConfigTreeNew.h +++ b/BaseLib/ConfigTreeNew.h @@ -7,9 +7,8 @@ * */ -#pragma once - -#include "ConfigTree.h" +#ifndef BASELIB_CONFIGTREE_H_ +#define BASELIB_CONFIGTREE_H_ #include <typeindex> #include <map> @@ -17,24 +16,30 @@ #include <functional> #include <memory> +#include <boost/property_tree/ptree.hpp> + +extern template class boost::property_tree::basic_ptree< + std::string, std::string, std::less<std::string>>; + + namespace BaseLib { -class ConfigTreeNew; +class ConfigTree; /*! Check if \c conf has been read entirely and invalidate it. * * This method can savely be called on \c nullptr's. * - * \see ConfigTreeNew::checkAndInvalidate() + * \see ConfigTree::checkAndInvalidate() */ -void checkAndInvalidate(ConfigTreeNew* const conf); +void checkAndInvalidate(ConfigTree* const conf); //! \overload -void checkAndInvalidate(std::unique_ptr<ConfigTreeNew> const& conf); +void checkAndInvalidate(std::unique_ptr<ConfigTree> const& conf); //! \overload -void checkAndInvalidate(ConfigTreeNew& conf); +void checkAndInvalidate(ConfigTree& conf); template<typename Iterator> class Range; @@ -86,7 +91,7 @@ template<typename Iterator> class Range; * function BaseLib::makeConfigTree(), which performs many error checks. For limitations * of the used XML parser, please have a look at that function's documentation. */ -class ConfigTreeNew final +class ConfigTree final { public: /*! A wrapper around a Boost Iterator for iterating over ranges of subtrees. @@ -95,13 +100,13 @@ public: * a setting has been parsed. */ class SubtreeIterator - : public std::iterator<std::input_iterator_tag, ConfigTreeNew> + : public std::iterator<std::input_iterator_tag, ConfigTree> { public: using Iterator = boost::property_tree::ptree::const_assoc_iterator; explicit SubtreeIterator(Iterator it, std::string const& root, - ConfigTreeNew const& parent) + ConfigTree const& parent) : _it(it), _tagname(root), _parent(parent) {} @@ -111,14 +116,14 @@ public: return *this; } - ConfigTreeNew operator*() { + ConfigTree operator*() { // if this iterator has been incremented since the last dereference, // tell the _parent instance that a subtree now has been parsed. if (_has_incremented) { _has_incremented = false; _parent.markVisited(_tagname, Attr::TAG, false); } - return ConfigTreeNew(_it->second, _parent, _tagname); + return ConfigTree(_it->second, _parent, _tagname); } bool operator==(SubtreeIterator const& other) const { @@ -135,7 +140,7 @@ public: protected: std::string const _tagname; - ConfigTreeNew const& _parent; + ConfigTree const& _parent; }; /*! A wrapper around a Boost Iterator for iterating over ranges of parameters. @@ -153,7 +158,7 @@ public: // says that since MSVC 14.0 inheriting of constructors is supported. //! Inherit the constructor explicit ParameterIterator(Iterator it, std::string const& root, - ConfigTreeNew const& parent) + ConfigTree const& parent) : SubtreeIterator(it, root, parent) {} #else @@ -161,7 +166,7 @@ public: using SubtreeIterator::SubtreeIterator; #endif - ConfigTreeNew operator*() { + ConfigTree operator*() { auto st = SubtreeIterator::operator*(); if (st.hasChildren()) _parent.error("The requested parameter <" + _tagname + ">" @@ -185,7 +190,7 @@ public: using Iterator = boost::property_tree::ptree::const_assoc_iterator; explicit ValueIterator(Iterator it, std::string const& root, - ConfigTreeNew const& parent) + ConfigTree const& parent) : _it(it), _tagname(root), _parent(parent) {} @@ -202,7 +207,7 @@ public: _has_incremented = false; _parent.markVisited<ValueType>(_tagname, Attr::TAG, false); } - return ConfigTreeNew(_it->second, _parent, _tagname).getValue<ValueType>(); + return ConfigTree(_it->second, _parent, _tagname).getValue<ValueType>(); } bool operator==(ValueIterator<ValueType> const& other) const { @@ -217,7 +222,7 @@ public: bool _has_incremented = true; Iterator _it; std::string const _tagname; - ConfigTreeNew const& _parent; + ConfigTree const& _parent; }; //! The tree being wrapped by this class. @@ -249,24 +254,24 @@ public: * Defaults are strict: By default, both callbacks are set to the same function, * i.e., warnings will also result in program abortion! */ - explicit ConfigTreeNew(PTree const& tree, + explicit ConfigTree(PTree const& tree, std::string const& filename, Callback const& error_cb = onerror, Callback const& warning_cb = onerror); //! copying is not compatible with the semantics of this class - ConfigTreeNew(ConfigTreeNew const&) = delete; + ConfigTree(ConfigTree const&) = delete; //! After being moved from, \c other is in an undefined state and must not be //! used anymore! - ConfigTreeNew(ConfigTreeNew && other); + ConfigTree(ConfigTree && other); //! copying is not compatible with the semantics of this class - ConfigTreeNew& operator=(ConfigTreeNew const&) = delete; + ConfigTree& operator=(ConfigTree const&) = delete; //! After being moved from, \c other is in an undefined state and must not be //! used anymore! - ConfigTreeNew& operator=(ConfigTreeNew &&); + ConfigTree& operator=(ConfigTree &&); /*! \name Methods for directly accessing parameter values * @@ -331,7 +336,7 @@ public: * * \pre \c param must not have been read before from this ConfigTree. */ - ConfigTreeNew + ConfigTree getConfParam(std::string const& param) const; /*! Get parameter \c param from the configuration tree if present. @@ -340,7 +345,7 @@ public: * * \pre \c param must not have been read before from this ConfigTree. */ - boost::optional<ConfigTreeNew> + boost::optional<ConfigTree> getConfParamOptional(std::string const& param) const; /*! Fetches all parameters with name \c param from the current level of the tree. @@ -430,14 +435,14 @@ public: * * \pre \c root must not have been read before from this ConfigTree. */ - ConfigTreeNew + ConfigTree getConfSubtree(std::string const& root) const; /*! Get the subtree rooted at \c root if present * * \pre \c root must not have been read before from this ConfigTree. */ - boost::optional<ConfigTreeNew> + boost::optional<ConfigTree> getConfSubtreeOptional(std::string const& root) const; /*! Get all subtrees that have a root \c root from the current level of the tree. @@ -484,7 +489,7 @@ public: //! The destructor performs the check if all nodes at the current level of the tree //! have been read. - ~ConfigTreeNew(); + ~ConfigTree(); //! Default error callback function //! Will print an error message and call std::abort() @@ -510,7 +515,7 @@ private: }; //! Used for wrapping a subtree - explicit ConfigTreeNew(PTree const& tree, ConfigTreeNew const& parent, std::string const& root); + explicit ConfigTree(PTree const& tree, ConfigTree const& parent, std::string const& root); /*! Called if an error occurs. Will call the error callback. * @@ -619,12 +624,15 @@ private: //! Set of allowed characters in a key name. static const std::string key_chars; - friend void checkAndInvalidate(ConfigTreeNew* const conf); - friend void checkAndInvalidate(ConfigTreeNew& conf); - friend void checkAndInvalidate(std::unique_ptr<ConfigTreeNew> const& conf); + friend void checkAndInvalidate(ConfigTree* const conf); + friend void checkAndInvalidate(ConfigTree& conf); + friend void checkAndInvalidate(std::unique_ptr<ConfigTree> const& conf); }; } #include "ConfigTreeNew-impl.h" + +#endif // BASELIB_CONFIGTREE_H_ + diff --git a/BaseLib/ConfigTreeUtil.cpp b/BaseLib/ConfigTreeUtil.cpp index 12b3904dede..1aa7864d774 100644 --- a/BaseLib/ConfigTreeUtil.cpp +++ b/BaseLib/ConfigTreeUtil.cpp @@ -18,20 +18,20 @@ namespace BaseLib ConfigTreeTopLevel::ConfigTreeTopLevel( const std::string& filepath, const bool be_ruthless, - ConfigTreeNew::PTree&& ptree) + ConfigTree::PTree&& ptree) : _ptree(std::move(ptree)) , _ctree(_ptree, filepath, - be_ruthless ? ConfigTreeNew::onerror : ConfigTreeNew::onwarning) + be_ruthless ? ConfigTree::onerror : ConfigTree::onwarning) { } -ConfigTreeNew const& +ConfigTree const& ConfigTreeTopLevel::operator*() const { return _ctree; } -ConfigTreeNew const* +ConfigTree const* ConfigTreeTopLevel::operator->() const { return &_ctree; @@ -47,7 +47,7 @@ ConfigTreeTopLevel makeConfigTree(const std::string& filepath, const bool be_ruthless, const std::string& toplevel_tag) { - ConfigTreeNew::PTree ptree; + ConfigTree::PTree ptree; // note: Trimming whitespace and ignoring comments is crucial in order // for our configuration tree implementation to work! diff --git a/BaseLib/ConfigTreeUtil.h b/BaseLib/ConfigTreeUtil.h index 80f568b5581..8fa18613ff1 100644 --- a/BaseLib/ConfigTreeUtil.h +++ b/BaseLib/ConfigTreeUtil.h @@ -31,7 +31,7 @@ public: */ explicit ConfigTreeTopLevel(std::string const& filepath, bool const be_ruthless, - ConfigTreeNew::PTree&& ptree); + ConfigTree::PTree&& ptree); /*! Access the contained ConfigTree. * @@ -39,7 +39,7 @@ public: * the \c _ctree when it is passed around. In order to check and invalidate \c _ctree use the provided * member function. */ - ConfigTreeNew const& operator*() const; + ConfigTree const& operator*() const; /*! Access the contained ConfigTree. * @@ -47,7 +47,7 @@ public: * the \c _ctree when it is passed around. In order to check and invalidate \c _ctree use the provided * member function. */ - ConfigTreeNew const* operator->() const; + ConfigTree const* operator->() const; /*! Check if the contained ConfigTree has been processed entirely. * @@ -58,8 +58,8 @@ public: void checkAndInvalidate(); private: - ConfigTreeNew::PTree const _ptree; //!< <tt>boost::property_tree</tt> that underlies \c _ctree - ConfigTreeNew _ctree; //!< ConfigTree depending on \c _ptree + ConfigTree::PTree const _ptree; //!< <tt>boost::property_tree</tt> that underlies \c _ctree + ConfigTree _ctree; //!< ConfigTree depending on \c _ptree }; /*! Create a ConfigTree from an XML file. diff --git a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp index d68b650f9b9..99b032cd5ac 100644 --- a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp +++ b/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp @@ -128,7 +128,7 @@ bool BoostXmlGmlInterface::readFile(const std::string &fname) return true; } -void BoostXmlGmlInterface::readPoints(BaseLib::ConfigTreeNew const& pointsRoot, +void BoostXmlGmlInterface::readPoints(BaseLib::ConfigTree const& pointsRoot, std::vector<GeoLib::Point*>& points, std::map<std::string, std::size_t>& pnt_names ) { @@ -158,7 +158,7 @@ void BoostXmlGmlInterface::readPoints(BaseLib::ConfigTreeNew const& pointsRoot, } void BoostXmlGmlInterface::readPolylines( - BaseLib::ConfigTreeNew const& polylinesRoot, + BaseLib::ConfigTree const& polylinesRoot, std::vector<GeoLib::Polyline*>& polylines, std::vector<GeoLib::Point*> const& points, std::vector<std::size_t> const& pnt_id_map, @@ -191,7 +191,7 @@ void BoostXmlGmlInterface::readPolylines( } void BoostXmlGmlInterface::readSurfaces( - BaseLib::ConfigTreeNew const& surfacesRoot, + BaseLib::ConfigTree const& surfacesRoot, std::vector<GeoLib::Surface*>& surfaces, std::vector<GeoLib::Point*> const& points, const std::vector<std::size_t>& pnt_id_map, diff --git a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h b/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h index 7b128f12e89..1a711c0c64d 100644 --- a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h +++ b/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h @@ -50,26 +50,26 @@ protected: private: /// Reads GeoLib::Point-objects from an xml-file - void readPoints ( BaseLib::ConfigTreeNew const& pointsRoot, + void readPoints ( BaseLib::ConfigTree const& pointsRoot, std::vector<GeoLib::Point*>& points, std::map<std::string, std::size_t>& pnt_names); /// Reads GeoLib::Polyline-objects from an xml-file - void readPolylines ( BaseLib::ConfigTreeNew const& polylinesRoot, + void readPolylines ( BaseLib::ConfigTree const& polylinesRoot, std::vector<GeoLib::Polyline*>& polylines, std::vector<GeoLib::Point*> const& points, const std::vector<std::size_t>& pnt_id_map, std::map<std::string, std::size_t>& ply_names); /// Reads GeoLib::Surface-objects from an xml-file - void readSurfaces ( BaseLib::ConfigTreeNew const& surfacesRoot, + void readSurfaces ( BaseLib::ConfigTree const& surfacesRoot, std::vector<GeoLib::Surface*>& surfaces, std::vector<GeoLib::Point*> const& points, const std::vector<std::size_t>& pnt_id_map, std::map<std::string, std::size_t>& sfc_names); - void addSurfacesToPropertyTree(BaseLib::ConfigTreeNew::PTree & pt); - void addPolylinesToPropertyTree(BaseLib::ConfigTreeNew::PTree & geometry_set); + void addSurfacesToPropertyTree(BaseLib::ConfigTree::PTree & pt); + void addPolylinesToPropertyTree(BaseLib::ConfigTree::PTree & geometry_set); std::map<std::size_t, std::size_t> _idx_map; GeoLib::GEOObjects &_geo_objects; diff --git a/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp b/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp index 21b6d293679..e8ebda34ad8 100644 --- a/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp +++ b/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp @@ -97,7 +97,7 @@ private: EigenLinearSolver::EigenLinearSolver(EigenMatrix &A, const std::string /*solver_name*/, - const BaseLib::ConfigTreeNew* const option) + const BaseLib::ConfigTree* const option) { if (option) setOption(*option); @@ -116,7 +116,7 @@ EigenLinearSolver::EigenLinearSolver(EigenMatrix &A, } } -void EigenLinearSolver::setOption(BaseLib::ConfigTreeNew const& option) +void EigenLinearSolver::setOption(BaseLib::ConfigTree const& option) { ignoreOtherLinearSolvers(option, "eigen"); auto const ptSolver = option.getConfSubtreeOptional("eigen"); diff --git a/MathLib/LinAlg/Eigen/EigenLinearSolver.h b/MathLib/LinAlg/Eigen/EigenLinearSolver.h index 0f12d3f6d23..5a6bbc56cca 100644 --- a/MathLib/LinAlg/Eigen/EigenLinearSolver.h +++ b/MathLib/LinAlg/Eigen/EigenLinearSolver.h @@ -35,7 +35,7 @@ public: * LisOption struct. */ EigenLinearSolver(EigenMatrix &A, const std::string solver_name = "", - BaseLib::ConfigTreeNew const*const option = nullptr); + BaseLib::ConfigTree const*const option = nullptr); ~EigenLinearSolver() { @@ -45,7 +45,7 @@ public: /** * parse linear solvers configuration */ - void setOption(const BaseLib::ConfigTreeNew& option); + void setOption(const BaseLib::ConfigTree& option); /** * copy linear solvers options diff --git a/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.cpp b/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.cpp index 75acc900fdf..e51b6a64484 100644 --- a/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.cpp +++ b/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.cpp @@ -26,7 +26,7 @@ namespace MathLib EigenLisLinearSolver::EigenLisLinearSolver( EigenMatrix& A, const std::string /*solver_name*/, - BaseLib::ConfigTreeNew const* const option) + BaseLib::ConfigTree const* const option) : _A(A), _lis_option(option) { } diff --git a/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h b/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h index 303ea5cbd84..03c7f24eb56 100644 --- a/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h +++ b/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h @@ -38,7 +38,7 @@ public: * LisOption struct. */ EigenLisLinearSolver(EigenMatrix &A, const std::string solver_name = "", - BaseLib::ConfigTreeNew const*const option = nullptr); + BaseLib::ConfigTree const*const option = nullptr); /** * copy linear solvers options diff --git a/MathLib/LinAlg/LinearSolverOptions.cpp b/MathLib/LinAlg/LinearSolverOptions.cpp index 6c42a036dfa..b5a582dc9f0 100644 --- a/MathLib/LinAlg/LinearSolverOptions.cpp +++ b/MathLib/LinAlg/LinearSolverOptions.cpp @@ -14,7 +14,7 @@ namespace MathLib void -ignoreOtherLinearSolvers(const BaseLib::ConfigTreeNew &config, +ignoreOtherLinearSolvers(const BaseLib::ConfigTree &config, const std::string &solver_name) { for (auto const& s : known_linear_solvers) { diff --git a/MathLib/LinAlg/LinearSolverOptions.h b/MathLib/LinAlg/LinearSolverOptions.h index 8a36efd814e..33133ba5175 100644 --- a/MathLib/LinAlg/LinearSolverOptions.h +++ b/MathLib/LinAlg/LinearSolverOptions.h @@ -23,7 +23,7 @@ namespace MathLib * This function is currently used in the option parsing code of our * \c EigenLinearSolver, \c LisOption and \c PETScLinearSolver */ -void ignoreOtherLinearSolvers(BaseLib::ConfigTreeNew const& config, +void ignoreOtherLinearSolvers(BaseLib::ConfigTree const& config, std::string const& solver_name); } diff --git a/MathLib/LinAlg/Lis/LisLinearSolver.cpp b/MathLib/LinAlg/Lis/LisLinearSolver.cpp index a0acc785631..e8ea20e94db 100644 --- a/MathLib/LinAlg/Lis/LisLinearSolver.cpp +++ b/MathLib/LinAlg/Lis/LisLinearSolver.cpp @@ -27,7 +27,7 @@ namespace MathLib LisLinearSolver::LisLinearSolver(LisMatrix &A, const std::string /*solver_name*/, - const BaseLib::ConfigTreeNew* const option) + const BaseLib::ConfigTree* const option) : _A(A), _lis_option(option) { } diff --git a/MathLib/LinAlg/Lis/LisLinearSolver.h b/MathLib/LinAlg/Lis/LisLinearSolver.h index 1741deec287..96b65dc8c11 100644 --- a/MathLib/LinAlg/Lis/LisLinearSolver.h +++ b/MathLib/LinAlg/Lis/LisLinearSolver.h @@ -46,7 +46,7 @@ public: * LisOption struct. */ LisLinearSolver(LisMatrix &A, const std::string solver_name = "", - BaseLib::ConfigTreeNew const*const option = nullptr); + BaseLib::ConfigTree const*const option = nullptr); /** * configure linear solvers diff --git a/MathLib/LinAlg/Lis/LisOption.h b/MathLib/LinAlg/Lis/LisOption.h index 197bbbd89b7..a12d8a56a01 100644 --- a/MathLib/LinAlg/Lis/LisOption.h +++ b/MathLib/LinAlg/Lis/LisOption.h @@ -40,7 +40,7 @@ namespace MathLib */ struct LisOption { - LisOption(BaseLib::ConfigTreeNew const* const options) + LisOption(BaseLib::ConfigTree const* const options) { if (options) { diff --git a/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp b/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp index 28f94f495f2..bae601f32cf 100644 --- a/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp +++ b/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp @@ -23,7 +23,7 @@ namespace MathLib { PETScLinearSolver::PETScLinearSolver(PETScMatrix& A, const std::string prefix, - BaseLib::ConfigTreeNew const* const option) + BaseLib::ConfigTree const* const option) : _A(A), _elapsed_ctime(0.) { // Insert options into petsc database if any. diff --git a/MathLib/LinAlg/PETSc/PETScLinearSolver.h b/MathLib/LinAlg/PETSc/PETScLinearSolver.h index b0ea9353ea1..35010ab6e51 100644 --- a/MathLib/LinAlg/PETSc/PETScLinearSolver.h +++ b/MathLib/LinAlg/PETSc/PETScLinearSolver.h @@ -50,7 +50,7 @@ class PETScLinearSolver petsc options database. */ PETScLinearSolver(PETScMatrix& A, const std::string prefix = "", - BaseLib::ConfigTreeNew const* const option = nullptr); + BaseLib::ConfigTree const* const option = nullptr); ~PETScLinearSolver() { diff --git a/MathLib/LinAlg/Solvers/GaussAlgorithm-impl.h b/MathLib/LinAlg/Solvers/GaussAlgorithm-impl.h index bdc545adf5b..b29bea94de9 100644 --- a/MathLib/LinAlg/Solvers/GaussAlgorithm-impl.h +++ b/MathLib/LinAlg/Solvers/GaussAlgorithm-impl.h @@ -21,7 +21,7 @@ namespace MathLib { template <typename MAT_T, typename VEC_T> GaussAlgorithm<MAT_T, VEC_T>::GaussAlgorithm(MAT_T &A, const std::string /*solver_name*/, - BaseLib::ConfigTreeNew const* const) : + BaseLib::ConfigTree const* const) : _mat(A), _n(_mat.getNRows()), _perm(new IDX_T[_n]) {} diff --git a/MathLib/LinAlg/Solvers/GaussAlgorithm.h b/MathLib/LinAlg/Solvers/GaussAlgorithm.h index 2aef9ea4995..3f52e7ed485 100644 --- a/MathLib/LinAlg/Solvers/GaussAlgorithm.h +++ b/MathLib/LinAlg/Solvers/GaussAlgorithm.h @@ -55,7 +55,7 @@ public: * second argument was introduced. */ GaussAlgorithm(MAT_T &A, const std::string solver_name = "", - BaseLib::ConfigTreeNew const*const option = nullptr); + BaseLib::ConfigTree const*const option = nullptr); /** * destructor, deletes the permutation */ diff --git a/NumLib/TimeStepping/Algorithms/FixedTimeStepping.cpp b/NumLib/TimeStepping/Algorithms/FixedTimeStepping.cpp index 72c255d1261..63e84648b1f 100644 --- a/NumLib/TimeStepping/Algorithms/FixedTimeStepping.cpp +++ b/NumLib/TimeStepping/Algorithms/FixedTimeStepping.cpp @@ -32,7 +32,7 @@ FixedTimeStepping::FixedTimeStepping(double t0, double tn, double dt) {} FixedTimeStepping* -FixedTimeStepping::newInstance(BaseLib::ConfigTreeNew const& config) +FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config) { config.checkConfParam("type", "FixedTimeStepping"); diff --git a/NumLib/TimeStepping/Algorithms/FixedTimeStepping.h b/NumLib/TimeStepping/Algorithms/FixedTimeStepping.h index b258bedc295..ff892c927bc 100644 --- a/NumLib/TimeStepping/Algorithms/FixedTimeStepping.h +++ b/NumLib/TimeStepping/Algorithms/FixedTimeStepping.h @@ -64,7 +64,7 @@ public: * * Currently this function only covers uniform timestep size. */ - static FixedTimeStepping* newInstance(BaseLib::ConfigTreeNew const& config); + static FixedTimeStepping* newInstance(BaseLib::ConfigTree const& config); virtual ~FixedTimeStepping() {} diff --git a/ProcessLib/GroundwaterFlowProcess.h b/ProcessLib/GroundwaterFlowProcess.h index fb06b0dd012..28f507e9ec6 100644 --- a/ProcessLib/GroundwaterFlowProcess.h +++ b/ProcessLib/GroundwaterFlowProcess.h @@ -38,7 +38,7 @@ public: GroundwaterFlowProcess(MeshLib::Mesh& mesh, std::vector<ProcessVariable> const& variables, std::vector<std::unique_ptr<ParameterBase>> const& parameters, - BaseLib::ConfigTreeNew const& config) + BaseLib::ConfigTree const& config) : Process<GlobalSetup>(mesh) { config.checkConfParam("type", "GROUNDWATER_FLOW"); diff --git a/ProcessLib/InitialCondition.cpp b/ProcessLib/InitialCondition.cpp index 21d330db828..89f5e10b9cd 100644 --- a/ProcessLib/InitialCondition.cpp +++ b/ProcessLib/InitialCondition.cpp @@ -21,7 +21,7 @@ namespace ProcessLib { std::unique_ptr<InitialCondition> createUniformInitialCondition( - BaseLib::ConfigTreeNew const& config) + BaseLib::ConfigTree const& config) { config.checkConfParam("type", "Uniform"); @@ -33,7 +33,7 @@ std::unique_ptr<InitialCondition> createUniformInitialCondition( } std::unique_ptr<InitialCondition> createMeshPropertyInitialCondition( - BaseLib::ConfigTreeNew const& config, MeshLib::Mesh const& mesh) + BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh) { auto field_name = config.getConfParam<std::string>("field_name"); DBUG("Using field_name %s", field_name.c_str()); diff --git a/ProcessLib/InitialCondition.h b/ProcessLib/InitialCondition.h index a6b686b0360..850da20fa27 100644 --- a/ProcessLib/InitialCondition.h +++ b/ProcessLib/InitialCondition.h @@ -17,7 +17,7 @@ namespace BaseLib { -class ConfigTreeNew; +class ConfigTree; } namespace MeshLib @@ -57,7 +57,7 @@ private: /// Construct a UniformInitialCondition from configuration. std::unique_ptr<InitialCondition> createUniformInitialCondition( - BaseLib::ConfigTreeNew const& config); + BaseLib::ConfigTree const& config); /// Distribution of values given by a mesh property defined on nodes. class MeshPropertyInitialCondition : public InitialCondition @@ -81,7 +81,7 @@ private: /// Construct a MeshPropertyInitialCondition from configuration. std::unique_ptr<InitialCondition> createMeshPropertyInitialCondition( - BaseLib::ConfigTreeNew const& config, MeshLib::Mesh const& mesh); + BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh); } // namespace ProcessLib diff --git a/ProcessLib/NeumannBcConfig.h b/ProcessLib/NeumannBcConfig.h index bc84426ebb1..2ac0ef47bdb 100644 --- a/ProcessLib/NeumannBcConfig.h +++ b/ProcessLib/NeumannBcConfig.h @@ -44,7 +44,7 @@ class NeumannBcConfig : public BoundaryConditionConfig { public: NeumannBcConfig(GeoLib::GeoObject const* const geometry, - BaseLib::ConfigTreeNew const& config) + BaseLib::ConfigTree const& config) : BoundaryConditionConfig(geometry) { DBUG("Constructing NeumannBcConfig from config."); diff --git a/ProcessLib/Parameter.cpp b/ProcessLib/Parameter.cpp index 40eb6b0370c..ecbabfe84d9 100644 --- a/ProcessLib/Parameter.cpp +++ b/ProcessLib/Parameter.cpp @@ -17,7 +17,7 @@ namespace ProcessLib { std::unique_ptr<ParameterBase> createConstParameter( - BaseLib::ConfigTreeNew const& config) + BaseLib::ConfigTree const& config) { config.checkConfParam("type", "Constant"); auto value = config.getConfParam<double>("value"); @@ -27,7 +27,7 @@ std::unique_ptr<ParameterBase> createConstParameter( } std::unique_ptr<ParameterBase> createMeshPropertyParameter( - BaseLib::ConfigTreeNew const& config, MeshLib::Mesh const& mesh) + BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh) { config.checkConfParam("type", "MeshProperty"); auto field_name = config.getConfParam<std::string>("field_name"); diff --git a/ProcessLib/Parameter.h b/ProcessLib/Parameter.h index 482c454c242..9d7555c3204 100644 --- a/ProcessLib/Parameter.h +++ b/ProcessLib/Parameter.h @@ -66,7 +66,7 @@ private: ReturnType _value; }; -std::unique_ptr<ParameterBase> createConstParameter(BaseLib::ConfigTreeNew const& config); +std::unique_ptr<ParameterBase> createConstParameter(BaseLib::ConfigTree const& config); /// A parameter represented by a mesh property vector. template <typename ReturnType> @@ -87,7 +87,7 @@ private: MeshLib::PropertyVector<ReturnType> const& _property; }; -std::unique_ptr<ParameterBase> createMeshPropertyParameter(BaseLib::ConfigTreeNew const& config, MeshLib::Mesh const& mesh); +std::unique_ptr<ParameterBase> createMeshPropertyParameter(BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh); } // namespace ProcessLib diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h index f5d20b033db..8828b124915 100644 --- a/ProcessLib/Process.h +++ b/ProcessLib/Process.h @@ -135,9 +135,9 @@ protected: /// Set linear solver options; called by the derived process which is /// parsing the configuration. - void setLinearSolverOptions(BaseLib::ConfigTreeNew&& config) + void setLinearSolverOptions(BaseLib::ConfigTree&& config) { - _linear_solver_options.reset(new BaseLib::ConfigTreeNew( + _linear_solver_options.reset(new BaseLib::ConfigTree( std::move(config))); } @@ -300,7 +300,7 @@ protected: std::unique_ptr<AssemblerLib::LocalToGlobalIndexMap> _local_to_global_index_map; - std::unique_ptr<BaseLib::ConfigTreeNew> _linear_solver_options; + std::unique_ptr<BaseLib::ConfigTree> _linear_solver_options; std::unique_ptr<typename GlobalSetup::LinearSolver> _linear_solver; std::unique_ptr<typename GlobalSetup::MatrixType> _A; diff --git a/ProcessLib/ProcessVariable.cpp b/ProcessLib/ProcessVariable.cpp index 420834abd10..51f70ee6c95 100644 --- a/ProcessLib/ProcessVariable.cpp +++ b/ProcessLib/ProcessVariable.cpp @@ -18,7 +18,7 @@ namespace ProcessLib { -ProcessVariable::ProcessVariable(BaseLib::ConfigTreeNew const& config, +ProcessVariable::ProcessVariable(BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh, GeoLib::GEOObjects const& geometries) : _name(config.getConfParam<std::string>("name")) diff --git a/ProcessLib/ProcessVariable.h b/ProcessLib/ProcessVariable.h index 565768a8070..65d8bebed18 100644 --- a/ProcessLib/ProcessVariable.h +++ b/ProcessLib/ProcessVariable.h @@ -47,7 +47,7 @@ namespace ProcessLib class ProcessVariable { public: - ProcessVariable(BaseLib::ConfigTreeNew const& config, MeshLib::Mesh const& mesh, + ProcessVariable(BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh, GeoLib::GEOObjects const& geometries); ProcessVariable(ProcessVariable&&); diff --git a/ProcessLib/UniformDirichletBoundaryCondition.h b/ProcessLib/UniformDirichletBoundaryCondition.h index 55182f6ad45..3078bf2a2b4 100644 --- a/ProcessLib/UniformDirichletBoundaryCondition.h +++ b/ProcessLib/UniformDirichletBoundaryCondition.h @@ -39,7 +39,7 @@ class UniformDirichletBoundaryCondition { public: UniformDirichletBoundaryCondition(GeoLib::GeoObject const* const geometry, - BaseLib::ConfigTreeNew const& config) + BaseLib::ConfigTree const& config) : _geometry(geometry) { DBUG("Constructing UniformDirichletBoundaryCondition from config."); diff --git a/Tests/AssemblerLib/TestSerialLinearSolver.cpp b/Tests/AssemblerLib/TestSerialLinearSolver.cpp index 5d03fb32dc9..e7125a0c8e7 100644 --- a/Tests/AssemblerLib/TestSerialLinearSolver.cpp +++ b/Tests/AssemblerLib/TestSerialLinearSolver.cpp @@ -136,7 +136,7 @@ TEST(AssemblerLibSerialLinearSolver, Steady2DdiffusionQuadElem) t_root.put_child("eigen", t_solver); } t_root.put("lis", "-i cg -p none -tol 1e-16 -maxiter 1000"); - BaseLib::ConfigTreeNew conf(t_root, ""); + BaseLib::ConfigTree conf(t_root, ""); GlobalSetup::LinearSolver ls(*A, "solver_name", &conf); ls.solve(*rhs, *x); diff --git a/Tests/BaseLib/TestConfigTree.cpp b/Tests/BaseLib/TestConfigTree.cpp index 3b89a6f3e5d..0b0e627febf 100644 --- a/Tests/BaseLib/TestConfigTree.cpp +++ b/Tests/BaseLib/TestConfigTree.cpp @@ -30,11 +30,11 @@ // Exception thrown by the error callback of the class below class Exc {}; -// class that provides callback functions used with ConfigTreeNew +// class that provides callback functions used with ConfigTree class Callbacks { public: - BaseLib::ConfigTreeNew::Callback + BaseLib::ConfigTree::Callback get_error_cb() { return [this](std::string const& filename, std::string const& path, @@ -52,7 +52,7 @@ public: }; } - BaseLib::ConfigTreeNew::Callback + BaseLib::ConfigTree::Callback get_warning_cb() { return [this](std::string const& filename, std::string const& path, @@ -90,10 +90,10 @@ readXml(const char xml[]) return ptree; } -BaseLib::ConfigTreeNew +BaseLib::ConfigTree makeConfigTree(boost::property_tree::ptree const& ptree, Callbacks& cbs) { - return BaseLib::ConfigTreeNew(ptree, "FILENAME", + return BaseLib::ConfigTree(ptree, "FILENAME", cbs.get_error_cb(), cbs.get_warning_cb()); } @@ -518,13 +518,13 @@ TEST(BaseLibConfigTree, MoveConstruct) // test that read status of data is transferred in move construction { - BaseLib::ConfigTreeNew const u2(std::move(u)); + BaseLib::ConfigTree const u2(std::move(u)); EXPECT_ERR_WARN(cbs, false, false); } EXPECT_ERR_WARN(cbs, false, false); // test that read status of children is transferred in move construction - BaseLib::ConfigTreeNew conf2(std::move(conf)); + BaseLib::ConfigTree conf2(std::move(conf)); EXPECT_EQ("XX", conf2.getConfParam<std::string>("n", "XX")); EXPECT_ERR_WARN(cbs, false, false); diff --git a/Tests/MathLib/TestLinearSolver.cpp b/Tests/MathLib/TestLinearSolver.cpp index b6eb35a7bdb..23c8ea8ed5c 100644 --- a/Tests/MathLib/TestLinearSolver.cpp +++ b/Tests/MathLib/TestLinearSolver.cpp @@ -99,7 +99,7 @@ template<typename IntType> struct Example1 }; template <class T_MATRIX, class T_VECTOR, class T_LINEAR_SOVLER, typename IntType> -void checkLinearSolverInterface(T_MATRIX &A, BaseLib::ConfigTreeNew const& ls_option) +void checkLinearSolverInterface(T_MATRIX &A, BaseLib::ConfigTree const& ls_option) { Example1<IntType> ex1; @@ -136,7 +136,7 @@ void checkLinearSolverInterface(T_MATRIX &A, BaseLib::ConfigTreeNew const& ls_op template <class T_MATRIX, class T_VECTOR, class T_LINEAR_SOVLER> void checkLinearSolverInterface(T_MATRIX& A, T_VECTOR& b, const std::string& prefix_name, - BaseLib::ConfigTreeNew const& ls_option) + BaseLib::ConfigTree const& ls_option) { int mrank; MPI_Comm_rank(PETSC_COMM_WORLD, &mrank); @@ -204,7 +204,7 @@ void checkLinearSolverInterface(T_MATRIX& A, T_VECTOR& b, TEST(MathLib, CheckInterface_GaussAlgorithm) { boost::property_tree::ptree t_root; - BaseLib::ConfigTreeNew conf(t_root, ""); + BaseLib::ConfigTree conf(t_root, ""); using Example = Example1<std::size_t>; @@ -226,7 +226,7 @@ TEST(Math, CheckInterface_Eigen) t_solver.put("error_tolerance", 1e-15); t_solver.put("max_iteration_step", 1000); t_root.put_child("eigen", t_solver); - BaseLib::ConfigTreeNew conf(t_root, ""); + BaseLib::ConfigTree conf(t_root, ""); using IntType = MathLib::EigenMatrix::IndexType; @@ -243,7 +243,7 @@ TEST(Math, CheckInterface_EigenLis) boost::property_tree::ptree t_root; boost::property_tree::ptree t_solver; t_root.put("lis", "-i cg -p none -tol 1e-15 -maxiter 1000"); - BaseLib::ConfigTreeNew conf(t_root, ""); + BaseLib::ConfigTree conf(t_root, ""); using IntType = MathLib::LisMatrix::IndexType; @@ -260,7 +260,7 @@ TEST(Math, CheckInterface_Lis) boost::property_tree::ptree t_root; boost::property_tree::ptree t_solver; t_root.put("lis", "-i cg -p none -tol 1e-15 -maxiter 1000"); - BaseLib::ConfigTreeNew conf(t_root, ""); + BaseLib::ConfigTree conf(t_root, ""); using IntType = MathLib::LisMatrix::IndexType; @@ -294,7 +294,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_basic) checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, MathLib::PETScLinearSolver>( - A, b, "ptest1_", BaseLib::ConfigTreeNew(t_root, "")); + A, b, "ptest1_", BaseLib::ConfigTree(t_root, "")); } TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor) @@ -320,7 +320,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor) checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, MathLib::PETScLinearSolver>( - A, b, "ptest2_", BaseLib::ConfigTreeNew(t_root, "")); + A, b, "ptest2_", BaseLib::ConfigTree(t_root, "")); } TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_gmres_amg) @@ -348,7 +348,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_gmres_amg) checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, MathLib::PETScLinearSolver>( - A, b, "ptest3_", BaseLib::ConfigTreeNew(t_root, "")); + A, b, "ptest3_", BaseLib::ConfigTree(t_root, "")); } #endif -- GitLab