1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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
25 \*---------------------------------------------------------------------------*/
27 #include "faceTetPolyPatchCellDecomp.H"
28 #include "tetPolyBoundaryMeshCellDecomp.H"
29 #include "tetPolyMeshCellDecomp.H"
30 #include "demandDrivenData.H"
32 #include "addToRunTimeSelectionTable.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 defineTypeNameAndDebug(faceTetPolyPatchCellDecomp, 0);
42 defineRunTimeSelectionTable(faceTetPolyPatchCellDecomp, polyPatch);
44 addToRunTimeSelectionTable
46 faceTetPolyPatchCellDecomp,
47 faceTetPolyPatchCellDecomp,
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 // Construct from polyPatch
55 faceTetPolyPatchCellDecomp::faceTetPolyPatchCellDecomp
58 const tetPolyBoundaryMeshCellDecomp& bm
61 tetPolyPatchCellDecomp(bm),
62 boundaryIndex_(p.index())
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 const polyPatch& faceTetPolyPatchCellDecomp::patch() const
70 return boundaryMesh().mesh()().polyMesh::boundaryMesh()[index()];
74 triFaceList faceTetPolyPatchCellDecomp::faceTriangles
80 boundaryMesh().mesh()()
81 .boundaryMesh()[index()].localFaces()[faceID];
83 // Create a list of triangles to keep the triangles that
84 // have already been added
85 triFaceList result(f.size() - 2);
87 for (label triI = 0; triI < (f.size() - 2); triI++)
89 result[triI] = triFace(f[0], f[triI + 1], f[triI + 2]);
96 faceList faceTetPolyPatchCellDecomp::triFaces() const
99 boundaryMesh().mesh()().boundaryMesh()[index()];
101 // Count the number of faces
106 nTriFaces += mf[faceI].size() - 2;
109 faceList result(nTriFaces);
111 // Reset the counter for re-use
114 face triangleFace(3);
118 const face& f = mf[faceI];
120 for (label triI = 0; triI < (f.size() - 2); triI++)
122 triangleFace[0] = f[0];
123 triangleFace[1] = f[triI + 1];
124 triangleFace[2] = f[triI + 2];
126 result[nTriFaces] = triangleFace;
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 } // End namespace Foam
139 // ************************************************************************* //