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)/meshTools/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \

View file

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

View file

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

View file

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