LANDIS-II-Foundation / Extension-Base-Harvest

Base Harvest extension for the LANDIS-II landscape change model.
https://sites.google.com/site/landismodel/extensions/base-harvest
Apache License 2.0
0 stars 7 forks source link

Planting crashes program #32

Open rmscheller opened 6 years ago

rmscheller commented 6 years ago

From Ivan Kruhlov: Attached is the file from the example dataset of the latest Biomass Harvest extension, to which I added the PLANT option for the active prescription (line 58). After this, the program, which had run smoothly before, crashed.

The keyword is also causing NECN to crash.

biomass-harvest_SetUp_s2e1_plant.txt

rmscheller commented 6 years ago

After examining the code, I recommend the following.
In Library-Harvest-Mgmt: Prescription.Schedule for harvest provides a BitArray and ActiveSite. This would allow us to remove the dependence on Library-Succession, making for cleaner, easier-to-maintain code.

In Succession: Reproduction.ScheduleForPlanting accepts BitArray and ActiveSite and treats it similarly as resprout and serotiny (see line 55-56: https://github.com/LANDIS-II-Foundation/Library-Succession/blob/master/src/Reproduction.cs). This would allow us to remove Planting.cs and IPlanting.cs and also (I believe) IFormOfReproduction.cs and FormOfReproduction.cs (I couldn't find any other place they are used except for Planting). Again, a simplification and stream-lining of the code. In Reproduction.cs, line 277 is replaced with the commented-out 278-290.

rmscheller commented 6 years ago

p.s. When the program crashes, it throws an Object-not-found exception. The object not found is "planting". Both selectedSpecies and site != null.