Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/suits.h
[mareframe] / trunk / gadget / suits.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/suits.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef suits_h
2 :     #define suits_h
3 :    
4 :     #include "charptrvector.h"
5 :     #include "suitfuncptrvector.h"
6 :     #include "doublematrixptrvector.h"
7 :     #include "keeper.h"
8 :    
9 :     class Predator;
10 :    
11 :     /**
12 :     * \class Suits
13 :     * \brief This is the class used to calculate and store the suitability values for all the preys of a single predator
14 :     */
15 :     class Suits {
16 :     public:
17 :     /**
18 :     * \brief This is the default Suits constructor
19 :     */
20 :     Suits() {};
21 :     /**
22 :     * \brief This is the default Suits destructor
23 :     */
24 :     ~Suits();
25 :     /**
26 :     * \brief This function will add suitability values for a given prey
27 :     * \param preyname is the name of the prey to be added
28 :     * \param suitf is the SuitFunc that defines the suitability values
29 :     */
30 :     void addPrey(const char* preyname, SuitFunc* suitf);
31 :     /**
32 :     * \brief This function will delete suitability values for a given prey
33 :     * \param i is the index of the prey to be deleted
34 :     * \param keeper is the Keeper for the current model
35 :     */
36 :     void deletePrey(int i, Keeper* const keeper);
37 :     /**
38 :     * \brief This function will return the name of a given prey
39 :     * \param i is the index of the prey
40 :     * \return name of the prey
41 :     */
42 :     const char* getPreyName(int i) const { return preynames[i]; };
43 :     /**
44 :     * \brief This will initialise the preys that will be consumed by the predator
45 :     * \param pred is the Predator that the suitability functions are defined for
46 :     */
47 :     void Initialise(const Predator* const pred);
48 :     /**
49 :     * \brief This function will return the number of preys that have suitability values
50 :     * \return number of preys
51 :     */
52 :     int numPreys() const { return preynames.Size(); };
53 :     /**
54 :     * \brief This function will check to see if the suitability parameters for a given prey have changed on the current timestep
55 :     * \param i is the index of the prey
56 :     * \param TimeInfo is the TimeClass for the current model
57 :     * \return 1 if the values have changed, 0 otherwise
58 :     */
59 :     int didChange(int i, const TimeClass* const TimeInfo) { return suitFunction[i]->didChange(TimeInfo); };
60 :     /**
61 :     * \brief This function will return the calculated suitability values for a given prey
62 :     * \param i is the index of the prey
63 :     * \return preCalcSuitability[i], the DoubleMatrix containing the suitability values
64 :     */
65 :     const DoubleMatrix& getSuitability(int i) const { return (*preCalcSuitability[i]); };
66 :     /**
67 :     * \brief This function will reset the suitability information for a given predator
68 :     * \param pred is the Predator that the suitability functions are defined for
69 :     * \param TimeInfo is the TimeClass for the current model
70 :     */
71 :     void Reset(const Predator* const pred, const TimeClass* const TimeInfo);
72 :     protected:
73 :     /**
74 :     * \brief This is the CharPtrVector of prey names
75 :     */
76 :     CharPtrVector preynames;
77 :     /**
78 :     * \brief This is the SuitFuncPtrVector of the suitability functions used when calculating the consumption of the preys
79 :     */
80 :     SuitFuncPtrVector suitFunction;
81 :     /**
82 :     * \brief This is the DoubleMatrixPtrVector of calculated suitability values
83 :     * \note The indices for this object are [prey][predator length][prey length]
84 :     */
85 :     DoubleMatrixPtrVector preCalcSuitability;
86 :     };
87 :    
88 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge