1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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
25 \*---------------------------------------------------------------------------*/
27 #include "primitiveMesh.H"
28 #include "SortableList.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 bool Foam::primitiveMesh::checkPointNearness
35 const scalar reportDistSqr,
39 const pointField& points = this->points();
42 SortableList<scalar> sortedMag(magSqr(points));
46 for (label i = 1; i < sortedMag.size(); i++)
48 label pti = sortedMag.indices()[i];
50 // Compare pti to any previous points with similar sortedMag
54 j >= 0 && (sortedMag[j] > sortedMag[i]-reportDistSqr);
58 label prevPtI = sortedMag.indices()[j];
60 if (magSqr(points[pti] - points[prevPtI]) < reportDistSqr)
62 // Commented out in 1.6.x. HJ, 17/Aug/2010
63 //// Check if unconnected.
64 //const labelList& pEdges = pointEdges()[pti];
66 //bool connected = false;
68 //forAll(pEdges, pEdgei)
70 // if (edges()[pEdges[pEdgei]].otherVertex(prevPtI) != -1)
84 setPtr->insert(prevPtI);
91 reduce(nClose, sumOp<label>());
97 Info<< " <<Points closer than " << Foam::sqrt(reportDistSqr)
98 << " together found, number: " << nClose
111 // ************************************************************************* //