mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: allow empty refinement surfaces #1303
This commit is contained in:
@ -381,70 +381,82 @@ Foam::labelList Foam::meshRefinement::nearestPatch
|
|||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||||
|
|
||||||
// Count number of faces in adaptPatchIDs
|
labelList nearestAdaptPatch;
|
||||||
label nFaces = 0;
|
|
||||||
forAll(adaptPatchIDs, i)
|
if (adaptPatchIDs.size())
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[adaptPatchIDs[i]];
|
nearestAdaptPatch.setSize(mesh_.nFaces(), adaptPatchIDs[0]);
|
||||||
nFaces += pp.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field on cells and faces.
|
|
||||||
List<topoDistanceData> cellData(mesh_.nCells());
|
|
||||||
List<topoDistanceData> faceData(mesh_.nFaces());
|
|
||||||
|
|
||||||
// Start of changes
|
// Count number of faces in adaptPatchIDs
|
||||||
labelList patchFaces(nFaces);
|
label nFaces = 0;
|
||||||
List<topoDistanceData> patchData(nFaces);
|
forAll(adaptPatchIDs, i)
|
||||||
nFaces = 0;
|
|
||||||
forAll(adaptPatchIDs, i)
|
|
||||||
{
|
|
||||||
label patchI = adaptPatchIDs[i];
|
|
||||||
const polyPatch& pp = patches[patchI];
|
|
||||||
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
{
|
||||||
patchFaces[nFaces] = pp.start()+i;
|
const polyPatch& pp = patches[adaptPatchIDs[i]];
|
||||||
patchData[nFaces] = topoDistanceData(patchI, 0);
|
nFaces += pp.size();
|
||||||
nFaces++;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Propagate information inwards
|
// Field on cells and faces.
|
||||||
FaceCellWave<topoDistanceData> deltaCalc
|
List<topoDistanceData> cellData(mesh_.nCells());
|
||||||
(
|
List<topoDistanceData> faceData(mesh_.nFaces());
|
||||||
mesh_,
|
|
||||||
patchFaces,
|
|
||||||
patchData,
|
|
||||||
faceData,
|
|
||||||
cellData,
|
|
||||||
mesh_.globalData().nTotalCells()+1
|
|
||||||
);
|
|
||||||
|
|
||||||
// And extract
|
// Start of changes
|
||||||
labelList nearestAdaptPatch(mesh_.nFaces(), adaptPatchIDs[0]);
|
labelList patchFaces(nFaces);
|
||||||
|
List<topoDistanceData> patchData(nFaces);
|
||||||
bool haveWarned = false;
|
nFaces = 0;
|
||||||
forAll(faceData, faceI)
|
forAll(adaptPatchIDs, i)
|
||||||
{
|
|
||||||
if (!faceData[faceI].valid(deltaCalc.data()))
|
|
||||||
{
|
{
|
||||||
if (!haveWarned)
|
label patchI = adaptPatchIDs[i];
|
||||||
|
const polyPatch& pp = patches[patchI];
|
||||||
|
|
||||||
|
forAll(pp, i)
|
||||||
{
|
{
|
||||||
WarningIn("meshRefinement::nearestPatch(..)")
|
patchFaces[nFaces] = pp.start()+i;
|
||||||
<< "Did not visit some faces, e.g. face " << faceI
|
patchData[nFaces] = topoDistanceData(patchI, 0);
|
||||||
<< " at " << mesh_.faceCentres()[faceI] << endl
|
nFaces++;
|
||||||
<< "Assigning these cells to patch "
|
|
||||||
<< adaptPatchIDs[0]
|
|
||||||
<< endl;
|
|
||||||
haveWarned = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// Propagate information inwards
|
||||||
|
FaceCellWave<topoDistanceData> deltaCalc
|
||||||
|
(
|
||||||
|
mesh_,
|
||||||
|
patchFaces,
|
||||||
|
patchData,
|
||||||
|
faceData,
|
||||||
|
cellData,
|
||||||
|
mesh_.globalData().nTotalCells()+1
|
||||||
|
);
|
||||||
|
|
||||||
|
// And extract
|
||||||
|
|
||||||
|
bool haveWarned = false;
|
||||||
|
forAll(faceData, faceI)
|
||||||
{
|
{
|
||||||
nearestAdaptPatch[faceI] = faceData[faceI].data();
|
if (!faceData[faceI].valid(deltaCalc.data()))
|
||||||
|
{
|
||||||
|
if (!haveWarned)
|
||||||
|
{
|
||||||
|
WarningIn("meshRefinement::nearestPatch(..)")
|
||||||
|
<< "Did not visit some faces, e.g. face " << faceI
|
||||||
|
<< " at " << mesh_.faceCentres()[faceI] << endl
|
||||||
|
<< "Assigning these cells to patch "
|
||||||
|
<< adaptPatchIDs[0]
|
||||||
|
<< endl;
|
||||||
|
haveWarned = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nearestAdaptPatch[faceI] = faceData[faceI].data();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use patch 0
|
||||||
|
nearestAdaptPatch.setSize(mesh_.nFaces(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
return nearestAdaptPatch;
|
return nearestAdaptPatch;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user