ENH: globalIndex: work in local mode
This commit is contained in:
parent
d21091c788
commit
1f1d559e20
@ -27,14 +27,22 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * 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)
|
offsets_(Pstream::nProcs()+1)
|
||||||
{
|
{
|
||||||
labelList localSizes(Pstream::nProcs());
|
labelList localSizes(Pstream::nProcs());
|
||||||
localSizes[Pstream::myProcNo()] = localSize;
|
localSizes[Pstream::myProcNo()] = localSize;
|
||||||
Pstream::gatherList(localSizes, tag);
|
if (parallel)
|
||||||
Pstream::scatterList(localSizes, tag);
|
{
|
||||||
|
Pstream::gatherList(localSizes, tag);
|
||||||
|
Pstream::scatterList(localSizes, tag);
|
||||||
|
}
|
||||||
|
|
||||||
label offset = 0;
|
label offset = 0;
|
||||||
offsets_[0] = 0;
|
offsets_[0] = 0;
|
||||||
|
@ -72,7 +72,12 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from local max size
|
//- 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
|
//- Construct from Istream
|
||||||
globalIndex(Istream& is);
|
globalIndex(Istream& is);
|
||||||
|
Loading…
Reference in New Issue
Block a user