mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: mapDistribute: extra constructor. Used in #284.
This commit is contained in:
@ -480,6 +480,17 @@ Foam::mapDistribute::mapDistribute
|
||||
}
|
||||
|
||||
|
||||
Foam::mapDistribute::mapDistribute
|
||||
(
|
||||
labelListList&& subMap,
|
||||
const bool subHasFlip,
|
||||
const bool constructHasFlip
|
||||
)
|
||||
:
|
||||
mapDistributeBase(std::move(subMap), subHasFlip, constructHasFlip)
|
||||
{}
|
||||
|
||||
|
||||
Foam::mapDistribute::mapDistribute(Istream& is)
|
||||
{
|
||||
is >> *this;
|
||||
|
||||
@ -325,10 +325,10 @@ public:
|
||||
mapDistribute();
|
||||
|
||||
//- Copy construct
|
||||
mapDistribute(const mapDistribute& map);
|
||||
explicit mapDistribute(const mapDistribute& map);
|
||||
|
||||
//- Move construct
|
||||
mapDistribute(mapDistribute&& map);
|
||||
explicit mapDistribute(mapDistribute&& map);
|
||||
|
||||
//- Move construct from components
|
||||
mapDistribute
|
||||
@ -416,8 +416,18 @@ public:
|
||||
const int tag = Pstream::msgType()
|
||||
);
|
||||
|
||||
//- Construct from my elements to send. Assumes layout is my elements
|
||||
// first followed by elements from all other processors in consecutive
|
||||
// order
|
||||
mapDistribute
|
||||
(
|
||||
labelListList&& subMap,
|
||||
const bool subHasFlip = false,
|
||||
const bool constructHasFlip = false
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
mapDistribute(Istream& is);
|
||||
explicit mapDistribute(Istream& is);
|
||||
|
||||
//- Clone
|
||||
autoPtr<mapDistribute> clone() const;
|
||||
|
||||
@ -790,6 +790,58 @@ Foam::mapDistributeBase::mapDistributeBase
|
||||
}
|
||||
|
||||
|
||||
Foam::mapDistributeBase::mapDistributeBase
|
||||
(
|
||||
labelListList&& subMap,
|
||||
const bool subHasFlip,
|
||||
const bool constructHasFlip
|
||||
)
|
||||
:
|
||||
constructSize_(0),
|
||||
subMap_(std::move(subMap)),
|
||||
subHasFlip_(subHasFlip),
|
||||
constructHasFlip_(constructHasFlip),
|
||||
schedulePtr_()
|
||||
{
|
||||
// Send over how many i need to receive.
|
||||
labelList recvSizes;
|
||||
Pstream::exchangeSizes(subMap_, recvSizes);
|
||||
|
||||
// Determine order of receiving
|
||||
labelListList constructMap(Pstream::nProcs());
|
||||
|
||||
// My local segments first
|
||||
label nLocal = recvSizes[Pstream::myProcNo()];
|
||||
{
|
||||
labelList& myMap = constructMap[Pstream::myProcNo()];
|
||||
myMap.setSize(nLocal);
|
||||
forAll(myMap, i)
|
||||
{
|
||||
myMap[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
label segmenti = nLocal;
|
||||
forAll(constructMap, proci)
|
||||
{
|
||||
if (proci != Pstream::myProcNo())
|
||||
{
|
||||
// What i need to receive is what other processor is sending to me.
|
||||
label nRecv = recvSizes[proci];
|
||||
constructMap[proci].setSize(nRecv);
|
||||
|
||||
for (label i = 0; i < nRecv; i++)
|
||||
{
|
||||
constructMap[proci][i] = segmenti++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constructSize_ = segmenti;
|
||||
constructMap_.transfer(constructMap);
|
||||
}
|
||||
|
||||
|
||||
Foam::mapDistributeBase::mapDistributeBase(Istream& is)
|
||||
{
|
||||
is >> *this;
|
||||
|
||||
@ -199,10 +199,10 @@ public:
|
||||
mapDistributeBase();
|
||||
|
||||
//- Copy construct
|
||||
mapDistributeBase(const mapDistributeBase& map);
|
||||
explicit mapDistributeBase(const mapDistributeBase& map);
|
||||
|
||||
//- Move construct
|
||||
mapDistributeBase(mapDistributeBase&& map);
|
||||
explicit mapDistributeBase(mapDistributeBase&& map);
|
||||
|
||||
//- Construct from components
|
||||
mapDistributeBase
|
||||
@ -246,6 +246,16 @@ public:
|
||||
const int tag = Pstream::msgType()
|
||||
);
|
||||
|
||||
//- Construct from my elements to send. Assumes layout is my elements
|
||||
// first followed by elements from all other processors in consecutive
|
||||
// order
|
||||
mapDistributeBase
|
||||
(
|
||||
labelListList&& subMap,
|
||||
const bool subHasFlip = false,
|
||||
const bool constructHasFlip = false
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
mapDistributeBase(Istream& is);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user