Donor/acceptor within boundig box criterion update

Previously, we only checked whether the acceptor point is within bounding box of
donor, which may not be fair. Now, we also check whether the donor point is
within bounding box of acceptor.

Having both checks makes sense since there's no reason to prefer one criterion
over the other.
This commit is contained in:
Vuko Vukcevic 2018-07-16 16:39:09 +02:00
parent b46ede8553
commit ef5f6a5f59
4 changed files with 56 additions and 27 deletions

View file

@ -1,4 +1,4 @@
EXE_INC = -DFULLDEBUG -g -O0 \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \

View file

@ -115,8 +115,9 @@ private:
// Note that the processor number is the same for all extended // Note that the processor number is the same for all extended
// donors // donors
//- Donor within BB flag //- Whether donor (or acceptor) is within bounding box of acceptor
bool donorWithinBB_; // (or donor)
bool withinBB_;
public: public:
@ -152,7 +153,7 @@ public:
donorPoint_(vector::zero), donorPoint_(vector::zero),
extendedDonorCells_(), extendedDonorCells_(),
extendedDonorPoints_(), extendedDonorPoints_(),
donorWithinBB_(false) withinBB_(false)
{} {}
//- Construct from Istream //- Construct from Istream
@ -165,8 +166,8 @@ public:
donorProcNo_(readLabel(is)), donorProcNo_(readLabel(is)),
donorPoint_(is), donorPoint_(is),
extendedDonorCells_(is), extendedDonorCells_(is),
extendedDonorPoints_(is), extendedDonorPoints_(is),
donorWithinBB_(is) withinBB_(is)
{} {}
//- Copy constructor - default //- Copy constructor - default
@ -281,27 +282,33 @@ public:
} }
//- Return whether the donor is within bounding box //- Return whether the donor is within bounding box
bool donorWithinBB() const bool withinBB() const
{ {
return donorWithinBB_; return withinBB_;
} }
// Edit // Edit
//- Set withinBB
void setWithinBB(const bool withinBB)
{
withinBB_ = withinBB;
}
//- Set hit: donor found //- Set hit: donor found
void setDonor void setDonor
( (
const label& donorCell, const label& donorCell,
const label& donorProcNo, const label& donorProcNo,
const point& donorPoint, const point& donorPoint,
bool donorWithinBB const bool withinBB
) )
{ {
donorCell_ = donorCell; donorCell_ = donorCell;
donorProcNo_ = donorProcNo; donorProcNo_ = donorProcNo;
donorPoint_ = donorPoint; donorPoint_ = donorPoint;
donorWithinBB_ = donorWithinBB; withinBB_ = withinBB;
} }
//- Set extended donors by going through neighbours of currently set //- Set extended donors by going through neighbours of currently set
@ -370,7 +377,7 @@ public:
extendedDonorCells_ = rd.extendedDonorCells_; extendedDonorCells_ = rd.extendedDonorCells_;
extendedDonorPoints_ = rd.extendedDonorPoints_; extendedDonorPoints_ = rd.extendedDonorPoints_;
donorWithinBB_ = rd.donorWithinBB_; withinBB_ = rd.withinBB_;
} }
@ -388,7 +395,7 @@ public:
&& a.acceptorPoint_ == b.acceptorPoint_ && a.acceptorPoint_ == b.acceptorPoint_
&& a.donorCell_ == b.donorCell_ && a.donorCell_ == b.donorCell_
&& a.donorProcNo_ == b.donorProcNo_ && a.donorProcNo_ == b.donorProcNo_
&& a.donorWithinBB_ == b.donorWithinBB_; && a.withinBB_ == b.withinBB_;
// Note: do not check whether extended neighbours are the same, we // Note: do not check whether extended neighbours are the same, we
// assume they will be if donor data is the same // assume they will be if donor data is the same
@ -417,7 +424,7 @@ public:
>> rd.donorPoint_ >> rd.donorPoint_
>> rd.extendedDonorCells_ >> rd.extendedDonorCells_
>> rd.extendedDonorPoints_ >> rd.extendedDonorPoints_
>> rd.donorWithinBB_; >> rd.withinBB_;
return is; return is;
} }
@ -432,7 +439,7 @@ public:
<< rd.donorPoint_ << token::SPACE << rd.donorPoint_ << token::SPACE
<< rd.extendedDonorCells_ << token::SPACE << rd.extendedDonorCells_ << token::SPACE
<< rd.extendedDonorPoints_ << token::SPACE << rd.extendedDonorPoints_ << token::SPACE
<< rd.donorWithinBB_; << rd.withinBB_;
return os; return os;
} }
}; };

View file

@ -420,7 +420,7 @@ bool Foam::adaptiveOverlapFringe::updateIteration
// Get current donor/acceptor pair // Get current donor/acceptor pair
const donorAcceptor& curDA = donorAcceptorRegionData[daPairI]; const donorAcceptor& curDA = donorAcceptorRegionData[daPairI];
if (!curDA.donorWithinBB()) if (!curDA.withinBB())
{ {
// Donor of this acceptor is not within bounding box. // Donor of this acceptor is not within bounding box.
// Append this pair to unsuitableDAPairs list. // Append this pair to unsuitableDAPairs list.

View file

@ -1165,17 +1165,17 @@ bool Foam::oversetRegion::updateDonorAcceptors() const
// Get index obtained by octree // Get index obtained by octree
const label donorCandidateIndex = pih.index(); const label donorCandidateIndex = pih.index();
// Donor within BB flag // Whether acceptor is within donor's bounding box
const bool donorWithinBB = mesh_.pointInCellBB const bool withinBB = mesh_.pointInCellBB
( (
curP, curP,
curDonors[donorCandidateIndex] curDonors[donorCandidateIndex]
); );
if if
( (
!daPair.donorFound() !daPair.donorFound()
|| donorWithinBB || withinBB
|| ( || (
mag(cc[curDonors[donorCandidateIndex]] - curP) mag(cc[curDonors[donorCandidateIndex]] - curP)
< mag(daPair.donorPoint() - curP) < mag(daPair.donorPoint() - curP)
@ -1187,8 +1187,8 @@ bool Foam::oversetRegion::updateDonorAcceptors() const
( (
curDonors[donorCandidateIndex], curDonors[donorCandidateIndex],
Pstream::myProcNo(), Pstream::myProcNo(),
cc[curDonors[donorCandidateIndex]], cc[curDonors[donorCandidateIndex]],
donorWithinBB withinBB
); );
// Set extended donors // Set extended donors
@ -1366,7 +1366,7 @@ bool Foam::oversetRegion::updateDonorAcceptors() const
// in oversetFringe // in oversetFringe
if if
( (
(curDA.donorWithinBB() && !curDACombined.donorWithinBB()) (curDA.withinBB() && !curDACombined.withinBB())
|| (curDA.distance() < curDACombined.distance()) || (curDA.distance() < curDACombined.distance())
) )
{ {
@ -1376,13 +1376,35 @@ bool Foam::oversetRegion::updateDonorAcceptors() const
( (
curDA.donorCell(), curDA.donorCell(),
curDA.donorProcNo(), curDA.donorProcNo(),
curDA.donorPoint(), curDA.donorPoint(),
curDA.donorWithinBB() curDA.withinBB()
); );
} }
} }
} }
// 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 // Check whether all acceptors have been visited. Used for testing/debugging
// parallel comms // parallel comms
if (oversetMesh::debug) if (oversetMesh::debug)