Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "blockMesh.H"
00029
00030
00031
00032
00033 void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
00034 {
00035 Info<< nl << "Check block mesh topology" << endl;
00036
00037 bool blockMeshOK = true;
00038
00039 const pointField& points = bm.points();
00040 const faceList& faces = bm.faces();
00041 const cellList& cells = bm.cells();
00042 const polyPatchList& patches = bm.boundaryMesh();
00043
00044 label nBoundaryFaces=0;
00045 forAll(cells, celli)
00046 {
00047 nBoundaryFaces += cells[celli].nFaces();
00048 }
00049
00050 nBoundaryFaces -= 2*bm.nInternalFaces();
00051
00052 label nDefinedBoundaryFaces=0;
00053 forAll(patches, patchi)
00054 {
00055 nDefinedBoundaryFaces += patches[patchi].size();
00056 }
00057
00058
00059 Info<< nl << tab << "Basic statistics" << endl;
00060
00061 Info<< tab << tab << "Number of internal faces : "
00062 << bm.nInternalFaces() << endl;
00063
00064 Info<< tab << tab << "Number of boundary faces : "
00065 << nBoundaryFaces << endl;
00066
00067 Info<< tab << tab << "Number of defined boundary faces : "
00068 << nDefinedBoundaryFaces << endl;
00069
00070 Info<< tab << tab << "Number of undefined boundary faces : "
00071 << nBoundaryFaces - nDefinedBoundaryFaces << endl;
00072
00073 if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
00074 {
00075 Info<< tab << tab << tab
00076 << "(Warning : only leave undefined the front and back planes "
00077 << "of 2D planar geometries!)" << endl;
00078 }
00079
00080 Info<< nl << tab << "Checking patch -> block consistency" << endl;
00081
00082
00083 forAll(patches, patchi)
00084 {
00085 const faceList& Patch = patches[patchi];
00086
00087 forAll(Patch, patchFacei)
00088 {
00089 const face& patchFace = Patch[patchFacei];
00090 bool patchFaceOK = false;
00091
00092 forAll(cells, celli)
00093 {
00094 const labelList& cellFaces = cells[celli];
00095
00096 forAll(cellFaces, cellFacei)
00097 {
00098 if (patchFace == faces[cellFaces[cellFacei]])
00099 {
00100 patchFaceOK = true;
00101
00102 if
00103 (
00104 (
00105 patchFace.normal(points)
00106 & faces[cellFaces[cellFacei]].normal(points)
00107 ) < 0.0
00108 )
00109 {
00110 Info<< tab << tab
00111 << "Face " << patchFacei
00112 << " of patch " << patchi
00113 << " (" << patches[patchi].name() << ")"
00114 << " points inwards"
00115 << endl;
00116
00117 blockMeshOK = false;
00118 }
00119 }
00120 }
00121 }
00122
00123 if (!patchFaceOK)
00124 {
00125 Info<< tab << tab
00126 << "Face " << patchFacei
00127 << " of patch " << patchi
00128 << " (" << patches[patchi].name() << ")"
00129 << " does not match any block faces" << endl;
00130
00131 blockMeshOK = false;
00132 }
00133 }
00134 }
00135
00136 if (!blockMeshOK)
00137 {
00138 FatalErrorIn("blockMesh::checkBlockMesh(const polyMesh& bm)")
00139 << "Block mesh topology incorrect, stopping mesh generation!"
00140 << exit(FatalError);
00141 }
00142 }
00143
00144