source: src/base/particle.hpp@ 64ba929

Last change on this file since 64ba929 was dfed1c, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.7 KB
Line 
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
15namespace VMG
16{
17
18namespace Particle
19{
20
21class Particle
22{
23public:
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
51 Vector& Pos() {return x_;}
52 const Vector& Pos() const {return x_;}
53
54 vmg_float& Charge() {return q_;}
55 const vmg_float& Charge() const {return q_;}
56
57 vmg_float& Pot() {return p_;}
58 const vmg_float& Pot() const {return p_;}
59
60 Vector& Force() {return f_;}
61 const Vector& Force() const {return f_;}
62
63 int& Rank() {return rank_;}
64 const int& Rank() const {return rank_;}
65
66 vmg_int& Index() {return index_;}
67 const vmg_int& Index() const {return index_;}
68
69 bool operator==(const Particle& rhs)
70 {
71 return (this->rank_ == rhs.rank_) && (this->index_ == rhs.index_);
72 }
73
74 bool operator!=(const Particle& rhs)
75 {
76 return (this->rank_ != rhs.rank_) || (this->index_ != rhs.index_);
77 }
78
79private:
80 Vector x_, f_;
81 vmg_float q_, p_;
82 int rank_;
83 vmg_int index_;
84};
85
86}
87
88}
89
90#endif /* PARTICLE_HPP_ */
Note: See TracBrowser for help on using the repository browser.