WarpX
Resampling.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_H_
8 #define WARPX_RESAMPLING_H_
9 
10 #include "ResamplingTrigger.H"
11 
13 
14 #include <AMReX_REAL.H>
15 
16 #include <memory>
17 #include <string>
18 
23 {
27  virtual void operator() (WarpXParIter& /*pti*/, int /*lev*/, WarpXParticleContainer* /*pc*/) const = 0;
28 
32  virtual ~ResamplingAlgorithm () = default;
33 
35  ResamplingAlgorithm () = default;
36 
37 
42 };
43 
51 {
52 public:
53 
57  Resampling () = default;
58 
65  Resampling (const std::string& species_name);
66 
74  bool triggered (int timestep, amrex::Real global_numparts) const;
75 
83  void operator() (WarpXParIter& pti, int lev, WarpXParticleContainer* pc) const;
84 
85 private:
87  std::unique_ptr<ResamplingAlgorithm> m_resampling_algorithm;
88 };
89 
90 #endif //WARPX_RESAMPLING_H_
This is a general class used for resampling that is instantiated as a member of MultiParticleContaine...
Definition: Resampling.H:51
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: Resampling.cpp:36
ResamplingTrigger m_resampling_trigger
Definition: Resampling.H:86
Resampling()=default
Default constructor of the Resampling class.
std::unique_ptr< ResamplingAlgorithm > m_resampling_algorithm
Definition: Resampling.H:87
void operator()(WarpXParIter &pti, int lev, WarpXParticleContainer *pc) const
A method that uses the ResamplingAlgorithm object to perform resampling.
Definition: Resampling.cpp:41
This class is used to determine if resampling should be done at a given timestep for a given species....
Definition: ResamplingTrigger.H:24
Definition: WarpXParticleContainer.H:53
Definition: WarpXParticleContainer.H:111
An empty base class from which specific resampling algorithms are derived.
Definition: Resampling.H:23
virtual void operator()(WarpXParIter &, int, WarpXParticleContainer *) const =0
Virtual operator() of the abstract ResamplingAlgorithm class.
ResamplingAlgorithm(ResamplingAlgorithm const &)=default
ResamplingAlgorithm()=default
ResamplingAlgorithm & operator=(ResamplingAlgorithm const &)=default
virtual ~ResamplingAlgorithm()=default
Virtual destructor of the abstract ResamplingAlgorithm class.
ResamplingAlgorithm(ResamplingAlgorithm &&)=default