1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Collection of static functions to do various simple mesh related things.
34 \*---------------------------------------------------------------------------*/
41 #include "labelList.H"
42 #include "pointField.H"
45 #include "primitivePatch.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Namespace meshTools Declaration
57 \*---------------------------------------------------------------------------*/
61 // Bit identifiers for octants (p=plus, m=min e.g. plusXminYminZ)
63 static const label mXmYmZ = 0;
64 static const label pXmYmZ = 1;
65 static const label mXpYmZ = 2;
66 static const label pXpYmZ = 3;
68 static const label mXmYpZ = 4;
69 static const label pXmYpZ = 5;
70 static const label mXpYpZ = 6;
71 static const label pXpYpZ = 7;
73 static const label mXmYmZMask = 1 << mXmYmZ;
74 static const label pXmYmZMask = 1 << pXmYmZ;
75 static const label mXpYmZMask = 1 << mXpYmZ;
76 static const label pXpYmZMask = 1 << pXpYmZ;
78 static const label mXmYpZMask = 1 << mXmYpZ;
79 static const label pXmYpZMask = 1 << pXmYpZ;
80 static const label mXpYpZMask = 1 << mXpYpZ;
81 static const label pXpYpZMask = 1 << pXpYpZ;
84 //- Check if n is in same direction as normals of all faceLabels
88 const vectorField& faceNormals,
89 const labelList& faceLabels
92 //- Calculate point normals on a 'box' mesh (all edges aligned with
94 vectorField calcBoxPointNormals(const primitivePatch& pp);
96 //- Normalized edge vector
97 vector normEdgeVec(const primitiveMesh&, const label edgeI);
99 //- Write obj representation of point
107 //- Write obj representation of faces subset
113 const labelList& faceLabels
116 //- Write obj representation of faces
124 //- Write obj representation of cell subset
131 const labelList& cellLabels
134 //- Is edge used by cell
137 const primitiveMesh&,
142 //- Is edge used by face
145 const primitiveMesh&,
150 //- Is face used by cell
153 const primitiveMesh&,
158 //- Return edge among candidates that uses the two vertices.
161 const edgeList& edges,
162 const labelList& candidates,
167 //- Return edge between two vertices. Returns -1 if no edge.
170 const primitiveMesh&,
175 //- Return edge shared by two faces. Throws error if no edge found.
178 const primitiveMesh&,
183 //- Return face shared by two cells. Throws error if none found.
186 const primitiveMesh&,
191 //- Get faces on cell using edgeI. Throws error if no two found.
194 const primitiveMesh&,
201 //- Return label of other edge (out of candidates edgeLabels)
202 // connected to vertex but not edgeI. Throws error if none found.
205 const primitiveMesh&,
206 const labelList& edgeLabels,
211 //- Return face on cell using edgeI but not faceI. Throws error
215 const primitiveMesh&,
221 //- Return cell on other side of face. Throws error
222 // if face not internal.
225 const primitiveMesh&,
230 //- Returns label of edge nEdges away from startEdge (in the direction
234 const primitiveMesh&,
236 const label startEdgeI,
237 const label startVertI,
243 // Hex only functionality.
246 //- Given edge on hex find other 'parallel', non-connected edges.
247 void getParallelEdges
249 const primitiveMesh&,
257 //- Given edge on hex find all 'parallel' (i.e. non-connected)
258 // edges and average direction of them
261 const primitiveMesh&,
266 //- Reverse of edgeToCutDir: given direction find edge bundle and
267 // return one of them.
270 const primitiveMesh&,
275 } // End namespace meshTools
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 } // End namespace Foam
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 // ************************************************************************* //