forked from gfrd/egfrd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnalyticalSingle.hpp
109 lines (90 loc) · 3.1 KB
/
AnalyticalSingle.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef ANALYTICAL_SINGLE_HPP
#define ANALYTICAL_SINGLE_HPP
#include "Single.hpp"
template<typename Ttraits_, typename Tshell_>
class AnalyticalSingle: public Single<Ttraits_>
{
public:
typedef Single<Ttraits_> base_type;
typedef Ttraits_ traits_type;
typedef typename traits_type::world_type::length_type length_type;
typedef typename traits_type::world_type::position_type position_type;
typedef typename traits_type::world_type::particle_id_pair particle_id_pair;
typedef typename traits_type::domain_id_type identifier_type;
typedef typename traits_type::shell_id_type shell_id_type;
typedef typename traits_type::network_rules_type network_rules_type;
typedef Tshell_ shell_type;
typedef std::pair<const shell_id_type, shell_type> shell_id_pair;
typedef typename network_rules_type::reaction_rule_vector reaction_rule_vector;
typedef typename traits_type::rate_type rate_type;
public:
virtual ~AnalyticalSingle() {}
AnalyticalSingle(identifier_type const& id,
particle_id_pair const& particle,
shell_id_pair const& shell)
: base_type(id, particle), shell_(shell) {}
shell_id_pair const& shell() const
{
return shell_;
}
shell_id_pair& shell()
{
return shell_;
}
length_type mobility_radius() const
{
return shape_size(shape(shell_.second)) - base_type::particle().second.radius();
}
virtual char const* type_name() const
{
return retrieve_domain_type_name(*this);
}
virtual position_type const& position() const
{
return shape_position(shape(shell_.second));
}
virtual position_type& position()
{
return shape_position(shape(shell_.second));
}
virtual length_type const& size() const
{
return shape_size(shape(shell_.second));
}
virtual length_type& size()
{
return shape_size(shape(shell_.second));
}
virtual typename Domain<traits_type>::size_type num_shells() const
{
return 1;
}
virtual typename Domain<traits_type>::size_type multiplicity() const
{
return 1;
}
virtual void accept(ImmutativeDomainVisitor<traits_type> const& visitor) const
{
visitor(*this);
}
virtual void accept(MutativeDomainVisitor<traits_type> const& visitor)
{
visitor(*this);
}
virtual std::string as_string() const
{
return (boost::format(
"%s(id=%s, event=%s, last_time=%.16g, dt=%.16g, particle=(%s:%s), shell=(%d:%s))") %
type_name() %
boost::lexical_cast<std::string>(base_type::id_) %
boost::lexical_cast<std::string>(base_type::event_.first) %
base_type::last_time_ % base_type::dt_ %
boost::lexical_cast<std::string>(base_type::particle().first) %
boost::lexical_cast<std::string>(base_type::particle().second) %
boost::lexical_cast<std::string>(shell_.first) %
boost::lexical_cast<std::string>(shell_.second)).str();
}
protected:
shell_id_pair shell_;
};
#endif /* ANALYTICAL_SINGLE_HPP */