You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Python interface should reflect the recent changes to the Particle struct. The goal is to adapt all property getters to the new syntax, except for ext_flag and rotation which can be ignored (they rely on special getters outside the class definition). The setters don't need to change. This task is suitable for a coding day and can be done in about half an hour. No C++ knowledge required.
The src/python/espressomd/particle_data.pyx file currently looks like this:
cdef class ParticleHandle:
propertytype:
def__get__(self):
self.update_particle_data()
returnself.particle_data.p.type
It should look like this:
cdef class ParticleHandle:
propertytype:
def__get__(self):
self.update_particle_data()
returnself.particle_data.type() # <<< now we simply call the struct method
To achieve this, the src/python/espressomd/particle_data.pxd needs to be changed from this:
cdef extern from"particle_data.hpp":
ctypedef struct particle_properties "ParticleProperties":
int identity
inttype
ctypedef struct particle "Particle":
particle_properties p
Vector3d calc_dip()
to this:
cdef extern from"particle_data.hpp":
ctypedef struct particle_properties "ParticleProperties":
int identity # <<< 'type' is gone, 'identity' can be removed too
ctypedef struct particle "Particle":
particle_properties p
Vector3d calc_dip()
inttype() # <<< struct method is declared, do the same for all other properties
The same changes have to be applied to 2-3 lines in src/python/espressomd/visualization_mayavi.pyx.
Once all getters are replaced, particle_data.pxd should no longer need to declare the particle substructs.
The text was updated successfully, but these errors were encountered:
Additional task: do the same for compiler-dependent getters. All particle properties should now be available, even when features are not compiled in (when in doubt, run the python testsuite with maintainer/configs/empty.hpp as myconfig.hpp). Go from:
The Python interface should reflect the recent changes to the
Particle
struct. The goal is to adapt all property getters to the new syntax, except forext_flag
androtation
which can be ignored (they rely on special getters outside the class definition). The setters don't need to change. This task is suitable for a coding day and can be done in about half an hour. No C++ knowledge required.The
src/python/espressomd/particle_data.pyx
file currently looks like this:It should look like this:
To achieve this, the
src/python/espressomd/particle_data.pxd
needs to be changed from this:to this:
The same changes have to be applied to 2-3 lines in
src/python/espressomd/visualization_mayavi.pyx
.Once all getters are replaced,
particle_data.pxd
should no longer need to declare the particle substructs.The text was updated successfully, but these errors were encountered: