initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / triSurface / meshTriangulation / meshTriangulation.H
blob4f4257eed901ae6065c2bd88e1968a1f319b435d
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::meshTriangulation
28 Description
29     Triangulation of mesh faces. Generates (multiply connected) trisurface.
31     All patch faces keep their patchID as triangle region.
32     Internal faces get the supplied region number.
34 SourceFiles
35     meshTriangulation.C
37 \*---------------------------------------------------------------------------*/
40 #ifndef meshTriangulation_H
41 #define meshTriangulation_H
43 #include "triSurface.H"
44 #include "typeInfo.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 // Forward declaration of classes
52 class polyMesh;
53 class primitiveMesh;
55 /*---------------------------------------------------------------------------*\
56                            Class meshTriangulation Declaration
57 \*---------------------------------------------------------------------------*/
59 class meshTriangulation
61     public triSurface
63     // Private data
65         //- Number of triangles in this that are internal to the surface.
66         label nInternalFaces_;
68         //- From triangle to mesh face
69         labelList faceMap_;
71     // Private Member Functions
73         //- Is face internal to the subset.
74         static bool isInternalFace
75         (
76             const primitiveMesh&,
77             const boolList& includedCell,
78             const label faceI
79         );
81         //- find boundary faces of subset.
82         static void getFaces
83         (
84             const primitiveMesh&,
85             const boolList& includedCell,
86             boolList& faceIsCut,
87             label& nFaces,
88             label& nInternalFaces
89         );
91         //- Add triangulation of face to triangles. Optionally reverse.
92         void insertTriangles
93         (
94             const triFaceList&,
95             const label faceI,
96             const label regionI,
97             const bool reverse,
99             List<labelledTri>& triangles,
100             label& triI
101         );
104 public:
106     ClassName("meshTriangulation");
109     // Constructors
111         //- Construct null
112         meshTriangulation();
114         //- Construct from selected mesh cell and region number to be used
115         //  for triangles resulting from internal faces. (all boundary triangles
116         //  get polyMesh patch id). 
117         //  faceCentreDecomposition = true  : decomposition around face centre
118         //                            false : decomposition using
119         //                                    existing vertices
120         meshTriangulation
121         (
122             const polyMesh&,
123             const label internalFacesPatch,
124             const boolList& includedCell,
125             const bool faceCentreDecomposition = false
126         );
129     // Member Functions
131         //- number of triangles in *this which are internal to the surface
132         label nInternalFaces() const
133         {
134             return nInternalFaces_;
135         }
137         //- from triangle to mesh face
138         const labelList& faceMap() const
139         {
140             return faceMap_;
141         }
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace Foam
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 #endif
153 // ************************************************************************* //