Added distance to and index of closest surface patch to indexedVertex, using this to preform tests of near surface grading and refinement.

This commit is contained in:
graham 2009-02-19 18:01:13 +00:00
parent 7f2f779779
commit c09bbf8a25
3 changed files with 78 additions and 13 deletions

View File

@ -98,6 +98,10 @@ void Foam::CV3D::setVertexAlignmentDirections()
vector d = pHit.hitPoint() - vert;
vit->distanceToClosestSurface() = mag(d);
vit->indexOfClosestPatch() = qSurf_[pHit.index()].region();
tensor R = rotationTensor(vector(0,0,1), np);
label s = 36;
@ -1019,6 +1023,9 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
// Use the least similar of globalAlignmentDirs as the
// 2nd alignment and then generate the third.
Warning<< "Using supplementary globalAlignmentDirs."
<< endl;
scalar minDotProduct = 1+SMALL;
alignmentDirs.setSize(3);
@ -1048,6 +1055,8 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
}
else
{
Warning<< "Using all globalAlignmentDirs." << endl;
alignmentDirs = globalAlignmentDirs;
}
@ -1084,6 +1093,38 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
// targetCellSize *= 0.56222 - 0.413*midEdgeY;
scalar targetCellSizeA = targetCellSize;
scalar targetCellSizeB = targetCellSize;
if
(
vA->indexOfClosestPatch() == 1
&& vA->distanceToClosestSurface() < 0.03
)
{
targetCellSizeA *= 0.5;
}
else if (vA->indexOfClosestPatch() == 0)
{
targetCellSizeA *= 2;
}
if
(
vB->indexOfClosestPatch() == 1
&& vB->distanceToClosestSurface() < 0.03
)
{
targetCellSizeB *= 0.5;
}
else if (vB->indexOfClosestPatch() == 0)
{
targetCellSizeB *= 2;
}
targetCellSize = sqrt(targetCellSizeA * targetCellSizeB);
scalar targetFaceArea = targetCellSize*targetCellSize;
if (alignmentDotProd > cosAcceptanceAngle)

View File

@ -67,6 +67,10 @@ class indexedVertex
Foam::List<Foam::vector> alignmentDirections_;
Foam::scalar distanceToClosestSurface_;
Foam::label indexOfClosestPatch_;
public:
@ -94,7 +98,9 @@ public:
Vb(),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT),
alignmentDirections_(0)
alignmentDirections_(0),
distanceToClosestSurface_(-1),
indexOfClosestPatch_(-1)
{}
indexedVertex(const Point& p)
@ -102,7 +108,9 @@ public:
Vb(p),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT),
alignmentDirections_(0)
alignmentDirections_(0),
distanceToClosestSurface_(-1),
indexOfClosestPatch_(-1)
{}
indexedVertex(const Point& p, Cell_handle f)
@ -110,7 +118,9 @@ public:
Vb(f, p),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT),
alignmentDirections_(0)
alignmentDirections_(0),
distanceToClosestSurface_(-1),
indexOfClosestPatch_(-1)
{}
indexedVertex(Cell_handle f)
@ -118,7 +128,9 @@ public:
Vb(f),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT),
alignmentDirections_(0)
alignmentDirections_(0),
distanceToClosestSurface_(-1),
indexOfClosestPatch_(-1)
{}
@ -142,16 +154,26 @@ public:
return type_;
}
Foam::List<Foam::vector>& alignmentDirections()
inline Foam::List<Foam::vector>& alignmentDirections()
{
return alignmentDirections_;
}
const Foam::List<Foam::vector>& alignmentDirections() const
inline const Foam::List<Foam::vector>& alignmentDirections() const
{
return alignmentDirections_;
}
inline Foam::scalar& distanceToClosestSurface()
{
return distanceToClosestSurface_;
}
inline Foam::label& indexOfClosestPatch()
{
return indexOfClosestPatch_;
}
inline bool uninitialised() const
{
return type_ == INTERNAL_POINT && index_ == INTERNAL_POINT;

View File

@ -888,14 +888,16 @@ void Foam::CV3D::insertSurfaceNearestPointPairs()
if (edgePoints.size())
{
smoothEdgePositions(edgePoints, edgeLabels);
Warning<< "Edge point insertion disabled." << endl;
insertEdgePointGroups
(
edgePoints,
edgeLabels,
"surfaceNearestEdgePoints.obj"
);
// smoothEdgePositions(edgePoints, edgeLabels);
// insertEdgePointGroups
// (
// edgePoints,
// edgeLabels,
// "surfaceNearestEdgePoints.obj"
// );
}
}