mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Moved edge processing to a separate function fed by blocks of edge points separated into individual lists. Fixed two logic errors in edge processing.
This commit is contained in:
@ -164,7 +164,12 @@ void Foam::CV3D::insertGrid()
|
|||||||
{
|
{
|
||||||
for (int k=0; k<nk; k++)
|
for (int k=0; k<nk; k++)
|
||||||
{
|
{
|
||||||
point p1 (x0 + i*delta.x(), y0 + j*delta.y(), z0 + k*delta.z());
|
point p1
|
||||||
|
(
|
||||||
|
x0 + i*delta.x(),
|
||||||
|
y0 + j*delta.y(),
|
||||||
|
z0 + k*delta.z()
|
||||||
|
);
|
||||||
|
|
||||||
point p2 = p1 + 0.5*delta;
|
point p2 = p1 + 0.5*delta;
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,6 @@ public:
|
|||||||
//- Square of span
|
//- Square of span
|
||||||
scalar span2;
|
scalar span2;
|
||||||
|
|
||||||
|
|
||||||
//- Minumum edge-length of the cell size below which protusions
|
//- Minumum edge-length of the cell size below which protusions
|
||||||
// through the surface are not split
|
// through the surface are not split
|
||||||
scalar minEdgeLen;
|
scalar minEdgeLen;
|
||||||
@ -148,6 +147,16 @@ public:
|
|||||||
//- point may not be placed
|
//- point may not be placed
|
||||||
scalar featurePointGuard;
|
scalar featurePointGuard;
|
||||||
|
|
||||||
|
//- Guard distance from a feature edge within which a surface control
|
||||||
|
//- point may not be placed
|
||||||
|
scalar featureEdgeGuard;
|
||||||
|
|
||||||
|
//- minimum and maximum distances along a feature edge allowed between
|
||||||
|
//- pairs of points. Eventually these should be able to adapt to local
|
||||||
|
//- grading requirements.
|
||||||
|
scalar minEdgeSpacing;
|
||||||
|
scalar maxEdgeSpacing;
|
||||||
|
|
||||||
tolerances
|
tolerances
|
||||||
(
|
(
|
||||||
const dictionary& controlDict,
|
const dictionary& controlDict,
|
||||||
@ -254,6 +263,13 @@ private:
|
|||||||
DynamicList<label>& edgeLabels
|
DynamicList<label>& edgeLabels
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
void smoothEdge
|
||||||
|
(
|
||||||
|
List<point>& edgePoints,
|
||||||
|
List<scalar>& edgeDistances,
|
||||||
|
const label edgeI
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Insert point-pairs at the nearest points on the surface to the
|
//- Insert point-pairs at the nearest points on the surface to the
|
||||||
// control vertex of dual-cells which intersect the boundary in order
|
// control vertex of dual-cells which intersect the boundary in order
|
||||||
// to provide a boundary-layer mesh.
|
// to provide a boundary-layer mesh.
|
||||||
|
|||||||
@ -194,19 +194,14 @@ void Foam::CV3D::smoothEdgePositions
|
|||||||
edgeDistances.transfer(copyEdgeDistances);
|
edgeDistances.transfer(copyEdgeDistances);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the points along each edge (in blocks of edgeLabel) performing 3
|
// Create a List to hold each edge, process them individually, then
|
||||||
// functions:
|
// recombine the edges into a single list.
|
||||||
// 1: move points away from feature points
|
|
||||||
// 2: aggregate tight groups of points into one point
|
|
||||||
// 3: adjust the spacing of remaining points on a pair by pair basis to
|
|
||||||
// remove excess points
|
|
||||||
|
|
||||||
// part 1
|
List<List<point> > edgePointIndividualLists(edgeLabelJumps.size());
|
||||||
|
|
||||||
{
|
List<List<scalar> > edgeDistanceIndividualLists(edgeLabelJumps.size());
|
||||||
DynamicList<point> tempEdgePoints(edgePoints.size());
|
|
||||||
|
|
||||||
DynamicList<label> tempEdgeLabels(edgeLabels.size());
|
List<label> edgeLabelIndividualList(edgeLabelJumps.size());
|
||||||
|
|
||||||
forAll(edgeLabelJumps, eLJ)
|
forAll(edgeLabelJumps, eLJ)
|
||||||
{
|
{
|
||||||
@ -225,9 +220,71 @@ void Foam::CV3D::smoothEdgePositions
|
|||||||
length = edgeLabelJumps[eLJ + 1] - start;
|
length = edgeLabelJumps[eLJ + 1] - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<point> edgePointBlock(SubList<point>(edgePoints, length, start));
|
edgePointIndividualLists[eLJ] = SubList<point>
|
||||||
|
(
|
||||||
|
edgePoints,
|
||||||
|
length,
|
||||||
|
start
|
||||||
|
);
|
||||||
|
|
||||||
List<scalar> edgeDistanceBlock(SubList<scalar>(edgeDistances, length, start));
|
edgeDistanceIndividualLists[eLJ] = SubList<scalar>
|
||||||
|
(
|
||||||
|
edgeDistances,
|
||||||
|
length,
|
||||||
|
start
|
||||||
|
);
|
||||||
|
|
||||||
|
edgeLabelIndividualList[eLJ] = edgeI;
|
||||||
|
}
|
||||||
|
|
||||||
|
edgePoints.clear();
|
||||||
|
edgeDistances.clear();
|
||||||
|
edgeLabels.clear();
|
||||||
|
|
||||||
|
forAll(edgeLabelIndividualList, e)
|
||||||
|
{
|
||||||
|
label edgeI = edgeLabelIndividualList[e];
|
||||||
|
|
||||||
|
smoothEdge
|
||||||
|
(
|
||||||
|
edgePointIndividualLists[e],
|
||||||
|
edgeDistanceIndividualLists[e],
|
||||||
|
edgeI
|
||||||
|
);
|
||||||
|
|
||||||
|
const List<point>& tempEdgePoints = edgePointIndividualLists[e];
|
||||||
|
|
||||||
|
forAll(tempEdgePoints, tEP)
|
||||||
|
{
|
||||||
|
edgePoints.append(tempEdgePoints[tEP]);
|
||||||
|
|
||||||
|
edgeLabels.append(edgeI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
edgePoints.shrink();
|
||||||
|
|
||||||
|
edgeLabels.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::CV3D::smoothEdge
|
||||||
|
(
|
||||||
|
List<point>& edgePoints,
|
||||||
|
List<scalar>& edgeDistances,
|
||||||
|
const label edgeI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const pointField& localPts = qSurf_.localPoints();
|
||||||
|
const edgeList& edges = qSurf_.edges();
|
||||||
|
|
||||||
|
// Process the points along each edge (in blocks of edgeLabel) performing 3
|
||||||
|
// functions:
|
||||||
|
// 1: move points away from feature points
|
||||||
|
// 2: aggregate tight groups of points into one point
|
||||||
|
// 3: adjust the spacing of remaining points on a pair by pair basis to
|
||||||
|
// remove excess points and add points to long uncontrolled spans.
|
||||||
|
|
||||||
const edge& e(edges[edgeI]);
|
const edge& e(edges[edgeI]);
|
||||||
|
|
||||||
@ -240,20 +297,27 @@ void Foam::CV3D::smoothEdgePositions
|
|||||||
if (edgeLength < 2*tols_.featurePointGuard)
|
if (edgeLength < 2*tols_.featurePointGuard)
|
||||||
{
|
{
|
||||||
Info<< "edge " << edgeI
|
Info<< "edge " << edgeI
|
||||||
<< " is too short with respect to the featurePointGuard distance "
|
<< " is too short with respect to the featurePointGuard "
|
||||||
<< "to allow edge control points to be placed."
|
<< "distance to allow edge control points to be placed."
|
||||||
<< nl << "Edge length = " << edgeLength
|
<< nl << "Edge length = " << edgeLength
|
||||||
<< nl <<endl;
|
<< nl <<endl;
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// part 1
|
||||||
forAll (edgeDistanceBlock, eDB)
|
|
||||||
{
|
{
|
||||||
|
DynamicList<point> tempEdgePoints;
|
||||||
|
|
||||||
bool startGuardPlaced = false;
|
bool startGuardPlaced = false;
|
||||||
|
|
||||||
bool endGuardPlaced = false;
|
bool endGuardPlaced = false;
|
||||||
|
|
||||||
const scalar& edgeDist = edgeDistanceBlock[eDB];
|
forAll (edgePoints, eP)
|
||||||
|
{
|
||||||
|
const point& edgePoint = edgePoints[eP];
|
||||||
|
|
||||||
|
const scalar& edgeDist = edgeDistances[eP];
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -263,12 +327,10 @@ void Foam::CV3D::smoothEdgePositions
|
|||||||
{
|
{
|
||||||
tempEdgePoints.append
|
tempEdgePoints.append
|
||||||
(
|
(
|
||||||
eStart + (edgePointBlock[eDB] - eStart)
|
eStart + (edgePoint - eStart)
|
||||||
* tols_.featurePointGuard/edgeDist
|
* tols_.featurePointGuard/edgeDist
|
||||||
);
|
);
|
||||||
|
|
||||||
tempEdgeLabels.append(edgeI);
|
|
||||||
|
|
||||||
startGuardPlaced = true;
|
startGuardPlaced = true;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
@ -279,117 +341,61 @@ void Foam::CV3D::smoothEdgePositions
|
|||||||
{
|
{
|
||||||
tempEdgePoints.append
|
tempEdgePoints.append
|
||||||
(
|
(
|
||||||
eEnd + (edgePointBlock[eDB] - eEnd)
|
eEnd + (edgePoint - eEnd)
|
||||||
* tols_.featurePointGuard/(edgeLength - edgeDist)
|
* tols_.featurePointGuard/(edgeLength - edgeDist)
|
||||||
);
|
);
|
||||||
|
|
||||||
tempEdgeLabels.append(edgeI);
|
|
||||||
|
|
||||||
endGuardPlaced = true;
|
endGuardPlaced = true;
|
||||||
}
|
}
|
||||||
else
|
else if
|
||||||
|
(
|
||||||
|
edgeDist > tols_.featurePointGuard
|
||||||
|
&& edgeDist < (edgeLength - tols_.featurePointGuard)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
tempEdgePoints.append(edgePointBlock[eDB]);
|
tempEdgePoints.append(edgePoint);
|
||||||
|
|
||||||
tempEdgeLabels.append(edgeI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
edgePoints.transfer(tempEdgePoints.shrink());
|
edgePoints.transfer(tempEdgePoints.shrink());
|
||||||
|
|
||||||
edgeLabels.transfer(tempEdgeLabels.shrink());
|
|
||||||
}
|
}
|
||||||
|
// Recalculate edge distances.
|
||||||
|
|
||||||
// If no points are left on the edges then do not progress any further.
|
|
||||||
|
|
||||||
if (!edgePoints.size())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Re-establish the correct distances and jumps
|
|
||||||
|
|
||||||
edgeDistances.clear();
|
|
||||||
|
|
||||||
edgeDistances.setSize(edgePoints.size());
|
edgeDistances.setSize(edgePoints.size());
|
||||||
|
|
||||||
forAll(edgeDistances, eD)
|
forAll(edgeDistances, eD)
|
||||||
{
|
{
|
||||||
const point& edgeStart = localPts[edges[edgeLabels[eD]].start()];
|
edgeDistances[eD] = mag(eStart - edgePoints[eD]);
|
||||||
|
|
||||||
edgeDistances[eD] = mag(edgeStart - edgePoints[eD]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeLabelJumps.clear();
|
|
||||||
|
|
||||||
// Force first edgeLabel to be a jump
|
|
||||||
edgeLabelJumps.append(0);
|
|
||||||
|
|
||||||
for (label eL = 1; eL < edgeLabels.size(); eL++)
|
|
||||||
{
|
|
||||||
if (edgeLabels[eL] > edgeLabels[eL-1])
|
|
||||||
{
|
|
||||||
edgeLabelJumps.append(eL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
edgeLabelJumps.shrink();
|
|
||||||
|
|
||||||
// part 2
|
// part 2
|
||||||
{
|
{
|
||||||
DynamicList<point> tempEdgePoints(edgePoints.size());
|
DynamicList<point> tempEdgePoints;
|
||||||
|
|
||||||
DynamicList<label> tempEdgeLabels(edgeLabels.size());
|
|
||||||
|
|
||||||
forAll(edgeLabelJumps, eLJ)
|
|
||||||
{
|
|
||||||
label start = edgeLabelJumps[eLJ];
|
|
||||||
|
|
||||||
label edgeI = edgeLabels[start];
|
|
||||||
|
|
||||||
label length;
|
|
||||||
|
|
||||||
if (eLJ == edgeLabelJumps.size() - 1)
|
|
||||||
{
|
|
||||||
length = edgeLabels.size() - start;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
length = edgeLabelJumps[eLJ + 1] - start;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<point> edgePointBlock(SubList<point>(edgePoints, length, start));
|
|
||||||
|
|
||||||
List<scalar> edgeDistanceBlock(SubList<scalar>(edgeDistances, length, start));
|
|
||||||
|
|
||||||
label groupSize = 0;
|
label groupSize = 0;
|
||||||
|
|
||||||
point newEdgePoint(vector::zero);
|
point newEdgePoint(vector::zero);
|
||||||
|
|
||||||
if (edgeDistanceBlock.size() == 1)
|
if (edgePoints.size() == 1)
|
||||||
{
|
{
|
||||||
tempEdgePoints.append(edgePointBlock[0]);
|
tempEdgePoints.append(edgePoints[0]);
|
||||||
|
|
||||||
tempEdgeLabels.append(edgeI);
|
|
||||||
}
|
}
|
||||||
else if ((edgeDistanceBlock[1] - edgeDistanceBlock[0]) > tols_.edgeGroupSpacing)
|
else if
|
||||||
|
(
|
||||||
|
(edgeDistances[1] - edgeDistances[0]) > tols_.edgeGroupSpacing
|
||||||
|
)
|
||||||
{
|
{
|
||||||
tempEdgePoints.append(edgePointBlock[0]);
|
tempEdgePoints.append(edgePoints[0]);
|
||||||
|
|
||||||
tempEdgeLabels.append(edgeI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (label eDB = 1; eDB < edgeDistanceBlock.size(); eDB++)
|
for (label eP = 1; eP < edgePoints.size(); eP++)
|
||||||
{
|
{
|
||||||
const scalar& edgeDist = edgeDistanceBlock[eDB];
|
const scalar& edgeDist = edgeDistances[eP];
|
||||||
const scalar& previousEdgeDist = edgeDistanceBlock[eDB - 1];
|
const scalar& previousEdgeDist = edgeDistances[eP - 1];
|
||||||
|
|
||||||
if ((edgeDist - previousEdgeDist) < tols_.edgeGroupSpacing)
|
if ((edgeDist - previousEdgeDist) < tols_.edgeGroupSpacing)
|
||||||
{
|
{
|
||||||
newEdgePoint += edgePointBlock[eDB];
|
newEdgePoint += edgePoints[eP];
|
||||||
|
|
||||||
groupSize++;
|
groupSize++;
|
||||||
}
|
}
|
||||||
@ -401,26 +407,254 @@ void Foam::CV3D::smoothEdgePositions
|
|||||||
|
|
||||||
tempEdgePoints.append(newEdgePoint);
|
tempEdgePoints.append(newEdgePoint);
|
||||||
|
|
||||||
tempEdgeLabels.append(edgeI);
|
|
||||||
|
|
||||||
newEdgePoint = vector::zero;
|
newEdgePoint = vector::zero;
|
||||||
|
|
||||||
groupSize = 0;
|
groupSize = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tempEdgePoints.append(edgePointBlock[eDB]);
|
tempEdgePoints.append(edgePoints[eP]);
|
||||||
|
|
||||||
tempEdgeLabels.append(edgeI);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
edgePoints.transfer(tempEdgePoints.shrink());
|
edgePoints.transfer(tempEdgePoints.shrink());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
edgeLabels.transfer(tempEdgeLabels.shrink());
|
|
||||||
}
|
// {
|
||||||
}
|
// DynamicList<point> tempEdgePoints(edgePoints.size());
|
||||||
|
|
||||||
|
// DynamicList<label> tempEdgeLabels(edgeLabels.size());
|
||||||
|
|
||||||
|
// forAll(edgeLabelJumps, eLJ)
|
||||||
|
// {
|
||||||
|
// label start = edgeLabelJumps[eLJ];
|
||||||
|
|
||||||
|
// label edgeI = edgeLabels[start];
|
||||||
|
|
||||||
|
// label length;
|
||||||
|
|
||||||
|
// if (eLJ == edgeLabelJumps.size() - 1)
|
||||||
|
// {
|
||||||
|
// length = edgeLabels.size() - start;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// length = edgeLabelJumps[eLJ + 1] - start;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// List<point> edgePointBlock
|
||||||
|
// (
|
||||||
|
// SubList<point>(edgePoints, length, start)
|
||||||
|
// );
|
||||||
|
|
||||||
|
// List<scalar> edgeDistanceBlock
|
||||||
|
// (
|
||||||
|
// SubList<scalar>(edgeDistances, length, start)
|
||||||
|
// );
|
||||||
|
|
||||||
|
// const edge& e(edges[edgeI]);
|
||||||
|
|
||||||
|
// const point& eStart(localPts[e.start()]);
|
||||||
|
|
||||||
|
// const point& eEnd(localPts[e.end()]);
|
||||||
|
|
||||||
|
// scalar edgeLength = mag(eStart - eEnd);
|
||||||
|
|
||||||
|
// if (edgeLength < 2*tols_.featurePointGuard)
|
||||||
|
// {
|
||||||
|
// Info<< "edge " << edgeI
|
||||||
|
// << " is too short with respect to the featurePointGuard "
|
||||||
|
// << "distance to allow edge control points to be placed."
|
||||||
|
// << nl << "Edge length = " << edgeLength
|
||||||
|
// << nl <<endl;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// forAll (edgeDistanceBlock, eDB)
|
||||||
|
// {
|
||||||
|
// bool startGuardPlaced = false;
|
||||||
|
|
||||||
|
// bool endGuardPlaced = false;
|
||||||
|
|
||||||
|
// const scalar& edgeDist = edgeDistanceBlock[eDB];
|
||||||
|
|
||||||
|
// if
|
||||||
|
// (
|
||||||
|
// edgeDist < tols_.featurePointGuard
|
||||||
|
// && !startGuardPlaced
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// tempEdgePoints.append
|
||||||
|
// (
|
||||||
|
// eStart + (edgePointBlock[eDB] - eStart)
|
||||||
|
// * tols_.featurePointGuard/edgeDist
|
||||||
|
// );
|
||||||
|
|
||||||
|
// tempEdgeLabels.append(edgeI);
|
||||||
|
|
||||||
|
// startGuardPlaced = true;
|
||||||
|
// }
|
||||||
|
// else if
|
||||||
|
// (
|
||||||
|
// edgeDist > (edgeLength - tols_.featurePointGuard)
|
||||||
|
// && !endGuardPlaced
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// tempEdgePoints.append
|
||||||
|
// (
|
||||||
|
// eEnd + (edgePointBlock[eDB] - eEnd)
|
||||||
|
// * tols_.featurePointGuard/(edgeLength - edgeDist)
|
||||||
|
// );
|
||||||
|
|
||||||
|
// tempEdgeLabels.append(edgeI);
|
||||||
|
|
||||||
|
// endGuardPlaced = true;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// tempEdgePoints.append(edgePointBlock[eDB]);
|
||||||
|
|
||||||
|
// tempEdgeLabels.append(edgeI);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// edgePoints.transfer(tempEdgePoints.shrink());
|
||||||
|
|
||||||
|
// edgeLabels.transfer(tempEdgeLabels.shrink());
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// // If no points are left on the edges then do not progress any further.
|
||||||
|
|
||||||
|
// if (!edgePoints.size())
|
||||||
|
// {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Re-establish the correct distances and jumps
|
||||||
|
|
||||||
|
// edgeDistances.clear();
|
||||||
|
|
||||||
|
// edgeDistances.setSize(edgePoints.size());
|
||||||
|
|
||||||
|
// forAll(edgeDistances, eD)
|
||||||
|
// {
|
||||||
|
// const point& edgeStart = localPts[edges[edgeLabels[eD]].start()];
|
||||||
|
|
||||||
|
// edgeDistances[eD] = mag(edgeStart - edgePoints[eD]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// edgeLabelJumps.clear();
|
||||||
|
|
||||||
|
// // Force first edgeLabel to be a jump
|
||||||
|
// edgeLabelJumps.append(0);
|
||||||
|
|
||||||
|
// for (label eL = 1; eL < edgeLabels.size(); eL++)
|
||||||
|
// {
|
||||||
|
// if (edgeLabels[eL] > edgeLabels[eL-1])
|
||||||
|
// {
|
||||||
|
// edgeLabelJumps.append(eL);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// edgeLabelJumps.shrink();
|
||||||
|
|
||||||
|
// // part 2
|
||||||
|
// {
|
||||||
|
// DynamicList<point> tempEdgePoints(edgePoints.size());
|
||||||
|
|
||||||
|
// DynamicList<label> tempEdgeLabels(edgeLabels.size());
|
||||||
|
|
||||||
|
// forAll(edgeLabelJumps, eLJ)
|
||||||
|
// {
|
||||||
|
// label start = edgeLabelJumps[eLJ];
|
||||||
|
|
||||||
|
// label edgeI = edgeLabels[start];
|
||||||
|
|
||||||
|
// label length;
|
||||||
|
|
||||||
|
// if (eLJ == edgeLabelJumps.size() - 1)
|
||||||
|
// {
|
||||||
|
// length = edgeLabels.size() - start;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// length = edgeLabelJumps[eLJ + 1] - start;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// List<point> edgePointBlock
|
||||||
|
// (
|
||||||
|
// SubList<point>(edgePoints, length, start)
|
||||||
|
// );
|
||||||
|
|
||||||
|
// List<scalar> edgeDistanceBlock
|
||||||
|
// (
|
||||||
|
// SubList<scalar>(edgeDistances, length, start)
|
||||||
|
// );
|
||||||
|
|
||||||
|
// label groupSize = 0;
|
||||||
|
|
||||||
|
// point newEdgePoint(vector::zero);
|
||||||
|
|
||||||
|
// if (edgeDistanceBlock.size() == 1)
|
||||||
|
// {
|
||||||
|
// tempEdgePoints.append(edgePointBlock[0]);
|
||||||
|
|
||||||
|
// tempEdgeLabels.append(edgeI);
|
||||||
|
// }
|
||||||
|
// else if
|
||||||
|
// (
|
||||||
|
// (edgeDistanceBlock[1] - edgeDistanceBlock[0])
|
||||||
|
// > tols_.edgeGroupSpacing)
|
||||||
|
// {
|
||||||
|
// tempEdgePoints.append(edgePointBlock[0]);
|
||||||
|
|
||||||
|
// tempEdgeLabels.append(edgeI);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// for (label eDB = 1; eDB < edgeDistanceBlock.size(); eDB++)
|
||||||
|
// {
|
||||||
|
// const scalar& edgeDist = edgeDistanceBlock[eDB];
|
||||||
|
// const scalar& previousEdgeDist = edgeDistanceBlock[eDB - 1];
|
||||||
|
|
||||||
|
// if ((edgeDist - previousEdgeDist) < tols_.edgeGroupSpacing)
|
||||||
|
// {
|
||||||
|
// newEdgePoint += edgePointBlock[eDB];
|
||||||
|
|
||||||
|
// groupSize++;
|
||||||
|
// }
|
||||||
|
// else if (groupSize > 0)
|
||||||
|
// {
|
||||||
|
// // A point group has been formed and has finished
|
||||||
|
|
||||||
|
// newEdgePoint /= groupSize;
|
||||||
|
|
||||||
|
// tempEdgePoints.append(newEdgePoint);
|
||||||
|
|
||||||
|
// tempEdgeLabels.append(edgeI);
|
||||||
|
|
||||||
|
// newEdgePoint = vector::zero;
|
||||||
|
|
||||||
|
// groupSize = 0;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// tempEdgePoints.append(edgePointBlock[eDB]);
|
||||||
|
|
||||||
|
// tempEdgeLabels.append(edgeI);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// edgePoints.transfer(tempEdgePoints.shrink());
|
||||||
|
|
||||||
|
// edgeLabels.transfer(tempEdgeLabels.shrink());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
void Foam::CV3D::insertPointPairs
|
void Foam::CV3D::insertPointPairs
|
||||||
@ -697,10 +931,9 @@ void Foam::CV3D::insertSurfaceNearestPointPairs()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicList<point> nearSurfacePoints(nSurfacePointsEst);
|
DynamicList<point> allNearSurfacePoints(nSurfacePointsEst);
|
||||||
|
DynamicList<point> allSurfacePoints(nSurfacePointsEst);
|
||||||
DynamicList<point> surfacePoints(nSurfacePointsEst);
|
DynamicList<label> allSurfaceTris(nSurfacePointsEst);
|
||||||
DynamicList<label> surfaceTris(nSurfacePointsEst);
|
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
@ -725,14 +958,44 @@ void Foam::CV3D::insertSurfaceNearestPointPairs()
|
|||||||
|
|
||||||
if (dualCellSurfaceIntersection(vit))
|
if (dualCellSurfaceIntersection(vit))
|
||||||
{
|
{
|
||||||
nearSurfacePoints.append(vert);
|
allNearSurfacePoints.append(vert);
|
||||||
surfacePoints.append(pHit.hitPoint());
|
allSurfacePoints.append(pHit.hitPoint());
|
||||||
surfaceTris.append(pHit.index());
|
allSurfaceTris.append(pHit.index());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pointField surfacePointsForEdges(allSurfacePoints.shrink());
|
||||||
|
|
||||||
|
labelList allEdgeLabels;
|
||||||
|
labelList allEdgeEndPoints;
|
||||||
|
pointField allEdgePoints;
|
||||||
|
|
||||||
|
qSurf_.features().nearestSurfEdge
|
||||||
|
(
|
||||||
|
qSurf_.features().featureEdges(),
|
||||||
|
surfacePointsForEdges,
|
||||||
|
vector::one * 2.0 * tols_.featureEdgeGuard,
|
||||||
|
allEdgeLabels,
|
||||||
|
allEdgeEndPoints,
|
||||||
|
allEdgePoints
|
||||||
|
);
|
||||||
|
|
||||||
|
DynamicList<point> nearSurfacePoints(nSurfacePointsEst);
|
||||||
|
DynamicList<point> surfacePoints(nSurfacePointsEst);
|
||||||
|
DynamicList<label> surfaceTris(nSurfacePointsEst);
|
||||||
|
|
||||||
|
forAll(allEdgePoints, eP)
|
||||||
|
{
|
||||||
|
if (allEdgeLabels[eP] == -1)
|
||||||
|
{
|
||||||
|
nearSurfacePoints.append(allNearSurfacePoints[eP]);
|
||||||
|
surfacePoints.append(allSurfacePoints[eP]);
|
||||||
|
surfaceTris.append(allSurfaceTris[eP]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nearSurfacePoints.shrink();
|
nearSurfacePoints.shrink();
|
||||||
surfacePoints.shrink();
|
surfacePoints.shrink();
|
||||||
surfaceTris.shrink();
|
surfaceTris.shrink();
|
||||||
|
|||||||
@ -57,6 +57,20 @@ Foam::CV3D::tolerances::tolerances
|
|||||||
featurePointGuard
|
featurePointGuard
|
||||||
(
|
(
|
||||||
readScalar(controlDict.lookup("featurePointGuardCoeff"))*minCellSize
|
readScalar(controlDict.lookup("featurePointGuardCoeff"))*minCellSize
|
||||||
|
),
|
||||||
|
|
||||||
|
featureEdgeGuard
|
||||||
|
(
|
||||||
|
readScalar(controlDict.lookup("featureEdgeGuardCoeff"))*minCellSize
|
||||||
|
),
|
||||||
|
|
||||||
|
minEdgeSpacing
|
||||||
|
(
|
||||||
|
readScalar(controlDict.lookup("minEdgeSpacingCoeff"))*minCellSize
|
||||||
|
),
|
||||||
|
maxEdgeSpacing
|
||||||
|
(
|
||||||
|
readScalar(controlDict.lookup("maxEdgeSpacingCoeff"))*minCellSize
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user