13#ifndef CD_GENERICPARTICLEIMPLEM_H
14#define CD_GENERICPARTICLEIMPLEM_H
18#include <CD_NamespaceHeader.H>
20template <
size_t M,
size_t N>
32template <
size_t M,
size_t N>
35 this->m_position =
a_other.m_position;
36 this->m_scalars =
a_other.m_scalars;
37 this->m_vectors =
a_other.m_vectors;
40template <
size_t M,
size_t N>
43template <
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>
85template <
size_t M,
size_t N>
92template <
size_t M,
size_t N>
99template <
size_t M,
size_t N>
106template <
size_t M,
size_t N>
113template <
size_t M,
size_t N>
121template <
size_t M,
size_t N>
129template <
size_t M,
size_t N>
137template <
size_t M,
size_t N>
145template <
size_t M,
size_t N>
149 return (this->m_position ==
a_p.m_position &&
this->m_scalars ==
a_p.m_scalars &&
this->m_vectors ==
a_p.m_vectors);
152template <
size_t M,
size_t N>
159template <
size_t M,
size_t N>
189template <
size_t M,
size_t N>
199 size +=
M *
sizeof(
Real);
205template <
size_t M,
size_t N>
211 detail::pushParticleProperty(p, m_particleID);
212 detail::pushParticleProperty(p, m_rankID);
214 detail::pushParticleProperty(p, m_position[0]);
215 detail::pushParticleProperty(p, m_position[1]);
217 detail::pushParticleProperty(p, m_position[2]);
220 for (
size_t i = 0;
i <
M;
i++) {
221 detail::pushParticleProperty(p, m_scalars[
i]);
224 for (
size_t i = 0;
i <
N;
i++) {
225 detail::pushParticleProperty(p, m_vectors[
i][0]);
226 detail::pushParticleProperty(p, m_vectors[
i][1]);
228 detail::pushParticleProperty(p, m_vectors[
i][2]);
233template <
size_t M,
size_t N>
239 detail::pullParticleProperty(p, m_particleID);
240 detail::pullParticleProperty(p, m_rankID);
242 detail::pullParticleProperty(p, m_position[0]);
243 detail::pullParticleProperty(p, m_position[1]);
245 detail::pullParticleProperty(p, m_position[2]);
248 for (
size_t i = 0;
i <
M;
i++) {
249 detail::pullParticleProperty(p, m_scalars[
i]);
252 for (
size_t i = 0;
i <
N;
i++) {
253 detail::pullParticleProperty(p, m_vectors[
i][0]);
254 detail::pullParticleProperty(p, m_vectors[
i][1]);
256 detail::pullParticleProperty(p, m_vectors[
i][2]);
261template <
size_t M,
size_t N>
268 size +=
M *
sizeof(
Real);
274template <
size_t M,
size_t N>
280 detail::pushParticleProperty(p, m_position[0]);
281 detail::pushParticleProperty(p, m_position[1]);
283 detail::pushParticleProperty(p, m_position[2]);
286 for (
size_t i = 0;
i <
M;
i++) {
287 detail::pushParticleProperty(p, m_scalars[
i]);
290 for (
size_t i = 0;
i <
N;
i++) {
291 detail::pushParticleProperty(p, m_vectors[
i][0]);
292 detail::pushParticleProperty(p, m_vectors[
i][1]);
294 detail::pushParticleProperty(p, m_vectors[
i][2]);
299template <
size_t M,
size_t N>
305 detail::pullParticleProperty(p, m_position[0]);
306 detail::pullParticleProperty(p, m_position[1]);
308 detail::pullParticleProperty(p, m_position[2]);
311 for (
size_t i = 0;
i <
M;
i++) {
312 detail::pullParticleProperty(p, m_scalars[
i]);
315 for (
size_t i = 0;
i <
N;
i++) {
316 detail::pullParticleProperty(p, m_vectors[
i][0]);
317 detail::pullParticleProperty(p, m_vectors[
i][1]);
319 detail::pullParticleProperty(p, m_vectors[
i][2]);
324template <
size_t M,
size_t N>
328 ostr <<
"GenericParticle : \n";
331 ostr <<
"\tPosition = " << p.position() <<
"\n";
336#include <CD_NamespaceFooter.H>
std::ostream & operator<<(std::ostream &ostr, const GenericParticle< M, N > &p)
Particle printing function.
Definition CD_GenericParticleImplem.H:326
Declaration of a generic particle class.
virtual void linearOut(void *a_buffer) const
Write a linear binary representation of the internal data. Assumes that sufficient memory for the buf...
Definition CD_GenericParticleImplem.H:207
virtual ~GenericParticle()
Destructor (deallocates runtime memory storage)
const int32_t & particleID() const noexcept
Get the particle ID.
Definition CD_GenericParticleImplem.H:59
virtual int H5size() const
Function that is used when writing particles to HDF5.
Definition CD_GenericParticleImplem.H:263
RealVect & position()
Get the particle position.
Definition CD_GenericParticleImplem.H:45
bool operator!=(const GenericParticle< M, N > &a_p) const
Comparison operator with other particle.
Definition CD_GenericParticleImplem.H:154
Real & real()
Get one of the scalars.
Definition CD_GenericParticleImplem.H:116
const std::array< Real, M > & getReals() const noexcept
Get the M scalars.
Definition CD_GenericParticleImplem.H:87
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
virtual void H5linearOut(void *a_buffer) const
Linearize the Real components onto a buffer workable by HDF5.
Definition CD_GenericParticleImplem.H:276
bool operator==(const GenericParticle< M, N > &a_p) const
Comparison operator with other particle.
Definition CD_GenericParticleImplem.H:147
RealVect & vect()
Get one of the RealVects.
Definition CD_GenericParticleImplem.H:132
const int32_t & rankID() const noexcept
Get the MPI rank ID.
Definition CD_GenericParticleImplem.H:73
virtual void linearIn(const void *a_buffer)
Read a linear binary representation of the internal data. Assumes that the buffer has the correct dat...
Definition CD_GenericParticleImplem.H:235
virtual void H5linearIn(const void *a_buffer)
Delinearize the buffer onto the real components in the particle class.
Definition CD_GenericParticleImplem.H:301
bool operator<(const GenericParticle< M, N > &a_other) const noexcept
Particle comparison operator. Returns lexicographical ordering.
Definition CD_GenericParticleImplem.H:161
GenericParticle()
Default constructor – initializes everything to zero.
Definition CD_GenericParticleImplem.H:21
std::array< Real, M > m_scalars
Scalar storage array.
Definition CD_GenericParticle.H:299
std::array< RealVect, N > m_vectors
vector storage array
Definition CD_GenericParticle.H:304
const std::array< RealVect, N > & getVects() const noexcept
Get the N vectors.
Definition CD_GenericParticleImplem.H:101
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