colinsheppard / insalmo

The Individual-Based Salmon Stream Model
GNU General Public License v2.0
2 stars 0 forks source link

Bug in (not) sorting by length #83

Closed SFRailsback closed 12 years ago

SFRailsback commented 12 years ago

We are using the same "compare" function in two separate calls to QSort - one is to sort spawners by arrival date and one to sort fish by length every day. Needless to say they are not getting sorted by length. This is a major bug.

I fixed this in a version of the code on my Linux machine: DunhamSteelhead-insalmo-65e5126. The key statements in TroutModelSwarm are to replace the QSort statements with these:

[QSort sortObjectsIn: spawners using: M(compareArrivalTime:)];

[QSort sortObjectsIn: liveFish using: M(compare:)];