AlmaBTE  1.3
A solver of the space- and time-dependent Boltzmann transport equation for phonons
deviational_particle.hpp
Go to the documentation of this file.
1 // Copyright 2015-2018 The ALMA Project Developers
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 // implied. See the License for the specific language governing
13 // permissions and limitations under the License.
14 
15 #pragma once
16 
20 
21 #include <algorithm>
22 #include <Eigen/Dense>
23 
24 namespace alma {
26 enum class particle_sign { minus = -1, plus = 1 };
27 
32 template <typename T> inline particle_sign get_particle_sign(const T& value) {
33  if (value >= 0)
34  return particle_sign::plus;
35  else
36  return particle_sign::minus;
37 }
38 
39 
42 class D_particle {
43 public:
45  Eigen::VectorXd pos;
47  std::size_t q;
49  std::size_t alpha;
53  double t;
55  D_particle(const Eigen::VectorXd& _pos,
56  std::size_t _q,
57  std::size_t _alpha,
58  particle_sign _sign,
59  double _t)
60  : pos(std::move(_pos)), q(_q), alpha(_alpha), sign(_sign), t(_t) {
61  }
62 
63 
65  D_particle(const D_particle& original)
66  : pos(original.pos), q(original.q), alpha(original.alpha),
67  sign(original.sign), t(original.t) {
68  }
69 
70 
75  friend void swap(D_particle& a, D_particle& b) {
76  a.pos.swap(b.pos);
77  std::swap(a.q, b.q);
78  std::swap(a.alpha, b.alpha);
79  std::swap(a.sign, b.sign);
80  std::swap(a.t, b.t);
81  }
82 
83 
86  swap(*this, original);
87  return *this;
88  }
89 };
90 } // namespace alma
Definition: analytic1d.hpp:26
D_particle(const D_particle &original)
Copy constructor.
Definition: deviational_particle.hpp:65
STL namespace.
particle_sign get_particle_sign(const T &value)
Convenience function for obtaining a particle_sign.
Definition: deviational_particle.hpp:32
std::size_t q
q point index in some regular grid.
Definition: deviational_particle.hpp:47
Each object of this class represents a deviational particle in the simulation.
Definition: deviational_particle.hpp:42
Eigen::VectorXd pos
Cartesian coordinates of the particle [nm].
Definition: deviational_particle.hpp:45
D_particle & operator=(D_particle original)
Assignment operator (copy and swap).
Definition: deviational_particle.hpp:85
particle_sign sign
Sign of the particle.
Definition: deviational_particle.hpp:51
D_particle(const Eigen::VectorXd &_pos, std::size_t _q, std::size_t _alpha, particle_sign _sign, double _t)
Basic constructor.
Definition: deviational_particle.hpp:55
std::size_t alpha
Mode index.
Definition: deviational_particle.hpp:49
friend void swap(D_particle &a, D_particle &b)
Swap the data from two objects.
Definition: deviational_particle.hpp:75
particle_sign
Simple enum representing a sign.
Definition: deviational_particle.hpp:26
double t
Current time.
Definition: deviational_particle.hpp:53