OGS
scaleMeshPropertyVector.cpp
Go to the documentation of this file.
1
12
#include "
scaleMeshPropertyVector.h
"
13
14
#include "
MeshLib/Mesh.h
"
15
16
namespace
MeshLib
17
{
18
void
scaleMeshPropertyVector
(
MeshLib::Mesh
& mesh,
19
std::string
const
& property_name,
20
double
factor)
21
{
22
if
(!mesh.
getProperties
().
existsPropertyVector
<
double
>(property_name))
23
{
24
WARN
(
"Did not find PropertyVector '{:s}' for scaling."
, property_name);
25
return
;
26
}
27
auto
& pv = *mesh.
getProperties
().
getPropertyVector
<
double
>(property_name);
28
std::transform(pv.begin(), pv.end(), pv.begin(),
29
[factor](
auto
const
& v) { return v * factor; });
30
}
31
}
// namespace MeshLib
WARN
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition
Logging.h:40
Mesh.h
Definition of the Mesh class.
MeshLib::Mesh
Definition
Mesh.h:43
MeshLib::Mesh::getProperties
Properties & getProperties()
Definition
Mesh.h:134
MeshLib::Properties::existsPropertyVector
bool existsPropertyVector(std::string_view name) const
Definition
Properties.h:74
MeshLib::Properties::getPropertyVector
PropertyVector< T > const * getPropertyVector(std::string_view name) const
MeshLib
Definition
ProjectData.h:41
MeshLib::scaleMeshPropertyVector
void scaleMeshPropertyVector(MeshLib::Mesh &mesh, std::string const &property_name, double factor)
Definition
scaleMeshPropertyVector.cpp:18
scaleMeshPropertyVector.h
MeshLib
Utils
scaleMeshPropertyVector.cpp
Generated by
1.12.0