OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::meshTriangulation
00027 
00028 Description
00029     Triangulation of mesh faces. Generates (multiply connected) trisurface.
00030 
00031     All patch faces keep their patchID as triangle region.
00032     Internal faces get the supplied region number.
00033 
00034 SourceFiles
00035     meshTriangulation.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 
00040 #ifndef meshTriangulation_H
00041 #define meshTriangulation_H
00042 
00043 #include "triSurface.H"
00044 #include "typeInfo.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 // Forward declaration of classes
00052 class polyMesh;
00053 class primitiveMesh;
00054 
00055 /*---------------------------------------------------------------------------*\
00056                            Class meshTriangulation Declaration
00057 \*---------------------------------------------------------------------------*/
00058 
00059 class meshTriangulation
00060 :
00061     public triSurface
00062 {
00063     // Private data
00064 
00065         //- Number of triangles in this that are internal to the surface.
00066         label nInternalFaces_;
00067 
00068         //- From triangle to mesh face
00069         labelList faceMap_;
00070 
00071     // Private Member Functions
00072 
00073         //- Is face internal to the subset.
00074         static bool isInternalFace
00075         (
00076             const primitiveMesh&,
00077             const boolList& includedCell,
00078             const label faceI
00079         );
00080 
00081         //- find boundary faces of subset.
00082         static void getFaces
00083         (
00084             const primitiveMesh&,
00085             const boolList& includedCell,
00086             boolList& faceIsCut,
00087             label& nFaces,
00088             label& nInternalFaces
00089         );
00090 
00091         //- Add triangulation of face to triangles. Optionally reverse.
00092         void insertTriangles
00093         (
00094             const triFaceList&,
00095             const label faceI,
00096             const label regionI,
00097             const bool reverse,
00098 
00099             List<labelledTri>& triangles,
00100             label& triI
00101         );
00102 
00103 
00104 public:
00105 
00106     ClassName("meshTriangulation");
00107 
00108 
00109     // Constructors
00110 
00111         //- Construct null
00112         meshTriangulation();
00113 
00114         //- Construct from selected mesh cell and region number to be used
00115         //  for triangles resulting from internal faces. (all boundary triangles
00116         //  get polyMesh patch id). 
00117         //  faceCentreDecomposition = true  : decomposition around face centre
00118         //                            false : decomposition using
00119         //                                    existing vertices
00120         meshTriangulation
00121         (
00122             const polyMesh&,
00123             const label internalFacesPatch,
00124             const boolList& includedCell,
00125             const bool faceCentreDecomposition = false
00126         );
00127 
00128 
00129     // Member Functions
00130 
00131         //- number of triangles in *this which are internal to the surface
00132         label nInternalFaces() const
00133         {
00134             return nInternalFaces_;
00135         }
00136 
00137         //- from triangle to mesh face
00138         const labelList& faceMap() const
00139         {
00140             return faceMap_;
00141         }
00142 };
00143 
00144 
00145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00146 
00147 } // End namespace Foam
00148 
00149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00150 
00151 #endif
00152 
00153 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd