make formatting and doxygen decorations for utils functions consistent

This commit is contained in:
Axel Kohlmeyer
2020-08-24 20:45:44 -04:00
parent 3f685c346f
commit 024e4c5f21
2 changed files with 80 additions and 82 deletions

View File

@ -29,7 +29,7 @@ namespace LAMMPS_NS {
namespace utils {
/** \brief Match text against a simplified regex pattern
/** Match text against a simplified regex pattern
*
* \param text the text to be matched against the pattern
* \param pattern the search pattern, which may contain regexp markers
@ -37,14 +37,14 @@ namespace LAMMPS_NS {
*/
bool strmatch(const std::string &text, const std::string &pattern);
/** \brief Send message to screen and logfile, if available
/** Send message to screen and logfile, if available
*
* \param lmp pointer to LAMMPS class instance
* \param mesg message to be printed
*/
void logmesg(LAMMPS *lmp, const std::string &mesg);
/** \brief return a string representing the current system error status
/** return a string representing the current system error status
*
* This is a wrapper around calling strerror(errno).
*
@ -52,7 +52,7 @@ namespace LAMMPS_NS {
*/
std::string getsyserror();
/** \brief safe wrapper around fgets() which aborts on errors
/** safe wrapper around fgets() which aborts on errors
* or EOF and prints a suitable error message to help debugging
*
* \param srcname name of the calling source file (from FLERR macro)
@ -66,7 +66,7 @@ namespace LAMMPS_NS {
void sfgets(const char *srcname, int srcline, char *s, int size,
FILE *fp, const char *filename, Error *error);
/** \brief safe wrapper around fread() which aborts on errors
/** safe wrapper around fread() which aborts on errors
* or EOF and prints a suitable error message to help debugging
*
* \param srcname name of the calling source file (from FLERR macro)
@ -81,7 +81,7 @@ namespace LAMMPS_NS {
void sfread(const char *srcname, int srcline, void *s, size_t size,
size_t num, FILE *fp, const char *filename, Error *error);
/** \brief Report if a requested style is in a package or may have a typo
/** Report if a requested style is in a package or may have a typo
*
* \param style type of style that is to be checked for
* \param name name of style that was not found
@ -91,8 +91,8 @@ namespace LAMMPS_NS {
std::string check_packages_for_style(const std::string &style,
const std::string &name, LAMMPS *lmp);
/** \brief Convert a string to a floating point number while checking
if it is a valid floating point or integer number
/** Convert a string to a floating point number while checking
* if it is a valid floating point or integer number
*
* \param file name of source file for error message
* \param line in source file for error message
@ -104,8 +104,8 @@ namespace LAMMPS_NS {
double numeric(const char *file, int line, const char *str,
bool do_abort, LAMMPS *lmp);
/** \brief Convert a string to an integer number while checking
if it is a valid integer number (regular int)
/** Convert a string to an integer number while checking
* if it is a valid integer number (regular int)
*
* \param file name of source file for error message
* \param line in source file for error message
@ -117,8 +117,8 @@ namespace LAMMPS_NS {
int inumeric(const char *file, int line, const char *str,
bool do_abort, LAMMPS *lmp);
/** \brief Convert a string to an integer number while checking
if it is a valid integer number (bigint)
/** Convert a string to an integer number while checking
* if it is a valid integer number (bigint)
*
* \param file name of source file for error message
* \param line in source file for error message
@ -130,8 +130,8 @@ namespace LAMMPS_NS {
bigint bnumeric(const char *file, int line, const char *str,
bool do_abort, LAMMPS *lmp);
/** \brief Convert a string to an integer number while checking
if it is a valid integer number (tagint)
/** 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 in source file for error message
@ -143,54 +143,51 @@ namespace LAMMPS_NS {
tagint tnumeric(const char *file, int line, const char *str,
bool do_abort, LAMMPS *lmp);
/**
* \brief Trim leading and trailing whitespace. Like TRIM() in Fortran.
/** Trim leading and trailing whitespace. Like TRIM() in Fortran.
*
* \param line string that should be trimmed
* \return new string without whitespace (string)
*/
std::string trim(const std::string &line);
/**
* \brief Trim anything from '#' onward
/** Trim anything from '#' onward
*
* \param line string that should be trimmed
* \return new string without comment (string)
*/
std::string trim_comment(const std::string &line);
/**
* \brief Count words in string
/** Count words in string
*
* \param text string that should be searched
* \param separators string containing characters that will be treated as whitespace
* \return number of words found
*/
size_t count_words(const std::string & text, const std::string & separators);
size_t count_words(const std::string &text, const std::string &separators);
/**
* \brief Count words in string, ignore any whitespace matching " \t\r\n\f"
/** Count words in string, ignore any whitespace matching " \t\r\n\f"
*
* \param text string that should be searched
* \param separators string containing characters that will be treated as whitespace
* \return number of words found
*/
size_t count_words(const std::string & text);
size_t count_words(const std::string &text);
/**
* \brief Count words in C-string, ignore any whitespace matching " \t\r\n\f"
/** Count words in C-string, ignore any whitespace matching " \t\r\n\f"
*
* \param text string that should be searched
* \param separators string containing characters that will be treated as whitespace
* \return number of words found
*/
size_t count_words(const char * text);
size_t count_words(const char *text);
/**
* \brief Count words in a single line, trim anything from '#' onward
/** Count words in a single line, trim anything from '#' onward
*
* \param text string that should be trimmed and searched
* \param separators string containing characters that will be treated as whitespace
* \return number of words found
*/
size_t trim_and_count_words(const std::string & text, const std::string & separators = " \t\r\n\f");
size_t trim_and_count_words(const std::string &text, const std::string &separators = " \t\r\n\f");
/**
* \brief Take text and split into non-whitespace words.
/** Take text and split into non-whitespace words.
*
* This can handle single and double quotes, escaped quotes,
* and escaped codes within quotes, but due to using an STL
@ -203,21 +200,21 @@ namespace LAMMPS_NS {
*/
std::vector<std::string> split_words(const std::string &text);
/**
* \brief Check if string can be converted to valid integer
* \param text string that should be checked
/** Check if string can be converted to valid integer
*
* \param str string that should be checked
* \return true, if string contains valid integer, false otherwise
*/
bool is_integer(const std::string & str);
bool is_integer(const std::string &str);
/**
* \brief Check if string can be converted to valid floating-point number
* \param text string that should be checked
/** Check if string can be converted to valid floating-point number
*
* \param str string that should be checked
* \return true, if string contains valid floating-point number, false otherwise
*/
bool is_double(const std::string & str);
bool is_double(const std::string &str);
/** \brief try to detect pathname from FILE pointer.
/** Try to detect pathname from FILE pointer.
*
* Currently only supported on Linux, otherwise will report "(unknown)".
*
@ -228,12 +225,12 @@ namespace LAMMPS_NS {
*/
const char *guesspath(char *buf, int len, FILE *fp);
/**
* \brief Strip off leading part of path, return just the filename
/** Strip off leading part of path, return just the filename
*
* \param path file path
* \return file name
*/
std::string path_basename(const std::string & path);
std::string path_basename(const std::string &path);
/**
* \brief Join two paths
@ -241,64 +238,65 @@ namespace LAMMPS_NS {
* \param b second path
* \return combined path
*/
std::string path_join(const std::string & a, const std::string & b);
std::string path_join(const std::string &a, const std::string &b);
/**
* \brief Check if file exists and is readable
* \param path file path
* \return true if file exists and is readable
*/
bool file_is_readable(const std::string & path);
bool file_is_readable(const std::string &path);
/**
* \brief Determine full path of potential file
* If file is not found in current directory, search LAMMPS_POTENTIALS folder
/** Determine full path of potential file. If file is not found in current directory,
* search LAMMPS_POTENTIALS folder
*
* \param path file path
* \return full path to potential file
*/
std::string get_potential_file_path(const std::string& path);
std::string get_potential_file_path(const std::string &path);
/**
* \brief Read potential file and return DATE field if it is present
/** Read potential file and return DATE field if it is present
*
* \param path file path
* \param potential_name name of potential that is being read
* \return DATE field if present
*/
std::string get_potential_date(const std::string & path, const std::string & potential_name);
std::string get_potential_date(const std::string &path, const std::string &potential_name);
/**
* \brief Read potential file and return UNITS field if it is present
/** Read potential file and return UNITS field if it is present
*
* \param path file path
* \param potential_name name of potential that is being read
* \return UNITS field if present
*/
std::string get_potential_units(const std::string & path, const std::string & potential_name);
std::string get_potential_units(const std::string &path, const std::string &potential_name);
enum { NOCONVERT = 0, METAL2REAL = 1, REAL2METAL = 1<<1 };
enum { UNKNOWN = 0, ENERGY };
/**
* \brief Return bitmask of available conversion factors for a given propert
/** Return bitmask of available conversion factors for a given property
*
* \param property property to be converted
* \return bitmask indicating available conversions
*/
int get_supported_conversions(const int property);
/**
* \brief Return unit conversion factor for given property and selected from/to units
/** Return unit conversion factor for given property and selected from/to units
*
* \param property property to be converted
* \param conversion constant indicating the conversion
* \return conversion factor
*/
double get_conversion_factor(const int property, const int conversion);
/**
* \brief Convert a time string to seconds
* The strings "off" and "unlimited" result in -1
/** Convert a time string to seconds
*
* The strings "off" and "unlimited" result in -1
*
* \param timespec a string in the following format: ([[HH:]MM:]SS)
* \return total in seconds
*/
double timespec2seconds(const std::string & timespec);
double timespec2seconds(const std::string &timespec);
}
}