Class ActivityMap¶
- Defined in File ActivityMap.h
Class Documentation¶
-
class
ActivityMap¶ Contains the routines for importing activity maps and getting a cell value from the map.
Activity maps can be reproduction probability maps or death maps.
Public Functions
-
ActivityMap()¶
-
bool
isNull()¶ Gets if the map is a null reproduction map, with no matrix storage in memory necessary.
- Return
- true if the map is “null” or “none”
Imports the map file from the given path Requires the dimensions to be identical as the fine map file dimensions.
- Parameters
file_name: the path to the reproduction map to importsize_x: the x dimensions of the map filesize_y: the y dimensions of the map file
-
void
setActivityFunction()¶ Correctly sets the reproduction function to either rejectionSampleNull or rejectionSample depending on if a reproduction map is used or not.
-
void
setOffsets(const unsigned long &x_offset, const unsigned long &y_offset, const unsigned long &xdim, const unsigned long &ydim)¶ Sets the offsets for the reproduction map from the sample grid.
- Parameters
x_offset: the x offset from the sample gridy_offset: the y offset from the sample gridxdim: the x dimension of the sample gridydim: the y dimension of the sample grid
-
bool
rejectionSampleNull(const unsigned long &x, const unsigned long &y, const long &xwrap, const long &ywrap)¶ Returns true for all cell values Function to be pointed to in cases where there is no reproduction map.
- Return
- true always
- Parameters
random_number: random number object to pass forwardx: x coordinate of the lineage on the sample gridy: y coordinate of the lineage on the sample gridxwrap: x wrapping of the lineageywrap: y wrapping of the lineage
-
bool
rejectionSample(const unsigned long &x, const unsigned long &y, const long &xwrap, const long &ywrap)¶ Returns true for all cell values Function to be pointed to in cases where there is no reproduction map.
- Return
- true always
- Parameters
random_number: random number object to pass forwardx: x coordinate of the lineage on the sample gridy: y coordinate of the lineage on the sample gridxwrap: x wrapping of the lineageywrap: y wrapping of the lineage
-
double
getVal(const unsigned long &x, const unsigned long &y, const long &xwrap, const long &ywrap)¶ Gets the value of the reproduction map at that location.
- Return
- value of the reproduction map at the required location
- Parameters
x: x coordinate of the lineage on the sample gridy: y coordinate of the lineage on the sample gridxwrap: x wrapping of the lineageywrap: y wrapping of the lineage
-
bool
actionOccurs(const unsigned long &x, const unsigned long &y, const long &xwrap, const long &ywrap)¶ Tests if the random action occurs.
- Return
- value of the reproduction map at the required location
- Parameters
x: x coordinate of the lineage on the sample gridy: y coordinate of the lineage on the sample gridxwrap: x wrapping of the lineageywrap: y wrapping of the lineage
-
void
standardiseValues()¶ Standardises probability values from 0-1.
-
double
get(const unsigned long &rows, const unsigned long &cols)¶ Get the value at the specified index.
- Return
- the value at the specified row and column
- Parameters
rows: the row index to obtaincols: the column index to obtain
-
ActivityMap &
operator=(const ActivityMap &rm)¶ Equality operator.
- Return
- the self ActivityMap object
- Parameters
rm: the ActivityMap object to copy from
Protected Types
-
typedef bool (
ActivityMap::*rep_ptr)(const unsigned long &x, const unsigned long &y, const long &xwrap, const long &ywrap)¶
Protected Attributes
-
Map<double>
activity_map¶
-
string
map_file¶
-
double
max_val¶
-
bool
null_map¶
-
unsigned long
offset_x¶
-
unsigned long
offset_y¶
-
unsigned long
x_dim¶
-
unsigned long
y_dim¶
-
shared_ptr<RNGController>
random¶
Friends
-
ostream &
operator<<(ostream &os, ActivityMap &r)¶ Operator for outputting to an ostream.
- Return
- the os object
- Parameters
os: the ostream to output tor: the ActivityMap to read from
-
istream &
operator>>(istream &is, ActivityMap &r)¶ Operator for inputting from an istream.
- Return
- the is object
- Parameters
is: the istream to input fromr: the ActivityMap to input to
-