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

Method UpdateResourceCount

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

Source from the content-addressed store, hash-verified

8551}
8552
8553void cPopulation::UpdateResourceCount(const int Verbosity, cWorld* world) {
8554 const cResourceLib & resource_lib = environment.GetResourceLib();
8555 int global_res_index = -1;
8556 int deme_res_index = -1;
8557 int num_deme_res = 0;
8558
8559 //setting size of global and deme-level resources
8560 for(int i = 0; i < resource_lib.GetSize(); i++) {
8561 cResource * res = resource_lib.GetResource(i);
8562 if (res->GetDemeResource())
8563 num_deme_res++;
8564 }
8565
8566 for(int i = 0; i < GetNumDemes(); i++) {
8567 cResourceCount tmp_deme_res_count(num_deme_res);
8568 GetDeme(i).SetDemeResourceCount(tmp_deme_res_count);
8569 }
8570
8571 for (int i = 0; i < resource_lib.GetSize(); i++) {
8572 cResource * res = resource_lib.GetResource(i);
8573 if (!res->GetDemeResource()) {
8574 global_res_index++;
8575 const double decay = 1.0 - res->GetOutflow();
8576 resource_count.Setup(world, global_res_index, res->GetName(), res->GetInitial(),
8577 res->GetInflow(), decay,
8578 res->GetGeometry(), res->GetXDiffuse(),
8579 res->GetXGravity(), res->GetYDiffuse(),
8580 res->GetYGravity(), res->GetInflowX1(),
8581 res->GetInflowX2(), res->GetInflowY1(),
8582 res->GetInflowY2(), res->GetOutflowX1(),
8583 res->GetOutflowX2(), res->GetOutflowY1(),
8584 res->GetOutflowY2(), res->GetCellListPtr(),
8585 res->GetCellIdListPtr(), Verbosity,
8586 res->GetPeaks(),
8587 res->GetMinHeight(), res->GetMinRadius(), res->GetRadiusRange(),
8588 res->GetAh(), res->GetAr(),
8589 res->GetAcx(), res->GetAcy(),
8590 res->GetHStepscale(), res->GetRStepscale(),
8591 res->GetCStepscaleX(), res->GetCStepscaleY(),
8592 res->GetHStep(), res->GetRStep(),
8593 res->GetCStepX(), res->GetCStepY(),
8594 res->GetUpdateDynamic(), res->GetPeakX(), res->GetPeakY(),
8595 res->GetHeight(), res->GetSpread(), res->GetPlateau(), res->GetOutflow(),
8596 res->GetMaxX(), res->GetMinX(), res->GetMaxY(), res->GetMinY(), res->GetAscaler(), res->GetUpdateStep(),
8597 res->GetHalo(), res->GetHaloInnerRadius(), res->GetHaloWidth(),
8598 res->GetHaloAnchorX(), res->GetHaloAnchorY(), res->GetMoveSpeed(), res->GetMoveResistance(),
8599 res->GetPlateauInflow(), res->GetPlateauOutflow(), res->GetConeInflow(), res->GetConeOutflow(),
8600 res->GetGradientInflow(), res->GetIsPlateauCommon(), res->GetFloor(), res->GetHabitat(),
8601 res->GetMinSize(), res->GetMaxSize(), res->GetConfig(), res->GetCount(), res->GetResistance(), res->GetDamage(),
8602 res->GetDeathOdds(), res->IsPath(), res->IsHammer(),
8603 res->GetInitialPlatVal(), res->GetThreshold(), res->GetRefuge(), res->GetGradient()
8604 );
8605
8606 } else if (res->GetDemeResource()) {
8607 deme_res_index++;
8608 for(int j = 0; j < GetNumDemes(); j++) {
8609 GetDeme(j).SetupDemeRes(deme_res_index, res, Verbosity, world);
8610 // could add deme resources to global resource stats here

Callers 1

ProcessMethod · 0.80

Calls 15

GetDemeResourceMethod · 0.80
SetDemeResourceCountMethod · 0.80
GetGeometryMethod · 0.80
GetXDiffuseMethod · 0.80
GetXGravityMethod · 0.80
GetYDiffuseMethod · 0.80
GetYGravityMethod · 0.80
GetInflowX1Method · 0.80
GetInflowX2Method · 0.80
GetInflowY1Method · 0.80
GetInflowY2Method · 0.80
GetOutflowX1Method · 0.80

Tested by

no test coverage detected