https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: 873fbdf2a3a68f82822d0168088b436b6908a22f authored by Tom Fischer on 30 August 2023, 08:02:31 UTC
Merge branch 'TinyIncludeFix' into 'master'
Tip revision: 873fbdf
scaleMeshPropertyVector.cpp
/**
 * \file
 *
 * \copyright
 * Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#include "scaleMeshPropertyVector.h"

#include "MeshLib/Mesh.h"

namespace MeshLib
{
void scaleMeshPropertyVector(MeshLib::Mesh& mesh,
                             std::string const& property_name,
                             double factor)
{
    if (!mesh.getProperties().existsPropertyVector<double>(property_name))
    {
        WARN("Did not find PropertyVector '{:s}' for scaling.", property_name);
        return;
    }
    auto& pv = *mesh.getProperties().getPropertyVector<double>(property_name);
    std::transform(pv.begin(), pv.end(), pv.begin(),
                   [factor](auto const& v) { return v * factor; });
}
}  // namespace MeshLib
back to top