UPstream: Added const_cast for OpenMPI versions < 1.7.4

Note
    The const_cast used in this file is a temporary hack for to work around
    bugs in OpenMPI for versions < 1.7.4
This commit is contained in:
Henry Weller
2017-11-03 14:40:59 +00:00
parent a331fbe51a
commit 1da9266df3

View File

@ -21,6 +21,10 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Note
The const_cast used in this file is a temporary hack for to work around
bugs in OpenMPI for versions < 1.7.4
\*---------------------------------------------------------------------------*/
#include "UPstream.H"
@ -332,8 +336,6 @@ void Foam::UPstream::allToAll
(
MPI_Alltoall
(
// NOTE: const_cast is a temporary hack for
// backward-compatibility with versions of OpenMPI < 1.7.4
const_cast<label*>(sendData.begin()),
sizeof(label),
MPI_BYTE,
@ -403,13 +405,13 @@ void Foam::UPstream::allToAll
(
MPI_Alltoallv
(
sendData,
sendSizes.begin(),
sendOffsets.begin(),
const_cast<char*>(sendData),
const_cast<int*>(sendSizes.begin()),
const_cast<int*>(sendOffsets.begin()),
MPI_BYTE,
recvData,
recvSizes.begin(),
recvOffsets.begin(),
const_cast<int*>(recvSizes.begin()),
const_cast<int*>(recvOffsets.begin()),
MPI_BYTE,
PstreamGlobals::MPICommunicators_[communicator]
)
@ -465,12 +467,12 @@ void Foam::UPstream::gather
(
MPI_Gatherv
(
sendData,
const_cast<char*>(sendData),
sendSize,
MPI_BYTE,
recvData,
recvSizes.begin(),
recvOffsets.begin(),
const_cast<int*>(recvSizes.begin()),
const_cast<int*>(recvOffsets.begin()),
MPI_BYTE,
0,
MPI_Comm(PstreamGlobals::MPICommunicators_[communicator])
@ -524,9 +526,9 @@ void Foam::UPstream::scatter
(
MPI_Scatterv
(
sendData,
sendSizes.begin(),
sendOffsets.begin(),
const_cast<char*>(sendData),
const_cast<int*>(sendSizes.begin()),
const_cast<int*>(sendOffsets.begin()),
MPI_BYTE,
recvData,
recvSize,