[Avida-SVN] r3579 - branches/topology-manager/source/main

pakanati at myxo.css.msu.edu pakanati at myxo.css.msu.edu
Sun Dec 27 19:26:13 PST 2009


Author: pakanati
Date: 2009-12-27 22:26:12 -0500 (Sun, 27 Dec 2009)
New Revision: 3579

Modified:
   branches/topology-manager/source/main/cDeme.h
   branches/topology-manager/source/main/cTopoElement.h
   branches/topology-manager/source/main/cTopologyManager.cc
   branches/topology-manager/source/main/cTopologyManager.h
Log:
inline problem

Modified: branches/topology-manager/source/main/cDeme.h
===================================================================
--- branches/topology-manager/source/main/cDeme.h	2009-12-24 02:43:53 UTC (rev 3578)
+++ branches/topology-manager/source/main/cDeme.h	2009-12-28 03:26:12 UTC (rev 3579)
@@ -26,6 +26,7 @@
 
 #include <set>
 #include <vector>
+#include <limits>
 
 #include "cDemeCellEvent.h"
 #include "cGermline.h"
@@ -47,7 +48,7 @@
 class cDemePredicate;
 
 /*! Demes are groups of cells in the population that are somehow bound together
-as a unit.  The deme object is used from within cPopulation to manage these 
+as a unit.  The deme object is used from within cPopulation to manage these
 groups. */
 
 class cDeme
@@ -61,12 +62,12 @@
 	bool replicateDeme;
 	bool treatable;
   std::set<int> treatment_ages;
-	
+
 // 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;
   int cur_org_count; //!< Number of organisms are currently in this deme.
-  int last_org_count; 
+  int last_org_count;
   int injected_count; //<! Number of organisms that have been injected into this deme
   int birth_count_perslot;
   int _age; //!< Age of this deme, in updates.
@@ -75,7 +76,7 @@
   int time_used; //!< number of cpu cycles this deme has used
   int gestation_time; // Time used during last generation
   double cur_normalized_time_used; // normalized by merit and number of orgs
-  double last_normalized_time_used; 
+  double last_normalized_time_used;
 	unsigned int MSG_sendFailed;
 	unsigned int MSG_dropped;
 	unsigned int MSG_SuccessfullySent;
@@ -91,61 +92,61 @@
   unsigned int consecutiveSuccessfulEventPeriods;
   int sleeping_count; //!< Number of organisms currently sleeping
   cDoubleSum energyUsage;
-  
+
   double total_energy_donated;
   double total_energy_received;
   double total_energy_applied;
-  
+
   tArray<int> cur_task_exe_count;
   tArray<int> cur_reaction_count;
   tArray<int> last_task_exe_count;
   tArray<int> last_reaction_count;
-  
+
   tArray<int> cur_org_task_count;
   tArray<int> cur_org_task_exe_count;
   tArray<int> cur_org_reaction_count;
   tArray<int> last_org_task_count;
   tArray<int> last_org_task_exe_count;
   tArray<int> last_org_reaction_count;
-  
-  double avg_founder_generation;  //Average generation of current founders                                    
-  double generations_per_lifetime; //Generations between current founders and founders of parent  
 
+  double avg_founder_generation;  //Average generation of current founders
+  double generations_per_lifetime; //Generations between current founders and founders of parent
+
   // End of phenotypic traits
-  
+
   cGermline _germline; //!< The germline for this deme, if used.
 
   cDeme(const cDeme&); // @not_implemented
-  
+
   cResourceCount deme_resource_count; //!< Resources available to the deme
   tArray<int> energy_res_ids; //!< IDs of energy resources
-  
+
   tVector<cDemeCellEvent> cell_events;
   std::vector<std::pair<int, int> > event_slot_end_points; // (slot end point, slot flow rate)
-  
+
   int         m_germline_genotype_id; // Genotype id of germline (if in use)
   tArray<int> m_founder_genotype_ids; // List of genotype ids used to found deme.
                                       // Keep a lease on these genotypes for the deme's lifetime.
-  tArray<cPhenotype> m_founder_phenotypes; // List of phenotypes of founder organsisms                                    
-                                      
+  tArray<cPhenotype> m_founder_phenotypes; // List of phenotypes of founder organsisms
+
   cMerit _current_merit; //!< Deme merit applied to all organisms living in this deme.
   cMerit _next_merit; //!< Deme merit that will be inherited upon deme replication.
 
   tVector<cDemePredicate*> deme_pred_list; // Deme Predicates
   tVector<cOrgMessagePredicate*> message_pred_list; // Message Predicates
   tVector<cOrgMovementPredicate*> movement_pred_list;  // Movement Predicates
-	
+
 	// For the points infrastructure
-	double points; 
-	unsigned int migrations_out; 
+	double points;
+	unsigned int migrations_out;
 	unsigned int migrations_in;
 	unsigned int suicides;
-	
-  
+
+
 public:
   cDeme() : _id(0), width(0), replicateDeme(false), treatable(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), 
+            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), energyInjectedIntoOrganisms(0.0), energyRemainingInDemeAtReplication(0.0), total_energy_testament(0.0),
             eventsTotal(0), eventsKilled(0), eventsKilledThisSlot(0), eventKillAttempts(0), eventKillAttemptsThisSlot(0),
             consecutiveSuccessfulEventPeriods(0), sleeping_count(0),
@@ -175,7 +176,7 @@
   void KillAll();
 
   void UpdateStats();
-  
+
   int GetBirthCount() const { return cur_birth_count; }
   int GetLastBirthCount() const { return last_birth_count; }
   void IncBirthCount() { cur_birth_count++; birth_count_perslot++;}
@@ -190,7 +191,7 @@
   int GetSleepingCount() const { return sleeping_count; }
   void IncSleepingCount() { sleeping_count++; }
   void DecSleepingCount() { sleeping_count--; }
-  
+
   int GetGeneration() const { return generation; }
 
   int GetInjectedCount() const { return injected_count; }
@@ -198,10 +199,10 @@
 
   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; }
-	
+
 	bool isTreatable() const { return treatable; }
 	void setTreatable(bool value) { treatable = value; }
   void AddTreatmentAge(const int age) { treatment_ages.insert(age); }
@@ -215,13 +216,13 @@
   int GetEventKillAttempts() const { return eventKillAttempts; }
   int GetEventKillAttemptsThisSlot() const { return eventKillAttemptsThisSlot; }
   int GetConsecutiveSuccessfulEventPeriods() const { return consecutiveSuccessfulEventPeriods;}
-  
+
   // -= Germline =-
   //! Returns this deme's germline.
   cGermline& GetGermline() { return _germline; }
   //! Replaces this deme's germline.
   void ReplaceGermline(const cGermline& germline);
-  
+
   //! Update this deme's merit by rotating the heritable merit to the current merit.
   void UpdateDemeMerit();
   //! Update this deme's merit from the given source; merit will be applied to organisms now.
@@ -254,10 +255,10 @@
   // -= Update support =-
   //! Called once, at the end of every update.
   void ProcessUpdate();
-  /*! Returns the age of this deme, updates.  Age is defined as the number of 
+  /*! Returns the age of this deme, updates.  Age is defined as the number of
     updates since the last time Reset() was called. */
   int GetAge() const { return _age; }
-  
+
   const cResourceCount& GetDemeResourceCount() const { return deme_resource_count; }
   void SetDemeResourceCount(const cResourceCount in_res) { deme_resource_count = in_res; }
   void ResizeSpatialGrids(const int in_x, const int in_y) { deme_resource_count.ResizeSpatialGrids(in_x, in_y); }
@@ -270,17 +271,17 @@
   void Update(double time_step) { deme_resource_count.Update(time_step); }
   int GetRelativeCellID(int absolute_cell_id) const { return absolute_cell_id % GetSize(); } //!< assumes all demes are the same size
   int GetAbsoluteCellID(int relative_cell_id) const { return relative_cell_id + (_id * GetSize()); } //!< assumes all demes are the same size
-	
+
   void SetCellEventGradient(int x1, int y1, int x2, int y2, int delay, int duration, bool static_pos, int time_to_live);
   int GetNumEvents();
   void SetCellEvent(int x1, int y1, int x2, int y2, int delay, int duration, bool static_position, int total_events);
-  void SetCellEventSlots(int x1, int y1, int x2, int y2, int delay, int duration, 
-                         bool static_position, int m_total_slots, int m_total_events_per_slot_max, 
+  void SetCellEventSlots(int x1, int y1, int x2, int y2, int delay, int duration,
+                         bool static_position, int m_total_slots, int m_total_events_per_slot_max,
                          int m_total_events_per_slot_min, int m_tolal_event_flow_levels);
 
   bool KillCellEvent(const int eventID);
   cDemeCellEvent* GetCellEvent(const int i) { return &cell_events[i]; };
-  
+
   double CalculateTotalEnergy() const;
   double CalculateTotalInitialEnergyResources() const;
 	double GetEnergyInjectedIntoOrganisms() const { return energyInjectedIntoOrganisms; }
@@ -289,8 +290,8 @@
 	void SetEnergyRemainingInDemeAtReplication(double energy) { energyRemainingInDemeAtReplication = energy; }
   double GetTotalEnergyTestament() { return total_energy_testament; }
   void IncreaseTotalEnergyTestament(double increment) { total_energy_testament += increment; }
-  
-  void IncTimeUsed(double merit) 
+
+  void IncTimeUsed(double merit)
     { time_used++; cur_normalized_time_used += 1.0/merit/(double)cur_org_count; }
   int GetTimeUsed() { return time_used; }
   int GetGestationTime() { return gestation_time; }
@@ -302,9 +303,9 @@
   void AddFounder(cGenotype& _in_genotype, cPhenotype * _in_phenotype = NULL);
   tArray<int>& GetFounderGenotypeIDs() { return m_founder_genotype_ids; }
   tArray<cPhenotype>& GetFounderPhenotypes() { return m_founder_phenotypes; }
-  double GetAvgFounderGeneration() { return avg_founder_generation; }        
-  void UpdateGenerationsPerLifetime(double old_avg_founder_generation, tArray<cPhenotype>& new_founder_phenotypes);   
-  double GetGenerationsPerLifetime() { return generations_per_lifetime; }  
+  double GetAvgFounderGeneration() { return avg_founder_generation; }
+  void UpdateGenerationsPerLifetime(double old_avg_founder_generation, tArray<cPhenotype>& new_founder_phenotypes);
+  double GetGenerationsPerLifetime() { return generations_per_lifetime; }
 
   // --- Germline management --- //
   void ReplaceGermline(cGenotype& _in_genotype);
@@ -328,7 +329,7 @@
   void AddEventMoveBetweenTargetsPred(int times);
   void AddEventMigrateToTargetsPred(int times);
   void AddEventEventNUniqueIndividualsMovedIntoTargetPred(int times);
-	
+
 	// --- Messaging stats --- //
 	void IncMessageSent() { ++MSG_sent; }
 	void MessageSuccessfullySent() { ++MSG_SuccessfullySent; }
@@ -341,7 +342,7 @@
 
   // --- Pheromones --- //
   void AddPheromone(int absolute_cell_id, double value);
-	
+
 	// --- Points --- //
 	double GetNumberOfPoints() { return points; }
 	void AddNumberOfPoints(double num_points) { points += num_points; }
@@ -355,7 +356,7 @@
 	void ClearMigrationOut() { migrations_out = 0; }
 	void ClearMigrationIn() { migrations_in = 0; }
 	void ClearSuicides() { suicides = 0; }
-  
+
   // --- Energy Sharing --- //
   double GetEnergyDonated() const { return total_energy_donated; }
   double GetEnergyReceived() const { return total_energy_received; }

Modified: branches/topology-manager/source/main/cTopoElement.h
===================================================================
--- branches/topology-manager/source/main/cTopoElement.h	2009-12-24 02:43:53 UTC (rev 3578)
+++ branches/topology-manager/source/main/cTopoElement.h	2009-12-28 03:26:12 UTC (rev 3579)
@@ -36,7 +36,7 @@
   cTopoElement() { ; }
 
 public:
-  virtual ~cTopoElement();
+  virtual ~cTopoElement() {;}
 };
 
 

Modified: branches/topology-manager/source/main/cTopologyManager.cc
===================================================================
--- branches/topology-manager/source/main/cTopologyManager.cc	2009-12-24 02:43:53 UTC (rev 3578)
+++ branches/topology-manager/source/main/cTopologyManager.cc	2009-12-28 03:26:12 UTC (rev 3579)
@@ -63,9 +63,13 @@
     m_world->GetConfig().ENERGY_CAP.Set(std::numeric_limits<double>::max());
   }
 
+  /* From cPopulation.cc
   if(m_world->GetConfig().LOG_SLEEP_TIMES.Get() == 1)  {
     sleep_log = new tVector<pair<int,int> >[world_x*world_y];
   }
+  */
+
+
   // Print out world details
   if (world->GetVerbosity() > VERBOSE_NORMAL) {
     cout << "Building world " << world_x << "x" << world_y << "x" << world_z << " = " << num_cells << " organisms." << endl;
@@ -119,8 +123,6 @@
   world_z = world->GetConfig().WORLD_Z.Get();
 
   // What are the sizes of the demes that we're creating?
-  const int num_cells = world_x * world_y * world_z;
-  const int geometry = world->GetConfig().WORLD_GEOMETRY.Get();
 
   const int deme_size_x = world_x;
   const int deme_size_y = world_y / num_demes;
@@ -2705,7 +2707,8 @@
 }
 
 
-inline void cTopologyManager::AdjustSchedule(const cPopulationCell& cell, const cMerit& merit)
+//inline
+void cTopologyManager::AdjustSchedule(const cPopulationCell& cell, const cMerit& merit)
 {
   const int deme_id = cell.GetDemeID();
 //  cout << " CCC " << deme_id;

Modified: branches/topology-manager/source/main/cTopologyManager.h
===================================================================
--- branches/topology-manager/source/main/cTopologyManager.h	2009-12-24 02:43:53 UTC (rev 3578)
+++ branches/topology-manager/source/main/cTopologyManager.h	2009-12-28 03:26:12 UTC (rev 3579)
@@ -70,17 +70,17 @@
   cSchedule* schedule;                // Handles allocation of CPU cycles
 
   cPopulation* m_pop;
-  tArray<cPopulationCell>& cell_array;  // Local cells composing the population
+  tArray<cPopulationCell> cell_array;  // Local cells composing the population
   tArray<int> empty_cell_id_array;     // Used for PREFER_EMPTY birth methods
   cEnvironment& environment;          // Physics & Chemistry description
   int world_x;                         // Structured population width.
   int world_y;                         // Structured population height.
   int world_z; 						   // Population depth.
 
-  
+
   cTopologyManager(); // @not_implemented
-  
-  
+
+
 public:
   cWorld* m_world;
   cTopologyManager(cWorld* world); //, cPopulation* pop);
@@ -211,7 +211,8 @@
 
 
   int ScheduleOrganism();          // Determine next organism to be processed.
-  inline void AdjustSchedule(const cPopulationCell& cell, const cMerit& merit);
+  //inline
+  void AdjustSchedule(const cPopulationCell& cell, const cMerit& merit);
 
 
 };




More information about the Avida-cvs mailing list