WarpX
ResamplingTrigger.H
Go to the documentation of this file.
1 /* Copyright 2019-2020 Neil Zaim
2  *
3  * This file is part of WarpX.
4  *
5  * License: BSD-3-Clause-LBNL
6  */
7 #ifndef WARPX_RESAMPLING_TRIGGER_H_
8 #define WARPX_RESAMPLING_TRIGGER_H_
9 
11 
12 #include <AMReX_REAL.H>
13 
14 #include <limits>
15 #include <string>
16 
24 {
25 public:
26 
30  ResamplingTrigger () = default;
31 
36  ResamplingTrigger (const std::string& species_name);
37 
45  bool triggered (int timestep, amrex::Real global_numparts) const;
46 
52  void initialize_global_numcells () const;
53 
54 private:
55  // Intervals that define predetermined timesteps at which resampling is performed for all
56  // species.
58 
59  // Average number of particles per cell above which resampling is performed for a given species
60  amrex::Real m_max_avg_ppc = std::numeric_limits<amrex::Real>::max();
61 
62  //Total number of simulated cells, summed over all mesh refinement levels.
63  mutable amrex::Real m_global_numcells = amrex::Real(0.0);
64 
65  mutable bool m_initialized = false;
66 };
67 
68 #endif //WARPX_RESAMPLING_TRIGGER_H_
This class is used to determine if resampling should be done at a given timestep for a given species....
Definition: ResamplingTrigger.H:24
amrex::Real m_max_avg_ppc
Definition: ResamplingTrigger.H:60
utils::parser::IntervalsParser m_resampling_intervals
Definition: ResamplingTrigger.H:57
bool triggered(int timestep, amrex::Real global_numparts) const
A method that returns true if resampling should be done for the considered species at the considered ...
Definition: ResamplingTrigger.cpp:29
ResamplingTrigger()=default
Default constructor of the ResamplingTrigger class.
bool m_initialized
Definition: ResamplingTrigger.H:65
void initialize_global_numcells() const
A method that initializes the member m_global_numcells. It is only called once (the first time trigge...
Definition: ResamplingTrigger.cpp:38
amrex::Real m_global_numcells
Definition: ResamplingTrigger.H:63
This class is a parser for multiple slices of the form x,y,z,... where x, y and z are slices of the f...
Definition: IntervalsParser.H:103