Commit 0756da59 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Initfile with Dune::ParameterTree

parent 5da43678
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <boost/property_tree/json_parser.hpp> #include <dune/common/parametertreeparser.hh>
// a parser for arithmetic expressions // a parser for arithmetic expressions
// #include <muParser.h> // #include <muParser.h>
...@@ -56,8 +56,7 @@ namespace AMDiS ...@@ -56,8 +56,7 @@ namespace AMDiS
test_exit(file_exists(fn), test_exit(file_exists(fn),
"init-file '", fn, "' cannot be opened for reading"); "init-file '", fn, "' cannot be opened for reading");
using boost::property_tree::json_parser::read_json; Dune::ParameterTreeParser::readINITree(fn, pt);
read_json(fn, pt);
} }
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
#include <list> #include <list>
#include <vector> #include <vector>
#define BOOST_BIND_NO_PLACEHOLDERS
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/numeric/conversion/cast.hpp> #include <boost/numeric/conversion/cast.hpp>
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
#include <boost/property_tree/ptree.hpp>
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include <dune/common/parametertree.hh>
// #include <boost/property_tree/ptree.hpp>
#include <dune/common/std/optional.hh>
#include <dune/amdis/Output.hpp> #include <dune/amdis/Output.hpp>
#include <dune/amdis/common/Math.hpp> #include <dune/amdis/common/Math.hpp>
...@@ -197,13 +197,15 @@ namespace AMDiS ...@@ -197,13 +197,15 @@ namespace AMDiS
template <class T> template <class T>
static boost::optional<T> get(std::string tag) static Dune::Std::optional<T> get(std::string key)
{ {
using path = boost::property_tree::ptree::path_type; replaceAll(key, "->", ".");
replaceAll(tag, "->", ">"); try {
auto tagPath = path(tag, '>'); return singlett().pt.get<T>(key);
}
return singlett().pt.get_optional<T>(tagPath); catch (...) {
return Dune::Std::nullopt;
}
} }
...@@ -230,10 +232,9 @@ namespace AMDiS ...@@ -230,10 +232,9 @@ namespace AMDiS
if (debugInfo == -1) if (debugInfo == -1)
debugInfo = singlett().getMsgInfo(); debugInfo = singlett().getMsgInfo();
using path = boost::property_tree::ptree::path_type; replaceAll(tag, "->", ".");
replaceAll(tag, "->", ">"); // auto tagPath = path(tag, '>');
auto tagPath = path(tag, '>'); // singlett().pt.put(tagPath, value);
singlett().pt.put(tagPath, value);
// update msg parameters msgInfo, msgWait, paramInfo // update msg parameters msgInfo, msgWait, paramInfo
singlett().getInternalParameters(); singlett().getInternalParameters();
...@@ -303,8 +304,8 @@ namespace AMDiS ...@@ -303,8 +304,8 @@ namespace AMDiS
int paramInfo = 1; int paramInfo = 1;
int breakOnMissingTag = 0; int breakOnMissingTag = 0;
/// boost:property_tree to read/store parameter values /// ParameterTree to read/store parameter values
boost::property_tree::ptree pt; Dune::ParameterTree pt;
}; };
using Parameters = Initfile; using Parameters = Initfile;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment