[Avida-SVN] r2039 - development/source/analyze
kaben at myxo.css.msu.edu
kaben at myxo.css.msu.edu
Sun Sep 2 18:05:31 PDT 2007
Author: kaben
Date: 2007-09-02 21:05:31 -0400 (Sun, 02 Sep 2007)
New Revision: 2039
Modified:
development/source/analyze/cAnalyzeGenotypeTreeStats.cc
Log:
Added logic to cAnalyzeGenotypeTreeStats for detecting incomplete tree.
Notes:
- This still assumes exactly one tree is present, with root denoted by genotype
having parent id of -1.
- I would like cAnalyzeGenotypeTreeStats to be able to detect and handle
multiple trees at once. This is not a high priority unless Gabe / Charles
requests it.
Modified: development/source/analyze/cAnalyzeGenotypeTreeStats.cc
===================================================================
--- development/source/analyze/cAnalyzeGenotypeTreeStats.cc 2007-09-03 00:48:07 UTC (rev 2038)
+++ development/source/analyze/cAnalyzeGenotypeTreeStats.cc 2007-09-03 01:05:31 UTC (rev 2039)
@@ -94,12 +94,19 @@
cAnalyzeGenotype * genotype = m_agl[pos].genotype;
int parent_id = genotype->GetParentID();
if (-1 != parent_id){
- id_hash.Find(parent_id, m_agl[pos].ppos);
- int parent_position = m_agl[pos].ppos;
- m_agl[parent_position].offspring_positions.Push(pos);
- /* XXX I think I'll be able to remove this. */
- cAnalyzeGenotype * parent_genotype = m_agl[parent_position].genotype;
- genotype->LinkParent(parent_genotype);
+ bool found_parent = id_hash.Find(parent_id, m_agl[pos].ppos);
+ if (found_parent){
+ int parent_position = m_agl[pos].ppos;
+ m_agl[parent_position].offspring_positions.Push(pos);
+ ///* XXX I think I'll be able to remove this. */
+ //cAnalyzeGenotype * parent_genotype = m_agl[parent_position].genotype;
+ //genotype->LinkParent(parent_genotype);
+ } else {
+ if (m_world->GetVerbosity() >= VERBOSE_ON) {
+ cerr << "Error: the parent of a non-root tree node is missing - " << endl;
+ }
+ return;
+ }
}
}
More information about the Avida-cvs
mailing list