Could you please confirm that the particle filters work for the HDF5 plugin output?
I was doing a simple test -- the LWFA example with added particleFilters.param, where I define a filter:
struct FunctorOnePercentParticles
{
static constexpr char const * name = "OnePercentParticles";
template< typename T_Rng, typename T_Particle >
HDINLINE bool operator()(
T_Rng & rng,
T_Particle const & particle
)
{
bool result = false;
//if( rng() >= float_X( 0.99 ) )
// result = true;
return result;
}
};
using OnePercentParticles = generic::FreeRng<
FunctorOnePercentParticles,
pmacc::random::distributions::Uniform< float_X >
>;
using AllParticleFilters = MakeSeq_t<
All,
OnePercentParticles
>;
This is supposed to block completely the particles output (since selection is commented), but in the output with --hdf5.source 'species_all, fields_all'", all species are still present. Am I forgetting something essential to activate the filter ?
PS in the doc
https://picongpu.readthedocs.io/en/0.4.2/usage/particles.html#_CPPv3N8picongpu9particles6filter7generic7FreeRngE
there seem to be a bug in example -- rng >= float_X( 0.5 ) should be rng() >= float_X( 0.5 ), right ?
You did everything correct. But if you want to output only the selected (or better say: unselected) particles, you can write: --hdf5.source 'species_OnePercentParticles,fields_all'.
That way, the filter "all" for species will not be written and only the "OnePercentParticles" filter is written (and fields).
You can also write --hdf5.source 'species_all,species_OnePercentParticles,fields_all' to write all particles in all species, all fields and also the one percent random selected particles (again).
P.S.: Ouch, sorry for the typo in the example. The code for it is here. Do you want to fix it with a first pull request to dev? :)
The HDF5 plugin docs also do not really mention the syntax species_<filter> (./bin/picongpu --help would tell in your input set at least). We should probably update its manual page as well.
sure, I'll patch it -- its never too much of the glory =)
concerning _HDF5 plugin docs_, i confirm, that for a pure user, the fast use of this plugin is rather challenging since species_all and fields_all are hard to extrapolate -- I mean, one can easily guess replacing fields_all with E, B, etc (getting field names from the output opmd files), but choosing one species, e.g. e won't work without _all..
At least it getting clearer, why _Functor_ requires the name string ;-)
uod patch is https://github.com/ComputationalRadiationPhysics/picongpu/pull/2825
Thx for the PR!
Docs: Yes, I wonder where we can efficiently document that. Nearly every "species" plugin supports filters now (yay!) so we can probably doc the naming convention in a common place in plugins, potentially before this section, and link in each plugin to it.
The creation of filters is, as you found, already doc-ed at least (now in the .param section)
I removed my text here I posted the answer to the wrong issue.