mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: removing isSurfacePoint.
It was conceptually broken. The idea was that in certain cases, you knew that you were on the surface of the geometry (point pair distance queries for example) so didn't need to do a nearest-point-on-surface query. This was fine for a single surface, but when there were multiple surfaces, the first high-priority surface would return a size, even if the query point was miles away. To fix this would need a distance check, removing the point of the check altogether.
This commit is contained in:
@ -42,8 +42,7 @@ defineTypeNameAndDebug(cellSizeControlSurfaces, 0);
|
||||
bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
|
||||
(
|
||||
const point& pt,
|
||||
scalar& minSize,
|
||||
bool isSurfacePoint
|
||||
scalar& minSize
|
||||
) const
|
||||
{
|
||||
bool anyFunctionFound = false;
|
||||
@ -71,7 +70,7 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
|
||||
|
||||
// scalar sizeI;
|
||||
|
||||
// if (cSF.cellSize(pt, sizeI, isSurfacePoint))
|
||||
// if (cSF.cellSize(pt, sizeI))
|
||||
// {
|
||||
// anyFunctionFound = true;
|
||||
|
||||
@ -119,7 +118,7 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
|
||||
|
||||
scalar sizeI;
|
||||
|
||||
if (cSF.cellSize(pt, sizeI, isSurfacePoint))
|
||||
if (cSF.cellSize(pt, sizeI))
|
||||
{
|
||||
anyFunctionFound = true;
|
||||
|
||||
@ -280,18 +279,12 @@ Foam::cellSizeControlSurfaces::~cellSizeControlSurfaces()
|
||||
|
||||
Foam::scalar Foam::cellSizeControlSurfaces::cellSize
|
||||
(
|
||||
const point& pt,
|
||||
bool isSurfacePoint
|
||||
const point& pt
|
||||
) const
|
||||
{
|
||||
if (isSurfacePoint)
|
||||
{
|
||||
// Pout<< "WARNING: isSurfacePoint is broken!" << endl;
|
||||
}
|
||||
|
||||
scalar size = defaultCellSize_;
|
||||
|
||||
bool anyFunctionFound = evalCellSizeFunctions(pt, size, isSurfacePoint);
|
||||
bool anyFunctionFound = evalCellSizeFunctions(pt, size);
|
||||
|
||||
if (!anyFunctionFound)
|
||||
{
|
||||
@ -317,30 +310,12 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
|
||||
(
|
||||
"Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
|
||||
"("
|
||||
"const point& pt, "
|
||||
"bool isSurfacePoint"
|
||||
"const point& pt"
|
||||
") const"
|
||||
)
|
||||
<< "Point " << pt << " did not find a nearest surface point"
|
||||
<< nl << exit(FatalError) << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
|
||||
// "("
|
||||
// "const point& pt, "
|
||||
// "bool isSurfacePoint"
|
||||
// ") const"
|
||||
// )
|
||||
// << "Point " << pt
|
||||
// << " Cannot use isSurfacePoint here, or at all!"
|
||||
// << nl << exit(FatalError) << endl;
|
||||
|
||||
// Evaluating the cell size at the nearest surface
|
||||
evalCellSizeFunctions(surfHit.hitPoint(), size, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,31 +325,14 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
|
||||
|
||||
Foam::scalarField Foam::cellSizeControlSurfaces::cellSize
|
||||
(
|
||||
const pointField& pts,
|
||||
const List<bool>& isSurfacePoint
|
||||
const pointField& pts
|
||||
) const
|
||||
{
|
||||
if (pts.size() != isSurfacePoint.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::cellSizeControlSurfaces::cellSizeControlSurfaces \
|
||||
( \
|
||||
const pointField& pts, \
|
||||
const List<bool>& isSurfacePoint \
|
||||
) \
|
||||
const"
|
||||
) << "Size of pointField (" << pts.size()
|
||||
<< ") and List<bool> (" << isSurfacePoint.size()
|
||||
<< ") do not match." << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
scalarField cellSizes(pts.size());
|
||||
|
||||
forAll(pts, i)
|
||||
{
|
||||
cellSizes[i] = cellSize(pts[i], isSurfacePoint[i]);
|
||||
cellSizes[i] = cellSize(pts[i]);
|
||||
}
|
||||
|
||||
return cellSizes;
|
||||
|
||||
@ -84,8 +84,7 @@ class cellSizeControlSurfaces
|
||||
bool evalCellSizeFunctions
|
||||
(
|
||||
const point& pt,
|
||||
scalar& minSize,
|
||||
bool isSurfacePoint
|
||||
scalar& minSize
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -130,18 +129,10 @@ public:
|
||||
// Query
|
||||
|
||||
//- Return the cell size at the given location
|
||||
scalar cellSize
|
||||
(
|
||||
const point& pt,
|
||||
bool isSurfacePoint = false
|
||||
) const;
|
||||
scalar cellSize(const point& pt) const;
|
||||
|
||||
//- Return the cell size at the given locations
|
||||
scalarField cellSize
|
||||
(
|
||||
const pointField& pts,
|
||||
const List<bool>& isSurfacePoint
|
||||
) const;
|
||||
scalarField cellSize(const pointField& pts) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -174,8 +174,7 @@ public:
|
||||
virtual bool cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint = false
|
||||
scalar& size
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -68,17 +68,9 @@ scalar linearDistance::sizeFunction(scalar d) const
|
||||
bool linearDistance::cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint
|
||||
scalar& size
|
||||
) const
|
||||
{
|
||||
if (isSurfacePoint)
|
||||
{
|
||||
size = surfaceCellSize_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
size = 0;
|
||||
|
||||
List<pointIndexHit> hits;
|
||||
|
||||
@ -106,8 +106,7 @@ public:
|
||||
virtual bool cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint = false
|
||||
scalar& size
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -71,11 +71,10 @@ scalar linearSpatial::sizeFunction(const point& pt) const
|
||||
bool linearSpatial::cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint
|
||||
scalar& size
|
||||
) const
|
||||
{
|
||||
if (sideMode_ == rmBothsides || isSurfacePoint)
|
||||
if (sideMode_ == rmBothsides)
|
||||
{
|
||||
size = sizeFunction(pt);
|
||||
|
||||
|
||||
@ -104,8 +104,7 @@ public:
|
||||
virtual bool cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint = false
|
||||
scalar& size
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -139,17 +139,9 @@ scalar surfaceOffsetLinearDistance::sizeFunction(scalar d) const
|
||||
bool surfaceOffsetLinearDistance::cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint
|
||||
scalar& size
|
||||
) const
|
||||
{
|
||||
if (isSurfacePoint)
|
||||
{
|
||||
size = surfaceCellSize_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
size = 0;
|
||||
|
||||
List<pointIndexHit> hits;
|
||||
|
||||
@ -113,8 +113,7 @@ public:
|
||||
virtual bool cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint = false
|
||||
scalar& size
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -55,11 +55,10 @@ uniform::uniform
|
||||
bool uniform::cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint
|
||||
scalar& size
|
||||
) const
|
||||
{
|
||||
if (sideMode_ == rmBothsides || isSurfacePoint)
|
||||
if (sideMode_ == rmBothsides)
|
||||
{
|
||||
size = cellSize_;
|
||||
|
||||
|
||||
@ -88,8 +88,7 @@ public:
|
||||
virtual bool cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint = false
|
||||
scalar& size
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -57,17 +57,9 @@ uniformDistance::uniformDistance
|
||||
bool uniformDistance::cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint
|
||||
scalar& size
|
||||
) const
|
||||
{
|
||||
if (isSurfacePoint)
|
||||
{
|
||||
size = cellSize_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
size = 0;
|
||||
|
||||
List<pointIndexHit> hits;
|
||||
|
||||
@ -94,8 +94,7 @@ public:
|
||||
virtual bool cellSize
|
||||
(
|
||||
const point& pt,
|
||||
scalar& size,
|
||||
bool isSurfacePoint = false
|
||||
scalar& size
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -1483,8 +1483,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
||||
|
||||
storedSizes_[i] = cellSizeControl().cellSize
|
||||
(
|
||||
sizeAndAlignmentLocations_[i],
|
||||
false
|
||||
sizeAndAlignmentLocations_[i]
|
||||
);
|
||||
|
||||
storedAlignments_[i] = requiredAlignment(sizeAndAlignmentLocations_[i]);
|
||||
@ -1576,7 +1575,7 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
|
||||
|
||||
vit->alignment() = requiredAlignment(pt);
|
||||
|
||||
vit->targetCellSize() = cellSizeControl().cellSize(pt, false);
|
||||
vit->targetCellSize() = cellSizeControl().cellSize(pt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,11 +181,7 @@ private:
|
||||
//- Return the local target cell size at the given location. Takes
|
||||
// boolean argument to allow speed-up of queries if the point is going
|
||||
// to be on a surface.
|
||||
inline scalar targetCellSize
|
||||
(
|
||||
const Foam::point& pt,
|
||||
bool isSurfacePoint = false
|
||||
) const;
|
||||
inline scalar targetCellSize(const Foam::point& pt) const;
|
||||
|
||||
//- Return the target cell size from that stored on a pair of
|
||||
// Delaunay vertices, using a mean function.
|
||||
|
||||
@ -27,11 +27,10 @@ License
|
||||
|
||||
inline Foam::scalar Foam::conformalVoronoiMesh::targetCellSize
|
||||
(
|
||||
const Foam::point& pt,
|
||||
bool isSurfacePoint
|
||||
const Foam::point& pt
|
||||
) const
|
||||
{
|
||||
return cellSizeControl().cellSize(pt, isSurfacePoint);
|
||||
return cellSizeControl().cellSize(pt);
|
||||
}
|
||||
|
||||
|
||||
@ -139,10 +138,7 @@ inline Foam::scalar Foam::conformalVoronoiMesh::pointPairDistance
|
||||
const Foam::point& pt
|
||||
) const
|
||||
{
|
||||
// Point pair distances are always going to be at the surface, so the
|
||||
// targetCellSize can be told to do a quick, surface only check.
|
||||
|
||||
return targetCellSize(pt, true)*cvMeshControls().pointPairDistanceCoeff();
|
||||
return targetCellSize(pt)*cvMeshControls().pointPairDistanceCoeff();
|
||||
}
|
||||
|
||||
|
||||
@ -162,13 +158,10 @@ inline Foam::scalar Foam::conformalVoronoiMesh::featurePointExclusionDistanceSqr
|
||||
const Foam::point& pt
|
||||
) const
|
||||
{
|
||||
// Exclusion distance tests are always going to be at the surface, so the
|
||||
// targetCellSize can be told to do a quick, surface only check.
|
||||
|
||||
return
|
||||
sqr
|
||||
(
|
||||
targetCellSize(pt, true)
|
||||
targetCellSize(pt)
|
||||
*cvMeshControls().featurePointExclusionDistanceCoeff()
|
||||
);
|
||||
}
|
||||
@ -179,13 +172,10 @@ inline Foam::scalar Foam::conformalVoronoiMesh::featureEdgeExclusionDistanceSqr
|
||||
const Foam::point& pt
|
||||
) const
|
||||
{
|
||||
// Exclusion distance tests are always going to be at the surface, so the
|
||||
// targetCellSize can be told to do a quick, surface only check.
|
||||
|
||||
return
|
||||
sqr
|
||||
(
|
||||
targetCellSize(pt, true)
|
||||
targetCellSize(pt)
|
||||
*cvMeshControls().featureEdgeExclusionDistanceCoeff()
|
||||
);
|
||||
}
|
||||
|
||||
@ -339,11 +339,7 @@ bool Foam::autoDensity::fillBox
|
||||
|
||||
pointField corners(bb.points());
|
||||
|
||||
scalarField cornerSizes = cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
corners,
|
||||
List<bool>(8, false)
|
||||
);
|
||||
scalarField cornerSizes = cvMesh_.cellSizeControl().cellSize(corners);
|
||||
|
||||
Field<bool> insideCorners = combinedWellInside(corners, cornerSizes);
|
||||
|
||||
@ -452,11 +448,7 @@ bool Foam::autoDensity::fillBox
|
||||
);
|
||||
}
|
||||
|
||||
lineSizes = cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
linePoints,
|
||||
List<bool>(nLine, false)
|
||||
);
|
||||
lineSizes = cvMesh_.cellSizeControl().cellSize(linePoints);
|
||||
|
||||
Field<bool> insideLines = combinedWellInside
|
||||
(
|
||||
@ -557,8 +549,7 @@ bool Foam::autoDensity::fillBox
|
||||
|
||||
scalarField sampleSizes = cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
samplePoints,
|
||||
List<bool>(samplePoints.size(), false)
|
||||
samplePoints
|
||||
);
|
||||
|
||||
Field<bool> insidePoints = combinedWellInside
|
||||
|
||||
@ -167,11 +167,7 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
minimumSurfaceDistanceCoeffSqr_
|
||||
*sqr
|
||||
(
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
cvMesh_.cellSizeControl().cellSize(points)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -228,11 +228,7 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
minimumSurfaceDistanceCoeffSqr_
|
||||
*sqr
|
||||
(
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
cvMesh_.cellSizeControl().cellSize(points)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -134,11 +134,7 @@ std::list<Vb::Point> pointFile::initialPoints() const
|
||||
minimumSurfaceDistanceCoeffSqr_
|
||||
*sqr
|
||||
(
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
cvMesh_.cellSizeControl().cellSize(points)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -143,11 +143,7 @@ std::list<Vb::Point> uniformGrid::initialPoints() const
|
||||
minimumSurfaceDistanceCoeffSqr_
|
||||
*sqr
|
||||
(
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
cvMesh_.cellSizeControl().cellSize(points)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user