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:39:28 +00:00
parent ba26df7ed6
commit 83293fa32e

View file

@ -21,6 +21,10 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 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" #include "UPstream.H"
@ -332,8 +336,6 @@ void Foam::UPstream::allToAll
( (
MPI_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()), const_cast<label*>(sendData.begin()),
sizeof(label), sizeof(label),
MPI_BYTE, MPI_BYTE,
@ -403,13 +405,13 @@ void Foam::UPstream::allToAll
( (
MPI_Alltoallv MPI_Alltoallv
( (
sendData, const_cast<char*>(sendData),
sendSizes.begin(), const_cast<int*>(sendSizes.begin()),
sendOffsets.begin(), const_cast<int*>(sendOffsets.begin()),
MPI_BYTE, MPI_BYTE,
recvData, recvData,
recvSizes.begin(), const_cast<int*>(recvSizes.begin()),
recvOffsets.begin(), const_cast<int*>(recvOffsets.begin()),
MPI_BYTE, MPI_BYTE,
PstreamGlobals::MPICommunicators_[communicator] PstreamGlobals::MPICommunicators_[communicator]
) )
@ -465,12 +467,12 @@ void Foam::UPstream::gather
( (
MPI_Gatherv MPI_Gatherv
( (
sendData, const_cast<char*>(sendData),
sendSize, sendSize,
MPI_BYTE, MPI_BYTE,
recvData, recvData,
recvSizes.begin(), const_cast<int*>(recvSizes.begin()),
recvOffsets.begin(), const_cast<int*>(recvOffsets.begin()),
MPI_BYTE, MPI_BYTE,
0, 0,
MPI_Comm(PstreamGlobals::MPICommunicators_[communicator]) MPI_Comm(PstreamGlobals::MPICommunicators_[communicator])
@ -524,9 +526,9 @@ void Foam::UPstream::scatter
( (
MPI_Scatterv MPI_Scatterv
( (
sendData, const_cast<char*>(sendData),
sendSizes.begin(), const_cast<int*>(sendSizes.begin()),
sendOffsets.begin(), const_cast<int*>(sendOffsets.begin()),
MPI_BYTE, MPI_BYTE,
recvData, recvData,
recvSize, recvSize,