PFASST++
particle.hpp
Go to the documentation of this file.
1 
5 #ifndef _EXAMPLES__BORIS__PARTICLE_HPP_
6 #define _EXAMPLES__BORIS__PARTICLE_HPP_
7 
8 #include <memory>
9 #include <vector>
10 using namespace std;
11 
12 #include <pfasst/logging.hpp>
13 
14 
15 namespace pfasst
16 {
17  namespace examples
18  {
19  namespace boris
20  {
24  template<
25  typename precision
26  >
27  using ParticleComponent = vector<precision>;
28 
32  template<typename T>
33  inline el::base::type::ostream_t& operator<<(el::base::type::ostream_t& os, const vector<T>& vec);
34 
35 
39  template<
40  typename precision
41  >
42  class Particle
43  : public el::Loggable
44  {
45  protected:
46  size_t _dim;
47  precision _charge;
48  precision _mass;
51 
52  public:
53  explicit Particle(const size_t dim = 3);
54  Particle(const size_t dim, const precision charge, const precision mass);
55  virtual ~Particle();
56 
57  inline size_t dim() const;
59  const ParticleComponent<precision>& pos() const;
61  const ParticleComponent<precision>& vel() const;
62  const precision charge() const;
63  const precision mass() const;
64  const precision alpha() const;
65 
66  void set_charge(const precision& charge);
67  void set_mass(const precision& mass);
68 
69  virtual void log(el::base::type::ostream_t& os) const;
70  };
71 
72 
76  template<typename precision>
77  inline el::base::type::ostream_t& operator<<(el::base::type::ostream_t& os,
78  const shared_ptr<Particle<precision>>& sp_particle);
79  } // ::pfasst::examples::boris
80  } // ::pfasst::examples
81 } // ::pfasst
82 
83 // #include "particle_util.hpp"
84 #include "particle_impl.hpp"
85 
86 #endif // _EXAMPLES__BORIS__PARTICLE_HPP_
el::base::type::ostream_t & operator<<(el::base::type::ostream_t &os, const shared_ptr< Particle< precision >> &sp_particle)
STL namespace.
ParticleComponent< precision > _pos
Definition: particle.hpp:49
vector< precision > ParticleComponent
Definition: particle.hpp:27
ParticleComponent< precision > _vel
Definition: particle.hpp:50