Subversion Repositories public iLand

Rev

Rev 470 | Rev 483 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 470 Rev 475
Line 39... Line 39...
39
39
40
40
41
class Species
41
class Species
42
{
42
{
43
public:
43
public:
44
    Species(SpeciesSet *set) { mSet = set; mIndex=set->count(); mSeedDispersal=0; }
-
 
-
 
44
    Species(SpeciesSet *set) { mSet = set; mIndex=set->count(); mSeedDispersal=0; mRandomGenerator=0; }
45
    ~Species();
45
    ~Species();
46
    // maintenance
46
    // maintenance
47
    void setup();
47
    void setup();
48
    void newYear();
48
    void newYear();
-
 
49
    // getter for a thread-local random number generator object. if setRandomGenerator() is used, this saves some overhead
-
 
50
    MTRand &randomGenerator() const { if (mRandomGenerator) return *mRandomGenerator; else return GlobalSettings::instance()->randomGenerator(); }
-
 
51
    void setRandomGenerator() { mRandomGenerator = &GlobalSettings::instance()->randomGenerator(); } // fetch random generator of the current thread
-
 
52
49
53
50
    const SpeciesSet *speciesSet() const { return mSet; }
54
    const SpeciesSet *speciesSet() const { return mSet; }
51
    // properties
55
    // properties
52
    SeedDispersal *seedDispersal() const { return mSeedDispersal; }
56
    SeedDispersal *seedDispersal() const { return mSeedDispersal; }
53
    /// @property id 4-character unique identification of the tree species
57
    /// @property id 4-character unique identification of the tree species
Line 110... Line 114...
110
    // helpers during setup
114
    // helpers during setup
111
    bool boolVar(const QString s) { return mSet->var(s).toBool(); } ///< during setup: get value of variable @p s as a boolean variable.
115
    bool boolVar(const QString s) { return mSet->var(s).toBool(); } ///< during setup: get value of variable @p s as a boolean variable.
112
    double doubleVar(const QString s) { return mSet->var(s).toDouble(); }///< during setup: get value of variable @p s as a double.
116
    double doubleVar(const QString s) { return mSet->var(s).toDouble(); }///< during setup: get value of variable @p s as a double.
113
    int intVar(const QString s) { return mSet->var(s).toInt(); } ///< during setup: get value of variable @p s as an integer.
117
    int intVar(const QString s) { return mSet->var(s).toInt(); } ///< during setup: get value of variable @p s as an integer.
114
    QString stringVar(const QString s) { return mSet->var(s).toString(); } ///< during setup: get value of variable @p s as a string.
118
    QString stringVar(const QString s) { return mSet->var(s).toString(); } ///< during setup: get value of variable @p s as a string.
-
 
119
    MTRand *mRandomGenerator;
115
120
116
    SpeciesSet *mSet; ///< ptr. to the "parent" set
121
    SpeciesSet *mSet; ///< ptr. to the "parent" set
117
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
122
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
118
    QString mId;
123
    QString mId;
119
    QString mName;
124
    QString mName;