Merge remote-tracking branch 'upstream/develop' into python-api

This commit is contained in:
Will Boyd 2015-03-10 13:31:59 -04:00
commit f59e0afcff
10 changed files with 2144 additions and 42 deletions

View file

@ -57,13 +57,7 @@ Validating XML Files
Input files can be checked before executing OpenMC using the ``xml_validate``
script. It is located in ``src/utils/xml_validate.py`` in the source code or in
``bin/xml_validate`` in the install directory. Before use, the third party
package TRANG_ must be installed and in your ``PATH`` to convert the compact
RelaxNG schema to standard RelaxNG format. For Ubuntu, you can install with:
.. code-block:: bash
sudo apt-get install trang
``bin/xml_validate`` in the install directory.
Two command line arguments can be set when running ``xml_validate``:
@ -84,7 +78,6 @@ Message Description
======================== ===================================
[XML ERROR] Cannot parse XML file.
[NO RELAXNG FOUND] No RelaxNG file found for XML file.
[TRANG FAILED] TRANG not installed properly.
[NOT VALID] XML file does not match RelaxNG.
[VALID] XML file matches RelaxNG.
======================== ===================================
@ -98,8 +91,6 @@ the following command:
/opt/openmc/0.6.2/bin/xml_validate
.. _TRANG: http://www.thaiopensource.com/relaxng/trang.html
--------------------------------------
Settings Specification -- settings.xml
--------------------------------------

230
src/relaxng/cmfd.rng Normal file
View file

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="cmfd" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<interleave>
<element name="mesh">
<interleave>
<choice>
<element name="dimension">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="dimension">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<choice>
<element name="upper_right">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="upper_right">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="width">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="width">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</choice>
<choice>
<element name="albedo">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="albedo">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<optional>
<choice>
<element name="map">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="map">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="energy">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="energy">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
</interleave>
</element>
<optional>
<element name="norm">
<data type="double"/>
</element>
</optional>
<optional>
<element name="feedback">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="downscatter">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="dhat_reset">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="solver">
<data type="string"/>
</element>
</optional>
<optional>
<element name="snes_monitor">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="ksp_monitor">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="power_monitor">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="write_matrices">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="run_adjoint">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="write_hdf5">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="begin">
<data type="int"/>
</element>
</optional>
<optional>
<element name="tally_reset">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
</optional>
<optional>
<element name="display">
<data type="string"/>
</element>
</optional>
<optional>
<element name="spectral">
<data type="double"/>
</element>
</optional>
<optional>
<element name="shift">
<data type="double"/>
</element>
</optional>
<optional>
<element name="ktol">
<data type="double"/>
</element>
</optional>
<optional>
<element name="stol">
<data type="double"/>
</element>
</optional>
<optional>
<element name="gauss_seidel_tolerance">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
</optional>
</interleave>
</element>

View file

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="cross_sections" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<interleave>
<zeroOrMore>
<element name="ace_table">
<interleave>
<choice>
<element name="name">
<data type="string">
<param name="maxLength">15</param>
</data>
</element>
<attribute name="name">
<data type="string">
<param name="maxLength">15</param>
</data>
</attribute>
</choice>
<optional>
<choice>
<element name="alias">
<data type="string">
<param name="maxLength">15</param>
</data>
</element>
<attribute name="alias">
<data type="string">
<param name="maxLength">15</param>
</data>
</attribute>
</choice>
</optional>
<choice>
<element name="zaid">
<data type="int"/>
</element>
<attribute name="zaid">
<data type="int"/>
</attribute>
</choice>
<optional>
<choice>
<element name="metastable">
<data type="int"/>
</element>
<attribute name="metastable">
<data type="int"/>
</attribute>
</choice>
</optional>
<choice>
<element name="awr">
<data type="double"/>
</element>
<attribute name="awr">
<data type="double"/>
</attribute>
</choice>
<choice>
<element name="temperature">
<data type="double"/>
</element>
<attribute name="temperature">
<data type="double"/>
</attribute>
</choice>
<choice>
<element name="path">
<data type="string">
<param name="maxLength">255</param>
</data>
</element>
<attribute name="path">
<data type="string">
<param name="maxLength">255</param>
</data>
</attribute>
</choice>
<optional>
<choice>
<element name="location">
<data type="int"/>
</element>
<attribute name="location">
<data type="int"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="filetype">
<choice>
<value>ascii</value>
<value>binary</value>
</choice>
</element>
<attribute name="filetype">
<choice>
<value>ascii</value>
<value>binary</value>
</choice>
</attribute>
</choice>
</optional>
</interleave>
</element>
</zeroOrMore>
<optional>
<element name="directory">
<data type="string">
<param name="maxLength">255</param>
</data>
</element>
</optional>
<element name="filetype">
<choice>
<value>ascii</value>
<value>binary</value>
</choice>
</element>
<optional>
<element name="record_length">
<data type="int"/>
</element>
</optional>
<optional>
<element name="entries">
<data type="int"/>
</element>
</optional>
</interleave>
</element>

345
src/relaxng/geometry.rng Normal file
View file

@ -0,0 +1,345 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="geometry" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<interleave>
<zeroOrMore>
<element name="cell">
<interleave>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
<optional>
<choice>
<element name="universe">
<data type="int"/>
</element>
<attribute name="universe">
<data type="int"/>
</attribute>
</choice>
</optional>
<choice>
<choice>
<element name="fill">
<data type="int"/>
</element>
<attribute name="fill">
<data type="int"/>
</attribute>
</choice>
<choice>
<element name="material">
<choice>
<data type="int"/>
<value>void</value>
</choice>
</element>
<attribute name="material">
<choice>
<data type="int"/>
<value>void</value>
</choice>
</attribute>
</choice>
</choice>
<optional>
<choice>
<element name="surfaces">
<list>
<zeroOrMore>
<data type="int"/>
</zeroOrMore>
</list>
</element>
<attribute name="surfaces">
<list>
<zeroOrMore>
<data type="int"/>
</zeroOrMore>
</list>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="rotation">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="rotation">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="translation">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="translation">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="surface">
<interleave>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
<choice>
<element name="type">
<data type="string">
<param name="maxLength">15</param>
</data>
</element>
<attribute name="type">
<data type="string">
<param name="maxLength">15</param>
</data>
</attribute>
</choice>
<choice>
<element name="coeffs">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="coeffs">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<optional>
<choice>
<element name="boundary">
<choice>
<value>transmit</value>
<value>reflective</value>
<value>vacuum</value>
</choice>
</element>
<attribute name="boundary">
<choice>
<value>transmit</value>
<value>reflective</value>
<value>vacuum</value>
</choice>
</attribute>
</choice>
</optional>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="lattice">
<interleave>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
<choice>
<element name="dimension">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</element>
<attribute name="dimension">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="pitch">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="pitch">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="universes">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="universes">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
<optional>
<choice>
<element name="outside">
<data type="int"/>
</element>
<attribute name="outside">
<data type="int"/>
</attribute>
</choice>
</optional>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="hex_lattice">
<interleave>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
<choice>
<element name="n_rings">
<data type="int"/>
</element>
<attribute name="n_rings">
<data type="int"/>
</attribute>
</choice>
<optional>
<choice>
<element name="n_axial">
<data type="int"/>
</element>
<attribute name="n_axial">
<data type="int"/>
</attribute>
</choice>
</optional>
<choice>
<element name="center">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="center">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="pitch">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="pitch">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="universes">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="universes">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
<optional>
<choice>
<element name="outer">
<data type="int"/>
</element>
<attribute name="outer">
<data type="int"/>
</attribute>
</choice>
</optional>
</interleave>
</element>
</zeroOrMore>
</interleave>
</element>

184
src/relaxng/materials.rng Normal file
View file

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="materials" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<interleave>
<oneOrMore>
<element name="material">
<interleave>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
<element name="density">
<interleave>
<optional>
<choice>
<element name="value">
<data type="double"/>
</element>
<attribute name="value">
<data type="double"/>
</attribute>
</choice>
</optional>
<choice>
<element name="units">
<data type="string">
<param name="maxLength">10</param>
</data>
</element>
<attribute name="units">
<data type="string">
<param name="maxLength">10</param>
</data>
</attribute>
</choice>
</interleave>
</element>
<zeroOrMore>
<element name="nuclide">
<interleave>
<choice>
<element name="name">
<data type="string">
<param name="maxLength">7</param>
</data>
</element>
<attribute name="name">
<data type="string">
<param name="maxLength">7</param>
</data>
</attribute>
</choice>
<optional>
<choice>
<element name="xs">
<data type="string">
<param name="maxLength">3</param>
</data>
</element>
<attribute name="xs">
<data type="string">
<param name="maxLength">3</param>
</data>
</attribute>
</choice>
</optional>
<choice>
<choice>
<element name="ao">
<data type="double"/>
</element>
<attribute name="ao">
<data type="double"/>
</attribute>
</choice>
<choice>
<element name="wo">
<data type="double"/>
</element>
<attribute name="wo">
<data type="double"/>
</attribute>
</choice>
</choice>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="element">
<interleave>
<choice>
<element name="name">
<data type="string">
<param name="maxLength">2</param>
</data>
</element>
<attribute name="name">
<data type="string">
<param name="maxLength">2</param>
</data>
</attribute>
</choice>
<optional>
<choice>
<element name="xs">
<data type="string">
<param name="maxLength">3</param>
</data>
</element>
<attribute name="xs">
<data type="string">
<param name="maxLength">3</param>
</data>
</attribute>
</choice>
</optional>
<choice>
<choice>
<element name="ao">
<data type="double"/>
</element>
<attribute name="ao">
<data type="double"/>
</attribute>
</choice>
<choice>
<element name="wo">
<data type="double"/>
</element>
<attribute name="wo">
<data type="double"/>
</attribute>
</choice>
</choice>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="sab">
<interleave>
<choice>
<element name="name">
<data type="string">
<param name="maxLength">7</param>
</data>
</element>
<attribute name="name">
<data type="string">
<param name="maxLength">7</param>
</data>
</attribute>
</choice>
<optional>
<choice>
<element name="xs">
<data type="string">
<param name="maxLength">3</param>
</data>
</element>
<attribute name="xs">
<data type="string">
<param name="maxLength">3</param>
</data>
</attribute>
</choice>
</optional>
</interleave>
</element>
</zeroOrMore>
</interleave>
</element>
</oneOrMore>
<optional>
<element name="default_xs">
<data type="string">
<param name="maxLength">3</param>
</data>
</element>
</optional>
</interleave>
</element>

295
src/relaxng/plots.rng Normal file
View file

@ -0,0 +1,295 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="plots" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<zeroOrMore>
<element name="plot">
<interleave>
<optional>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="filename">
<data type="string">
<param name="maxLength">50</param>
</data>
</element>
<attribute name="filename">
<data type="string">
<param name="maxLength">50</param>
</data>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="type">
<choice>
<value>slice</value>
<value>voxel</value>
</choice>
</element>
<attribute name="type">
<choice>
<value>slice</value>
<value>voxel</value>
</choice>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="color">
<choice>
<value>cell</value>
<value>mat</value>
<value>material</value>
</choice>
</element>
<attribute name="color">
<choice>
<value>cell</value>
<value>mat</value>
<value>material</value>
</choice>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="level">
<data type="int"/>
</element>
<attribute name="level">
<data type="int"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="origin">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="origin">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="width">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="width">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="basis">
<choice>
<value>xy</value>
<value>yz</value>
<value>xz</value>
</choice>
</element>
<attribute name="basis">
<choice>
<value>xy</value>
<value>yz</value>
<value>xz</value>
</choice>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="pixels">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="pixels">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="background">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="background">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
<zeroOrMore>
<element name="col_spec">
<interleave>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
<choice>
<element name="rgb">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="rgb">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="mask">
<interleave>
<choice>
<element name="components">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="components">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="background">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="background">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="meshlines">
<interleave>
<choice>
<element name="meshtype">
<choice>
<value>tally</value>
<value>entropy</value>
<value>ufs</value>
<value>cmfd</value>
</choice>
</element>
<attribute name="meshtype">
<choice>
<value>tally</value>
<value>entropy</value>
<value>ufs</value>
<value>cmfd</value>
</choice>
</attribute>
</choice>
<optional>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
</optional>
<choice>
<element name="linewidth">
<data type="int"/>
</element>
<attribute name="linewidth">
<data type="int"/>
</attribute>
</choice>
<optional>
<choice>
<element name="color">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="color">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
</interleave>
</element>
</zeroOrMore>
</interleave>
</element>
</zeroOrMore>
</element>

19
src/relaxng/readme.rst Normal file
View file

@ -0,0 +1,19 @@
=====================
Editing RelaxNG files
=====================
All direct edits to RelaxNG files should be in the .rnc files. The program
TRANG_ should be used to generate a correcsponding .rng file. For Ubuntu, you
can install with:
.. code-block:: bash
sudo apt-get install trang
To convert the .rnc file to .rng, use the following syntax:
.. code-block:: bash
trang {filename}.rnc {filename}.rng
.. _TRANG: http://www.thaiopensource.com/relaxng/trang.html

704
src/relaxng/settings.rng Normal file
View file

@ -0,0 +1,704 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="settings" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<interleave>
<optional>
<element name="confidence_intervals">
<data type="boolean"/>
</element>
</optional>
<choice>
<element name="eigenvalue">
<interleave>
<choice>
<element name="batches">
<data type="positiveInteger"/>
</element>
<attribute name="batches">
<data type="positiveInteger"/>
</attribute>
</choice>
<choice>
<element name="inactive">
<data type="nonNegativeInteger"/>
</element>
<attribute name="inactive">
<data type="nonNegativeInteger"/>
</attribute>
</choice>
<choice>
<element name="particles">
<data type="positiveInteger"/>
</element>
<attribute name="particles">
<data type="positiveInteger"/>
</attribute>
</choice>
<optional>
<choice>
<element name="generations_per_batch">
<data type="positiveInteger"/>
</element>
<attribute name="generations_per_batch">
<data type="positiveInteger"/>
</attribute>
</choice>
</optional>
</interleave>
</element>
<element name="fixed_source">
<interleave>
<choice>
<element name="batches">
<data type="positiveInteger"/>
</element>
<attribute name="batches">
<data type="positiveInteger"/>
</attribute>
</choice>
<choice>
<element name="particles">
<data type="positiveInteger"/>
</element>
<attribute name="particles">
<data type="positiveInteger"/>
</attribute>
</choice>
</interleave>
</element>
</choice>
<optional>
<element name="cross_sections">
<data type="string">
<param name="maxLength">255</param>
</data>
</element>
</optional>
<optional>
<element name="cutoff">
<interleave>
<optional>
<choice>
<element name="weight">
<data type="double"/>
</element>
<attribute name="weight">
<data type="double"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="weight_avg">
<data type="double"/>
</element>
<attribute name="weight_avg">
<data type="double"/>
</attribute>
</choice>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="energy_grid">
<choice>
<value>nuclide</value>
<value>log</value>
<value>logarithm</value>
<value>logarithmic</value>
</choice>
</element>
</optional>
<optional>
<element name="entropy">
<interleave>
<optional>
<choice>
<element name="dimension">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</element>
<attribute name="dimension">
<list>
<oneOrMore>
<data type="int"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
<choice>
<element name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="upper_right">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="upper_right">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</interleave>
</element>
</optional>
<optional>
<element name="log_grid_bins">
<data type="positiveInteger"/>
</element>
</optional>
<optional>
<element name="natural_elements">
<data type="string">
<param name="maxLength">20</param>
</data>
</element>
</optional>
<optional>
<element name="no_reduce">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="output">
<interleave>
<optional>
<choice>
<element name="summary">
<data type="boolean"/>
</element>
<attribute name="summary">
<data type="boolean"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="cross_sections">
<data type="boolean"/>
</element>
<attribute name="cross_sections">
<data type="boolean"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="tallies">
<data type="boolean"/>
</element>
<attribute name="tallies">
<data type="boolean"/>
</attribute>
</choice>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="output_path">
<data type="string">
<param name="maxLength">255</param>
</data>
</element>
</optional>
<optional>
<element name="ptables">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="run_cmfd">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="seed">
<data type="positiveInteger"/>
</element>
</optional>
<optional>
<element name="source">
<interleave>
<optional>
<element name="file">
<data type="string">
<param name="maxLength">255</param>
</data>
</element>
</optional>
<optional>
<element name="space">
<interleave>
<choice>
<element name="type">
<data type="string">
<param name="maxLength">16</param>
</data>
</element>
<attribute name="type">
<data type="string">
<param name="maxLength">16</param>
</data>
</attribute>
</choice>
<optional>
<choice>
<element name="length">
<data type="int"/>
</element>
<attribute name="length">
<data type="int"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="interpolation">
<data type="string">
<param name="maxLength">10</param>
</data>
</element>
<attribute name="interplation">
<data type="string">
<param name="maxLength">10</param>
</data>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="parameters">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="parameters">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="angle">
<interleave>
<choice>
<element name="type">
<data type="string">
<param name="maxLength">16</param>
</data>
</element>
<attribute name="type">
<data type="string">
<param name="maxLength">16</param>
</data>
</attribute>
</choice>
<optional>
<choice>
<element name="length">
<data type="int"/>
</element>
<attribute name="length">
<data type="int"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="interpolation">
<data type="string">
<param name="maxLength">10</param>
</data>
</element>
<attribute name="interplation">
<data type="string">
<param name="maxLength">10</param>
</data>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="parameters">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="parameters">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="energy">
<interleave>
<choice>
<element name="type">
<data type="string">
<param name="maxLength">16</param>
</data>
</element>
<attribute name="type">
<data type="string">
<param name="maxLength">16</param>
</data>
</attribute>
</choice>
<optional>
<choice>
<element name="length">
<data type="int"/>
</element>
<attribute name="length">
<data type="int"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="interpolation">
<data type="string">
<param name="maxLength">10</param>
</data>
</element>
<attribute name="interplation">
<data type="string">
<param name="maxLength">10</param>
</data>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="parameters">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="parameters">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</optional>
</interleave>
</element>
</optional>
<optional>
<choice>
<element name="write_initial">
<data type="boolean"/>
</element>
<attribute name="write_initial">
<data type="boolean"/>
</attribute>
</choice>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="state_point">
<choice>
<choice>
<element name="batches">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</element>
<attribute name="batches">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="interval">
<data type="positiveInteger"/>
</element>
<attribute name="interval">
<data type="positiveInteger"/>
</attribute>
</choice>
</choice>
</element>
</optional>
<optional>
<element name="source_point">
<interleave>
<optional>
<choice>
<choice>
<element name="batches">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</element>
<attribute name="batches">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="interval">
<data type="positiveInteger"/>
</element>
<attribute name="interval">
<data type="positiveInteger"/>
</attribute>
</choice>
</choice>
</optional>
<optional>
<choice>
<element name="separate">
<data type="boolean"/>
</element>
<attribute name="separate">
<data type="boolean"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="write">
<data type="boolean"/>
</element>
<attribute name="write">
<data type="boolean"/>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="overwrite_latest">
<data type="boolean"/>
</element>
<attribute name="overwrite_latest">
<data type="boolean"/>
</attribute>
</choice>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="survival_biasing">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="threads">
<data type="positiveInteger"/>
</element>
</optional>
<optional>
<element name="trace">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</element>
</optional>
<optional>
<element name="track">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</element>
</optional>
<optional>
<element name="verbosity">
<data type="positiveInteger"/>
</element>
</optional>
<optional>
<element name="uniform_fs">
<interleave>
<choice>
<element name="dimension">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</element>
<attribute name="dimension">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="upper_right">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="upper_right">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</interleave>
</element>
</optional>
<optional>
<element name="resonance_scattering">
<zeroOrMore>
<element name="scatterer">
<interleave>
<choice>
<element name="nuclide">
<data type="string">
<param name="maxLength">12</param>
</data>
</element>
<attribute name="nuclide">
<data type="string">
<param name="maxLength">12</param>
</data>
</attribute>
</choice>
<choice>
<element name="method">
<data type="string">
<param name="maxLength">16</param>
</data>
</element>
<attribute name="method">
<data type="string">
<param name="maxLength">16</param>
</data>
</attribute>
</choice>
<choice>
<element name="xs_label">
<data type="string">
<param name="maxLength">12</param>
</data>
</element>
<attribute name="xs_label">
<data type="string">
<param name="maxLength">12</param>
</data>
</attribute>
</choice>
<choice>
<element name="xs_label_0K">
<data type="string">
<param name="maxLength">12</param>
</data>
</element>
<attribute name="xs_label_0K">
<data type="string">
<param name="maxLength">12</param>
</data>
</attribute>
</choice>
<choice>
<element name="E_min">
<data type="double"/>
</element>
<attribute name="E_min">
<data type="double"/>
</attribute>
</choice>
<optional>
<choice>
<element name="E_max">
<data type="double"/>
</element>
<attribute name="E_max">
<data type="double"/>
</attribute>
</choice>
</optional>
</interleave>
</element>
</zeroOrMore>
</element>
</optional>
</interleave>
</element>

216
src/relaxng/tallies.rng Normal file
View file

@ -0,0 +1,216 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="tallies" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<interleave>
<zeroOrMore>
<element name="mesh">
<interleave>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
<choice>
<element name="type">
<choice>
<value>rectangular</value>
<value>hexagonal</value>
</choice>
</element>
<attribute name="type">
<choice>
<value>rectangular</value>
<value>hexagonal</value>
</choice>
</attribute>
</choice>
<choice>
<element name="dimension">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</element>
<attribute name="dimension">
<list>
<oneOrMore>
<data type="positiveInteger"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="lower_left">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<choice>
<element name="upper_right">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="upper_right">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
<choice>
<element name="width">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="width">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</choice>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="tally">
<interleave>
<choice>
<element name="id">
<data type="int"/>
</element>
<attribute name="id">
<data type="int"/>
</attribute>
</choice>
<optional>
<choice>
<element name="label">
<data type="string">
<param name="maxLength">52</param>
</data>
</element>
<attribute name="label">
<data type="string">
<param name="maxLength">52</param>
</data>
</attribute>
</choice>
</optional>
<optional>
<choice>
<element name="estimator">
<choice>
<value>analog</value>
<value>tracklength</value>
</choice>
</element>
<attribute name="estimator">
<choice>
<value>analog</value>
<value>tracklength</value>
</choice>
</attribute>
</choice>
</optional>
<zeroOrMore>
<element name="filter">
<interleave>
<choice>
<element name="type">
<choice>
<value>cell</value>
<value>cellborn</value>
<value>material</value>
<value>universe</value>
<value>surface</value>
<value>mesh</value>
<value>energy</value>
<value>energyout</value>
</choice>
</element>
<attribute name="type">
<choice>
<value>cell</value>
<value>cellborn</value>
<value>material</value>
<value>universe</value>
<value>surface</value>
<value>mesh</value>
<value>energy</value>
<value>energyout</value>
</choice>
</attribute>
</choice>
<choice>
<element name="bins">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</element>
<attribute name="bins">
<list>
<oneOrMore>
<data type="double"/>
</oneOrMore>
</list>
</attribute>
</choice>
</interleave>
</element>
</zeroOrMore>
<optional>
<element name="nuclides">
<list>
<oneOrMore>
<data type="string">
<param name="maxLength">12</param>
</data>
</oneOrMore>
</list>
</element>
</optional>
<element name="scores">
<list>
<oneOrMore>
<data type="string">
<param name="maxLength">20</param>
</data>
</oneOrMore>
</list>
</element>
</interleave>
</element>
</zeroOrMore>
<optional>
<element name="assume_separate">
<data type="boolean"/>
</element>
</optional>
</interleave>
</element>

View file

@ -50,10 +50,10 @@ if not os.path.exists(relaxng_path):
raise Exception("RelaxNG path: {0} does not exist, set with -r "
"command line option.".format(relaxng_path))
# Make sure there are .rnc files in RelaxNG path
rnc_files = glob.glob(os.path.join(relaxng_path, "*.rnc"))
if len(rnc_files) == 0:
raise Exception("No .rnc files found in RelaxNG "
# Make sure there are .rng files in RelaxNG path
rng_files = glob.glob(os.path.join(relaxng_path, "*.rng"))
if len(rng_files) == 0:
raise Exception("No .rng files found in RelaxNG "
"path: {0}.".format(relaxng_path))
# Get list of xml input files
@ -80,36 +80,22 @@ for xml_file in xml_files:
xml_prefix = os.path.basename(xml_file)
xml_prefix = xml_prefix.split(".")[0]
# Search for rnc file
rnc_file = os.path.join(relaxng_path, xml_prefix + ".rnc")
rng_file = xml_prefix + ".rng"
if rnc_file in rnc_files:
# Search for rng file
rng_file = os.path.join(relaxng_path, xml_prefix + ".rng")
if rng_file in rng_files:
# convert RNC to RNG file
rc = call("trang {0} {1}".format(rnc_file, rng_file), shell=True)
# read in RelaxNG
relaxng_doc = etree.parse(rng_file)
relaxng = etree.RelaxNG(relaxng_doc)
# check return code
if rc == 0:
# validate xml file again RelaxNG
try:
relaxng.assertValid(xml_tree)
print(BOLD + OK + '[VALID]' + ENDC)
except (etree.DocumentInvalid, TypeError) as e:
print(BOLD + FAIL + '[NOT VALID]' + ENDC)
print(" {0}".format(e))
# read in RelaxNG
relaxng_doc = etree.parse(rng_file)
relaxng = etree.RelaxNG(relaxng_doc)
# validate xml file again RelaxNG
try:
relaxng.assertValid(xml_tree)
print(BOLD + OK + '[VALID]' + ENDC)
except (etree.DocumentInvalid, TypeError) as e:
print(BOLD + FAIL + '[NOT VALID]' + ENDC)
print(" {0}".format(e))
# remove rng file
os.remove(rng_file)
# trang command failed
else:
print(BOLD + FAIL + '[TRANG FAILED]' + ENDC)
# RNC file does not exist
# RNG file does not exist
else:
print(BOLD + NOT_FOUND + '[NO RELAXNG FOUND]' + ENDC)