Skip to content

Commit

Permalink
don't start in natal patch
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoPannetier committed Jan 22, 2024
1 parent 19b361e commit ad90a0c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Individual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2213,8 +2213,8 @@ void testIndividual() {
ls.addCellToLand(final_cell);
ls.allocatePatches(&sp);
ls.updateCarryingCapacity(&sp, 0, 0);
init_patch = (Patch*)init_cell->getPatch();

// Init cell is NOT in natal patch
Patch* natalPatch = new Patch(0, 0);
// Step length too short
m.stepLength = 0.1; // cannot reach final cell
m.rho = 0.0; // random angle
Expand All @@ -2223,7 +2223,7 @@ void testIndividual() {
steps.maxStepsYr = 2;
steps.maxSteps = 3;
sp.setSteps(0, 0, steps);
ind = Individual(init_cell, init_patch, 0, 0, 0, 0.0, true, 2);
ind = Individual(init_cell, natalPatch, 0, 0, 0, 0.0, true, 2);
ind.setStatus(1); // dispersing
ind.forceInitPath();
ind.forceInitCRW(m);
Expand All @@ -2244,7 +2244,7 @@ void testIndividual() {
// Step length too long
m.stepLength = ls_params.dimX * SQRT2 * 1.5; // overshoots
sp.setMovtTraits(m);
ind = Individual(init_cell, init_patch, 0, 0, 0, 0.0, true, 2);
ind = Individual(init_cell, natalPatch, 0, 0, 0, 0.0, true, 2);
ind.setStatus(1); // dispersing
ind.forceInitPath();
ind.forceInitCRW(m);
Expand All @@ -2259,7 +2259,7 @@ void testIndividual() {
// Adequate step length
m.stepLength = (ls_params.dimX - 1) * SQRT2;
sp.setMovtTraits(m);
ind = Individual(init_cell, init_patch, 0, 0, 0, 0.0, true, 2);
ind = Individual(init_cell, natalPatch, 0, 0, 0, 0.0, true, 2);
ind.setStatus(1); // dispersing
ind.forceInitPath();
ind.forceInitCRW(m);
Expand All @@ -2269,7 +2269,7 @@ void testIndividual() {
assert(ind.getCurrCell() == final_cell);

// If boundaries are absorbing however, very likely to die
ind = Individual(init_cell, init_patch, 0, 0, 0, 0.0, true, 2);
ind = Individual(init_cell, natalPatch, 0, 0, 0, 0.0, true, 2);
ind.setStatus(1); // dispersing
ind.forceInitPath();
ind.forceInitCRW(m);
Expand All @@ -2291,7 +2291,7 @@ void testIndividual() {
sp.setMovtTraits(m);
steps.maxStepsYr = steps.maxSteps = 2;
sp.setSteps(0, 0, steps);
ind = Individual(init_cell, init_patch, 0, 0, 0, 0.0, true, 2);
ind = Individual(init_cell, natalPatch, 0, 0, 0, 0.0, true, 2);
ind.setStatus(1); // dispersing
ind.forceInitPath();
ind.forceInitCRW(m);
Expand All @@ -2304,6 +2304,8 @@ void testIndividual() {
assert(ind.getCurrCell() == final_cell);
// not a good test yet, must add other suitable cells
// and start outside of natal patch


}
}
#endif // RSDEBUG
Expand Down

0 comments on commit ad90a0c

Please sign in to comment.