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
|
bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& minSize,
|
scalar& minSize
|
||||||
bool isSurfacePoint
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
bool anyFunctionFound = false;
|
bool anyFunctionFound = false;
|
||||||
@ -71,7 +70,7 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
|
|||||||
|
|
||||||
// scalar sizeI;
|
// scalar sizeI;
|
||||||
|
|
||||||
// if (cSF.cellSize(pt, sizeI, isSurfacePoint))
|
// if (cSF.cellSize(pt, sizeI))
|
||||||
// {
|
// {
|
||||||
// anyFunctionFound = true;
|
// anyFunctionFound = true;
|
||||||
|
|
||||||
@ -119,7 +118,7 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
|
|||||||
|
|
||||||
scalar sizeI;
|
scalar sizeI;
|
||||||
|
|
||||||
if (cSF.cellSize(pt, sizeI, isSurfacePoint))
|
if (cSF.cellSize(pt, sizeI))
|
||||||
{
|
{
|
||||||
anyFunctionFound = true;
|
anyFunctionFound = true;
|
||||||
|
|
||||||
@ -280,18 +279,12 @@ Foam::cellSizeControlSurfaces::~cellSizeControlSurfaces()
|
|||||||
|
|
||||||
Foam::scalar Foam::cellSizeControlSurfaces::cellSize
|
Foam::scalar Foam::cellSizeControlSurfaces::cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt
|
||||||
bool isSurfacePoint
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (isSurfacePoint)
|
|
||||||
{
|
|
||||||
// Pout<< "WARNING: isSurfacePoint is broken!" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
scalar size = defaultCellSize_;
|
scalar size = defaultCellSize_;
|
||||||
|
|
||||||
bool anyFunctionFound = evalCellSizeFunctions(pt, size, isSurfacePoint);
|
bool anyFunctionFound = evalCellSizeFunctions(pt, size);
|
||||||
|
|
||||||
if (!anyFunctionFound)
|
if (!anyFunctionFound)
|
||||||
{
|
{
|
||||||
@ -317,30 +310,12 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
|
|||||||
(
|
(
|
||||||
"Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
|
"Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
|
||||||
"("
|
"("
|
||||||
"const point& pt, "
|
"const point& pt"
|
||||||
"bool isSurfacePoint"
|
|
||||||
") const"
|
") const"
|
||||||
)
|
)
|
||||||
<< "Point " << pt << " did not find a nearest surface point"
|
<< "Point " << pt << " did not find a nearest surface point"
|
||||||
<< nl << exit(FatalError) << endl;
|
<< 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
|
Foam::scalarField Foam::cellSizeControlSurfaces::cellSize
|
||||||
(
|
(
|
||||||
const pointField& pts,
|
const pointField& pts
|
||||||
const List<bool>& isSurfacePoint
|
|
||||||
) const
|
) 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());
|
scalarField cellSizes(pts.size());
|
||||||
|
|
||||||
forAll(pts, i)
|
forAll(pts, i)
|
||||||
{
|
{
|
||||||
cellSizes[i] = cellSize(pts[i], isSurfacePoint[i]);
|
cellSizes[i] = cellSize(pts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cellSizes;
|
return cellSizes;
|
||||||
|
|||||||
@ -84,8 +84,7 @@ class cellSizeControlSurfaces
|
|||||||
bool evalCellSizeFunctions
|
bool evalCellSizeFunctions
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& minSize,
|
scalar& minSize
|
||||||
bool isSurfacePoint
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -130,18 +129,10 @@ public:
|
|||||||
// Query
|
// Query
|
||||||
|
|
||||||
//- Return the cell size at the given location
|
//- Return the cell size at the given location
|
||||||
scalar cellSize
|
scalar cellSize(const point& pt) const;
|
||||||
(
|
|
||||||
const point& pt,
|
|
||||||
bool isSurfacePoint = false
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Return the cell size at the given locations
|
//- Return the cell size at the given locations
|
||||||
scalarField cellSize
|
scalarField cellSize(const pointField& pts) const;
|
||||||
(
|
|
||||||
const pointField& pts,
|
|
||||||
const List<bool>& isSurfacePoint
|
|
||||||
) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -174,8 +174,7 @@ public:
|
|||||||
virtual bool cellSize
|
virtual bool cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint = false
|
|
||||||
) const = 0;
|
) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -68,17 +68,9 @@ scalar linearDistance::sizeFunction(scalar d) const
|
|||||||
bool linearDistance::cellSize
|
bool linearDistance::cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (isSurfacePoint)
|
|
||||||
{
|
|
||||||
size = surfaceCellSize_;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
List<pointIndexHit> hits;
|
List<pointIndexHit> hits;
|
||||||
|
|||||||
@ -106,8 +106,7 @@ public:
|
|||||||
virtual bool cellSize
|
virtual bool cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint = false
|
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -71,11 +71,10 @@ scalar linearSpatial::sizeFunction(const point& pt) const
|
|||||||
bool linearSpatial::cellSize
|
bool linearSpatial::cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (sideMode_ == rmBothsides || isSurfacePoint)
|
if (sideMode_ == rmBothsides)
|
||||||
{
|
{
|
||||||
size = sizeFunction(pt);
|
size = sizeFunction(pt);
|
||||||
|
|
||||||
|
|||||||
@ -104,8 +104,7 @@ public:
|
|||||||
virtual bool cellSize
|
virtual bool cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint = false
|
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -139,17 +139,9 @@ scalar surfaceOffsetLinearDistance::sizeFunction(scalar d) const
|
|||||||
bool surfaceOffsetLinearDistance::cellSize
|
bool surfaceOffsetLinearDistance::cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (isSurfacePoint)
|
|
||||||
{
|
|
||||||
size = surfaceCellSize_;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
List<pointIndexHit> hits;
|
List<pointIndexHit> hits;
|
||||||
|
|||||||
@ -113,8 +113,7 @@ public:
|
|||||||
virtual bool cellSize
|
virtual bool cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint = false
|
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -55,11 +55,10 @@ uniform::uniform
|
|||||||
bool uniform::cellSize
|
bool uniform::cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (sideMode_ == rmBothsides || isSurfacePoint)
|
if (sideMode_ == rmBothsides)
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = cellSize_;
|
||||||
|
|
||||||
|
|||||||
@ -88,8 +88,7 @@ public:
|
|||||||
virtual bool cellSize
|
virtual bool cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint = false
|
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -57,17 +57,9 @@ uniformDistance::uniformDistance
|
|||||||
bool uniformDistance::cellSize
|
bool uniformDistance::cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (isSurfacePoint)
|
|
||||||
{
|
|
||||||
size = cellSize_;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
List<pointIndexHit> hits;
|
List<pointIndexHit> hits;
|
||||||
|
|||||||
@ -94,8 +94,7 @@ public:
|
|||||||
virtual bool cellSize
|
virtual bool cellSize
|
||||||
(
|
(
|
||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size,
|
scalar& size
|
||||||
bool isSurfacePoint = false
|
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1483,8 +1483,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
|||||||
|
|
||||||
storedSizes_[i] = cellSizeControl().cellSize
|
storedSizes_[i] = cellSizeControl().cellSize
|
||||||
(
|
(
|
||||||
sizeAndAlignmentLocations_[i],
|
sizeAndAlignmentLocations_[i]
|
||||||
false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
storedAlignments_[i] = requiredAlignment(sizeAndAlignmentLocations_[i]);
|
storedAlignments_[i] = requiredAlignment(sizeAndAlignmentLocations_[i]);
|
||||||
@ -1576,7 +1575,7 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
|
|||||||
|
|
||||||
vit->alignment() = requiredAlignment(pt);
|
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
|
//- Return the local target cell size at the given location. Takes
|
||||||
// boolean argument to allow speed-up of queries if the point is going
|
// boolean argument to allow speed-up of queries if the point is going
|
||||||
// to be on a surface.
|
// to be on a surface.
|
||||||
inline scalar targetCellSize
|
inline scalar targetCellSize(const Foam::point& pt) const;
|
||||||
(
|
|
||||||
const Foam::point& pt,
|
|
||||||
bool isSurfacePoint = false
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Return the target cell size from that stored on a pair of
|
//- Return the target cell size from that stored on a pair of
|
||||||
// Delaunay vertices, using a mean function.
|
// Delaunay vertices, using a mean function.
|
||||||
|
|||||||
@ -27,11 +27,10 @@ License
|
|||||||
|
|
||||||
inline Foam::scalar Foam::conformalVoronoiMesh::targetCellSize
|
inline Foam::scalar Foam::conformalVoronoiMesh::targetCellSize
|
||||||
(
|
(
|
||||||
const Foam::point& pt,
|
const Foam::point& pt
|
||||||
bool isSurfacePoint
|
|
||||||
) const
|
) 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 Foam::point& pt
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Point pair distances are always going to be at the surface, so the
|
return targetCellSize(pt)*cvMeshControls().pointPairDistanceCoeff();
|
||||||
// targetCellSize can be told to do a quick, surface only check.
|
|
||||||
|
|
||||||
return targetCellSize(pt, true)*cvMeshControls().pointPairDistanceCoeff();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,13 +158,10 @@ inline Foam::scalar Foam::conformalVoronoiMesh::featurePointExclusionDistanceSqr
|
|||||||
const Foam::point& pt
|
const Foam::point& pt
|
||||||
) const
|
) 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
|
return
|
||||||
sqr
|
sqr
|
||||||
(
|
(
|
||||||
targetCellSize(pt, true)
|
targetCellSize(pt)
|
||||||
*cvMeshControls().featurePointExclusionDistanceCoeff()
|
*cvMeshControls().featurePointExclusionDistanceCoeff()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -179,13 +172,10 @@ inline Foam::scalar Foam::conformalVoronoiMesh::featureEdgeExclusionDistanceSqr
|
|||||||
const Foam::point& pt
|
const Foam::point& pt
|
||||||
) const
|
) 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
|
return
|
||||||
sqr
|
sqr
|
||||||
(
|
(
|
||||||
targetCellSize(pt, true)
|
targetCellSize(pt)
|
||||||
*cvMeshControls().featureEdgeExclusionDistanceCoeff()
|
*cvMeshControls().featureEdgeExclusionDistanceCoeff()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -339,11 +339,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
|
|
||||||
pointField corners(bb.points());
|
pointField corners(bb.points());
|
||||||
|
|
||||||
scalarField cornerSizes = cvMesh_.cellSizeControl().cellSize
|
scalarField cornerSizes = cvMesh_.cellSizeControl().cellSize(corners);
|
||||||
(
|
|
||||||
corners,
|
|
||||||
List<bool>(8, false)
|
|
||||||
);
|
|
||||||
|
|
||||||
Field<bool> insideCorners = combinedWellInside(corners, cornerSizes);
|
Field<bool> insideCorners = combinedWellInside(corners, cornerSizes);
|
||||||
|
|
||||||
@ -452,11 +448,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
lineSizes = cvMesh_.cellSizeControl().cellSize
|
lineSizes = cvMesh_.cellSizeControl().cellSize(linePoints);
|
||||||
(
|
|
||||||
linePoints,
|
|
||||||
List<bool>(nLine, false)
|
|
||||||
);
|
|
||||||
|
|
||||||
Field<bool> insideLines = combinedWellInside
|
Field<bool> insideLines = combinedWellInside
|
||||||
(
|
(
|
||||||
@ -557,8 +549,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
|
|
||||||
scalarField sampleSizes = cvMesh_.cellSizeControl().cellSize
|
scalarField sampleSizes = cvMesh_.cellSizeControl().cellSize
|
||||||
(
|
(
|
||||||
samplePoints,
|
samplePoints
|
||||||
List<bool>(samplePoints.size(), false)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Field<bool> insidePoints = combinedWellInside
|
Field<bool> insidePoints = combinedWellInside
|
||||||
|
|||||||
@ -167,11 +167,7 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
|||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
*sqr
|
*sqr
|
||||||
(
|
(
|
||||||
cvMesh_.cellSizeControl().cellSize
|
cvMesh_.cellSizeControl().cellSize(points)
|
||||||
(
|
|
||||||
points,
|
|
||||||
List<bool>(points.size(), false)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -228,11 +228,7 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
|||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
*sqr
|
*sqr
|
||||||
(
|
(
|
||||||
cvMesh_.cellSizeControl().cellSize
|
cvMesh_.cellSizeControl().cellSize(points)
|
||||||
(
|
|
||||||
points,
|
|
||||||
List<bool>(points.size(), false)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -134,11 +134,7 @@ std::list<Vb::Point> pointFile::initialPoints() const
|
|||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
*sqr
|
*sqr
|
||||||
(
|
(
|
||||||
cvMesh_.cellSizeControl().cellSize
|
cvMesh_.cellSizeControl().cellSize(points)
|
||||||
(
|
|
||||||
points,
|
|
||||||
List<bool>(points.size(), false)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -143,11 +143,7 @@ std::list<Vb::Point> uniformGrid::initialPoints() const
|
|||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
*sqr
|
*sqr
|
||||||
(
|
(
|
||||||
cvMesh_.cellSizeControl().cellSize
|
cvMesh_.cellSizeControl().cellSize(points)
|
||||||
(
|
|
||||||
points,
|
|
||||||
List<bool>(points.size(), false)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user