library: update new function signatures to use void* instead of bigint

This commit is contained in:
Richard Berger
2025-01-19 16:06:33 -07:00
parent 93e266f648
commit 2c82ce8142
4 changed files with 32 additions and 35 deletions

View File

@ -13,9 +13,9 @@ fixes, or variables in LAMMPS using the following functions:
- :cpp:func:`lammps_set_internal_variable`
- :cpp:func:`lammps_variable_info`
- :cpp:func:`lammps_eval`
- :cpp:func:`lammps_compute_clearstep`
- :cpp:func:`lammps_compute_addstep_all`
- :cpp:func:`lammps_compute_addstep`
- :cpp:func:`lammps_clearstep_compute`
- :cpp:func:`lammps_addstep_compute_all`
- :cpp:func:`lammps_addstep_compute`
-----------------------
@ -64,17 +64,17 @@ fixes, or variables in LAMMPS using the following functions:
-----------------------
.. doxygenfunction:: lammps_compute_clearstep
.. doxygenfunction:: lammps_clearstep_compute
:project: progguide
-----------------------
.. doxygenfunction:: lammps_compute_addstep_all(void *handle, int nextstep)
.. doxygenfunction:: lammps_addstep_compute_all
:project: progguide
-----------------------
.. doxygenfunction:: lammps_compute_addstep(void *handle, int nextstep)
.. doxygenfunction:: lammps_addstep_compute
:project: progguide
-----------------------

View File

@ -422,9 +422,9 @@ class lammps(object):
self.lib.lammps_extract_variable_datatype.argtypes = [c_void_p, c_char_p]
self.lib.lammps_extract_variable_datatype.restype = c_int
self.lib.lammps_compute_clearstep.argtype = [c_void_p]
self.lib.lammps_compute_addstep.argtype = [c_void_p, self.c_bigint]
self.lib.lammps_compute_addstep_all.argtype = [c_void_p, self.c_bigint]
self.lib.lammps_clearstep_compute.argtype = [c_void_p]
self.lib.lammps_addstep_compute.argtype = [c_void_p, c_void_p]
self.lib.lammps_addstep_compute_all.argtype = [c_void_p, c_void_p]
self.lib.lammps_eval.argtypes = [c_void_p, c_char_p]
self.lib.lammps_eval.restype = c_double
@ -1598,21 +1598,23 @@ class lammps(object):
# -------------------------------------------------------------------------
def compute_clearstep(self, nextstep):
def clearstep_compute(self, nextstep):
with ExceptionCheck(self):
return self.lib.lammps_compute_clearstep(self.lmp)
return self.lib.lammps_clearstep_compute(self.lmp)
# -------------------------------------------------------------------------
def compute_addstep(self, nextstep):
def addstep_compute(self, nextstep):
with ExceptionCheck(self):
return self.lib.lammps_compute_addstep(self.lmp, nextstep)
nextstep = self.c_bigint(nextstep)
return self.lib.lammps_addstep_compute(self.lmp, pointer(nextstep))
# -------------------------------------------------------------------------
def compute_addstep_all(self, nextstep):
def addstep_compute_all(self, nextstep):
with ExceptionCheck(self):
return self.lib.lammps_compute_addstep_all(self.lmp, nextstep)
nextstep = self.c_bigint(nextstep)
return self.lib.lammps_addstep_compute_all(self.lmp, pointer(nextstep))
# -------------------------------------------------------------------------

View File

@ -2974,14 +2974,14 @@ double lammps_eval(void *handle, const char *expr)
and to flag computes that store invocation times as having been invoked
*See also*
:cpp:func:`lammps_compute_addstep_all`
:cpp:func:`lammps_compute_addstep`
:cpp:func:`lammps_addstep_compute_all`
:cpp:func:`lammps_addstep_compute`
\endverbatim
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
*/
void lammps_compute_clearstep(void * handle) {
void lammps_clearstep_compute(void * handle) {
auto lmp = (LAMMPS *) handle;
lmp->modify->clearstep_compute();
}
@ -3000,17 +3000,17 @@ void lammps_compute_clearstep(void * handle) {
do not loop only over n_timeflag, since may not be set yet
*See also*
:cpp:func:`lammps_compute_clearstep`
:cpp:func:`lammps_compute_addstep`
:cpp:func:`lammps_clearstep_compute`
:cpp:func:`lammps_addstep_compute`
\endverbatim
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
* \param newstep next timestep the compute will be invoked
* \param newstep pointer to bigint of next timestep the compute will be invoked
*/
void lammps_compute_addstep_all(void * handle, bigint newstep) {
void lammps_addstep_compute_all(void * handle, void * newstep) {
auto lmp = (LAMMPS *) handle;
lmp->modify->addstep_compute_all(newstep);
lmp->modify->addstep_compute_all(*static_cast<bigint*>(newstep));
}
/* ---------------------------------------------------------------------- */
@ -3025,17 +3025,17 @@ void lammps_compute_addstep_all(void * handle, bigint newstep) {
called everywhere that computes are used, after computes are invoked
*See also*
:cpp:func:`lammps_compute_addstep_all`
:cpp:func:`lammps_compute_clearstep`
:cpp:func:`lammps_addstep_compute_all`
:cpp:func:`lammps_clearstep_compute`
\endverbatim
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
* \param newstep next timestep the compute will be invoked
*/
void lammps_compute_addstep(void * handle, bigint newstep) {
void lammps_addstep_compute(void * handle, void * newstep) {
auto lmp = (LAMMPS *) handle;
lmp->modify->addstep_compute(newstep);
lmp->modify->addstep_compute(*static_cast<bigint*>(newstep));
}
// ----------------------------------------------------------------------

View File

@ -191,14 +191,9 @@ int lammps_set_internal_variable(void *handle, const char *name, double value);
int lammps_variable_info(void *handle, int idx, char *buf, int bufsize);
double lammps_eval(void *handle, const char *expr);
void lammps_compute_clearstep(void *handle);
#if defined(LAMMPS_SMALLSMALL)
void lammps_compute_addstep_all(void *handle, int nextstep);
void lammps_compute_addstep(void *handle, int nextstep);
#else
void lammps_compute_addstep_all(void *handle, int64_t nextstep);
void lammps_compute_addstep(void *handle, int64_t nextstep);
#endif
void lammps_clearstep_compute(void *handle);
void lammps_addstep_compute_all(void *handle, void * nextstep);
void lammps_addstep_compute(void *handle, void * nextstep);
/* ----------------------------------------------------------------------
* Library functions for scatter/gather operations of data