Fortran API review
This commit is contained in:
+141
-329
@@ -13,298 +13,113 @@
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_model.h"
|
||||
|
||||
/* file handling interface */
|
||||
static inline h5_int64_t
|
||||
open_file (
|
||||
const char *name,
|
||||
const int l_name,
|
||||
h5_int32_t flags,
|
||||
MPI_Comm ccomm,
|
||||
h5_size_t align
|
||||
#define h5_createprop_file F77_NAME( \
|
||||
h5_createprop_file, \
|
||||
h5_createprop_file_, \
|
||||
H5_CREATEPROP_FILE)
|
||||
h5_int64_t
|
||||
h5_createprop_file (
|
||||
void
|
||||
) {
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_file_t f = h5_open_file ( name2, flags, ccomm, align );
|
||||
free ( name2 );
|
||||
return (h5_int64_t)f;
|
||||
H5_API_ENTER (h5_int64_t, "%s", "");
|
||||
H5_API_RETURN ((h5_int64_t)h5_create_prop (H5_PROP_FILE));
|
||||
}
|
||||
|
||||
#define h5_openr F77_NAME( \
|
||||
h5_openr, \
|
||||
h5_openr_, \
|
||||
H5_OPENR)
|
||||
#define h5_setprop_filempio F77_NAME( \
|
||||
h5_setprop_filempio, \
|
||||
h5_setprop_filempio_, \
|
||||
H5_SETPROP_FILEMPIO)
|
||||
h5_int64_t
|
||||
h5_openr (
|
||||
const char *file_name,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%s'",
|
||||
file_name);
|
||||
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_RDONLY, 0, 0));
|
||||
h5_setprop_filempio (
|
||||
h5_int64_t* _prop,
|
||||
MPI_Fint* _comm
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"prop=%lld, comm=%lld",
|
||||
(long long int)*_prop, (long long int)*_comm);
|
||||
h5_prop_t prop = (h5_prop_t)*_prop;
|
||||
MPI_Comm comm = MPI_Comm_f2c (*_comm);
|
||||
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio (prop, &comm));
|
||||
}
|
||||
|
||||
#define h5_openw F77_NAME( \
|
||||
h5_openw, \
|
||||
h5_openw_, \
|
||||
H5_OPENW)
|
||||
#define h5_setprop_filealign F77_NAME ( \
|
||||
h5_setprop_filealign, \
|
||||
h5_setprop_filealign_, \
|
||||
H5_SETPROP_FILEALIGN)
|
||||
h5_int64_t
|
||||
h5_openw (
|
||||
const char *file_name,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%s'",
|
||||
file_name);
|
||||
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_WRONLY, 0, 0));
|
||||
h5_setprop_filealign (
|
||||
h5_int64_t* _prop,
|
||||
h5_int64_t* align
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"prop=%lld, align=%lld",
|
||||
(long long int)*_prop, (long long int)*align);
|
||||
h5_prop_t prop = (h5_prop_t)*_prop;
|
||||
H5_API_RETURN (h5_set_prop_file_align (prop, *align));
|
||||
}
|
||||
|
||||
#define h5_opena F77_NAME( \
|
||||
h5_opena, \
|
||||
h5_opena_, \
|
||||
H5_OPENA)
|
||||
#define h5_setprop_filethrottle F77_NAME ( \
|
||||
h5_setprop_filethrottle, \
|
||||
h5_setprop_filethrottle_, \
|
||||
H5_SETPROP_FILETHROTTLE)
|
||||
|
||||
h5_int64_t
|
||||
h5_opena (
|
||||
const char *file_name,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%s'",
|
||||
file_name);
|
||||
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_APPEND, 0, 0));
|
||||
h5_setprop_filethrottle (
|
||||
h5_int64_t* _prop,
|
||||
h5_int64_t* throttle
|
||||
) {
|
||||
H5_API_ENTER (
|
||||
h5_err_t,
|
||||
"prop=%lld, throttle=%lld",
|
||||
(long long int)*_prop, (long long int)*throttle);
|
||||
h5_prop_t prop = (h5_prop_t)*_prop;
|
||||
H5_API_RETURN (h5_set_prop_file_throttle (prop, *throttle));
|
||||
}
|
||||
|
||||
#define h5_openr_align F77_NAME( \
|
||||
h5_openr_align, \
|
||||
h5_openr_align_, \
|
||||
H5_OPENR_ALIGN)
|
||||
#define h5_closeprop F77_NAME ( \
|
||||
h5_closeprop, \
|
||||
h5_closeprop_, \
|
||||
H5_CLOSEPROP)
|
||||
h5_int64_t
|
||||
h5_openr_align (
|
||||
const char *file_name,
|
||||
const h5_int64_t *align,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu",
|
||||
file_name, (long long unsigned)align);
|
||||
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_RDONLY, 0, *align));
|
||||
h5_closeprop (
|
||||
h5_int64_t* _prop
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"prop=%lld",
|
||||
(long long int)*_prop);
|
||||
h5_prop_t prop = (h5_prop_t)*_prop;
|
||||
H5_API_RETURN (h5_close_prop (prop));
|
||||
}
|
||||
|
||||
#define h5_openw_align F77_NAME( \
|
||||
h5_openw_align, \
|
||||
h5_openw_align_, \
|
||||
H5_OPENW_ALIGN)
|
||||
#define h5_openfile F77_NAME( \
|
||||
h5_openfile, \
|
||||
h5_openfile_, \
|
||||
H5_OPENFILE)
|
||||
h5_int64_t
|
||||
h5_openw_align (
|
||||
const char *file_name,
|
||||
const h5_int64_t *align,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu",
|
||||
file_name, (long long unsigned)align);
|
||||
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_WRONLY, 0, *align));
|
||||
h5_openfile (
|
||||
const char* _fname,
|
||||
h5_int64_t* _mode,
|
||||
h5_int64_t* _props,
|
||||
const int _len_fname
|
||||
) {
|
||||
int len_fname = strlenf (_fname, _len_fname);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fname = %*s, mode=%lld, props=%lld",
|
||||
len_fname, _fname, (long long int)*_mode, (long long int)*_props);
|
||||
char* fname = h5_strdupfor2c (_fname, _len_fname);
|
||||
h5_int64_t mode = *_mode;
|
||||
h5_prop_t props = (h5_prop_t)*_props;
|
||||
h5_file_t f = h5_open_file2 (fname, mode, props);
|
||||
free (fname);
|
||||
H5_API_RETURN ((h5_int64_t)f);
|
||||
}
|
||||
|
||||
#define h5_opena_align F77_NAME( \
|
||||
h5_opena_align, \
|
||||
h5_opena_align_, \
|
||||
H5_OPENA_ALIGN)
|
||||
#define h5_closefile F77_NAME( \
|
||||
h5_closefile, \
|
||||
h5_closefile_, \
|
||||
H5_CLOSEFILE)
|
||||
h5_int64_t
|
||||
h5_opena_align (
|
||||
const char *file_name,
|
||||
const h5_int64_t *align,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu",
|
||||
file_name, (long long unsigned)align);
|
||||
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_APPEND, 0, *align));
|
||||
}
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
h5_int32_t
|
||||
flagsfor2c (
|
||||
const char* flags,
|
||||
const int l_flags
|
||||
) {
|
||||
if (flags == NULL)
|
||||
return 0;
|
||||
|
||||
h5_int32_t fbits = 0;
|
||||
char* flags2 = h5_strdupfor2c (flags, l_flags);
|
||||
|
||||
flags2 = strtok (flags2, ",");
|
||||
while (flags != NULL) {
|
||||
if (strcmp (flags2, "vfd_mpiposix") == 0)
|
||||
fbits |= H5_VFD_MPIPOSIX;
|
||||
else if (strcmp (flags2, "vfd_core") == 0)
|
||||
fbits |= H5_VFD_CORE;
|
||||
else if (strcmp (flags2, "vfd_mpio_ind") == 0)
|
||||
fbits |= H5_VFD_MPIIO_IND;
|
||||
else if (strcmp (flags2, "fs_lustre") == 0)
|
||||
fbits |= H5_FS_LUSTRE;
|
||||
else {
|
||||
// :FIXME: ignore unknown strings!?
|
||||
}
|
||||
flags2 = strtok (NULL, ",");
|
||||
}
|
||||
free (flags2);
|
||||
return fbits;
|
||||
}
|
||||
|
||||
static inline h5_int64_t
|
||||
open_file_par (
|
||||
const char* file_name,
|
||||
const int l_file_name,
|
||||
MPI_Fint* fcomm,
|
||||
const h5_int32_t mode,
|
||||
const char* flags,
|
||||
const int l_flags,
|
||||
h5_int64_t align
|
||||
) {
|
||||
return open_file (
|
||||
file_name, l_file_name,
|
||||
mode | flagsfor2c (flags, l_flags),
|
||||
MPI_Comm_f2c (*fcomm),
|
||||
align);
|
||||
}
|
||||
|
||||
#define h5_openr_par F77_NAME( \
|
||||
h5_openr_par, \
|
||||
h5_openr_par_, \
|
||||
H5_OPENR_PAR)
|
||||
h5_int64_t
|
||||
h5_openr_par (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d",
|
||||
l_file_name, file_name, *fcomm);
|
||||
H5_API_RETURN (
|
||||
open_file_par (
|
||||
file_name, l_file_name,
|
||||
fcomm,
|
||||
H5_O_RDONLY,
|
||||
NULL, 0,
|
||||
0));
|
||||
}
|
||||
|
||||
#define h5_openw_par F77_NAME( \
|
||||
h5_openw_par, \
|
||||
h5_openw_par_, \
|
||||
H5_OPENW_PAR)
|
||||
h5_int64_t
|
||||
h5_openw_par (
|
||||
const char* file_name,
|
||||
MPI_Fint* fcomm,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d",
|
||||
l_file_name, file_name, *fcomm);
|
||||
H5_API_RETURN (
|
||||
open_file_par (
|
||||
file_name, l_file_name,
|
||||
fcomm,
|
||||
H5_O_WRONLY,
|
||||
NULL, 0,
|
||||
0));
|
||||
}
|
||||
|
||||
#define h5_opena_par F77_NAME( \
|
||||
h5_opena_par, \
|
||||
h5_opena_par_, \
|
||||
H5_OPENA_PAR)
|
||||
h5_int64_t
|
||||
h5_opena_par (
|
||||
const char* file_name,
|
||||
MPI_Fint* fcomm,
|
||||
const int l_file_name
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d",
|
||||
l_file_name, file_name, *fcomm);
|
||||
H5_API_RETURN (
|
||||
open_file_par (
|
||||
file_name, l_file_name,
|
||||
fcomm,
|
||||
H5_O_APPEND,
|
||||
NULL, 0,
|
||||
0));
|
||||
}
|
||||
|
||||
#define h5_openr_par_align F77_NAME( \
|
||||
h5_openr_par_align, \
|
||||
h5_openr_par_align_, \
|
||||
H5_OPENR_PAR_ALIGN)
|
||||
h5_int64_t
|
||||
h5_openr_par_align (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const h5_int64_t *align,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld",
|
||||
l_file_name, file_name, *fcomm, flags, (long long)align);
|
||||
H5_API_RETURN (
|
||||
open_file_par (
|
||||
file_name, l_file_name,
|
||||
fcomm,
|
||||
H5_O_RDONLY,
|
||||
flags, l_flags,
|
||||
*align));
|
||||
}
|
||||
|
||||
#define h5_openw_par_align F77_NAME( \
|
||||
h5_openw_par_align, \
|
||||
h5_openw_par_align_, \
|
||||
H5_OPENW_PAR_ALIGN)
|
||||
h5_int64_t
|
||||
h5_openw_par_align (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const h5_int64_t *align,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld",
|
||||
l_file_name, file_name, *fcomm, flags, (long long)align);
|
||||
H5_API_RETURN (
|
||||
open_file_par (
|
||||
file_name, l_file_name,
|
||||
fcomm,
|
||||
H5_O_WRONLY,
|
||||
flags, l_flags,
|
||||
*align));
|
||||
}
|
||||
|
||||
#define h5_opena_par_align F77_NAME( \
|
||||
h5_opena_par_align, \
|
||||
h5_opena_par_align_, \
|
||||
H5_OPENA_PAR_ALIGN)
|
||||
h5_int64_t
|
||||
h5_opena_par_align (
|
||||
const char *file_name,
|
||||
MPI_Fint *fcomm,
|
||||
const h5_int64_t *align,
|
||||
const char *flags,
|
||||
const int l_file_name,
|
||||
const int l_flags
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld",
|
||||
l_file_name, file_name, *fcomm, flags, (long long)align);
|
||||
H5_API_RETURN (
|
||||
open_file_par (
|
||||
file_name, l_file_name,
|
||||
fcomm,
|
||||
H5_O_APPEND,
|
||||
flags, l_flags,
|
||||
*align));
|
||||
}
|
||||
#endif
|
||||
|
||||
#define h5_close F77_NAME( \
|
||||
h5_close, \
|
||||
h5_close_, \
|
||||
H5_CLOSE)
|
||||
h5_int64_t
|
||||
h5_close (
|
||||
h5_closefile (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
@@ -312,6 +127,45 @@ h5_close (
|
||||
H5_API_RETURN (h5_close_file (fh));
|
||||
}
|
||||
|
||||
#define h5_checkfile F77_NAME( \
|
||||
h5_checkfile, \
|
||||
h5_checkfile_, \
|
||||
H5_CHECKFILE)
|
||||
h5_int64_t
|
||||
h5_checkfile (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_check_filehandle (fh));
|
||||
}
|
||||
|
||||
#define h5_flushfile F77_NAME( \
|
||||
h5_flushfile, \
|
||||
h5_flushfile_, \
|
||||
H5_FLUSHFILE)
|
||||
h5_int64_t
|
||||
h5_flushfile (
|
||||
const h5_int64_t* f
|
||||
) {
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_flush_file (fh));
|
||||
}
|
||||
|
||||
#define h5_flushstep F77_NAME( \
|
||||
h5_flushstep, \
|
||||
h5_flushstep_, \
|
||||
H5_FLUSHSTEP)
|
||||
h5_int64_t
|
||||
h5_flushstep (
|
||||
const h5_int64_t* f
|
||||
) {
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_flush_step (fh));
|
||||
}
|
||||
|
||||
#define h5_finalize F77_NAME( \
|
||||
h5_finalize, \
|
||||
h5_finalize_, \
|
||||
@@ -324,62 +178,6 @@ h5_finalize (
|
||||
H5_API_RETURN (h5_close_hdf5());
|
||||
}
|
||||
|
||||
#define h5_check F77_NAME( \
|
||||
h5_check, \
|
||||
h5_check_, \
|
||||
H5_CHECK)
|
||||
h5_int64_t
|
||||
h5_check (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_check_filehandle (fh));
|
||||
}
|
||||
|
||||
/* H5hut data model */
|
||||
#define h5_setstep F77_NAME( \
|
||||
h5_setstep, \
|
||||
h5_setstep_, \
|
||||
H5_SETSTEP)
|
||||
h5_int64_t
|
||||
h5_setstep (
|
||||
const h5_int64_t *f,
|
||||
h5_int64_t *step ) {
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p, step=%lld", (h5_file_p)fh, (long long)*step);
|
||||
H5_API_RETURN (h5_set_step (fh, (*step)-1));
|
||||
}
|
||||
|
||||
#define h5_getstep F77_NAME( \
|
||||
h5_getstep, \
|
||||
h5_getstep_, \
|
||||
H5_GETSTEP)
|
||||
h5_int64_t
|
||||
h5_getstep (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_get_step (fh) + 1);
|
||||
}
|
||||
|
||||
#define h5_getnsteps F77_NAME( \
|
||||
h5_getnsteps, \
|
||||
h5_getnsteps_, \
|
||||
H5_GETNSTEPS)
|
||||
h5_int64_t
|
||||
h5_getnsteps (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_get_num_steps (fh));
|
||||
}
|
||||
|
||||
|
||||
/* debug output */
|
||||
@@ -396,3 +194,17 @@ h5_set_verbosity_level (
|
||||
H5_API_RETURN(h5_set_debuglevel (*level));
|
||||
}
|
||||
|
||||
#define h5_abort_on_error F77_NAME( \
|
||||
h5_abort_on_error, \
|
||||
h5_abort_on_error_, \
|
||||
H5_ABORT_ON_ERROR)
|
||||
h5_int64_t
|
||||
h5_abort_on_error (
|
||||
void
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "%s", "");
|
||||
h5_set_debuglevel (1);
|
||||
H5_API_RETURN (h5_set_errorhandler (h5_abort_errorhandler));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ h5bl_getfieldattribinfo (
|
||||
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
h5_int64_t attrib_type;
|
||||
h5_int64_t herr = h5b_get_field_attrib_info (
|
||||
h5_int64_t herr = h5b_get_field_attrib_info_by_idx (
|
||||
f,
|
||||
field_name2, *attrib_idx - 1,
|
||||
attrib_name, l_attrib_name,
|
||||
|
||||
@@ -39,9 +39,9 @@ h5_getnfileattribs (
|
||||
}
|
||||
|
||||
#define h5_getfileattribinfo F77_NAME( \
|
||||
h5_getfileattribinfo, \
|
||||
h5_getfileattribinfo_, \
|
||||
H5_GETFILEATTRIBINFO)
|
||||
h5_getfileattribinfo, \
|
||||
h5_getfileattribinfo_, \
|
||||
H5_GETFILEATTRIBINFO)
|
||||
h5_int64_t
|
||||
h5_getfileattribinfo (
|
||||
const h5_int64_t* const fh,
|
||||
@@ -61,7 +61,7 @@ h5_getfileattribinfo (
|
||||
(h5_file_p)fh,
|
||||
(long long)*attrib_idx,
|
||||
attrib_name, attrib_type, attrib_nelem);
|
||||
h5_int64_t h5err = h5_get_file_attrib_info (
|
||||
h5_int64_t h5err = h5_get_file_attrib_info_by_idx (
|
||||
f,
|
||||
*attrib_idx - 1,
|
||||
attrib_name, l_attrib_name,
|
||||
@@ -72,6 +72,36 @@ h5_getfileattribinfo (
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
#define h5_getfileattribinfo_by_name F77_NAME( \
|
||||
h5_getfileattribinfo_by_name, \
|
||||
h5_getfileattribinfo_by_name_, \
|
||||
H5_GETFILEATTRIBINFO_BY_NAME)
|
||||
h5_int64_t
|
||||
h5_getfileattribinfo_by_name (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const _name,
|
||||
h5_int64_t* const _type,
|
||||
h5_int64_t* const _nelem,
|
||||
const int l_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c(fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, "
|
||||
"name=%.*s, "
|
||||
"type=%p, "
|
||||
"nelem=%p",
|
||||
(h5_file_p)fh,
|
||||
l_name, _name, _type, _nelem);
|
||||
char* name = h5_strdupfor2c (_name, l_name);
|
||||
h5_int64_t h5err = h5_get_file_attrib_info_by_name (
|
||||
f,
|
||||
name,
|
||||
_type,
|
||||
(h5_size_t*)_nelem);
|
||||
convert_type2for (_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
/*
|
||||
_ __
|
||||
(_) / /__
|
||||
@@ -309,8 +339,8 @@ h5_writefileattrib_i4 (
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c(fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
"fh=%p, name='%.*s', buffer[12]=%d, %x, %x, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer[12], buffer[13], buffer[14], (long long)*nelem);
|
||||
H5_API_RETURN (write_file_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
@@ -386,7 +416,7 @@ h5_getstepattribinfo (
|
||||
(h5_file_p)f,
|
||||
(long long)*attrib_idx,
|
||||
attrib_name, attrib_type, attrib_nelem);
|
||||
h5_int64_t h5err = h5_get_step_attrib_info (
|
||||
h5_int64_t h5err = h5_get_step_attrib_info_by_idx (
|
||||
f,
|
||||
*attrib_idx - 1,
|
||||
attrib_name, l_attrib_name,
|
||||
@@ -397,6 +427,36 @@ h5_getstepattribinfo (
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
#define h5_getstepattribinfo_by_name F77_NAME( \
|
||||
h5_getstepattribinfo_by_name, \
|
||||
h5_getstepattribinfo_by_name_, \
|
||||
H5_GETSTEPATTRIBINFO_BY_NAME)
|
||||
h5_int64_t
|
||||
h5_getstepattribinfo_by_name (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const _name,
|
||||
h5_int64_t* const _type,
|
||||
h5_int64_t* const _nelem,
|
||||
const int l_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c(fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, "
|
||||
"name=%.*s, "
|
||||
"type=%p, "
|
||||
"nelem=%p",
|
||||
(h5_file_p)fh,
|
||||
l_name, _name, _type, _nelem);
|
||||
char* name = h5_strdupfor2c (_name, l_name);
|
||||
h5_int64_t h5err = h5_get_step_attrib_info_by_name (
|
||||
f,
|
||||
name,
|
||||
_type,
|
||||
(h5_size_t*)_nelem);
|
||||
convert_type2for (_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
static inline h5_int64_t
|
||||
write_step_attrib (
|
||||
const h5_file_t fh,
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (c) 2006-2013, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5_private.h"
|
||||
|
||||
#include "h5core/h5.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_model.h"
|
||||
|
||||
/* H5hut data model */
|
||||
|
||||
#define h5_hasstep F77_NAME( \
|
||||
h5_hasstep, \
|
||||
h5_hasstep_, \
|
||||
H5_HASSTEP)
|
||||
int
|
||||
h5_hasstep (
|
||||
const h5_int64_t* f,
|
||||
const h5_int64_t* stepno
|
||||
) {
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (
|
||||
int,
|
||||
"f=%p, stepno=%lld",
|
||||
(h5_file_p)fh, (long long int)stepno);
|
||||
H5_API_RETURN (h5_has_step (fh, *stepno));
|
||||
}
|
||||
|
||||
#define h5_setstep F77_NAME( \
|
||||
h5_setstep, \
|
||||
h5_setstep_, \
|
||||
H5_SETSTEP)
|
||||
h5_int64_t
|
||||
h5_setstep (
|
||||
const h5_int64_t *f,
|
||||
h5_int64_t *step ) {
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p, step=%lld", (h5_file_p)fh, (long long)*step);
|
||||
H5_API_RETURN (h5_set_step (fh, *step));
|
||||
}
|
||||
|
||||
#define h5_getstep F77_NAME( \
|
||||
h5_getstep, \
|
||||
h5_getstep_, \
|
||||
H5_GETSTEP)
|
||||
h5_int64_t
|
||||
h5_getstep (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_get_step (fh) + 1);
|
||||
}
|
||||
|
||||
#define h5_getnsteps F77_NAME( \
|
||||
h5_getnsteps, \
|
||||
h5_getnsteps_, \
|
||||
H5_GETNSTEPS)
|
||||
h5_int64_t
|
||||
h5_getnsteps (
|
||||
const h5_int64_t *f
|
||||
) {
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_get_num_steps (fh));
|
||||
}
|
||||
+22
-18
@@ -2,15 +2,17 @@
|
||||
if ENABLE_FORTRAN
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/include
|
||||
|
||||
F90_FILES = \
|
||||
H5F.f90 \
|
||||
H5_constF.f90 \
|
||||
H5_attribsF.f90 \
|
||||
H5PartF.f90 \
|
||||
H5Part_ioF.f90 \
|
||||
H5BlockF.f90 \
|
||||
H5Block_attribsF.f90 \
|
||||
H5Block_ioF.f90
|
||||
F90_FILES = \
|
||||
$(top_srcdir)/src/include/H5hut.f90 \
|
||||
$(top_srcdir)/src/include/H5.f90 \
|
||||
$(top_srcdir)/src/include/H5_const.f90 \
|
||||
$(top_srcdir)/src/include/H5_attribs.f90 \
|
||||
$(top_srcdir)/src/include/H5_model.f90 \
|
||||
$(top_srcdir)/src/include/H5Part.f90 \
|
||||
$(top_srcdir)/src/include/H5Part_io.f90 \
|
||||
$(top_srcdir)/src/include/H5Block.f90 \
|
||||
$(top_srcdir)/src/include/H5Block_attribs.f90 \
|
||||
$(top_srcdir)/src/include/H5Block_io.f90
|
||||
|
||||
EXTRA_HEADERS =
|
||||
|
||||
@@ -20,16 +22,18 @@ EXTRA_DIST = \
|
||||
$(F90_FILES)
|
||||
|
||||
nodist_include_HEADERS = \
|
||||
$(top_srcdir)/src/include/H5hutF.h
|
||||
$(top_srcdir)/src/include/H5hut.f
|
||||
|
||||
lib_LTLIBRARIES = libH5hutF.la
|
||||
|
||||
include_HEADERS = \
|
||||
../include/H5hutF.h
|
||||
$(F90_FILES) \
|
||||
$(top_srcdir)/src/include/H5hut.f
|
||||
|
||||
libH5hutF_la_SOURCES = \
|
||||
H5.c \
|
||||
H5_attribs.c \
|
||||
H5_model.c \
|
||||
H5Part.c \
|
||||
H5Part_io.c \
|
||||
H5Block.c \
|
||||
@@ -37,17 +41,17 @@ libH5hutF_la_SOURCES = \
|
||||
H5Block_io.c
|
||||
|
||||
libH5hutF_la_DEPENDENCIES = \
|
||||
$(top_srcdir)/src/include/H5hutF.h
|
||||
$(top_srcdir)/src/include/H5hut.f
|
||||
|
||||
libH5hutF_la_LDFLAGS = -version-info 2:0:0 -rpath '$(libdir)'
|
||||
|
||||
$(top_srcdir)/src/include/H5hutF.h: $(F90_FILES)
|
||||
awk '/INTEGER\*8 :: /{print "\t" $$0}' $^ >$@
|
||||
awk '/PARAMETER /{print "\t" $$0}' $^ >> $@
|
||||
awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >>$@
|
||||
$(top_srcdir)/src/include/H5hut.f: $(F90_FILES)
|
||||
awk '/INTEGER\*8 :: /{print " " $$0}' $^ >$@
|
||||
awk '/PARAMETER /{print " " $$0}' $^ >> $@
|
||||
awk '/INTEGER\*8 FUNCTION/{print " " $$1 " " $$3}' $^ >>$@
|
||||
|
||||
all-local: ../include/H5hutF.h
|
||||
$(INSTALL) -m644 .libs/libH5hutF.a ../lib
|
||||
all-local: $(top_srcdir)/src/include/H5hut.f
|
||||
$(INSTALL) -m644 .libs/libH5hutF.a $(top_builddir)/src/lib
|
||||
endif
|
||||
|
||||
clean: clean-am
|
||||
|
||||
@@ -80,4 +80,15 @@ h5_filehandlefor2c (
|
||||
) {
|
||||
return (h5_file_t)*ptr;
|
||||
}
|
||||
|
||||
static inline
|
||||
int strlenf (
|
||||
const char* s,
|
||||
int len
|
||||
) {
|
||||
if (len == 0) return 0;
|
||||
while (s[--len] == ' ');
|
||||
return ++len;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user