ENH: distinguish between face areaNormal/unitNormal in the code

This commit is contained in:
Mark Olesen
2018-08-10 15:43:06 +02:00
parent b81a2f2fa6
commit c1964d7807
52 changed files with 200 additions and 256 deletions

View File

@ -188,19 +188,17 @@ label findInternalFace(const primitiveMesh& mesh, const labelList& meshF)
bool correctOrientation(const pointField& points, const cellShape& shape)
{
// Get centre of shape.
point cc(shape.centre(points));
const point cc(shape.centre(points));
// Get outwards pointing faces.
faceList faces(shape.faces());
forAll(faces, i)
for (const face& f : faces)
{
const face& f = faces[i];
vector n(f.normal(points));
const vector areaNorm(f.areaNormal(points));
// Check if vector from any point on face to cc points outwards
if (((points[f[0]] - cc) & n) < 0)
if (((points[f[0]] - cc) & areaNorm) < 0)
{
// Incorrectly oriented
return false;

View File

@ -225,9 +225,10 @@ int main(int argc, char *argv[])
// Determine orientation of tri v.s. cell centre.
point cc(cll.centre(points));
point fc(tri.centre(points));
vector fn(tri.normal(points));
if (((fc - cc) & fn) < 0)
const vector areaNorm(tri.areaNormal(points));
if (((fc - cc) & areaNorm) < 0)
{
// Boundary face points inwards. Flip.
boundaryFaces[facei].flip();