📄 level_map.html
字号:
<html><title>An Avida Levelization Map</title><body bgcolor="#FFFFFF" text="#000000" link="#0000AA" alink="#0000FF" vlink="#000044"><h2 align=center>An Avida Levelization Map</h2><p>Levelization is an important tool for large software projects, thoughfew seem to use it. The concept is that all components in the project shouldbe part of a well defined hierarchy. In C++, a component is defined as apair of files, one of which is a header (ending in .hh) and the other is acode file (ending in .cc).<p>So what do I mean about hierarchy? Basically, for any two components Aand B, if B requires A in to successfully compile, than A should notalso require B. Thus, A is a "lower level" component than B.To illustrate this in avida, we can use the example of the "genome" and"organism" components. The cOrganism class requires the cGenome class tobe compiled, so we need make sure that the reverse is not true.For those of you who are familiar with graph theory, a project beinglevelized simply means that the project's components and their dependenciesform a directed, acyclic graph (DAG).<p>This is not always as easy as it sounds. For example, when I decided tolevelize the Avida source code, my biggest challenge was with the pair ofclasses cOrganism and cPopulation. The population has a collection oforganisms inside of it, so obviously it needs to know about them.Unfortunately, the organism <i>also</i> needs to interact with thepopulation, for example to let it know when it is ready to have its child beborn. To solve this problem,I created the cPopulationInterface class. This class, is at a lover levelthan either population or organism, so they both have access to it.The object of class cPopulation (or of class cTestCPU, for when we need totest an organism) will give the population interface pointers to thefunctions thatshould be executed under specific conditions, and then the organism willuse those function pointers as needed. Don't worry too much about this now;this example is merely intended to illustrate that levelization is notalways easy, but its also not impossible.<p>The term "levelization" refers to the levels in the hierarchy. All of thosecomponents that don't have any dependencies are on level 0. Those that onlydepend on components in level zero are themselves at level one, and so on.<h3>Levelization Chart</h3>Below are a listing of all of the files in the<tt><font color="#008844">main/</font></tt> and <tt><font color="#008844">cpu/</font></tt> directories. Files in<tt><font color="#008844">tools/</font></tt> are not listed because theyare internally levelized, and do not depend on any other avida files outsideof that directory. Conversely, no files in these directories depend onanything in either of the viewer directories, so they are not listed either.Files in the <tt><font color="#008844">events/</font></tt> directory areauto-generated and not being discussed at this point. So, basically, theseare only those files that are at the core of avida.<p><table><tr><td><b>Level</b> <td><b>Component</b> <td><b>Dependencies</b><tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">config</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">cpu/</font><font color="#000088">cpu_stats</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">cpu/</font><font color="#000088">cpu_stack</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">inst</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">cpu/</font><font color="#000088">label</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">mutations</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">pop_interface</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">reaction</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">reaction_result</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">resource</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">resource_count</font></tt> <td>[none]<tr><th>0 <td><tt><font color="#008844">main/</font><font color="#000088">tasks</font></tt> <td>[none]<tr><th>1 <td><tt><font color="#008844">main/</font><font color="#000088">genome</font></tt> <td>inst<tr><th>1 <td><tt><font color="#008844">main/</font><font color="#000088">inst_lib</font></tt> <td>inst<tr><th>1 <td><tt><font color="#008844">main/</font><font color="#000088">stats</font></tt> <td>config<tr><th>2 <td><tt><font color="#008844">main/</font><font color="#000088">environment</font></tt> <td>reaction, resource, tasks, inst_lib, mutations, reaction_result<tr><th>2 <td><tt><font color="#008844">cpu/</font><font color="#000088">cpu_memory</font></tt> <td>genome<tr><th>2 <td><tt><font color="#008844">main/</font><font color="#000088">genome_util</font></tt> <td>genome<tr><th>2 <td><tt><font color="#008844">cpu/</font><font color="#000088">hardware_base</font></tt> <td>inst, inst_lib<tr><th>2 <td><tt><font color="#008844">main/</font><font color="#000088">inst_util</font></tt> <td>inst_lib, genome<tr><th>3 <td><tt><font color="#008844">main/</font><font color="#000088">phenotype</font></tt> <td>environment, config<tr><th>3 <td><tt><font color="#008844">cpu/</font><font color="#000088">head</font></tt> <td>inst, inst_lib, hardware_base, cpu_memory, label<tr><th>4 <td><tt><font color="#008844">main/</font><font color="#000088">organism</font></tt> <td>mutations, pop_interface, cpu_stats, phenotype, config, inst_lib, inst_util, genome, genome_util, hardware_base<tr><th>5 <td><tt><font color="#008844">main/</font><font color="#000088">population_cell</font></tt> <td>mutations, organism<tr><th>5 <td><tt><font color="#008844">cpu/</font><font color="#000088">test_cpu</font></tt> <td>config, hardware_base, inst_lib, inst_util, organism, phenotype, pop_interface, resource_count, tasks<tr><th>6 <td><tt><font color="#008844">main/</font><font color="#000088">fitness_matrix</font></tt> <td>stats, organism, test_cpu, config, inst_lib<tr><th>6 <td><tt><font color="#008844">main/</font><font color="#000088">genotype</font></tt> <td>genome, config, genome_util, organism, phenotype, stats, test_cpu<tr><th>6 <td><tt><font color="#008844">cpu/</font><font color="#000088">hardware_cpu</font></tt> <td>cpu_memory, cpu_stack, label, head, config, inst_lib, genome_util, organism, phenotype, test_cpu<tr><th>7 <td><tt><font color="#008844">cpu/</font><font color="#000088">hardware_factory</font></tt> <td>hardware_base, hardware_cpu<tr><th>7 <td><tt><font color="#008844">cpu/</font><font color="#000088">hardware_util</font></tt> <td>inst_lib, inst_util, hardware_base, hardware_cpu<tr><th>7 <td><tt><font color="#008844">main/</font><font color="#000088">species</font></tt> <td>genome, stats, genotype, genome_util, test_cpu<tr><th>7 <td><tt><font color="#008844">cpu/</font><font color="#000088">test_util</font></tt> <td>genome, genotype, inst_util, organism, phenotype, stats, hardware_base, test_cpu<tr><th>8 <td><tt><font color="#008844">main/</font><font color="#000088">genebank</font></tt> <td>species, genotype, config, stats, test_util<tr><th>8 <td><tt><font color="#008844">main/</font><font color="#000088">landscape</font></tt> <td>genome, test_cpu, cpu_memory, stats, inst_lib, organism, phenotype, test_util<tr><th>9 <td><tt><font color="#008844">main/</font><font color="#000088">analyze</font></tt> <td>genome, config, species, fitness_matrix, inst_lib, inst_util, landscape, phenotype, genome_util, test_cpu, hardware_util, test_util, environment<tr><th>10 <td><tt><font color="#008844">main/</font><font color="#000088">population</font></tt> <td>resource_count, inst_lib, pop_interface, mutations, config, genebank, genome_util, genotype, hardware_base, hardware_factory, hardware_util, inst_util, organism, phenotype, population_cell, species, stats, tasks<tr><th>11 <td><tt><font color="#008844">main/</font><font color="#000088">analyze_util</font></tt> <td>config, genebank, genome, genome_util, genotype, inst_lib, inst_util, landscape, organism, phenotype, population, population_cell, species, stats, test_cpu, test_util<tr><th>11 <td><tt><font color="#008844">main/</font><font color="#000088">callback_util</font></tt> <td>avida, genotype, organism, population, population_cell, pop_interface, hardware_base, hardware_factory, test_cpu<tr><th>12 <td><tt><font color="#008844">main/</font><font color="#000088">avida</font></tt> <td>stats, environment genotype, genebank, analyze, config, species, genome_util, test_cpu, callback_util, population, {events}, {viewers}</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -