[Avida-SVN] r3043 - in development/source: cpu main
beckma24 at myxo.css.msu.edu
beckma24 at myxo.css.msu.edu
Mon Dec 15 07:21:10 PST 2008
Author: beckma24
Date: 2008-12-15 10:21:09 -0500 (Mon, 15 Dec 2008)
New Revision: 3043
Modified:
development/source/cpu/cHardwareCPU.cc
development/source/main/cDeme.cc
development/source/main/cDeme.h
development/source/main/cPopulation.cc
Log:
Changed repro-deme so that the deme gets replicated at the end of cPopulation::ProcessStep
Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc 2008-12-15 14:59:37 UTC (rev 3042)
+++ development/source/cpu/cHardwareCPU.cc 2008-12-15 15:21:09 UTC (rev 3043)
@@ -2673,7 +2673,7 @@
return false; // in test CPU
// this function will become to depend on a predicate, but I am still thinking of how to do this (BEB)
- m_world->GetPopulation().ReplicateDeme(*sourceDeme);
+ sourceDeme->ReplicateDeme();
return true;
}
Modified: development/source/main/cDeme.cc
===================================================================
--- development/source/main/cDeme.cc 2008-12-15 14:59:37 UTC (rev 3042)
+++ development/source/main/cDeme.cc 2008-12-15 15:21:09 UTC (rev 3043)
@@ -46,6 +46,8 @@
birth_count_perslot = 0;
m_world = world;
+ replicateDeme = false;
+
_current_merit = 1.0;
_next_merit = 1.0;
@@ -258,6 +260,8 @@
consecutiveSuccessfulEventPeriods = 0;
+ replicateDeme = false;
+
cur_task_exe_count.SetAll(0);
cur_reaction_count.SetAll(0);
Modified: development/source/main/cDeme.h
===================================================================
--- development/source/main/cDeme.h 2008-12-15 14:59:37 UTC (rev 3042)
+++ development/source/main/cDeme.h 2008-12-15 15:21:09 UTC (rev 3043)
@@ -56,6 +56,8 @@
tArray<int> cell_ids;
int width; //!< Width of this deme.
+ bool replicateDeme;
+
// The following should be moved to cDemePhenotype / cPopulationPhenotype
int cur_birth_count; //!< Number of organisms that have been born into this deme since reset.
int last_birth_count;
@@ -125,7 +127,7 @@
tVector<cOrgMovementPredicate*> movement_pred_list; // Movement Predicates
public:
- cDeme() : _id(0), width(0), cur_birth_count(0), last_birth_count(0), cur_org_count(0), last_org_count(0), injected_count(0), birth_count_perslot(0),
+ cDeme() : _id(0), width(0), replicateDeme(false), cur_birth_count(0), last_birth_count(0), cur_org_count(0), last_org_count(0), injected_count(0), birth_count_perslot(0),
_age(0), generation(0), total_org_energy(0.0),
time_used(0), gestation_time(0), cur_normalized_time_used(0.0), last_normalized_time_used(0.0),
MSG_sendFailed(0), MSG_dropped(0), MSG_SuccessfullySent(0), MSG_sent(0), total_energy_testament(0.0),
@@ -179,6 +181,9 @@
bool IsEmpty() const { return cur_org_count == 0; }
bool IsFull() const { return cur_org_count == cell_ids.GetSize(); }
+
+ bool TestReplication() const { return replicateDeme; }
+ void ReplicateDeme() { replicateDeme = true; }
int GetSlotFlowRate() const;
int GetEventsTotal() const { return eventsTotal; }
Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc 2008-12-15 14:59:37 UTC (rev 3042)
+++ development/source/main/cPopulation.cc 2008-12-15 15:21:09 UTC (rev 3043)
@@ -2575,7 +2575,9 @@
else if (m_world->GetConfig().DEMES_REPLICATE_BIRTHS.Get()
&& (deme.GetBirthCount() >= m_world->GetConfig().DEMES_REPLICATE_BIRTHS.Get())) ReplicateDeme(deme);
else if (m_world->GetConfig().DEMES_REPLICATE_ORGS.Get()
- && (deme.GetOrgCount() >= m_world->GetConfig().DEMES_REPLICATE_ORGS.Get())) ReplicateDeme(deme);
+ && (deme.GetOrgCount() >= m_world->GetConfig().DEMES_REPLICATE_ORGS.Get())) ReplicateDeme(deme);
+ else if(deme.TestReplication())
+ ReplicateDeme(deme);
}
// Print out all statistics about individual demes
More information about the Avida-cvs
mailing list