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

Method UpdateInflow

avida-core/source/main/cPopulation.cc:8398–8409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8396}
8397
8398void cPopulation::UpdateInflow(const cString& res_name, const double change)
8399{
8400 const cResourceLib & resource_lib = environment.GetResourceLib();
8401 for (int i = 0; i < resource_lib.GetSize(); i++) {
8402 cResource* res = resource_lib.GetResource(i);
8403 if (res->GetName() == res_name) {
8404 resource_count.SetInflow(res_name, resource_count.GetInflow(res_name) + change);
8405 }
8406 }
8407 assert(resource_count.GetInflow(res_name) >= 0);
8408 if (resource_count.GetInflow(res_name) < 0) cout << "WARNING: update to inflow rate results in negative resource inflow!" << endl;
8409}
8410
8411void cPopulation::ExecutePredatoryResource(cAvidaContext& ctx, const int cell_id, const double pred_odds, const int juvs_per, const bool hammer)
8412{

Callers 2

ProcessMethod · 0.80
ProcessMethod · 0.80

Calls 5

GetSizeMethod · 0.45
GetResourceMethod · 0.45
GetNameMethod · 0.45
SetInflowMethod · 0.45
GetInflowMethod · 0.45

Tested by

no test coverage detected