diff --git a/.gitattributes b/.gitattributes index db66031..12863a2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -347,6 +347,8 @@ doc/tetrahedron_refinements/text2vtk.py -text /license.txt -text /missing -text /rules.make -text +src/H5.c -text +src/H5.h -text src/H5Block.c -text src/H5Block.h -text src/H5Fed.c -text @@ -360,6 +362,7 @@ src/H5Fed_store.c -text src/H5Fed_storeretrieve.c -text src/H5Part.c -text src/H5Part.h -text +src/H5_inquiry.c -text src/Makefile.am -text src/bindings/C++/H5Fed.cc -text src/bindings/C++/H5Fed.hh -text diff --git a/src/H5.c b/src/H5.c new file mode 100644 index 0000000..5700b03 --- /dev/null +++ b/src/H5.c @@ -0,0 +1,196 @@ +/* + Copyright 2007-2008 + Paul Scherrer Institut, Villigen, Switzerland; + Benedikt Oswald; + Achim Gsell + All rights reserved. + + Authors + Achim Gsell + + Warning + This code is under development. + + */ + +/*! + Some conventions: + Functions: + Name: + thisIsAFunction() + Return values: + negative value or NULL signals an error + + + Macros: + UPPERCASE_WITH_UNDERSCORE + \note + In function names we use the words \b get and \b store insteed of + \b read and \b write, because no I/O is actually done in these + functions. +*/ + + +/*! + \defgroup h5_c_api H5Fed C API +*/ +/*! + \ingroup h5_c_api + \defgroup h5_general +*/ + + +#include +#include +#include "h5/h5.h" +#include "h5/h5_private.h" +#include "H5Fed.h" + + +/****** General routines *****************************************************/ + +/*! + \ingroup h5_general + + Open file with name \c filename. This function is available in the paralell + and serial version. In the serial case \c comm may have any value. + + \return File handle. + \return NULL on error. + + \note + File is always opened in read/writer mode! +*/ +h5_file * +H5OpenFile ( + const char * filename, /*!< file name */ + const MPI_Comm comm /*!< MPI communicator */ + ) { + SET_FNAME ( __func__ ); + return h5_open_file( filename, H5_O_RDWR, comm ); +} + +/*! + \ingroup h5_general + + Close file. + + \return value \c >=0 on success + \return -1 on error +*/ +h5_err_t +H5CloseFile ( + h5_file * fh /*!< file handle */ + ) { + SET_FNAME ( __func__ ); + return h5_close_file ( fh ); +} + +/*! + \ingroup h5_general + + Define format of the step names. + + Example: ==H5FedDefineStepNameFormat( f, "Step", 6 )== defines step names + like ==Step#000042==. + + \return value \c >=0 on success + \return -1 on error +*/ +h5_err_t +H5DefineStepNameFormat ( + h5_file *f, /*!< Handle to file */ + const char *name, /*!< Prefix */ + const h5part_int64_t width /*!< Width of the number */ + ) { + SET_FNAME ( "H5PartDefineStepNameFormat" ); + + return h5_define_stepname_fmt( f, name, width ); +} + +/*! + \ingroup h5_general + + Get format of the step names. + + \return value \c >=0 on success + \return -1 on error +*/ +h5_err_t +H5GetStepNameFormat ( + h5_file *f, /*!< Handle to file */ + char *name, /*!< OUT: Prefix */ + h5_int64_t *l_name, /*!< length of buffer name */ + h5_int64_t *width /*!< OUT: Width of the number */ + ) { + SET_FNAME ( "H5PartDefineStepNameFormat" ); + + return h5_get_stepname_fmt( f, name, l_name, width ); +} + +/*! + \ingroup h5_general + + Set the current step. + + \return \c H5_SUCCESS or error code +*/ +h5_err_t +H5SetStep ( + h5_file *f, /*!< [in] Handle to open file */ + const h5_int64_t step /*!< [in] Step to set. */ + ) { + + SET_FNAME ( __func__ ); + return h5_set_step ( f, step ); +} + +/*! + \ingroup h5_general + + Get current step. + + \return \c H5_SUCCESS or error code +*/ +h5_int64_t +H5GetStep ( + h5_file *f /*!< Handle to open file */ + ) { + + SET_FNAME ( __func__ ); + return h5_get_step ( f ); +} + +/*! + \ingroup h5_general + + Start traversing steps. + + \return \c H5_SUCCESS or error code +*/ +h5_err_t +H5StartTraverseSteps ( + h5_file *f /*!< Handle to open file */ + ) { + + SET_FNAME ( "H5FedStartTraverseSteps" ); + + return -1; +} + +/*! + \ingroup h5_general + + Traverse steps. + + \return \c H5_SUCCESS or error code +*/ +h5_err_t +H5TraverseSteps ( + h5_file *f /*!< Handle to open file */ + ) { + + SET_FNAME ( "H5FedStartTraverseSteps" ); + + return -1; +} diff --git a/src/H5.h b/src/H5.h new file mode 100644 index 0000000..29aea70 --- /dev/null +++ b/src/H5.h @@ -0,0 +1,65 @@ +/* + Copyright 2007-2008 + Paul Scherrer Institut, Villigen, Switzerland; + Benedikt Oswald; + Achim Gsell + All rights reserved. + + Authors + Achim Gsell + + Warning + This code is under development. + + */ + +#ifndef __H5_H +#define __H5_H + +h5_file* +H5OpenFile ( + const char * filename, + const MPI_Comm comm + ); + +h5_err_t +H5CloseFile ( + h5_file * fh + ); + +h5_err_t +H5DefineStepNameFormat ( + h5_file *f, + const char *name, + const h5part_int64_t width + ); + +h5_err_t +H5GetStepNameFormat ( + h5_file *f, + char *name, + h5_int64_t *l_name, + h5_int64_t *width + ); + +h5_err_t +H5SetStep ( + h5_file *f, + const h5_int64_t step + ); + +h5_int64_t +H5GetStep ( + h5_file *f + ); + +h5_err_t +H5StartTraverseSteps ( + h5_file *f + ); + +h5_err_t +H5TraverseSteps ( + h5_file *f + ); +#endif diff --git a/src/H5_inquiry.c b/src/H5_inquiry.c new file mode 100644 index 0000000..0c9b8f4 --- /dev/null +++ b/src/H5_inquiry.c @@ -0,0 +1,76 @@ +/* + Copyright 2007-2008 + Paul Scherrer Institut, Villigen, Switzerland; + Benedikt Oswald; + Achim Gsell + All rights reserved. + + Authors + Achim Gsell + + Warning + This code is under development. + + */ +/*! + \ingroup h5f_c_api + \defgroup h5_inquiry +*/ + +#include +#include +#include "h5/h5.h" +#include "h5/h5_private.h" +#include "H5Fed.h" + +/*! + \ingroup h5_inquiry + + Get the number of compute nodes. + + \return Number of compute notes. + \return \c -1 on error. + */ +h5_int_t +H5GetNumNodes ( + h5_file * fh /*!< file handle */ + ) { + SET_FNAME ( __func__ ); + return (h5_int_t)fh->nprocs; +} + +/*` + \ingroup h5_inquiry + + Get the number of steps that are currently stored in the file. + + \return number of steps or error code +*/ +h5_id_t +H5GetNumSteps ( + h5_file * fh /*!< file handle */ + ) { + SET_FNAME ( __func__ ); + return h5_get_num_steps( fh ); +} + +/*! + \ingroup h5_inquiry + + Query whether a particular step already exists in the file. + + \return true or false +*/ +h5_err_t +H5HasStep ( + h5_file *f, /*!< [in] Handle to open file */ + h5part_int64_t step /*!< [in] Step number to query */ + ) { + + SET_FNAME ( __func__ ); + + return h5_has_step( f, step ); +} + + +