OGS
scaleMeshPropertyVector.cpp
Go to the documentation of this file.
1
13
14#include "MeshLib/Mesh.h"
15
16namespace MeshLib
17{
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
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
Definition of the Mesh class.
Properties & getProperties()
Definition Mesh.h:134
bool existsPropertyVector(std::string_view name) const
PropertyVector< T > const * getPropertyVector(std::string_view name) const
void scaleMeshPropertyVector(MeshLib::Mesh &mesh, std::string const &property_name, double factor)