Rename main Python API classes to get rid of File.

This commit is contained in:
Paul Romano 2016-04-25 10:37:06 -05:00
parent cccca4062a
commit 50a80693b5
37 changed files with 203 additions and 284 deletions

View file

@ -36,15 +36,15 @@ moderator.add_nuclide(h1, 2.)
moderator.add_nuclide(o16, 1.)
moderator.add_s_alpha_beta('HH2O', '71t')
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
# Instantiate a Materials object, register all Materials, and export to XML
materials_file = openmc.Materials()
materials_file.default_xs = '71c'
materials_file.add_materials([fuel1, fuel2, moderator])
materials_file.export_to_xml()
###############################################################################
# Exporting to OpenMC geometry.xml File
# Exporting to OpenMC geometry.xml file
###############################################################################
# Instantiate planar surfaces
@ -97,14 +97,10 @@ outer_box.fill = moderator
root = openmc.Universe(universe_id=0, name='root universe')
root.add_cells([inner_box, middle_box, outer_box])
# Instantiate a Geometry and register the root Universe
# Instantiate a Geometry and register the root Universe, and export to XML
geometry = openmc.Geometry()
geometry.root_universe = root
# Instantiate a GeometryFile, register Geometry, and export to XML
geometry_file = openmc.GeometryFile()
geometry_file.geometry = geometry
geometry_file.export_to_xml()
geometry.export_to_xml()
###############################################################################
@ -112,7 +108,7 @@ geometry_file.export_to_xml()
###############################################################################
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
settings_file = openmc.SettingsFile()
settings_file = openmc.Settings()
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
@ -133,7 +129,7 @@ plot.width = [20, 20]
plot.pixels = [200, 200]
plot.color = 'cell'
# Instantiate a PlotsFile, add Plot, and export to XML
plot_file = openmc.PlotsFile()
# Instantiate a Plots object, add Plot, and export to XML
plot_file = openmc.Plots()
plot_file.add_plot(plot)
plot_file.export_to_xml()