/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "primitiveMesh.H" #include "pyramidPointFaceRef.H" #include "ListOps.H" #include "unitConversion.H" #include "SortableList.H" #include "EdgeMap.H" #include "primitiveMeshTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // Foam::scalar Foam::primitiveMesh::closedThreshold_ = 1.0e-6; Foam::scalar Foam::primitiveMesh::aspectThreshold_ = 1000; Foam::scalar Foam::primitiveMesh::nonOrthThreshold_ = 70; // deg Foam::scalar Foam::primitiveMesh::skewThreshold_ = 4; Foam::scalar Foam::primitiveMesh::planarCosAngle_ = 1.0e-6; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // bool Foam::primitiveMesh::checkClosedBoundary ( const vectorField& areas, const bool report, const PackedBoolList& internalOrCoupledFaces ) const { if (debug) { Info<< "bool primitiveMesh::checkClosedBoundary(" << "const bool) const: " << "checking whether the boundary is closed" << endl; } // Loop through all boundary faces and sum up the face area vectors. // For a closed boundary, this should be zero in all vector components vector sumClosed(vector::zero); scalar sumMagClosedBoundary = 0; for (label faceI = nInternalFaces(); faceI < areas.size(); faceI++) { if (!internalOrCoupledFaces.size() || !internalOrCoupledFaces[faceI]) { sumClosed += areas[faceI]; sumMagClosedBoundary += mag(areas[faceI]); } } reduce(sumClosed, sumOp()); reduce(sumMagClosedBoundary, sumOp()); vector openness = sumClosed/(sumMagClosedBoundary + VSMALL); if (cmptMax(cmptMag(openness)) > closedThreshold_) { if (debug || report) { Info<< " ***Boundary openness " << openness << " possible hole in boundary description." << endl; } return true; } else { if (debug || report) { Info<< " Boundary openness " << openness << " OK." << endl; } return false; } } bool Foam::primitiveMesh::checkClosedCells ( const vectorField& faceAreas, const scalarField& cellVolumes, const bool report, labelHashSet* setPtr, labelHashSet* aspectSetPtr, const Vector