group_particles
Loading...
Searching...
No Matches
callback_utils_prt_modify.hpp
Go to the documentation of this file.
1
6#ifndef CALLBACK_UTILS_PRT_MODIFY_HPP
7#define CALLBACK_UTILS_PRT_MODIFY_HPP
8
9#include "callback.hpp"
10
11namespace CallbackUtils {
12
15namespace prt_modify {
16
17
24 template<typename AFields, typename VField, bool sqrta>
25 class PrtRSD :
26 virtual public Callback<AFields>
27 {
29 bool do_it;
30 coord_t rsd_factor;
31 size_t rsd_direction;
32
33 public :
34 PrtRSD () = delete;
35
43 PrtRSD (char rsd_direction_, double Omega_m, double z) {
44 if (rsd_direction_ == 'n') {
45 do_it = false;
46 return;
47 }
48 else
49 do_it = true;
50 rsd_direction = rsd_direction_ - 'x';
51 rsd_factor = (1.0+z)
52 / ( 100.0 * std::sqrt( Omega_m*std::pow(1+z, 3) + (1.0-Omega_m) ) );
53 if constexpr (sqrta) rsd_factor /= std::sqrt(1.0+z);
54 }
55
56 void prt_modify (PrtProperties &prt) override final {
57 if (!do_it) return;
58 const auto v = prt.template get<VField>()[rsd_direction];
59 auto x = prt.coord()[rsd_direction];
60 x += rsd_factor * v;
61 // make sure periodicity still respected
62 if (x > prt.Bsize) x -= prt.Bsize;
63 else if (x < 0) x += prt.Bsize;
64 prt.coord()[rsd_direction] = x;
65 }
66 };
67}
68
69}
70
71
72
73#endif // CALLBACK_UTILS_PRT_MODIFY_HPP
74
Contains the abstract base class that the user should subclass from in order to define the desired fu...
Implement RSD shifting of particle positions along a coordinate.
Definition callback_utils_prt_modify.hpp:27
PrtRSD(char rsd_direction_, double Omega_m, double z)
Constructor.
Definition callback_utils_prt_modify.hpp:43
float coord_t
Internal coordinate type.
Definition fields.hpp:28
contains classes that implement parts of the Callback base.
Definition callback_utils.hpp:35
Specialization of the Callback::BaseProperties type to particles.
Definition callback.hpp:95
The abstract base class the user should inherit from.
Definition callback.hpp:32