Skip to content
Snippets Groups Projects
Commit 1f1d559e authored by mattijs's avatar mattijs
Browse files

ENH: globalIndex: work in local mode

parent d21091c7
Branches
Tags
No related merge requests found
......@@ -27,14 +27,22 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::globalIndex::globalIndex(const label localSize, const int tag)
Foam::globalIndex::globalIndex
(
const label localSize,
const int tag,
const bool parallel
)
:
offsets_(Pstream::nProcs()+1)
{
labelList localSizes(Pstream::nProcs());
localSizes[Pstream::myProcNo()] = localSize;
Pstream::gatherList(localSizes, tag);
Pstream::scatterList(localSizes, tag);
if (parallel)
{
Pstream::gatherList(localSizes, tag);
Pstream::scatterList(localSizes, tag);
}
label offset = 0;
offsets_[0] = 0;
......
......@@ -72,7 +72,12 @@ public:
// Constructors
//- Construct from local max size
globalIndex(const label localSize, const int tag = Pstream::msgType());
globalIndex
(
const label localSize,
const int tag = Pstream::msgType(),
const bool parallel = true // use parallel comms
);
//- Construct from Istream
globalIndex(Istream& is);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment