OGS 6.1.0-1721-g6382411ad
createPorosityModel.cpp
Go to the documentation of this file.
1 
13 #include "createPorosityModel.h"
14 
15 #include "BaseLib/Error.h"
16 #include "BaseLib/ConfigTree.h"
17 
19 
20 #include "Porosity.h"
21 
22 namespace MaterialLib
23 {
24 namespace PorousMedium
25 {
26 std::unique_ptr<Porosity> createPorosityModel(BaseLib::ConfigTree const& config,
27  std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters)
28 {
30  auto const type = config.getConfigParameter<std::string>("type");
31 
32  if (type == "Constant")
33  {
34  auto const& constant_porosity = ProcessLib::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 } // end namespace
48 } // end namespace
std::unique_ptr< Porosity > createPorosityModel(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ProcessLib::ParameterBase >> const &parameters)
T getConfigParameter(std::string const &param) const
#define OGS_FATAL(fmt,...)
Definition: Error.h:71