add function to dispatch LAMMPS errors to library interfaces

This commit is contained in:
Axel Kohlmeyer
2022-09-23 16:28:15 -04:00
parent 0f2a7d3f33
commit 86d1aacf7e
7 changed files with 197 additions and 45 deletions

View File

@ -75,6 +75,18 @@ enum _LMP_TYPE_CONST {
LMP_SIZE_COLS = 5 /*!< return number of columns */
};
/** Error codes to select the suitable function in the Error class
*
* Must be kept in sync with the equivalent constants in lammps/constants.py */
enum _LMP_ERROR_CONST {
LMP_ERROR_WARNING = 0, /*!< call Error::warning() */
LMP_ERROR_ONE = 1, /*!< called from one MPI rank */
LMP_ERROR_ALL = 2, /*!< called from all MPI ranks */
LMP_ERROR_WORLD = 4, /*!< error on Comm::world */
LMP_ERROR_UNIVERSE = 8 /*!< error on Comm::universe */
};
/* Ifdefs to allow this file to be included in C and C++ programs */
#ifdef __cplusplus
@ -97,6 +109,8 @@ void lammps_mpi_finalize();
void lammps_kokkos_finalize();
void lammps_python_finalize();
void lammps_error(void *handle, int error_type, const char *error_text);
/* ----------------------------------------------------------------------
* Library functions to process commands
* ---------------------------------------------------------------------- */