[Avida-SVN] r2517 - in development: documentation source/main

baerb at myxo.css.msu.edu baerb at myxo.css.msu.edu
Thu Apr 3 13:02:50 PDT 2008


Author: baerb
Date: 2008-04-03 16:02:50 -0400 (Thu, 03 Apr 2008)
New Revision: 2517

Modified:
   development/documentation/actions.html
   development/source/main/cEnvironment.cc
   development/source/main/cResource.cc
   development/source/main/cResource.h
Log:

Fixed a problem where new cell resources with the same cell id were creating
new entries in the cell list instead of replacing the information in the
existing structure.

Ran the program to generate a current version of actions.html



Modified: development/documentation/actions.html
===================================================================
--- development/documentation/actions.html	2008-04-03 14:42:35 UTC (rev 2516)
+++ development/documentation/actions.html	2008-04-03 20:02:50 UTC (rev 2517)
@@ -9,7 +9,7 @@
 
 <div class="revision">
 Revised 2006-09-03 DMB
-<br>Generated Fri Feb 29 12:15:08 2008 by make_actions_html</div>
+<br>Generated Thu Apr  3 16:13:04 2008 by make_actions_html</div>
 
 <p>
 <a href="index.html">Return to the Index</a> &nbsp;|&nbsp;
@@ -62,12 +62,12 @@
       <a href="#ChangeEnvironment">ChangeEnvironment</a><br>
       <a href="#compete_demes">compete_demes</a><br>
       <a href="#CompeteDemes">CompeteDemes</a><br>
+      <a href="#CompeteOrganisms">CompeteOrganisms</a><br>
       <a href="#compete_organisms">compete_organisms</a><br>
-      <a href="#CompeteOrganisms">CompeteOrganisms</a><br>
       <a href="#connect_cells">connect_cells</a><br>
       <a href="#ConnectCells">ConnectCells</a><br>
+      <a href="#copy_deme">copy_deme</a><br>
       <a href="#CopyDeme">CopyDeme</a><br>
-      <a href="#copy_deme">copy_deme</a><br>
       <a href="#DelayedDemeEvent">DelayedDemeEvent</a><br>
       <a href="#DeletionLandscape">DeletionLandscape</a><br>
       <a href="#detail_parasite_pop">detail_parasite_pop</a><br>
@@ -122,8 +122,8 @@
       <a href="#InjectDemes">InjectDemes</a><br>
       <a href="#InjectParasite">InjectParasite</a><br>
       <a href="#InjectParasitePair">InjectParasitePair</a><br>
+      <a href="#InjectRandom">InjectRandom</a><br>
       <a href="#inject_random">inject_random</a><br>
-      <a href="#InjectRandom">InjectRandom</a><br>
       <a href="#InjectRange">InjectRange</a><br>
       <a href="#inject_range">inject_range</a><br>
       <a href="#InjectResource">InjectResource</a><br>
@@ -140,17 +140,17 @@
       <a href="#JoinGridRow">JoinGridRow</a><br>
       <a href="#KillProb">KillProb</a><br>
       <a href="#KillRate">KillRate</a><br>
-    <td valign="top">
       <a href="#KillRectangle">KillRectangle</a><br>
       <a href="#kill_rectangle">kill_rectangle</a><br>
+    <td valign="top">
       <a href="#LoadClone">LoadClone</a><br>
       <a href="#load_clone">load_clone</a><br>
       <a href="#load_dump_file">load_dump_file</a><br>
       <a href="#LoadPopulation">LoadPopulation</a><br>
       <a href="#ModMutProb">ModMutProb</a><br>
       <a href="#MutationalNeighborhood">MutationalNeighborhood</a><br>
+      <a href="#new_trial">new_trial</a><br>
       <a href="#NewTrial">NewTrial</a><br>
-      <a href="#new_trial">new_trial</a><br>
       <a href="#outflow_scaled_resource">outflow_scaled_resource</a><br>
       <a href="#OutflowScaledResource">OutflowScaledResource</a><br>
       <a href="#PairTestLandscape">PairTestLandscape</a><br>
@@ -174,11 +174,15 @@
       <a href="#PrintDemeAllStats">PrintDemeAllStats</a><br>
       <a href="#PrintDemeAverageData">PrintDemeAverageData</a><br>
       <a href="#PrintDemeDonorStats">PrintDemeDonorStats</a><br>
+      <a href="#PrintDemeFounders">PrintDemeFounders</a><br>
+      <a href="#PrintDemeReactionData">PrintDemeReactionData</a><br>
       <a href="#PrintDemeReplicationData">PrintDemeReplicationData</a><br>
       <a href="#PrintDemeResourceStats">PrintDemeResourceStats</a><br>
       <a href="#PrintDemeSpacialEnergyStats">PrintDemeSpacialEnergyStats</a><br>
       <a href="#PrintDemeSpacialSleepStats">PrintDemeSpacialSleepStats</a><br>
       <a href="#PrintDemeStats">PrintDemeStats</a><br>
+      <a href="#PrintDemeTasksData">PrintDemeTasksData</a><br>
+      <a href="#PrintDemeTasksExeData">PrintDemeTasksExeData</a><br>
       <a href="#print_depth_histogram">print_depth_histogram</a><br>
       <a href="#PrintDepthHistogram">PrintDepthHistogram</a><br>
       <a href="#print_detailed_fitness_data">print_detailed_fitness_data</a><br>
@@ -256,13 +260,14 @@
       <a href="#PrintViableTasksData">PrintViableTasksData</a><br>
       <a href="#RandomLandscape">RandomLandscape</a><br>
       <a href="#rate_kill">rate_kill</a><br>
+      <a href="#replicate_demes">replicate_demes</a><br>
       <a href="#ReplicateDemes">ReplicateDemes</a><br>
-      <a href="#replicate_demes">replicate_demes</a><br>
       <a href="#reset_demes">reset_demes</a><br>
       <a href="#ResetDemes">ResetDemes</a><br>
       <a href="#SampleLandscape">SampleLandscape</a><br>
       <a href="#save_clone">save_clone</a><br>
       <a href="#SaveClone">SaveClone</a><br>
+      <a href="#SaveDemeFounders">SaveDemeFounders</a><br>
       <a href="#SaveHistoricPopulation">SaveHistoricPopulation</a><br>
       <a href="#SaveHistoricSexPopulation">SaveHistoricSexPopulation</a><br>
       <a href="#SaveParasitePopulation">SaveParasitePopulation</a><br>
@@ -273,6 +278,7 @@
       <a href="#SetCellResource">SetCellResource</a><br>
       <a href="#SetEnvironmentInputs">SetEnvironmentInputs</a><br>
       <a href="#SetEnvironmentRandomMask">SetEnvironmentRandomMask</a><br>
+      <a href="#SetMigrationRate">SetMigrationRate</a><br>
       <a href="#SetMutProb">SetMutProb</a><br>
       <a href="#SetNumInstBefore0Energy">SetNumInstBefore0Energy</a><br>
       <a href="#SetOptimizeMinMax">SetOptimizeMinMax</a><br>
@@ -883,15 +889,6 @@
   </p>
 </li>
 <li><p>
-  <strong><a name="compete_organisms">compete_organisms</a></strong>
-  <i>[int type=1]</i>
-  </p>
-  <p>
-    <font color="red">DEPRECATED</font>
-
-  </p>
-</li>
-<li><p>
   <strong><a name="CompeteOrganisms">CompeteOrganisms</a></strong>
   <i>[int type=0] [int parents_survive=0] [double scaled_time=1.0] [int dynamic_scaling=0]</i>
   </p>
@@ -913,6 +910,15 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="compete_organisms">compete_organisms</a></strong>
+  <i>[int type=1]</i>
+  </p>
+  <p>
+    <font color="red">DEPRECATED</font>
+
+  </p>
+</li>
+<li><p>
   <strong><a name="connect_cells">connect_cells</a></strong>
   <i>&lt;int cellA_x&gt; &lt;int cellA_y&gt; &lt;int cellB_x&gt; &lt;int cellB_y&gt;</i>
   </p>
@@ -931,20 +937,20 @@
   </p>
 </li>
 <li><p>
-  <strong><a name="CopyDeme">CopyDeme</a></strong>
+  <strong><a name="copy_deme">copy_deme</a></strong>
   <i>&lt;int src_id&gt; &lt;int dest_id&gt;</i>
   </p>
   <p>
-  
+    <font color="red">DEPRECATED</font>
+
   </p>
 </li>
 <li><p>
-  <strong><a name="copy_deme">copy_deme</a></strong>
+  <strong><a name="CopyDeme">CopyDeme</a></strong>
   <i>&lt;int src_id&gt; &lt;int dest_id&gt;</i>
   </p>
   <p>
-    <font color="red">DEPRECATED</font>
-
+  
   </p>
 </li>
 <li><p>
@@ -1050,20 +1056,20 @@
   </p>
 </li>
 <li><p>
-  <strong><a name="inject_random">inject_random</a></strong>
+  <strong><a name="InjectRandom">InjectRandom</a></strong>
   <i>&lt;int length&gt; [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]</i>
   </p>
   <p>
-    <font color="red">DEPRECATED</font>
+    Injects a randomly generated genome of the supplied length into the population.
 
   </p>
 </li>
 <li><p>
-  <strong><a name="InjectRandom">InjectRandom</a></strong>
+  <strong><a name="inject_random">inject_random</a></strong>
   <i>&lt;int length&gt; [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]</i>
   </p>
   <p>
-    Injects a randomly generated genome of the supplied length into the population.
+    <font color="red">DEPRECATED</font>
 
   </p>
 </li>
@@ -1208,21 +1214,21 @@
   </p>
 </li>
 <li><p>
-  <strong><a name="NewTrial">NewTrial</a></strong>
-  <i>No Arguments</i>
+  <strong><a name="new_trial">new_trial</a></strong>
+  <i>[int type=1]</i>
   </p>
   <p>
-    Immediately calculates the fitness of each organism in the population, saves this value for use with the CompeteOrganisms
-  event, and resets the state of all organisms.
+    <font color="red">DEPRECATED</font>
 
   </p>
 </li>
 <li><p>
-  <strong><a name="new_trial">new_trial</a></strong>
-  <i>[int type=1]</i>
+  <strong><a name="NewTrial">NewTrial</a></strong>
+  <i>No Arguments</i>
   </p>
   <p>
-    <font color="red">DEPRECATED</font>
+    Immediately calculates the fitness of each organism in the population, saves this value for use with the CompeteOrganisms
+  event, and resets the state of all organisms.
 
   </p>
 </li>
@@ -1236,20 +1242,20 @@
   </p>
 </li>
 <li><p>
-  <strong><a name="ReplicateDemes">ReplicateDemes</a></strong>
+  <strong><a name="replicate_demes">replicate_demes</a></strong>
   <i>[string trigger=full_deme]</i>
   </p>
   <p>
-  
+    <font color="red">DEPRECATED</font>
+
   </p>
 </li>
 <li><p>
-  <strong><a name="replicate_demes">replicate_demes</a></strong>
+  <strong><a name="ReplicateDemes">ReplicateDemes</a></strong>
   <i>[string trigger=full_deme]</i>
   </p>
   <p>
-    <font color="red">DEPRECATED</font>
-
+  
   </p>
 </li>
 <li><p>
@@ -1290,6 +1296,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="SetMigrationRate">SetMigrationRate</a></strong>
+  <i>[double rate=0.0]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="SetMutProb">SetMutProb</a></strong>
   <i>[string mut_type="copy"] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]</i>
   </p>
@@ -1764,6 +1778,22 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDemeFounders">PrintDemeFounders</a></strong>
+  <i>[string fname="deme_founders.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="PrintDemeReactionData">PrintDemeReactionData</a></strong>
+  <i>[string fname="deme_reactions.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintDemeReplicationData">PrintDemeReplicationData</a></strong>
   <i>[string fname="deme_repl.dat"]</i>
   </p>
@@ -1804,6 +1834,22 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDemeTasksData">PrintDemeTasksData</a></strong>
+  <i>[string fname="deme_tasks.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="PrintDemeTasksExeData">PrintDemeTasksExeData</a></strong>
+  <i>[string fname="deme_tasks_exe.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="print_depth_histogram">print_depth_histogram</a></strong>
   <i>[string fname="depth_histogram.dat"]</i>
   </p>
@@ -2521,6 +2567,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="SaveDemeFounders">SaveDemeFounders</a></strong>
+  <i>[string fname=""]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="SetVerbose">SetVerbose</a></strong>
   <i>[string verbosity=""]</i>
   </p>

Modified: development/source/main/cEnvironment.cc
===================================================================
--- development/source/main/cEnvironment.cc	2008-04-03 14:42:35 UTC (rev 2516)
+++ development/source/main/cEnvironment.cc	2008-04-03 20:02:50 UTC (rev 2517)
@@ -527,9 +527,15 @@
       }
     }
     for (int i=0; i < cell_list.GetSize(); i++) {
-      cCellResource tmp_cell_resource(cell_list[i],tmp_initial,
-                                      tmp_inflow, tmp_outflow);
-      this_resource->AddCellResource(tmp_cell_resource);
+      if (cCellResource *CellResourcePtr = 
+            this_resource->GetCellResourcePtr(cell_list[i])) {
+        this_resource->UpdateCellResource(CellResourcePtr,tmp_initial,
+                                          tmp_inflow, tmp_outflow);
+      } else {
+        cCellResource tmp_cell_resource(cell_list[i],tmp_initial,
+                                        tmp_inflow, tmp_outflow);
+        this_resource->AddCellResource(tmp_cell_resource);
+      }
     }
     
   }

Modified: development/source/main/cResource.cc
===================================================================
--- development/source/main/cResource.cc	2008-04-03 14:42:35 UTC (rev 2516)
+++ development/source/main/cResource.cc	2008-04-03 20:02:50 UTC (rev 2517)
@@ -115,3 +115,28 @@
   }
   return false;
 }
+
+/* Return a pointer to cell resource with a given cell id, if there is no 
+   cell resource with that id return NULL */
+cCellResource *cResource::GetCellResourcePtr(int _id) {
+
+  bool found = false;
+  int cell_index = 0;
+  while (cell_index < cell_list.GetSize() && !found) {
+    if (cell_list[cell_index].GetId() == _id) {
+      return(&cell_list[cell_index]);
+      found = true;
+    } else {
+      cell_index++;
+    }
+  }
+  return(NULL);
+}
+
+/* Update the values of given cell resource */
+void cResource::UpdateCellResource(cCellResource *_CellResourcePtr, double _initial, 
+                        double _inflow, double _outflow) {
+  _CellResourcePtr->SetInitial(_initial);
+  _CellResourcePtr->SetInflow(_inflow);
+  _CellResourcePtr->SetOutflow(_outflow);
+}

Modified: development/source/main/cResource.h
===================================================================
--- development/source/main/cResource.h	2008-04-03 14:42:35 UTC (rev 2516)
+++ development/source/main/cResource.h	2008-04-03 20:02:50 UTC (rev 2517)
@@ -53,6 +53,9 @@
   double GetInitial() const { return initial; }
   double GetInflow() const { return inflow; }
   double GetOutflow() const { return outflow; }
+  double SetInitial(double _initial) { initial = _initial; }
+  double SetInflow(double _inflow) { inflow = _inflow; }
+  double SetOutflow(double _outflow) { outflow = _outflow; }
 };
 
 /* class to hold all information for a single resource */
@@ -131,6 +134,9 @@
   bool SetDemeResource(cString _deme_resource);
   bool SetEnergyResource(cString _energy_resource);
   void AddCellResource(cCellResource new_cell) { cell_list.Push(new_cell); }
+  cCellResource *GetCellResourcePtr(int _id);
+  void UpdateCellResource(cCellResource *_CellResoucePtr, double _initial, 
+                          double _inflow, double _outflow);
 };
 
 




More information about the Avida-cvs mailing list