OGS
CreateMedium.cpp
Go to the documentation of this file.
1
13#include "CreateMedium.h"
14
15#include "BaseLib/ConfigTree.h"
16#include "CreatePhase.h"
17#include "CreateProperty.h"
18#include "Medium.h"
21
22namespace MaterialPropertyLib
23{
24std::unique_ptr<Medium> createMedium(
25 int const material_id,
26 int const geometry_dimension,
27 BaseLib::ConfigTree const& config,
28 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
29 ParameterLib::CoordinateSystem const* const local_coordinate_system,
30 std::map<std::string,
31 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
32 curves)
33{
34 // Parsing the phases
35 // Properties of phases may be not required in all the cases.
36 auto&& phases = createPhases(geometry_dimension,
38 config.getConfigSubtreeOptional("phases"),
39 parameters, local_coordinate_system, curves);
40
41 // Parsing medium properties, overwriting the defaults.
42 auto&& properties =
43 createProperties(geometry_dimension,
45 config.getConfigSubtreeOptional("properties"),
46 parameters, local_coordinate_system, curves);
47
48 if (phases.empty() && !properties)
49 {
50 OGS_FATAL("Neither tag <phases> nor tag <properties> has been found.");
51 }
52
53 return std::make_unique<Medium>(material_id, std::move(phases),
54 std::move(properties));
55}
56
57} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
std::unique_ptr< Medium > createMedium(int const material_id, int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::vector< std::unique_ptr< Phase > > createPhases(int const geometry_dimension, std::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::unique_ptr< PropertyArray > createProperties(int const geometry_dimension, std::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
A local coordinate system used for tensor transformations.