Sending a DataType (via MPI)

If I want to tell another process to create a dataset using (for example) H5T_NATIVE_LONG or some other, is there an easy way of going from an identifier to a datatype.

I'm guessing no, because in h5dump, there is a somewhat laborious construction for going to/from a string...

      } else if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) {
          printf("H5T_NATIVE_SCHAR");
      } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) {
          printf("H5T_NATIVE_UCHAR");
      } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) {
          printf("H5T_NATIVE_SHORT");
      } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) {
          printf("H5T_NATIVE_USHORT");
      } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) {

Is there no utility function anywhere that does a DataTypeFromString and DataTypeToString kind of translation?

Or is there another easy way of doing it?

Thanks

JB

···

--
John Biddiscombe, email:biddisco @ cscs.ch

CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82

John,

Please take a look at the H5Tencode http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Encode and H5Tdecode functions.

Elena

···

On Nov 13, 2009, at 4:32 AM, Biddiscombe, John A. wrote:

If I want to tell another process to create a dataset using (for example) H5T_NATIVE_LONG or some other, is there an easy way of going from an identifier to a datatype.

I'm guessing no, because in h5dump, there is a somewhat laborious construction for going to/from a string...

     } else if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) {
         printf("H5T_NATIVE_SCHAR");
     } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) {
         printf("H5T_NATIVE_UCHAR");
     } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) {
         printf("H5T_NATIVE_SHORT");
     } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) {
         printf("H5T_NATIVE_USHORT");
     } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) {

Is there no utility function anywhere that does a DataTypeFromString and DataTypeToString kind of translation?

Or is there another easy way of doing it?

Thanks

JB

--
John Biddiscombe, email:biddisco @ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

John,

Please take a look at the H5Tencode http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Encode and H5Tdecode functions.

  Possibly the H5LTdtype_to_text and H5LTtext_to_dtype, also.

  Quincey

···

On Nov 13, 2009, at 10:03 AM, Elena Pourmal wrote:

Elena
On Nov 13, 2009, at 4:32 AM, Biddiscombe, John A. wrote:

If I want to tell another process to create a dataset using (for example) H5T_NATIVE_LONG or some other, is there an easy way of going from an identifier to a datatype.

I'm guessing no, because in h5dump, there is a somewhat laborious construction for going to/from a string...

    } else if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) {
        printf("H5T_NATIVE_SCHAR");
    } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) {
        printf("H5T_NATIVE_UCHAR");
    } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) {
        printf("H5T_NATIVE_SHORT");
    } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) {
        printf("H5T_NATIVE_USHORT");
    } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) {

Is there no utility function anywhere that does a DataTypeFromString and DataTypeToString kind of translation?

Or is there another easy way of doing it?

Thanks

JB

--
John Biddiscombe, email:biddisco @ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Thanks for both these options. The _to_text _to_dtype looks like it's just what I'm after.

JB

···

> Please take a look at the H5Tencode
http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Encode and
H5Tdecode functions.

  Possibly the H5LTdtype_to_text and H5LTtext_to_dtype, also.