mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamyHexMesh: Check moved internal points are inside the geometry before inserting them
This commit is contained in:
@ -562,7 +562,7 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
|
|||||||
{
|
{
|
||||||
if (vit->internalOrBoundaryPoint())
|
if (vit->internalOrBoundaryPoint())
|
||||||
{
|
{
|
||||||
pointFromPoint pt = topoint(vit->point());
|
const pointFromPoint pt = topoint(vit->point());
|
||||||
|
|
||||||
cellShapeControls().cellSizeAndAlignment
|
cellShapeControls().cellSizeAndAlignment
|
||||||
(
|
(
|
||||||
@ -1135,10 +1135,12 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
&& pointToBeRetained[vB->index()] == true
|
&& pointToBeRetained[vB->index()] == true
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pointsToInsert.append
|
Foam::point pt(0.5*(dVA + dVB));
|
||||||
(
|
|
||||||
toPoint(0.5*(dVA + dVB))
|
if (internalPointIsInside(pt))
|
||||||
);
|
{
|
||||||
|
pointsToInsert.append(toPoint(pt));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1274,10 +1276,13 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
if (positionOnThisProc(newPt))
|
if (positionOnThisProc(newPt))
|
||||||
{
|
{
|
||||||
// Prevent insertions spanning surfaces
|
// Prevent insertions spanning surfaces
|
||||||
|
if (internalPointIsInside(newPt))
|
||||||
|
{
|
||||||
pointsToInsert.append(toPoint(newPt));
|
pointsToInsert.append(toPoint(newPt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
@ -1310,10 +1315,12 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
&& pointToBeRetained[vB->index()] == true
|
&& pointToBeRetained[vB->index()] == true
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pointsToInsert.append
|
Foam::point pt(0.5*(dVA + dVB));
|
||||||
(
|
|
||||||
toPoint(0.5*(dVA + dVB))
|
if (internalPointIsInside(pt))
|
||||||
);
|
{
|
||||||
|
pointsToInsert.append(toPoint(pt));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1428,21 +1435,31 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
// 14/1/2011.
|
// 14/1/2011.
|
||||||
// Only necessary if using an exact constructions kernel
|
// Only necessary if using an exact constructions kernel
|
||||||
// (extended precision)
|
// (extended precision)
|
||||||
|
Foam::point pt
|
||||||
pointsToInsert.append
|
|
||||||
(
|
|
||||||
toPoint
|
|
||||||
(
|
(
|
||||||
topoint(vit->point())
|
topoint(vit->point())
|
||||||
+ displacementAccumulator[vit->index()]
|
+ displacementAccumulator[vit->index()]
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (internalPointIsInside(pt))
|
||||||
|
{
|
||||||
|
pointsToInsert.append(toPoint(pt));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pointsToInsert.shrink();
|
pointsToInsert.shrink();
|
||||||
|
|
||||||
|
Info<< indent
|
||||||
|
<< returnReduce
|
||||||
|
(
|
||||||
|
pointToBeRetained.count() - pointsToInsert.size(),
|
||||||
|
sumOp<label>()
|
||||||
|
)
|
||||||
|
<< " internal points were inserted outside the domain. "
|
||||||
|
<< "They have been removed." << endl;
|
||||||
|
|
||||||
// Save displacements to file.
|
// Save displacements to file.
|
||||||
if (foamyHexMeshControls().objOutput() && time().outputTime())
|
if (foamyHexMeshControls().objOutput() && time().outputTime())
|
||||||
{
|
{
|
||||||
@ -1483,67 +1500,6 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
|
|
||||||
insertInternalPoints(pointsToInsert, true);
|
insertInternalPoints(pointsToInsert, true);
|
||||||
|
|
||||||
{
|
|
||||||
// Remove internal points that have been inserted outside the surface.
|
|
||||||
label internalPtIsOutside = 0;
|
|
||||||
|
|
||||||
autoPtr<OBJstream> str;
|
|
||||||
|
|
||||||
if (foamyHexMeshControls().objOutput() && time().outputTime())
|
|
||||||
{
|
|
||||||
str.set
|
|
||||||
(
|
|
||||||
new OBJstream(time().path()/"internalPointsOutsideDomain.obj")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
DynamicList<Vertex_handle> pointsToRemove;
|
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
|
||||||
vit != finite_vertices_end();
|
|
||||||
++vit
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(vit->internalPoint() || vit->internalBoundaryPoint())
|
|
||||||
//&& !vit->referred()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const pointFromPoint pt = topoint(vit->point());
|
|
||||||
|
|
||||||
bool inside = geometryToConformTo_.inside(pt);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!inside
|
|
||||||
|| !geometryToConformTo_.globalBounds().contains(pt)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
foamyHexMeshControls().objOutput()
|
|
||||||
&& time().outputTime()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
str().write(topoint(vit->point()));
|
|
||||||
}
|
|
||||||
|
|
||||||
pointsToRemove.append(vit);
|
|
||||||
internalPtIsOutside++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
remove(pointsToRemove.begin(), pointsToRemove.end());
|
|
||||||
|
|
||||||
Info<< " " << returnReduce(internalPtIsOutside, sumOp<label>())
|
|
||||||
<< " internal points were inserted outside the domain. "
|
|
||||||
<< "They have been removed." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fix points that have not been significantly displaced
|
// Fix points that have not been significantly displaced
|
||||||
// for
|
// for
|
||||||
// (
|
// (
|
||||||
|
|||||||
@ -244,6 +244,9 @@ private:
|
|||||||
DynamicList<Vb>& pts
|
DynamicList<Vb>& pts
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Check internal point is completely inside the meshable region
|
||||||
|
inline bool internalPointIsInside(const Foam::point& pt) const;
|
||||||
|
|
||||||
inline bool isPointPair
|
inline bool isPointPair
|
||||||
(
|
(
|
||||||
const Vertex_handle& vA,
|
const Vertex_handle& vA,
|
||||||
|
|||||||
@ -325,6 +325,24 @@ inline void Foam::conformalVoronoiMesh::createBafflePointPair
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::conformalVoronoiMesh::internalPointIsInside
|
||||||
|
(
|
||||||
|
const Foam::point& pt
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!geometryToConformTo_.inside(pt)
|
||||||
|
|| !geometryToConformTo_.globalBounds().contains(pt)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::conformalVoronoiMesh::isPointPair
|
inline bool Foam::conformalVoronoiMesh::isPointPair
|
||||||
(
|
(
|
||||||
const Vertex_handle& vA,
|
const Vertex_handle& vA,
|
||||||
|
|||||||
@ -674,6 +674,8 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
|
|||||||
|
|
||||||
pBufs.finishedSends();
|
pBufs.finishedSends();
|
||||||
|
|
||||||
|
Info<< incrIndent << indent << " Face ordering initialised..." << endl;
|
||||||
|
|
||||||
// Receive and calculate ordering
|
// Receive and calculate ordering
|
||||||
bool anyChanged = false;
|
bool anyChanged = false;
|
||||||
|
|
||||||
@ -731,6 +733,8 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<< incrIndent << indent << " Faces matched." << endl;
|
||||||
|
|
||||||
reduce(anyChanged, orOp<bool>());
|
reduce(anyChanged, orOp<bool>());
|
||||||
|
|
||||||
if (anyChanged)
|
if (anyChanged)
|
||||||
|
|||||||
Reference in New Issue
Block a user