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 {
42 fixed_times_for_output);
43 }
44 if (type == "EvolutionaryPIDcontroller")
45 {
47 parseEvolutionaryPIDcontroller(config), fixed_times_for_output);
48 }
49 if (type == "IterationNumberBasedTimeStepping")
50 {
53 fixed_times_for_output);
54 }
56 "Unknown time stepping type: '{:s}'. The available types are: "
57 "\n\tSingleStep,"
58 "\n\tFixedTimeStepping,"
59 "\n\tEvolutionaryPIDcontroller,",
60 "\n\tIterationNumberBasedTimeStepping\n",
61 type.data());
62}
63
64} // 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(EvolutionaryPIDcontrollerParameters 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)
EvolutionaryPIDcontrollerParameters parseEvolutionaryPIDcontroller(BaseLib::ConfigTree const &config)
FixedTimeSteppingParameters parseFixedTimeStepping(BaseLib::ConfigTree const &config)
IterationNumberBasedTimeSteppingParameters parseIterationNumberBasedTimeStepping(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createFixedTimeStepping(FixedTimeSteppingParameters const &parameters, std::vector< double > const &fixed_times_for_output)
std::unique_ptr< TimeStepAlgorithm > createIterationNumberBasedTimeStepping(IterationNumberBasedTimeSteppingParameters &&parameters, std::vector< double > const &fixed_times_for_output)