Commit 1e392009 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Make ranks argument of icetCommSubset constant

The subset command of the communicator takes an array of ranks, but that
array should not be changed. Declare that array const in all versions of
the function. (This requires a const cast when calling the MPI version
since that function does not take a const array even though it should.)
parent 0b9cf86f
......@@ -32,7 +32,7 @@
static IceTCommunicator MPIDuplicate(IceTCommunicator self);
static IceTCommunicator MPISubset(IceTCommunicator self,
int count,
IceTInt32 *ranks);
const IceTInt32 *ranks);
static void MPIDestroy(IceTCommunicator self);
static void MPIBarrier(IceTCommunicator self);
static void MPISend(IceTCommunicator self,
......@@ -271,7 +271,7 @@ static IceTCommunicator MPIDuplicate(IceTCommunicator self)
static IceTCommunicator MPISubset(IceTCommunicator self,
int count,
IceTInt32 *ranks)
const IceTInt32 *ranks)
MPI_Group original_group;
MPI_Group subset_group;
......@@ -279,7 +279,7 @@ static IceTCommunicator MPISubset(IceTCommunicator self,
IceTCommunicator result;
MPI_Comm_group(MPI_COMM, &original_group);
MPI_Group_incl(original_group, count, ranks, &subset_group);
MPI_Group_incl(original_group, count, (IceTInt32 *)ranks, &subset_group);
MPI_Comm_create(MPI_COMM, subset_group, &subset_comm);
result = icetCreateMPICommunicator(subset_comm);
......@@ -34,7 +34,7 @@ IceTCommunicator icetCommDuplicate()
return comm->Duplicate(comm);
IceTCommunicator icetCommSubset(int count, IceTInt32 *ranks)
IceTCommunicator icetCommSubset(int count, const IceTInt32 *ranks)
IceTCommunicator comm = icetGetCommunicator();
return comm->Subset(comm, count, ranks);
......@@ -53,7 +53,7 @@ struct IceTCommunicatorStruct {
struct IceTCommunicatorStruct *
(*Subset)(struct IceTCommunicatorStruct *self,
int count,
IceTInt32 *ranks);
const IceTInt32 *ranks);
void (*Barrier)(struct IceTCommunicatorStruct *self);
void (*Send)(struct IceTCommunicatorStruct *self,
const void *buf,
......@@ -23,7 +23,7 @@ extern "C" {
the current context. */
ICET_EXPORT IceTCommunicator icetCommDuplicate();
ICET_EXPORT IceTCommunicator icetCommSubset(int count,
IceTInt32 *ranks);
const IceTInt32 *ranks);
ICET_EXPORT void icetCommBarrier();
ICET_EXPORT void icetCommSend(const void *buf,
IceTSizeType count,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment