From a0964ae2f15777731cdcea5930c6358b0b7e05a9 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Mon, 15 Aug 2016 08:16:13 +0200 Subject: [PATCH] [MeL] Impl. of scaleMeshPropertyVector(). --- .../createMeshElemPropertiesFromASCRaster.cpp | 11 ----------- MeshLib/Mesh.cpp | 10 ++++++++++ MeshLib/Mesh.h | 8 ++++++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Applications/Utils/SimpleMeshCreation/createMeshElemPropertiesFromASCRaster.cpp b/Applications/Utils/SimpleMeshCreation/createMeshElemPropertiesFromASCRaster.cpp index 9d59d4ab877..8a4a0fc467f 100644 --- a/Applications/Utils/SimpleMeshCreation/createMeshElemPropertiesFromASCRaster.cpp +++ b/Applications/Utils/SimpleMeshCreation/createMeshElemPropertiesFromASCRaster.cpp @@ -36,17 +36,6 @@ #include "MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h" #include "MeshLib/MeshEnums.h" -void scaleMeshPropertyVector(MeshLib::Mesh & mesh, - std::string const& property_name, - double factor) -{ - boost::optional<MeshLib::PropertyVector<double> &> pv( - mesh.getProperties().getPropertyVector<double>(property_name)); - - for (auto & v : *pv) - v *= factor; -} - int main(int argc, char* argv[]) { ApplicationsLib::LogogSetup logo_setup; diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp index f1308e6e3a2..d205f39fbf3 100644 --- a/MeshLib/Mesh.cpp +++ b/MeshLib/Mesh.cpp @@ -253,5 +253,15 @@ void Mesh::setNodesConnectedByElements() } } +void scaleMeshPropertyVector(MeshLib::Mesh & mesh, + std::string const& property_name, + double factor) +{ + boost::optional<MeshLib::PropertyVector<double> &> pv( + mesh.getProperties().getPropertyVector<double>(property_name)); + + for (auto & v : *pv) + v *= factor; +} } diff --git a/MeshLib/Mesh.h b/MeshLib/Mesh.h index bb43ae634ae..0fc14924a85 100644 --- a/MeshLib/Mesh.h +++ b/MeshLib/Mesh.h @@ -164,6 +164,14 @@ protected: Properties _properties; }; /* class */ + + +/// Scales the mesh property with name \c property_name by given \c factor. +/// \note The property must be a "double" property. +void scaleMeshPropertyVector(MeshLib::Mesh& mesh, + std::string const& property_name, + double factor); + } /* namespace */ #endif /* MESH_H_ */ -- GitLab