1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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
27 \*---------------------------------------------------------------------------*/
29 #include "blockMesh.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38 // Check the blockMesh topology
40 void blockMesh::checkBlockMesh(const polyMesh& bm)
42 Info<< nl << "Check block mesh topology" << endl;
44 bool blockMeshOK = true;
46 const pointField& points = bm.points();
47 const faceList& faces = bm.faces();
48 const cellList& cells = bm.cells();
49 const polyPatchList& patches = bm.boundaryMesh();
51 label nBoundaryFaces=0;
54 nBoundaryFaces += cells[celli].nFaces();
57 nBoundaryFaces -= 2*bm.nInternalFaces();
59 label nDefinedBoundaryFaces=0;
60 forAll(patches, patchi)
62 nDefinedBoundaryFaces += patches[patchi].size();
66 Info<< nl << tab << "Basic statistics" << endl;
68 Info<< tab << tab << "Number of internal faces : "
69 << bm.nInternalFaces() << endl;
71 Info<< tab << tab << "Number of boundary faces : "
72 << nBoundaryFaces << endl;
74 Info<< tab << tab << "Number of defined boundary faces : "
75 << nDefinedBoundaryFaces << endl;
77 Info<< tab << tab << "Number of undefined boundary faces : "
78 << nBoundaryFaces - nDefinedBoundaryFaces << endl;
80 if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
82 Info<< tab << tab << tab
83 << "(Warning : only leave undefined the front and back planes "
84 << "of 2D planar geometries!)" << endl;
87 Info<< nl << tab << "Checking patch -> block consistency" << endl;
90 forAll(patches, patchi)
92 const faceList& Patch = patches[patchi];
94 forAll(Patch, patchFacei)
96 const face& patchFace = Patch[patchFacei];
97 bool patchFaceOK = false;
101 const labelList& cellFaces = cells[celli];
103 forAll(cellFaces, cellFacei)
105 if (patchFace == faces[cellFaces[cellFacei]])
112 patchFace.normal(points)
113 & faces[cellFaces[cellFacei]].normal(points)
118 << "Face " << patchFacei
119 << " of patch " << patchi
120 << " (" << patches[patchi].name() << ")"
133 << "Face " << patchFacei
134 << " of patch " << patchi
135 << " (" << patches[patchi].name() << ")"
136 << " does not match any block faces" << endl;
145 FatalErrorIn("blockMesh::checkBlockMesh(const polyMesh& bm)")
146 << "Block mesh topology incorrect, stopping mesh generation!"
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 } // End namespace Foam
156 // ************************************************************************* //