Bugfixes in cuttingPatchFringe
1. No need to flip the face when creating .stl 2. Removed wrong break statement 3. Slight reorganization and improvements
This commit is contained in:
parent
db859b968c
commit
d9bf1218a2
1 changed files with 34 additions and 36 deletions
|
@ -228,7 +228,9 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
|
|
||||||
forAll (ts, tsI)
|
forAll (ts, tsI)
|
||||||
{
|
{
|
||||||
triFaces[tsI] = ts[tsI].reverseFace();
|
// Bugfix: no need to reverse face because the normals point in
|
||||||
|
// the correct direction already. VV, 20/May/2019.
|
||||||
|
triFaces[tsI] = ts[tsI];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,11 +371,6 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
const unallocLabelList& owner = mesh.faceOwner();
|
const unallocLabelList& owner = mesh.faceOwner();
|
||||||
const unallocLabelList& neighbour = mesh.faceNeighbour();
|
const unallocLabelList& neighbour = mesh.faceNeighbour();
|
||||||
|
|
||||||
// Collect all inside cells either as hole cells or acceptor
|
|
||||||
// cells. For the first iteration, acceptor cells are the cells that
|
|
||||||
// have at least one neighbour cell that is not marked
|
|
||||||
labelHashSet acceptors(myRegionCells.size()/10);
|
|
||||||
|
|
||||||
// Bool list for collecting faces with at least one unmarked
|
// Bool list for collecting faces with at least one unmarked
|
||||||
// cell (to determine the acceptors for the first iteration)
|
// cell (to determine the acceptors for the first iteration)
|
||||||
boolList hasUnmarkedCell(mesh.nFaces(), false);
|
boolList hasUnmarkedCell(mesh.nFaces(), false);
|
||||||
|
@ -391,7 +388,6 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
{
|
{
|
||||||
// Set the mark for this global face and break out
|
// Set the mark for this global face and break out
|
||||||
hasUnmarkedCell[cFaces[i]] = true;
|
hasUnmarkedCell[cFaces[i]] = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,8 +401,12 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
// Mark-up for all hole faces
|
// Mark-up for all inside faces
|
||||||
boolList holeFaceMask(mesh.nFaces(), false);
|
boolList insideFaceMask(mesh.nFaces(), false);
|
||||||
|
|
||||||
|
// Collect all acceptors for the first iteration (the cells that
|
||||||
|
// have at least one neighbour cell that is not marked)
|
||||||
|
labelHashSet acceptors(myRegionCells.size()/10);
|
||||||
|
|
||||||
// Loop again through all cells and collect marked ones into
|
// Loop again through all cells and collect marked ones into
|
||||||
// acceptors or holes, depending on whether they have unmarked cell
|
// acceptors or holes, depending on whether they have unmarked cell
|
||||||
|
@ -418,10 +418,6 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
// This cell is inside the covered region
|
// This cell is inside the covered region
|
||||||
const cell& cFaces = meshCells[cellI];
|
const cell& cFaces = meshCells[cellI];
|
||||||
|
|
||||||
// Helper variable to determine whether this marked cell
|
|
||||||
// should be collected as a hole
|
|
||||||
bool isHole = true;
|
|
||||||
|
|
||||||
forAll (cFaces, i)
|
forAll (cFaces, i)
|
||||||
{
|
{
|
||||||
// Get global face index
|
// Get global face index
|
||||||
|
@ -431,24 +427,26 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
if (hasUnmarkedCell[faceI])
|
if (hasUnmarkedCell[faceI])
|
||||||
{
|
{
|
||||||
// This cell has unmarked neighbour, collect it into
|
// This cell has unmarked neighbour, collect it into
|
||||||
// the acceptor list, set isHole to false and break
|
// the acceptor list
|
||||||
acceptors.insert(cellI);
|
acceptors.insert(cellI);
|
||||||
isHole = false;
|
|
||||||
|
// This cell is no longer "inside cell"
|
||||||
|
insideMask[cellI] = false;;
|
||||||
|
|
||||||
|
// Break out since there's nothing to do for this cell
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is a hole, collect it and mark its faces
|
// If this is still inside cell, collect it and mark its faces
|
||||||
if (isHole)
|
if (insideMask[cellI])
|
||||||
{
|
{
|
||||||
holeCellMask[cellI] = true;
|
|
||||||
|
|
||||||
// Loop through cell faces and mark them
|
// Loop through cell faces and mark them
|
||||||
const cell& cFaces = meshCells[cellI];
|
const cell& cFaces = meshCells[cellI];
|
||||||
|
|
||||||
forAll (cFaces, i)
|
forAll (cFaces, i)
|
||||||
{
|
{
|
||||||
holeFaceMask[cFaces[i]] = true;
|
insideFaceMask[cFaces[i]] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // End if cell is inside
|
} // End if cell is inside
|
||||||
|
@ -464,7 +462,7 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
// Face markup for propagation
|
// Face markup for propagation
|
||||||
boolList propagateFace(mesh.nFaces(), false);
|
boolList propagateFace(mesh.nFaces(), false);
|
||||||
|
|
||||||
// Loop through all donors and mark faces that are around hole
|
// Loop through all acceptors and mark faces that are around hole
|
||||||
// cells. This way, we make sure that we go towards the correct,
|
// cells. This way, we make sure that we go towards the correct,
|
||||||
// inside direction
|
// inside direction
|
||||||
forAllConstIter (labelHashSet, acceptors, iter)
|
forAllConstIter (labelHashSet, acceptors, iter)
|
||||||
|
@ -479,7 +477,7 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
// Get face index (global)
|
// Get face index (global)
|
||||||
const label& faceI = cFaces[i];
|
const label& faceI = cFaces[i];
|
||||||
|
|
||||||
if (holeFaceMask[faceI])
|
if (insideFaceMask[faceI])
|
||||||
{
|
{
|
||||||
// This is a hole face, we are moving in the right
|
// This is a hole face, we are moving in the right
|
||||||
// direction. Mark the face for propagation
|
// direction. Mark the face for propagation
|
||||||
|
@ -507,25 +505,25 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
const label& nei = neighbour[faceI];
|
const label& nei = neighbour[faceI];
|
||||||
|
|
||||||
// Either owner or neighbour may be hole, not both
|
// Either owner or neighbour may be hole, not both
|
||||||
if (holeCellMask[own])
|
if (insideMask[own])
|
||||||
{
|
{
|
||||||
// Owner cell is a hole, insert it
|
// Owner cell is a hole, insert it
|
||||||
newAcceptors.insert(own);
|
newAcceptors.insert(own);
|
||||||
|
|
||||||
// Update hole mask
|
// Update hole mask
|
||||||
holeCellMask[own] = false;
|
insideMask[own] = false;
|
||||||
}
|
}
|
||||||
else if (holeCellMask[nei])
|
else if (insideMask[nei])
|
||||||
{
|
{
|
||||||
// Neighbour cell is a hole, insert it
|
// Neighbour cell is a hole, insert it
|
||||||
newAcceptors.insert(nei);
|
newAcceptors.insert(nei);
|
||||||
|
|
||||||
// Update hole mask
|
// Update hole mask
|
||||||
holeCellMask[nei] = false;
|
insideMask[nei] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also update hole face mask for next iteration
|
// Also update hole face mask for next iteration
|
||||||
holeFaceMask[faceI] = false;
|
insideFaceMask[faceI] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,17 +541,17 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
// side. Neighbour handled on the other side
|
// side. Neighbour handled on the other side
|
||||||
const label& own = owner[faceI];
|
const label& own = owner[faceI];
|
||||||
|
|
||||||
if (holeCellMask[own])
|
if (insideMask[own])
|
||||||
{
|
{
|
||||||
// Face cell is a hole, insert it
|
// Face cell is a hole, insert it
|
||||||
newAcceptors.insert(own);
|
newAcceptors.insert(own);
|
||||||
|
|
||||||
// Update hole mask
|
// Update hole mask
|
||||||
holeCellMask[own] = false;
|
insideMask[own] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also update hole face mask for next iteration
|
// Also update hole face mask for next iteration
|
||||||
holeFaceMask[faceI] = false;
|
insideFaceMask[faceI] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,9 +567,9 @@ void Foam::cuttingPatchFringe::calcAddressing() const
|
||||||
// optimized by using dynamic lists)
|
// optimized by using dynamic lists)
|
||||||
labelHashSet fringeHoles(myRegionCells.size()/10);
|
labelHashSet fringeHoles(myRegionCells.size()/10);
|
||||||
|
|
||||||
forAll (holeCellMask, cellI)
|
forAll (insideMask, cellI)
|
||||||
{
|
{
|
||||||
if (holeCellMask[cellI])
|
if (insideMask[cellI])
|
||||||
{
|
{
|
||||||
fringeHoles.insert(cellI);
|
fringeHoles.insert(cellI);
|
||||||
}
|
}
|
||||||
|
@ -657,10 +655,10 @@ Foam::cuttingPatchFringe::cuttingPatchFringe
|
||||||
")"
|
")"
|
||||||
) << "You have specified nLayers = " << nLayers_
|
) << "You have specified nLayers = " << nLayers_
|
||||||
<< nl
|
<< nl
|
||||||
<< "We strongly advise to use at least 2 layers to avoid"
|
<< "We strongly advise to use at least 2 layers to avoid" << nl
|
||||||
<< " possibility of having acceptors that cannot find decent"
|
<< "possibility of having acceptors that cannot find decent" << nl
|
||||||
<< "donors on the other side."
|
<< "donors on the other side."
|
||||||
<< abort(FatalError);
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue