[Avida-SVN] r1126 - in development: . source/analyze source/main source/platform source/targets/avida support/scons
avidaedward at myxo.css.msu.edu
avidaedward at myxo.css.msu.edu
Mon Dec 11 19:27:05 PST 2006
Author: avidaedward
Date: 2006-12-11 22:27:04 -0500 (Mon, 11 Dec 2006)
New Revision: 1126
Modified:
development/
development/BuildAvida.py
development/SConstruct
development/my_avida_build_options.py
development/source/analyze/cAnalyze.cc
development/source/analyze/cAnalyze.h
development/source/analyze/cAnalyzeGenotype.cc
development/source/analyze/cAnalyzeGenotype.h
development/source/main/cAvidaConfig.h
development/source/platform/SConscript
development/source/targets/avida/SConscript
development/support/scons/scons.py
development/support/scons/sconsign.py
Log:
r1121 at Kaben-Nanlohys-MacBook-Pro-15: kaben | 2006-12-08 21:45:27 -0500
Addition of cAnalyzeGenotypeLink to help analyze lineage trees;
Prep for Gabe's cumulative stemminess.
Property changes on: development
___________________________________________________________________
Name: svk:merge
+ 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/development:1121
Modified: development/BuildAvida.py
===================================================================
--- development/BuildAvida.py 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/BuildAvida.py 2006-12-12 03:27:04 UTC (rev 1126)
@@ -38,7 +38,7 @@
# Tell Python where to find the main SCons build script, the SCons
# library, and our SCons customizations.
sys.path.append(os.path.join(sys.path[0], 'support/scons'))
-os.environ["SCONS_LIB_DIR"] = os.path.join(sys.path[0], 'support/scons/scons-local-0.96.1')
+os.environ["SCONS_LIB_DIR"] = os.path.join(sys.path[0], 'support/scons/scons-local-0.96.93')
# Any command line arguments are passed to SCons when it is imported by
# the next line.
Modified: development/SConstruct
===================================================================
--- development/SConstruct 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/SConstruct 2006-12-12 03:27:04 UTC (rev 1126)
@@ -28,6 +28,12 @@
# Static help text is defined in
# support/utils/AvidaUtils/StaticHelp.py
#
+
+# XXX Must not use default scons signatures database; as of SCons
+# 0.96.93, default database seems to be too-easily corrupted.
+# @kgn 06-Dec-6
+import anydbm
+SConsignFile('scons-signatures', anydbm)
AvidaUtils.Configure(ARGUMENTS, environment)
if environment.subst('$enableSerialization') in ['1', 'yes']:
@@ -91,7 +97,7 @@
if environment.subst('$extrasDir') not in ['None', 'none', '']:
environment.SConscript(
os.path.join(environment.subst('$extrasDir'), 'SConscript'),
- #build_dir = '$extrasBuildDir',
+ build_dir = '$extrasBuildDir',
duplicate = 0
)
Modified: development/my_avida_build_options.py
===================================================================
--- development/my_avida_build_options.py 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/my_avida_build_options.py 2006-12-12 03:27:04 UTC (rev 1126)
@@ -26,11 +26,15 @@
# Note: this file is also a Python script, so you can do some processing
# here if you like.
-buildType = "Release"
+extrasDir = '../avida-extras'
+execPrefix = "#/work"
+#buildType = "Release"
+buildType = "Debug"
+
enablePyPkg = "no"
-enableTestCode = "no"
-#enableTCMalloc = "no"
+enableMemTracking = "yes"
+enableGuiNcurses = "yes"
boostIncludeDir = None
boostPythonLibDir = None
Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/source/analyze/cAnalyze.cc 2006-12-12 03:27:04 UTC (rev 1126)
@@ -3099,7 +3099,14 @@
// Calculate various stats for trees in population.
void cAnalyze::CommandPrintTreeStats(cString cur_string)
{
- // @CAO GRAB FILENAME!
+ if (m_world->GetVerbosity() >= VERBOSE_ON) cout << "Printing tree stats for batch "
+ << cur_batch << endl;
+ else cout << "Printing tree stats..." << endl;
+
+ // Load in the variables...
+ cString filename("tree_stats.dat");
+ if (cur_string.GetSize() != 0) filename = cur_string.PopWord();
+
cAnalyzeGenotype * genotype = NULL;
tListIterator<cAnalyzeGenotype> batch_it(batch[cur_batch].List());
Modified: development/source/analyze/cAnalyze.h
===================================================================
--- development/source/analyze/cAnalyze.h 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/source/analyze/cAnalyze.h 2006-12-12 03:27:04 UTC (rev 1126)
@@ -55,7 +55,12 @@
class cAnalyze
{
-private:
+/*
+FIXME : switch back to private.
+- switched to public while I brainstorm. @kgn 06.11.22
+*/
+//private:
+public:
int cur_batch;
cGenotypeBatch batch[MAX_BATCHES];
tList<cAnalyzeCommand> command_list;
Modified: development/source/analyze/cAnalyzeGenotype.cc
===================================================================
--- development/source/analyze/cAnalyzeGenotype.cc 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/source/analyze/cAnalyzeGenotype.cc 2006-12-12 03:27:04 UTC (rev 1126)
@@ -146,6 +146,7 @@
cAnalyzeGenotype::~cAnalyzeGenotype()
{
if (knockout_stats != NULL) delete knockout_stats;
+ Unlink();
}
Modified: development/source/analyze/cAnalyzeGenotype.h
===================================================================
--- development/source/analyze/cAnalyzeGenotype.h 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/source/analyze/cAnalyzeGenotype.h 2006-12-12 03:27:04 UTC (rev 1126)
@@ -42,8 +42,41 @@
class cTestCPU;
class cWorld;
+/* FIXME : Refactor. @kgn */
+class cAnalyzeGenotype;
+class cAnalyzeGenotypeLink {
+private:
+ cAnalyzeGenotype *m_parent;
+ tList<cAnalyzeGenotype> m_child_list;
+public:
+ cAnalyzeGenotypeLink():m_parent(0) {
+ SetParent(0);
+ ClearChildren();
+ }
+ void SetParent(cAnalyzeGenotype *parent){ m_parent = parent; }
+ cAnalyzeGenotype *GetParent(){ return m_parent; }
+ tList<cAnalyzeGenotype> &GetChildList(){ return m_child_list; }
+ cAnalyzeGenotype *FindChild(cAnalyzeGenotype *child){
+ return GetChildList().FindPtr(child);
+ }
+ cAnalyzeGenotype *RemoveChild(cAnalyzeGenotype *child){
+ return GetChildList().Remove(child);
+ }
+ void AddChild(cAnalyzeGenotype *child){
+ if(!FindChild(child)){
+ GetChildList().PushRear(child);
+ }
+ }
+ void ClearChildren(){
+ m_child_list.Clear();
+ }
+};
+
+
class cAnalyzeGenotype {
private:
+ cAnalyzeGenotypeLink m_link;
+private:
cWorld* m_world;
cGenome genome; // Full Genome
cInstSet& inst_set; // Instruction set used in this genome
@@ -315,17 +348,37 @@
equality of two references means that they refer to the same object.
*/
bool operator==(const cAnalyzeGenotype &in) const { return &in == this; }
+
+ cAnalyzeGenotypeLink &GetLink(){ return m_link; }
+ void LinkParent(cAnalyzeGenotype *parent){
+ if(GetLink().GetParent() && GetLink().GetParent() != parent){
+ GetLink().GetParent()->GetLink().RemoveChild(this);
+ }
+ GetLink().SetParent(parent);
+ if(parent){ parent->GetLink().AddChild(this); }
+ }
+ void LinkChild(cAnalyzeGenotype &child){ child.LinkParent(this); }
+ void UnlinkParent(){ LinkParent(0); }
+ void UnlinkChildren(){
+ tListIterator<cAnalyzeGenotype> it(GetLink().GetChildList());
+ while (it.Next() != NULL) { it.Get()->GetLink().SetParent(0); }
+ GetLink().ClearChildren();
+ }
+ void Unlink(){
+ UnlinkParent();
+ UnlinkChildren();
+ }
+ cAnalyzeGenotype *GetParent(){ return GetLink().GetParent(); }
+ bool HasChild(cAnalyzeGenotype &child){ return GetLink().FindChild(&child); }
+ bool UnlinkChild(cAnalyzeGenotype &child){
+ if(HasChild(child)){
+ child.UnlinkParent();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ tList<cAnalyzeGenotype> &GetChildList(){ return GetLink().GetChildList(); }
};
-#ifdef ENABLE_UNIT_TESTS
-namespace nAnalyzeGenotype {
- /**
- * Run unit tests
- *
- * @param full Run full test suite; if false, just the fast tests.
- **/
- void UnitTests(bool full = false);
-}
-#endif
-
#endif
Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/source/main/cAvidaConfig.h 2006-12-12 03:27:04 UTC (rev 1126)
@@ -290,8 +290,8 @@
CONFIG_ADD_GROUP(ANALYZE_GROUP, "Analysis Settings");
CONFIG_ADD_VAR(MT_CONCURRENCY, int, 1, "Number of concurrent analyze threads");
- CONFIG_ADD_VAR(ANALYZE_OPTION_1, cString, "", "String variable accessible from analysis scripts");
- CONFIG_ADD_VAR(ANALYZE_OPTION_2, cString, "", "String variable accessible from analysis scripts");
+ //CONFIG_ADD_VAR(ANALYZE_OPTION_1, cString, "", "String variable accessible from analysis scripts");
+ //CONFIG_ADD_VAR(ANALYZE_OPTION_2, cString, "", "String variable accessible from analysis scripts");
#endif
Modified: development/source/platform/SConscript
===================================================================
--- development/source/platform/SConscript 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/source/platform/SConscript 2006-12-12 03:27:04 UTC (rev 1126)
@@ -2,7 +2,6 @@
Import('environment')
if environment['enableTCMalloc'] in ('True', '1', 1):
- print "I am descending into tcmalloc."
environment.SConscript('tcmalloc/SConscript')
# vim: set ft=python:
Modified: development/source/targets/avida/SConscript
===================================================================
--- development/source/targets/avida/SConscript 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/source/targets/avida/SConscript 2006-12-12 03:27:04 UTC (rev 1126)
@@ -15,8 +15,8 @@
'analyze',
'drivers',
'cpu',
+ 'actions',
'tools',
- 'actions',
'analyze',
#'archive',
#'boost_serialization',
Modified: development/support/scons/scons.py
===================================================================
--- development/support/scons/scons.py 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/support/scons/scons.py 2006-12-12 03:27:04 UTC (rev 1126)
@@ -24,15 +24,15 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "/home/scons/scons/branch.0/baseline/src/script/scons.py 0.96.1.D001 2004/08/23 09:55:29 knight"
+__revision__ = "/home/scons/scons/branch.0/branch.96/baseline/src/script/scons.py 0.96.93.D001 2006/11/06 08:31:54 knight"
-__version__ = "0.96.1"
+__version__ = "0.96.93"
__build__ = "D001"
-__buildsys__ = "casablanca"
+__buildsys__ = "roxbury"
-__date__ = "2004/08/23 09:55:29"
+__date__ = "2006/11/06 08:31:54"
__developer__ = "knight"
@@ -129,6 +129,23 @@
prefs))
prefs = temp
+ # Add the parent directory of the current python's library to the
+ # preferences. On SuSE-91/AMD64, for example, this is /usr/lib64,
+ # not /usr/lib.
+ try:
+ libpath = os.__file__
+ except AttributeError:
+ pass
+ else:
+ while libpath:
+ libpath, tail = os.path.split(libpath)
+ if tail[:6] == "python":
+ break
+ if libpath:
+ # Python library is in /usr/libfoo/python*;
+ # check /usr/libfoo/scons*.
+ prefs.append(libpath)
+
# Look first for 'scons-__version__' in all of our preference libs,
# then for 'scons'.
libs.extend(map(lambda x: os.path.join(x, scons_version), prefs))
Modified: development/support/scons/sconsign.py
===================================================================
--- development/support/scons/sconsign.py 2006-12-12 03:18:46 UTC (rev 1125)
+++ development/support/scons/sconsign.py 2006-12-12 03:27:04 UTC (rev 1126)
@@ -24,15 +24,15 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "/home/scons/scons/branch.0/baseline/src/script/sconsign.py 0.96.1.D001 2004/08/23 09:55:29 knight"
+__revision__ = "/home/scons/scons/branch.0/branch.96/baseline/src/script/sconsign.py 0.96.93.D001 2006/11/06 08:31:54 knight"
-__version__ = "0.96.1"
+__version__ = "0.96.93"
__build__ = "D001"
-__buildsys__ = "casablanca"
+__buildsys__ = "roxbury"
-__date__ = "2004/08/23 09:55:29"
+__date__ = "2006/11/06 08:31:54"
__developer__ = "knight"
@@ -130,6 +130,23 @@
prefs))
prefs = temp
+ # Add the parent directory of the current python's library to the
+ # preferences. On SuSE-91/AMD64, for example, this is /usr/lib64,
+ # not /usr/lib.
+ try:
+ libpath = os.__file__
+ except AttributeError:
+ pass
+ else:
+ while libpath:
+ libpath, tail = os.path.split(libpath)
+ if tail[:6] == "python":
+ break
+ if libpath:
+ # Python library is in /usr/libfoo/python*;
+ # check /usr/libfoo/scons*.
+ prefs.append(libpath)
+
# Look first for 'scons-__version__' in all of our preference libs,
# then for 'scons'.
libs.extend(map(lambda x: os.path.join(x, scons_version), prefs))
@@ -184,6 +201,7 @@
Print_Flags = Flagger()
Verbose = 0
Readable = 0
+Raw = 0
def default_mapper(entry, name):
try:
@@ -224,23 +242,44 @@
'implicit' : 'bkids',
}
-def printfield(name, entry):
- def field(name, verbose=Verbose, entry=entry):
- if not Print_Flags[name]:
- return None
- fieldname = map_name.get(name, name)
- mapper = map_field.get(fieldname, default_mapper)
- val = mapper(entry, name)
- if verbose:
- val = name + ": " + val
- return val
+def field(name, entry, verbose=Verbose):
+ if not Print_Flags[name]:
+ return None
+ fieldname = map_name.get(name, name)
+ mapper = map_field.get(fieldname, default_mapper)
+ val = mapper(entry, name)
+ if verbose:
+ val = name + ": " + val
+ return val
- fieldlist = ["timestamp", "bsig", "csig"]
- outlist = [name+":"] + filter(None, map(field, fieldlist))
- sep = Verbose and "\n " or " "
- print string.join(outlist, sep)
+def nodeinfo_raw(name, ninfo, prefix=""):
+ # This does essentially what the pprint module does,
+ # except that it sorts the keys for deterministic output.
+ d = ninfo.__dict__
+ keys = d.keys()
+ keys.sort()
+ l = []
+ for k in keys:
+ l.append('%s: %s' % (repr(k), repr(d[k])))
+ return name + ': {' + string.join(l, ', ') + '}'
- outlist = field("implicit", 0)
+def nodeinfo_string(name, ninfo, prefix=""):
+ fieldlist = ["bsig", "csig", "timestamp", "size"]
+ f = lambda x, ni=ninfo, v=Verbose: field(x, ni, v)
+ outlist = [name+":"] + filter(None, map(f, fieldlist))
+ if Verbose:
+ sep = "\n " + prefix
+ else:
+ sep = " "
+ return string.join(outlist, sep)
+
+def printfield(name, entry, prefix=""):
+ if Raw:
+ print nodeinfo_raw(name, entry.ninfo, prefix)
+ else:
+ print nodeinfo_string(name, entry.ninfo, prefix)
+
+ outlist = field("implicit", entry, 0)
if outlist:
if Verbose:
print " implicit:"
@@ -256,8 +295,10 @@
else:
printfield(name, entry)
else:
- for name, e in entries.items():
- printfield(name, e)
+ names = entries.keys()
+ names.sort()
+ for name in names:
+ printfield(name, entries[name])
class Do_SConsignDB:
def __init__(self, dbm_name, dbm):
@@ -345,14 +386,17 @@
-h, --help Print this message and exit.
-i, --implicit Print implicit dependency information.
-r, --readable Print timestamps in human-readable form.
+ --raw Print raw Python object representations.
+ -s, --size Print file sizes.
-t, --timestamp Print timestamp information.
-v, --verbose Verbose, describe each field.
"""
-opts, args = getopt.getopt(sys.argv[1:], "bcd:e:f:hirtv",
+opts, args = getopt.getopt(sys.argv[1:], "bcd:e:f:hirstv",
['bsig', 'csig', 'dir=', 'entry=',
'format=', 'help', 'implicit',
- 'readable', 'timestamp', 'verbose'])
+ 'raw', 'readable',
+ 'size', 'timestamp', 'verbose'])
for o, a in opts:
@@ -383,8 +427,12 @@
sys.exit(0)
elif o in ('-i', '--implicit'):
Print_Flags['implicit'] = 1
+ elif o in ('--raw',):
+ Raw = 1
elif o in ('-r', '--readable'):
Readable = 1
+ elif o in ('-s', '--size'):
+ Print_Flags['size'] = 1
elif o in ('-t', '--timestamp'):
Print_Flags['timestamp'] = 1
elif o in ('-v', '--verbose'):
More information about the Avida-cvs
mailing list