[Avida-SVN] r2964 - branches/movement/source/actions

grabow38 at myxo.css.msu.edu grabow38 at myxo.css.msu.edu
Mon Nov 24 05:17:15 PST 2008


Author: grabow38
Date: 2008-11-24 08:17:15 -0500 (Mon, 24 Nov 2008)
New Revision: 2964

Modified:
   branches/movement/source/actions/PopulationActions.cc
Log:
In cActionInjectDemes: Added guards to prevent breaking consistency tests with organism placement and facing on injection.

Modified: branches/movement/source/actions/PopulationActions.cc
===================================================================
--- branches/movement/source/actions/PopulationActions.cc	2008-11-23 20:23:02 UTC (rev 2963)
+++ branches/movement/source/actions/PopulationActions.cc	2008-11-24 13:17:15 UTC (rev 2964)
@@ -575,30 +575,37 @@
                                         m_merit, m_lineage_label, m_neutral_metric);
         m_world->GetPopulation().GetDeme(i).IncInjectedCount();
       }
-    } else {
+    } 
+    else {
       for(int i = start_deme; i <= end_deme; ++i) {
-        // WARNING: initial ancestor has already be injected into the population
-        //           calling this will overwrite it.
-       // m_world->GetPopulation().Inject(genome,
-       //                                 m_world->GetPopulation().GetDeme(i).GetCellID(0),
-       //                                 m_merit, m_lineage_label, m_neutral_metric);
         // @WRE: use configuration value to figure out cell ID for placement 15-Nov-2008
-        m_world->GetPopulation().Inject(genome,
-                                        m_world->GetPopulation().DemeSelectInjectionCell( m_world->GetPopulation().GetDeme(i), 0),
-                                        m_merit, m_lineage_label, m_neutral_metric);
-                
-        cDeme& deme =  m_world->GetPopulation().GetDeme(i);
-        cPopulationCell& cell =  m_world->GetPopulation().GetCell( m_world->GetPopulation().DemeSelectInjectionCell( m_world->GetPopulation().GetDeme(i), 0));
+        // @ LMG: Guards to avoid breaking consistency tests
+        if (m_world->GetConfig().DEMES_ORGANISM_PLACEMENT.Get() && m_world->GetConfig().DEMES_USE_GERMLINE.Get()) {
+          m_world->GetPopulation().Inject(genome,
+                                          m_world->GetPopulation().DemeSelectInjectionCell( m_world->GetPopulation().GetDeme(i), 0),
+                                          m_merit, m_lineage_label, m_neutral_metric);
+        } else {
+          // WARNING: initial ancestor has already be injected into the population
+          //           calling this will overwrite it.
+            m_world->GetPopulation().Inject(genome,
+                                     m_world->GetPopulation().GetDeme(i).GetCellID(0),
+                                     m_merit, m_lineage_label, m_neutral_metric);
+        }
         
-        m_world->GetPopulation().DemePostInjection(deme, cell);
+        // @ LMG: Another guard to prevent breaking tests
+        if (m_world->GetConfig().DEMES_ORGANISM_FACING.Get()) {
+          cDeme& deme =  m_world->GetPopulation().GetDeme(i);
+          cPopulationCell& cell =  m_world->GetPopulation().GetCell( m_world->GetPopulation().DemeSelectInjectionCell( m_world->GetPopulation().GetDeme(i), 0));
+          m_world->GetPopulation().DemePostInjection(deme, cell);
+        }
         
         m_world->GetPopulation().GetDeme(i).IncInjectedCount();
       }
     }
   }
 };
+  
 
-
 /*! Injects one or more organisms into all demes in the population at a specified cell.
  *  Note: This gets the genotype from the germline, so germline use is required
  *  Note: one organism is inserted each time this is called, and it will stop




More information about the Avida-cvs mailing list