-
Notifications
You must be signed in to change notification settings - Fork 0
/
GreensFunction2DAbs.hpp
92 lines (73 loc) · 2.43 KB
/
GreensFunction2DAbs.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef GREENS_FUNCTION_2D_ABS_HPP
#define GREENS_FUNCTION_2D_ABS_HPP
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include "Defs.hpp"
namespace greens_functions
{
class GreensFunction2DAbs
{
public:
GreensFunction2DAbs(const Real D, const Real r0, const Real a);
virtual ~GreensFunction2DAbs();
const Real drawTime(const Real rnd) const;
const Real drawR(const Real rnd, const Real t) const;
const Real drawTheta(const Real rnd, const Real r, const Real t) const;
const Real p_survival(const Real t) const;
const Real p_int_r(const Real r, const Real t) const;
const Real p_int_theta(const Real r, const Real theta, const Real t) const;
const Real p_int_2pi(const Real r, const Real t) const;
const Real getD() const {return this->D;}
const Real geta() const {return this->a;}
const Real getr0() const {return this->r0;}
const std::string dump() const;
const char* getName() const
{
return "GreensFunction2DAbs";
}
private:
const Real p_int_theta_first(const Real r,
const Real theta,
const Real t) const;
const Real p_int_theta_second(const Real r,
const Real theta,
const Real t) const;
private:
struct p_survival_params
{
const GreensFunction2DAbs* const gf;
const Real rnd;
};
struct p_r_params
{
const GreensFunction2DAbs* const gf;
const Real t;
const Real target;
/* when time = t, probability of existence is p_surv(t). *
* to seek the r, the random value that satisfy the equation *
* must be in [0, p_surv). the value, rnd * p_surv(t) is target. */
};
struct p_theta_params
{
const GreensFunction2DAbs* const gf;
const Real t;
const Real r;
const Real rnd;
};
static const Real p_survival_F(const Real t,
const p_survival_params* params);
static const Real p_r_F(const Real r,
const p_r_params* params);
static const Real p_theta_F(const Real theta,
const p_theta_params* params);
private:
static const Real CUTOFF;//1e-10, provisionally.
Real D;
Real a;
Real r0;
};
}//greens_functions
#endif//GREENS_FUNCTION_2D_ABS