Rev 1165 | Rev 1174 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1165 | Rev 1168 | ||
---|---|---|---|
Line 60... | Line 60... | ||
60 | 60 | ||
61 | // start from a random species (and cycle through the available species)
|
61 | // start from a random species (and cycle through the available species)
|
62 | species_idx = *s_idx; |
62 | species_idx = *s_idx; |
63 | 63 | ||
64 | ResourceUnitSpecies *rus = ru->ruSpecies()[species_idx]; |
64 | ResourceUnitSpecies *rus = ru->ruSpecies()[species_idx]; |
- | 65 | rus->establishment().clear(); |
|
- | 66 | ||
65 | // check if there are seeds of the given species on the resource unit
|
67 | // check if there are seeds of the given species on the resource unit
|
66 | float seeds = 0.f; |
68 | float seeds = 0.f; |
67 | Grid<float> &seedmap = const_cast<Grid<float>& >(rus->species()->seedDispersal()->seedMap()); |
69 | Grid<float> &seedmap = const_cast<Grid<float>& >(rus->species()->seedDispersal()->seedMap()); |
68 | for (int iy=0;iy<5;++iy) { |
70 | for (int iy=0;iy<5;++iy) { |
69 | float *p = seedmap.ptr(iseedmap.x(), iseedmap.y()); |
71 | float *p = seedmap.ptr(iseedmap.x(), iseedmap.y()); |
Line 75... | Line 77... | ||
75 | continue; |
77 | continue; |
76 | 78 | ||
77 | // calculate the abiotic environment (TACA)
|
79 | // calculate the abiotic environment (TACA)
|
78 | rus->establishment().calculateAbioticEnvironment(); |
80 | rus->establishment().calculateAbioticEnvironment(); |
79 | double abiotic_env = rus->establishment().abioticEnvironment(); |
81 | double abiotic_env = rus->establishment().abioticEnvironment(); |
80 | if (abiotic_env==0.) |
- | |
- | 82 | if (abiotic_env==0.) { |
|
- | 83 | rus->establishment().writeDebugOutputs(); |
|
81 | continue; |
84 | continue; |
- | 85 | }
|
|
82 | 86 | ||
83 | // loop over all 2m cells on this resource unit
|
87 | // loop over all 2m cells on this resource unit
|
84 | SaplingCell *sap_cells = ru->saplingCellArray(); |
88 | SaplingCell *sap_cells = ru->saplingCellArray(); |
85 | SaplingCell *s; |
89 | SaplingCell *s; |
86 | int isc = 0; // index on 2m cell |
90 | int isc = 0; // index on 2m cell |
Line 130... | Line 134... | ||
130 | }
|
134 | }
|
131 | 135 | ||
132 | }
|
136 | }
|
133 | }
|
137 | }
|
134 | }
|
138 | }
|
135 | - | ||
- | 139 | // create debug output related to establishment
|
|
- | 140 | rus->establishment().writeDebugOutputs(); |
|
136 | }
|
141 | }
|
137 | 142 | ||
138 | }
|
143 | }
|
139 | 144 | ||
140 | void Saplings::saplingGrowth(const ResourceUnit *ru) |
145 | void Saplings::saplingGrowth(const ResourceUnit *ru) |
Line 174... | Line 179... | ||
174 | // store statistics on saplings/regeneration
|
179 | // store statistics on saplings/regeneration
|
175 | for (QList<ResourceUnitSpecies*>::const_iterator i=ru->ruSpecies().constBegin(); i!=ru->ruSpecies().constEnd(); ++i) { |
180 | for (QList<ResourceUnitSpecies*>::const_iterator i=ru->ruSpecies().constBegin(); i!=ru->ruSpecies().constEnd(); ++i) { |
176 | (*i)->saplingStat().calculate((*i)->species(), const_cast<ResourceUnit*>(ru)); |
181 | (*i)->saplingStat().calculate((*i)->species(), const_cast<ResourceUnit*>(ru)); |
177 | (*i)->statistics().add(&((*i)->saplingStat())); |
182 | (*i)->statistics().add(&((*i)->saplingStat())); |
178 | }
|
183 | }
|
- | 184 | ||
- | 185 | // debug output related to saplings
|
|
- | 186 | if (GlobalSettings::instance()->isDebugEnabled(GlobalSettings::dSaplingGrowth)) { |
|
- | 187 | ||
- | 188 | // establishment details
|
|
- | 189 | for (QList<ResourceUnitSpecies*>::const_iterator it=ru->ruSpecies().constBegin();it!=ru->ruSpecies().constEnd();++it) { |
|
- | 190 | if ((*it)->saplingStat().livingSaplings() == 0) |
|
- | 191 | continue; |
|
- | 192 | DebugList &out = GlobalSettings::instance()->debugList(ru->index(), GlobalSettings::dSaplingGrowth); |
|
- | 193 | out << (*it)->species()->id() << ru->index() <<ru->id(); |
|
- | 194 | out << (*it)->saplingStat().livingSaplings() << (*it)->saplingStat().averageHeight() << (*it)->saplingStat().averageAge() |
|
- | 195 | << (*it)->saplingStat().averageDeltaHPot() << (*it)->saplingStat().averageDeltaHRealized(); |
|
- | 196 | out << (*it)->saplingStat().newSaplings() << (*it)->saplingStat().diedSaplings() |
|
- | 197 | << (*it)->saplingStat().recruitedSaplings() <<(*it)->species()->saplingGrowthParameters().referenceRatio; |
|
- | 198 | }
|
|
- | 199 | }
|
|
- | 200 | ||
179 | }
|
201 | }
|
180 | 202 | ||
181 | SaplingCell *Saplings::cell(QPoint lif_coords, bool only_valid, ResourceUnit **rRUPtr) |
203 | SaplingCell *Saplings::cell(QPoint lif_coords, bool only_valid, ResourceUnit **rRUPtr) |
182 | {
|
204 | {
|
183 | FloatGrid *lif_grid = GlobalSettings::instance()->model()->grid(); |
205 | FloatGrid *lif_grid = GlobalSettings::instance()->model()->grid(); |