WarpX
Public Member Functions | Private Attributes | List of all members
ParticleReductionFunctor Class Referencefinal

Functor to calculate per-cell averages of particle properties. More...

#include <ParticleReductionFunctor.H>

Inheritance diagram for ParticleReductionFunctor:
ComputeDiagFunctor

Public Member Functions

 ParticleReductionFunctor (const amrex::MultiFab *mf_src, int lev, amrex::IntVect crse_ratio, const std::string &fn_str, int ispec, bool do_average, bool do_filter, const std::string &filter_str, int ncomp=1)
 
void operator() (amrex::MultiFab &mf_dst, int dcomp, int) const override
 Compute the average of the function m_map_fn over each grid cell. More...
 
- Public Member Functions inherited from ComputeDiagFunctor
 ComputeDiagFunctor (int ncomp, amrex::IntVect crse_ratio)
 
virtual ~ComputeDiagFunctor ()=default
 
 ComputeDiagFunctor (const ComputeDiagFunctor &)=default
 
ComputeDiagFunctoroperator= (const ComputeDiagFunctor &)=default
 
 ComputeDiagFunctor (ComputeDiagFunctor &&)=default
 
ComputeDiagFunctoroperator= (ComputeDiagFunctor &&)=default
 
int nComp () const
 
virtual void PrepareFunctorData (int i_buffer, bool z_slice_in_domain, amrex::Real current_z_boost, amrex::Box buffer_box, const int k_index_zlab, const int snapshot_full)
 Prepare data required to process fields in the operator() Note that this function has parameters that are specific to back-transformed diagnostics, that are unused for regular diagnostics. More...
 
virtual void InitData ()
 
void InterpolateMFForDiag (amrex::MultiFab &mf_dst, const amrex::MultiFab &mf_src, int dcomp, const amrex::DistributionMapping &dm, bool convertRZmodes2cartesian) const
 

Private Attributes

int const m_lev
 
int const m_ispec
 
bool const m_do_average
 
bool const m_do_filter
 
std::unique_ptr< amrex::Parserm_map_fn_parser
 
std::unique_ptr< amrex::Parserm_filter_fn_parser
 
amrex::ParserExecutor< 6 > m_map_fn
 
amrex::ParserExecutor< 6 > m_filter_fn
 

Additional Inherited Members

- Protected Attributes inherited from ComputeDiagFunctor
amrex::IntVect m_crse_ratio
 

Detailed Description

Functor to calculate per-cell averages of particle properties.

Constructor & Destructor Documentation

◆ ParticleReductionFunctor()

ParticleReductionFunctor::ParticleReductionFunctor ( const amrex::MultiFab mf_src,
int  lev,
amrex::IntVect  crse_ratio,
const std::string &  fn_str,
int  ispec,
bool  do_average,
bool  do_filter,
const std::string &  filter_str,
int  ncomp = 1 
)

Constructor.

Parameters
[in]mf_srcsource multifab. Must be nullptr as no source MF is needed to compute the number of particles per cell, banane.
[in]levlevel of multifab.
[in]crse_ratiofor interpolating field values from simulation MultiFabs to the output diagnostic MultiFab mf_dst.
[in]fn_strparser string that describes the function to apply to particles and then average over each cell
[in]ispecindex of the species over which to calculate the average
[in]do_averageWhether to do an average or a sum of the function
[in]do_filterWhether to apply a filter function to particles before averaging
[in]filter_strParser string for filter function to apply before averaging
[in]ncompNumber of component of mf_src to cell-center in dst multifab.

Member Function Documentation

◆ operator()()

void ParticleReductionFunctor::operator() ( amrex::MultiFab mf_dst,
int  dcomp,
int   
) const
overridevirtual

Compute the average of the function m_map_fn over each grid cell.

Parameters
[out]mf_dstoutput MultiFab where the result is written
[in]dcompfirst component of mf_dst in which cell-centered data is stored

Implements ComputeDiagFunctor.

Member Data Documentation

◆ m_do_average

bool const ParticleReductionFunctor::m_do_average
private

Whether to calculate the average of the data

◆ m_do_filter

bool const ParticleReductionFunctor::m_do_filter
private

whether to apply m_filter_fn

◆ m_filter_fn

amrex::ParserExecutor<6> ParticleReductionFunctor::m_filter_fn
private

◆ m_filter_fn_parser

std::unique_ptr<amrex::Parser> ParticleReductionFunctor::m_filter_fn_parser
private

Parser function to filter particles before pass to map. Arguments: x, y, z, ux, uy, uz

◆ m_ispec

int const ParticleReductionFunctor::m_ispec
private

index of species to average over

◆ m_lev

int const ParticleReductionFunctor::m_lev
private

level on which mf_src is defined

◆ m_map_fn

amrex::ParserExecutor<6> ParticleReductionFunctor::m_map_fn
private

Compiled m_map_fn_parser

◆ m_map_fn_parser

std::unique_ptr<amrex::Parser> ParticleReductionFunctor::m_map_fn_parser
private

Parser function to be averaged by the functor. Arguments: x, y, z, ux, uy, uz


The documentation for this class was generated from the following files: