Randomly removes individuals from the patches according to the extinction rate parameter.
More...
Randomly removes individuals from the patches according to the extinction rate parameter.
Sets the patches extinction flag accordingly.
void LCE_Patch_Extinction::execute |
( |
| ) |
|
|
virtual |
Implements LifeCycleEvent.
285{
286#ifdef _DEBUG_
287 message(
"LCE_Patch_Extinction::execute ");
288 unsigned int cnt = 0;
289#endif
292
294
301
307 }
308#ifdef _DEBUG_
310#endif
311 }
312#ifdef _DEBUG_
313 message(
"(%i extinct patches)\n",cnt);
314#endif
315}
void do_remove(age_idx AGE, Patch *patch)
Definition: LCEmisc.cc:328
void do_flush(Patch *patch)
Definition: LCEmisc.cc:319
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:430
unsigned int get_K()
Definition: metapop.h:479
bool get_isExtinct()
Definition: metapop.h:484
void message(const char *message,...)
Definition: output.cc:40
#define ALL
All ages age class flag.
Definition: types.h:56
@ OFFSx
Definition: types.h:42
@ ADLTx
Definition: types.h:42
References _by_proportion, _by_size, _extinction_threshold, LifeCycleEvent::_popPtr, _Xtion_rate, ADLTx, ALL, do_flush(), do_remove(), TMatrix::get(), Patch::get_isExtinct(), Patch::get_K(), Metapop::getPatch(), Metapop::getPatchNbr(), message(), OFFSx, Patch::size(), and RAND::Uniform().
bool LCE_Patch_Extinction::set_matrix_param |
( |
TMatrix * |
mat, |
|
|
string |
name |
|
) |
| |
256{
257 double value;
259
261
263
265 error(
"The \"%s\" matrix must be a one-dimensional array.\n", name.c_str());
266 return false;
267 }
268
270 error(
"The length of the \"%s\" array must be equal to the number of patches.\n", name.c_str());
271 return false;
272 }
273
274 } else {
278 }
279 return true;
280}
This structure stores one parameter, its definition and its string argument.
Definition: param.h:54
double getValue()
Returns the argument value according to its type.
Definition: param.cc:347
bool isMatrix()
Checks if the argument is of matrix type.
Definition: param.h:172
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:357
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
void reset(unsigned int rows, unsigned int cols)
Re-allocate the existing matrix with assigned rows and cols dimensions.
Definition: tmatrix.h:116
void assign(double val)
Assigns a value to all element of the matrix.
Definition: tmatrix.h:110
unsigned int getNbRows()
Gives the number of rows.
Definition: tmatrix.h:166
unsigned int getNbCols()
Gives the number of columns.
Definition: tmatrix.h:169
int error(const char *str,...)
Definition: output.cc:77
References LifeCycleEvent::_popPtr, TMatrix::assign(), error(), SimComponent::get_parameter(), Param::getMatrix(), TMatrix::getNbCols(), TMatrix::getNbRows(), Metapop::getPatchNbr(), Param::getValue(), Param::isMatrix(), and TMatrix::reset().
Referenced by setParameters().
bool LCE_Patch_Extinction::setParameters |
( |
| ) |
|
|
virtual |
Implements SimComponent.
151{
152
154
156
158
159 } else {
162 }
163
165
167
169
171
172 } else {
176 }
177
180
182
184
185 } else {
189 }
190
192
194 error(
"Please give one of the following parameter: \"extinction_rate\", \"extinction_size\", or \"extinction_proportion\".\n");
195 return false;
196 }
198 warning(
"Both \"extinction_size\" and \"extinction_proportion\" are set, using sizes only.\n");
200 }
201
203
205 error(
"\"extinction_size_distribution\" is set but the \"extinction_size\" parameter is not!\n");
206 return false;
207 }
208
212
214
216
218
220
222
224
226 error(
"Standard deviation of the normal distribution for the harvesting size distribution is missing!\n");
227 return false;
228 }
229
231
233
235 error(
"Standard deviation of the lognormal distribution for the harvesting size distribution is missing!\n");
236 return false;
237 }
238
240
242
243 else {
244 error(
"Distribution \"%s\" is not a valid option for \"harvest_size_distribution\"\n",
246 return false;
247 }
248
249 }
250 return true;
251}
unsigned int rand_exp(double mean)
Definition: LCEmisc.h:127
unsigned int rand_lognormal(double mean)
Definition: LCEmisc.h:128
unsigned int rand_uniform(double max)
Definition: LCEmisc.h:124
string _harvest_distribution
Name of the distribution to use.
Definition: LCEmisc.h:112
unsigned int rand_poisson(double mean)
Definition: LCEmisc.h:125
bool set_matrix_param(TMatrix *mat, string name)
Definition: LCEmisc.cc:255
unsigned int rand_gaussian(double mean)
Definition: LCEmisc.h:126
string getArg(string name)
Accessor to the parameters argument string.
Definition: param.h:300
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
void warning(const char *str,...)
Definition: output.cc:58
References _by_proportion, _by_size, _extinction_threshold, _harvest_dist_stdev, _harvest_distribution, _harvest_proportion, _harvest_size, _harvest_size_varies, SimComponent::_paramSet, _rand_size_fct, _Xtion_rate, error(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), ParamSet::getArg(), rand_exp(), rand_gaussian(), rand_lognormal(), rand_poisson(), rand_uniform(), set_matrix_param(), and warning().
Referenced by LCE_Patch_Extinction().