Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
core_mesh.h
Go to the documentation of this file.
1 
9 #pragma once
10 #include "stdafx.h"
11 #include "params.hpp"
12 #include "precision.hpp"
13 #include "class_mesh.hpp"
14 #include "class_particles.hpp"
15 #include "class_vec_3d.hpp"
16 
17 void get_k_vec(size_t N, size_t index, int* k_vec);
18 void get_k_vec(size_t N, size_t index, Vec_3D<int> &k_vec);
19 FTYPE_t get_k_sq(size_t N, size_t index);
20 
21 template<typename T> void get_per(Vec_3D<T> &position, size_t per);
22 template<typename T> void get_per(Vec_3D<T> &position, size_t perx, size_t pery, size_t perz);
23 void get_per(std::vector<Particle_v<FTYPE_t>>& particles, const size_t per);
24 
25 FTYPE_t get_distance(const Vec_3D<FTYPE_t> &x_1, const Vec_3D<FTYPE_t> &x_2, size_t per);
26 Vec_3D<FTYPE_t> get_sgn_distance(const Vec_3D<FTYPE_t> &x_from, const Vec_3D<FTYPE_t> &x_to, size_t per);
27 
28 void assign_to(Mesh& field, const Vec_3D<FTYPE_t> &position, const FTYPE_t value);
29 void assign_to(std::vector<Mesh>& field, const Vec_3D<FTYPE_t> &position, const Vec_3D<FTYPE_t>& value);
30 void assign_from(const Mesh &field, const Vec_3D<FTYPE_t> &position, FTYPE_t& value, FTYPE_t mod = 1);
31 void assign_from(const std::vector<Mesh> &field, const Vec_3D<FTYPE_t> &position, Vec_3D<FTYPE_t>& value, FTYPE_t mod = 1);
32 
39 void fftw_execute_dft_r2c(const FFTW_PLAN_TYPE &p_F, Mesh& rho);
40 
47 void fftw_execute_dft_c2r(const FFTW_PLAN_TYPE &p_B, Mesh& rho);
48 
55 void fftw_execute_dft_r2c_triple(const FFTW_PLAN_TYPE &p_F, std::vector<Mesh>& rho);
56 
63 void fftw_execute_dft_c2r_triple(const FFTW_PLAN_TYPE &p_B, std::vector<Mesh>& rho);
64 
65 template<unsigned int points>
66 class IT
67 {
68 public:
69  IT(const Vec_3D<FTYPE_t> &pos); // ctor for assignment scheme
70  IT(const Vec_3D<FTYPE_t> &pos, FTYPE_t Hc); // ctor for chaining mesh
71 
72  size_t counter;
74 
75  bool iter();
76 };
77 
void assign_to(Mesh &field, const Vec_3D< double > &position, const double value)
Definition: core_mesh.cpp:201
void get_k_vec(size_t N, size_t index, int *k_vec)
Definition: core_mesh.cpp:20
double get_k_sq(size_t N, size_t index)
Definition: core_mesh.cpp:38
Vec_3D< double > get_sgn_distance(const Vec_3D< double > &x_from, const Vec_3D< double > &x_to, size_t per)
Definition: core_mesh.cpp:122
define container Vec_3D
class handling particles (position only)
void fftw_execute_dft_c2r_triple(const FFTW_PLAN_TYPE &p_B, std::vector< Mesh > &rho)
compute three backward (complex to real) FFTs on vector of meshes (inplace)
Definition: core_mesh.cpp:263
void assign_from(const Mesh &field, const Vec_3D< double > &position, double &value, double mod=1)
Definition: core_mesh.cpp:224
bool iter()
Definition: core_mesh.cpp:187
: creates a mesh of N*N*(N+2) cells
Definition: class_mesh.hpp:95
: class for effective iteration of cube of mesh cells
Definition: core_mesh.h:66
define container Particle (with and without velocity)
void fftw_execute_dft_c2r(const FFTW_PLAN_TYPE &p_B, Mesh &rho)
compute backward (complex to real) FFT on mesh (inplace)
Definition: core_mesh.cpp:253
system include files and for project-specific include files that are used frequently but are changed ...
void fftw_execute_dft_r2c(const FFTW_PLAN_TYPE &p_F, Mesh &rho)
compute forward (real to complex) FFT on mesh (inplace)
Definition: core_mesh.cpp:247
void get_per(Vec_3D< T > &position, size_t per)
Definition: core_mesh.cpp:66
double get_distance(const Vec_3D< double > &x_1, const Vec_3D< double > &x_2, size_t per)
void fftw_execute_dft_r2c_triple(const FFTW_PLAN_TYPE &p_F, std::vector< Mesh > &rho)
compute three forward (real to complex) FFTs on vector of meshes (inplace)
Definition: core_mesh.cpp:258
various simulation parameters
#define FFTW_PLAN_TYPE
Definition: precision.hpp:26
single / double / long double definitions
size_t counter
Definition: core_mesh.h:72
: class handling basic 3D-vector functions, definitions
auto value(T const &val) -> Generator< T >
Definition: catch.hpp:3177
IT(const Vec_3D< double > &pos)
Definition: core_mesh.cpp:171
Vec_3D< size_t > vec
Definition: core_mesh.h:73
define container Mesh