OGS 6.2.0-97-g4a610c866
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"
19 
24 
25 namespace NumLib
26 {
27 std::unique_ptr<TimeStepAlgorithm> createTimeStepper(
28  BaseLib::ConfigTree const& config)
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);
42  }
43  if (type == "EvolutionaryPIDcontroller")
44  {
46  }
47  if (type == "IterationNumberBasedTimeStepping")
48  {
50  }
51  OGS_FATAL(
52  "Unknown time stepping type: '%s'. The available types are: "
53  "\n\tSingleStep,"
54  "\n\tFixedTimeStepping,"
55  "\n\tEvolutionaryPIDcontroller,",
56  "\n\tIterationNumberBasedTimeStepping\n",
57  type.data());
58 }
59 
60 } // end of namespace NumLib
std::unique_ptr< TimeStepAlgorithm > createEvolutionaryPIDcontroller(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createTimeStepper(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createIterationNumberBasedTimeStepping(BaseLib::ConfigTree const &config)
T peekConfigParameter(std::string const &param) const
std::unique_ptr< TimeStepAlgorithm > createFixedTimeStepping(BaseLib::ConfigTree const &config)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
void ignoreConfigParameter(std::string const &param) const
Definition: ConfigTree.cpp:186