12 #ifndef CD_TracerParticleImplem_H
13 #define CD_TracerParticleImplem_H
17 #include <CD_NamespaceHeader.H>
19 template <
size_t M,
size_t N>
22 this->m_position = RealVect::Zero;
24 this->m_velocity = RealVect::Zero;
26 for (
auto& s : this->m_scalars) {
30 for (
auto& v : this->m_vectors) {
35 template <
size_t M,
size_t N>
45 template <
size_t M,
size_t N>
49 template <
size_t M,
size_t N>
56 template <
size_t M,
size_t N>
63 template <
size_t M,
size_t N>
70 template <
size_t M,
size_t N>
71 inline const RealVect&
77 template <
size_t M,
size_t N>
84 template <
size_t M,
size_t N>
89 Real* buffer = (Real*) buf;
92 D_TERM(*buffer++ = this->m_position[0];,
93 *buffer++ = this->m_position[1];,
94 *buffer++ = this->m_position[2];);
97 for (
size_t i = 0; i < M; i++) {
98 *buffer++ = this->m_scalars[i];
102 for (
size_t i = 0; i < N; i++) {
103 const RealVect& v = this->m_vectors[i];
105 D_TERM(*buffer++ = v[0];, *buffer++ = v[1];, *buffer++ = v[2];);
109 D_TERM(*buffer++ = m_velocity[0];,
110 *buffer++ = m_velocity[1];,
111 *buffer++ = m_velocity[2];);
119 template <
size_t M,
size_t N>
125 Real* buffer = (Real*)buf;
127 D_TERM(this->m_position[0] = *buffer++;,
128 this->m_position[1] = *buffer++;,
129 this->m_position[2] = *buffer++;);
132 for (
size_t i = 0; i < M; i++) {
133 this->m_scalars[i] = *buffer++;
137 for (
size_t i = 0; i < N; i++) {
138 RealVect& v = this->m_vectors[i];
140 D_TERM(v[0] = *buffer++;,
146 D_TERM(m_velocity[0] = *buffer++;,
147 m_velocity[1] = *buffer++;,
148 m_velocity[2] = *buffer++;);
156 template <
size_t M,
size_t N>
160 ostr <<
"TracerParticle : \n";
163 ostr <<
"\tPosition = " << p.
position() <<
"\n";
164 ostr <<
"\tWeight = " << p.
weight() <<
"\n";
165 ostr <<
"\tVelocity = " << p.
velocity() <<
"\n";
170 #include <CD_NamespaceFooter.H>
std::ostream & operator<<(std::ostream &ostr, const TracerParticle< M, N > &p)
Particle printing function.
Definition: CD_TracerParticleImplem.H:158
Declaration of a tracer particle class.
A generic particle class, holding the position and a specified number of real and vector values.
Definition: CD_GenericParticle.H:33
RealVect & position()
Get the particle position.
Definition: CD_GenericParticleImplem.H:47
RealVect m_position
Particle position.
Definition: CD_GenericParticle.H:180
std::array< Real, M > m_scalars
Scalar storage array.
Definition: CD_GenericParticle.H:185
std::array< RealVect, N > m_vectors
vector storage array
Definition: CD_GenericParticle.H:190
A tracer particle class. This is templated for holding extra storage (useful for kernels).
Definition: CD_TracerParticle.H:33
TracerParticle()
Default constructor – initializes everything to zero.
Definition: CD_TracerParticleImplem.H:20
RealVect m_velocity
Particle velocity.
Definition: CD_TracerParticle.H:109
RealVect & velocity()
Get the particle velocity.
Definition: CD_TracerParticleImplem.H:65
virtual void linearOut(void *a_buffer) const override
Write a linear binary representation of the internal data. Assumes that sufficient memory for the buf...
Definition: CD_TracerParticleImplem.H:86
virtual ~TracerParticle()
Destructor (deallocates runtime memory storage)
Definition: CD_TracerParticleImplem.H:46
Real m_weight
Particle "weight".
Definition: CD_TracerParticle.H:104
virtual void linearIn(void *a_buffer) override
Read a linear binary representation of the internal data. Assumes that the buffer has the correct dat...
Definition: CD_TracerParticleImplem.H:121
virtual int size() const override
Returns the size, in number of bytes, of a flat representation of the data in this object.
Definition: CD_TracerParticleImplem.H:79
Real & weight()
Get the particle "weight".
Definition: CD_TracerParticleImplem.H:51