Go to the documentation of this file.
64 const labelList& fEdges =
s.faceEdges()[changedFaces[i]];
68 changedEdges[changedI++] = fEdges[j];
89 label edgeI = changedEdges[i];
91 const labelList& eFaces =
s.edgeFaces()[edgeI];
93 if (eFaces.
size() < 2)
97 else if (eFaces.
size() == 2)
99 label face0 = eFaces[0];
100 label face1 = eFaces[1];
105 if (flip[face0] == UNVISITED)
107 if (flip[face1] == UNVISITED)
115 if (consistentEdge(
s.edges()[edgeI], f0,
f1))
118 flip[face0] = (flip[face1] == FLIP ? FLIP : NOFLIP);
123 flip[face0] = (flip[face1] == FLIP ? NOFLIP : FLIP);
125 changedFaces[changedI++] = face0;
130 if (flip[face1] == UNVISITED)
133 if (consistentEdge(
s.edges()[edgeI], f0,
f1))
135 flip[face1] = (flip[face0] == FLIP ? FLIP : NOFLIP);
139 flip[face1] = (flip[face0] == FLIP ? NOFLIP : FLIP);
141 changedFaces[changedI++] = face1;
150 changedFaces.
setSize(changedI);
159 const label startFaceI,
170 changedEdges = faceToEdge(
s, changedFaces);
172 if (changedEdges.empty())
177 changedFaces = edgeToFace(
s, changedEdges, flipState);
179 if (changedFaces.empty())
190 const point& samplePoint,
191 const bool orientOutside,
192 const label nearestFaceI,
193 const point& nearestPt,
207 if (side == triSurfaceTools::UNKNOWN)
211 flipState[nearestFaceI] = NOFLIP;
213 else if ((side == triSurfaceTools::OUTSIDE) == orientOutside)
217 flipState[nearestFaceI] = NOFLIP;
222 flipState[nearestFaceI] = FLIP;
227 vector n = triSurfaceTools::surfaceNormal(
s, nearestFaceI, nearestPt);
229 Pout<<
"orientedSurface::propagateOrientation : starting face"
230 <<
" orientation:" <<
nl
231 <<
" for samplePoint:" << samplePoint <<
nl
232 <<
" starting from point:" << nearestPt <<
nl
233 <<
" on face:" << nearestFaceI <<
nl
234 <<
" with normal:" <<
n <<
nl
235 <<
" decided side:" <<
label(side)
240 walkSurface(
s, nearestFaceI, flipState);
251 const point& outsidePoint,
268 const point& fc =
s.faceCentres()[faceI];
269 const vector&
n =
s.faceNormals()[faceI];
271 const vector d = fc - outsidePoint;
272 const scalar magD =
mag(d);
275 if (magD > SMALL && (
mag(
n & d/magD) > 1
e-6))
288 label zoneIndex = -1;
291 if (hits[0][i].index() == faceI)
302 if ((zoneIndex%2) == 0)
306 isOutside = ((
n & d) < 0);
310 isOutside = ((
n & d) > 0);
326 bool hasFlipped =
false;
331 if (flipState[faceI] == UNVISITED)
334 <<
"unvisited face " << faceI
337 else if (flipState[faceI] == FLIP)
360 bool anyFlipped =
false;
376 label startFaceI = -1;
377 while (faceI <
s.size())
387 if (startFaceI == -1)
392 flipState[startFaceI] =
NOFLIP;
415 const point& samplePoint,
416 const bool orientOutside
421 orient(*
this, samplePoint, orientOutside);
429 const bool orientOutside
439 orient(*
this, outsidePoint, orientOutside);
448 const point& samplePoint,
449 const bool orientOutside
455 bool topoFlipped = orientConsistent(
s);
469 scalar minDist = GREAT;
475 if (flipState[faceI] == UNVISITED)
478 s[faceI].nearestPoint(samplePoint,
s.points());
509 bool geomFlipped = flipSurface(
s, flipState);
511 return topoFlipped || geomFlipped;
519 const point& samplePoint,
520 const bool orientOutside
526 bool topoFlipped = orientConsistent(
s);
532 if (
s.edgeFaces()[edgeI].size() != 2)
534 borderEdge[edgeI] =
true;
543 for (
label zoneI = 0; zoneI < nZones; zoneI++)
545 label zoneFaceI = -1;
558 if (isOutside == orientOutside)
560 flipState[zoneFaceI] = NOFLIP;
564 flipState[zoneFaceI] = FLIP;
566 walkSurface(
s, zoneFaceI, flipState);
570 bool geomFlipped = flipSurface(
s, flipState);
572 return topoFlipped || geomFlipped;
const Field< PointType > & points() const
Return reference to global points.
const point & max() const
Maximum describing the bounding box.
static void walkSurface(const triSurface &s, const label startFaceI, labelList &flipState)
Walk from face across connected faces. Change orientation to be.
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
This class describes the interaction of a face and a point. It carries the info of a successful hit a...
static bool flipSurface(triSurface &s, const labelList &flipState)
Given flipState reverse triangles of *this. Return true if.
orientedSurface()
Construct null.
const Point & rawPoint() const
Return point with no checking.
Standard boundBox + extra functionality for use in octree.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool orientConsistent(triSurface &s)
Make surface surface has consistent orientation across connected.
void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &info) const
Calculate all intersections from start to end.
dimensioned< scalar > mag(const dimensioned< Type > &)
Helper class to search on triSurface.
vector span() const
The bounding box span (from minimum to maximum)
static void propagateOrientation(const triSurface &, const point &outsidePoint, const bool orientOutside, const label nearestFaceI, const point &nearestPt, labelList &flipState)
Given nearest point and face check orientation to nearest face.
scalar distance() const
Return distance to hit.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
Triangulated surface description with patch information.
A subset of mesh faces organised as a primitive patch.
static labelList faceToEdge(const triSurface &, const labelList &changedFaces)
From changed faces get the changed edges.
errorManip< error > abort(error &err)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
static bool consistentEdge(const edge &e, const triSurface::FaceType &f0, const triSurface::FaceType &f1)
Return true if edge is used in opposite order in faces.
void setSize(const label)
Reset size of List.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static labelList edgeToFace(const triSurface &, const labelList &changedEdges, labelList &flip)
From changed edges check the orientation of the connected faces.
prefixOSstream Pout(cout, "Pout")
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const triSurface & surface() const
Return reference to the surface.
const dimensionedScalar e
Elementary charge.
Triangle with additional region number.
int edgeDirection(const edge &) const
Return the edge direction on the face.
static void findZoneSide(const triSurfaceSearch &surfSearches, const labelList &faceZone, const label zoneI, const point &visiblePoint, label &zoneFaceI, bool &isOutside)
Find a face on zoneI and count number of intersections to determine.
static bool orient(triSurface &, const point &, const bool orientOutside)
Flip faces such that normals are consistent with point:
void size(const label)
Override size to be inconsistent with allocated storage.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
defineTypeNameAndDebug(combustionModel, 0)