ECP-WarpX / WarpX

WarpX is an advanced electromagnetic & electrostatic Particle-In-Cell code.
https://ecp-warpx.github.io
Other
291 stars 185 forks source link

Parser: Support User-Defined Particle Attributes #3051

Open ax3l opened 2 years ago

ax3l commented 2 years ago

For our filters and histograms in I/O (1D, 2D, full, #3033), it would be very useful if user-defined particle attributes could be used in parser functions.

Currently, we only support the pre-defined attributes there, most of the time that's x,y,z,ux,uy,uz.

Do you have an idea how we could do this @WeiqunZhang @RevathiJambunathan @hklion ?

hklion commented 2 years ago

Maybe a way to do this is to add a compile flag that controls the max number of user-defined attributes that can be used in the parsers? That way it can scale to something arbitrarily large if a user wants, but by default we don't have to carry around much (or any!) extra memory. Identifying which variables to use from the parser function would require some string gymnastics, but I don't think there's any reason variable names would have to be known at compile time (though I've never tried it).