| [dfed1c] | 1 | /**
|
|---|
| 2 | * @file particle.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Sat Sep 17 14:45:56 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Class to represent a particle
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | #ifndef PARTICLE_HPP_
|
|---|
| 11 | #define PARTICLE_HPP_
|
|---|
| 12 |
|
|---|
| 13 | #include "base/vector.hpp"
|
|---|
| 14 |
|
|---|
| 15 | namespace VMG
|
|---|
| 16 | {
|
|---|
| 17 |
|
|---|
| 18 | namespace Particle
|
|---|
| 19 | {
|
|---|
| 20 |
|
|---|
| 21 | class Particle
|
|---|
| 22 | {
|
|---|
| 23 | public:
|
|---|
| 24 | Particle(const vmg_float* x, const vmg_float& q) :
|
|---|
| 25 | x_(x),
|
|---|
| 26 | f_(0.0),
|
|---|
| 27 | q_(q),
|
|---|
| 28 | p_(0.0),
|
|---|
| 29 | rank_(-1),
|
|---|
| 30 | index_(-1)
|
|---|
| 31 | {}
|
|---|
| 32 |
|
|---|
| 33 | Particle(const vmg_float* x, const vmg_float& q, const vmg_float& p, const vmg_float* f, const int& rank, const vmg_int& index) :
|
|---|
| 34 | x_(x),
|
|---|
| 35 | f_(f),
|
|---|
| 36 | q_(q),
|
|---|
| 37 | p_(p),
|
|---|
| 38 | rank_(rank),
|
|---|
| 39 | index_(index)
|
|---|
| 40 | {}
|
|---|
| 41 |
|
|---|
| 42 | Particle(const Vector& x, const vmg_float& q, const vmg_float& p, const Vector& f, const int& rank, const vmg_int& index) :
|
|---|
| 43 | x_(x),
|
|---|
| 44 | f_(f),
|
|---|
| 45 | q_(q),
|
|---|
| 46 | p_(p),
|
|---|
| 47 | rank_(rank),
|
|---|
| 48 | index_(index)
|
|---|
| 49 | {}
|
|---|
| 50 |
|
|---|
| [ac6d04] | 51 | Particle(const Particle& other) :
|
|---|
| 52 | x_(other.x_),
|
|---|
| 53 | f_(other.f_),
|
|---|
| 54 | q_(other.q_),
|
|---|
| 55 | p_(other.p_),
|
|---|
| 56 | rank_(other.rank_),
|
|---|
| 57 | index_(other.index_)
|
|---|
| 58 | {}
|
|---|
| 59 |
|
|---|
| [dfed1c] | 60 | Vector& Pos() {return x_;}
|
|---|
| 61 | const Vector& Pos() const {return x_;}
|
|---|
| 62 |
|
|---|
| 63 | vmg_float& Charge() {return q_;}
|
|---|
| 64 | const vmg_float& Charge() const {return q_;}
|
|---|
| 65 |
|
|---|
| 66 | vmg_float& Pot() {return p_;}
|
|---|
| 67 | const vmg_float& Pot() const {return p_;}
|
|---|
| 68 |
|
|---|
| [716da7] | 69 | Vector& Field() {return f_;}
|
|---|
| 70 | const Vector& Field() const {return f_;}
|
|---|
| [dfed1c] | 71 |
|
|---|
| 72 | int& Rank() {return rank_;}
|
|---|
| 73 | const int& Rank() const {return rank_;}
|
|---|
| 74 |
|
|---|
| 75 | vmg_int& Index() {return index_;}
|
|---|
| 76 | const vmg_int& Index() const {return index_;}
|
|---|
| 77 |
|
|---|
| 78 | bool operator==(const Particle& rhs)
|
|---|
| 79 | {
|
|---|
| 80 | return (this->rank_ == rhs.rank_) && (this->index_ == rhs.index_);
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | bool operator!=(const Particle& rhs)
|
|---|
| 84 | {
|
|---|
| 85 | return (this->rank_ != rhs.rank_) || (this->index_ != rhs.index_);
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | private:
|
|---|
| 89 | Vector x_, f_;
|
|---|
| 90 | vmg_float q_, p_;
|
|---|
| 91 | int rank_;
|
|---|
| 92 | vmg_int index_;
|
|---|
| 93 | };
|
|---|
| 94 |
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | #endif /* PARTICLE_HPP_ */
|
|---|