OGS
scaleMeshPropertyVector.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 "
scaleMeshPropertyVector.h
"
5
6
#include <range/v3/algorithm/transform.hpp>
7
8
#include "
MeshLib/Mesh.h
"
9
10
namespace
MeshLib
11
{
12
void
scaleMeshPropertyVector
(
MeshLib::Mesh
& mesh,
13
std::string
const
& property_name,
14
double
factor)
15
{
16
if
(!mesh.
getProperties
().
existsPropertyVector
<
double
>(property_name))
17
{
18
WARN
(
"Did not find PropertyVector '{:s}' for scaling."
, property_name);
19
return
;
20
}
21
auto
& pv = *mesh.
getProperties
().
getPropertyVector
<
double
>(property_name);
22
ranges::transform(pv, pv.begin(),
23
[factor](
auto
const
& v) { return v * factor; });
24
}
25
}
// namespace MeshLib
WARN
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition
Logging.h:34
Mesh.h
MeshLib::Mesh
Definition
Mesh.h:34
MeshLib::Mesh::getProperties
Properties & getProperties()
Definition
Mesh.h:125
MeshLib::Properties::existsPropertyVector
bool existsPropertyVector(std::string_view name) const
Definition
Properties-impl.h:85
MeshLib::Properties::getPropertyVector
PropertyVector< T > const * getPropertyVector(std::string_view name) const
MeshLib
Definition
ProjectData.h:30
MeshLib::scaleMeshPropertyVector
void scaleMeshPropertyVector(MeshLib::Mesh &mesh, std::string const &property_name, double factor)
Definition
scaleMeshPropertyVector.cpp:12
scaleMeshPropertyVector.h
MeshLib
Utils
scaleMeshPropertyVector.cpp
Generated by
1.14.0