MCPcopy Create free account
hub / github.com/devosoft/avida / SetCellList

Method SetCellList

avida-core/source/main/cSpatialResCount.cc:216–231  ·  view source on GitHub ↗

Set all the individual cells to their initial values */

Source from the content-addressed store, hash-verified

214
215/* Set all the individual cells to their initial values */
216void cSpatialResCount::SetCellList(Apto::Array<cCellResource>* in_cell_list_ptr)
217{
218 cell_list_ptr = in_cell_list_ptr;
219 for (int i = 0; i < cell_list_ptr->GetSize(); i++) {
220 int cell_id = (*cell_list_ptr)[i].GetId();
221
222 /* Be sure the user entered a valid cell id or if the the program is loading
223 the resource for the testCPU that does not have a grid set up */
224
225 if (cell_id >= 0 && cell_id <= grid.GetSize()) {
226 Rate((*cell_list_ptr)[i].GetId(), (*cell_list_ptr)[i].GetInitial());
227 State((*cell_list_ptr)[i].GetId());
228 Element(cell_id).SetInitial((*cell_list_ptr)[i].GetInitial());
229 }
230 }
231}
232
233/* Set the rate variable for one element using the array index */
234

Callers 1

SetupMethod · 0.80

Calls 4

GetIdMethod · 0.80
GetSizeMethod · 0.45
GetInitialMethod · 0.45
SetInitialMethod · 0.45

Tested by

no test coverage detected