From 0a44baa84814f77e1726780efef683fad4321887 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 20 Mar 2017 10:02:43 -0600 Subject: [PATCH] add mpi_type_create_hvector --- mpi.h | 4 +++- type.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mpi.h b/mpi.h index ebe0b4e7..9183bf89 100644 --- a/mpi.h +++ b/mpi.h @@ -1,4 +1,3 @@ - #ifndef _MPI_H_ #define _MPI_H_ @@ -411,6 +410,9 @@ extern int MPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old extern int MPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype *newtype); +extern int MPI_Type_create_hvector(int count, int blocklen, MPI_Aint stride, + MPI_Datatype oldtype, MPI_Datatype *newtype); + extern int MPI_Type_indexed(int count, int *blocklens, int *displacements, MPI_Datatype oldtype, MPI_Datatype *newtype); diff --git a/type.c b/type.c index 22e3d305..8dd93f27 100644 --- a/type.c +++ b/type.c @@ -448,6 +448,23 @@ int MPI_Type_hvector(int count, int blocklen, MPI_Aint stride, return Type_hvector(count, blocklen, stride, old_ptr, new_ptr); } +FC_FUNC( mpi_type_create_hvector, MPI_TYPE_CREATE_HVECTOR ) + (int * count, long * blocklen, long * stride, + int * oldtype, int * newtype, int * ierr) +{ + *ierr = MPI_Type_create_hvector(*count, *blocklen, *stride, *oldtype, newtype); +} + +int MPI_Type_create_hvector(int count, int blocklen, MPI_Aint stride, + MPI_Datatype oldtype, MPI_Datatype * newtype) +{ + Datatype old_ptr = *(Datatype*) mpi_handle_to_datatype(oldtype); + Datatype * new_ptr; + + mpi_alloc_handle(newtype, (void**) &new_ptr); + return Type_hvector(count, blocklen, stride, old_ptr, new_ptr); +} + int Type_hvector(int count, int blocklen, MPI_Aint stride, Datatype oldtype, Datatype *newtype)