diff --git a/Individual.cpp b/Individual.cpp index 4c86804..7ddc6fd 100644 --- a/Individual.cpp +++ b/Individual.cpp @@ -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); @@ -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 diff --git a/Landscape.cpp b/Landscape.cpp index dfcfa9a..9998063 100644 --- a/Landscape.cpp +++ b/Landscape.cpp @@ -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; @@ -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; diff --git a/Landscape.h b/Landscape.h index 75837da..a8d6020 100644 --- a/Landscape.h +++ b/Landscape.h @@ -232,7 +232,7 @@ class Landscape { void addPatchNum(int); std::vector 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.) );