Dynamically determine dataset type within a group and build a mpi struct correspondly

Hi everyone,
There is a HDF5 file, which contains several groups. Each group has multiple datasets. The dataset might be different types. A simple examples looks like:
HDF5 "ptf.h5" {
GROUP "/" {
   GROUP "g" {
      DATASET "a" {
         DATATYPE H5T_IEEE_F32LE
      }
      DATASET "b" {
         DATATYPE H5T_STD_I64LE
      }
      DATASET "c" {
         DATATYPE H5T_STD_I8LE
      }
      DATASET "d" {
         DATATYPE H5T_STD_I16LE
      }
}}

One job of my is to sort the whole group based on one dataset within MPI environment. One basic step of the sorting codes is to package each line of these four variables into one and exchange among MPI process. Right now, I define some static struct like below and use MPI_Type_create_struct/MPI_Type_commit to register this type. After registration, this compound type can be used for MPI_Sendrecv.

struct community_type{
float a;
double b;
char c;
short d;
}

In order to make the codes more general, one possible way is to dynamically determine the type of each dataset , then find its corresponding type in MPI, and finally call MPI_Type_create_struct/MPI_Type_commit to register this type.

Does anyone know any place I can find related information about this idea?

Thanks a lot,
Bin

···

--