ENH: globalIndex: work in local mode

This commit is contained in:
mattijs 2011-12-08 16:24:15 +00:00
parent d21091c788
commit 1f1d559e20
2 changed files with 17 additions and 4 deletions

View File

@ -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;

View File

@ -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);