FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

meshTriangulation.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::meshTriangulation
00026 
00027 Description
00028     Triangulation of mesh faces. Generates (multiply connected) trisurface.
00029 
00030     All patch faces keep their patchID as triangle region.
00031     Internal faces get the supplied region number.
00032 
00033 SourceFiles
00034     meshTriangulation.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 
00039 #ifndef meshTriangulation_H
00040 #define meshTriangulation_H
00041 
00042 #include <triSurface/triSurface.H>
00043 #include <OpenFOAM/typeInfo.H>
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 // Forward declaration of classes
00051 class polyMesh;
00052 class primitiveMesh;
00053 
00054 /*---------------------------------------------------------------------------*\
00055                            Class meshTriangulation Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class meshTriangulation
00059 :
00060     public triSurface
00061 {
00062     // Private data
00063 
00064         //- Number of triangles in this that are internal to the surface.
00065         label nInternalFaces_;
00066 
00067         //- From triangle to mesh face
00068         labelList faceMap_;
00069 
00070     // Private Member Functions
00071 
00072         //- Is face internal to the subset.
00073         static bool isInternalFace
00074         (
00075             const primitiveMesh&,
00076             const boolList& includedCell,
00077             const label faceI
00078         );
00079 
00080         //- find boundary faces of subset.
00081         static void getFaces
00082         (
00083             const primitiveMesh&,
00084             const boolList& includedCell,
00085             boolList& faceIsCut,
00086             label& nFaces,
00087             label& nInternalFaces
00088         );
00089 
00090         //- Add triangulation of face to triangles. Optionally reverse.
00091         void insertTriangles
00092         (
00093             const triFaceList&,
00094             const label faceI,
00095             const label regionI,
00096             const bool reverse,
00097 
00098             List<labelledTri>& triangles,
00099             label& triI
00100         );
00101 
00102 
00103 public:
00104 
00105     ClassName("meshTriangulation");
00106 
00107 
00108     // Constructors
00109 
00110         //- Construct null
00111         meshTriangulation();
00112 
00113         //- Construct from selected mesh cell and region number to be used
00114         //  for triangles resulting from internal faces. (all boundary triangles
00115         //  get polyMesh patch id). 
00116         //  faceCentreDecomposition = true  : decomposition around face centre
00117         //                            false : decomposition using
00118         //                                    existing vertices
00119         meshTriangulation
00120         (
00121             const polyMesh&,
00122             const label internalFacesPatch,
00123             const boolList& includedCell,
00124             const bool faceCentreDecomposition = false
00125         );
00126 
00127 
00128     // Member Functions
00129 
00130         //- number of triangles in *this which are internal to the surface
00131         label nInternalFaces() const
00132         {
00133             return nInternalFaces_;
00134         }
00135 
00136         //- from triangle to mesh face
00137         const labelList& faceMap() const
00138         {
00139             return faceMap_;
00140         }
00141 };
00142 
00143 
00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00145 
00146 } // End namespace Foam
00147 
00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00149 
00150 #endif
00151 
00152 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines