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 
24 namespace NumLib
25 {
26 std::unique_ptr<TimeStepAlgorithm> createTimeStepper(
27  BaseLib::ConfigTree const& config)
28 {
30  auto const type = config.peekConfigParameter<std::string>("type");
31 
32  if (type == "SingleStep")
33  {
35  config.ignoreConfigParameter("type");
36  return std::make_unique<NumLib::FixedTimeStepping>(0.0, 1.0, 1.0);
37  }
38  if (type == "FixedTimeStepping")
39  {
40  return NumLib::createFixedTimeStepping(config);
41  }
42  if (type == "EvolutionaryPIDcontroller")
43  {
45  }
46  if (type == "IterationNumberBasedTimeStepping")
47  {
49  }
50  OGS_FATAL(
51  "Unknown time stepping type: '{:s}'. The available types are: "
52  "\n\tSingleStep,"
53  "\n\tFixedTimeStepping,"
54  "\n\tEvolutionaryPIDcontroller,",
55  "\n\tIterationNumberBasedTimeStepping\n",
56  type.data());
57 }
58 
59 } // 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
Definition: ConfigTree.cpp:181
std::unique_ptr< TimeStepAlgorithm > createTimeStepper(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createIterationNumberBasedTimeStepping(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createEvolutionaryPIDcontroller(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createFixedTimeStepping(BaseLib::ConfigTree const &config)