mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: avoid read/write of empty slots for globalIndex gather
This commit is contained in:
@ -108,7 +108,11 @@ void Foam::globalIndex::gather
|
||||
{
|
||||
SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
||||
|
||||
if (is_contiguous<Type>::value)
|
||||
if (procSlot.empty())
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
else if (is_contiguous<Type>::value)
|
||||
{
|
||||
IPstream::read
|
||||
(
|
||||
@ -136,7 +140,11 @@ void Foam::globalIndex::gather
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_contiguous<Type>::value)
|
||||
if (fld.empty())
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
else if (is_contiguous<Type>::value)
|
||||
{
|
||||
OPstream::write
|
||||
(
|
||||
@ -210,28 +218,42 @@ void Foam::globalIndex::gather
|
||||
{
|
||||
SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
||||
|
||||
IPstream fromProc
|
||||
(
|
||||
commsType,
|
||||
procIDs[i],
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
fromProc >> procSlot;
|
||||
if (procSlot.empty())
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
IPstream fromProc
|
||||
(
|
||||
commsType,
|
||||
procIDs[i],
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
fromProc >> procSlot;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster
|
||||
(
|
||||
commsType,
|
||||
procIDs[0],
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
toMaster << fld;
|
||||
if (fld.empty())
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster
|
||||
(
|
||||
commsType,
|
||||
procIDs[0],
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
toMaster << fld;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,6 +707,10 @@ void Foam::globalIndex::scatter
|
||||
// Could also warn and change to scheduled etc...
|
||||
}
|
||||
|
||||
// FUTURE:
|
||||
// could decide which procs will receive data and use mpiScatter
|
||||
// to distribute. Could then skip send/receive for those procs...
|
||||
|
||||
const label startOfRequests = UPstream::nRequests();
|
||||
|
||||
if (Pstream::myProcNo(comm) == procIDs[0])
|
||||
|
||||
Reference in New Issue
Block a user