48 bool fullMatch =
true;
50 point compareOrigin = origin;
52 if (origin == point::max)
56 compareOrigin =
sum(pts1)/pts1.
size();
71 scalar dist0 = pts0MagSqr[i];
73 label face0I = pts0MagSqr.
indices()[i];
75 scalar matchDist = matchDistances[face0I];
77 label startI =
findLower(pts1MagSqr, 0.99999*dist0 - 2*matchDist);
86 scalar minDistSqr = VGREAT;
93 (j < pts1MagSqr.
size())
94 && (pts1MagSqr[j] < 1.00001*dist0 + 2*matchDist)
99 label facei = pts1MagSqr.
indices()[j];
101 scalar distSqr =
magSqr(pts0[face0I] - pts1[facei]);
103 if (distSqr <=
sqr(matchDist) && distSqr < minDistSqr)
105 minDistSqr = distSqr;
116 Pout<<
"Cannot find point in pts1 matching point " << face0I
117 <<
" coord:" << pts0[face0I]
118 <<
" in pts0 when using tolerance " << matchDist <<
endl;
121 Pout<<
"Searching started from:" << startI <<
" in pts1"
127 (j < pts1MagSqr.
size())
128 && (pts1MagSqr[j] < 1.00001*dist0 + 2*matchDist)
133 label facei = pts1MagSqr.
indices()[j];
135 Pout<<
" Compared coord: " << pts1[facei]
137 <<
" with difference to point "
138 <<
mag(pts1[facei] - pts0[face0I]) <<
endl;
143 from0To1[face0I] = minFacei;
165 bool fullMatch =
true;
167 point compareOrigin = origin;
169 if (origin == point::max)
173 compareOrigin =
sum(pts1)/pts1.
size();
188 scalar dist0 = pts0MagSqr[i];
190 label face0I = pts0MagSqr.
indices()[i];
192 scalar matchDist = matchDistances[face0I];
194 label startI =
findLower(pts1MagSqr, 0.99999*dist0 - 2*matchDist);
202 scalar minDistSqr = VGREAT;
206 const scalar minDistNorm = 0;
212 (j < pts1MagSqr.
size())
213 && (pts1MagSqr[j] < 1.00001*dist0 + 2*matchDist)
218 label facei = pts1MagSqr.
indices()[j];
220 scalar distSqr =
magSqr(pts0[face0I] - pts1[facei]);
222 scalar distNorm = (pts0Dir[face0I] & pts1Dir[facei]);
233 if (distSqr <=
sqr(matchDist) && distSqr < minDistSqr)
236 if (distNorm < minDistNorm)
238 minDistSqr = distSqr;
250 Pout<<
"Cannot find point in pts1 matching point " << face0I
251 <<
" coord:" << pts0[face0I]
252 <<
" in pts0 when using tolerance " << matchDist <<
endl;
255 Pout<<
"Searching started from:" << startI <<
" in pts1"
261 (j < pts1MagSqr.
size())
262 && (pts1MagSqr[j] < 1.00001*dist0 + 2*matchDist)
267 label facei = pts1MagSqr.
indices()[j];
269 Pout<<
" Compared coord: " << pts1[facei]
271 <<
" with difference to point "
272 <<
mag(pts1[facei] - pts0[face0I]) <<
endl;
277 from0To1[face0I] = minFacei;
Various functions to operate on Lists.
void setSize(const label n)
Alias for resize()
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelList & indices() const noexcept
Return the list of sorted indices. Updated every sort.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
Determine correspondence between points. See below.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
bool matchPoints(const UList< point > &pts0, const UList< point > &pts1, const UList< scalar > &matchDistance, const bool verbose, labelList &from0To1, const point &origin=point::zero)
Determine correspondence between pointFields. Gets passed.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
#define forAll(list, i)
Loop across all elements in list.
A non-counting (dummy) refCount.