mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve edge access for face/triFace
- additional rcEdge(), rcEdges() methods for reverse order walk - accept generic edge() method as alternative to faceEdge() for single edge retrieval. - edge() method with points -> returns the vector - reduce the number of operations in edgeDirection methods DEFEATURE: remove longestEdge global function - deprecated and replaced by face::longestEdge() method (2017-04)
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,6 +33,8 @@ Description
|
|||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "labelledTri.H"
|
#include "labelledTri.H"
|
||||||
|
#include "faceList.H"
|
||||||
|
#include "triFaceList.H"
|
||||||
#include "pointList.H"
|
#include "pointList.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
@ -63,6 +65,35 @@ void testSign
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
void testEdges(const Face& f)
|
||||||
|
{
|
||||||
|
const label nEdges = f.nEdges();
|
||||||
|
Info<< "face: " << f << nl
|
||||||
|
<< "flip: " << f.reverseFace() << nl
|
||||||
|
<< " fc edges:" << flatOutput(f.edges()) << nl
|
||||||
|
<< " rc edges:" << flatOutput(f.rcEdges()) << nl;
|
||||||
|
|
||||||
|
Info<< " forward edges" << nl;
|
||||||
|
for (label edgei = 0; edgei < nEdges; ++edgei)
|
||||||
|
{
|
||||||
|
Info<< " " << edgei << " : " << f.edge(edgei) << nl;
|
||||||
|
}
|
||||||
|
Info<< " reverse edges" << nl;
|
||||||
|
for (label edgei = 0; edgei < nEdges; ++edgei)
|
||||||
|
{
|
||||||
|
Info<< " " << edgei << " : " << f.rcEdge(edgei) << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void testCompare(const triFace& a, const triFace& b)
|
||||||
|
{
|
||||||
|
Info<< "compare: " << a << " with " << b
|
||||||
|
<< " == " << triFace::compare(a, b) << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Main program:
|
// Main program:
|
||||||
|
|
||||||
@ -92,7 +123,7 @@ int main(int argc, char *argv[])
|
|||||||
{ 2, 2, 2}
|
{ 2, 2, 2}
|
||||||
});
|
});
|
||||||
|
|
||||||
face f1{ 1, 2, 3, 4 };
|
face f1({1, 2, 3, 4});
|
||||||
Info<< "face:"; faceInfo(f1, points1); Info << nl;
|
Info<< "face:"; faceInfo(f1, points1); Info << nl;
|
||||||
testSign(f1, points1, testPoints);
|
testSign(f1, points1, testPoints);
|
||||||
|
|
||||||
@ -100,7 +131,7 @@ int main(int argc, char *argv[])
|
|||||||
testSign(f1, points2, testPoints);
|
testSign(f1, points2, testPoints);
|
||||||
Info<< nl;
|
Info<< nl;
|
||||||
|
|
||||||
triFace t1{ 1, 2, 3 };
|
triFace t1({1, 2, 3});
|
||||||
Info<< "triFace:"; faceInfo(t1, points1); Info << nl;
|
Info<< "triFace:"; faceInfo(t1, points1); Info << nl;
|
||||||
testSign(t1, points1, testPoints);
|
testSign(t1, points1, testPoints);
|
||||||
|
|
||||||
@ -115,11 +146,12 @@ int main(int argc, char *argv[])
|
|||||||
f1 = t1.triFaceFace();
|
f1 = t1.triFaceFace();
|
||||||
Info<< "face:" << f1 << nl;
|
Info<< "face:" << f1 << nl;
|
||||||
|
|
||||||
// expect these to fail
|
#if 0
|
||||||
|
// Expect failure, but triggers abort which cannot be caught
|
||||||
const bool throwingError = FatalError.throwExceptions();
|
const bool throwingError = FatalError.throwExceptions();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
labelledTri l1{ 1, 2, 3, 10, 24 };
|
labelledTri l1({1, 2, 3, 10, 24});
|
||||||
Info<< "labelled:" << l1 << nl;
|
Info<< "labelled:" << l1 << nl;
|
||||||
}
|
}
|
||||||
catch (const Foam::error& err)
|
catch (const Foam::error& err)
|
||||||
@ -128,11 +160,12 @@ int main(int argc, char *argv[])
|
|||||||
<< "Caught FatalError " << err << nl << endl;
|
<< "Caught FatalError " << err << nl << endl;
|
||||||
}
|
}
|
||||||
FatalError.throwExceptions(throwingError);
|
FatalError.throwExceptions(throwingError);
|
||||||
|
#endif
|
||||||
|
|
||||||
labelledTri l2{ 1, 2, 3 };
|
labelledTri l2({1, 2, 3});
|
||||||
Info<< "labelled:" << l2 << nl;
|
Info<< "labelled:" << l2 << nl;
|
||||||
|
|
||||||
labelledTri l3{ 1, 2, 3, 10 };
|
labelledTri l3({1, 2, 3, 10});
|
||||||
Info<< "labelled:" << l3 << nl;
|
Info<< "labelled:" << l3 << nl;
|
||||||
|
|
||||||
t1.flip();
|
t1.flip();
|
||||||
@ -141,6 +174,62 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "flip:" << t1 << nl;
|
Info<< "flip:" << t1 << nl;
|
||||||
Info<< "flip:" << l3 << nl;
|
Info<< "flip:" << l3 << nl;
|
||||||
|
|
||||||
|
{
|
||||||
|
triFaceList faceList1
|
||||||
|
({
|
||||||
|
triFace{1, 2, 3},
|
||||||
|
triFace{4, 2, 100},
|
||||||
|
triFace{1, 3, 2},
|
||||||
|
});
|
||||||
|
|
||||||
|
Info<< nl << "Test edges" << nl;
|
||||||
|
|
||||||
|
for (const auto& f : faceList1)
|
||||||
|
{
|
||||||
|
testEdges(f);
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
faceList faceList1
|
||||||
|
({
|
||||||
|
face{1, 2, 3, 4},
|
||||||
|
face{1, 4, 3, 2},
|
||||||
|
face{4, 2, 100, 8, 35},
|
||||||
|
});
|
||||||
|
|
||||||
|
Info<< nl << "Test edges" << nl;
|
||||||
|
|
||||||
|
for (const auto& f : faceList1)
|
||||||
|
{
|
||||||
|
testEdges(f);
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
triFaceList faceList1
|
||||||
|
({
|
||||||
|
triFace{1, 2, 3},
|
||||||
|
triFace{1, 3, 2},
|
||||||
|
triFace{3, 1, 2},
|
||||||
|
triFace{4, 5, 1},
|
||||||
|
});
|
||||||
|
|
||||||
|
Info<< nl << "Test triFace compare" << nl;
|
||||||
|
for (const triFace& a : faceList1)
|
||||||
|
{
|
||||||
|
for (const triFace& b : faceList1)
|
||||||
|
{
|
||||||
|
testCompare(a, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ License
|
|||||||
#include "triPointRef.H"
|
#include "triPointRef.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "ConstCirculator.H"
|
#include "ConstCirculator.H"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -40,25 +41,18 @@ const char* const Foam::face::typeName = "face";
|
|||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField>
|
Foam::tmp<Foam::vectorField>
|
||||||
Foam::face::calcEdges(const UList<point>& points) const
|
Foam::face::calcEdgeVectors(const UList<point>& points) const
|
||||||
{
|
{
|
||||||
tmp<vectorField> tedges(new vectorField(size()));
|
auto tedgeVecs = tmp<vectorField>::New(size());
|
||||||
vectorField& edges = tedges.ref();
|
auto& edgeVecs = tedgeVecs.ref();
|
||||||
|
|
||||||
forAll(*this, i)
|
forAll(*this, i)
|
||||||
{
|
{
|
||||||
label ni = fcIndex(i);
|
edgeVecs[i] = vector(points[nextLabel(i)] - points[thisLabel(i)]);
|
||||||
|
edgeVecs[i].normalise();
|
||||||
point thisPt = points[operator[](i)];
|
|
||||||
point nextPt = points[operator[](ni)];
|
|
||||||
|
|
||||||
vector vec(nextPt - thisPt);
|
|
||||||
vec /= Foam::mag(vec) + VSMALL;
|
|
||||||
|
|
||||||
edges[i] = vec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tedges;
|
return tedgeVecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,11 +62,11 @@ Foam::scalar Foam::face::edgeCos
|
|||||||
const label index
|
const label index
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label leftEdgeI = left(index);
|
const vector& leftEdge = edges[rcIndex(index)];
|
||||||
label rightEdgeI = right(index);
|
const vector& rightEdge = edges[index];
|
||||||
|
|
||||||
// Note negate on left edge to get correct left-pointing edge.
|
// Note negate on left edge to get correct left-pointing edge.
|
||||||
return -(edges[leftEdgeI] & edges[rightEdgeI]);
|
return -(leftEdge & rightEdge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -90,12 +84,12 @@ Foam::label Foam::face::mostConcaveAngle
|
|||||||
|
|
||||||
forAll(edges, i)
|
forAll(edges, i)
|
||||||
{
|
{
|
||||||
label leftEdgeI = left(i);
|
const vector& leftEdge = edges[rcIndex(i)];
|
||||||
label rightEdgeI = right(i);
|
const vector& rightEdge = edges[i];
|
||||||
|
|
||||||
vector edgeNormal = edges[rightEdgeI] ^ edges[leftEdgeI];
|
vector edgeNormal = (rightEdge ^ leftEdge);
|
||||||
|
|
||||||
scalar edgeCos = edges[leftEdgeI] & edges[rightEdgeI];
|
scalar edgeCos = (leftEdge & rightEdge);
|
||||||
scalar edgeAngle = acos(max(-1.0, min(1.0, edgeCos)));
|
scalar edgeAngle = acos(max(-1.0, min(1.0, edgeCos)));
|
||||||
|
|
||||||
scalar angle;
|
scalar angle;
|
||||||
@ -133,15 +127,15 @@ Foam::label Foam::face::split
|
|||||||
faceList& quadFaces
|
faceList& quadFaces
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label oldIndices = (triI + quadI);
|
const label oldIndices = (triI + quadI);
|
||||||
|
|
||||||
if (size() <= 2)
|
if (size() < 3)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Serious problem: asked to split a face with < 3 vertices"
|
<< "Serious problem: asked to split a face with < 3 vertices"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
if (size() == 3)
|
else if (size() == 3)
|
||||||
{
|
{
|
||||||
// Triangle. Just copy.
|
// Triangle. Just copy.
|
||||||
if (mode == COUNTTRIANGLE || mode == COUNTQUAD)
|
if (mode == COUNTTRIANGLE || mode == COUNTQUAD)
|
||||||
@ -166,7 +160,7 @@ Foam::label Foam::face::split
|
|||||||
else if (mode == SPLITTRIANGLE)
|
else if (mode == SPLITTRIANGLE)
|
||||||
{
|
{
|
||||||
// Start at point with largest internal angle.
|
// Start at point with largest internal angle.
|
||||||
const vectorField edges(calcEdges(points));
|
const vectorField edges(calcEdgeVectors(points));
|
||||||
|
|
||||||
scalar minAngle;
|
scalar minAngle;
|
||||||
label startIndex = mostConcaveAngle(points, edges, minAngle);
|
label startIndex = mostConcaveAngle(points, edges, minAngle);
|
||||||
@ -197,13 +191,13 @@ Foam::label Foam::face::split
|
|||||||
{
|
{
|
||||||
// General case. Like quad: search for largest internal angle.
|
// General case. Like quad: search for largest internal angle.
|
||||||
|
|
||||||
const vectorField edges(calcEdges(points));
|
const vectorField edges(calcEdgeVectors(points));
|
||||||
|
|
||||||
scalar minAngle = 1;
|
scalar minAngle = 1;
|
||||||
label startIndex = mostConcaveAngle(points, edges, minAngle);
|
label startIndex = mostConcaveAngle(points, edges, minAngle);
|
||||||
|
|
||||||
scalar bisectAngle = minAngle/2;
|
scalar bisectAngle = minAngle/2;
|
||||||
vector rightEdge = edges[right(startIndex)];
|
const vector& rightEdge = edges[startIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Look for opposite point which as close as possible bisects angle
|
// Look for opposite point which as close as possible bisects angle
|
||||||
@ -222,7 +216,7 @@ Foam::label Foam::face::split
|
|||||||
points[operator[](index)]
|
points[operator[](index)]
|
||||||
- points[operator[](startIndex)]
|
- points[operator[](startIndex)]
|
||||||
);
|
);
|
||||||
splitEdge /= Foam::mag(splitEdge) + VSMALL;
|
splitEdge.normalise();
|
||||||
|
|
||||||
const scalar splitCos = splitEdge & rightEdge;
|
const scalar splitCos = splitEdge & rightEdge;
|
||||||
const scalar splitAngle = acos(max(-1.0, min(1.0, splitCos)));
|
const scalar splitAngle = acos(max(-1.0, min(1.0, splitCos)));
|
||||||
@ -786,62 +780,57 @@ Foam::tensor Foam::face::inertia
|
|||||||
|
|
||||||
Foam::edgeList Foam::face::edges() const
|
Foam::edgeList Foam::face::edges() const
|
||||||
{
|
{
|
||||||
const labelList& points = *this;
|
const labelList& verts = *this;
|
||||||
|
const label nVerts = verts.size();
|
||||||
|
|
||||||
edgeList e(points.size());
|
edgeList theEdges(nVerts);
|
||||||
|
|
||||||
for (label pointi = 0; pointi < points.size() - 1; ++pointi)
|
// Last edge closes the polygon
|
||||||
|
theEdges.last().first() = verts.last();
|
||||||
|
theEdges.last().second() = verts[0];
|
||||||
|
|
||||||
|
for (label verti = 0; verti < nVerts - 1; ++verti)
|
||||||
{
|
{
|
||||||
e[pointi] = edge(points[pointi], points[pointi + 1]);
|
theEdges[verti].first() = verts[verti];
|
||||||
|
theEdges[verti].second() = verts[verti + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add last edge
|
return theEdges;
|
||||||
e.last() = edge(points.last(), points[0]);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Foam::face::edgeDirection(const edge& e) const
|
Foam::edgeList Foam::face::rcEdges() const
|
||||||
{
|
{
|
||||||
forAll(*this, i)
|
const labelList& verts = *this;
|
||||||
|
const label nVerts = verts.size();
|
||||||
|
|
||||||
|
edgeList theEdges(nVerts);
|
||||||
|
|
||||||
|
// First edge closes the polygon
|
||||||
|
theEdges.first().first() = verts[0];
|
||||||
|
theEdges.first().second() = verts.last();
|
||||||
|
|
||||||
|
for (label verti = 1; verti < nVerts; ++verti)
|
||||||
{
|
{
|
||||||
if (operator[](i) == e.first())
|
theEdges[verti].first() = verts[nVerts - verti];
|
||||||
{
|
theEdges[verti].second() = verts[nVerts - verti - 1];
|
||||||
if (operator[](rcIndex(i)) == e.second())
|
|
||||||
{
|
|
||||||
// Reverse direction
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (operator[](fcIndex(i)) == e.second())
|
|
||||||
{
|
|
||||||
// Forward direction
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No match
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if (operator[](i) == e.second())
|
|
||||||
{
|
|
||||||
if (operator[](rcIndex(i)) == e.first())
|
|
||||||
{
|
|
||||||
// Forward direction
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (operator[](fcIndex(i)) == e.first())
|
|
||||||
{
|
|
||||||
// Reverse direction
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No match
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not found
|
return theEdges;
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Foam::face::edgeDirection(const Foam::edge& e) const
|
||||||
|
{
|
||||||
|
const label idx = find(e.first());
|
||||||
|
|
||||||
|
if (idx != -1)
|
||||||
|
{
|
||||||
|
if (e.second() == nextLabel(idx)) return 1; // Forward
|
||||||
|
if (e.second() == prevLabel(idx)) return -1; // Reverse
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; // Not found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -894,29 +883,26 @@ Foam::label Foam::face::trianglesQuads
|
|||||||
|
|
||||||
Foam::label Foam::face::longestEdge(const UList<point>& pts) const
|
Foam::label Foam::face::longestEdge(const UList<point>& pts) const
|
||||||
{
|
{
|
||||||
const edgeList& eds = this->edges();
|
const labelList& verts = *this;
|
||||||
|
const label nVerts = verts.size();
|
||||||
|
|
||||||
label longestEdgeI = -1;
|
// Last edge closes the polygon. Use it to initialize loop
|
||||||
scalar longestEdgeLength = -SMALL;
|
label longest = nVerts - 1;
|
||||||
|
scalar longestLen = Foam::edge(verts.first(), verts.last()).mag(pts);
|
||||||
|
|
||||||
forAll(eds, edI)
|
// Examine other edges
|
||||||
|
for (label edgei = 0; edgei < nVerts - 1; ++edgei)
|
||||||
{
|
{
|
||||||
scalar edgeLength = eds[edI].mag(pts);
|
scalar edgeLen = Foam::edge(verts[edgei], verts[edgei + 1]).mag(pts);
|
||||||
|
|
||||||
if (edgeLength > longestEdgeLength)
|
if (longestLen < edgeLen)
|
||||||
{
|
{
|
||||||
longestEdgeI = edI;
|
longest = edgei;
|
||||||
longestEdgeLength = edgeLength;
|
longestLen = edgeLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return longestEdgeI;
|
return longest;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::longestEdge(const face& f, const UList<point>& pts)
|
|
||||||
{
|
|
||||||
return f.longestEdge(pts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,14 +76,8 @@ class face
|
|||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Edge to the right of face vertex i
|
|
||||||
inline label right(const label i) const;
|
|
||||||
|
|
||||||
//- Edge to the left of face vertex i
|
|
||||||
inline label left(const label i) const;
|
|
||||||
|
|
||||||
//- Construct list of edge vectors for face
|
//- Construct list of edge vectors for face
|
||||||
tmp<vectorField> calcEdges
|
tmp<vectorField> calcEdgeVectors
|
||||||
(
|
(
|
||||||
const UList<point>& points
|
const UList<point>& points
|
||||||
) const;
|
) const;
|
||||||
@ -190,7 +184,7 @@ public:
|
|||||||
void flip();
|
void flip();
|
||||||
|
|
||||||
//- Return the points corresponding to this face
|
//- Return the points corresponding to this face
|
||||||
inline pointField points(const UList<point>& points) const;
|
inline pointField points(const UList<point>& pts) const;
|
||||||
|
|
||||||
//- Centre point of face
|
//- Centre point of face
|
||||||
point centre(const UList<point>& points) const;
|
point centre(const UList<point>& points) const;
|
||||||
@ -227,13 +221,14 @@ public:
|
|||||||
|
|
||||||
// Navigation through face vertices
|
// Navigation through face vertices
|
||||||
|
|
||||||
//- Return true if the point label is found in face.
|
//- Find local index on face for the point label, same as find()
|
||||||
inline bool found(const label pointLabel) const;
|
|
||||||
|
|
||||||
//- Find local index on face for the point label,
|
|
||||||
// \return position in face (0,1,2,...) or -1 if not found.
|
// \return position in face (0,1,2,...) or -1 if not found.
|
||||||
inline label which(const label pointLabel) const;
|
inline label which(const label pointLabel) const;
|
||||||
|
|
||||||
|
//- The vertex on face - identical to operator[], but with naming
|
||||||
|
//- similar to nextLabel(), prevLabel()
|
||||||
|
inline label thisLabel(const label i) const;
|
||||||
|
|
||||||
//- Next vertex on face
|
//- Next vertex on face
|
||||||
inline label nextLabel(const label i) const;
|
inline label nextLabel(const label i) const;
|
||||||
|
|
||||||
@ -342,25 +337,45 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return number of edges
|
//- Return number of edges
|
||||||
inline label nEdges() const;
|
inline label nEdges() const noexcept;
|
||||||
|
|
||||||
//- Return edges in face point ordering,
|
//- Return i-th face edge in forward walk order.
|
||||||
|
//- The faceEdge(0) is the edge between [0] and [1]
|
||||||
|
inline Foam::edge faceEdge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return i-th face edge in forward walk order.
|
||||||
|
//- Identical to faceEdge() but with generic name
|
||||||
|
inline Foam::edge edge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return vector of i-th face edge in forward walk order.
|
||||||
|
inline vector edge(const label edgei, const UList<point>& pts) const;
|
||||||
|
|
||||||
|
//- Return i-th face edge in reverse walk order.
|
||||||
|
//- The rcEdge(0) is the edge between [0] and [n-1]
|
||||||
|
inline Foam::edge rcEdge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return vector of i-th face edge in reverse walk order.
|
||||||
|
inline vector rcEdge(const label edgei, const UList<point>& pts) const;
|
||||||
|
|
||||||
|
//- Return list of edges in forward walk order.
|
||||||
// i.e. edges()[0] is edge between [0] and [1]
|
// i.e. edges()[0] is edge between [0] and [1]
|
||||||
edgeList edges() const;
|
edgeList edges() const;
|
||||||
|
|
||||||
//- Return n-th face edge
|
//- Return list of edges in reverse walk order.
|
||||||
inline edge faceEdge(const label n) const;
|
// i.e. rcEdges()[0] is edge between [0] and [n-1]
|
||||||
|
edgeList rcEdges() const;
|
||||||
|
|
||||||
//- The edge direction on the face
|
//- Test the edge direction on the face
|
||||||
// \return
|
// \return
|
||||||
// - 0: edge not found on the face
|
// - 0: edge not found on the face
|
||||||
// - +1: forward (counter-clockwise) on the face
|
// - +1: forward (counter-clockwise) on the face
|
||||||
// - -1: reverse (clockwise) on the face
|
// - -1: reverse (clockwise) on the face
|
||||||
int edgeDirection(const edge& e) const;
|
int edgeDirection(const Foam::edge& e) const;
|
||||||
|
|
||||||
//- Find the longest edge on a face.
|
//- Find the longest edge on a face.
|
||||||
label longestEdge(const UList<point>& pts) const;
|
label longestEdge(const UList<point>& pts) const;
|
||||||
|
|
||||||
|
|
||||||
// Face splitting utilities
|
// Face splitting utilities
|
||||||
|
|
||||||
//- Number of triangles after splitting
|
//- Number of triangles after splitting
|
||||||
@ -493,13 +508,6 @@ struct offsetOp<face>
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Deprecated(2017-04) find the longest edge on a face.
|
|
||||||
//- Face point labels index into pts.
|
|
||||||
// \deprecated(2017-04) use class method instead
|
|
||||||
FOAM_DEPRECATED_FOR(2017-04, "use face::longestEdge() method")
|
|
||||||
label longestEdge(const face& f, const UList<point>& pts);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool operator==(const face& a, const face& b);
|
inline bool operator==(const face& a, const face& b);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,20 +26,6 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
inline Foam::label Foam::face::right(const label i) const
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::face::left(const label i) const
|
|
||||||
{
|
|
||||||
return rcIndex(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::face::face(const label sz)
|
inline Foam::face::face(const label sz)
|
||||||
@ -98,23 +84,19 @@ inline Foam::face::face(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::pointField Foam::face::points
|
inline Foam::pointField Foam::face::points(const UList<point>& pts) const
|
||||||
(
|
|
||||||
const UList<point>& meshPoints
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
// There are as many points as there are labels for them
|
// There are as many points as there are labels for them
|
||||||
pointField p(size());
|
pointField p(size());
|
||||||
|
|
||||||
// For each point in list, set it to the point in 'pnts' addressed
|
auto iter = p.begin();
|
||||||
// by 'labs'
|
|
||||||
label i = 0;
|
|
||||||
for (const label pointi : *this)
|
for (const label pointi : *this)
|
||||||
{
|
{
|
||||||
p[i++] = meshPoints[pointi];
|
*iter = pts[pointi];
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return list
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,22 +115,54 @@ inline Foam::scalar Foam::face::mag(const UList<point>& p) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::face::nEdges() const
|
inline Foam::label Foam::face::nEdges() const noexcept
|
||||||
{
|
{
|
||||||
// for a closed polygon a number of edges is the same as number of points
|
// for a closed polygon a number of edges is the same as number of points
|
||||||
return size();
|
return size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::edge Foam::face::faceEdge(const label n) const
|
inline Foam::edge Foam::face::faceEdge(const label edgei) const
|
||||||
{
|
{
|
||||||
return edge(operator[](n), operator[](fcIndex(n)));
|
return Foam::edge(thisLabel(edgei), nextLabel(edgei));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::face::found(const label pointLabel) const
|
inline Foam::edge Foam::face::edge(const label edgei) const
|
||||||
{
|
{
|
||||||
return labelList::found(pointLabel);
|
return faceEdge(edgei);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::face::edge
|
||||||
|
(
|
||||||
|
const label edgei,
|
||||||
|
const UList<point>& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return vector(pts[nextLabel(edgei)] - pts[thisLabel(edgei)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::face::rcEdge(const label edgei) const
|
||||||
|
{
|
||||||
|
// Edge 0 (forward and reverse) always starts at [0]
|
||||||
|
// for consistency with face flipping
|
||||||
|
const label pointi = edgei ? (nEdges() - edgei) : 0;
|
||||||
|
return Foam::edge(thisLabel(pointi), prevLabel(pointi));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::face::rcEdge
|
||||||
|
(
|
||||||
|
const label edgei,
|
||||||
|
const UList<point>& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Edge 0 (forward and reverse) always starts at [0]
|
||||||
|
// for consistency with face flipping
|
||||||
|
const label pointi = edgei ? (3 - edgei) : 0;
|
||||||
|
return vector(pts[prevLabel(pointi)] - pts[thisLabel(pointi)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,6 +172,12 @@ inline Foam::label Foam::face::which(const label pointLabel) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::face::thisLabel(const label i) const
|
||||||
|
{
|
||||||
|
return labelList::operator[](i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::face::nextLabel(const label i) const
|
inline Foam::label Foam::face::nextLabel(const label i) const
|
||||||
{
|
{
|
||||||
return labelList::fcValue(i);
|
return labelList::fcValue(i);
|
||||||
|
|||||||
@ -116,7 +116,7 @@ public:
|
|||||||
inline void flip();
|
inline void flip();
|
||||||
|
|
||||||
//- Return the points corresponding to this face
|
//- Return the points corresponding to this face
|
||||||
inline pointField points(const UList<point>& points) const;
|
inline pointField points(const UList<point>& pts) const;
|
||||||
|
|
||||||
//- Return triangle as a face
|
//- Return triangle as a face
|
||||||
inline face triFaceFace() const;
|
inline face triFaceFace() const;
|
||||||
@ -148,20 +148,27 @@ public:
|
|||||||
//- Magnitude of face area
|
//- Magnitude of face area
|
||||||
inline scalar mag(const UList<point>& points) const;
|
inline scalar mag(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Number of triangles after splitting
|
//- Number of triangles after splitting == 1
|
||||||
inline label nTriangles() const;
|
inline label nTriangles() const noexcept;
|
||||||
|
|
||||||
//- Return face with reverse direction
|
//- Return face with reverse direction
|
||||||
// The starting points of the original and reverse face are identical.
|
// The starting points of the original and reverse face are identical.
|
||||||
inline triFace reverseFace() const;
|
inline triFace reverseFace() const;
|
||||||
|
|
||||||
//- Return true if the point label is found in face.
|
//- Find local index on face for the point label, same as find()
|
||||||
inline bool found(const label pointLabel) const;
|
|
||||||
|
|
||||||
//- Find local index on face for the point label.
|
|
||||||
// \return position in face (0,1,2) or -1 if not found.
|
// \return position in face (0,1,2) or -1 if not found.
|
||||||
inline label which(const label pointLabel) const;
|
inline label which(const label pointLabel) const;
|
||||||
|
|
||||||
|
//- Next vertex on face
|
||||||
|
inline label nextLabel(const label i) const;
|
||||||
|
|
||||||
|
//- Previous vertex on face
|
||||||
|
inline label prevLabel(const label i) const;
|
||||||
|
|
||||||
|
//- The vertex on face - identical to operator[], but with naming
|
||||||
|
//- similar to nextLabel(), prevLabel()
|
||||||
|
inline label thisLabel(const label i) const;
|
||||||
|
|
||||||
//- Return swept-volume from old-points to new-points
|
//- Return swept-volume from old-points to new-points
|
||||||
inline scalar sweptVol
|
inline scalar sweptVol
|
||||||
(
|
(
|
||||||
@ -243,22 +250,41 @@ public:
|
|||||||
const scalar tol = SMALL
|
const scalar tol = SMALL
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return number of edges
|
//- Return number of edges == 3
|
||||||
inline label nEdges() const;
|
inline label nEdges() const noexcept;
|
||||||
|
|
||||||
//- Return edges in face point ordering,
|
//- Return i-th face edge in forward walk order.
|
||||||
|
//- The faceEdge(0) is the edge between [0] and [1]
|
||||||
|
inline Foam::edge faceEdge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return i-th face edge in forward walk order.
|
||||||
|
//- Identical to faceEdge() but with generic name
|
||||||
|
inline Foam::edge edge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return vector of i-th face edge in forward walk order.
|
||||||
|
inline vector edge(const label edgei, const UList<point>& pts) const;
|
||||||
|
|
||||||
|
//- Return i-th face edge in reverse walk order.
|
||||||
|
//- The rcEdge(0) is the edge between [0] to [n-1]
|
||||||
|
inline Foam::edge rcEdge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return vector of i-th face edge in reverse walk order.
|
||||||
|
inline vector rcEdge(const label edgei, const UList<point>& pts) const;
|
||||||
|
|
||||||
|
//- Return list of edges in forward walk order.
|
||||||
// i.e. edges()[0] is edge between [0] and [1]
|
// i.e. edges()[0] is edge between [0] and [1]
|
||||||
inline edgeList edges() const;
|
inline edgeList edges() const;
|
||||||
|
|
||||||
//- Return n-th face edge
|
//- Return list of edges in reverse walk order.
|
||||||
inline edge faceEdge(const label n) const;
|
// i.e. rcEdges()[0] is edge between [0] to [n-1]
|
||||||
|
inline edgeList rcEdges() const;
|
||||||
|
|
||||||
//- Return the edge direction on the face
|
//- Test the edge direction on the face
|
||||||
// \return
|
// \return
|
||||||
// - +1: forward (counter-clockwise) on the face
|
// - +1: forward (counter-clockwise) on the face
|
||||||
// - -1: reverse (clockwise) on the face
|
// - -1: reverse (clockwise) on the face
|
||||||
// - 0: edge not found on the face
|
// - 0: edge not found on the face
|
||||||
inline int edgeDirection(const edge& e) const;
|
inline int edgeDirection(const Foam::edge& e) const;
|
||||||
|
|
||||||
//- Compare triFaces
|
//- Compare triFaces
|
||||||
// \return:
|
// \return:
|
||||||
|
|||||||
@ -29,7 +29,7 @@ License
|
|||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "triPointRef.H"
|
#include "triPointRef.H"
|
||||||
#include "Swap.H"
|
#include <algorithm> // For std::swap
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -144,13 +144,13 @@ inline void Foam::triFace::flip()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::pointField Foam::triFace::points(const UList<point>& points) const
|
inline Foam::pointField Foam::triFace::points(const UList<point>& pts) const
|
||||||
{
|
{
|
||||||
pointField p(3);
|
pointField p(3);
|
||||||
|
|
||||||
p[0] = points[operator[](0)];
|
p[0] = pts[operator[](0)];
|
||||||
p[1] = points[operator[](1)];
|
p[1] = pts[operator[](1)];
|
||||||
p[2] = points[operator[](2)];
|
p[2] = pts[operator[](2)];
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ inline Foam::scalar Foam::triFace::mag(const UList<point>& points) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::triFace::nTriangles() const
|
inline Foam::label Foam::triFace::nTriangles() const noexcept
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -222,18 +222,30 @@ inline Foam::triFace Foam::triFace::reverseFace() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::triFace::found(const label pointLabel) const
|
|
||||||
{
|
|
||||||
return FixedList<label, 3>::found(pointLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::triFace::which(const label pointLabel) const
|
inline Foam::label Foam::triFace::which(const label pointLabel) const
|
||||||
{
|
{
|
||||||
return FixedList<label, 3>::find(pointLabel);
|
return FixedList<label, 3>::find(pointLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::triFace::thisLabel(const label i) const
|
||||||
|
{
|
||||||
|
return operator[](i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::triFace::nextLabel(const label i) const
|
||||||
|
{
|
||||||
|
return operator[]((i == 2 ? 0 : i+1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::triFace::prevLabel(const label i) const
|
||||||
|
{
|
||||||
|
return operator[]((i ? i-1 : 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::scalar Foam::triFace::sweptVol
|
inline Foam::scalar Foam::triFace::sweptVol
|
||||||
(
|
(
|
||||||
const UList<point>& opts,
|
const UList<point>& opts,
|
||||||
@ -353,61 +365,109 @@ inline int Foam::triFace::sign
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::triFace::nEdges() const
|
inline Foam::label Foam::triFace::nEdges() const noexcept
|
||||||
{
|
{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::triFace::faceEdge(const label edgei) const
|
||||||
|
{
|
||||||
|
return Foam::edge(thisLabel(edgei), nextLabel(edgei));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::triFace::edge(const label edgei) const
|
||||||
|
{
|
||||||
|
return faceEdge(edgei);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::triFace::edge
|
||||||
|
(
|
||||||
|
const label edgei,
|
||||||
|
const UList<point>& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return vector(pts[nextLabel(edgei)] - pts[thisLabel(edgei)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::triFace::rcEdge(const label edgei) const
|
||||||
|
{
|
||||||
|
// Edge 0 (forward and reverse) always starts at [0]
|
||||||
|
// for consistency with face flipping
|
||||||
|
const label pointi = edgei ? (3 - edgei) : 0;
|
||||||
|
return Foam::edge(thisLabel(pointi), prevLabel(pointi));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::triFace::rcEdge
|
||||||
|
(
|
||||||
|
const label edgei,
|
||||||
|
const UList<point>& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Edge 0 (forward and reverse) always starts at [0]
|
||||||
|
// for consistency with face flipping
|
||||||
|
const label pointi = edgei ? (3 - edgei) : 0;
|
||||||
|
return vector(pts[prevLabel(pointi)] - pts[thisLabel(pointi)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::edgeList Foam::triFace::edges() const
|
inline Foam::edgeList Foam::triFace::edges() const
|
||||||
{
|
{
|
||||||
edgeList e(3);
|
edgeList theEdges(3);
|
||||||
|
|
||||||
e[0].first() = operator[](0);
|
theEdges[0].first() = operator[](0);
|
||||||
e[0].second() = operator[](1);
|
theEdges[0].second() = operator[](1);
|
||||||
|
|
||||||
e[1].first() = operator[](1);
|
theEdges[1].first() = operator[](1);
|
||||||
e[1].second() = operator[](2);
|
theEdges[1].second() = operator[](2);
|
||||||
|
|
||||||
e[2].first() = operator[](2);
|
theEdges[2].first() = operator[](2);
|
||||||
e[2].second() = operator[](0);
|
theEdges[2].second() = operator[](0);
|
||||||
|
|
||||||
return e;
|
return theEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::edge Foam::triFace::faceEdge(const label n) const
|
inline Foam::edgeList Foam::triFace::rcEdges() const
|
||||||
{
|
{
|
||||||
return edge(operator[](n), operator[](fcIndex(n)));
|
edgeList theEdges(3);
|
||||||
|
|
||||||
|
theEdges[0].first() = operator[](0);
|
||||||
|
theEdges[0].second() = operator[](2);
|
||||||
|
|
||||||
|
theEdges[1].first() = operator[](2);
|
||||||
|
theEdges[1].second() = operator[](1);
|
||||||
|
|
||||||
|
theEdges[2].first() = operator[](1);
|
||||||
|
theEdges[2].second() = operator[](0);
|
||||||
|
|
||||||
|
return theEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// return
|
inline int Foam::triFace::edgeDirection(const Foam::edge& e) const
|
||||||
// - +1: forward (counter-clockwise) on the face
|
|
||||||
// - -1: reverse (clockwise) on the face
|
|
||||||
// - 0: edge not found on the face
|
|
||||||
inline int Foam::triFace::edgeDirection(const edge& e) const
|
|
||||||
{
|
{
|
||||||
if
|
if (e.first() == operator[](0))
|
||||||
(
|
|
||||||
(operator[](0) == e.first() && operator[](1) == e.second())
|
|
||||||
|| (operator[](1) == e.first() && operator[](2) == e.second())
|
|
||||||
|| (operator[](2) == e.first() && operator[](0) == e.second())
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return 1;
|
if (e.second() == operator[](1)) return 1; // Forward
|
||||||
|
if (e.second() == operator[](2)) return -1; // Reverse
|
||||||
}
|
}
|
||||||
else if
|
if (e.first() == operator[](1))
|
||||||
(
|
|
||||||
(operator[](0) == e.second() && operator[](1) == e.first())
|
|
||||||
|| (operator[](1) == e.second() && operator[](2) == e.first())
|
|
||||||
|| (operator[](2) == e.second() && operator[](0) == e.first())
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return -1;
|
if (e.second() == operator[](2)) return 1; // Forward
|
||||||
|
if (e.second() == operator[](0)) return -1; // Reverse
|
||||||
|
}
|
||||||
|
if (e.first() == operator[](2))
|
||||||
|
{
|
||||||
|
if (e.second() == operator[](0)) return 1; // Forward
|
||||||
|
if (e.second() == operator[](1)) return -1; // Reverse
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0; // Not found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -81,9 +81,9 @@ Foam::label Foam::checkFireEdges
|
|||||||
{
|
{
|
||||||
const face& faceA = faces[faceI];
|
const face& faceA = faces[faceI];
|
||||||
|
|
||||||
forAll(faceA, edgeI)
|
forAll(faceA, edgei)
|
||||||
{
|
{
|
||||||
const edge currEdge = faceA.faceEdge(edgeI);
|
const edge currEdge = faceA.edge(edgei);
|
||||||
|
|
||||||
// all faces attached to the first point
|
// all faces attached to the first point
|
||||||
const labelList& otherFaceIds = pointFaces[currEdge[0]];
|
const labelList& otherFaceIds = pointFaces[currEdge[0]];
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,7 +37,7 @@ License
|
|||||||
#include "motionSmoother.H"
|
#include "motionSmoother.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -45,6 +45,8 @@ defineTypeNameAndDebug(edgeCollapser, 0);
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::labelHashSet Foam::edgeCollapser::checkBadFaces
|
Foam::labelHashSet Foam::edgeCollapser::checkBadFaces
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -415,7 +417,7 @@ void Foam::edgeCollapser::faceCollapseAxisAndAspectRatio
|
|||||||
{
|
{
|
||||||
// It is possible that all the points of a face are the same
|
// It is possible that all the points of a face are the same
|
||||||
|
|
||||||
collapseAxis = f.edges()[f.longestEdge(pts)].unitVec(pts);
|
collapseAxis = f.edge(f.longestEdge(pts)).unitVec(pts);
|
||||||
|
|
||||||
// Empirical correlation for high aspect ratio faces
|
// Empirical correlation for high aspect ratio faces
|
||||||
|
|
||||||
@ -432,7 +434,7 @@ void Foam::edgeCollapser::faceCollapseAxisAndAspectRatio
|
|||||||
// Cannot necessarily determine linearly independent
|
// Cannot necessarily determine linearly independent
|
||||||
// eigenvectors, or any at all, use longest edge direction.
|
// eigenvectors, or any at all, use longest edge direction.
|
||||||
|
|
||||||
collapseAxis = f.edges()[f.longestEdge(pts)].unitVec(pts);
|
collapseAxis = f.edge(f.longestEdge(pts)).unitVec(pts);
|
||||||
|
|
||||||
aspectRatio = 1.0;
|
aspectRatio = 1.0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -122,9 +123,9 @@ Foam::tmp<Foam::scalarField> Foam::levelSetFraction
|
|||||||
vector a(Zero);
|
vector a(Zero);
|
||||||
vector r(Zero);
|
vector r(Zero);
|
||||||
|
|
||||||
for (label eI = 0; eI < f.size(); ++eI)
|
for (label edgei = 0; edgei < f.nEdges(); ++edgei)
|
||||||
{
|
{
|
||||||
const edge e = f.faceEdge(eI);
|
const edge e = f.edge(edgei);
|
||||||
|
|
||||||
const FixedList<point, 3>
|
const FixedList<point, 3>
|
||||||
tri =
|
tri =
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -141,9 +142,9 @@ Foam::tmp<Foam::Field<Type>> Foam::levelSetAverage
|
|||||||
vector a(Zero);
|
vector a(Zero);
|
||||||
sumType r = Zero;
|
sumType r = Zero;
|
||||||
|
|
||||||
for (label eI = 0; eI < f.size(); ++eI)
|
for (label edgei = 0; edgei < f.nEdges(); ++edgei)
|
||||||
{
|
{
|
||||||
const edge e = f.faceEdge(eI);
|
const edge e = f.edge(edgei);
|
||||||
|
|
||||||
const FixedList<point, 3>
|
const FixedList<point, 3>
|
||||||
tri =
|
tri =
|
||||||
|
|||||||
@ -297,7 +297,7 @@ void Foam::particle::changeFace(const label tetTriI)
|
|||||||
(
|
(
|
||||||
;
|
;
|
||||||
edgeI < newFace.size()
|
edgeI < newFace.size()
|
||||||
&& edge::compare(sharedEdge, newFace.faceEdge(edgeI)) != edgeComp;
|
&& edge::compare(sharedEdge, newFace.edge(edgeI)) != edgeComp;
|
||||||
++ edgeI
|
++ edgeI
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -84,7 +84,7 @@ Foam::label Foam::surfaceIntersection::getEdge
|
|||||||
const label fp
|
const label fp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const edge faceEdge = surf.localFaces()[facei].faceEdge(fp);
|
const edge faceEdge = surf.localFaces()[facei].edge(fp);
|
||||||
|
|
||||||
const labelList& eLabels = surf.faceEdges()[facei];
|
const labelList& eLabels = surf.faceEdges()[facei];
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,7 @@ void Foam::cuttingSurfaceBase::walkCellCuts
|
|||||||
|
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
edge e(f.faceEdge(fp));
|
edge e(f.edge(fp));
|
||||||
|
|
||||||
// Action #1: Orient edge (+ve gradient) and detect intersect
|
// Action #1: Orient edge (+ve gradient) and detect intersect
|
||||||
if (!edgeOrientIntersect(e))
|
if (!edgeOrientIntersect(e))
|
||||||
|
|||||||
Reference in New Issue
Block a user