https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: 307696753f6e7a224b6f3e2113598744171f704d authored by Norbert Grunwald on 10 May 2023, 18:02:03 UTC
Merge branch 'fix_ogata_banks' into 'master'
Tip revision: 3076967
RadiusEdgeRatioMetric.cpp
/**
 * \file
 * \author Karsten Rink
 * \date   2014-09-02
 * \brief  Implementation of the RadiusEdgeRadioMetric class.
 *
 * \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 "RadiusEdgeRatioMetric.h"

#include "GeoLib/MinimalBoundingSphere.h"
#include "MeshLib/Node.h"

namespace MeshLib
{
void RadiusEdgeRatioMetric::calculateQuality()
{
    std::vector<MeshLib::Element*> const& elements(_mesh.getElements());
    std::size_t const nElements(_mesh.getNumberOfElements());
    for (std::size_t k(0); k < nElements; k++)
    {
        Element const& elem(*elements[k]);
        std::size_t const n_nodes(elem.getNumberOfBaseNodes());
        std::vector<MathLib::Point3d*> pnts(n_nodes);
        std::copy_n(elem.getNodes(), n_nodes, pnts.begin());
        GeoLib::MinimalBoundingSphere const s(pnts);
        auto const& [min, max] = computeSqrEdgeLengthRange(elem);
        _element_quality_metric[k] = std::sqrt(min) / (2 * s.getRadius());
    }
}

}  // end namespace MeshLib
back to top