1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Given point flip all faces such that normals point in same direction.
33 \*---------------------------------------------------------------------------*/
35 #ifndef orientedSurface_H
36 #define orientedSurface_H
38 #include "triSurface.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
48 /*---------------------------------------------------------------------------*\
49 Class orientedSurface Declaration
50 \*---------------------------------------------------------------------------*/
58 //- Enumeration listing whether face needs to be flipped.
67 // Private Member Functions
69 //- Return true if edge is used in opposite order in faces
70 static bool consistentEdge
73 const triSurface::FaceType& f0,
74 const triSurface::FaceType& f1
77 //- From changed faces get the changed edges
78 static labelList faceToEdge
81 const labelList& changedFaces
84 //- From changed edges check the orientation of the connected faces
85 // and flip them. Return changed faces.
86 static labelList edgeToFace
89 const labelList& changedEdges,
93 //- Walk from face across connected faces. Change orientation to be
94 // consistent with startFaceI.
95 static void walkSurface
98 const label startFaceI,
102 //- Given nearest point and face check orientation to nearest face
103 // and flip if nessecary (only marked in flipState) and propagate.
104 static void propagateOrientation
107 const point& outsidePoint,
108 const bool orientOutside,
109 const label nearestFaceI,
110 const point& nearestPt,
114 //- Given flipState reverse triangles of *this. Return true if
116 static bool flipSurface(triSurface& s, const labelList& flipState);
120 ClassName("orientedSurface");
128 //- Construct from triSurface and sample point which is either
129 // outside (orientOutside = true) or inside (orientOutside = false).
130 // Uses linear search to find nearest.
134 const point& samplePoint,
135 const bool orientOutside = true
138 //- Construct from triSurface. Calculates outside point as being
139 // outside the bounding box of the surface.
140 orientedSurface(const triSurface&, const bool orientOutside = true);
145 //- Flip faces such that normals are consistent with point:
146 // orientOutside=true : point outside surface
147 // orientOutside=false : point inside surface
148 static bool orient(triSurface&, const point&, const bool orientOutside);
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 // ************************************************************************* //