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 "meshOctree.H"
31 // #define DEBUGSearch
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 void cartesianMeshExtractor::clearOut()
42 deleteDemandDrivenData(leafCellLabelPtr_);
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 // Construct from octree and mesh data
48 cartesianMeshExtractor::cartesianMeshExtractor
51 const IOdictionary& meshDict,
55 octreeCheck_(octree, meshDict, false),
57 decomposeSplitHexes_(false),
58 leafCellLabelPtr_(new labelList(octree.numberOfLeaves(), -1))
62 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
64 cartesianMeshExtractor::~cartesianMeshExtractor()
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 void cartesianMeshExtractor::decomposeSplitHexes()
73 decomposeSplitHexes_ = true;
76 void cartesianMeshExtractor::createMesh()
78 Info << "Extracting polyMesh" << endl;
80 //- create points and pointLeaves addressing
81 createPointsAndAddressing();
86 //- decompose split-hex cells into tetrahedra and pyramids
87 decomposeSplitHexesIntoTetsAndPyramids();
89 //- remove unused vertices
90 polyMeshGenModifier(mesh_).removeUnusedVertices();
92 Info << "Mesh has :" << nl
93 << mesh_.points().size() << " vertices " << nl
94 << mesh_.faces().size() << " faces" << nl
95 << mesh_.cells().size() << " cells" << endl;
97 if( Pstream::parRun() )
99 label nCells = mesh_.cells().size();
100 reduce(nCells, sumOp<label>());
101 Info << "Total number of cells " << nCells << endl;
103 if( mesh_.cells().size() == 0 )
107 "void cartesianMeshExtractor::createMesh()"
108 ) << "There are no cells in the mesh!"
109 << nl << "The reasons for this can be fwofold:"
110 << nl << "1. Inadequate mesh resolution."
111 << nl << "2. You maxCellSize is a multiplier of the domain length."
112 << " This can be reolved by reducing the maxCellSize by a fraction."
113 << "i.e. 2.49999 instead of 2.5." << exit(FatalError);
116 Info << "Finished extracting polyMesh" << endl;
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 } // End namespace Foam
123 // ************************************************************************* //