Skip to content

Commit

Permalink
show me
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoPannetier committed Jun 12, 2024
1 parent ea3ecad commit bb1e750
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
10 changes: 1 addition & 9 deletions Individual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1877,13 +1877,12 @@ void testIndividual() {
sp.setSteps(0, 0, steps);

// Set up patches
ls.allocatePatches(&sp);
ls.allocatePatches(&sp, true);
ls.updateCarryingCapacity(&sp, 0, 0);
Patch* init_patch = (Patch*)init_cell->getPatch();

ls.printPatches();


// Create and set up individual
Individual ind0(init_cell, init_patch, 1, 0, 0, 0.0, true, 2);

Expand All @@ -1906,13 +1905,6 @@ void testIndividual() {
Cell* first_step_cell = ind1.getCurrCell();
assert(first_step_cell != init_cell);

for (int i = 0; i < cell_vec.size(); i++) {
//if (i == 12) assert(cell_vec[i].)
}

cout << endl << "After:" << endl;
ls.printPatches();

assert((Patch*)first_step_cell->getPatch() != init_patch);
ind1.setStatus(1); // emigrating again

Expand Down
6 changes: 5 additions & 1 deletion Landscape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ void Landscape::generatePatches()
//---------------------------------------------------------------------------
/* Create a patch for each suitable cell of a cell-based landscape (all other
habitat cells are added to the matrix patch) */
void Landscape::allocatePatches(Species* pSpecies)
void Landscape::allocatePatches(Species* pSpecies, const bool& showMe)
{
float habK;
Patch* pPatch;
Expand Down Expand Up @@ -669,16 +669,20 @@ void Landscape::allocatePatches(Species* pSpecies)
for (int i = 0; i < nhab; i++) {
habK += pSpecies->getHabK(pCell->getHabIndex(i));
}
if (showMe) cout << "K = " << habK << "\t";
if (habK > 0.0) { // cell is suitable - create a patch for it
patchnums.push_back(patchnum);
pPatch = newPatch(patchnum++);
if (showMe) cout << "pPatch = " << pPatch << "\t";
addCellToPatch(pCell, pPatch);
}
else { // cell is not suitable - add to the matrix patch
if (showMe) cout << "matrixPatch = " << matrixPatch << "\t";
addCellToPatch(pCell, matrixPatch);
pPatch = 0;
}
}
if (showMe) cout << endl;
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion Landscape.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class Landscape {
void addPatchNum(int);
std::vector<int> getPatchNums() const { return patchnums; }
void generatePatches(); // create an artificial landscape
void allocatePatches(Species*); // create patches for a cell-based landscape
void allocatePatches(Species*, const bool& showMe = false); // create patches for a cell-based landscape
Patch* newPatch(
int // patch sequential no. (id no. is set to equal sequential no.)
);
Expand Down

0 comments on commit bb1e750

Please sign in to comment.