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 
10 #include "Utils/IntervalsParser.H"
11 
12 #include <AMReX_ParmParse.H>
13 
21 {
22 public:
23 
27  ResamplingTrigger () = default;
28 
33  ResamplingTrigger (const std::string species_name);
34 
42  bool triggered (const int timestep, const amrex::Real global_numparts) const;
43 
49  void initialize_global_numcells () const;
50 
51 private:
52  // Intervals that define predetermined timesteps at which resampling is performed for all
53  // species.
55 
56  // Average number of particles per cell above which resampling is performed for a given species
57  amrex::Real m_max_avg_ppc = std::numeric_limits<amrex::Real>::max();
58 
59  //Total number of simulated cells, summed over all mesh refinement levels.
60  mutable amrex::Real m_global_numcells = amrex::Real(0.0);
61 
62  mutable bool m_initialized = false;
63 };
64 
65 #endif //WARPX_RESAMPLING_TRIGGER_H_
amrex::Real m_global_numcells
Definition: ResamplingTrigger.H:60
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:82
This class is used to determine if resampling should be done at a given timestep for a given species...
Definition: ResamplingTrigger.H:20
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:30
IntervalsParser m_resampling_intervals
Definition: ResamplingTrigger.H:54
ResamplingTrigger()=default
Default constructor of the ResamplingTrigger class.
bool m_initialized
Definition: ResamplingTrigger.H:62
amrex::Real m_max_avg_ppc
Definition: ResamplingTrigger.H:57
bool triggered(const int timestep, const 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:21