-
Notifications
You must be signed in to change notification settings - Fork 0
/
jaan_habitat.cpp
89 lines (78 loc) · 2.5 KB
/
jaan_habitat.cpp
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
#include "jaan_habitat.h"
Habitat::Habitat(
double init_optimal_pref,
double init_optimal_qual,
double init_optimal_trait,
double init_selection_on_pref,
double init_selection_on_qual,
double init_selection_on_trt,
double init_expr_efficiency):
optimal_preference(init_optimal_pref),
optimal_quality(init_optimal_qual),
optimal_trait(init_optimal_trait),
selection_on_pref(init_selection_on_pref),
selection_on_qual(init_selection_on_qual),
selection_on_trt(init_selection_on_trt),
expr_efficiency(init_expr_efficiency)
{
}
Habitat::Habitat(const Habitat& other):
optimal_preference(other.get_optimal_preference()),
optimal_quality(other.get_optimal_quality()),
optimal_trait(other.get_optimal_trait()),
selection_on_pref(other.get_selection_on_pref()),
selection_on_qual(other.get_selection_on_qual()),
selection_on_trt(other.get_selection_on_trt()),
expr_efficiency(other.get_expr_efficiency())
{
}
double Habitat::get_optimal_preference() const
{
return optimal_preference;
}
double Habitat::get_optimal_quality() const
{
return optimal_quality;
}
double Habitat::get_optimal_trait() const
{
return optimal_trait;
}
double Habitat::get_selection_on_pref() const
{
return selection_on_pref;
}
double Habitat::get_selection_on_qual() const
{
return selection_on_qual;
}
double Habitat::get_selection_on_trt() const
{
return selection_on_trt;
}
double Habitat::get_expr_efficiency() const
{
return expr_efficiency;
}
/// Prints the parameters of the simulation to the output file.
void Habitat::print_habitat(std::ofstream& output) const
{
output << "optimal_preference," << optimal_preference
<< "\noptimal_quality," << optimal_quality
<< "\noptimal_trait," << optimal_trait
<< "\nselection_on_pref," << selection_on_pref
<< "\nselection_on_quality," << selection_on_qual
<< "\nselection_on_trt," << selection_on_trt
<< "\nexpr_efficiency," << expr_efficiency<< std::endl;
}
Habitat& Habitat::operator=(Habitat other)
{
std::swap(optimal_preference, other.optimal_preference);
std::swap(optimal_quality, other.optimal_quality);
std::swap(optimal_trait, other.optimal_trait);
std::swap(selection_on_pref, other.selection_on_trt);
std::swap(selection_on_qual, other.selection_on_qual);
std::swap(selection_on_trt, other.selection_on_trt);
std::swap(expr_efficiency, other.expr_efficiency);
return *this;
}