Loading [MathJax]/extensions/tex2jax.js
OGS
scaleMeshPropertyVector.cpp
Go to the documentation of this file.
1
13
14#include <range/v3/algorithm/transform.hpp>
15
16#include "MeshLib/Mesh.h"
17
18namespace MeshLib
19{
21 std::string const& property_name,
22 double factor)
23{
24 if (!mesh.getProperties().existsPropertyVector<double>(property_name))
25 {
26 WARN("Did not find PropertyVector '{:s}' for scaling.", property_name);
27 return;
28 }
29 auto& pv = *mesh.getProperties().getPropertyVector<double>(property_name);
30 ranges::transform(pv, pv.begin(),
31 [factor](auto const& v) { return v * factor; });
32}
33} // 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:136
bool existsPropertyVector(std::string_view name) const
Definition Properties.h:93
PropertyVector< T > const * getPropertyVector(std::string_view name) const
void scaleMeshPropertyVector(MeshLib::Mesh &mesh, std::string const &property_name, double factor)