reformat comments

This commit is contained in:
Axel Kohlmeyer
2021-07-11 14:57:00 -04:00
parent eecc012525
commit 51d082ff2b

View File

@ -33,7 +33,7 @@ class LAMMPS;
namespace utils { namespace utils {
/** 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 text the text to be matched against the pattern
* \param pattern the search pattern, which may contain regexp markers * \param pattern the search pattern, which may contain regexp markers
@ -41,7 +41,7 @@ namespace utils {
bool strmatch(const std::string &text, const std::string &pattern); bool strmatch(const std::string &text, const std::string &pattern);
/** Find sub-string that matches a simplified regex pattern /*! Find sub-string that matches a simplified regex pattern
* *
* \param text the text to be matched against the pattern * \param text the text to be matched against the pattern
* \param pattern the search pattern, which may contain regexp markers * \param pattern the search pattern, which may contain regexp markers
@ -53,7 +53,7 @@ namespace utils {
void fmtargs_logmesg(LAMMPS *lmp, fmt::string_view format, fmt::format_args args); void fmtargs_logmesg(LAMMPS *lmp, fmt::string_view format, fmt::format_args args);
/** Send formatted message to screen and logfile, if available /*! Send formatted message to screen and logfile, if available
* *
* This function simplifies the repetitive task of outputting some * This function simplifies the repetitive task of outputting some
* message to both the screen and/or the log file. The template * message to both the screen and/or the log file. The template
@ -62,21 +62,21 @@ namespace utils {
* *
* \param lmp pointer to LAMMPS class instance * \param lmp pointer to LAMMPS class instance
* \param format format string of message to be printed * \param format format string of message to be printed
* \param args arguments to format string */ * \param ... arguments to format string */
template <typename S, typename... Args> void logmesg(LAMMPS *lmp, const S &format, Args &&...args) template <typename S, typename... Args> void logmesg(LAMMPS *lmp, const S &format, Args &&...args)
{ {
fmtargs_logmesg(lmp, format, fmt::make_args_checked<Args...>(format, args...)); fmtargs_logmesg(lmp, format, fmt::make_args_checked<Args...>(format, args...));
} }
/** \overload /*! \overload
* *
* \param lmp pointer to LAMMPS class instance * \param lmp pointer to LAMMPS class instance
* \param mesg string with message to be printed */ * \param mesg string with message to be printed */
void logmesg(LAMMPS *lmp, const std::string &mesg); void logmesg(LAMMPS *lmp, const std::string &mesg);
/** 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). * This is a wrapper around calling strerror(errno).
* *
@ -84,7 +84,7 @@ namespace utils {
std::string getsyserror(); std::string getsyserror();
/** Wrapper around fgets() which reads whole lines but truncates the /*! Wrapper around fgets() which reads whole lines but truncates the
* data to the buffer size and ensures a newline char at the end. * data to the buffer size and ensures a newline char at the end.
* *
* This function is useful for reading line based text files with * This function is useful for reading line based text files with
@ -98,7 +98,7 @@ namespace utils {
char *fgets_trunc(char *s, int size, FILE *fp); char *fgets_trunc(char *s, int size, FILE *fp);
/** 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. * or EOF and prints a suitable error message to help debugging.
* *
* Use nullptr as the error parameter to avoid the abort on EOF or error. * Use nullptr as the error parameter to avoid the abort on EOF or error.
@ -114,7 +114,7 @@ namespace utils {
void sfgets(const char *srcname, int srcline, char *s, int size, FILE *fp, const char *filename, void sfgets(const char *srcname, int srcline, char *s, int size, FILE *fp, const char *filename,
Error *error); Error *error);
/** 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. * or EOF and prints a suitable error message to help debugging.
* *
* Use nullptr as the error parameter to avoid the abort on EOF or error. * Use nullptr as the error parameter to avoid the abort on EOF or error.
@ -131,7 +131,7 @@ namespace utils {
void sfread(const char *srcname, int srcline, void *s, size_t size, size_t num, FILE *fp, void sfread(const char *srcname, int srcline, void *s, size_t size, size_t num, FILE *fp,
const char *filename, Error *error); const char *filename, Error *error);
/** Read N lines of text from file into buffer and broadcast them /*! Read N lines of text from file into buffer and broadcast them
* *
* This function uses repeated calls to fread() to fill a buffer with * This function uses repeated calls to fread() to fill a buffer with
* newline terminated text. If a line does not end in a newline (e.g. * newline terminated text. If a line does not end in a newline (e.g.
@ -150,7 +150,7 @@ namespace utils {
int read_lines_from_file(FILE *fp, int nlines, int nmax, char *buffer, int me, MPI_Comm comm); int read_lines_from_file(FILE *fp, int nlines, int nmax, char *buffer, int me, MPI_Comm comm);
/** 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 style type of style that is to be checked for
* \param name name of style that was not found * \param name name of style that was not found
@ -160,7 +160,7 @@ namespace utils {
std::string check_packages_for_style(const std::string &style, const std::string &name, std::string check_packages_for_style(const std::string &style, const std::string &name,
LAMMPS *lmp); LAMMPS *lmp);
/** Convert a string to a floating point number while checking /*! Convert a string to a floating point number while checking
* if it is a valid floating point or integer number * if it is a valid floating point or integer number
* *
* \param file name of source file for error message * \param file name of source file for error message
@ -168,11 +168,11 @@ namespace utils {
* \param str string to be converted to number * \param str string to be converted to number
* \param do_abort determines whether to call Error::one() or Error::all() * \param do_abort determines whether to call Error::one() or Error::all()
* \param lmp pointer to top-level LAMMPS class instance * \param lmp pointer to top-level LAMMPS class instance
* \return double precision floating point number * \return double precision floating point number */
*/
double numeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); double numeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp);
/** Convert a string to an integer number while checking /*! Convert a string to an integer number while checking
* if it is a valid integer number (regular int) * if it is a valid integer number (regular int)
* *
* \param file name of source file for error message * \param file name of source file for error message
@ -184,7 +184,7 @@ namespace utils {
int inumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); int inumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp);
/** Convert a string to an integer number while checking /*! Convert a string to an integer number while checking
* if it is a valid integer number (bigint) * if it is a valid integer number (bigint)
* *
* \param file name of source file for error message * \param file name of source file for error message
@ -196,7 +196,7 @@ namespace utils {
bigint bnumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); bigint bnumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp);
/** Convert a string to an integer number while checking /*! Convert a string to an integer number while checking
* if it is a valid integer number (tagint) * if it is a valid integer number (tagint)
* *
* \param file name of source file for error message * \param file name of source file for error message
@ -208,7 +208,7 @@ namespace utils {
tagint tnumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); 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 /*! Compute index bounds derived from a string with a possible wildcard
* *
* This functions processes the string in *str* and set the values of *nlo* * This functions processes the string in *str* and set the values of *nlo*
* and *nhi* according to the following five cases: * and *nhi* according to the following five cases:
@ -232,7 +232,7 @@ namespace utils {
void bounds(const char *file, int line, const std::string &str, bigint nmin, bigint nmax, void bounds(const char *file, int line, const std::string &str, bigint nmin, bigint nmax,
TYPE &nlo, TYPE &nhi, Error *error); TYPE &nlo, TYPE &nhi, Error *error);
/** Expand list of arguments when containing fix/compute wildcards /*! Expand list of arguments when containing fix/compute wildcards
* *
* This function searches the list of arguments in *arg* for strings * This function searches the list of arguments in *arg* for strings
* of the kind c_ID[*] or f_ID[*] referring to computes or fixes. * of the kind c_ID[*] or f_ID[*] referring to computes or fixes.
@ -260,7 +260,7 @@ namespace utils {
int expand_args(const char *file, int line, int narg, char **arg, int mode, char **&earg, int expand_args(const char *file, int line, int narg, char **arg, int mode, char **&earg,
LAMMPS *lmp); LAMMPS *lmp);
/** Make C-style copy of string in new storage /*! Make C-style copy of string in new storage
* *
* This allocates a storage buffer and copies the C-style or * This allocates a storage buffer and copies the C-style or
* C++ style string into it. The buffer is allocated with "new" * C++ style string into it. The buffer is allocated with "new"
@ -271,21 +271,21 @@ namespace utils {
char *strdup(const std::string &text); char *strdup(const std::string &text);
/** 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 * \param line string that should be trimmed
* \return new string without whitespace (string) */ * \return new string without whitespace (string) */
std::string trim(const std::string &line); std::string trim(const std::string &line);
/** Return string with anything from '#' onward removed /*! Return string with anything from '#' onward removed
* *
* \param line string that should be trimmed * \param line string that should be trimmed
* \return new string without comment (string) */ * \return new string without comment (string) */
std::string trim_comment(const std::string &line); std::string trim_comment(const std::string &line);
/** Check if a string will likely have UTF-8 encoded characters /*! Check if a string will likely have UTF-8 encoded characters
* *
* UTF-8 uses the 7-bit standard ASCII table for the first 127 characters and * UTF-8 uses the 7-bit standard ASCII table for the first 127 characters and
* all other characters are encoded as multiple bytes. For the multi-byte * all other characters are encoded as multiple bytes. For the multi-byte
@ -316,7 +316,7 @@ namespace utils {
return false; return false;
} }
/** Replace known UTF-8 characters with ASCII equivalents /*! Replace known UTF-8 characters with ASCII equivalents
* *
\verbatim embed:rst \verbatim embed:rst
@ -329,7 +329,7 @@ namespace utils {
std::string utf8_subst(const std::string &line); std::string utf8_subst(const std::string &line);
/** Count words in string with custom choice of separating characters /*! Count words in string with custom choice of separating characters
* *
* \param text string that should be searched * \param text string that should be searched
* \param separators string containing characters that will be treated as whitespace * \param separators string containing characters that will be treated as whitespace
@ -337,21 +337,21 @@ namespace utils {
size_t count_words(const std::string &text, const std::string &separators); size_t count_words(const std::string &text, const std::string &separators);
/** 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 text string that should be searched
* \return number of words found */ * \return number of words found */
size_t count_words(const std::string &text); size_t count_words(const std::string &text);
/** 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 text string that should be searched
* \return number of words found */ * \return number of words found */
size_t count_words(const char *text); size_t count_words(const char *text);
/** 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 text string that should be trimmed and searched
* \param separators string containing characters that will be treated as whitespace * \param separators string containing characters that will be treated as whitespace
@ -359,7 +359,7 @@ namespace utils {
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");
/** Take text and split into non-whitespace words. /*! Take text and split into non-whitespace words.
* *
* This can handle strings with single and double quotes, escaped quotes, * This can handle strings with single and double quotes, escaped quotes,
* and escaped codes within quotes, but due to using an STL container and * and escaped codes within quotes, but due to using an STL container and
@ -378,27 +378,27 @@ namespace utils {
std::vector<std::string> split_words(const std::string &text); std::vector<std::string> split_words(const std::string &text);
/** Take multi-line text and split into lines /*! Take multi-line text and split into lines
* *
* \param text string that should be split * \param text string that should be split
* \return STL vector with the lines */ * \return STL vector with the lines */
std::vector<std::string> split_lines(const std::string &text); std::vector<std::string> split_lines(const std::string &text);
/** Check if string can be converted to valid integer /*! Check if string can be converted to valid integer
* *
* \param str string that should be checked * \param str string that should be checked
* \return true, if string contains valid a integer, false otherwise */ * \return true, if string contains valid a integer, false otherwise */
bool is_integer(const std::string &str); bool is_integer(const std::string &str);
/** Check if string can be converted to valid floating-point number /*! Check if string can be converted to valid floating-point number
* *
* \param str string that should be checked * \param str string that should be checked
* \return true, if string contains valid number, false otherwise */ * \return true, if string contains valid number, false otherwise */
bool is_double(const std::string &str); bool is_double(const std::string &str);
/** Check if string is a valid ID /*! Check if string is a valid ID
* ID strings may contain only letters, numbers, and underscores. * ID strings may contain only letters, numbers, and underscores.
* *
* \param str string that should be checked * \param str string that should be checked
@ -406,7 +406,7 @@ namespace utils {
bool is_id(const std::string &str); bool is_id(const std::string &str);
/** Try to detect pathname from FILE pointer. /*! Try to detect pathname from FILE pointer.
* *
* Currently only supported on Linux, otherwise will report "(unknown)". * Currently only supported on Linux, otherwise will report "(unknown)".
* *
@ -417,21 +417,21 @@ namespace utils {
const char *guesspath(char *buf, int len, FILE *fp); const char *guesspath(char *buf, int len, FILE *fp);
/** Strip off leading part of path, return just the filename /*! Strip off leading part of path, return just the filename
* *
* \param path file path * \param path file path
* \return file name */ * \return file name */
std::string path_basename(const std::string &path); std::string path_basename(const std::string &path);
/** Return the directory part of a path. Return "." if empty /*! Return the directory part of a path. Return "." if empty
* *
* \param path file path * \param path file path
* \return directory name */ * \return directory name */
std::string path_dirname(const std::string &path); std::string path_dirname(const std::string &path);
/** Join two pathname segments /*! Join two pathname segments
* *
* This uses the forward slash '/' character unless LAMMPS is compiled * This uses the forward slash '/' character unless LAMMPS is compiled
* for Windows where it used the equivalent backward slash '\\'. * for Windows where it used the equivalent backward slash '\\'.
@ -442,14 +442,14 @@ namespace utils {
std::string path_join(const std::string &a, const std::string &b); std::string path_join(const std::string &a, const std::string &b);
/** Check if file exists and is readable /*! Check if file exists and is readable
* *
* \param path file path * \param path file path
* \return true if file exists and is readable */ * \return true if file exists and is readable */
bool file_is_readable(const std::string &path); bool file_is_readable(const std::string &path);
/** Determine full path of potential file. If file is not found in current directory, /*! Determine full path of potential file. If file is not found in current directory,
* search directories listed in LAMMPS_POTENTIALS environment variable * search directories listed in LAMMPS_POTENTIALS environment variable
* *
* \param path file path * \param path file path
@ -457,7 +457,7 @@ namespace utils {
std::string get_potential_file_path(const std::string &path); std::string get_potential_file_path(const std::string &path);
/** 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 path file path
* \param potential_name name of potential that is being read * \param potential_name name of potential that is being read
@ -465,7 +465,7 @@ namespace utils {
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);
/** 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 path file path
* \param potential_name name of potential that is being read * \param potential_name name of potential that is being read
@ -476,13 +476,14 @@ namespace utils {
enum { NOCONVERT = 0, METAL2REAL = 1, REAL2METAL = 1 << 1 }; enum { NOCONVERT = 0, METAL2REAL = 1, REAL2METAL = 1 << 1 };
enum { UNKNOWN = 0, ENERGY }; enum { UNKNOWN = 0, ENERGY };
/** Return bitmask of available conversion factors for a given property /*! Return bitmask of available conversion factors for a given property
* *
* \param property property to be converted * \param property property to be converted
* \return bitmask indicating available conversions */ * \return bitmask indicating available conversions */
int get_supported_conversions(const int property); int get_supported_conversions(const int property);
/** 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 property property to be converted
* \param conversion constant indicating the conversion * \param conversion constant indicating the conversion
@ -490,7 +491,7 @@ namespace utils {
double get_conversion_factor(const int property, const int conversion); double get_conversion_factor(const int property, const int conversion);
/** Open a potential file as specified by *name* /*! Open a potential file as specified by *name*
* *
* If opening the file directly fails, the function will search for * If opening the file directly fails, the function will search for
* it in the list of folder pointed to by the environment variable * it in the list of folder pointed to by the environment variable
@ -513,7 +514,7 @@ namespace utils {
FILE *open_potential(const std::string &name, LAMMPS *lmp, int *auto_convert); FILE *open_potential(const std::string &name, LAMMPS *lmp, int *auto_convert);
/** Convert a time string to seconds /*! Convert a time string to seconds
* *
* The strings "off" and "unlimited" result in -1 * The strings "off" and "unlimited" result in -1
* *
@ -522,7 +523,7 @@ namespace utils {
double timespec2seconds(const std::string &timespec); double timespec2seconds(const std::string &timespec);
/** Convert a LAMMPS version date to a number /*! Convert a LAMMPS version date to a number
* *
* This will generate a number YYYYMMDD from a date string * This will generate a number YYYYMMDD from a date string
* (with or without blanks) that is suitable for numerical * (with or without blanks) that is suitable for numerical
@ -537,9 +538,10 @@ namespace utils {
* *
* \param date string in the format (Day Month Year) * \param date string in the format (Day Month Year)
* \return date code */ * \return date code */
int date2num(const std::string &date); int date2num(const std::string &date);
/** Custom merge sort implementation /*! Custom merge sort implementation
* *
* This function provides a custom upward hybrid merge sort * This function provides a custom upward hybrid merge sort
* implementation with support to pass an opaque pointer to * implementation with support to pass an opaque pointer to