It’s easy to access one particle property in the plugin in which it is created. But how can I access other plugin’s property? For example, I want access to particle temperature from the build-in pTpath particle property in my own user-defined plugin. How can I do this?
(Maybe the “get_property_component_by_name” function is helpful, but I don’t know how to use it exactly.)
Wang Shi:
the properties attached to a particle aren’t kept in separate places, regardless of who created the particle or the property. They’re all stored in one long vector for each particle. That means that when you access a particle, you can always get all properties. The question is simply: Out of all of the numbers stored with a particle, which of these numbers correspond to a particular property (namely, the one you care about)? This is where the function you mention comes in: It translates from a symbolic name for a property to the position within the long vector. All you need to know is the symbolic name of the property you want to query.
I should mention that the function is deprecated and that you should be calling ParticlePropertyInformation::get_position_by_field_name() instead, which does the same thing.
Best
W.
Thanks a lot! I constantly get warning about the deprecated function and didn’t know why. Very helpful.