[Avida-SVN] r2452 - in development: . source/analyze source/main source/tools

baerb at myxo.css.msu.edu baerb at myxo.css.msu.edu
Tue Mar 11 12:33:46 PDT 2008


Author: baerb
Date: 2008-03-11 15:33:46 -0400 (Tue, 11 Mar 2008)
New Revision: 2452

Modified:
   development/Avida.vcproj
   development/source/analyze/cAnalyzeTreeStats_Gamma.cc
   development/source/main/cPopulation.cc
   development/source/tools/tArray.h
Log:
Made minor code changes so that program runs on Windows
computers.

Added new files and changed directories for some existing
files in the .vcproj

Created a wrapper for qsort in tArray.h

Use that wrapper in cAnalyzeTreeStats_Gamma.cc

Call the Avida random number generator instead of
the linux system random() in one case in cPopulation.cc



Modified: development/Avida.vcproj
===================================================================
--- development/Avida.vcproj	2008-03-11 18:09:40 UTC (rev 2451)
+++ development/Avida.vcproj	2008-03-11 19:33:46 UTC (rev 2452)
@@ -253,6 +253,14 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\analyze\cAnalyzeTreeStats_CumulativeStemminess.h"
+				>
+			</File>
+			<File
+				RelativePath=".\source\analyze\cAnalyzeTreeStats_Gamma.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\targets\avida-viewer\cAnalyzeView.h"
 				>
 			</File>
@@ -365,6 +373,14 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\main\cDemeCellEvent.h"
+				>
+			</File>
+			<File
+				RelativePath=".\source\tools\cDemeProbSchedule.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\cDoubleSum.h"
 				>
 			</File>
@@ -649,6 +665,14 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\main\cPhenPlastGenotype.h"
+				>
+			</File>
+			<File
+				RelativePath=".\source\main\cPlasticPhenotype.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\main\cPopulation.h"
 				>
 			</File>
@@ -661,6 +685,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\tools\cProbDemeProbSchedule.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\cProbSchedule.h"
 				>
 			</File>
@@ -821,7 +849,7 @@
 				>
 			</File>
 			<File
-				RelativePath=".\source\tools\cThread.h"
+				RelativePath=".\source\platform\cThread.h"
 				>
 			</File>
 			<File
@@ -925,6 +953,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\platform\PlatformExpert.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\actions\PopulationActions.h"
 				>
 			</File>
@@ -1057,6 +1089,14 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\analyze\cAnalyzeTreeStats_CumulativeStemminess.cc"
+				>
+			</File>
+			<File
+				RelativePath=".\source\analyze\cAnalyzeTreeStats_Gamma.cc"
+				>
+			</File>
+			<File
 				RelativePath=".\source\targets\avida-viewer\cAnalyzeView.cc"
 				>
 			</File>
@@ -1149,6 +1189,14 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\main\cDemeCellEvent.cc"
+				>
+			</File>
+			<File
+				RelativePath=".\source\tools\cDemeProbSchedule.cc"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\cDoubleSum.cc"
 				>
 			</File>
@@ -1353,6 +1401,14 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\main\cPhenPlastGenotype.cc"
+				>
+			</File>
+			<File
+				RelativePath=".\source\main\cPlasticPhenotype.cc"
+				>
+			</File>
+			<File
 				RelativePath=".\source\main\cPopulation.cc"
 				>
 			</File>
@@ -1365,6 +1421,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\tools\cProbDemeProbSchedule.cc"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\cProbSchedule.cc"
 				>
 			</File>
@@ -1485,7 +1545,7 @@
 				>
 			</File>
 			<File
-				RelativePath=".\source\tools\cThread.cc"
+				RelativePath=".\source\platform\cThread.cc"
 				>
 			</File>
 			<File
@@ -1525,6 +1585,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\platform\PlatformExpert.cc"
+				>
+			</File>
+			<File
 				RelativePath=".\source\actions\PopulationActions.cc"
 				>
 			</File>

Modified: development/source/analyze/cAnalyzeTreeStats_Gamma.cc
===================================================================
--- development/source/analyze/cAnalyzeTreeStats_Gamma.cc	2008-03-11 18:09:40 UTC (rev 2451)
+++ development/source/analyze/cAnalyzeTreeStats_Gamma.cc	2008-03-11 19:33:46 UTC (rev 2452)
@@ -143,36 +143,9 @@
 
 // Quicksort functions.
 void QSortAGPhyloDepth(tArray<cAnalyzeGenotype *> &gen_array){
-  const int size = gen_array.GetSize();
-  cAnalyzeGenotype *c_gen_array[size];
-  
-  /* Copy unsorted array from gen_array into c_gen_array. */
-  for(int i = 0; i < size; i++){
-    c_gen_array[i] = (gen_array[i]);
-  }
-  
-  /* Quicksort c_gen_array. */
-  qsort(c_gen_array, size, sizeof(cAnalyzeGenotype*), CompareAGPhyloDepth);
-  
-  /* If qsort returned successfully, copy sorted array from c_gen_array into gen_array. */
-  for(int i = 0; i < size; i++){
-    gen_array[i] = (c_gen_array[i]);
-  }
-}  
+  gen_array.QSort(CompareAGPhyloDepth);
+} 
+
 void QSortAGUpdateBorn(tArray<cAnalyzeGenotype *> &gen_array){
-  const int size = gen_array.GetSize();
-  cAnalyzeGenotype *c_gen_array[size];
-  
-  /* Copy unsorted array from gen_array into c_gen_array. */
-  for(int i = 0; i < size; i++){
-    c_gen_array[i] = (gen_array[i]);
-  }
-  
-  /* Quicksort c_gen_array. */
-  qsort(c_gen_array, size, sizeof(cAnalyzeGenotype*), CompareAGUpdateBorn);
-  
-  /* If qsort returned successfully, copy sorted array from c_gen_array into gen_array. */
-  for(int i = 0; i < size; i++){
-    gen_array[i] = (c_gen_array[i]);
-  }
+  gen_array.QSort(CompareAGUpdateBorn);
 }  

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2008-03-11 18:09:40 UTC (rev 2451)
+++ development/source/main/cPopulation.cc	2008-03-11 19:33:46 UTC (rev 2452)
@@ -2180,11 +2180,10 @@
         if (cell_array[i].GetOrganism()->GetPhenotype().OK()) {
           // Get measurement, exclude parent
           if (parent_cell.GetID() != cell_array[i].GetID()) {
-            msr = random();
+            msr = m_world->GetRandom().GetDouble();
           } else {
             msr = 0.0;
           }
-
           if (max_msr < msr) {
             max_msr = msr;
             max_msrndx = i;

Modified: development/source/tools/tArray.h
===================================================================
--- development/source/tools/tArray.h	2008-03-11 18:09:40 UTC (rev 2451)
+++ development/source/tools/tArray.h	2008-03-11 19:33:46 UTC (rev 2452)
@@ -205,6 +205,13 @@
     a.SplitLoadSave(*this, version);
   } 
 
+  // wrapper for the c++ qsort routine
+  
+  void QSort(int ( * comparator ) ( const void *, const void * ))
+  {
+    qsort(m_data, m_size, sizeof(m_data[0]), comparator);
+  }
+
 };
 
 #endif




More information about the Avida-cvs mailing list