OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
AbstractParticle.h
Go to the documentation of this file.
1 //
2 // Class AbstractParticle
3 // Abstract base class for IpplParticleBase and AmrParticleBase
4 //
5 // Copyright (c) 2017, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved
7 //
8 // Implemented as part of the PhD thesis
9 // "Precise Simulations of Multibunches in High Intensity Cyclotrons"
10 //
11 // This file is part of OPAL.
12 //
13 // OPAL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20 //
21 #ifndef ABSTRACT_PARTICLE_H
22 #define ABSTRACT_PARTICLE_H
23 
25 
26 template<class T> class ParticleAttrib;
27 class ParticleAttribBase;
28 
29 template <class T, unsigned Dim>
31 
32 public:
41 
42 public:
43 
44  AbstractParticle() : R_p(0), ID_p(0) {}
45 
46  virtual ~AbstractParticle() { }
47 // AbstractParticle(ParticlePos_t& R,
48 // ParticleIndex_t& ID) : R_p(&R), ID_p(&ID)
49 // {
50 // std::cout << "AbstractParticle()" << std::endl;
51 // }
52 
53  virtual void addAttribute(ParticleAttribBase& pa) = 0;
54 
55  virtual size_t getTotalNum() const = 0;
56  virtual size_t getLocalNum() const = 0;
57  virtual size_t getDestroyNum() const = 0;
58  virtual size_t getGhostNum() const = 0;
59  virtual void setTotalNum(size_t n) = 0;
60  virtual void setLocalNum(size_t n) = 0;
61 
62  virtual Layout_t& getLayout() = 0;
63  virtual const Layout_t& getLayout() const = 0;
64 
65  virtual bool getUpdateFlag(UpdateFlags f) const = 0;
66 
67  virtual void setUpdateFlag(UpdateFlags f, bool val) = 0;
68 
70 
71  virtual void setBConds(const ParticleBConds<Position_t, Dim>& bc) = 0;
72 
73  virtual bool singleInitNode() const = 0;
74 
75  virtual void resetID() = 0;
76 
77 
78  virtual void update() = 0;
79  virtual void update(const ParticleAttrib<char>& canSwap) = 0;
80 
81  virtual void createWithID(unsigned id) = 0;
82  virtual void create(size_t) = 0;
83  virtual void globalCreate(size_t np) = 0;
84 
85  virtual void destroy(size_t, size_t, bool = false) = 0;
86 
87  virtual void performDestroy(bool updateLocalNum = false) = 0;
88 
89  virtual void ghostDestroy(size_t M, size_t I) = 0;
90 
91 public:
94 };
95 
96 #endif
virtual void create(size_t)=0
virtual ~AbstractParticle()
ParticleLayout< T, Dim >::SingleParticlePos_t SingleParticlePos_t
ParticleLayout< T, Dim >::Index_t Index_t
ParticleLayout< T, Dim > Layout_t
virtual void globalCreate(size_t np)=0
ParticleLayout< T, Dim >::Position_t Position_t
virtual void setTotalNum(size_t n)=0
ParticlePos_t * R_p
virtual void setUpdateFlag(UpdateFlags f, bool val)=0
ParticleLayout< T, Dim >::UpdateFlags UpdateFlags
virtual void addAttribute(ParticleAttribBase &pa)=0
virtual void setLocalNum(size_t n)=0
virtual const Layout_t & getLayout() const =0
virtual void setBConds(const ParticleBConds< Position_t, Dim > &bc)=0
ParticleIndex_t * ID_p
virtual size_t getTotalNum() const =0
virtual size_t getLocalNum() const =0
virtual bool singleInitNode() const =0
ParticleAttrib< SingleParticlePos_t > ParticlePos_t
virtual void createWithID(unsigned id)=0
virtual ParticleBConds< Position_t, Dim > & getBConds()=0
virtual void destroy(size_t, size_t, bool=false)=0
virtual bool getUpdateFlag(UpdateFlags f) const =0
virtual Layout_t & getLayout()=0
virtual void resetID()=0
virtual void performDestroy(bool updateLocalNum=false)=0
virtual void ghostDestroy(size_t M, size_t I)=0
virtual void update(const ParticleAttrib< char > &canSwap)=0
virtual size_t getGhostNum() const =0
ParticleAttrib< Index_t > ParticleIndex_t
virtual size_t getDestroyNum() const =0
virtual void update()=0
unsigned Index_t