OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
PoissonSolver.h
Go to the documentation of this file.
1 #ifndef POISSON_SOLVER_H_
2 #define POISSON_SOLVER_H_
3 
6 
7 #include "Field/Field.h"
8 
9 #ifdef ENABLE_AMR
10  #include "Utilities/OpalException.h"
11 #endif
13 template <class T, unsigned Dim>
14 class PartBunchBase;
15 
17 
18 protected:
21 
22 public:
23 
24  // given a charge-density field rho and a set of mesh spacings hr,
25  // compute the scalar potential in open space
26  virtual void computePotential(Field_t &rho, Vector_t hr) = 0;
27 
28 #ifdef ENABLE_AMR
39  virtual void solve(AmrScalarFieldContainer_t &/*rho*/,
41  AmrVectorFieldContainer_t &/*efield*/,
42  unsigned short /*baseLevel*/,
43  unsigned short /*finestLevel*/,
44  bool /*prevAsGuess*/ = true)
45  {
46  throw OpalException("PoissonSolver::solve()", "Not supported for non-AMR code.");
47  };
48 
52  virtual void hasToRegrid() {
53  throw OpalException("PoissonSolver::hasToRegrid()", "Not supported for non-AMR code.");
54  }
55 #endif
56 
57  virtual void computePotential(Field_t &rho, Vector_t hr, double zshift) = 0;
58 
59  virtual double getXRangeMin(unsigned short level = 0) = 0;
60  virtual double getXRangeMax(unsigned short level = 0) = 0;
61  virtual double getYRangeMin(unsigned short level = 0) = 0;
62  virtual double getYRangeMax(unsigned short level = 0) = 0;
63  virtual double getZRangeMin(unsigned short level = 0) = 0;
64  virtual double getZRangeMax(unsigned short level = 0) = 0;
65  virtual void test(PartBunchBase<double, 3> *bunch) = 0 ;
66  virtual ~PoissonSolver(){};
67 
68  virtual void resizeMesh(Vector_t& /*origin*/, Vector_t& /*hr*/,
69  const Vector_t& /*rmin*/, const Vector_t& /*rmax*/,
70  double /*dh*/)
71  { };
72 
73 };
74 
75 inline Inform &operator<<(Inform &os, const PoissonSolver &/*fs*/) {
76  return os << "";
77 }
78 #endif
amr::AmrScalarFieldContainer_t AmrScalarFieldContainer_t
Definition: PBunchDefs.h:35
UniformCartesian< 3, double > Mesh_t
Definition: PBunchDefs.h:22
amr::AmrVectorFieldContainer_t AmrVectorFieldContainer_t
Definition: PBunchDefs.h:36
Inform & operator<<(Inform &os, const PoissonSolver &)
Definition: PoissonSolver.h:75
virtual void solve(AmrScalarFieldContainer_t &, AmrScalarFieldContainer_t &, AmrVectorFieldContainer_t &, unsigned short, unsigned short, bool=true)
Definition: PoissonSolver.h:39
virtual void computePotential(Field_t &rho, Vector_t hr, double zshift)=0
virtual void computePotential(Field_t &rho, Vector_t hr)=0
Field< std::complex< double >, 3, Mesh_t, Center_t > CxField_t
Definition: PoissonSolver.h:20
virtual double getZRangeMin(unsigned short level=0)=0
virtual double getYRangeMin(unsigned short level=0)=0
Field< int, 3, Mesh_t, Center_t > IField_t
Definition: PoissonSolver.h:19
virtual double getXRangeMin(unsigned short level=0)=0
virtual void resizeMesh(Vector_t &, Vector_t &, const Vector_t &, const Vector_t &, double)
Definition: PoissonSolver.h:68
virtual double getYRangeMax(unsigned short level=0)=0
virtual void hasToRegrid()
Definition: PoissonSolver.h:52
virtual double getZRangeMax(unsigned short level=0)=0
virtual void test(PartBunchBase< double, 3 > *bunch)=0
virtual double getXRangeMax(unsigned short level=0)=0
virtual ~PoissonSolver()
Definition: PoissonSolver.h:66
The base class for all OPAL exceptions.
Definition: OpalException.h:28
Definition: Field.h:33
Definition: Centering.h:32
Definition: Inform.h:42