Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sed -i -e 's/\t/ /g' [sources] Please people, stop using tabs
[simgrid.git] / src / smpi / smpi_mpi_dt.c
index f5266ae..9342827 100644 (file)
@@ -1,7 +1,7 @@
 /* smpi_mpi_dt.c -- MPI primitives to handle datatypes                        */
 /* FIXME: a very incomplete implementation                                    */
 
-/* Copyright (c) 2009-2014. The SimGrid Team.
+/* Copyright (c) 2009-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@ int type_keyval_id=0;//avoid collisions
     NULL,           /* pointer on extended struct*/   \
     0               /* in_use counter */              \
   };                                                  \
-MPI_Datatype name = &mpi_##name;
+const MPI_Datatype name = &mpi_##name;
 
 #define CREATE_MPI_DATATYPE_NULL(name)                \
   static s_smpi_mpi_datatype_t mpi_##name = {         \
@@ -49,7 +49,7 @@ MPI_Datatype name = &mpi_##name;
     NULL,           /* pointer on extended struct*/   \
     0               /* in_use counter */              \
   };                                                  \
-MPI_Datatype name = &mpi_##name;
+const MPI_Datatype name = &mpi_##name;
 
 //The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC.
 typedef struct {
@@ -547,8 +547,8 @@ int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new
 {
   int retval;
   if(old_type->has_subtype){
-         //handle this case as a hvector with stride equals to the extent of the datatype
-         return smpi_datatype_hvector(count, 1, smpi_datatype_get_extent(old_type), old_type, new_type);
+    //handle this case as a hvector with stride equals to the extent of the datatype
+    return smpi_datatype_hvector(count, 1, smpi_datatype_get_extent(old_type), old_type, new_type);
   }
   
   s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
@@ -557,9 +557,9 @@ int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new
                                                                 smpi_datatype_size(old_type));
                                                                 
   smpi_datatype_create(new_type,
-                                         count * smpi_datatype_size(old_type),
-                                         lb,lb + count * smpi_datatype_size(old_type),
-                                         1,subtype, DT_FLAG_CONTIGUOUS);
+            count * smpi_datatype_size(old_type),
+            lb,lb + count * smpi_datatype_size(old_type),
+            1,subtype, DT_FLAG_CONTIGUOUS);
   retval=MPI_SUCCESS;
   return retval;
 }
@@ -736,7 +736,7 @@ int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype
                                                                   smpi_datatype_size(old_type));
 
     smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type),
-                                                lb,ub,
+             lb,ub,
                          1,
                          subtype,
                          DT_FLAG_VECTOR);
@@ -893,9 +893,9 @@ int smpi_datatype_indexed(int count, int* blocklens, int* indices, MPI_Datatype
     size += blocklens[i];
 
     if(indices[i]*smpi_datatype_get_extent(old_type)+smpi_datatype_lb(old_type)<lb)
-       lb = indices[i]*smpi_datatype_get_extent(old_type)+smpi_datatype_lb(old_type);
+      lb = indices[i]*smpi_datatype_get_extent(old_type)+smpi_datatype_lb(old_type);
     if(indices[i]*smpi_datatype_get_extent(old_type)+blocklens[i]*smpi_datatype_ub(old_type)>ub)
-       ub = indices[i]*smpi_datatype_get_extent(old_type)+blocklens[i]*smpi_datatype_ub(old_type);
+      ub = indices[i]*smpi_datatype_get_extent(old_type)+blocklens[i]*smpi_datatype_ub(old_type);
 
     if ( (i< count -1) && (indices[i]+blocklens[i] != indices[i+1]) )contiguous=0;
   }
@@ -1072,7 +1072,7 @@ int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Dat
                                                                   old_type,
                                                                   smpi_datatype_size(old_type));
     smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type),
-                                                lb,
+             lb,
                          ub
                          ,1, subtype, DT_FLAG_DATA);
   }else{
@@ -1081,8 +1081,8 @@ int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Dat
                                                                   old_type,
                                                                   smpi_datatype_size(old_type));
     smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type),
-                                            0,size * smpi_datatype_size(old_type),
-                                            1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
+               0,size * smpi_datatype_size(old_type),
+               1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
   }
   retval=MPI_SUCCESS;
   return retval;