Avoid static int in lammps_last_thermo
This commit is contained in:
@ -794,7 +794,7 @@ argument string.
|
|||||||
- yes
|
- yes
|
||||||
* - type
|
* - type
|
||||||
- data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST`
|
- data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST`
|
||||||
- pointer to static int
|
- pointer to int
|
||||||
- yes
|
- yes
|
||||||
* - data
|
* - data
|
||||||
- actual field data for column
|
- actual field data for column
|
||||||
@ -815,7 +815,6 @@ void *lammps_last_thermo(void *handle, const char *what, int index)
|
|||||||
Thermo *th = lmp->output->thermo;
|
Thermo *th = lmp->output->thermo;
|
||||||
if (!th) return nullptr;
|
if (!th) return nullptr;
|
||||||
const int nfield = *th->get_nfield();
|
const int nfield = *th->get_nfield();
|
||||||
static int datatype;
|
|
||||||
|
|
||||||
BEGIN_CAPTURE
|
BEGIN_CAPTURE
|
||||||
{
|
{
|
||||||
@ -833,17 +832,7 @@ void *lammps_last_thermo(void *handle, const char *what, int index)
|
|||||||
} else if (strcmp(what, "type") == 0) {
|
} else if (strcmp(what, "type") == 0) {
|
||||||
if ((index < 0) || (index >= nfield)) return nullptr;
|
if ((index < 0) || (index >= nfield)) return nullptr;
|
||||||
const auto &field = th->get_fields()[index];
|
const auto &field = th->get_fields()[index];
|
||||||
if (field.type == multitype::INT) {
|
val = (void *) &field.type;
|
||||||
datatype = LAMMPS_INT;
|
|
||||||
val = (void *) &datatype;
|
|
||||||
} else if (field.type == multitype::BIGINT) {
|
|
||||||
datatype = LAMMPS_INT64;
|
|
||||||
val = (void *) &datatype;
|
|
||||||
} else if (field.type == multitype::DOUBLE) {
|
|
||||||
datatype = LAMMPS_DOUBLE;
|
|
||||||
val = (void *) &datatype;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (strcmp(what, "data") == 0) {
|
} else if (strcmp(what, "data") == 0) {
|
||||||
if ((index < 0) || (index >= nfield)) return nullptr;
|
if ((index < 0) || (index >= nfield)) return nullptr;
|
||||||
const auto &field = th->get_fields()[index];
|
const auto &field = th->get_fields()[index];
|
||||||
|
|||||||
@ -276,7 +276,8 @@ union ubuf {
|
|||||||
\endverbatim
|
\endverbatim
|
||||||
*/
|
*/
|
||||||
struct multitype {
|
struct multitype {
|
||||||
enum { NONE, DOUBLE, INT, BIGINT };
|
// same values as LAMMPS_INT, LAMMPS_DOUBLE, and LAMMPS_INT64 in library.h
|
||||||
|
enum { NONE = -1, INT = 0, DOUBLE = 2, BIGINT = 4 };
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
union {
|
union {
|
||||||
|
|||||||
Reference in New Issue
Block a user