mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: Initial state after latest Foundation merge
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,7 +76,7 @@ bool Foam::matchPoints
|
||||
|
||||
// Go through range of equal mag and find nearest vector.
|
||||
scalar minDistSqr = VGREAT;
|
||||
label minFaceI = -1;
|
||||
label minFacei = -1;
|
||||
|
||||
for
|
||||
(
|
||||
@ -88,18 +88,18 @@ bool Foam::matchPoints
|
||||
j++
|
||||
)
|
||||
{
|
||||
label faceI = pts1MagSqr.indices()[j];
|
||||
label facei = pts1MagSqr.indices()[j];
|
||||
// Compare actual vectors
|
||||
scalar distSqr = magSqr(pts0[face0I] - pts1[faceI]);
|
||||
scalar distSqr = magSqr(pts0[face0I] - pts1[facei]);
|
||||
|
||||
if (distSqr <= sqr(matchDist) && distSqr < minDistSqr)
|
||||
{
|
||||
minDistSqr = distSqr;
|
||||
minFaceI = faceI;
|
||||
minFacei = facei;
|
||||
}
|
||||
}
|
||||
|
||||
if (minFaceI == -1)
|
||||
if (minFacei == -1)
|
||||
{
|
||||
fullMatch = false;
|
||||
|
||||
@ -122,17 +122,17 @@ bool Foam::matchPoints
|
||||
j++
|
||||
)
|
||||
{
|
||||
label faceI = pts1MagSqr.indices()[j];
|
||||
label facei = pts1MagSqr.indices()[j];
|
||||
|
||||
Pout<< " Compared coord: " << pts1[faceI]
|
||||
Pout<< " Compared coord: " << pts1[facei]
|
||||
<< " at index " << j
|
||||
<< " with difference to point "
|
||||
<< mag(pts1[faceI] - pts0[face0I]) << endl;
|
||||
<< mag(pts1[facei] - pts0[face0I]) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
from0To1[face0I] = minFaceI;
|
||||
from0To1[face0I] = minFacei;
|
||||
}
|
||||
|
||||
return fullMatch;
|
||||
@ -187,7 +187,7 @@ bool Foam::matchPoints
|
||||
|
||||
// Go through range of equal mag and find nearest vector.
|
||||
scalar minDistSqr = VGREAT;
|
||||
label minFaceI = -1;
|
||||
label minFacei = -1;
|
||||
|
||||
// Valid candidate points should have opposite normal
|
||||
const scalar minDistNorm = 0;
|
||||
@ -202,16 +202,16 @@ bool Foam::matchPoints
|
||||
j++
|
||||
)
|
||||
{
|
||||
label faceI = pts1MagSqr.indices()[j];
|
||||
label facei = pts1MagSqr.indices()[j];
|
||||
// Compare actual vectors
|
||||
scalar distSqr = magSqr(pts0[face0I] - pts1[faceI]);
|
||||
scalar distSqr = magSqr(pts0[face0I] - pts1[facei]);
|
||||
|
||||
scalar distNorm = (pts0Dir[face0I] & pts1Dir[faceI]);
|
||||
scalar distNorm = (pts0Dir[face0I] & pts1Dir[facei]);
|
||||
|
||||
if
|
||||
(
|
||||
magSqr(pts0Dir[face0I]) < sqr(SMALL)
|
||||
&& magSqr(pts1Dir[faceI]) < sqr(SMALL)
|
||||
&& magSqr(pts1Dir[facei]) < sqr(SMALL)
|
||||
)
|
||||
{
|
||||
distNorm = -1;
|
||||
@ -223,12 +223,12 @@ bool Foam::matchPoints
|
||||
if (distNorm < minDistNorm)
|
||||
{
|
||||
minDistSqr = distSqr;
|
||||
minFaceI = faceI;
|
||||
minFacei = facei;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (minFaceI == -1)
|
||||
if (minFacei == -1)
|
||||
{
|
||||
fullMatch = false;
|
||||
|
||||
@ -251,17 +251,17 @@ bool Foam::matchPoints
|
||||
j++
|
||||
)
|
||||
{
|
||||
label faceI = pts1MagSqr.indices()[j];
|
||||
label facei = pts1MagSqr.indices()[j];
|
||||
|
||||
Pout<< " Compared coord: " << pts1[faceI]
|
||||
Pout<< " Compared coord: " << pts1[facei]
|
||||
<< " at index " << j
|
||||
<< " with difference to point "
|
||||
<< mag(pts1[faceI] - pts0[face0I]) << endl;
|
||||
<< mag(pts1[facei] - pts0[face0I]) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
from0To1[face0I] = minFaceI;
|
||||
from0To1[face0I] = minFacei;
|
||||
}
|
||||
|
||||
return fullMatch;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -73,9 +73,9 @@ Foam::label Foam::mergePoints
|
||||
const Field<Type> d(points - compareOrigin);
|
||||
|
||||
List<scalar> magSqrD(d.size());
|
||||
forAll(d, pointI)
|
||||
forAll(d, pointi)
|
||||
{
|
||||
magSqrD[pointI] = magSqr(d[pointI]);
|
||||
magSqrD[pointi] = magSqr(d[pointi]);
|
||||
}
|
||||
labelList order;
|
||||
sortedOrder(magSqrD, order);
|
||||
@ -84,42 +84,42 @@ Foam::label Foam::mergePoints
|
||||
Field<scalar> sortedTol(points.size());
|
||||
forAll(order, sortI)
|
||||
{
|
||||
label pointI = order[sortI];
|
||||
label pointi = order[sortI];
|
||||
|
||||
// Convert to scalar precision
|
||||
const point pt
|
||||
(
|
||||
scalar(d[pointI].x()),
|
||||
scalar(d[pointI].y()),
|
||||
scalar(d[pointI].z())
|
||||
scalar(d[pointi].x()),
|
||||
scalar(d[pointi].y()),
|
||||
scalar(d[pointi].z())
|
||||
);
|
||||
sortedTol[sortI] = 2*mergeTol*(mag(pt.x())+mag(pt.y())+mag(pt.z()));
|
||||
}
|
||||
|
||||
label newPointI = 0;
|
||||
label newPointi = 0;
|
||||
|
||||
|
||||
// Handle 0th point separately (is always unique)
|
||||
label pointI = order[0];
|
||||
pointMap[pointI] = newPointI++;
|
||||
label pointi = order[0];
|
||||
pointMap[pointi] = newPointi++;
|
||||
|
||||
|
||||
for (label sortI = 1; sortI < order.size(); sortI++)
|
||||
{
|
||||
// Get original point index
|
||||
label pointI = order[sortI];
|
||||
label pointi = order[sortI];
|
||||
const scalar mag2 = magSqrD[order[sortI]];
|
||||
// Convert to scalar precision
|
||||
const point pt
|
||||
(
|
||||
scalar(points[pointI].x()),
|
||||
scalar(points[pointI].y()),
|
||||
scalar(points[pointI].z())
|
||||
scalar(points[pointi].x()),
|
||||
scalar(points[pointi].y()),
|
||||
scalar(points[pointi].z())
|
||||
);
|
||||
|
||||
|
||||
// Compare to previous points to find equal one.
|
||||
label equalPointI = -1;
|
||||
label equalPointi = -1;
|
||||
|
||||
for
|
||||
(
|
||||
@ -129,46 +129,46 @@ Foam::label Foam::mergePoints
|
||||
prevSortI--
|
||||
)
|
||||
{
|
||||
label prevPointI = order[prevSortI];
|
||||
label prevPointi = order[prevSortI];
|
||||
const point prevPt
|
||||
(
|
||||
scalar(points[prevPointI].x()),
|
||||
scalar(points[prevPointI].y()),
|
||||
scalar(points[prevPointI].z())
|
||||
scalar(points[prevPointi].x()),
|
||||
scalar(points[prevPointi].y()),
|
||||
scalar(points[prevPointi].z())
|
||||
);
|
||||
|
||||
if (magSqr(pt - prevPt) <= mergeTolSqr)
|
||||
{
|
||||
// Found match.
|
||||
equalPointI = prevPointI;
|
||||
equalPointi = prevPointi;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (equalPointI != -1)
|
||||
if (equalPointi != -1)
|
||||
{
|
||||
// Same coordinate as equalPointI. Map to same new point.
|
||||
pointMap[pointI] = pointMap[equalPointI];
|
||||
// Same coordinate as equalPointi. Map to same new point.
|
||||
pointMap[pointi] = pointMap[equalPointi];
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Pout<< "Foam::mergePoints : Merging points "
|
||||
<< pointI << " and " << equalPointI
|
||||
<< " with coordinates:" << points[pointI]
|
||||
<< " and " << points[equalPointI]
|
||||
<< pointi << " and " << equalPointi
|
||||
<< " with coordinates:" << points[pointi]
|
||||
<< " and " << points[equalPointi]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Differs. Store new point.
|
||||
pointMap[pointI] = newPointI++;
|
||||
pointMap[pointi] = newPointi++;
|
||||
}
|
||||
}
|
||||
|
||||
return newPointI;
|
||||
return newPointi;
|
||||
}
|
||||
|
||||
|
||||
@ -193,9 +193,9 @@ bool Foam::mergePoints
|
||||
);
|
||||
|
||||
newPoints.setSize(nUnique);
|
||||
forAll(pointMap, pointI)
|
||||
forAll(pointMap, pointi)
|
||||
{
|
||||
newPoints[pointMap[pointI]] = points[pointI];
|
||||
newPoints[pointMap[pointi]] = points[pointi];
|
||||
}
|
||||
|
||||
return (nUnique != points.size());
|
||||
|
||||
Reference in New Issue
Block a user