Resolving merge commits
This commit is contained in:
parent
37c728edfb
commit
e2189947db
7 changed files with 141 additions and 65 deletions
|
@ -134,7 +134,8 @@ public:
|
|||
donorProcNo_(-1),
|
||||
donorPoint_(vector::zero),
|
||||
extendedDonorCells_(),
|
||||
extendedDonorPoints_()
|
||||
extendedDonorPoints_(),
|
||||
withinBB_(false)
|
||||
{}
|
||||
|
||||
//- Construct from acceptor data
|
||||
|
|
|
@ -105,7 +105,7 @@ class adaptiveOverlapFringe
|
|||
//- Name of the cell set defining initial holes (empty by default).
|
||||
// Useful when the resolution of the background mesh is much
|
||||
// coarser than the front mesh and no hole is found
|
||||
const word holesSetName_;
|
||||
const word holesZoneName_;
|
||||
|
||||
//- Optional list of patches to start the iterative fringe assembly
|
||||
// process (empty list by default). Useful when we actually have
|
||||
|
@ -125,6 +125,14 @@ class adaptiveOverlapFringe
|
|||
// be made
|
||||
const label specifiedIterationsNumber_;
|
||||
|
||||
//- User specified suitability trend rate. If the trend is larger
|
||||
// than the specified trend rate, additional iterations are
|
||||
// performed
|
||||
const scalar minSuitabilityRate_;
|
||||
|
||||
//- Maximum number of iterations
|
||||
const label maxIter_;
|
||||
|
||||
//- Relative iteration counter
|
||||
mutable label relativeCounter_;
|
||||
|
||||
|
|
|
@ -224,6 +224,21 @@ public:
|
|||
<< " on processor: " << daPair.acceptorProcNo()
|
||||
<< " did not find donor candidate."
|
||||
<< nl
|
||||
<< "Additional information: "
|
||||
<< nl
|
||||
<< (
|
||||
daPair.withinBB()
|
||||
? " Within bounding box"
|
||||
: " Not within bounding box"
|
||||
)
|
||||
<< nl << tab
|
||||
<< "Donor index: " << daPair.donorCell()
|
||||
<< nl << tab
|
||||
<< "Donor processor index: " << daPair.donorProcNo()
|
||||
<< nl << tab
|
||||
<< "Number of extended donors: "
|
||||
<< daPair.extendedDonorCells().size()
|
||||
<< nl << nl
|
||||
<< "Please review your fringe assembly settings"
|
||||
<< " (or try using adaptiveOverlap fringe algorithm)."
|
||||
<< abort(FatalError);
|
||||
|
|
|
@ -188,26 +188,37 @@ void Foam::overlapFringe::calcAddressing() const
|
|||
// holes)
|
||||
boolList eligibleAcceptors(mesh.nCells(), true);
|
||||
|
||||
// Read user specified holes into allHoles list. Note: if the cell set
|
||||
// is not found, the list will be empty
|
||||
labelList allHoles
|
||||
(
|
||||
cellSet
|
||||
(
|
||||
mesh,
|
||||
holesSetName_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
).toc()
|
||||
);
|
||||
// Read user specified holes into allHoles list. Note: use cellZone rather
|
||||
// than cellSet to have correct behaviour on dynamic mesh simulations
|
||||
// We will silently proceed if the zone is not found since this option is
|
||||
// not mandatory but is useful in certain cases
|
||||
|
||||
// Get zone index
|
||||
const label zoneID = mesh.cellZones().findZoneID(holesZoneName_);
|
||||
|
||||
// Create a hash set for allHoles
|
||||
labelHashSet allHoles;
|
||||
|
||||
if (zoneID > -1)
|
||||
{
|
||||
// Get the zone for holes and append them to set
|
||||
const labelList& specifiedHoles = mesh.cellZones()[zoneID];
|
||||
|
||||
allHoles.insert(specifiedHoles);
|
||||
}
|
||||
// else silently proceed without user-specified holes
|
||||
|
||||
// Extend allHoles with cutHoles
|
||||
allHoles.append(cutHoles);
|
||||
forAll (cutHoles, chI)
|
||||
{
|
||||
// Note: duplicated are removed because we're using hash set
|
||||
allHoles.insert(cutHoles[chI]);
|
||||
}
|
||||
|
||||
// Mark all holes
|
||||
forAll (allHoles, hI)
|
||||
forAllConstIter (labelHashSet, allHoles, iter)
|
||||
{
|
||||
const label& holeCellI = allHoles[hI];
|
||||
const label& holeCellI = iter.key();
|
||||
|
||||
// Mask eligible acceptors
|
||||
eligibleAcceptors[holeCellI] = false;
|
||||
|
@ -225,10 +236,10 @@ void Foam::overlapFringe::calcAddressing() const
|
|||
dynamicLabelList candidateAcceptors(mesh.nCells());
|
||||
|
||||
// Loop through all holes and find acceptor candidates
|
||||
forAll (allHoles, hI)
|
||||
forAllConstIter (labelHashSet, allHoles, iter)
|
||||
{
|
||||
// Get neighbours of this hole cell
|
||||
const labelList& hNbrs = cc[allHoles[hI]];
|
||||
const labelList& hNbrs = cc[iter.key()];
|
||||
|
||||
// Loop through neighbours of this hole cell
|
||||
forAll (hNbrs, nbrI)
|
||||
|
@ -370,7 +381,7 @@ void Foam::overlapFringe::calcAddressing() const
|
|||
// Transfer the acceptor list and allocate empty fringeHoles list, which
|
||||
// may be populated in updateIteration member function
|
||||
acceptorsPtr_ = new labelList(candidateAcceptors.xfer());
|
||||
fringeHolesPtr_ = new labelList(cutHoles);
|
||||
fringeHolesPtr_ = new labelList(allHoles.toc().xfer());
|
||||
}
|
||||
|
||||
|
||||
|
@ -398,7 +409,7 @@ Foam::overlapFringe::overlapFringe
|
|||
acceptorsPtr_(nullptr),
|
||||
finalDonorAcceptorsPtr_(nullptr),
|
||||
|
||||
holesSetName_(dict.lookupOrDefault<word>("holes", word())),
|
||||
holesZoneName_(dict.lookupOrDefault<word>("holes", word())),
|
||||
initPatchNames_
|
||||
(
|
||||
dict.lookupOrDefault<wordList>("initPatchNames", wordList())
|
||||
|
@ -688,8 +699,15 @@ bool Foam::overlapFringe::updateIteration
|
|||
}
|
||||
}
|
||||
|
||||
// Tranfer back the allFringeHoles dynamic list into member data
|
||||
fringeHolesPtr_->transfer(allFringeHoles);
|
||||
// Bugfix: Although we have found suitable overlap, we need to update
|
||||
// acceptors as well because eligible donors for acceptors of other
|
||||
// regions are calculated based on these acceptors (and holes)
|
||||
labelList& acceptors = *acceptorsPtr_;
|
||||
acceptors.setSize(finalDAPairs.size());
|
||||
forAll (acceptors, aI)
|
||||
{
|
||||
acceptors[aI] = finalDAPairs[aI].acceptorCell();
|
||||
}
|
||||
|
||||
// Transfer ownership of the final donor/acceptor list to the
|
||||
// finalDonorAcceptorsPtr_
|
||||
|
@ -698,6 +716,9 @@ bool Foam::overlapFringe::updateIteration
|
|||
finalDAPairs.xfer()
|
||||
);
|
||||
|
||||
// Tranfer back the allFringeHoles dynamic list into member data
|
||||
fringeHolesPtr_->transfer(allFringeHoles);
|
||||
|
||||
// At least 100*minGlobalFraction_ % of suitable donor/acceptor pairs
|
||||
// have been found.
|
||||
Info<< "Converted " << nAccToHoles << " acceptors to holes."
|
||||
|
|
|
@ -96,7 +96,7 @@ class overlapFringe
|
|||
//- Name of the cell set defining initial holes (empty by default).
|
||||
// Useful when the resolution of the background mesh is much
|
||||
// coarser than the front mesh and no hole is found
|
||||
const word holesSetName_;
|
||||
const word holesZoneName_;
|
||||
|
||||
//- Optional list of patches to start the iterative fringe assembly
|
||||
// process (empty list by default). Useful when we actually have
|
||||
|
|
|
@ -55,18 +55,33 @@ void Foam::oversetMesh::calcCellClassification() const
|
|||
nHoleCells += regions_[regionI].holes().size();
|
||||
}
|
||||
|
||||
Pout<< "Number of acceptor cells: " << nAcceptorCells << endl;
|
||||
acceptorCellsPtr_ = new labelList(nAcceptorCells);
|
||||
labelList& acceptor = *acceptorCellsPtr_;
|
||||
|
||||
Pout<< "Number of donor cells: " << nDonorCells << endl;
|
||||
donorCellsPtr_ = new labelList(nDonorCells);
|
||||
labelList& donor = *donorCellsPtr_;
|
||||
|
||||
Pout<< "Number of hole cells: " << nHoleCells << endl;
|
||||
holeCellsPtr_ = new labelList(nHoleCells);
|
||||
labelList& hole = *holeCellsPtr_;
|
||||
|
||||
// Print out processor specific information in debug
|
||||
if (oversetMesh::debug)
|
||||
{
|
||||
Pout<< "Number of acceptor cells: " << nAcceptorCells << endl;
|
||||
Pout<< "Number of donor cells: " << nDonorCells << endl;
|
||||
Pout<< "Number of hole cells: " << nHoleCells << endl;
|
||||
}
|
||||
// Else print global information
|
||||
else
|
||||
{
|
||||
Info<< "Number of acceptor cells: "
|
||||
<< returnReduce(nAcceptorCells, sumOp<label>()) << endl;
|
||||
Info<< "Number of donor cells: "
|
||||
<< returnReduce(nDonorCells, sumOp<label>()) << endl;
|
||||
Info<< "Number of hole cells: "
|
||||
<< returnReduce(nHoleCells, sumOp<label>()) << endl;
|
||||
}
|
||||
|
||||
// Reset counters
|
||||
nAcceptorCells = 0;
|
||||
nDonorCells = 0;
|
||||
|
|
|
@ -190,18 +190,9 @@ void Foam::oversetRegion::calcDonorAcceptorCells() const
|
|||
// Update global flag
|
||||
foundGlobalOverlap &= regionFoundSuitableOverlap;
|
||||
|
||||
// If the overlap has not been found for this region, we need to
|
||||
// reset:
|
||||
// - holeCells (depend on fringe holes)
|
||||
// - eligibleDonors (depend on fringe holes and acceptors),
|
||||
// - cellSearch (depends on eligible donors).
|
||||
if (!regionFoundSuitableOverlap)
|
||||
{
|
||||
deleteDemandDrivenData(curRegion.cellSearchPtr_);
|
||||
}
|
||||
|
||||
deleteDemandDrivenData(curRegion.holeCellsPtr_);
|
||||
deleteDemandDrivenData(curRegion.eligibleDonorCellsPtr_);
|
||||
// Deletion of demand driven data relocated to the end of
|
||||
// updateDonorAcceptors() member function. Makes more sense to have
|
||||
// it there. VV, 13/Jan/2019.
|
||||
}
|
||||
} while (!foundGlobalOverlap);
|
||||
|
||||
|
@ -1317,6 +1308,20 @@ bool Foam::oversetRegion::updateDonorAcceptors() const
|
|||
|
||||
// STAGE 11: Filter possibly multiple remote donors
|
||||
|
||||
// Sanity check before moving on. For each initial acceptor, we must
|
||||
// receive at least 1 corresponding donor (even if it is not found,
|
||||
// indicating an orphan cell) from different processors.
|
||||
if (a.size() > completeDonorAcceptorList.size())
|
||||
{
|
||||
FatalErrorIn("void oversetRegion::updateDonorAcceptors() const")
|
||||
<< "Size of initial acceptor set: " << a.size()
|
||||
<< " is larger than the size of the distributed "
|
||||
<< " donor/acceptor list: " << completeDonorAcceptorList.size()
|
||||
<< nl
|
||||
<< "This should not have happened..."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Create a masking field indicating that a certain acceptor has been
|
||||
// visited
|
||||
boolList isVisited(a.size(), false);
|
||||
|
@ -1379,35 +1384,16 @@ bool Foam::oversetRegion::updateDonorAcceptors() const
|
|||
curDA.donorPoint(),
|
||||
curDA.withinBB()
|
||||
);
|
||||
|
||||
// Bugfix: also need to reset extended donors since a better
|
||||
// candidate has been found. VV, 1/Jan/2019
|
||||
curDACombined.setExtendedDonors(curDA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update withinBB flag if the donor is within bounding box of acceptor
|
||||
// (previously we checked whether the acceptor is within bounding box of
|
||||
// donor)
|
||||
forAll (combinedDonorAcceptorList, daI)
|
||||
{
|
||||
donorAcceptor& curDA = combinedDonorAcceptorList[daI];
|
||||
|
||||
// If the acceptor is not within bounding box of donor, set the flag
|
||||
// other way around
|
||||
if (!curDA.withinBB())
|
||||
{
|
||||
curDA.setWithinBB
|
||||
(
|
||||
mesh_.pointInCellBB
|
||||
(
|
||||
curDA.donorPoint(),
|
||||
curDA.acceptorCell()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether all acceptors have been visited. Used for testing/debugging
|
||||
// parallel comms
|
||||
if (oversetMesh::debug)
|
||||
// Check whether all acceptors have been visited. Useful check if in
|
||||
// no-debug mode
|
||||
{
|
||||
bool allVisited = true;
|
||||
|
||||
|
@ -1435,12 +1421,35 @@ bool Foam::oversetRegion::updateDonorAcceptors() const
|
|||
<< nl
|
||||
<< "Try switching off useLocalBoundingBoxes for all regions"
|
||||
<< nl
|
||||
<< "(this optimisation is switched on by default)."
|
||||
<< "(this optimisation is switched off by default)."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update withinBB flag if the donor is within bounding box of acceptor
|
||||
// (previously we checked whether the acceptor is within bounding box of
|
||||
// donor)
|
||||
forAll (combinedDonorAcceptorList, daI)
|
||||
{
|
||||
donorAcceptor& curDA = combinedDonorAcceptorList[daI];
|
||||
|
||||
// If the acceptor is not within bounding box of donor, set the flag
|
||||
// other way around
|
||||
if (!curDA.withinBB())
|
||||
{
|
||||
curDA.setWithinBB
|
||||
(
|
||||
mesh_.pointInCellBB
|
||||
(
|
||||
curDA.donorPoint(),
|
||||
curDA.acceptorCell()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// STAGE 12: Finish the iteration by updating the fringe, which will
|
||||
// actually hold final and some intermediate steps for donor/acceptor
|
||||
// assembly process
|
||||
|
@ -1450,6 +1459,13 @@ bool Foam::oversetRegion::updateDonorAcceptors() const
|
|||
bool suitableOverlapFound =
|
||||
fringePtr_->updateIteration(combinedDonorAcceptorList);
|
||||
|
||||
// Delete all necessary demand driven data for this region since we have
|
||||
// just updated the iteration. Therefore, cellSearch, eligibleDonors and
|
||||
// holes need to be updated
|
||||
deleteDemandDrivenData(cellSearchPtr_);
|
||||
deleteDemandDrivenData(eligibleDonorCellsPtr_);
|
||||
deleteDemandDrivenData(holeCellsPtr_);
|
||||
|
||||
return suitableOverlapFound;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue