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