Commit 08655f27 authored by laurence's avatar laurence
Browse files

BUG: Incorrect point indexing in PatchTools::sortedEdgeFaces.

triSurface.sortedEdgeFaces() now calls PatchTools::sortedEdgeFaces
instead of using a copy of the same code
parent c7c7553e
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -68,10 +68,9 @@ Foam::PatchTools::sortedEdgeFaces
// Get opposite vertex for 0th face
const Face& f = localFaces[faceNbs[0]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
label vertI = (f[fp1] != e[1] ? f[fp1] : f[f.fcIndex(fp1)]);
// Get vector normal both to e2 and to edge from opposite vertex
// to edge (will be x-axis of our coordinate system)
......@@ -92,7 +91,7 @@ Foam::PatchTools::sortedEdgeFaces
const Face& f = localFaces[faceNbs[nbI]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
label vertI = (f[fp1] != e[1] ? f[fp1] : f[f.fcIndex(fp1)]);
vector vec = e2 ^ (localPoints[vertI] - edgePt);
vec /= mag(vec) + VSMALL;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -31,7 +31,7 @@ Description
#include "HashTable.H"
#include "SortableList.H"
#include "transform.H"
#include "PatchTools.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......@@ -46,79 +46,10 @@ void Foam::triSurface::calcSortedEdgeFaces() const
const labelListList& eFaces = edgeFaces();
// create the lists for the various results. (resized on completion)
sortedEdgeFacesPtr_ = new labelListList(eFaces.size());
labelListList& sortedEdgeFaces = *sortedEdgeFacesPtr_;
forAll(eFaces, edgeI)
{
const labelList& myFaceNbs = eFaces[edgeI];
if (myFaceNbs.size() > 2)
{
// Get point on edge and normalized direction of edge (= e2 base
// of our coordinate system)
const edge& e = edges()[edgeI];
const point& edgePt = localPoints()[e.start()];
vector e2 = e.vec(localPoints());
e2 /= mag(e2) + VSMALL;
// Get opposite vertex for 0th face
const labelledTri& f = localFaces()[myFaceNbs[0]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
// Get vector normal both to e2 and to edge from opposite vertex
// to edge (will be x-axis of our coordinate system)
vector e0 = e2 ^ (localPoints()[vertI] - edgePt);
e0 /= mag(e0) + VSMALL;
// Get y-axis of coordinate system
vector e1 = e2 ^ e0;
SortableList<scalar> faceAngles(myFaceNbs.size());
// e0 is reference so angle is 0
faceAngles[0] = 0;
for (label nbI = 1; nbI < myFaceNbs.size(); nbI++)
{
// Get opposite vertex
const labelledTri& f = localFaces()[myFaceNbs[nbI]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
vector vec = e2 ^ (localPoints()[vertI] - edgePt);
vec /= mag(vec) + VSMALL;
faceAngles[nbI] = pseudoAngle
(
e0,
e1,
vec
);
}
faceAngles.sort();
sortedEdgeFaces[edgeI] = UIndirectList<label>
(
myFaceNbs,
faceAngles.indices()
);
}
else
{
// No need to sort. Just copy.
sortedEdgeFaces[edgeI] = myFaceNbs;
}
}
sortedEdgeFaces = PatchTools::sortedEdgeFaces(*this);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment