[Avida-cvs] [avida-svn] r483 - in development/source: analyze cpu
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Sun Feb 26 08:44:42 PST 2006
Author: brysonda
Date: 2006-02-26 11:44:42 -0500 (Sun, 26 Feb 2006)
New Revision: 483
Modified:
development/source/analyze/cAnalyze.cc
development/source/cpu/cCPUMemory.cc
development/source/cpu/cCPUMemory.h
Log:
Up-port repeatability fix.
Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc 2006-02-26 16:35:01 UTC (rev 482)
+++ development/source/analyze/cAnalyze.cc 2006-02-26 16:44:42 UTC (rev 483)
@@ -4759,7 +4759,7 @@
}
// Assert that we found the correct number of samples.
- assert(num_samples = num_inst(cur_trait) * (num_inst(cur_trait)-1) / 2);
+ //assert(num_samples = num_inst(cur_trait) * (num_inst(cur_trait)-1) / 2);
// Now that we have all of the distances for this trait, divide by the
// number of samples and add it to the average.
Modified: development/source/cpu/cCPUMemory.cc
===================================================================
--- development/source/cpu/cCPUMemory.cc 2006-02-26 16:35:01 UTC (rev 482)
+++ development/source/cpu/cCPUMemory.cc 2006-02-26 16:44:42 UTC (rev 483)
@@ -117,11 +117,10 @@
// Do a sloppy resize first, saving old values...
const int old_size = active_size;
- const int old_array_size = genome.GetSize();
SloppyResize(new_size);
// Clean up all of the old memory that might need it...
- for (int i = old_size; i < new_size && i < old_array_size; i++) {
+ for (int i = old_size; i < new_size; i++) {
genome[i].SetOp(0);
flag_array[i] = 0;
}
@@ -132,8 +131,14 @@
{
assert(new_size >= 0);
+ const int old_size = active_size;
+
// Do a sloppy resize, which will still have old values.
SloppyResize(new_size);
+
+ for (int i = old_size; i < new_size; i++) {
+ flag_array[i] = 0;
+ }
}
@@ -188,5 +193,6 @@
// Now just copy everything over!
for (int i = 0; i < in_genome.GetSize(); i++) {
genome[i + pos] = in_genome[i];
+ flag_array[i + pos] = 0;
}
}
Modified: development/source/cpu/cCPUMemory.h
===================================================================
--- development/source/cpu/cCPUMemory.h 2006-02-26 16:35:01 UTC (rev 482)
+++ development/source/cpu/cCPUMemory.h 2006-02-26 16:44:42 UTC (rev 483)
@@ -40,7 +40,7 @@
void SloppyInsert(int pos, int num_lines); // Add lines, ignore new contents.
public:
- explicit cCPUMemory(int _size=1) : cGenome(_size), flag_array(_size) { ; }
+ explicit cCPUMemory(int _size=1) : cGenome(_size), flag_array(_size) { ClearFlags(); }
cCPUMemory(const cCPUMemory& in_memory);
cCPUMemory(const cGenome& in_genome) : cGenome(in_genome), flag_array(in_genome.GetSize()) { ; }
cCPUMemory(const cString& in_string) : cGenome(in_string), flag_array(in_string.GetSize()) { ; }
More information about the Avida-cvs
mailing list