Struct SimParameters¶
- Defined in File SimParameters.h
Struct Documentation¶
-
struct
SimParameters¶ Stores and imports the variables required by the Map object. Used to setting the Map variables in a more elegant way.
Public Functions
-
SimParameters()¶ Default constructor.
-
void
importParameters(ConfigParser configOption)¶ Links to the provided ConfigOption. Assumes that the parameters have already been parsed from the config file.
- Parameters
configOption: the parsed ConfigOption object
-
void
importParameters(const string &conf_in)¶ Imports the spatial variables from a path to the config file..
- Parameters
config_in: string of the path to the config file
-
void
importParameters()¶ Main import of parameters from the config file option.
-
void
setKeyParameters(const long long &job_type, const long long &seed, const string &output_directory, const unsigned long &max_time, unsigned long desired_specnum, const string ×_file)¶ Sets the main simulation parameters.
- Parameters
job_type: the job type reference number, used for file referencingseed: the seed to set random number generationoutput_directory: the output directorymax_time: the maximum time to simulate fordesired_specnum: the desired number of species to aim towards (currently not functional)times_file: the file containing a list of temporal sampling points
-
void
setSpeciationParameters(const long double &spec_in, bool is_protracted_in, const double &min_speciation_gen_in, const double &max_speciation_gen_in)¶ Sets the speciation parameters for the simulation.
- Parameters
spec_in: the speciation rate to useis_protracted_in: if true, simulates as a protracted simulationmin_speciation_gen_in: the minimum speciation generation for protracted simulationsmax_speciation_gen_in: the maximum speciation generation for protracted simulations
-
void
setDispersalParameters(const string &dispersal_method_in, const double &sigma_in, const double &tau_in, const double &m_prob_in, const double &cutoff_in, const double &dispersal_relative_cost_in, bool restrict_self_in, const string &landscape_type_in, const string &dispersal_file_in, const string &reproduction_file_in)¶ Sets the dispersal parameters for the simulation.
- Parameters
dispersal_method_in: the method of individuals dispersing (normal, fat-tailed or norm-uniform)sigma_in: the sigma value for a normal distributiontau_in: the tau value for the fat-tailed distributionm_prob_in: the probability of uniform dispersal for the norm-uniform distributioncutoff_in: the maximum dispersal distance for the uniform distributiondispersal_relative_cost_in: the relative cost of dispersing through non-forestrestrict_self_in: if true, prevents dispersal from the same celllandscape_type_in: the landscape type (infinite, tiled or closed)dispersal_file_in: a map of dispersal probabilitiesreproduction_file_in: a map of reproduction probabilities
-
void
setHistoricalMapParameters(const string &historical_fine_file_map_in, const string &historical_coarse_map_file_in, const double &gen_since_historical_in, const double &habitat_change_rate_in)¶ Sets the historical map parameters for the simulation.
- Parameters
historical_fine_file_map_in: the fine resolution historical filehistorical_coarse_map_file_in: the coarse resolution historical filegen_since_historical_in: the number of generations since the historical state was achievedhabitat_change_rate_in: the rate of habitat change towards the historical state
-
void
setHistoricalMapParameters(vector<string> path_fine, vector<unsigned long> number_fine, vector<double> rate_fine, vector<double> time_fine, vector<string> path_coarse, vector<unsigned long> number_coarse, vector<double> rate_coarse, vector<double> time_coarse)¶
-
void
setMapParameters(const string &fine_map_file_in, const string &coarse_map_file_in, const string &sample_mask_file_in, const unsigned long &grid_x_size_in, const unsigned long &grid_y_size_in, const unsigned long &sample_x_size_in, const unsigned long &sample_y_size_in, const unsigned long &sample_x_offset_in, const unsigned long &sample_y_offset_in, const unsigned long &fine_map_x_size_in, const unsigned long &fine_map_y_size_in, const unsigned long &fine_map_x_offset_in, const unsigned long &fine_map_y_offset_in, const unsigned long &coarse_map_x_size_in, const unsigned long &coarse_map_y_size_in, const unsigned long &coarse_map_x_offset_in, const unsigned long &coarse_map_y_offset_in, const unsigned long &coarse_map_scale_in, const double &deme_in, const double &deme_sample_in, bool uses_spatial_sampling_in)¶ Sets the map parameters for the simulation.
- Parameters
fine_map_file_in: the fine resolution density mapcoarse_map_file_in: the coarse resolution density mapsample_mask_file_in: the spatial sampling maskgrid_x_size_in: the x dimension of the gridgrid_y_size_in: the y dimension of the gridsample_x_size_in: the x dimension of the sample masksample_y_size_in: the y dimension of the sample masksample_x_offset_in: the x offset of the sample mask from the gridsample_y_offset_in: the y offset of the sample mask from the gridfine_map_x_size_in: the x dimension of the fine mapfine_map_y_size_in: the y dimension of the fine mapfine_map_x_offset_in: the x offset of the fine map from the sample maskfine_map_y_offset_in: the y offset of the fine map from the sample maskcoarse_map_x_size_in: the x dimension of the coarse mapcoarse_map_y_size_in: the y dimension of the coarse mapcoarse_map_x_offset_in: the x offset of the coarse map from the fine mapcoarse_map_y_offset_in: the y offset of the coarse map from the fine mapcoarse_map_scale_in: the scale of the coarse map compared to the fine mapdeme_in: the number of individuals per celldeme_sample_in: the proportion of individuals to sample from each celluses_spatial_sampling_in: if the sample mask denotes differing spatial sampling proportions
-
bool
setHistorical(const double &generation)¶ Updates the historical map parameters to the next item in the deque.
- Return
- bool true if we need to re-import the maps (i.e. the historical maps have changed between updates)
-
bool
checkNeedsUpdate(const double &g)¶ Checks if there will be another update to be performed on the map.
- Return
- true if another map update exists
-
bool
hasAnotherUpdate()¶
-
void
parseHistorical()¶ Parses the historical map data and creates the queue of historical maps.
-
void
setInitialHistoricalParameters()¶
-
void
printVars()¶ Prints selected important variables to the terminal.
-
void
printSpatialVars()¶ Prints the spatial variables.
-
void
setMetacommunityParameters(const unsigned long &metacommunity_size, const long double &speciation_rate, const unsigned long &seed, const unsigned long &job_type)¶ Sets the metacommunity parameters.
- Parameters
metacommunity_size: the number of individuals in the communityspeciation_rate: the speciation rate for the metacommunityseed: the seed for the simulationjob_type: the job referencing number
-
SimParameters &
operator=(const SimParameters &other)¶
Public Members
-
string
fine_map_file¶
-
string
coarse_map_file¶
-
string
output_directory¶
-
string
historical_fine_map_file¶
-
string
historical_coarse_map_file¶
-
string
sample_mask_file¶
-
long long
job_type= {}¶
-
long long
seed= {}¶
-
unsigned long
grid_x_size= {}¶
-
unsigned long
grid_y_size= {}¶
-
unsigned long
sample_x_size= {}¶
-
unsigned long
sample_y_size= {}¶
-
unsigned long
sample_x_offset= {}¶
-
unsigned long
sample_y_offset= {}¶
-
unsigned long
fine_map_x_size= {}¶
-
unsigned long
fine_map_y_size= {}¶
-
unsigned long
fine_map_x_offset= {}¶
-
unsigned long
fine_map_y_offset= {}¶
-
unsigned long
coarse_map_x_size= {}¶
-
unsigned long
coarse_map_y_size= {}¶
-
unsigned long
coarse_map_x_offset= {}¶
-
unsigned long
coarse_map_y_offset= {}¶
-
unsigned long
coarse_map_scale= {}¶
-
unsigned long
desired_specnum= {}¶
-
double
dispersal_relative_cost= {}¶
-
double
deme= {}¶
-
double
deme_sample= {}¶
-
long double
spec= {0.0}¶
-
double
sigma= {}¶
-
unsigned long
max_time= {}¶
-
double
gen_since_historical= {}¶
-
double
habitat_change_rate= {}¶
-
double
tau= {}¶
-
string
dispersal_method¶
-
double
m_prob= {}¶
-
double
cutoff= {}¶
-
bool
restrict_self= {}¶
-
string
times_file¶
-
vector<double>
times¶
-
ConfigParser
configs¶
-
bool
is_historical= {}¶
-
bool
uses_spatial_sampling= {}¶
-
string
landscape_type¶
-
bool
is_protracted= {}¶
-
double
min_speciation_gen= {}¶
-
double
max_speciation_gen= {}¶
-
string
dispersal_file¶
-
string
death_file¶
-
string
reproduction_file¶
-
std::queue<HistoricalMapParameters>
all_historical_map_parameters¶
-
bool
has_parsed_historical¶
Friends
-
ostream &
operator<<(ostream &os, const SimParameters &m)¶ Overloading the << operator for outputting to the output stream.
- Return
- os the output stream.
- Parameters
os: the output stream.m: the SimParameters object.
-
istream &
operator>>(istream &is, SimParameters &m)¶ Overloading the >> operator for inputting from an input stream.
- Return
- is the input stream
- Parameters
is: the input streamm: the mapvars object
-