Added RELAX NG schemas for XML input files.

This commit is contained in:
Paul Romano 2012-09-12 13:22:07 -04:00
parent 746a05984c
commit 1fdb09baab
7 changed files with 275 additions and 0 deletions

9
schemas.xml Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
<documentElement localName="geometry" uri="src/templates/geometry.rnc"/>
<documentElement localName="materials" uri="src/templates/materials.rnc"/>
<documentElement localName="settings" uri="src/templates/settings.rnc"/>
<documentElement localName="tallies" uri="src/templates/tallies.rnc"/>
<documentElement localName="plots" uri="src/templates/plots.rnc"/>
<documentElement localName="cross_sections" uri="src/templates/cross_sections.rnc"/>
</locatingRules>

View file

@ -0,0 +1,23 @@
element cross_sections {
element ace_table {
(element name { xsd:string { maxLength = "15" } } |
attribute name { xsd:string { maxLength = "15" } }) &
(element alias { xsd:string { maxLength = "15" } } |
attribute alias { xsd:string { maxLength = "15" } })? &
(element zaid { xsd:int } | attribute zaid { xsd:int }) &
(element metastable { xsd:int } | attribute metastable { xsd:int })? &
(element awr { xsd:double } | attribute awr { xsd:double }) &
(element temperature { xsd:double } | attribute temperature { xsd:double }) &
(element path { xsd:string { maxLength = "255" } } |
attribute path { xsd:string { maxLength = "255" } }) &
(element location { xsd:int } | attribute location { xsd:int })?
}* &
element directory { xsd:string { maxLength = "255" } }? &
element filetype { ( "ascii" | "binary" ) } &
element record_length { xsd:int }? &
element entries { xsd:int }?
}

View file

@ -0,0 +1,32 @@
element geometry {
element cell {
(element id { xsd:int } | attribute id { xsd:int }) &
(element universe { xsd:int } | attribute universe { xsd:int })? &
(
(element fill { xsd:int } | attribute fill { xsd:int }) |
(element material { xsd:int } | attribute material { xsd:int })
) &
(element surfaces { list { xsd:int+ } } | attribute surfaces { list { xsd:int+ } }) &
(element rotation { list { xsd:double+ } } | attribute rotation { list { xsd:double+ } })? &
(element translation { list { xsd:double+ } } | attribute translation { list { xsd:double+ } })?
}*
& element surface {
(element id { xsd:int } | attribute id { xsd:int }) &
(element type { xsd:string { maxLength = "15" } } |
attribute type { xsd:string { maxLength = "15" } }) &
(element coeffs { list { xsd:double+ } } | attribute coeffs { list { xsd:double+ } }) &
(element boundary { ( "transmit" | "reflective" | "vacuum" ) } |
attribute boundary { ( "transmit" | "reflective" | "vacuum" ) })?
}*
& element lattice {
(element id { xsd:int } | attribute id { xsd:int }) &
(element type { ( "rectangular" | "hexagonal" ) } |
attribute type { ( "rectangular" | "hexagonal" ) })? &
(element dimension { list { xsd:int+ } } | attribute dimension { list { xsd:int+ } }) &
(element lower_left { list { xsd:double+ } } | attribute lower_left { list { xsd:double+ } }) &
(element width { list { xsd:double+ } } | attribute width { list { xsd:double+ } }) &
(element universes { list { xsd:int+ } } | attribute universes { list { xsd:int+ } })
}*
}

View file

@ -0,0 +1,31 @@
element materials {
element material {
(element id { xsd:int } | attribute id { xsd:int }) &
element density {
(element value { xsd:double } | attribute value { xsd:double })? &
(element units { xsd:string { maxLength = "10" } } |
attribute units { xsd:string { maxLength = "10" } })
} &
element nuclide {
(element name { xsd:string { maxLength = "7" } } |
attribute name { xsd:string { maxLength = "7" } }) &
(element xs { xsd:string { maxLength = "3" } } |
attribute xs { xsd:string { maxLength = "3" } })? &
(
(element ao { xsd:double } | attribute ao { xsd:double }) |
(element wo { xsd:double } | attribute wo { xsd:double })
)
}* &
element sab {
(element name { xsd:string { maxLength = "7" } } |
attribute name { xsd:string { maxLength = "7" } }) &
(element xs { xsd:string { maxLength = "3" } } |
attribute xs { xsd:string { maxLength = "3" } })?
}*
}+ &
element default_xs { xsd:string { maxLength = "3" } }
}

31
src/templates/plots.rnc Normal file
View file

@ -0,0 +1,31 @@
element plots {
element plot {
(element id { xsd:int } | attribute id { xsd:int })? &
(element filename { xsd:string { maxLength = "50" } } |
attribute filename { xsd:string { maxLength = "50" } })? &
(element type { "slice" } | attribute type { "slice" })? &
(element color { ( "cell" | "mat" | "material" ) } |
attribute color { ( "cell" | "mat" | "material" ) })? &
(element origin { list { xsd:double+ } } |
attribute origin { list { xsd:double+ } })? &
(element width { list { xsd:double+ } } |
attribute width { list { xsd:double+ } })? &
(element basis { ( "xy" | "yz" | "xz" ) } |
attribute basis { ( "xy" | "yz" | "xz" ) })? &
(element pixels { list { xsd:int+ } } |
attribute pixels { list { xsd:int+ } })? &
(element background { list { xsd:int+ } } |
attribute background { list { xsd:int+ } })? &
element col_spec {
(element id { xsd:int } | attribute id { xsd:int }) &
(element rgb { list { xsd:int+ } } |
attribute rgb { list { xsd:int+ } })
}* &
element mask {
(element components { list { xsd:int+ } } |
attribute components { list { xsd:int+ } }) &
(element background { list { xsd:int+ } } |
attribute background { list { xsd:int+ } })
}*
}*
}

View file

@ -0,0 +1,99 @@
element settings {
element confidence_intervals { ( "on" | "off" ) }? &
(
element criticality {
(element batches { xsd:int } | attribute batches { xsd:int }) &
(element inactive { xsd:int } | attribute inactive { xsd:int }) &
(element particles { xsd:int } | attribute particles { xsd:int }) &
(element generations_per_batch { xsd:int } | attribute generations_per_batch { xsd:int })?
} |
element fixed_source {
(element batches { xsd:int } | attribute batches { xsd:int }) &
(element particles { xsd:int } | attribute particles { xsd:int })
}
) &
element cross_sections { xsd:string { maxLength = "255" } }? &
element cutoff {
(element weight { xsd:double } | attribute weight { xsd:double })? &
(element weight_avg { xsd:double } | attribute weight_avg { xsd:double })?
}? &
element energy_grid { xsd:string { maxLength = "7" } }? &
element entropy {
(element dimension { list { xsd:int+ } } |
attribute dimension { list { xsd:int+ } })? &
(element lower_left { list { xsd:double+ } } |
attribute lower_left { list { xsd:double+ } }) &
(element upper_right { list { xsd:double+ } } |
attribute upper_right { list { xsd:double+ } })
}? &
element no_reduce { ( "off" | "on" ) }? &
element output { list {
( "summary" | "cross_sections" | "tallies" )+ } }? &
element ptables { ( "off" | "on" ) }? &
element seed { xsd:integer }? &
element source {
element file { xsd:string { maxLength = "255" } }? &
element space {
(element type { xsd:string { maxLength = "10" } } |
attribute type { xsd:string { maxLength = "10" } }) &
(element length { xsd:int } | attribute length { xsd:int })? &
(element interpolation { xsd:string { maxLength = "10" } } |
attribute interplation { xsd:string { maxLength = "10" } })? &
(element parameters { list { xsd:double+ } } |
attribute parameters { list { xsd:double+ } })?
}? &
element angle {
(element type { xsd:string { maxLength = "10" } } |
attribute type { xsd:string { maxLength = "10" } }) &
(element length { xsd:int } | attribute length { xsd:int })? &
(element interpolation { xsd:string { maxLength = "10" } } |
attribute interplation { xsd:string { maxLength = "10" } })? &
(element parameters { list { xsd:double+ } } |
attribute parameters { list { xsd:double+ } })?
}? &
element energy {
(element type { xsd:string { maxLength = "10" } } |
attribute type { xsd:string { maxLength = "10" } }) &
(element length { xsd:int } | attribute length { xsd:int })? &
(element interpolation { xsd:string { maxLength = "10" } } |
attribute interplation { xsd:string { maxLength = "10" } })? &
(element parameters { list { xsd:double+ } } |
attribute parameters { list { xsd:double+ } })?
}?
}? &
element state_point {
(
(element batches { list { xsd:int } } |
attribute batches { list { xsd:int } }) |
(element interval { xsd:int} | attribute interval { xsd:int })
) &
(element source_separate { ( "off" | "on" ) } |
attribute source_separate { ( "off" | "on" ) })?
}? &
element survival_biasing { ( "off" | "on" ) }? &
element trace { list { xsd:int } }? &
element verbosity { xsd:int }? &
element uniform_fs{
(element dimension { list { xsd:int+ } } |
attribute dimension { list { xsd:int+ } }) &
(element lower_left { list { xsd:double+ } } |
attribute lower_left { list { xsd:double+ } }) &
(element upper_right { list { xsd:double+ } } |
attribute upper_right { list { xsd:double+ } })
}?
}

50
src/templates/tallies.rnc Normal file
View file

@ -0,0 +1,50 @@
element tallies {
element mesh {
(element id { xsd:int } | attribute id { xsd:int }) &
(element type { ( "rectangular" | "hexagonal" ) } |
attribute type { ( "rectangular" | "hexagonal" ) }) &
(element dimension { list { xsd:int+ } } |
attribute dimension { list { xsd:int+ } }) &
(element lower_left { list { xsd:double+ } } |
attribute lower_left { list { xsd:double+ } }) &
(
(element upper_right { list { xsd:double+ } } |
attribute upper_right { list { xsd:double+ } }) |
(element width { list { xsd:double+ } } |
attribute width { list { xsd:double+ } })
)
}* &
element tally {
(element id { xsd:int } | attribute id { xsd:int }) &
(element label { xsd:string { maxLength="52" } } |
attribute label { xsd:string { maxLength="52" } })? &
(element estimator { ( "analog" | "tracklength" ) } |
attribute estimator { ( "analog" | "tracklength" ) })? &
element filters {
(element cell { list { xsd:string { maxLength = "20" } } } |
attribute cell { list { xsd:string { maxLength = "20" } } })? &
(element surface { list { xsd:string { maxLength = "20" } } } |
attribute surface { list { xsd:string { maxLength = "20" } } })? &
(element universe { list { xsd:string { maxLength = "20" } } } |
attribute universe { list { xsd:string { maxLength = "20" } } })? &
(element material { list { xsd:string { maxLength = "20" } } } |
attribute material { list { xsd:string { maxLength = "20" } } })? &
(element mesh { xsd:int } | attribute mesh { xsd:int })? &
(element cellborn { list { xsd:string { maxLength = "20" } } } |
attribute cellborn { list { xsd:string { maxLength = "20" } } })? &
(element energy { list { xsd:double+ } } |
attribute energy { list { xsd:double+ } })? &
(element energyout { list { xsd:double+ } } |
attribute energyout { list { xsd:double+ } })?
}? &
element nuclides {
list { xsd:string { maxLength = "20" }+ }
}? &
element scores {
list { xsd:string { maxLength = "12" }+ }
}
}* &
element assume_separate { ( "off" | "on" ) }?
}