fix several issues when using extract_global() from python exposed by tests

This commit is contained in:
Axel Kohlmeyer
2021-03-25 11:23:28 -04:00
committed by Richard Berger
parent b8f02d759a
commit a193d9d429
3 changed files with 20 additions and 5 deletions

View File

@ -777,10 +777,11 @@ class lammps(object):
target_type = float
elif dtype == LAMMPS_STRING:
self.lib.lammps_extract_global.restype = c_char_p
target_type = lambda x: str(x, 'ascii')
ptr = self.lib.lammps_extract_global(self.lmp, name)
if ptr:
if dtype == LAMMPS_STRING:
return ptr.decode('utf-8')
if veclen > 1:
result = []
for i in range(0,veclen):