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

Method SetSize

avida-core/source/main/cResourceCount.cc:143–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void cResourceCount::SetSize(int num_resources)
144{
145 resource_name.ResizeClear(num_resources);
146 resource_initial.ResizeClear(num_resources);
147 resource_count.ResizeClear(num_resources);
148 decay_rate.ResizeClear(num_resources);
149 inflow_rate.ResizeClear(num_resources);
150 if(num_resources > 0) {
151 decay_precalc.ResizeClear(num_resources, PRECALC_DISTANCE+1);
152 inflow_precalc.ResizeClear(num_resources, PRECALC_DISTANCE+1);
153 }
154 geometry.ResizeClear(num_resources);
155
156 for (int i = 0; i < spatial_resource_count.GetSize(); i++) {
157 delete spatial_resource_count[i];
158 }
159
160 spatial_resource_count.ResizeClear(num_resources);
161
162 for(int i = 0; i < num_resources; i++){
163 spatial_resource_count[i] = new cSpatialResCount();
164 }
165
166 curr_grid_res_cnt.ResizeClear(num_resources);
167 curr_spatial_res_cnt.ResizeClear(num_resources);
168 cell_lists.ResizeClear(num_resources);
169 resource_name.SetAll("");
170 resource_initial.SetAll(0.0);
171 resource_count.SetAll(0.0);
172 decay_rate.SetAll(0.0);
173 inflow_rate.SetAll(0.0);
174 decay_precalc.SetAll(1.0); // This is 1-inflow, so there should be no inflow by default, JEB
175 inflow_precalc.SetAll(0.0);
176 geometry.SetAll(nGeometry::GLOBAL);
177 curr_grid_res_cnt.SetAll(0.0);
178 //DO spacial resources need to be set to zero?
179}
180
181cResourceCount::~cResourceCount()
182{

Callers 1

InitResourcesMethod · 0.80

Calls 3

ResizeClearMethod · 0.45
GetSizeMethod · 0.45
SetAllMethod · 0.45

Tested by 1

InitResourcesMethod · 0.64