mit-crpg/openmc — pull request #331 by wbinventor (2014-10-13 15:47:53+00:00)
Title: OpenMC Python API

This pull requests includes a Python API to generate OpenMC XML input files. The API is in the ``src/utils/openmc`` directory. Now, when a user installs OpenMC, the Python API is also installed as the ``openmc`` Python package on the user's machine. The API should make it easy(ier) to write and easily modify input files for large, complex geometries. In addition, this added functionality makes it easier to use OpenMC for parametric optimization. The API should satisfy the complete XML input specifications as documented on OpenMC's website (though I may have missed something).

The following is a rough breakdown of the files and Python classes included in this PR:

**settings.xml**
* Specifications implemented in ``settings.py``
* ``SettingsFile`` class

**materials.xml**
* Specifications implemented in ``nuclide.py``, ``element.py``, and ``material.py``
* ``Nuclide``, ``Element``, ``Material``, and ``MaterialsFile`` classes

**geometry.xml**
* Specifications implemented in ``surface.py``, ``universe.py`` and ``geometry.py``
* ``Surface`` and associated subclasses (*e.g.*, ``XPlane``, ``ZCylinder``, etc.), ``Cell``, ``Universe``, ``Lattice``, ``Geometry``, and ``GeometryFile`` classes

**tallies.xml**
* Specifications implemented in ``tallies.py``
* ``Mesh``, ``Filter``, ``Tally``, and ``TalliesFile`` classes

**plots.xml**
* Specifications implemented in ``plots.py``
* ``Plot`` and ``PlotsFile`` classes

All of the example input files in the ``examples`` directory were replicated into separate ``xml`` and ``python`` subdirectories. The ``python`` subdirectory includes ``build-xml.py`` files which generate all of the XML input files needed to run each case. The output from running the cases in the ``python`` subdirectory are slightly different than those in the ``xml`` subdirectory due to issue #330.

Finally, this PR is not ready to merge since it includes a compatibility module for OpenCSG, which is not yet open sourced. I mainly wanted to submit this PR to get some feedback from the core OpenMC developers which I can incorporate while waiting on OpenCSG to mature a bit. In addition, I wanted to communicate to OpenMC users that the API is available since others may find it useful for their work.