swh:1:snp:f521c49ab17ef7db6ec70b2430e1ed203f50383f
Raw File
Tip revision: 909f7bde884871e827db2fa57a5bd4d9972f17ab authored by cbsilver on 19 November 2021, 14:48:59 UTC
Replacing heat_capacity with specific_heat_capacity in ctests
Tip revision: 909f7bd
RadiusEdgeRatioMetric.cpp
/**
 * \file
 * \author Karsten Rink
 * \date   2014-09-02
 * \brief  Implementation of the RadiusEdgeRadioMetric class.
 *
 * \copyright
 * Copyright (c) 2012-2021, 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