source: src/units/particle/particle.hpp@ bd61b5c

Last change on this file since bd61b5c was a72216, checked in by Olaf Lenz <olenz@…>, 13 years ago

Fixed permissions.

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

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * vmg - a versatile multigrid solver
3 * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn
4 *
5 * vmg is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * vmg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * @file particle.hpp
21 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
22 * @date Sat Sep 17 14:45:56 2011
23 *
24 * @brief Class to represent a particle
25 *
26 */
27
28#ifndef PARTICLE_HPP_
29#define PARTICLE_HPP_
30
31#include "base/vector.hpp"
32
33namespace VMG
34{
35
36namespace Particle
37{
38
39class Particle
40{
41public:
42 Particle() :
43 x_(0.0),
44 f_(0.0),
45 q_(0.0),
46 p_(0.0),
47 rank_(-1),
48 index_(-1)
49 {}
50
51 Particle(const vmg_float* x, const vmg_float& q) :
52 x_(x),
53 f_(0.0),
54 q_(q),
55 p_(0.0),
56 rank_(-1),
57 index_(-1)
58 {}
59
60 Particle(const vmg_float* x, const vmg_float& q, const vmg_float& p, const vmg_float* f, const int& rank, const vmg_int& index) :
61 x_(x),
62 f_(f),
63 q_(q),
64 p_(p),
65 rank_(rank),
66 index_(index)
67 {}
68
69 Particle(const Vector& x, const vmg_float& q, const vmg_float& p, const Vector& f, const int& rank, const vmg_int& index) :
70 x_(x),
71 f_(f),
72 q_(q),
73 p_(p),
74 rank_(rank),
75 index_(index)
76 {}
77
78 Particle(const Particle& other) :
79 x_(other.x_),
80 f_(other.f_),
81 q_(other.q_),
82 p_(other.p_),
83 rank_(other.rank_),
84 index_(other.index_)
85 {}
86
87 Vector& Pos() {return x_;}
88 const Vector& Pos() const {return x_;}
89
90 vmg_float& Charge() {return q_;}
91 const vmg_float& Charge() const {return q_;}
92
93 vmg_float& Pot() {return p_;}
94 const vmg_float& Pot() const {return p_;}
95
96 Vector& Field() {return f_;}
97 const Vector& Field() const {return f_;}
98
99 int& Rank() {return rank_;}
100 const int& Rank() const {return rank_;}
101
102 vmg_int& Index() {return index_;}
103 const vmg_int& Index() const {return index_;}
104
105 bool operator==(const Particle& rhs)
106 {
107 return (this->rank_ == rhs.rank_) && (this->index_ == rhs.index_);
108 }
109
110 bool operator!=(const Particle& rhs)
111 {
112 return (this->rank_ != rhs.rank_) || (this->index_ != rhs.index_);
113 }
114
115private:
116 Vector x_, f_;
117 vmg_float q_, p_;
118 int rank_;
119 vmg_int index_;
120};
121
122}
123
124}
125
126#endif /* PARTICLE_HPP_ */
Note: See TracBrowser for help on using the repository browser.