Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
A class to aggregate structured data in an array. More...
#include <datatable.h>
Public Member Functions | |
DataTable () | |
Default constructor. More... | |
DataTable (unsigned int nbgroups, unsigned int nbclasses, unsigned int **classSizes) | |
Constructor. More... | |
~DataTable () | |
void | allocate (unsigned int nbgroups, unsigned int nbclasses, unsigned int **classSizes) |
Creates a table of size given by the sum of all classes passed by the 'classSizes' matrix. More... | |
void | update (unsigned int nbgroups, unsigned int nbclasses, unsigned int **classSizes) |
Updates the group and classe sizes and re-allocates the table according to its new length. More... | |
void | free () |
Deallocates all the allocated tables. More... | |
unsigned int | length () |
Returns the length of the table (total number of elements present). More... | |
T * | getTable () |
Accessor to the table array. More... | |
T * | getGroup (unsigned int group) |
Accessor to a group array. More... | |
T * | getClassWithinGroup (unsigned int group, unsigned int Class) |
Accessor to a class array whithin a group. More... | |
T | get (unsigned int group, unsigned int Class, unsigned int elmnt) |
Returns value stored of the element 'elmnt' of the class 'Class' in the group 'group'. More... | |
void | set (unsigned int group, unsigned int Class, unsigned int elmnt, T val) |
Sets the element 'elmnt' of the class 'Class' in the group 'group' to the value 'val'. More... | |
void | increment (unsigned int group, unsigned int Class, unsigned int elmnt) |
Increments 'elmnt' of the class 'Class' in the group 'group' by one. More... | |
void | plus (unsigned int group, unsigned int Class, unsigned int elmnt, T val) |
Adds 'val' to 'elmnt' in the class 'Class' in the group 'group'. More... | |
void | minus (unsigned int group, unsigned int Class, unsigned int elmnt, T val) |
Substracts 'val' from 'elmnt' in the class 'Class' in the group 'group'. More... | |
void | multiply (unsigned int group, unsigned int Class, unsigned int elmnt, T val) |
Multiplies 'elmnt' of the class 'Class' in the group 'group' by 'val'. More... | |
void | divide (unsigned int group, unsigned int Class, unsigned int elmnt, T val) |
Subdivide 'elmnt' of the class 'Class' in the group 'group' by 'val'. More... | |
void | init (T val) |
Sets all elements of the table to value 'val'. More... | |
unsigned int | getNumGroups () |
unsigned int | getNumClasses () |
unsigned int | size (unsigned int i, unsigned int j) |
void | show_up () |
Private Member Functions | |
void | store_sizes (unsigned int nbgroups, unsigned int nbclasses, unsigned int **classSizes) |
bool | sizeChange (unsigned int nbgroups, unsigned int nbclasses, unsigned int **classSizes) |
Private Attributes | |
unsigned int | _length |
length of the table More... | |
unsigned int | _groups |
number of groups in the table More... | |
unsigned int | _classes |
number of classes within each group More... | |
unsigned int ** | _cumulClassSizes |
Stores the indexes of each class of each group present in the table. More... | |
unsigned int * | _cumulGroupSizes |
Stores the indexes of each group present in the table. More... | |
unsigned int ** | _sizes |
T * | _table |
A class to aggregate structured data in an array.
The information is subdivided into groups (e.g., patch) themselves structured in classes (e.g., age or sex classes).
|
inline |
Default constructor.
|
inline |
Constructor.
nbgroups | the number of rows in the table, typically the number of patches |
nbclasses | an array of the sizes of each row, i.e. the Patch sizes |
classSizes | a matrix of the sizes of each class within each group |
References DataTable< T >::allocate().
References DataTable< T >::free().
|
inline |
Creates a table of size given by the sum of all classes passed by the 'classSizes' matrix.
nbgroups | the number of rows in the table, typically the number of patches |
nbclasses | the number of classes within a group, e.g. the age-classes |
classSizes | a matrix (nbgroups X nbclasses) of the sizes of each class within each group |
References DataTable< T >::_classes, DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, DataTable< T >::_groups, DataTable< T >::_length, DataTable< T >::_table, DataTable< T >::free(), and DataTable< T >::store_sizes().
Referenced by TTNeutralGenesSH::allocateTables(), DataTable< T >::DataTable(), and DataTable< T >::update().
|
inline |
Subdivide 'elmnt' of the class 'Class' in the group 'group' by 'val'.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
Referenced by TTNeutralGenesSH::setHeterozygosity().
|
inline |
Deallocates all the allocated tables.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, DataTable< T >::_groups, DataTable< T >::_length, DataTable< T >::_sizes, and DataTable< T >::_table.
Referenced by DataTable< T >::allocate(), and DataTable< T >::~DataTable().
|
inline |
Returns value stored of the element 'elmnt' of the class 'Class' in the group 'group'.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
Referenced by TTNeutralGenesSH::getHeterozygosity(), TTNeutralGenesSH::setAlleleTables(), TTNeutralGenesSH::setFst_li(), TTNeutralGenesSH::setFstatWeirCockerham(), TTNeutralGenesSH::setFstatWeirCockerham_MS(), TTNeutralGenesSH::setFstMatrix(), TTNeutralGenesSH::setHs(), TTNeutralGenesSH::setHs2(), TTNeutralGenesSH::setLociDivCounter(), TTNeutralGenesSH::setNeiGeneticDistance(), and TTNeutralGenesFH::write_varcompWC().
|
inline |
Accessor to a class array whithin a group.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
Referenced by TTQuantiSH::getSkewPerPatch(), and TTQuantiSH::setStats().
Accessor to a group array.
References DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
Referenced by TTQuantiSH::setStats().
References DataTable< T >::_classes.
References DataTable< T >::_groups.
Referenced by TTNeutralGenesSH::getHeterozygosity(), TTNeutralGenesSH::setAlleleTables(), TTNeutralGenesSH::setFstat(), and TTNeutralGenesSH::setFstat2().
|
inline |
|
inline |
Increments 'elmnt' of the class 'Class' in the group 'group' by one.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
Referenced by TTNeutralGenesSH::setAlleleTables().
|
inline |
Sets all elements of the table to value 'val'.
References DataTable< T >::_length, and DataTable< T >::_table.
Referenced by TTNeutralGenesSH::setAlleleTables(), and TTNeutralGenesSH::setHeteroTable().
Returns the length of the table (total number of elements present).
References DataTable< T >::_length.
|
inline |
Substracts 'val' from 'elmnt' in the class 'Class' in the group 'group'.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
|
inline |
Multiplies 'elmnt' of the class 'Class' in the group 'group' by 'val'.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
|
inline |
Adds 'val' to 'elmnt' in the class 'Class' in the group 'group'.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
Referenced by TTNeutralGenesSH::setHeteroTable().
|
inline |
Sets the element 'elmnt' of the class 'Class' in the group 'group' to the value 'val'.
References DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, and DataTable< T >::_table.
Referenced by TTNeutralGenesSH::setAlleleTables(), and store_quanti_trait_values().
|
inline |
References DataTable< T >::_classes, DataTable< T >::_groups, DataTable< T >::_length, and message().
References DataTable< T >::_sizes.
Referenced by TTQuantiSH::getSkewPerPatch(), and TTQuantiSH::setDataTables().
|
inlineprivate |
References DataTable< T >::_classes, DataTable< T >::_groups, and DataTable< T >::_sizes.
Referenced by DataTable< T >::update().
|
inlineprivate |
References DataTable< T >::_sizes.
Referenced by DataTable< T >::allocate(), and DataTable< T >::update().
|
inline |
Updates the group and classe sizes and re-allocates the table according to its new length.
nbgroups | the number of rows in the table, typically the number of patches |
nbclasses | the number of classes within a group, e.g. the age-class sizes |
classSizes | a matrix of the sizes of each class within each group |
References DataTable< T >::_classes, DataTable< T >::_cumulClassSizes, DataTable< T >::_cumulGroupSizes, DataTable< T >::_groups, DataTable< T >::_length, DataTable< T >::_table, DataTable< T >::allocate(), DataTable< T >::sizeChange(), and DataTable< T >::store_sizes().
Referenced by TTQuantiSH::setDataTables(), and TTNeutralGenesSH::setHeteroTable().
number of classes within each group
Referenced by DataTable< T >::allocate(), DataTable< T >::getNumClasses(), DataTable< T >::show_up(), DataTable< T >::sizeChange(), and DataTable< T >::update().
Stores the indexes of each class of each group present in the table.
the aggregated sizes of each classe within each group given by: size(class i!=0) = sum of size( (class 0) to (class i-1) ) and size(class i=0) = 0. This is repeated for each group.
Referenced by DataTable< T >::allocate(), DataTable< T >::divide(), DataTable< T >::free(), DataTable< T >::get(), DataTable< T >::getClassWithinGroup(), DataTable< T >::increment(), DataTable< T >::minus(), DataTable< T >::multiply(), DataTable< T >::plus(), DataTable< T >::set(), and DataTable< T >::update().
Stores the indexes of each group present in the table.
the aggregated sizes of each group with size(group i=0) = 0 and size(group i!=0) = sum of size( (group 0) to (group i-1)) where the group sizes are the sum of the classe sizes of the groups.
Referenced by DataTable< T >::allocate(), DataTable< T >::divide(), DataTable< T >::free(), DataTable< T >::get(), DataTable< T >::getClassWithinGroup(), DataTable< T >::getGroup(), DataTable< T >::increment(), DataTable< T >::minus(), DataTable< T >::multiply(), DataTable< T >::plus(), DataTable< T >::set(), and DataTable< T >::update().
number of groups in the table
Referenced by DataTable< T >::allocate(), DataTable< T >::free(), DataTable< T >::getNumGroups(), DataTable< T >::show_up(), DataTable< T >::sizeChange(), and DataTable< T >::update().
length of the table
Referenced by DataTable< T >::allocate(), DataTable< T >::free(), DataTable< T >::init(), DataTable< T >::length(), DataTable< T >::show_up(), and DataTable< T >::update().
|
private |
Referenced by DataTable< T >::allocate(), DataTable< T >::divide(), DataTable< T >::free(), DataTable< T >::get(), DataTable< T >::getClassWithinGroup(), DataTable< T >::getGroup(), DataTable< T >::getTable(), DataTable< T >::increment(), DataTable< T >::init(), DataTable< T >::minus(), DataTable< T >::multiply(), DataTable< T >::plus(), DataTable< T >::set(), and DataTable< T >::update().