calculate sizes also when running non-parallel
This commit is contained in:
parent
f0ddc03279
commit
de97ff23b9
@ -50,43 +50,42 @@ void Pstream::exchange
|
|||||||
const bool block
|
const bool block
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (UPstream::parRun())
|
if (!contiguous<T>())
|
||||||
{
|
{
|
||||||
if (!contiguous<T>())
|
FatalErrorIn
|
||||||
{
|
(
|
||||||
FatalErrorIn
|
"Pstream::exchange(..)"
|
||||||
(
|
) << "Continuous data only." << Foam::abort(FatalError);
|
||||||
"Pstream::exchange(..)"
|
}
|
||||||
) << "Continuous data only." << Foam::abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sendBufs.size() != UPstream::nProcs())
|
if (sendBufs.size() != UPstream::nProcs())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Pstream::exchange(..)"
|
"Pstream::exchange(..)"
|
||||||
) << "Size of list:" << sendBufs.size()
|
) << "Size of list:" << sendBufs.size()
|
||||||
<< " does not equal the number of processors:"
|
<< " does not equal the number of processors:"
|
||||||
<< UPstream::nProcs()
|
<< UPstream::nProcs()
|
||||||
<< Foam::abort(FatalError);
|
<< Foam::abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
sizes.setSize(UPstream::nProcs());
|
sizes.setSize(UPstream::nProcs());
|
||||||
labelList& nsTransPs = sizes[UPstream::myProcNo()];
|
labelList& nsTransPs = sizes[UPstream::myProcNo()];
|
||||||
nsTransPs.setSize(UPstream::nProcs());
|
nsTransPs.setSize(UPstream::nProcs());
|
||||||
|
|
||||||
forAll(sendBufs, procI)
|
forAll(sendBufs, procI)
|
||||||
{
|
{
|
||||||
nsTransPs[procI] = sendBufs[procI].size();
|
nsTransPs[procI] = sendBufs[procI].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send sizes across.
|
|
||||||
int oldTag = UPstream::msgType();
|
|
||||||
UPstream::msgType() = tag;
|
|
||||||
combineReduce(sizes, UPstream::listEq());
|
|
||||||
UPstream::msgType() = oldTag;
|
|
||||||
|
|
||||||
|
// Send sizes across.
|
||||||
|
int oldTag = UPstream::msgType();
|
||||||
|
UPstream::msgType() = tag;
|
||||||
|
combineReduce(sizes, UPstream::listEq());
|
||||||
|
UPstream::msgType() = oldTag;
|
||||||
|
|
||||||
|
if (Pstream::parRun())
|
||||||
|
{
|
||||||
// Set up receives
|
// Set up receives
|
||||||
// ~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user