GLAMERDOC++
Gravitational Lensing Code Library
Loading...
Searching...
No Matches
gaussian.h
1//
2// guassian.hpp
3// NR
4//
5// Created by Ben Metcalf on 17/04/2018.
6//
7
8#ifndef guassian_hpp
9#define guassian_hpp
10
11#include <stdio.h>
12#include <complex>
13#include <fstream>
14#include <vector>
15//#include "slsimlib.h"
16#include "utilities_slsim.h"
17#include <functional>
18#include <valarray>
19
20#include "fftw3.h"
21
22class GaussianField{
23public:
24 GaussianField(size_t Nx,size_t Ny):
25 Nx(Nx),Ny(Ny)
26 {
27 kappak.resize(Nx*(Ny/2+1));
28 std::vector<double> image(Nx*Ny);
29
30 pbackward = fftw_plan_dft_c2r_2d(Nx,Ny
31 ,reinterpret_cast<fftw_complex*>(kappak.data())
32 ,image.data(), FFTW_ESTIMATE);
33 }
34
35 ~GaussianField(){
36 fftw_destroy_plan(pbackward);
37 }
38 void GaussianField2D(double *image,std::function<double(double,double)> PofK,
39 double boxlrad,Utilities::RandomNumbers_NR &ran);
40
41 void GaussianField2D(std::vector<double> &image,std::function<double(double,double)> PofK,
42 double boxlrad,Utilities::RandomNumbers_NR &ran);
43
44 void GaussianField2D(std::valarray<double> &image,std::function<double(double,double)> PofK,
45 double boxlrad,Utilities::RandomNumbers_NR &ran);
46
47
48private:
49 std::vector<std::complex<double> > kappak;
50 fftw_plan pbackward;
51 size_t Nx;
52 size_t Ny;
53};
54
59void index_to_k_2d(size_t k
60 ,double &kx
61 ,double &ky
62 ,size_t Nx
63 ,size_t Ny
64 );
65
66void GaussianField2D(double *image,std::function<double(double,double)> PofK,
67 double boxlrad,int Nx,int Ny,Utilities::RandomNumbers_NR &ran);
68
69
70#endif /* guassian_hpp */
This is a class for generating random numbers. It simplifies and fool proofs initialization and allow...
Definition utilities_slsim.h:1059