Skip to content
Snippets Groups Projects
Commit d143182f authored by Christoph Lehmann's avatar Christoph Lehmann Committed by Dmitri Naumov
Browse files

added parser for timestepping configuration

parent e5e357a6
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,8 @@
#include "MeshLib/Mesh.h"
#include "NumLib/TimeStepping/Algorithms/FixedTimeStepping.h"
// FileIO
#include "FileIO/XmlIO/Boost/BoostXmlGmlInterface.h"
#include "FileIO/readMeshFromFile.h"
......@@ -69,6 +71,9 @@ ProjectData::ProjectData(ConfigTree const& project_config,
// output
parseOutput(project_config.get_child("output"), path);
// timestepping
parseTimeStepping(project_config.get_child("time_stepping"));
}
ProjectData::~ProjectData()
......@@ -274,3 +279,40 @@ void ProjectData::parseOutput(ConfigTree const& output_config,
_output_file_prefix = path + *file;
}
void ProjectData::parseTimeStepping(ConfigTree const& timestepping_config)
{
using namespace ProcessLib;
DBUG("Reading timestepping configuration.");
auto const type = timestepping_config.get_optional<std::string>("type");
if (!type)
{
ERR("Could not find required timestepper type.");
std::abort();
}
if (*type == "FixedTimeStepping")
{
_time_stepper.reset(NumLib::FixedTimeStepping::newInstance(timestepping_config));
}
else if (*type == "SingleStep")
{
_time_stepper.reset(new NumLib::FixedTimeStepping(0.0, 1.0, 1.0));
}
else
{
ERR("Unknown timestepper type: `%s'.", type->c_str());
std::abort();
}
if (!_time_stepper)
{
ERR("Initialization of timestepper failed.");
std::abort();
}
}
......@@ -22,6 +22,8 @@
#include "GeoLib/GEOObjects.h"
#endif
#include "NumLib/TimeStepping/Algorithms/ITimeStepAlgorithm.h"
#include "ProcessLib/ProcessVariable.h"
#include "ProcessLib/Process.h"
#include "ProcessLib/Parameter.h"
......@@ -164,6 +166,8 @@ private:
/// Parses the file tag and sets output file prefix.
void parseOutput(ConfigTree const& output_config, std::string const& path);
void parseTimeStepping(ConfigTree const& timestepping_config);
private:
#ifdef OGS_BUILD_GUI
GEOModels *_geoObjects = new GEOModels();
......@@ -182,6 +186,9 @@ private:
/// Output file path with project prefix.
std::string _output_file_prefix;
/// Timestepper
std::unique_ptr<NumLib::ITimeStepAlgorithm> _time_stepper;
};
#endif //PROJECTDATA_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment