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 Implementation of cellLooper. Does pure geometric cut through cell.
30 Handles all cell shapes in the same way: cut edges with plane through
31 cell centre and normal in direction of provided direction. Snaps cuts
32 close to edge endpoints (close = snapTol * minEdgeLen) to vertices.
34 Currently determines cuts through edges (and edgeendpoints close to plane)
35 in random order and then sorts them acc. to angle. Could be converted to
36 use walk but problem is that face can be cut multiple times (since does
37 not need to be convex). Another problem is that edges parallel to plane
38 might not be cut. So these are handled by looking at the distance from
39 edge endpoints to the plane.
44 \*---------------------------------------------------------------------------*/
46 #ifndef geomCellLooper_H
47 #define geomCellLooper_H
49 #include "cellLooper.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 // Forward declaration of classes
60 /*---------------------------------------------------------------------------*\
61 Class geomCellLooper Declaration
62 \*---------------------------------------------------------------------------*/
71 //- Tolerance for point equal test. Fraction of edge length.
72 static const scalar pointEqualTol_;
74 //- Tolerance for cut through edges to get snapped to edge end point.
75 // Fraction of length of minimum connected edge length.
76 static scalar snapTol_;
79 // Private Member Functions
81 //- Min length of attached edges
82 scalar minEdgeLen(const label vertI) const;
84 //- Return true and set weight if edge is cut
87 const plane& cutPlane,
92 //- Snaps cut through edge by cut through vertex (if weight closer than
93 // tol to 0 or 1). Returns vertex label snapped to or -1.
101 //- Gets two (random) vectors perpendicular to n and each other to be
110 //- Return true if the cut edge at loop[index] is inbetween the cuts
111 // through the edge end points.
112 bool edgeEndsCut(const labelList&, const label index) const;
115 //- Disallow default bitwise copy construct
116 geomCellLooper(const geomCellLooper&);
118 //- Disallow default bitwise assignment
119 void operator=(const geomCellLooper&);
124 //- Runtime type information
125 TypeName("geomCellLooper");
130 static scalar snapTol()
135 static void setSnapTol(const scalar tol)
145 //- Construct from components
146 geomCellLooper(const polyMesh& mesh);
150 virtual ~geomCellLooper();
157 //- Create cut along circumference of cellI. Gets current mesh cuts.
158 // Cut along circumference is expressed as loop of cuts plus weights
159 // for cuts along edges (only valid for edge cuts).
160 // Return true if successful cut.
163 const vector& refDir,
165 const boolList& vertIsCut,
166 const boolList& edgeIsCut,
167 const scalarField& edgeWeight,
170 scalarField& loopWeights
173 //- Same but now also base point of cut provided (instead of always
177 const plane& cutPlane,
179 const boolList& vertIsCut,
180 const boolList& edgeIsCut,
181 const scalarField& edgeWeight,
184 scalarField& loopWeights
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 } // End namespace Foam
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 // ************************************************************************* //