Egglib 2.1.11
C++ library reference manual
ChangeTypes.hpp
1 /*
2  Copyright 2009-2010 Stéphane De Mita, Mathieu Siol
3 
4  This file is part of the EggLib library.
5 
6  EggLib is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  EggLib is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with EggLib. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef EGGLIB_CHANGETYPES_HPP
21 #define EGGLIB_CHANGETYPES_HPP
22 
23 #include "ParamSet.hpp"
24 #include "Controller.hpp"
25 
26 namespace egglib {
27 
28 /**********************************************************************/
29 
35  class Change {
36  public:
37 
43  Change();
44 
50  Change(double date);
51 
53  double date() const;
54 
56  void date(double value);
57 
66  virtual void apply(ParamSet* paramSet, Controller* controller) const = 0;
67 
68  protected:
69  double _date;
70 
71  };
72 
73 /**********************************************************************/
74 
80  class SingleParamChange : public Change {
81  public:
82 
89 
96  SingleParamChange(double date, double value);
97 
99  double value() const;
100 
102  void value(double value);
103 
104  protected:
105  double _value;
106 
107  };
108 
109 /**********************************************************************/
110 
117  public:
118 
126 
134  PopulationParamChange(double date, unsigned int population, double value);
135 
137  unsigned int population() const;
138 
140  void population(unsigned int value);
141 
142  protected:
143 
144  unsigned int _population;
145 
146  };
147 
148 
149 /**********************************************************************/
150 
161  class Bottleneck : public SingleParamChange {
162  public:
163  Bottleneck(double date, double param) : SingleParamChange(date, param) {}
164  void apply(ParamSet* paramSet, Controller* controller) const;
165  };
166 
167 /**********************************************************************/
168 
175  public:
176  PopulationBottleneck(double date, unsigned int population, double value) : PopulationParamChange(date, population, value) {}
177  void apply(ParamSet* paramSet, Controller* controller) const;
178  };
179 
180 
181 /**********************************************************************/
182 
191  public:
192  AllPopulationSizeChange(double date, double value) : SingleParamChange(date, value) {}
193  void apply(ParamSet* paramSet, Controller* controller) const;
194  };
195 
196 
197 /**********************************************************************/
198 
205  public:
206  SinglePopulationSizeChange(double date, unsigned int population, double value) : PopulationParamChange(date, population, value) {}
207  void apply(ParamSet* paramSet, Controller* controller) const;
208  };
209 
210 
211 
212 /**********************************************************************/
213 
222  public:
223  GrowthRateChange(double date, double value) : SingleParamChange(date, value) {}
224  void apply(ParamSet* paramSet, Controller* controller) const;
225  };
226 
227 
228 /**********************************************************************/
229 
236  public:
237  PopulationGrowthRateChange(double date, unsigned int population, double value) : PopulationParamChange(date, population, value) {}
238  void apply(ParamSet* paramSet, Controller* controller) const;
239  };
240 
241 /**********************************************************************/
242 
251  public:
252  SelfingRateChange(double date, double value) : SingleParamChange(date, value) {}
253  void apply(ParamSet* paramSet, Controller* controller) const;
254  };
255 
256 /**********************************************************************/
257 
263  class PopulationFusion : public Change {
264  public:
272 
285  PopulationFusion(double date, unsigned int mother, unsigned int daughter);
286 
287  void apply(ParamSet* paramSet, Controller* controller) const;
288 
290  void daughter(unsigned int);
291 
293  unsigned int daughter() const;
294 
296  void mother(unsigned int);
297 
299  unsigned int mother() const;
300 
301  protected:
302  unsigned int _mother;
303  unsigned int _daughter;
304  };
305 
306 
307 /**********************************************************************/
308 
314  class PopulationSplit : public Change {
315  public:
322  PopulationSplit();
323 
344  PopulationSplit(double date, unsigned int pop, double proba);
345 
346  void apply(ParamSet* paramSet, Controller* controller) const;
347 
349  unsigned int population() const;
350 
352  void population(unsigned int);
353 
355  double probability() const;
356 
358  void probability(double);
359 
360  protected:
361  unsigned int _population;
362  double _probability;
363  };
364 
365 /**********************************************************************/
366 
375  public:
376  AllMigrationRateChange(double date, double value) : SingleParamChange(date, value) {}
377  void apply(ParamSet* paramSet, Controller* controller) const;
378  };
379 
380 /**********************************************************************/
381 
388  public:
397 
406  SingleMigrationRateChange(double date, unsigned int source, unsigned int dest, double migr);
407 
409  unsigned source() const;
410 
412  void source(unsigned int);
413 
415  unsigned dest() const;
416 
418  void dest(unsigned int);
419 
420  void apply(ParamSet* paramSet, Controller* controller) const;
421 
422  protected:
423  unsigned int _source;
424  unsigned int _dest;
425  };
426 }
427 
428 #endif
unsigned source() const
Gets the source population index.
Definition: ChangeTypes.cpp:264
Bottleneck event.
Definition: ChangeTypes.hpp:161
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:89
Split of a population.
Definition: ChangeTypes.hpp:314
Change()
Default constructor.
Definition: ChangeTypes.cpp:31
Fusion of two populations.
Definition: ChangeTypes.hpp:263
PopulationFusion()
Default constructor.
Definition: ChangeTypes.cpp:158
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:116
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:125
Change of a single population size.
Definition: ChangeTypes.hpp:204
double value() const
Gets the parameter value.
Definition: ChangeTypes.cpp:60
PopulationParamChange()
Default constructor.
Definition: ChangeTypes.cpp:70
unsigned int mother() const
Gets the mother population.
Definition: ChangeTypes.cpp:180
SingleParamChange()
Default constructor.
Definition: ChangeTypes.cpp:52
unsigned int population() const
Gets the population index.
Definition: ChangeTypes.cpp:78
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:98
SingleMigrationRateChange()
Default constructor.
Definition: ChangeTypes.cpp:254
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:138
unsigned int daughter() const
Gets the daughter population.
Definition: ChangeTypes.cpp:172
PopulationSplit()
Default constructor.
Definition: ChangeTypes.cpp:204
Change of the size of all populations.
Definition: ChangeTypes.hpp:190
unsigned dest() const
Gets the dest population index.
Definition: ChangeTypes.cpp:272
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:106
Controls a coalescent simulation.
Definition: Controller.hpp:39
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:230
Change of a single migration rate.
Definition: ChangeTypes.hpp:387
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:184
Pure virtual base class for parameter changes.
Definition: ChangeTypes.hpp:35
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:244
unsigned int population() const
Gets the population index.
Definition: ChangeTypes.cpp:214
Change of the migration rate of all population pairs.
Definition: ChangeTypes.hpp:374
Definition: ABC.cpp:37
Single parameter changes applied to a single population.
Definition: ChangeTypes.hpp:116
Set of parameters.
Definition: ParamSet.hpp:38
Change of the selfing rate.
Definition: ChangeTypes.hpp:250
Population-specific bottleneck event.
Definition: ChangeTypes.hpp:174
Change of the growth rate of all populations.
Definition: ChangeTypes.hpp:221
virtual void apply(ParamSet *paramSet, Controller *controller) const =0
Applies the event.
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:280
Pure virtual base class for single parameter changes.
Definition: ChangeTypes.hpp:80
double date() const
Gets the event date value.
Definition: ChangeTypes.cpp:40
void apply(ParamSet *paramSet, Controller *controller) const
Applies the event.
Definition: ChangeTypes.cpp:150
Change of a single population's growth rate.
Definition: ChangeTypes.hpp:235
double probability() const
Gets the probability of instant migration.
Definition: ChangeTypes.cpp:222

Hosted by 
Get EggLib at SourceForge.net. Fast, secure and Free Open Source software downloads