1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 // Check the blockMesh topology
34 void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
36 Info<< nl << "Check block mesh topology" << endl;
38 bool blockMeshOK = true;
40 const pointField& points = bm.points();
41 const faceList& faces = bm.faces();
42 const cellList& cells = bm.cells();
43 const polyPatchList& patches = bm.boundaryMesh();
45 label nBoundaryFaces=0;
48 nBoundaryFaces += cells[celli].nFaces();
51 nBoundaryFaces -= 2*bm.nInternalFaces();
53 label nDefinedBoundaryFaces=0;
54 forAll(patches, patchi)
56 nDefinedBoundaryFaces += patches[patchi].size();
60 Info<< nl << tab << "Basic statistics" << endl;
62 Info<< tab << tab << "Number of internal faces : "
63 << bm.nInternalFaces() << endl;
65 Info<< tab << tab << "Number of boundary faces : "
66 << nBoundaryFaces << endl;
68 Info<< tab << tab << "Number of defined boundary faces : "
69 << nDefinedBoundaryFaces << endl;
71 Info<< tab << tab << "Number of undefined boundary faces : "
72 << nBoundaryFaces - nDefinedBoundaryFaces << endl;
74 if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
76 Info<< tab << tab << tab
77 << "(Warning : only leave undefined the front and back planes "
78 << "of 2D planar geometries!)" << endl;
81 Info<< nl << tab << "Checking patch -> block consistency" << endl;
84 forAll(patches, patchi)
86 const faceList& Patch = patches[patchi];
88 forAll(Patch, patchFacei)
90 const face& patchFace = Patch[patchFacei];
91 bool patchFaceOK = false;
95 const labelList& cellFaces = cells[celli];
97 forAll(cellFaces, cellFacei)
99 if (patchFace == faces[cellFaces[cellFacei]])
106 patchFace.normal(points)
107 & faces[cellFaces[cellFacei]].normal(points)
112 << "Face " << patchFacei
113 << " of patch " << patchi
114 << " (" << patches[patchi].name() << ")"
127 << "Face " << patchFacei
128 << " of patch " << patchi
129 << " (" << patches[patchi].name() << ")"
130 << " does not match any block faces" << endl;
139 FatalErrorIn("blockMesh::checkBlockMesh(const polyMesh& bm)")
140 << "Block mesh topology incorrect, stopping mesh generation!"
145 // ************************************************************************* //