12#ifndef CD_TracerParticleImplem_H
13#define CD_TracerParticleImplem_H
17#include <CD_NamespaceHeader.H>
19template <
size_t M,
size_t N>
26 for (
auto&
s : this->m_scalars) {
30 for (
auto&
v : this->m_vectors) {
35template <
size_t M,
size_t N>
38 this->m_position =
a_other.m_position;
39 this->m_weight =
a_other.m_weight;
40 this->m_velocity =
a_other.m_velocity;
41 this->m_scalars =
a_other.m_scalars;
42 this->m_vectors =
a_other.m_vectors;
45template <
size_t M,
size_t N>
49template <
size_t M,
size_t N>
56template <
size_t M,
size_t N>
63template <
size_t M,
size_t N>
70template <
size_t M,
size_t N>
77template <
size_t M,
size_t N>
90template <
size_t M,
size_t N>
96 detail::pushParticleProperty(p, this->m_particleID);
97 detail::pushParticleProperty(p, this->m_rankID);
99 detail::pushParticleProperty(p, this->m_position[0]);
100 detail::pushParticleProperty(p, this->m_position[1]);
102 detail::pushParticleProperty(p, this->m_position[2]);
105 for (
size_t i = 0;
i <
M;
i++) {
106 detail::pushParticleProperty(p, this->m_scalars[
i]);
109 for (
size_t i = 0;
i <
M;
i++) {
110 detail::pushParticleProperty(p, this->m_vectors[
i][0]);
111 detail::pushParticleProperty(p, this->m_vectors[
i][1]);
113 detail::pushParticleProperty(p, this->m_vectors[
i][2]);
117 detail::pushParticleProperty(p, m_weight);
119 detail::pushParticleProperty(p, m_velocity[0]);
120 detail::pushParticleProperty(p, m_velocity[1]);
122 detail::pushParticleProperty(p, m_velocity[2]);
126template <
size_t M,
size_t N>
132 detail::pullParticleProperty(p, this->m_particleID);
133 detail::pullParticleProperty(p, this->m_rankID);
135 detail::pullParticleProperty(p, this->m_position[0]);
136 detail::pullParticleProperty(p, this->m_position[1]);
138 detail::pullParticleProperty(p, this->m_position[2]);
141 for (
size_t i = 0;
i <
M;
i++) {
142 detail::pullParticleProperty(p, this->m_scalars[
i]);
145 for (
size_t i = 0;
i <
M;
i++) {
146 detail::pullParticleProperty(p, this->m_vectors[
i][0]);
147 detail::pullParticleProperty(p, this->m_vectors[
i][1]);
149 detail::pullParticleProperty(p, this->m_vectors[
i][2]);
153 detail::pullParticleProperty(p, m_weight);
155 detail::pullParticleProperty(p, m_velocity[0]);
156 detail::pullParticleProperty(p, m_velocity[1]);
158 detail::pullParticleProperty(p, m_velocity[2]);
162template <
size_t M,
size_t N>
169 size +=
M *
sizeof(
Real);
171 size +=
sizeof(
Real);
177template <
size_t M,
size_t N>
183 detail::pushParticleProperty(p, this->m_position[0]);
184 detail::pushParticleProperty(p, this->m_position[1]);
186 detail::pushParticleProperty(p, this->m_position[2]);
189 for (
size_t i = 0;
i <
M;
i++) {
190 detail::pushParticleProperty(p, this->m_scalars[
i]);
193 for (
size_t i = 0;
i <
M;
i++) {
194 detail::pushParticleProperty(p, this->m_vectors[
i][0]);
195 detail::pushParticleProperty(p, this->m_vectors[
i][1]);
197 detail::pushParticleProperty(p, this->m_vectors[
i][2]);
201 detail::pushParticleProperty(p, m_weight);
203 detail::pushParticleProperty(p, m_velocity[0]);
204 detail::pushParticleProperty(p, m_velocity[1]);
206 detail::pushParticleProperty(p, m_velocity[2]);
210template <
size_t M,
size_t N>
216 detail::pullParticleProperty(p, this->m_position[0]);
217 detail::pullParticleProperty(p, this->m_position[1]);
219 detail::pullParticleProperty(p, this->m_position[2]);
222 for (
size_t i = 0;
i <
M;
i++) {
223 detail::pullParticleProperty(p, this->m_scalars[
i]);
226 for (
size_t i = 0;
i <
M;
i++) {
227 detail::pullParticleProperty(p, this->m_vectors[
i][0]);
228 detail::pullParticleProperty(p, this->m_vectors[
i][1]);
230 detail::pullParticleProperty(p, this->m_vectors[
i][2]);
234 detail::pullParticleProperty(p, m_weight);
236 detail::pullParticleProperty(p, m_velocity[0]);
237 detail::pullParticleProperty(p, m_velocity[1]);
239 detail::pullParticleProperty(p, m_velocity[2]);
243template <
size_t M,
size_t N>
251template <
size_t M,
size_t N>
259template <
size_t M,
size_t N>
267template <
size_t M,
size_t N>
275template <
size_t M,
size_t N>
279 ostr <<
"TracerParticle : \n";
282 ostr <<
"\tPosition = " << p.position() <<
"\n";
283 ostr <<
"\tWeight = " << p.weight() <<
"\n";
284 ostr <<
"\tVelocity = " << p.velocity() <<
"\n";
289#include <CD_NamespaceFooter.H>
std::ostream & operator<<(std::ostream &ostr, const TracerParticle< M, N > &p)
Particle printing function.
Definition CD_TracerParticleImplem.H:277
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:76
virtual int size() const
Returns the size, in number of bytes, of a flat representation of the data in this object.
Definition CD_GenericParticleImplem.H:195
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25
TracerParticle()
Default constructor – initializes everything to zero.
Definition CD_TracerParticleImplem.H:20
virtual void linearIn(const void *const a_buffer) override
Read a linear binary representation of the internal data. Assumes that the buffer has the correct dat...
Definition CD_TracerParticleImplem.H:128
virtual void H5linearOut(void *const a_buffer) const
Linearize the Real components onto a buffer workable by HDF5.
Definition CD_TracerParticleImplem.H:179
RealVect & vect()
Get one of the RealVects.
Definition CD_TracerParticleImplem.H:262
RealVect & velocity()
Get the particle velocity.
Definition CD_TracerParticleImplem.H:65
virtual int H5size() const
Function that is used when writing particles to HDF5.
Definition CD_TracerParticleImplem.H:164
virtual ~TracerParticle()
Destructor (deallocates runtime memory storage)
Definition CD_TracerParticleImplem.H:46
virtual void linearOut(void *const a_buffer) const override
Write a linear binary representation of the internal data. Assumes that sufficient memory for the buf...
Definition CD_TracerParticleImplem.H:92
virtual void H5linearIn(const void *const a_buffer)
Delinearize the buffer onto the real components in the particle class.
Definition CD_TracerParticleImplem.H:212
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 & real()
Get one of the scalars.
Definition CD_TracerParticleImplem.H:246
Real & weight()
Get the particle "weight".
Definition CD_TracerParticleImplem.H:51