1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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 3 of the License, or (at your
14 option) any later version.
16 cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "cartesianMeshExtractor.H"
29 #include "demandDrivenData.H"
30 #include "decomposeFaces.H"
31 #include "decomposeCells.H"
32 #include "hexMatcher.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 void cartesianMeshExtractor::decomposeSplitHexesIntoTetsAndPyramids()
45 if( !decomposeSplitHexes_ ) return;
47 Info << "Decomposing split-hex cells" << endl;
49 const faceListPMG& faces = mesh_.faces();
51 //- decompose faces which have more than 4 vertices
52 boolList decompose(faces.size(), false);
57 if( faces[faceI].size() > 4 )
61 decompose[faceI] = true;
65 reduce(nDecomposed, sumOp<label>());
67 Info << "Decomposing " << nDecomposed
68 << " faces with more than 4 vertices" << endl;
70 if( nDecomposed != 0 )
72 //- decompose marked faces into triangles
73 decomposeFaces(mesh_).decomposeMeshFaces(decompose);
76 //- decompose cells with 24 faces
77 const cellListPMG& cells = mesh_.cells();
78 decompose.setSize(cells.size());
84 if( !hex.matchShape(true, faces, mesh_.owner(), cellI, cells[cellI]) )
87 decompose[cellI] = true;
91 reduce(nDecomposed, sumOp<label>());
93 Info << "Decomposing " << nDecomposed
94 << " cells into tetrahedra and pyramids" << endl;
98 //- decompose marked cells into tets and pyramids
99 decomposeCells dc(mesh_);
100 dc.decomposeMesh(decompose);
103 Info << "Finished decomposing split-hex cells" << endl;
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 } // End namespace Foam
110 // ************************************************************************* //