WarpX
Public Member Functions | Private Attributes | List of all members
RandomFilter Struct Reference

Functor that returns 0 or 1 depending on a random draw per particle. More...

#include <FilterFunctors.H>

Public Member Functions

 RandomFilter (bool a_is_active, amrex::Real a_fraction)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool operator() (const SuperParticleType &p, const amrex::RandomEngine &engine) const noexcept
 draw random number, return 1 if number < m_fraction, 1 otherwise More...
 

Private Attributes

const bool m_is_active
 
const amrex::Real m_fraction = 1.0
 select all particles if false More...
 

Detailed Description

Functor that returns 0 or 1 depending on a random draw per particle.

Constructor & Destructor Documentation

◆ RandomFilter()

RandomFilter::RandomFilter ( bool  a_is_active,
amrex::Real  a_fraction 
)
inline

constructor

Parameters
a_is_activewhether the test is active
a_fractionfraction of particles to select

Member Function Documentation

◆ operator()()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool RandomFilter::operator() ( const SuperParticleType p,
const amrex::RandomEngine engine 
) const
inlinenoexcept

draw random number, return 1 if number < m_fraction, 1 otherwise

Parameters
pone particle
enginethe random number state and factory
Returns
whether or not the particle is selected

Member Data Documentation

◆ m_fraction

const amrex::Real RandomFilter::m_fraction = 1.0
private

select all particles if false

◆ m_is_active

const bool RandomFilter::m_is_active
private

The documentation for this struct was generated from the following file: