Merge branch 'python-refactor' into library-refactor
This commit is contained in:
983
python/lammps.py
983
python/lammps.py
File diff suppressed because it is too large
Load Diff
@ -3025,8 +3025,6 @@ void lammps_decode_image_flags(imageint image, int *flags)
|
|||||||
// Library functions for error handling with exceptions enabled
|
// Library functions for error handling with exceptions enabled
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef LAMMPS_EXCEPTIONS
|
|
||||||
|
|
||||||
/** \brief Check if there is a (new) error message available
|
/** \brief Check if there is a (new) error message available
|
||||||
|
|
||||||
\verbatim embed:rst
|
\verbatim embed:rst
|
||||||
@ -3035,19 +3033,24 @@ has thrown a :ref:`C++ exception <exceptions>`.
|
|||||||
|
|
||||||
.. note:
|
.. note:
|
||||||
|
|
||||||
This function is only available when the LAMMPS library has been
|
This function will always report "no error" when the LAMMPS library
|
||||||
compiled with ``-DLAMMPS_EXCEPTIONS`` which turns errors aborting
|
has been compiled without ``-DLAMMPS_EXCEPTIONS`` which turns fatal
|
||||||
LAMMPS into a C++ exceptions. You can use the library function
|
errors aborting LAMMPS into a C++ exceptions. You can use the library
|
||||||
:cpp:func:`lammps_config_has_exceptions` to check if this is the case.
|
function :cpp:func:`lammps_config_has_exceptions` to check if this is
|
||||||
|
the case.
|
||||||
\endverbatim
|
\endverbatim
|
||||||
*
|
*
|
||||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||||
* \return 0 on no error, 1 on error.
|
* \return 0 on no error, 1 on error.
|
||||||
*/
|
*/
|
||||||
int lammps_has_error(void *handle) {
|
int lammps_has_error(void *handle) {
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
LAMMPS * lmp = (LAMMPS *) handle;
|
LAMMPS * lmp = (LAMMPS *) handle;
|
||||||
Error * error = lmp->error;
|
Error * error = lmp->error;
|
||||||
return (error->get_last_error().empty()) ? 0 : 1;
|
return (error->get_last_error().empty()) ? 0 : 1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -3068,8 +3071,8 @@ the failing MPI ranks to send messages.
|
|||||||
|
|
||||||
.. note:
|
.. note:
|
||||||
|
|
||||||
This function is only available when the LAMMPS library has been
|
This function will do nothing when the LAMMPS library has been
|
||||||
compiled with ``-DLAMMPS_EXCEPTIONS`` which turns errors aborting
|
compiled without ``-DLAMMPS_EXCEPTIONS`` which turns errors aborting
|
||||||
LAMMPS into a C++ exceptions. You can use the library function
|
LAMMPS into a C++ exceptions. You can use the library function
|
||||||
:cpp:func:`lammps_config_has_exceptions` to check if this is the case.
|
:cpp:func:`lammps_config_has_exceptions` to check if this is the case.
|
||||||
\endverbatim
|
\endverbatim
|
||||||
@ -3080,6 +3083,7 @@ the failing MPI ranks to send messages.
|
|||||||
* \return 1 when all ranks had the error, 1 on a single rank error.
|
* \return 1 when all ranks had the error, 1 on a single rank error.
|
||||||
*/
|
*/
|
||||||
int lammps_get_last_error_message(void *handle, char * buffer, int buf_size) {
|
int lammps_get_last_error_message(void *handle, char * buffer, int buf_size) {
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
LAMMPS * lmp = (LAMMPS *) handle;
|
LAMMPS * lmp = (LAMMPS *) handle;
|
||||||
Error * error = lmp->error;
|
Error * error = lmp->error;
|
||||||
|
|
||||||
@ -3089,11 +3093,10 @@ int lammps_get_last_error_message(void *handle, char * buffer, int buf_size) {
|
|||||||
error->set_last_error("", ERROR_NONE);
|
error->set_last_error("", ERROR_NONE);
|
||||||
return error_type;
|
return error_type;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// fill-column: 72
|
// fill-column: 72
|
||||||
// End:
|
// End:
|
||||||
|
|||||||
@ -191,10 +191,8 @@ void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*);
|
|||||||
void lammps_fix_external_set_energy_global(void *, char *, double);
|
void lammps_fix_external_set_energy_global(void *, char *, double);
|
||||||
void lammps_fix_external_set_virial_global(void *, char *, double *);
|
void lammps_fix_external_set_virial_global(void *, char *, double *);
|
||||||
|
|
||||||
#ifdef LAMMPS_EXCEPTIONS
|
|
||||||
int lammps_has_error(void *handle);
|
int lammps_has_error(void *handle);
|
||||||
int lammps_get_last_error_message(void *handle, char *buffer, int buf_size);
|
int lammps_get_last_error_message(void *handle, char *buffer, int buf_size);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user