primitiveMeshCheckPointNearness.C
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 #include "primitiveMesh.H"
00028 #include "SortableList.H"
00029
00030
00031
00032 bool Foam::primitiveMesh::checkPointNearness
00033 (
00034 const bool report,
00035 const scalar reportDistSqr,
00036 labelHashSet* setPtr
00037 ) const
00038 {
00039 const pointField& points = this->points();
00040
00041
00042 SortableList<scalar> sortedMag(magSqr(points));
00043
00044 label nClose = 0;
00045
00046 for (label i = 1; i < sortedMag.size(); i++)
00047 {
00048 label pti = sortedMag.indices()[i];
00049
00050
00051 for
00052 (
00053 label j = i-1;
00054 j >= 0 && (sortedMag[j] > sortedMag[i]-reportDistSqr);
00055 --j
00056 )
00057 {
00058 label prevPtI = sortedMag.indices()[j];
00059
00060 if (magSqr(points[pti] - points[prevPtI]) < reportDistSqr)
00061 {
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 {
00078 nClose++;
00079
00080 if (setPtr)
00081 {
00082 setPtr->insert(pti);
00083 setPtr->insert(prevPtI);
00084 }
00085 }
00086 }
00087 }
00088 }
00089
00090 reduce(nClose, sumOp<label>());
00091
00092 if (nClose > 0)
00093 {
00094 if (report)
00095 {
00096 Info<< " <<Points closer than " << Foam::sqrt(reportDistSqr)
00097 << " together found, number: " << nClose
00098 << endl;
00099 }
00100
00101 return true;
00102 }
00103 else
00104 {
00105 return false;
00106 }
00107 }
00108
00109
00110
Copyright © 2000-2009 OpenCFD Ltd