CosmoGRaPH v0.0
particles.h
1 #ifndef COSMO_PARTICLES
2 #define COSMO_PARTICLES
3 
4 #include "../../cosmo_types.h"
5 #include "../../cosmo_includes.h"
6 #include "particles_data.h"
7 #include "../bssn/bssn.h"
8 
9 namespace cosmo
10 {
11 
18 class Particles
19 {
20  // list of particle registers
21  particle_vec * particles;
22 
23 public:
24 
25  Particles();
26  ~Particles();
27 
28  void init(idx_t n_particles);
29  void addParticle(Particle<real_t> particle);
30 
31  particle_vec * getParticleVec();
32 
33  real_t getFractionalIndex(real_t x);
34  idx_t getIndexBelow(real_t x);
35  idx_t getNearestIndex(real_t x);
36  void setX_d(real_t X[3], real_t x_d[3]);
37 
39  ParticleMetricPrimitives<real_t> corner_pp_in[2][2][2], real_t x_d[3]);
40 
42  ParticleMetricPrimitives<real_t> corner_pp_in[2][2][2], real_t x_d[3]);
43 
44  real_t linearInterpolation(
45  real_t C000, real_t C001, real_t C010, real_t C011, /* values at "C"orners, C_{x,y,z} */
46  real_t C100, real_t C101, real_t C110, real_t C111, /* "binary" order */
47  real_t x_d[3] /* normalized position within cube */
48  );
49 
51  Particle<real_t> * p, map_t & bssn_fields);
52 
54  Particle<real_t> * p, map_t & bssn_fields);
55 
56  void RKStep(ParticleRegister<real_t> * pr, real_t h, real_t RK_sum_coeff,
57  map_t & bssn_fields);
58 
59  void RK1Step(map_t & bssn_fields);
60  void RK2Step(map_t & bssn_fields);
61  void RK3Step(map_t & bssn_fields);
62  void RK4Step(map_t & bssn_fields);
63 
64  void stepInit(map_t & bssn_fields);
65  void regSwap_c_a();
66  void stepTerm();
67 
68  real_t getKernelWeight(real_t r, real_t r_s);
69  void addParticlesToBSSNSrc(BSSN * bssnSim);
70  void addParticleToBSSNSrc(Particle<real_t> * p_c, map_t & bssn_fields);
71 };
72 
73 }
74 
75 #endif
ParticleMetricPrimitives< real_t > interpolatePrimitivesFromCornersIncomplete(ParticleMetricPrimitives< real_t > corner_pp_in[2][2][2], real_t x_d[3])
Only set some metric components.
Definition: particles.cc:179
ParticleMetricPrimitives< real_t > getInterpolatedPrimitives(Particle< real_t > *p, map_t &bssn_fields)
Interpolate metric primitives required for geodesic integration.
Definition: particles.cc:278
real_t getFractionalIndex(real_t x)
Compute non-integer index at a point.
Definition: particles.cc:86
Data structure containing 4 needed RK4 registers.
Definition: particles_data.h:28
void RKStep(ParticleRegister< real_t > *pr, real_t h, real_t RK_sum_coeff, map_t &bssn_fields)
Implementation for evaluating a single RK step.
Definition: particles.cc:404
Definition: bardeen.cc:5
idx_t getIndexBelow(real_t x)
Returns the index "below" a point (floor of getFractionalIndex)
Definition: particles.cc:96
idx_t getNearestIndex(real_t x)
Returns the index nearest a point (rounds getFractionalIndex)
Definition: particles.cc:104
ParticleMetricPrimitives< real_t > getInterpolatedPrimitivesIncomplete(Particle< real_t > *p, map_t &bssn_fields)
Interpolate some metric primitives required for geodesic integration.
Definition: particles.cc:222
Class for evolving non-interacting matter particles.
Definition: particles.h:18
Data structure for storing metric quantities ("primitives") at an arbitrary point.
Definition: particles_data.h:48
void setX_d(real_t X[3], real_t x_d[3])
Sets a fractional distance between grid points.
Definition: particles.cc:120
BSSN Class: evolves BSSN metric fields, computes derived quantities.
Definition: bssn.h:24
Data structure for particles.
Definition: particles_data.h:14
void addParticle(Particle< real_t > particle)
Add an individual particle.
Definition: particles.cc:72
void addParticlesToBSSNSrc(BSSN *bssnSim)
Definition: particles.cc:540
void init(idx_t n_particles)
Create random particles.
Definition: particles.cc:33
ParticleMetricPrimitives< real_t > interpolatePrimitivesFromCorners(ParticleMetricPrimitives< real_t > corner_pp_in[2][2][2], real_t x_d[3])
Linearly interpolate metric quantities from corners of a "box".
Definition: particles.cc:140