Add lammps_flush_buffers() library function
This commit is contained in:
@ -13,6 +13,7 @@ functions. They do not directly call the LAMMPS library.
|
||||
- :cpp:func:`lammps_fix_external_set_virial_peratom`
|
||||
- :cpp:func:`lammps_fix_external_set_vector_length`
|
||||
- :cpp:func:`lammps_fix_external_set_vector`
|
||||
- :cpp:func:`lammps_flush_buffers`
|
||||
- :cpp:func:`lammps_free`
|
||||
- :cpp:func:`lammps_is_running`
|
||||
- :cpp:func:`lammps_force_timeout`
|
||||
@ -72,6 +73,11 @@ where such memory buffers were allocated that require the use of
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_flush_buffers
|
||||
:project: progguide
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_free
|
||||
:project: progguide
|
||||
|
||||
|
||||
@ -5439,6 +5439,25 @@ void lammps_fix_external_set_vector(void *handle, const char *id, int idx, doubl
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/** Flush output buffers
|
||||
|
||||
\verbatim embed:rst
|
||||
This function can be used to force output to be written to screen and logfiles
|
||||
to simplify capturing output from LAMMPS library calls.
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
*/
|
||||
void lammps_flush_buffers(void *handle) {
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
if (lmp->screen) fflush(lmp->screen);
|
||||
if (lmp->logfile) fflush(lmp->logfile);
|
||||
if (lmp->universe->uscreen) fflush(lmp->universe->uscreen);
|
||||
if (lmp->universe->ulogfile) fflush(lmp->universe->ulogfile);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/** Free memory buffer allocated by LAMMPS.
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
@ -246,6 +246,8 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double
|
||||
void lammps_fix_external_set_vector_length(void *handle, const char *id, int len);
|
||||
void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val);
|
||||
|
||||
void lammps_flush_buffers(void *ptr);
|
||||
|
||||
void lammps_free(void *ptr);
|
||||
|
||||
int lammps_is_running(void *handle);
|
||||
|
||||
Reference in New Issue
Block a user