Revision 734261b3ee2ff9a172b90739f1cf7e2ae9823c25 authored by rinkk on 11 February 2021, 14:52:44 UTC, committed by rinkk on 15 February 2021, 10:13:16 UTC
1 parent 8cacbd1
CellRule.cpp
/**
* \file
* \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 "CellRule.h"
#include "MeshLib/Node.h"
#include "Element.h"
#include "FaceRule.h"
namespace MeshLib {
bool CellRule::testElementNodeOrder(const Element* e)
{
Eigen::Vector3d const cc =
Eigen::Map<Eigen::Vector3d const>(getCenterOfGravity(*e).getCoords());
const unsigned nFaces(e->getNumberOfFaces());
for (unsigned j = 0; j < nFaces; ++j)
{
MeshLib::Element const* const face(e->getFace(j));
// Node 1 is checked below because that way all nodes are used for the test
// at some point, while for node 0 at least one node in every element
// type would be used for checking twice and one wouldn't be checked at
// all. (based on the definition of the _face_nodes variable)
auto const x =
Eigen::Map<Eigen::Vector3d const>(face->getNode(1)->getCoords());
Eigen::Vector3d const cx = x - cc;
const double s = FaceRule::getSurfaceNormal(face).dot(cx);
delete face;
if (s >= 0)
{
return false;
}
}
return true;
}
} // namespace MeshLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...