Commit 06f0a8b4 authored by gsell's avatar gsell
Browse files

compile with -O3 if debug is disabled, compile with -Wall in always

parent 205a1a5c
......@@ -119,16 +119,23 @@ PATH_Search() {
AC_CANONICAL_HOST
AC_PROG_MAKE_SET
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CFLAGS -Wall"
FFLAGS="$FFLAGS -Wall"
# debug enabled?
AC_MSG_CHECKING([if debug is enabled])
if test "X$ENABLE_DEBUG" = "Xyes"; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -g -Wall"
CXXFLAGS="$CFLAGS -g -Wall"
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CFLAGS -g"
FFLAGS="$FFLAGS -g"
else
AC_MSG_RESULT([no])
CFLAGS="$CFLAGS -O3"
CXXFLAGS="$CFLAGS -O3"
FFLAGS="$FFLAGS -O3"
fi
# Determine a C/C++ compiler to use.
......
#include <stdlib.h>
#include <string.h>
#include "h5core/h5_core.h"
#include "Underscore.h"
#if defined(F77_SINGLE_UNDERSCORE)
#define F77NAME(a,b) a
#elif defined(F77_CRAY_UNDERSCORE)
#define F77NAME(a,b) b
#elif defined(F77_NO_UNDERSCORE)
#else
#error Error, no way to determine how to construct fortran bindings
#endif
#if !defined(F77_NO_UNDERSCORE)
#define h5bl_3d_setview F77NAME ( \
h5bl_3d_setview_, \
H5BL_3D_SETVIEW )
#define h5bl_3d_getview F77NAME ( \
h5bl_3d_getview_, \
H5BL_3D_GETVIEW )
#define h5bl_3d_setchunk F77NAME ( \
h5bl_3d_setchunk_, \
H5BL_3D_SETCHUNK )
#define h5bl_3d_getreducedview F77NAME ( \
h5bl_3d_getreducedview_, \
H5BL_3D_GETREDUCEDVIEW )
#define h5bl_3d_hasview F77NAME ( \
h5bl_hasview_, \
H5BL_HASVIEW )
#define h5bl_getnumfields F77NAME ( \
h5bl_getnumfields_, \
H5BL_GETNUMFIELDS )
#define h5bl_getfieldinfo F77NAME ( \
h5bl_getfieldinfo_, \
H5BL_GETFIELDINFO )
#define h5bl_writefieldattrib_string F77NAME ( \
h5bl_writefieldattrib_string_, \
H5BL_WRITEFIELDATTRIB_STRING )
#define h5bl_getnfieldattribs F77NAME ( \
h5bl_getnfieldattribs_, \
H5BL_GETNFIELDATTRIBS )
#define h5bl_getfieldattribinfo F77NAME ( \
h5bl_getfieldattribinfo_, \
h5bl_getfieldattribinfo )
#define h5bl_readfieldattrib_string F77NAME ( \
h5bl_readfieldattrib_string_, \
H5BL_READFIELDATTRIB_STRING )
#endif
h5_err_t
h5bl_3d_setview (
h5_int64_t *const f,
const h5_int64_t *i_start, /*!< start index of i */
const h5_int64_t *i_end, /*!< end index of i */
const h5_int64_t *j_start, /*!< start index of j */
const h5_int64_t *j_end, /*!< end index of j */
const h5_int64_t *k_start, /*!< start index of k */
const h5_int64_t *k_end /*!< end index of k */
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%lld, i_end=%lld, "
"j_start=%lld, j_end=%lld, "
"k_start=%lld, k_end=%lld",
fh,
(long long)i_start, (long long)i_end,
(long long)j_start, (long long)j_end,
(long long)k_start, (long long)k_end);
H5_API_RETURN(h5b_3d_set_view (
fh,
*i_start-1, *i_end-1,
*j_start-1, *j_end-1,
*k_start-1, *k_end-1 ));
}
h5_err_t
h5bl_3d_setchunk (
h5_int64_t *const f,
const h5_int64_t *i,
const h5_int64_t *j,
const h5_int64_t *k
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, i=%lld, j=%lld, k=%lld",
fh, (long long)i, (long long)j, (long long)k);
H5_API_RETURN(h5b_3d_set_chunk ( fh, *i, *j, *k ));
}
h5_err_t
h5bl_3d_getview (
h5_int64_t *const f,
h5_int64_t *const i_start,
h5_int64_t *const i_end,
h5_int64_t *const j_start,
h5_int64_t *const j_end,
h5_int64_t *const k_start,
h5_int64_t *const k_end
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%p, i_end=%p, "
"j_start=%p, j_end=%p, "
"k_start=%p, k_end=%p",
fh,
i_start, i_end,
j_start, j_end,
k_start, k_end);
H5_API_RETURN (h5b_3d_get_view (
fh,
(h5_size_t*)i_start, (h5_size_t*)i_end,
(h5_size_t*)j_start, (h5_size_t*)j_end,
(h5_size_t*)k_start, (h5_size_t*)k_end ));
}
h5_err_t
h5bl_3d_getreducedview (
h5_int64_t *const f,
h5_int64_t *const i_start,
h5_int64_t *const i_end,
h5_int64_t *const j_start,
h5_int64_t *const j_end,
h5_int64_t *const k_start,
h5_int64_t *const k_end
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%p, i_end=%p, "
"j_start=%p, j_end=%p, "
"k_start=%p, k_end=%p",
fh,
i_start, i_end,
j_start, j_end,
k_start, k_end);
H5_API_RETURN(h5b_3d_get_reduced_view (
fh,
(h5_size_t*)i_start, (h5_size_t*)i_end,
(h5_size_t*)j_start, (h5_size_t*)j_end,
(h5_size_t*)k_start, (h5_size_t*)k_end ));
}
h5_int64_t
h5bl_3d_hasview (
h5_int64_t *const f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", fh);
H5_API_RETURN (h5b_3d_has_view ( fh ));
}
h5_err_t
h5bl_getnumfields (
h5_int64_t *const f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", fh);
H5_API_RETURN (h5b_get_num_fields ( fh ));
}
h5_err_t
h5bl_getfieldinfo (
h5_int64_t *const f,
const h5_int64_t *idx,
char *name,
h5_size_t *field_rank,
h5_size_t *field_dims,
h5_size_t *elem_rank,
h5_int64_t *type,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, idx=%lld, "
"name=%p,"
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p, l_name=%d",
fh, (long long)*idx, name,
field_rank, field_dims, elem_rank, type, l_name);
h5_err_t herr = h5b_get_field_info (
fh, *idx, name, (h5_size_t)l_name,
field_rank, field_dims, elem_rank, type );
h5_strc2for ( name, l_name );
H5_API_RETURN(herr);
}
h5_err_t
h5bl_writefieldattrib_string (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
const char *buffer,
const int l_field_name,
const int l_attrib_name,
const int l_buffer
) {
h5_file_t *fh = h5_filehandlefor2c(f);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
char *buffer2 = h5_strdupfor2c ( buffer, l_buffer );
H5_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name='%s', "
"buffer='%s', "
"l_field_name=%d, "
"l_attrib_name=%d, "
"l_buffer=%d",
fh,
field_name2,
attrib_name2,
buffer2, l_field_name, l_attrib_name, l_buffer);
h5_err_t herr = h5_write_field_attrib (
fh, field_name2, attrib_name2,
H5_STRING_T, buffer2, strlen(buffer2)+1 );
free ( field_name2 );
free ( attrib_name2 );
free ( buffer2 );
H5_API_RETURN(herr);
}
h5_err_t
h5bl_getnfieldattribs (
h5_int64_t *const f,
const char *name,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
char *name2 = h5_strdupfor2c ( name, l_name );
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', l_name=%d", fh, name2, l_name);
h5_err_t herr = h5b_get_num_field_attribs ( fh, name2 );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5bl_getfieldattribinfo (
h5_int64_t *const f,
const char *field_name,
const h5_int64_t *attrib_idx,
char *attrib_name,
h5_size_t *attrib_nelem,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
H5_API_ENTER (h5_err_t,
"f=%p field_name='%s', "
"attrib_idx=%lld, "
"attrib_name=%p, "
"attrib_nelem=%p, l_field_name=%d, l_attrib_name=%d",
fh,
field_name2,
(long long)*attrib_idx,
attrib_name, attrib_nelem, l_field_name, l_attrib_name);
h5_int64_t attrib_type;
h5_err_t herr = h5b_get_field_attrib_info (
fh, field_name2, *attrib_idx,
attrib_name, l_attrib_name,
&attrib_type,
attrib_nelem );
h5_strc2for ( attrib_name, l_attrib_name );
free ( field_name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5bl_readfieldattrib_string (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
char *buffer,
const int l_field_name,
const int l_attrib_name,
const int l_buffer
) {
h5_file_t *fh = h5_filehandlefor2c(f);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
H5_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name='%s', "
"buffer=%p, l_field_name=%d, l_attrib_name=%d, l_buffer=%d",
fh,
field_name,
attrib_name,
buffer, l_field_name, l_attrib_name, l_buffer);
h5_err_t herr = h5_read_field_attrib (
fh, field_name2, attrib_name2,
H5_STRING_T, buffer );
h5_strc2for ( buffer, l_buffer );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
This diff is collapsed.
#include <stdlib.h>
#include "h5core/h5_core.h"
#include "Underscore.h"
#if defined(F77_SINGLE_UNDERSCORE)
#define F77NAME(a,b) a
#elif defined(F77_CRAY_UNDERSCORE)
#define F77NAME(a,b) b
#elif defined(F77_NO_UNDERSCORE)
#else
#error Error, no way to determine how to construct fortran bindings
#endif
#if !defined(F77_NO_UNDERSCORE)
#define h5pt_setnpoints F77NAME ( \
h5pt_setnpoints_, \
H5PT_SETNPOINTS )
#define h5pt_setnpoints_strided F77NAME ( \
h5pt_setnpoints_strided_, \
H5PT_SETNPOINTS_STRIDED )
#define h5pt_getnsteps F77NAME ( \
h5pt_getnsteps_, \
H5PT_GETNSTEPS )
#define h5pt_getndatasets F77NAME ( \
h5pt_getndatasets_, \
H5PT_GETNDATASETS )
#define h5pt_getnpoints F77NAME ( \
h5pt_getnpoints_, \
H5PT_GETNPOINTS )
#define h5pt_getdatasetname F77NAME ( \
h5pt_getdatasetname_, \
H5PT_GETDATASETNAME )
#define h5pt_setview F77NAME ( \
h5pt_setview_, \
H5PT_SETVIEW )
#define h5pt_setview_indices F77NAME ( \
h5pt_setview_indices_, \
H5PT_SETVIEW_INDICES )
#define h5pt_resetview F77NAME ( \
h5pt_resetview_, \
H5PT_RESETVIEW )
#define h5pt_hasview F77NAME ( \
h5pt_hasview_, \
H5PT_HASVIEW )
#define h5pt_getview F77NAME ( \
h5pt_getview_, \
H5PT_GETVIEW )
#define h5pt_writedata_r8 F77NAME ( \
h5pt_writedata_r8_, \
H5PT_WRITEDATA_R8 )
#define h5pt_writedata_r4 F77NAME ( \
h5pt_writedata_r4_, \
H5PT_WRITEDATA_R4 )
#define h5pt_writedata_i8 F77NAME ( \
h5pt_writedata_i8_, \
H5PT_WRITEDATA_I8 )
#define h5pt_writedata_i4 F77NAME ( \
h5pt_writedata_i4_, \
H5PT_WRITEDATA_I4 )
#define h5pt_readdata_r8 F77NAME ( \
h5pt_readdata_r8_, \
H5PT_READDATA_R8 )
#define h5pt_readdata_r4 F77NAME ( \
h5pt_readdata_r4_, \
H5PT_READDATA_R4 )
#define h5pt_readdata_i8 F77NAME ( \
h5pt_readdata_i8_, \
H5PT_READDATA_I8 )
#define h5pt_readdata_i4 F77NAME ( \
h5pt_readdata_i4_, \
H5PT_READDATA_I4 )
#endif
h5_err_t
h5pt_setnpoints (
const h5_int64_t *f,
h5_int64_t *n
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, n=%lld", fh, (long long)*n);
H5_API_RETURN(h5u_set_num_particles ( fh, *n, 1 ));
}
h5_err_t
h5pt_setnpoints_strided (
const h5_int64_t *f,
h5_int64_t *n,
h5_int64_t *stride
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, n=%lld, stride=%lld",
fh, (long long)*n, (long long)*stride);
H5_API_RETURN(h5u_set_num_particles ( fh, *n, *stride ));
}
/*==============Reading Data Characteristics============*/
h5_int64_t
h5pt_getndatasets (
const h5_int64_t *f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", fh);
H5_API_RETURN(h5u_get_num_datasets ( fh ));
}
h5_int64_t
h5pt_getnpoints (
const h5_int64_t *f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", fh);
H5_API_RETURN(h5u_get_num_particles ( fh ));
}
h5_err_t
h5pt_getdatasetname (
const h5_int64_t *f,
const h5_int64_t *index,
char *name,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, index=%lld, name='%s', l_name=%d",
fh, (long long)*index, name, l_name);
h5_err_t herr = h5u_get_dataset_info (
fh, *index, name, l_name, NULL, NULL );
h5_strc2for ( name, l_name );
H5_API_RETURN(herr);
}
/*=============Setting and getting views================*/
h5_err_t
h5pt_setview (
const h5_int64_t *f,
const h5_int64_t *start,
const h5_int64_t *end
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, start=%lld, end=%lld",
fh, (long long)*start, (long long)*end);
H5_API_RETURN(h5u_set_view ( fh, (*start)-1, (*end)-1 ));
}
h5_err_t
h5pt_setview_indices (
const h5_int64_t *f,
const h5_int64_t * const indices,
const h5_int64_t *nelem
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, indices=%p, nelem=%lld",
fh, indices, (long long)*nelem);
H5_API_RETURN(h5u_set_view_indices ( fh, (const h5_size_t*const)indices, *nelem ));
}
h5_err_t
h5pt_resetview (
const h5_int64_t *f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p", fh);
H5_API_RETURN(h5u_reset_view ( fh ));
}
h5_err_t
h5pt_hasview (
const h5_int64_t *f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p", fh);
H5_API_RETURN(h5u_has_view ( fh ));
}
h5_err_t
h5pt_getview (
const h5_int64_t *f,
h5_int64_t *start,
h5_int64_t *end
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, start=%p, end=%p",
fh, start, end);
H5_API_RETURN(h5u_get_view ( fh, start, end));
}
/*==================Writing data ============*/
h5_err_t
h5pt_writedata_r8 (
const h5_int64_t *f,
const char *name,
const h5_float64_t *data,
const int l_name ) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_write_data (
fh, name2, (void*)data, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_writedata_r4 (
const h5_int64_t *f,
const char *name,
const h5_float32_t *data,
const int l_name ) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_write_data (
fh, name2, (void*)data, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_writedata_i8 (
const h5_int64_t *f,
const char *name,
const h5_int64_t *data,
const int l_name ) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_write_data (
fh, name2, (void*)data, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_writedata_i4 (
const h5_int64_t *f,
const char *name,
const h5_int32_t *data,
const int l_name ) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_write_data (
fh, name2, (void*)data, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
<