mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: find point with perturbation
This commit is contained in:
@ -2228,6 +2228,36 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::meshRefinement::findRegion
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& cellToRegion,
|
||||
const vector& perturbVec,
|
||||
const point& p
|
||||
)
|
||||
{
|
||||
label regionI = -1;
|
||||
label cellI = mesh.findCell(p);
|
||||
if (cellI != -1)
|
||||
{
|
||||
regionI = cellToRegion[cellI];
|
||||
}
|
||||
reduce(regionI, maxOp<label>());
|
||||
|
||||
if (regionI == -1)
|
||||
{
|
||||
// See if we can perturb a bit
|
||||
cellI = mesh.findCell(p+perturbVec);
|
||||
if (cellI != -1)
|
||||
{
|
||||
regionI = cellToRegion[cellI];
|
||||
}
|
||||
reduce(regionI, maxOp<label>());
|
||||
}
|
||||
return regionI;
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
||||
(
|
||||
const labelList& globalToMasterPatch,
|
||||
@ -2246,16 +2276,13 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
||||
|
||||
regionSplit cellRegion(mesh_, blockedFace);
|
||||
|
||||
label regionI = -1;
|
||||
|
||||
label cellI = mesh_.findCell(keepPoint);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
regionI = cellRegion[cellI];
|
||||
}
|
||||
|
||||
reduce(regionI, maxOp<label>());
|
||||
label regionI = findRegion
|
||||
(
|
||||
mesh_,
|
||||
cellRegion,
|
||||
mergeDistance_*vector(1,1,1), // note:1,1,1 should really be normalised
|
||||
keepPoint
|
||||
);
|
||||
|
||||
if (regionI == -1)
|
||||
{
|
||||
|
||||
@ -890,6 +890,15 @@ public:
|
||||
//- Select coupled faces that are not collocated
|
||||
void selectSeparatedCoupledFaces(boolList&) const;
|
||||
|
||||
//- Find region cell is in. Uses optional perturbation to re-test.
|
||||
static label findRegion
|
||||
(
|
||||
const polyMesh&,
|
||||
const labelList& cellRegion,
|
||||
const vector& perturbVec,
|
||||
const point& p
|
||||
);
|
||||
|
||||
//- Split mesh. Keep part containing point.
|
||||
autoPtr<mapPolyMesh> splitMeshRegions
|
||||
(
|
||||
|
||||
@ -1381,18 +1381,16 @@ void Foam::meshRefinement::findCellZoneInsideWalk
|
||||
<< endl;
|
||||
|
||||
// Find the region containing the insidePoint
|
||||
label keepRegionI = -1;
|
||||
|
||||
label cellI = mesh_.findCell(insidePoint);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
keepRegionI = cellRegion[cellI];
|
||||
}
|
||||
reduce(keepRegionI, maxOp<label>());
|
||||
label keepRegionI = findRegion
|
||||
(
|
||||
mesh_,
|
||||
cellRegion,
|
||||
mergeDistance_*vector(1,1,1),
|
||||
insidePoint
|
||||
);
|
||||
|
||||
Info<< "For surface " << surfaces_.names()[surfI]
|
||||
<< " found point " << insidePoint << " in cell " << cellI
|
||||
<< " found point " << insidePoint
|
||||
<< " in global region " << keepRegionI
|
||||
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
||||
|
||||
@ -1548,19 +1546,16 @@ void Foam::meshRefinement::findCellZoneTopo
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Find the region containing the keepPoint
|
||||
label keepRegionI = -1;
|
||||
label keepRegionI = findRegion
|
||||
(
|
||||
mesh_,
|
||||
cellRegion,
|
||||
mergeDistance_*vector(1,1,1),
|
||||
keepPoint
|
||||
);
|
||||
|
||||
label cellI = mesh_.findCell(keepPoint);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
keepRegionI = cellRegion[cellI];
|
||||
}
|
||||
reduce(keepRegionI, maxOp<label>());
|
||||
|
||||
Info<< "Found point " << keepPoint << " in cell " << cellI
|
||||
Info<< "Found point " << keepPoint
|
||||
<< " in global region " << keepRegionI
|
||||
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
||||
|
||||
@ -2626,17 +2621,15 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
||||
blockedFace.clear();
|
||||
|
||||
// Find the region containing the keepPoint
|
||||
label keepRegionI = -1;
|
||||
label keepRegionI = findRegion
|
||||
(
|
||||
mesh_,
|
||||
cellRegion,
|
||||
mergeDistance_*vector(1,1,1),
|
||||
keepPoint
|
||||
);
|
||||
|
||||
label cellI = mesh_.findCell(keepPoint);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
keepRegionI = cellRegion[cellI];
|
||||
}
|
||||
reduce(keepRegionI, maxOp<label>());
|
||||
|
||||
Info<< "Found point " << keepPoint << " in cell " << cellI
|
||||
Info<< "Found point " << keepPoint
|
||||
<< " in global region " << keepRegionI
|
||||
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user