Skip to content
Snippets Groups Projects
Commit b9317723 authored by Mark OLESEN's avatar Mark OLESEN Committed by Mark OLESEN
Browse files

ENH: mapDistribute subMapTotalSize(), constructMapTotalSize()

- the sum of the respective list sizes

COMP: add noexcept to trivial mapDistribute constructors
parent 750d9084
Branches
Tags
1 merge request!623Support non-blocking construction of cyclic AMI
......@@ -148,13 +148,13 @@ void Foam::mapDistribute::printLayout(Ostream& os) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mapDistribute::mapDistribute()
Foam::mapDistribute::mapDistribute() noexcept
:
mapDistribute(UPstream::worldComm)
mapDistributeBase(UPstream::worldComm)
{}
Foam::mapDistribute::mapDistribute(const label comm)
Foam::mapDistribute::mapDistribute(const label comm) noexcept
:
mapDistributeBase(comm)
{}
......
......@@ -328,10 +328,10 @@ public:
using mapDistributeBase::mapDistributeBase;
//- Default construct - uses worldComm
mapDistribute();
mapDistribute() noexcept;
//- Default construct with specified communicator
explicit mapDistribute(const label comm);
explicit mapDistribute(const label comm) noexcept;
//- Move construct from base, no transforms
explicit mapDistribute(mapDistributeBase&& map);
......
......@@ -173,9 +173,9 @@ void Foam::mapDistributeBase::checkReceivedSize
if (receivedSize != expectedSize)
{
FatalErrorInFunction
<< "Expected from processor " << proci
<< " " << expectedSize << " but received "
<< receivedSize << " elements."
<< "From processor " << proci
<< " : expected " << expectedSize
<< " but received " << receivedSize << " elements" << nl
<< abort(FatalError);
}
}
......@@ -651,13 +651,13 @@ void Foam::mapDistributeBase::exchangeAddressing
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mapDistributeBase::mapDistributeBase()
Foam::mapDistributeBase::mapDistributeBase() noexcept
:
mapDistributeBase(UPstream::worldComm)
{}
Foam::mapDistributeBase::mapDistributeBase(const label comm)
Foam::mapDistributeBase::mapDistributeBase(const label comm) noexcept
:
constructSize_(0),
subMap_(),
......@@ -1014,7 +1014,6 @@ Foam::labelList Foam::mapDistributeBase::subMapSizes() const
{
sizes[i] = subMap_[i].size();
}
return sizes;
}
......@@ -1026,11 +1025,32 @@ Foam::labelList Foam::mapDistributeBase::constructMapSizes() const
{
sizes[i] = constructMap_[i].size();
}
return sizes;
}
Foam::label Foam::mapDistributeBase::subMapTotalSize() const noexcept
{
label total = 0;
for (const auto& list : subMap_)
{
total += list.size();
}
return total;
}
Foam::label Foam::mapDistributeBase::constructMapTotalSize() const noexcept
{
label total = 0;
for (const auto& list : constructMap_)
{
total += list.size();
}
return total;
}
void Foam::mapDistributeBase::clear()
{
constructSize_ = 0;
......
......@@ -147,7 +147,7 @@ protected:
// Protected Member Functions
//- Fatal if expected and received size are not equal
//- Fatal if expected != received size
static void checkReceivedSize
(
const label proci,
......@@ -375,10 +375,10 @@ public:
// Constructors
//- Default construct (uses worldComm)
mapDistributeBase();
mapDistributeBase() noexcept;
//- Default construct with specified communicator
explicit mapDistributeBase(const label comm);
explicit mapDistributeBase(const label comm) noexcept;
//- Copy construct
mapDistributeBase(const mapDistributeBase& map);
......@@ -585,6 +585,12 @@ public:
//- The sizes of the constructMap lists
labelList constructMapSizes() const;
//- The sum of the subMap list sizes
label subMapTotalSize() const noexcept;
//- The sum of the constructMap list sizes
label constructMapTotalSize() const noexcept;
// Schedule
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment