Make Materials, Plots, and Tallies list-like

This commit is contained in:
Paul Romano 2016-04-29 16:14:02 -05:00
parent ae083cf5d4
commit d9b097dbaf
31 changed files with 373 additions and 297 deletions

View file

@ -108,11 +108,8 @@
},
"outputs": [],
"source": [
"# Instantiate a Materials object, add Materials\n",
"materials_file = openmc.Materials()\n",
"materials_file.add_material(fuel)\n",
"materials_file.add_material(water)\n",
"materials_file.add_material(zircaloy)\n",
"# Instantiate a Materials collection\n",
"materials_file = openmc.Materials((fuel, water, zircaloy))\n",
"materials_file.default_xs = '71c'\n",
"\n",
"# Export to \"materials.xml\"\n",
@ -329,9 +326,8 @@
"plot.pixels = [250, 250]\n",
"plot.color = 'mat'\n",
"\n",
"# Instantiate a Plots object, add Plot, and export to \"plots.xml\"\n",
"plot_file = openmc.Plots()\n",
"plot_file.add_plot(plot)\n",
"# Instantiate a Plots collection and export to \"plots.xml\"\n",
"plot_file = openmc.Plots([plot])\n",
"plot_file.export_to_xml()"
]
},
@ -449,8 +445,7 @@
"tally.scores = ['fission', 'nu-fission']\n",
"\n",
"# Add mesh and Tally to Tallies\n",
"tallies_file.add_mesh(mesh)\n",
"tallies_file.add_tally(tally)"
"tallies_file.append(tally)"
]
},
{
@ -478,7 +473,7 @@
"tally.nuclides = [u235, u238]\n",
"\n",
"# Add mesh and tally to Tallies\n",
"tallies_file.add_tally(tally)"
"tallies_file.append(tally)"
]
},
{
@ -510,7 +505,7 @@
"tally.triggers = [trigger]\n",
"\n",
"# Add mesh and tally to Tallies\n",
"tallies_file.add_tally(tally)"
"tallies_file.append(tally)"
]
},
{