OGS 6.2.0-97-g4a610c866
createPorosityModel.cpp
Go to the documentation of this file.
1 
13 #include "createPorosityModel.h"
14 
15 #include "BaseLib/ConfigTree.h"
16 #include "BaseLib/Error.h"
17 #include "ParameterLib/Utils.h"
18 
19 #include "Porosity.h"
20 
21 namespace MaterialLib
22 {
23 namespace PorousMedium
24 {
25 std::unique_ptr<Porosity> createPorosityModel(
26  BaseLib::ConfigTree const& config,
27  std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
28 {
30  auto const type = config.getConfigParameter<std::string>("type");
31 
32  if (type == "Constant")
33  {
34  auto const& constant_porosity = ParameterLib::findParameter<double>(
35  config,
37  "porosity_parameter", parameters, 1);
38 
39  return std::make_unique<Porosity>(constant_porosity);
40  }
41 
42  OGS_FATAL("The porosity type %s is unavailable.\n",
43  "The available type is Constant.",
44  type.data());
45 }
46 
47 } // namespace PorousMedium
48 } // namespace MaterialLib
T getConfigParameter(std::string const &param) const
std::unique_ptr< Porosity > createPorosityModel(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63