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

Initfile with Dune::ParameterTree

parent 5da43678
Pipeline #959 passed with stage
in 8 minutes and 19 seconds
......@@ -9,7 +9,7 @@
#include <unistd.h>
#endif
#include <boost/property_tree/json_parser.hpp>
#include <dune/common/parametertreeparser.hh>
// a parser for arithmetic expressions
// #include <muParser.h>
......@@ -56,8 +56,7 @@ namespace AMDiS
test_exit(file_exists(fn),
"init-file '", fn, "' cannot be opened for reading");
using boost::property_tree::json_parser::read_json;
read_json(fn, pt);
Dune::ParameterTreeParser::readINITree(fn, pt);
}
......
......@@ -7,15 +7,15 @@
#include <list>
#include <vector>
#define BOOST_BIND_NO_PLACEHOLDERS
#include <boost/lexical_cast.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/tokenizer.hpp>
#include <boost/property_tree/ptree.hpp>
#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/common/Math.hpp>
......@@ -197,13 +197,15 @@ namespace AMDiS
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(tag, "->", ">");
auto tagPath = path(tag, '>');
return singlett().pt.get_optional<T>(tagPath);
replaceAll(key, "->", ".");
try {
return singlett().pt.get<T>(key);
}
catch (...) {
return Dune::Std::nullopt;
}
}
......@@ -230,10 +232,9 @@ namespace AMDiS
if (debugInfo == -1)
debugInfo = singlett().getMsgInfo();
using path = boost::property_tree::ptree::path_type;
replaceAll(tag, "->", ">");
auto tagPath = path(tag, '>');
singlett().pt.put(tagPath, value);
replaceAll(tag, "->", ".");
// auto tagPath = path(tag, '>');
// singlett().pt.put(tagPath, value);
// update msg parameters msgInfo, msgWait, paramInfo
singlett().getInternalParameters();
......@@ -303,8 +304,8 @@ namespace AMDiS
int paramInfo = 1;
int breakOnMissingTag = 0;
/// boost:property_tree to read/store parameter values
boost::property_tree::ptree pt;
/// ParameterTree to read/store parameter values
Dune::ParameterTree pt;
};
using Parameters = Initfile;
......
Markdown is supported
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