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

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

vmg: Added license files and headers (GPLv3).

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

  • Property mode set to 100644
File size: 2.6 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(const vmg_float* x, const vmg_float& q) :
43 x_(x),
44 f_(0.0),
45 q_(q),
46 p_(0.0),
47 rank_(-1),
48 index_(-1)
49 {}
50
51 Particle(const vmg_float* x, const vmg_float& q, const vmg_float& p, const vmg_float* f, const int& rank, const vmg_int& index) :
52 x_(x),
53 f_(f),
54 q_(q),
55 p_(p),
56 rank_(rank),
57 index_(index)
58 {}
59
60 Particle(const Vector& x, const vmg_float& q, const vmg_float& p, const Vector& 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 Particle& other) :
70 x_(other.x_),
71 f_(other.f_),
72 q_(other.q_),
73 p_(other.p_),
74 rank_(other.rank_),
75 index_(other.index_)
76 {}
77
78 Vector& Pos() {return x_;}
79 const Vector& Pos() const {return x_;}
80
81 vmg_float& Charge() {return q_;}
82 const vmg_float& Charge() const {return q_;}
83
84 vmg_float& Pot() {return p_;}
85 const vmg_float& Pot() const {return p_;}
86
87 Vector& Field() {return f_;}
88 const Vector& Field() const {return f_;}
89
90 int& Rank() {return rank_;}
91 const int& Rank() const {return rank_;}
92
93 vmg_int& Index() {return index_;}
94 const vmg_int& Index() const {return index_;}
95
96 bool operator==(const Particle& rhs)
97 {
98 return (this->rank_ == rhs.rank_) && (this->index_ == rhs.index_);
99 }
100
101 bool operator!=(const Particle& rhs)
102 {
103 return (this->rank_ != rhs.rank_) || (this->index_ != rhs.index_);
104 }
105
106private:
107 Vector x_, f_;
108 vmg_float q_, p_;
109 int rank_;
110 vmg_int index_;
111};
112
113}
114
115}
116
117#endif /* PARTICLE_HPP_ */
Note: See TracBrowser for help on using the repository browser.