OGS
CreateTimeStepper.cpp
Go to the documentation of this file.
1
12#include "CreateTimeStepper.h"
13
14#include <memory>
15#include <string>
16
17#include "BaseLib/ConfigTree.h"
18#include "BaseLib/Error.h"
23
24namespace NumLib
25{
26std::unique_ptr<TimeStepAlgorithm> createTimeStepper(
27 BaseLib::ConfigTree const& config,
28 std::vector<double> const& fixed_times_for_output)
29{
31 auto const type = config.peekConfigParameter<std::string>("type");
32
33 if (type == "SingleStep")
34 {
36 config.ignoreConfigParameter("type");
37 return std::make_unique<NumLib::FixedTimeStepping>(0.0, 1.0, 1.0);
38 }
39 if (type == "FixedTimeStepping")
40 {
41 return NumLib::createFixedTimeStepping(config, fixed_times_for_output);
42 }
43 if (type == "EvolutionaryPIDcontroller")
44 {
46 fixed_times_for_output);
47 }
48 if (type == "IterationNumberBasedTimeStepping")
49 {
51 config, fixed_times_for_output);
52 }
54 "Unknown time stepping type: '{:s}'. The available types are: "
55 "\n\tSingleStep,"
56 "\n\tFixedTimeStepping,"
57 "\n\tEvolutionaryPIDcontroller,",
58 "\n\tIterationNumberBasedTimeStepping\n",
59 type.data());
60}
61
62} // end of namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:26
T peekConfigParameter(std::string const &param) const
void ignoreConfigParameter(std::string const &param) const
std::unique_ptr< TimeStepAlgorithm > createEvolutionaryPIDcontroller(BaseLib::ConfigTree const &config, std::vector< double > const &fixed_times_for_output)
std::unique_ptr< TimeStepAlgorithm > createTimeStepper(BaseLib::ConfigTree const &config, std::vector< double > const &fixed_times_for_output)
std::unique_ptr< TimeStepAlgorithm > createFixedTimeStepping(BaseLib::ConfigTree const &config, std::vector< double > const &fixed_times_for_output)
std::unique_ptr< TimeStepAlgorithm > createIterationNumberBasedTimeStepping(BaseLib::ConfigTree const &config, std::vector< double > const &fixed_times_for_output)