add ability to retrieve the number of local rows for computes returning local data

this is done supporting the combination of type == 2 with style == 0,
i.e. a local scalar, which is not available in C++ (but there one can
access the compute style data member directly. for the python interface,
the pointer is automatically dereferenced and returned as a c_int.
This commit is contained in:
Axel Kohlmeyer
2018-04-19 18:37:15 -04:00
parent 164537cf37
commit 5bf8e1bc5b
2 changed files with 17 additions and 4 deletions

View File

@ -384,9 +384,14 @@ class lammps(object):
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
return ptr
if type == 2:
self.lib.lammps_extract_compute.restype = POINTER(POINTER(c_double))
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
return ptr
if style == 0:
self.lib.lammps_extract_compute.restype = POINTER(c_int)
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
return ptr[0]
else:
self.lib.lammps_extract_compute.restype = POINTER(POINTER(c_double))
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
return ptr
return None
# extract fix info