Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
For File, we can change the default error handler by specifying MPI_FILE_NULL as...
[simgrid.git] / src / smpi / bindings / smpi_pmpi_type.cpp
index 7d3e0db..5e35a9d 100644 (file)
@@ -196,7 +196,8 @@ int PMPI_Type_create_indexed_block(int count, int blocklength, const int* indice
   }
 }
 
-int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type)
+int PMPI_Type_hindexed(int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type,
+                       MPI_Datatype* new_type)
 {
   if (old_type == MPI_DATATYPE_NULL) {
     return MPI_ERR_TYPE;
@@ -209,7 +210,7 @@ int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatyp
 
 int PMPI_Type_create_hindexed(int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type,
                               MPI_Datatype* new_type) {
-  return PMPI_Type_hindexed(count, const_cast<int*>(blocklens),const_cast<MPI_Aint*>(indices),old_type,new_type);
+  return PMPI_Type_hindexed(count, blocklens, indices, old_type, new_type);
 }
 
 int PMPI_Type_create_hindexed_block(int count, int blocklength, const MPI_Aint* indices, MPI_Datatype old_type,
@@ -228,7 +229,9 @@ int PMPI_Type_create_hindexed_block(int count, int blocklength, const MPI_Aint*
   }
 }
 
-int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
+int PMPI_Type_struct(int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types,
+                     MPI_Datatype* new_type)
+{
   if (count<0){
     return MPI_ERR_COUNT;
   } else {
@@ -241,7 +244,7 @@ int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype*
 
 int PMPI_Type_create_struct(int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types,
                             MPI_Datatype* new_type) {
-  return PMPI_Type_struct(count, const_cast<int*>(blocklens), const_cast<MPI_Aint*>(indices), const_cast<MPI_Datatype*>(old_types), new_type);
+  return PMPI_Type_struct(count, blocklens, indices, old_types, new_type);
 }
 
 
@@ -298,10 +301,14 @@ int PMPI_Type_get_name(MPI_Datatype  datatype, char * name, int* len)
 }
 
 MPI_Datatype PMPI_Type_f2c(MPI_Fint datatype){
+  if(datatype==-1)
+    return MPI_DATATYPE_NULL;
   return static_cast<MPI_Datatype>(simgrid::smpi::F2C::f2c(datatype));
 }
 
 MPI_Fint PMPI_Type_c2f(MPI_Datatype datatype){
+  if(datatype==MPI_DATATYPE_NULL)
+    return -1;
   return datatype->c2f();
 }