OGS
MeshNodeParameter.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2
// SPDX-License-Identifier: BSD-3-Clause
3
4
#include "
MeshNodeParameter.h
"
5
6
#include "
BaseLib/ConfigTree.h
"
7
#include "
MeshLib/Mesh.h
"
8
9
namespace
ParameterLib
10
{
11
std::unique_ptr<ParameterBase>
createMeshNodeParameter
(
12
std::string
const
& name,
BaseLib::ConfigTree
const
& config,
13
MeshLib::Mesh
const
& mesh)
14
{
16
config.
checkConfigParameter
(
"type"
,
"MeshNode"
);
17
auto
const
field_name =
19
config.
getConfigParameter
<std::string>(
"field_name"
);
20
DBUG
(
"Using field_name {:s}"
, field_name);
21
22
// TODO other data types than only double
23
auto
const
&
property
=
24
mesh.
getProperties
().
getPropertyVector
<
double
>(field_name);
25
26
if
(property->getMeshItemType() !=
MeshLib::MeshItemType::Node
)
27
{
28
OGS_FATAL
(
"The mesh property `{:s}' is not a nodal property."
,
29
field_name);
30
}
31
32
return
std::make_unique<MeshNodeParameter<double>>(name, mesh, *property);
33
}
34
35
}
// namespace ParameterLib
ConfigTree.h
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:19
DBUG
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition
Logging.h:22
MeshNodeParameter.h
Mesh.h
BaseLib::ConfigTree
Definition
ConfigTree.h:101
BaseLib::ConfigTree::getConfigParameter
T getConfigParameter(std::string const ¶m) const
Definition
ConfigTree-impl.h:35
BaseLib::ConfigTree::checkConfigParameter
void checkConfigParameter(std::string const ¶m, std::string_view const value) const
Definition
ConfigTree.cpp:166
MeshLib::Mesh
Definition
Mesh.h:34
MeshLib::Mesh::getProperties
Properties & getProperties()
Definition
Mesh.h:125
MeshLib::Properties::getPropertyVector
PropertyVector< T > const * getPropertyVector(std::string_view name) const
MeshLib::MeshItemType::Node
@ Node
Definition
MeshEnums.h:13
ParameterLib
Definition
ChemicalSolverInterface.h:103
ParameterLib::createMeshNodeParameter
std::unique_ptr< ParameterBase > createMeshNodeParameter(std::string const &name, BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh)
Definition
MeshNodeParameter.cpp:11
ParameterLib
MeshNodeParameter.cpp
Generated by
1.14.0