Merge branch 'master' into iss2345
This commit is contained in:
@ -69,7 +69,7 @@ using namespace LAMMPS_NS;
|
||||
|
||||
#ifdef LAMMPS_EXCEPTIONS
|
||||
#define BEGIN_CAPTURE \
|
||||
Error * error = lmp->error; \
|
||||
Error *error = lmp->error; \
|
||||
try
|
||||
|
||||
#define END_CAPTURE \
|
||||
@ -594,7 +594,7 @@ double lammps_get_natoms(void *handle)
|
||||
{
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
|
||||
double natoms = static_cast<double> (lmp->atom->natoms);
|
||||
double natoms = static_cast<double>(lmp->atom->natoms);
|
||||
if (natoms > 9.0e15) return 0; // TODO:XXX why not -1?
|
||||
return natoms;
|
||||
}
|
||||
@ -616,7 +616,7 @@ a double, so it can also return information that is computed on-the-fly.
|
||||
* \param keyword string with the name of the thermo keyword
|
||||
* \return value of the requested thermo property or 0.0 */
|
||||
|
||||
double lammps_get_thermo(void *handle, char *keyword)
|
||||
double lammps_get_thermo(void *handle, const char *keyword)
|
||||
{
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
double dval = 0.0;
|
||||
@ -807,7 +807,7 @@ recognized, the function returns -1. Please also see :cpp:func:`lammps_extract_
|
||||
* \param keyword string with the name of the thermo keyword
|
||||
* \return value of the queried setting or -1 if unknown */
|
||||
|
||||
int lammps_extract_setting(void * handle, char *keyword)
|
||||
int lammps_extract_setting(void *handle, const char *keyword)
|
||||
{
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
|
||||
@ -865,7 +865,8 @@ Please also see :cpp:func:`lammps_extract_setting`,
|
||||
This table lists the supported names, their data types, length of the
|
||||
data area, and a short description. The ``bigint`` type may be defined
|
||||
to be either an ``int`` or an ``int64_t``. This is selected at
|
||||
:ref:`compile time <size>`.
|
||||
:ref:`compile time <size>` and can be queried through calling
|
||||
:cpp:func:`lammps_extract_setting`.
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
@ -1073,7 +1074,7 @@ to be either an ``int`` or an ``int64_t``. This is selected at
|
||||
* \return pointer (cast to ``void *``) to the location of the
|
||||
requested property. nullptr if name is not known. */
|
||||
|
||||
void *lammps_extract_global(void *handle, char *name)
|
||||
void *lammps_extract_global(void *handle, const char *name)
|
||||
{
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
|
||||
@ -1165,7 +1166,7 @@ of the :cpp:func:`Atom::extract() <LAMMPS_NS::Atom::extract>` function.
|
||||
* \return pointer (cast to ``void *``) to the location of the
|
||||
* requested data or ``nullptr`` if not found. */
|
||||
|
||||
void *lammps_extract_atom(void *handle, char *name)
|
||||
void *lammps_extract_atom(void *handle, const char *name)
|
||||
{
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
return lmp->atom->extract(name);
|
||||
@ -3724,7 +3725,7 @@ specific :doc:`LAMMPS package <Packages>` provided as argument.
|
||||
* \param name string with the name of the package
|
||||
* \return 1 if included, 0 if not.
|
||||
*/
|
||||
int lammps_config_has_package(char * name) {
|
||||
int lammps_config_has_package(const char *name) {
|
||||
return Info::has_package(name) ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -3764,7 +3765,7 @@ the function returns 0 and *buffer* is set to an empty string, otherwise 1;
|
||||
* \param buf_size size of the provided string buffer
|
||||
* \return 1 if successful, otherwise 0
|
||||
*/
|
||||
int lammps_config_package_name(int idx, char * buffer, int buf_size) {
|
||||
int lammps_config_package_name(int idx, char *buffer, int buf_size) {
|
||||
int maxidx = lammps_config_package_count();
|
||||
if ((idx < 0) || (idx >= maxidx)) {
|
||||
buffer[0] = '\0';
|
||||
@ -3788,14 +3789,14 @@ Valid categories are: *atom*\ , *integrate*\ , *minimize*\ ,
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
* \param category category of the style
|
||||
* \param name name of the style
|
||||
* \return 1 if included, 0 if not.
|
||||
* \param category category of the style
|
||||
* \param name name of the style
|
||||
* \return 1 if included, 0 if not.
|
||||
*/
|
||||
int lammps_has_style(void * handle, char * category, char * name) {
|
||||
int lammps_has_style(void *handle, const char *category, const char *name) {
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
Info info(lmp);
|
||||
return info.has_style(category, name) ? 0 : 1;
|
||||
return info.has_style(category, name) ? 1 : 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -3813,7 +3814,7 @@ categories.
|
||||
* \param category category of styles
|
||||
* \return number of styles in category
|
||||
*/
|
||||
int lammps_style_count(void * handle, char * category) {
|
||||
int lammps_style_count(void *handle, const char *category) {
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
Info info(lmp);
|
||||
return info.get_available_styles(category).size();
|
||||
@ -3839,7 +3840,8 @@ Please see :cpp:func:`lammps_has_style` for a list of valid categories.
|
||||
* \param buf_size size of the provided string buffer
|
||||
* \return 1 if successful, otherwise 0
|
||||
*/
|
||||
int lammps_style_name(void* handle, char * category, int idx, char * buffer, int buf_size) {
|
||||
int lammps_style_name(void *handle, const char *category, int idx,
|
||||
char *buffer, int buf_size) {
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
Info info(lmp);
|
||||
auto styles = info.get_available_styles(category);
|
||||
@ -4265,10 +4267,10 @@ the failing MPI ranks to send messages.
|
||||
* \param buf_size size of the provided string buffer
|
||||
* \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;
|
||||
Error * error = lmp->error;
|
||||
LAMMPS *lmp = (LAMMPS *) handle;
|
||||
Error *error = lmp->error;
|
||||
|
||||
if(!error->get_last_error().empty()) {
|
||||
int error_type = error->get_last_error_type();
|
||||
|
||||
Reference in New Issue
Block a user