chombo-discharge
CD_NonCommParticleImplem.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2022 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_NonCommParticleImplem_H
13 #define CD_NonCommParticleImplem_H
14 
15 // Our includes
16 #include <CD_NonCommParticle.H>
17 #include <CD_NamespaceHeader.H>
18 
19 template <size_t M, size_t N>
21 {
22  for (auto& s : m_scalars) {
23  s = 0.0;
24  }
25 
26  for (auto& v : m_vectors) {
27  v = RealVect::Zero;
28  }
29 }
30 
31 template <size_t M, size_t N>
33 {
34  this->m_scalars = a_other.m_scalars;
35  this->m_vectors = a_other.m_vectors;
36 }
37 
38 template <size_t M, size_t N>
40 {}
41 
42 template <size_t M, size_t N>
43 template <size_t K>
44 inline Real&
46 {
47  return std::get<K>(m_scalars);
48 }
49 
50 template <size_t M, size_t N>
51 template <size_t K>
52 inline const Real&
54 {
55  return std::get<K>(m_scalars);
56 }
57 
58 template <size_t M, size_t N>
59 template <size_t K>
60 inline RealVect&
62 {
63  return std::get<K>(m_vectors);
64 }
65 
66 template <size_t M, size_t N>
67 template <size_t K>
68 inline const RealVect&
70 {
71  return std::get<K>(m_vectors);
72 }
73 
74 template <size_t M, size_t N>
75 inline bool
77 {
78  return (m_scalars = a_other.m_scalars) && (m_vectors == a_other.m_vectors);
79 }
80 
81 template <size_t M, size_t N>
82 inline bool
84 {
85  return !(*this == a_other);
86 }
87 
88 #include <CD_NamespaceFooter.H>
89 
90 #endif
Declaration of a generic particle class.
A generic non-communicated particle class.
Definition: CD_NonCommParticle.H:32
std::array< Real, M > m_scalars
Scalar storage array.
Definition: CD_NonCommParticle.H:110
bool operator!=(const NonCommParticle< M, N > &a_other) const
Comparison operator with other particle.
Definition: CD_NonCommParticleImplem.H:83
RealVect & vect()
Get one of the RealVects.
Definition: CD_NonCommParticleImplem.H:61
NonCommParticle()
Default constructor – initializes everything to zero.
Definition: CD_NonCommParticleImplem.H:20
bool operator==(const NonCommParticle< M, N > &a_other) const
Comparison operator with other particle.
Definition: CD_NonCommParticleImplem.H:76
std::array< RealVect, N > m_vectors
vector storage array
Definition: CD_NonCommParticle.H:115
virtual ~NonCommParticle()
Destructor (deallocates runtime memory storage)
Definition: CD_NonCommParticleImplem.H:39
Real & real()
Get one of the scalars.
Definition: CD_NonCommParticleImplem.H:45