OGS
MeshNodeParameter.cpp
Go to the documentation of this file.
1
11#include "MeshNodeParameter.h"
12
13#include "BaseLib/ConfigTree.h"
14#include "MeshLib/Mesh.h"
15
16namespace ParameterLib
17{
18std::unique_ptr<ParameterBase> createMeshNodeParameter(
19 std::string const& name, BaseLib::ConfigTree const& config,
20 MeshLib::Mesh const& mesh)
21{
23 config.checkConfigParameter("type", "MeshNode");
24 auto const field_name =
26 config.getConfigParameter<std::string>("field_name");
27 DBUG("Using field_name {:s}", field_name);
28
29 // TODO other data types than only double
30 auto const& property =
31 mesh.getProperties().getPropertyVector<double>(field_name);
32
33 if (property->getMeshItemType() != MeshLib::MeshItemType::Node)
34 {
35 OGS_FATAL("The mesh property `{:s}' is not a nodal property.",
36 field_name);
37 }
38
39 return std::make_unique<MeshNodeParameter<double>>(name, mesh, *property);
40}
41
42} // namespace ParameterLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
Definition of the Mesh class.
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
Properties & getProperties()
Definition Mesh.h:134
PropertyVector< T > const * getPropertyVector(std::string_view name) const
std::unique_ptr< ParameterBase > createMeshNodeParameter(std::string const &name, BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh)