diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 443576601d..4eb19041aa 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -273,73 +273,165 @@ bool Foam::checkCoupledPoints const faceList& fcs = mesh.faces(); const polyBoundaryMesh& patches = mesh.boundaryMesh(); - // Zero'th point on coupled faces - pointField nbrZeroPoint(fcs.size()-mesh.nInternalFaces(), vector::max); - - // Exchange zero point - forAll(patches, patchI) + // Check size of faces + label maxSize = 0; { - if (patches[patchI].coupled()) + labelList nbrSize(fcs.size()-mesh.nInternalFaces(), 0); + + // Exchange size + forAll(patches, patchI) { - const coupledPolyPatch& cpp = refCast - ( - patches[patchI] - ); - - forAll(cpp, i) + if (patches[patchI].coupled()) { - label bFaceI = cpp.start()+i-mesh.nInternalFaces(); - const point& p0 = p[cpp[i][0]]; - nbrZeroPoint[bFaceI] = p0; - } - } - } - syncTools::swapBoundaryFacePositions(mesh, nbrZeroPoint); - - // Compare to local ones. Use same tolerance as for matching - label nErrorFaces = 0; - scalar avgMismatch = 0; - label nCoupledFaces = 0; - - forAll(patches, patchI) - { - if (patches[patchI].coupled()) - { - const coupledPolyPatch& cpp = refCast - ( - patches[patchI] - ); - - if (cpp.owner()) - { - scalarField smallDist + const coupledPolyPatch& cpp = refCast ( - cpp.calcFaceTol - ( - //cpp.matchTolerance(), - cpp, - cpp.points(), - cpp.faceCentres() - ) + patches[patchI] ); forAll(cpp, i) { label bFaceI = cpp.start()+i-mesh.nInternalFaces(); - const point& p0 = p[cpp[i][0]]; + nbrSize[bFaceI] = cpp[i].size(); + maxSize = max(maxSize, cpp[i].size()); + } + } + } + syncTools::swapBoundaryFaceList(mesh, nbrSize); - scalar d = mag(p0 - nbrZeroPoint[bFaceI]); - if (d > smallDist[i]) + // Check on owner + label nErrorFaces = 0; + forAll(patches, patchI) + { + if (patches[patchI].coupled()) + { + const coupledPolyPatch& cpp = refCast + ( + patches[patchI] + ); + + if (cpp.owner()) + { + forAll(cpp, i) { - if (setPtr) + label bFaceI = cpp.start()+i-mesh.nInternalFaces(); + + if (cpp[i].size() != nbrSize[bFaceI]) { - setPtr->insert(cpp.start()+i); + if (setPtr) + { + setPtr->insert(cpp.start()+i); + } + nErrorFaces++; + } + } + } + } + } + + reduce(nErrorFaces, sumOp