update and correct documentation for utils functions

This commit is contained in:
Axel Kohlmeyer
2020-08-29 23:51:46 -04:00
parent 9c404e02fd
commit ceeaf1e988
2 changed files with 92 additions and 86 deletions

View File

@ -133,62 +133,59 @@ namespace LAMMPS_NS {
/** Convert a string to an integer number while checking
* if it is a valid integer number (tagint)
*
* \param file name of source file for error message
* \param line line number in source file for error message
* \param str string to be converted to number
* \param do_abort determines whether to call Error::one() or Error::all()
* \param lmp pointer to top-level LAMMPS class instance
* \return integer number (tagint)
*/
* \param file name of source file for error message
* \param line line number in source file for error message
* \param str string to be converted to number
* \param do_abort determines whether to call Error::one() or Error::all()
* \param lmp pointer to top-level LAMMPS class instance
* \return integer number (tagint) */
tagint tnumeric(const char *file, int line, const char *str,
bool do_abort, LAMMPS *lmp);
/** Compute index bounds derived from a string with a possible wildcard
*
\verbatim embed:rst
* This functions processes the string in *str* and set the values of *nlo*
* and *nhi* according to the following five cases:
*
* - a single number *i*: nlo = i; nhi = i;
* - a single asterisk \*: nlo = nmin; nhi = nmax;
* - a single number followed by an asterisk *i*\*: nlo = i; nhi = nmax;
* - a single asterisk followed by a number \**i*: nlo = nmin; nhi = i;
* - two numbers with an asterisk in between *i\*j*: nlo = i; nhi = j;
*
* \param file name of source file for error message
* \param line line number in source file for error message
* \param str string to be processed
* \param nmin smallest possible lower bound
* \param nmax largest allowed upper bound
* \param nlo lower bound
* \param nhi upper bound
* \param error pointer to Error class for out-of-bounds messages */
This functions processes the string in *str* and set the values of *nlo*
and *nhi* according to the following five cases:
#. a single number *i*: nlo = i; nhi = i;
#. a single asterisk *\*\ *: nlo = nmin; nhi = nmax;
#. a single number followed by an asterisk *i\*\ *: nlo = i; nhi = nmax;
#. a single asterisk followed by a number *\*\ i*: nlo = nmin; nhi = i;
#. two numbers with an asterisk in between *i\*\ j*: nlo = i; nhi = j;
\endverbatim
* \param file name of source file for error message
* \param line line number in source file for error message
* \param str string to be processed
* \param nmin smallest possible lower bound
* \param nmax largest allowed upper bound
* \param nlo lower bound
* \param nhi upper bound
* \param error pointer to Error class for out-of-bounds error message
*/
void bounds(const char *file, int line, char *str,
int nmin, int nmax, int &nlo, int &nhi, Error *error);
/** Compute index bounds derived from a string with a possible wildcard
*
\verbatim embed:rst
This functions processes the string in *str* and set the values of *nlo*
and *nhi* according to the following five cases:
#. a single number *i*: nlo = i; nhi = i;
#. a single asterisk *\*\ *: nlo = nmin; nhi = nmax;
#. a single number followed by an asterisk *i\*\ *: nlo = i; nhi = nmax;
#. a single asterisk followed by a number *\*\ i*: nlo = nmin; nhi = i;
#. two numbers with an asterisk in between *i\*\ j*: nlo = i; nhi = j;
\endverbatim
* This functions processes the string in *str* and set the values of *nlo*
* and *nhi* according to the following five cases:
*
* - a single number *i*: nlo = i; nhi = i;
* - a single asterisk \*: nlo = nmin; nhi = nmax;
* - a single number followed by an asterisk *i*\*: nlo = i; nhi = nmax;
* - a single asterisk followed by a number \**i*: nlo = nmin; nhi = i;
* - two numbers with an asterisk in between *i\*j*: nlo = i; nhi = j;
*
* \param file name of source file for error message
* \param line line number in source file for error message
* \param str string to be processed
* \param nmin smallest possible lower bound
* \param nmax largest allowed upper bound
* \param nlo lower bound
* \param nhi upper bound
* \param error pointer to Error class for out-of-bounds messages */
* \param file name of source file for error message
* \param line line number in source file for error message
* \param str string to be processed
* \param nmin smallest possible lower bound
* \param nmax largest allowed upper bound
* \param nlo lower bound
* \param nhi upper bound
* \param error pointer to Error class for out-of-bounds error message
*/
void boundsbig(const char *file, int line, char *str,
bigint nmin, bigint nmax, bigint &nlo, bigint &nhi,
Error *error);
@ -209,15 +206,15 @@ and *nhi* according to the following five cases:
* caller. Otherwise arg and earg will point to the same address
* and no explicit de-allocation is needed by the caller.
*
* \param file name of source file for error message
* \param line line number in source file for error message
* \param narg number of arguments in current list
* \param arg argument list, possibly containing wildcards
* \param mode select between global vectors(=0) and arrays (=1)
* \param earg new argument list with wildcards expanded
* \param lmp pointer to top-level LAMMPS class instance
* \return number of arguments in expanded list
*/
* \param file name of source file for error message
* \param line line number in source file for error message
* \param narg number of arguments in current list
* \param arg argument list, possibly containing wildcards
* \param mode select between global vectors(=0) and arrays (=1)
* \param earg new argument list with wildcards expanded
* \param lmp pointer to top-level LAMMPS class instance
* \return number of arguments in expanded list */
int expand_args(const char *file, int line, int narg, char **arg,
int mode, char **&earg, LAMMPS *lmp);
@ -326,7 +323,7 @@ and *nhi* according to the following five cases:
bool file_is_readable(const std::string &path);
/** Determine full path of potential file. If file is not found in current directory,
* search LAMMPS_POTENTIALS folder
* search directories listed in LAMMPS_POTENTIALS environment variable
*
* \param path file path
* \return full path to potential file
@ -369,19 +366,25 @@ and *nhi* according to the following five cases:
/** Open a potential file as specified by *name*
*
\verbatim embed:rst
If opening the file directly fails, it will search for it in the folder(s)
pointed to by the environment variable LAMMPS_POTENTIALS.
If the potential file has a ``UNITS`` tag in the first line, its
value is compared to the current :doc:`unit style <units>` setting.
\endverbatim
* If opening the file directly fails, the function will search for
* it in the list of folder pointed to by the environment variable
* LAMMPS_POTENTIALS (if it is set).
*
* \param name file- or pathname of the potential file
* \param lmp pointer to top-level LAMMPS class instance
* \param auto_convert pointer to automatic unit conversion bitmask
* \return FILE pointer of the opened potential file or NULL
*/
* If the potential file has a ``UNITS`` tag in the first line, the
* tag's value is compared to the current unit style setting.
* The behavior of the function then depends on the value of the
* *auto_convert* parameter. If it is ``NULL``, then the unit values
* must match or else the open will fail with an error. Otherwise
* the bitmask that *auto_convert* points to is used check for
* compatibility with possible automatic conversions by the calling
* function. If compatible, the bitmask is set to the required
* conversion or ``NOCONVERT``.
*
* \param name file- or pathname of the potential file
* \param lmp pointer to top-level LAMMPS class instance
* \param auto_convert pointer to unit conversion bitmask or NULL
* \return FILE pointer of the opened potential file or NULL*/
FILE *open_potential(const std::string &name, LAMMPS *lmp, int *auto_convert);
/** Convert a time string to seconds