1 : |
agomez |
1 |
#ifndef agebandmatrixptrvector_h
|
2 : |
|
|
#define agebandmatrixptrvector_h
|
3 : |
|
|
|
4 : |
|
|
#include "agebandmatrix.h" |
5 : |
|
|
|
6 : |
|
|
class AgeBandMatrix;
|
7 : |
|
|
|
8 : |
|
|
/**
|
9 : |
|
|
* \class AgeBandMatrixPtrVector
|
10 : |
|
|
* \brief This class implements a dynamic vector of AgeBandMatrix values
|
11 : |
|
|
*/
|
12 : |
|
|
class AgeBandMatrixPtrVector {
|
13 : |
|
|
public:
|
14 : |
|
|
/**
|
15 : |
|
|
* \brief This is the default AgeBandMatrixPtrVector constructor
|
16 : |
|
|
*/
|
17 : |
|
|
AgeBandMatrixPtrVector() { size = 0; v = 0; };
|
18 : |
|
|
/**
|
19 : |
|
|
* \brief This is the AgeBandMatrixPtrVector constructor for a specified size
|
20 : |
|
|
* \param sz is the size of the vector to be created
|
21 : |
|
|
* \note The elements of the vector will all be created, and set to zero
|
22 : |
|
|
*/
|
23 : |
|
|
AgeBandMatrixPtrVector(int sz);
|
24 : |
|
|
/**
|
25 : |
|
|
* \brief This is the AgeBandMatrixPtrVector constructor for a specified size with an initial value specified by the minimum age and length of the new AgeBandMatrix created
|
26 : |
|
|
* \param sz is the size of the vector to be created
|
27 : |
|
|
* \param minage is the minimum age of the AgeBandMatrix to be created
|
28 : |
|
|
* \param minl is the IntVector of minimum lengths of the AgeBandMatrix to be created
|
29 : |
|
|
* \param lsize is the IntVector of sizes of the AgeBandMatrix to be created
|
30 : |
|
|
*/
|
31 : |
|
|
AgeBandMatrixPtrVector(int sz, int minage, const IntVector& minl, const IntVector& lsize);
|
32 : |
|
|
/**
|
33 : |
|
|
* \brief This is the AgeBandMatrixPtrVector constructor that creates a copy of an existing AgeBandMatrixPtrVector
|
34 : |
|
|
* \param initial is the AgeBandMatrixPtrVector to copy
|
35 : |
|
|
*/
|
36 : |
|
|
AgeBandMatrixPtrVector(const AgeBandMatrixPtrVector& initial);
|
37 : |
|
|
/**
|
38 : |
|
|
* \brief This is the AgeBandMatrixPtrVector destructor
|
39 : |
|
|
* \note This will free all the memory allocated to all the elements of the vector
|
40 : |
|
|
*/
|
41 : |
|
|
~AgeBandMatrixPtrVector();
|
42 : |
|
|
/**
|
43 : |
|
|
* \brief This will add new entries to the vector
|
44 : |
|
|
* \param add is the number of new entries to the vector
|
45 : |
|
|
* \param value is the value that will be entered for the new entries
|
46 : |
|
|
*/
|
47 : |
|
|
void resize(int add, AgeBandMatrix* value);
|
48 : |
|
|
/**
|
49 : |
|
|
* \brief This will add new empty entries to the vector
|
50 : |
|
|
* \param add is the number of new entries to the vector
|
51 : |
|
|
* \note The new elements of the vector will be created, and set to zero
|
52 : |
|
|
*/
|
53 : |
|
|
void resize(int add);
|
54 : |
|
|
/**
|
55 : |
|
|
* \brief This will add new entries to the vector and create new AgeBandMatrix initial values
|
56 : |
|
|
* \param add is the number of new entries to the vector
|
57 : |
|
|
* \param minage is the minimum age of the AgeBandMatrix to be created
|
58 : |
|
|
* \param minl is the IntVector of minimum lengths of the AgeBandMatrix to be created
|
59 : |
|
|
* \param lsize is the IntVector of sizes of the AgeBandMatrix to be created
|
60 : |
|
|
*/
|
61 : |
|
|
void resize(int add, int minage, const IntVector& minl, const IntVector& lsize);
|
62 : |
|
|
/**
|
63 : |
|
|
* \brief This will add new entries to the vector and create new AgeBandMatrix initial values
|
64 : |
|
|
* \param add is the number of new entries to the vector
|
65 : |
|
|
* \param minage is the minimum age of the AgeBandMatrix to be created
|
66 : |
|
|
* \param minl is the minimum length of the AgeBandMatrix to be created
|
67 : |
|
|
* \param matr is the PopInfoMatrix that the initial values are to be copied from
|
68 : |
|
|
*/
|
69 : |
|
|
void resize(int add, int minage, int minl, const PopInfoMatrix& matr);
|
70 : |
|
|
/**
|
71 : |
|
|
* \brief This will delete an entry from the vector
|
72 : |
|
|
* \param pos is the element of the vector to be deleted
|
73 : |
|
|
* \note This will free the memory allocated to the deleted element of the vector
|
74 : |
|
|
*/
|
75 : |
|
|
void Delete(int pos);
|
76 : |
|
|
/**
|
77 : |
|
|
* \brief This will return the size of the vector
|
78 : |
|
|
* \return the size of the vector
|
79 : |
|
|
*/
|
80 : |
|
|
int Size() const { return size; };
|
81 : |
|
|
/**
|
82 : |
|
|
* \brief This will return the value of an element of the vector
|
83 : |
|
|
* \param pos is the element of the vector to be returned
|
84 : |
|
|
* \return the value of the specified element
|
85 : |
|
|
*/
|
86 : |
|
|
AgeBandMatrix& operator [] (int pos) { return *v[pos]; };
|
87 : |
|
|
/**
|
88 : |
|
|
* \brief This will return the value of an element of the vector
|
89 : |
|
|
* \param pos is the element of the vector to be returned
|
90 : |
|
|
* \return the value of the specified element
|
91 : |
|
|
*/
|
92 : |
|
|
const AgeBandMatrix& operator [] (int pos) const { return *v[pos]; };
|
93 : |
|
|
/**
|
94 : |
|
|
* \brief This function will implement the migration of entries from one AgeBandMatrix to another within the vector of values
|
95 : |
|
|
* \param MI is the DoubleMatrix describing the migration
|
96 : |
|
|
* \param tmp is the PopInfoVector used to temporarily store the population during migration
|
97 : |
|
|
*/
|
98 : |
|
|
void Migrate(const DoubleMatrix& MI, PopInfoVector& tmp);
|
99 : |
|
|
protected:
|
100 : |
|
|
/**
|
101 : |
|
|
* \brief This is the vector of AgeBandMatrix values
|
102 : |
|
|
*/
|
103 : |
|
|
AgeBandMatrix** v;
|
104 : |
|
|
/**
|
105 : |
|
|
* \brief This is the size of the vector
|
106 : |
|
|
*/
|
107 : |
|
|
int size;
|
108 : |
|
|
};
|
109 : |
|
|
|
110 : |
|
|
#endif
|