FML
Loading...
Searching...
No Matches
SimpleParticle.h
Go to the documentation of this file.
1#ifndef SIMPLEPARTICLE_HEADER
2#define SIMPLEPARTICLE_HEADER
3#include <cstring>
4
5/// Example of a simple particle with all the methods needed to be used with MPIParticles
6/// Some algorithms might require more field like get_vol, id etc.
7/// The types used below can be changed (automatically inferred by algorithms)
8template <int NDIM>
10
11 /// Position of particle in [0,1)^NDIM
12 double Pos[NDIM];
13 /// Velocity of particle (in whatever units you want)
14 double Vel[NDIM];
15
16 /// Get the dimension of the position
17 constexpr int get_ndim() const { return NDIM; }
18 /// Get a pointer to the position of the particle
19 double * get_pos() { return Pos; }
20 /// Get a pointer to the velocity of the particle
21 double * get_vel() { return Vel; }
22};
23
24/// Example of a particle for COLA N-body simulations
25/// that is compatible with the make IC and N-body methods
26/// If you only want 1LPT then simply remove all 2LPT stuff below
27/// The types used below can be changed (automatically inferred by algorithms)
28template <int NDIM>
30
31 /// Position
32 double Pos[NDIM];
33 /// Lagrangian Position
34 double q[NDIM];
35 /// Velocity
36 double Vel[NDIM];
37 /// 1LPT displacement vector
38 double D_1LPT[NDIM];
39 /// 2LPT displacement vector
40 double D_2LPT[NDIM];
41 /// 3LPTa displacement vector
42 double D_3LPTa[NDIM];
43 /// 3LPTb displacement vector
44 double D_3LPTb[NDIM];
45 /// ID of the particle
46 long long int id;
47
48 /// Get the ID of the particle
49 long long int get_id() const { return id; }
50 /// Set the ID of the particle
51 void set_id(long long int _id) { id = _id; }
52 /// Get the dimension of the position
53 constexpr int get_ndim() const { return NDIM; }
54 /// Get a pointer to the position of the particle
55 double * get_pos() { return Pos; }
56 /// Get a pointer to the velocity of the particle
57 double * get_vel() { return Vel; }
58 /// Get a pointer to the Lagrangian position of the particle
59 double * get_q() { return q; }
60 /// Get a pointer to the initial 1LPT displacement field at the particles initial position
61 double * get_D_1LPT() { return D_1LPT; }
62 /// Get a pointer to the initial 2LPT displacement field at the particles initial position
63 double * get_D_2LPT() { return D_2LPT; }
64 /// Get a pointer to the initial 3LPTa displacement field at the particles initial position
65 double * get_D_3LPTa() { return D_3LPTa; }
66 /// Get a pointer to the initial 3LPTb displacement field at the particles initial position
67 double * get_D_3LPTb() { return D_3LPTb; }
68};
69
70#endif
const int NDIM
Example of a particle for COLA N-body simulations that is compatible with the make IC and N-body meth...
void set_id(long long int _id)
Set the ID of the particle.
double * get_vel()
Get a pointer to the velocity of the particle.
double Vel[NDIM]
Velocity.
double D_3LPTa[NDIM]
3LPTa displacement vector
double * get_D_3LPTa()
Get a pointer to the initial 3LPTa displacement field at the particles initial position.
double * get_D_2LPT()
Get a pointer to the initial 2LPT displacement field at the particles initial position.
double D_1LPT[NDIM]
1LPT displacement vector
long long int id
ID of the particle.
double * get_D_3LPTb()
Get a pointer to the initial 3LPTb displacement field at the particles initial position.
double * get_pos()
Get a pointer to the position of the particle.
double D_2LPT[NDIM]
2LPT displacement vector
double Pos[NDIM]
Position.
double * get_D_1LPT()
Get a pointer to the initial 1LPT displacement field at the particles initial position.
double q[NDIM]
Lagrangian Position.
constexpr int get_ndim() const
Get the dimension of the position.
long long int get_id() const
Get the ID of the particle.
double * get_q()
Get a pointer to the Lagrangian position of the particle.
double D_3LPTb[NDIM]
3LPTb displacement vector
Example of a simple particle with all the methods needed to be used with MPIParticles Some algorithms...
double Pos[NDIM]
Position of particle in [0,1)^NDIM.
constexpr int get_ndim() const
Get the dimension of the position.
double * get_pos()
Get a pointer to the position of the particle.
double Vel[NDIM]
Velocity of particle (in whatever units you want)
double * get_vel()
Get a pointer to the velocity of the particle.