OpenLB 1.7
Loading...
Searching...
No Matches
elParticle3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2016 Thomas Henn, Davide Dapelo
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24#ifndef EL_PARTICLE_3D_HH
25#define EL_PARTICLE_3D_HH
26
27#include <string>
28#include <iostream>
29#include <set>
30#include <vector>
31#include <list>
32#include <deque>
33
34#include "elParticle3D.h"
35
36namespace olb {
37
38
39template<typename T>
41 : Particle3D<T>(),
42 _charge(1.)
43{ }
44
45template<typename T>
46ElParticle3D<T>::ElParticle3D(std::vector<T> pos, T mas, T rad, T charge)
47 : Particle3D<T>(pos, mas, rad),
48 _charge(charge)
49{ }
50
51template<typename T>
52ElParticle3D<T>::ElParticle3D(std::vector<T> pos, std::vector<T> vel, T mas,
53 T rad, T charge)
54 : Particle3D<T>(pos, vel, mas, rad),
55 _charge(charge)
56{
57}
58
59template<typename T>
61 : Particle3D<T>(p),
62 _charge(p._charge)
63{ }
64
65template<typename T>
67{
68 serial[0] = this->_pos[0];
69 serial[1] = this->_pos[1];
70 serial[2] = this->_pos[2];
71 serial[3] = this->_vel[0];
72 serial[4] = this->_vel[1];
73 serial[5] = this->_vel[2];
74 serial[6] = this->_rad;
75 serial[7] = this->_mas;
76 serial[8] = (double) this->_active;
77 serial[9] = _charge;
78}
79
80template<typename T>
82{
83 this->_pos[0] = data[0];
84 this->_pos[1] = data[1];
85 this->_pos[2] = data[2];
86 this->_vel[0] = data[3];
87 this->_vel[1] = data[4];
88 this->_vel[2] = data[5];
89 this->_rad = data[6];
90 this->_mas = data[7];
91 this->_active = (bool) data[8];
92 _charge = data[9];
93}
94
95
96}
97
98#endif
virtual void unserialize(T *)
virtual void serialize(T serial[])
Top level namespace for all of OpenLB.