Skip to content
Snippets Groups Projects
Commit 6afdb2be authored by Karsten Rink's avatar Karsten Rink
Browse files

initial implementation of radius-edge-metric

parent 3e7f467d
No related branches found
No related tags found
No related merge requests found
/**
* \file RadiusEdgeRatioMetric.cpp
* \author Thomas Fischer
* \date 2014-09-02
* \brief Implementation of the RadiusEdgeRadioMetric class.
*
* \copyright
* Copyright (c) 2012-2014, 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 "Node.h"
#include "MinimalBoundingSphere.h"
namespace MeshLib
{
RadiusEdgeRatioMetric::RadiusEdgeRatioMetric(Mesh const*const mesh)
: ElementQualityMetric(mesh)
{}
void RadiusEdgeRatioMetric::calculateQuality ()
{
std::vector<MeshLib::Element*> const& elements(_mesh.getElements());
size_t const nElements (_mesh.getNElements());
for (size_t k(0); k < nElements; k++)
{
Element const& elem (*elements[k]);
std::size_t const n_nodes (elem.getNNodes());
MeshLib::Node* const*const nodes = elem.getNodes();
std::vector<GeoLib::Point*> pnts(n_nodes);
std::copy_n(elem.getNodes(), n_nodes, pnts.begin());
GeoLib::MinimalBoundingSphere const s(pnts);
double min, max;
elem.computeSqrEdgeLengthRange(min, max);
_element_quality_metric[k] = sqrt(min)/(2*s.getRadius());
}
}
} // end namespace MeshLib
/**
* \file RadiusEdgeRatioMetric.h
* \author Karsten Rink
* \date 2014-09-02
* \brief Definition of the RadiusEdgeRatioMetric class.
*
* \copyright
* Copyright (c) 2012-2014, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef RADIUSEDGERATIOMETRIC_H_
#define RADIUSEDGERATIOMETRIC_H_
#include "ElementQualityMetric.h"
namespace MeshLib
{
/**
* Calculates the quality of mesh elements based on the EquiAngleSkew measure
*/
class RadiusEdgeRatioMetric : public ElementQualityMetric
{
public:
RadiusEdgeRatioMetric(Mesh const& mesh);
virtual ~RadiusEdgeRatioMetric() {};
virtual void calculateQuality ();
};
}
#endif /* RADIUSEDGERATIOMETRIC_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment