This source file includes following definitions.
- MPI_Type_create_hindexed_block
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 #include "ompi_config.h"
  18 
  19 #include "ompi/mpi/c/bindings.h"
  20 #include "ompi/runtime/params.h"
  21 #include "ompi/communicator/communicator.h"
  22 #include "ompi/errhandler/errhandler.h"
  23 #include "ompi/datatype/ompi_datatype.h"
  24 #include "ompi/memchecker.h"
  25 
  26 #if OMPI_BUILD_MPI_PROFILING
  27 #if OPAL_HAVE_WEAK_SYMBOLS
  28 #pragma weak MPI_Type_create_hindexed_block = PMPI_Type_create_hindexed_block
  29 #endif
  30 #define MPI_Type_create_hindexed_block PMPI_Type_create_hindexed_block
  31 #endif
  32 
  33 static const char FUNC_NAME[] = "MPI_Type_create_hindexed_block";
  34 
  35 
  36 int MPI_Type_create_hindexed_block(int count,
  37                                    int blocklength,
  38                                    const MPI_Aint array_of_displacements[],
  39                                    MPI_Datatype oldtype,
  40                                    MPI_Datatype *newtype)
  41 {
  42     int rc;
  43 
  44     MEMCHECKER(
  45         memchecker_datatype(oldtype);
  46         );
  47 
  48     if( MPI_PARAM_CHECK ) {
  49         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  50         if( count < 0 ) {
  51             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT,
  52                                           FUNC_NAME);
  53         } else if( (count > 0) && (blocklength < 0 || NULL == array_of_displacements) ) {
  54             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
  55                                           FUNC_NAME );
  56         } else if (NULL == oldtype || MPI_DATATYPE_NULL == oldtype ||
  57                    NULL == newtype) {
  58             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE,
  59                                           FUNC_NAME );
  60         }
  61     }
  62 
  63     OPAL_CR_ENTER_LIBRARY();
  64 
  65     rc = ompi_datatype_create_hindexed_block( count, blocklength, array_of_displacements,
  66                                               oldtype, newtype );
  67     if( rc != MPI_SUCCESS ) {
  68         ompi_datatype_destroy( newtype );
  69         OMPI_ERRHANDLER_RETURN( rc, MPI_COMM_WORLD, rc, FUNC_NAME );
  70     }
  71     {
  72         const int* a_i[2] = {&count, &blocklength};
  73         ompi_datatype_set_args( *newtype, 2, a_i, count, array_of_displacements, 1, &oldtype,
  74                                 MPI_COMBINER_HINDEXED_BLOCK );
  75     }
  76 
  77     OPAL_CR_EXIT_LIBRARY();
  78     return MPI_SUCCESS;
  79 }