13#ifndef CD_TRACERPARTICLEIMPLEM_H
14#define CD_TRACERPARTICLEIMPLEM_H
18#include <CD_NamespaceHeader.H>
20template <
size_t M,
size_t N>
27 for (
auto&
s : this->m_scalars) {
31 for (
auto&
v : this->m_vectors) {
36template <
size_t M,
size_t N>
39 this->m_position =
a_other.m_position;
40 this->m_weight =
a_other.m_weight;
41 this->m_velocity =
a_other.m_velocity;
42 this->m_scalars =
a_other.m_scalars;
43 this->m_vectors =
a_other.m_vectors;
46template <
size_t M,
size_t N>
50template <
size_t M,
size_t N>
57template <
size_t M,
size_t N>
64template <
size_t M,
size_t N>
71template <
size_t M,
size_t N>
78template <
size_t M,
size_t N>
91template <
size_t M,
size_t N>
97 detail::pushParticleProperty(p, this->m_particleID);
98 detail::pushParticleProperty(p, this->m_rankID);
100 detail::pushParticleProperty(p, this->m_position[0]);
101 detail::pushParticleProperty(p, this->m_position[1]);
103 detail::pushParticleProperty(p, this->m_position[2]);
106 for (
size_t i = 0;
i <
M;
i++) {
107 detail::pushParticleProperty(p, this->m_scalars[
i]);
110 for (
size_t i = 0;
i <
N;
i++) {
111 detail::pushParticleProperty(p, this->m_vectors[
i][0]);
112 detail::pushParticleProperty(p, this->m_vectors[
i][1]);
114 detail::pushParticleProperty(p, this->m_vectors[
i][2]);
118 detail::pushParticleProperty(p, m_weight);
120 detail::pushParticleProperty(p, m_velocity[0]);
121 detail::pushParticleProperty(p, m_velocity[1]);
123 detail::pushParticleProperty(p, m_velocity[2]);
127template <
size_t M,
size_t N>
133 detail::pullParticleProperty(p, this->m_particleID);
134 detail::pullParticleProperty(p, this->m_rankID);
136 detail::pullParticleProperty(p, this->m_position[0]);
137 detail::pullParticleProperty(p, this->m_position[1]);
139 detail::pullParticleProperty(p, this->m_position[2]);
142 for (
size_t i = 0;
i <
M;
i++) {
143 detail::pullParticleProperty(p, this->m_scalars[
i]);
146 for (
size_t i = 0;
i <
N;
i++) {
147 detail::pullParticleProperty(p, this->m_vectors[
i][0]);
148 detail::pullParticleProperty(p, this->m_vectors[
i][1]);
150 detail::pullParticleProperty(p, this->m_vectors[
i][2]);
154 detail::pullParticleProperty(p, m_weight);
156 detail::pullParticleProperty(p, m_velocity[0]);
157 detail::pullParticleProperty(p, m_velocity[1]);
159 detail::pullParticleProperty(p, m_velocity[2]);
163template <
size_t M,
size_t N>
170 size +=
M *
sizeof(
Real);
172 size +=
sizeof(
Real);
178template <
size_t M,
size_t N>
184 detail::pushParticleProperty(p, this->m_position[0]);
185 detail::pushParticleProperty(p, this->m_position[1]);
187 detail::pushParticleProperty(p, this->m_position[2]);
190 for (
size_t i = 0;
i <
M;
i++) {
191 detail::pushParticleProperty(p, this->m_scalars[
i]);
194 for (
size_t i = 0;
i <
N;
i++) {
195 detail::pushParticleProperty(p, this->m_vectors[
i][0]);
196 detail::pushParticleProperty(p, this->m_vectors[
i][1]);
198 detail::pushParticleProperty(p, this->m_vectors[
i][2]);
202 detail::pushParticleProperty(p, m_weight);
204 detail::pushParticleProperty(p, m_velocity[0]);
205 detail::pushParticleProperty(p, m_velocity[1]);
207 detail::pushParticleProperty(p, m_velocity[2]);
211template <
size_t M,
size_t N>
217 detail::pullParticleProperty(p, this->m_position[0]);
218 detail::pullParticleProperty(p, this->m_position[1]);
220 detail::pullParticleProperty(p, this->m_position[2]);
223 for (
size_t i = 0;
i <
M;
i++) {
224 detail::pullParticleProperty(p, this->m_scalars[
i]);
227 for (
size_t i = 0;
i <
N;
i++) {
228 detail::pullParticleProperty(p, this->m_vectors[
i][0]);
229 detail::pullParticleProperty(p, this->m_vectors[
i][1]);
231 detail::pullParticleProperty(p, this->m_vectors[
i][2]);
235 detail::pullParticleProperty(p, m_weight);
237 detail::pullParticleProperty(p, m_velocity[0]);
238 detail::pullParticleProperty(p, m_velocity[1]);
240 detail::pullParticleProperty(p, m_velocity[2]);
244template <
size_t M,
size_t N>
252template <
size_t M,
size_t N>
260template <
size_t M,
size_t N>
268template <
size_t M,
size_t N>
276template <
size_t M,
size_t N>
280 ostr <<
"TracerParticle : \n";
283 ostr <<
"\tPosition = " << p.position() <<
"\n";
284 ostr <<
"\tWeight = " << p.weight() <<
"\n";
285 ostr <<
"\tVelocity = " << p.velocity() <<
"\n";
290#include <CD_NamespaceFooter.H>
std::ostream & operator<<(std::ostream &ostr, const TracerParticle< M, N > &p)
Particle printing function.
Definition CD_TracerParticleImplem.H:278
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:77
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:191
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26
TracerParticle()
Default constructor – initializes everything to zero.
Definition CD_TracerParticleImplem.H:21
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:129
virtual void H5linearOut(void *const a_buffer) const
Linearize the Real components onto a buffer workable by HDF5.
Definition CD_TracerParticleImplem.H:180
RealVect & vect()
Get one of the RealVects.
Definition CD_TracerParticleImplem.H:263
RealVect & velocity()
Get the particle velocity.
Definition CD_TracerParticleImplem.H:66
virtual int H5size() const
Function that is used when writing particles to HDF5.
Definition CD_TracerParticleImplem.H:165
virtual ~TracerParticle()
Destructor (deallocates runtime memory storage)
Definition CD_TracerParticleImplem.H:47
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:93
virtual void H5linearIn(const void *const a_buffer)
Delinearize the buffer onto the real components in the particle class.
Definition CD_TracerParticleImplem.H:213
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:80
Real & real()
Get one of the scalars.
Definition CD_TracerParticleImplem.H:247
Real & weight()
Get the particle "weight".
Definition CD_TracerParticleImplem.H:52