mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Merge branch 'develop' into new-scatt-mat
This commit is contained in:
commit
e640146f8f
64 changed files with 15896 additions and 1606 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -1,3 +0,0 @@
|
|||
[submodule "src/xml/fox"]
|
||||
path = src/xml/fox
|
||||
url = https://github.com/mit-crpg/fox.git
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||
project(openmc Fortran C)
|
||||
project(openmc Fortran C CXX)
|
||||
|
||||
# Setup output directories
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
|
@ -103,21 +103,17 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
|||
# Make sure version is sufficient
|
||||
execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -dumpversion
|
||||
OUTPUT_VARIABLE GCC_VERSION)
|
||||
if(GCC_VERSION VERSION_LESS 4.6)
|
||||
message(FATAL_ERROR "gfortran version must be 4.6 or higher")
|
||||
if(GCC_VERSION VERSION_LESS 4.8)
|
||||
message(FATAL_ERROR "gfortran version must be 4.8 or higher")
|
||||
endif()
|
||||
|
||||
# GCC compiler options
|
||||
list(APPEND f90flags -cpp -std=f2008 -fbacktrace)
|
||||
list(APPEND cflags -cpp -std=c99)
|
||||
if(debug)
|
||||
if(NOT (GCC_VERSION VERSION_LESS 4.7))
|
||||
list(APPEND f90flags -Wall)
|
||||
list(APPEND cflags -Wall)
|
||||
endif()
|
||||
list(APPEND f90flags -g -pedantic -fbounds-check
|
||||
list(APPEND f90flags -g -Wall -pedantic -fbounds-check
|
||||
-ffpe-trap=invalid,overflow,underflow)
|
||||
list(APPEND cflags -g -pedantic -fbounds-check)
|
||||
list(APPEND cflags -g -Wall -pedantic -fbounds-check)
|
||||
list(APPEND ldflags -g)
|
||||
endif()
|
||||
if(profile)
|
||||
|
|
@ -225,27 +221,14 @@ if(GIT_SHA1_SUCCESS EQUAL 0)
|
|||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# FoX Fortran XML Library
|
||||
# pugixml library
|
||||
#===============================================================================
|
||||
|
||||
# Only initialize git submodules if it is not there. User is responsible
|
||||
# for future updates of fox xml submodule.
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/xml/fox/.git)
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
message("-- Cloning FoX XML git repository...")
|
||||
execute_process(COMMAND git clone https://github.com/mit-crpg/fox.git src/xml/fox
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
execute_process(COMMAND git checkout bdc852f4f43d969fb1b179cba79295c1e095a455
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/xml/fox)
|
||||
else()
|
||||
message("-- Initializing/Updating FoX XML submodule...")
|
||||
execute_process(COMMAND git submodule init
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
execute_process(COMMAND git submodule update
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
add_subdirectory(src/xml/fox)
|
||||
add_library(pugixml src/pugixml/pugixml_c.cpp src/pugixml/pugixml.cpp)
|
||||
set_property(TARGET pugixml PROPERTY CXX_STANDARD 11)
|
||||
|
||||
add_library(pugixml_fortran src/pugixml/pugixml_f.F90)
|
||||
target_link_libraries(pugixml_fortran pugixml)
|
||||
|
||||
#===============================================================================
|
||||
# RPATH information
|
||||
|
|
@ -259,7 +242,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|||
# Build faddeeva library
|
||||
#===============================================================================
|
||||
|
||||
add_library(faddeeva STATIC src/Faddeeva.c)
|
||||
add_library(faddeeva STATIC src/faddeeva/Faddeeva.c)
|
||||
|
||||
#===============================================================================
|
||||
# Build OpenMC executable
|
||||
|
|
@ -352,11 +335,12 @@ set(LIBOPENMC_FORTRAN_SRC
|
|||
src/vector_header.F90
|
||||
src/volume_calc.F90
|
||||
src/volume_header.F90
|
||||
src/xml_interface.F90
|
||||
src/xml/openmc_fox.F90)
|
||||
src/xml_interface.F90)
|
||||
add_library(libopenmc STATIC ${LIBOPENMC_FORTRAN_SRC})
|
||||
set_target_properties(libopenmc PROPERTIES OUTPUT_NAME openmc)
|
||||
add_executable(${program} src/main.F90)
|
||||
set_property(TARGET ${program} libopenmc pugixml_fortran
|
||||
PROPERTY LINKER_LANGUAGE Fortran)
|
||||
|
||||
# target_include_directories was added in CMake 2.8.11 and is the recommended
|
||||
# way to set include directories. For lesser versions, we revert to set_property
|
||||
|
|
@ -388,7 +372,7 @@ endforeach()
|
|||
|
||||
# target_link_libraries treats any arguments starting with - but not -l as
|
||||
# linker flags. Thus, we can pass both linker flags and libraries together.
|
||||
target_link_libraries(libopenmc ${ldflags} ${HDF5_LIBRARIES} fox_dom faddeeva)
|
||||
target_link_libraries(libopenmc ${ldflags} ${HDF5_LIBRARIES} pugixml_fortran faddeeva)
|
||||
target_link_libraries(${program} ${ldflags} libopenmc)
|
||||
|
||||
#===============================================================================
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
Development Team
|
||||
================
|
||||
|
||||
Active development of the OpenMC Monte Carlo code is currently led by:
|
||||
The following people have contributed to development of the OpenMC Monte Carlo
|
||||
code:
|
||||
|
||||
* `Paul Romano <https://github.com/paulromano>`_
|
||||
* `Bryan Herman <https://github.com/bhermanmit>`_
|
||||
|
|
@ -14,6 +15,9 @@ Active development of the OpenMC Monte Carlo code is currently led by:
|
|||
* `Sterling Harper <https://github.com/smharper>`_
|
||||
* `Will Boyd <https://github.com/wbinventor>`_
|
||||
* `Samuel Shaner <https://github.com/samuelshaner>`_
|
||||
* `Jingang Liang <https://github.com/liangjg>`_
|
||||
* `Colin Josey <https://github.com/cjosey>`_
|
||||
* `Amanda Lund <https://github.com/amandalund>`_
|
||||
* `Benoit Forget <http://web.mit.edu/nse/people/faculty/forget.html>`_
|
||||
* `Kord Smith <http://web.mit.edu/nse/people/faculty/smith.html>`_
|
||||
* `Andrew Siegel <http://www.mcs.anl.gov/person/andrew-siegel>`_
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ as debugging.
|
|||
structures
|
||||
styleguide
|
||||
workflow
|
||||
xml-parsing
|
||||
user-input
|
||||
docbuild
|
||||
|
|
|
|||
73
docs/source/devguide/user-input.rst
Normal file
73
docs/source/devguide/user-input.rst
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
.. _devguide_user_input:
|
||||
|
||||
=========================
|
||||
Making User Input Changes
|
||||
=========================
|
||||
|
||||
Users are encouraged to use OpenMC's :ref:`pythonapi` to build XML files that
|
||||
the OpenMC solver then reads during the initialization phase. Thus, to modify,
|
||||
add, or remove user input options, changes must be made both within the Python
|
||||
API and the Fortran source that reads XML files produced by the Python API. The
|
||||
following steps should be followed to make changes to user input:
|
||||
|
||||
1. Determine the Python class you need to change. For example, if you are adding
|
||||
a new setting, you probably want to change the :class:`openmc.Settings`
|
||||
class. If you are adding a new surface type, you would need to create a
|
||||
subclass of :class:`openmc.Surface`.
|
||||
|
||||
2. To add a new option, the class will need a `property attribute`_. For
|
||||
example, if you wanted to add a "fast_mode" setting, you would need two
|
||||
methods that look like:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@property
|
||||
def fast_mode(self):
|
||||
...
|
||||
|
||||
@fast_mode.setter
|
||||
def fast_mode(self, fast_mode):
|
||||
...
|
||||
|
||||
3. Make sure that when an instance of the class is exported to XML (usually
|
||||
through a ``export_to_xml()`` or ``to_xml_element()`` method), a new element
|
||||
is written to the appropriate file. OpenMC uses the
|
||||
:mod:`xml.etree.ElementTree` API, so refer to the documentation of that
|
||||
module for guidance on creating elements/attributes.
|
||||
|
||||
4. Make sure that your input can be categorized as one of the datatypes from
|
||||
`XML Schema Part 2`_ and that parsing of the data appropriately reflects
|
||||
this. For example, for a boolean_ value, true can be represented either by
|
||||
"true" or by "1".
|
||||
|
||||
5. Now that you're done with the Python side, you need to make modifications to
|
||||
the Fortran codebase. Make appropriate changes in the `input_xml module`_ to
|
||||
read your new user input. You should use procedures and types defined by the
|
||||
`xml_interface module`_.
|
||||
|
||||
6. If you've made changes in the geometry or materials, make sure they are
|
||||
written out to the statepoint or summary files and that the
|
||||
:class:`openmc.StatePoint` and :class:`openmc.Summary` classes read them in.
|
||||
|
||||
7. Finally, a set of `RELAX NG`_ schemas exists that enables validation of input
|
||||
files. You should modify the RELAX NG schema for the file you changed. The
|
||||
easiest way to do this is to change the `compact syntax`_ file
|
||||
(e.g. ``src/relaxng/geometry.rnc``) and then convert it to regular XML syntax
|
||||
using trang_::
|
||||
|
||||
trang geometry.rnc geometry.rng
|
||||
|
||||
For most user input additions and changes, it is simple enough to follow a
|
||||
"monkey see, monkey do" approach. When in doubt, contact your nearest OpenMC
|
||||
developer or send a message to the `developers mailing list`_.
|
||||
|
||||
|
||||
.. _property attribute: https://docs.python.org/3.6/library/functions.html#property
|
||||
.. _XML Schema Part 2: http://www.w3.org/TR/xmlschema-2/
|
||||
.. _boolean: http://www.w3.org/TR/xmlschema-2/#boolean
|
||||
.. _xml_interface module: https://github.com/mit-crpg/openmc/blob/develop/src/xml_interface.F90
|
||||
.. _input_xml module: https://github.com/mit-crpg/openmc/blob/develop/src/input_xml.F90
|
||||
.. _RELAX NG: http://relaxng.org/
|
||||
.. _compact syntax: http://relaxng.org/compact-tutorial-20030326.html
|
||||
.. _trang: http://www.thaiopensource.com/relaxng/trang.html
|
||||
.. _developers mailing list: https://groups.google.com/forum/?fromgroups=#!forum/openmc-dev
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
.. _devguide_xml-parsing:
|
||||
|
||||
=================
|
||||
XML Input Parsing
|
||||
=================
|
||||
|
||||
OpenMC relies on the FoX_ Fortran XML library for reading and intrepreting the
|
||||
XML input files for geometry, materials, settings, tallies, etc. The use of an
|
||||
XML format makes writing input files considerably more flexible than would
|
||||
otherwise be possible.
|
||||
|
||||
With the FoX library, extending the user input files to include new tags is
|
||||
fairly straightforward. The steps for modifying/adding input are as follows:
|
||||
|
||||
1. Add appropriate calls to procedures from the `xml_interface module`_, such as
|
||||
``check_for_node``, ``get_node_value``, and ``get_node_array``. All input
|
||||
reading is performed in the `input_xml module`_.
|
||||
|
||||
2. Make sure that your input can be categorized as one of the datatypes from
|
||||
`XML Schema Part 2`_ and that parsing of the data appropriately reflects
|
||||
this. For example, for a boolean_ value, true can be represented either by
|
||||
"true" or by "1".
|
||||
|
||||
3. Add code to check the variable for any possible errors.
|
||||
|
||||
A set of `RELAX NG`_ schemata exists that enables real-time validation of input
|
||||
files when using the GNU Emacs text editor. You should also modify the RELAX NG
|
||||
schema for the file you changed (e.g. src/relaxng/geometry.rnc) so that
|
||||
those who use Emacs can confirm whether their input is valid before they
|
||||
run. You will need to be familiar with RELAX NG `compact syntax`_.
|
||||
|
||||
Working with the FoX Submodule
|
||||
==============================
|
||||
|
||||
The FoX_ library is included as a submodule_ in OpenMC. This means that for a
|
||||
given commit in OpenMC, there is an associated commit id that links to FoX.
|
||||
The actual FoX source code is maintained at mit-crpg/fox, branch openmc. When
|
||||
cloning the OpenMC repo for the first time, you will notice that the directory
|
||||
*src/xml/fox* is empty. To fetch the submodule source code, you can manually
|
||||
enter the following from the root directory of OpenMC:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
It should be noted that if the submodule is not initialized and updated, *cmake*
|
||||
will automatically perform these commands if it cannot file the FoX source code.
|
||||
|
||||
If you navigate into the FoX source code in OpenMC, src/xml/fox, and check git
|
||||
information, you will notice that you are in a completely different repo. Actually,
|
||||
you are in a clone of mit-crpg/fox. If you have write access to this repo, you can
|
||||
make changes to the FoX source code, commit and push just like any other repo.
|
||||
Just because you make changes to the FoX source code in OpenMC or in a standalone
|
||||
repo, this does not mean that OpenMC will automatically fetch these changes. The
|
||||
way submodules work is that they are just stored as a commit id. To save FoX xml
|
||||
source changes to your OpenMC branch, do the following:
|
||||
|
||||
1. Go into src/xml/fox and check out the appropriate source code state
|
||||
|
||||
2. Navigate back out of fox subdirectory and type:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
git status
|
||||
|
||||
3. Make sure you see that git recognized that the state of FoX changed:
|
||||
|
||||
::
|
||||
|
||||
# On branch fox_submodule
|
||||
# Changes not staged for commit:
|
||||
# (use "git add <file>..." to update what will be committed)
|
||||
# (use "git checkout -- <file>..." to discard changes in working directory)
|
||||
#
|
||||
# modified: fox (new commits)
|
||||
|
||||
4. Commit and push this change
|
||||
|
||||
Editing FoX on Personal Fork
|
||||
============================
|
||||
|
||||
If you don't have write access to mit-crpg/fox and thus can't make a branch off of the openmc
|
||||
branch there, you will need to fork mit-crpg/fox to your personal account. You need to then
|
||||
link your branch in your OpenMC repo, to the *openmc* branch on your own personal FoX fork.
|
||||
To do this, edit the *.gitmodules* file in the root folder of the repo. It contains the
|
||||
following information:
|
||||
|
||||
::
|
||||
|
||||
[submodule "src/xml/fox"]
|
||||
path = src/xml/fox
|
||||
url = git@github.com:mit-crpg/fox
|
||||
|
||||
Change the url remote to your own fork. The commit id should stay constant until you start
|
||||
making modification to FoX yourself. Once you have made changes to your FoX fork and linked
|
||||
the new commit id to your OpenMC branch, you can pull request your changes in by peforming
|
||||
the following steps:
|
||||
|
||||
1. Create a pull request from your fork of FoX to mit-crpg/fox and wait until it
|
||||
is merged into the openmc branch.
|
||||
|
||||
2. In your OpenMC repo, change your *.gitmodules* file back to point at mit-crpg/fox.
|
||||
|
||||
3. Submit a pull request to mit-crpg/openmc
|
||||
|
||||
.. warning:: If you make changes to your FoX submodule inside of an OpenMC repo and do not
|
||||
commit, do **not** run *git submodule update*. This may throw away any changes that
|
||||
were not committed.
|
||||
|
||||
.. _FoX: https://github.com/mit-crpg/fox
|
||||
.. _xml_interface module: https://github.com/mit-crpg/openmc/blob/develop/src/xml_interface.F90
|
||||
.. _input_xml module: https://github.com/mit-crpg/openmc/blob/develop/src/input_xml.F90
|
||||
.. _XML Schema Part 2: http://www.w3.org/TR/xmlschema-2/
|
||||
.. _boolean: http://www.w3.org/TR/xmlschema-2/#boolean
|
||||
.. _RELAX NG: http://relaxng.org/
|
||||
.. _compact syntax: http://relaxng.org/compact-tutorial-20030326.html
|
||||
.. _submodule: http://git-scm.com/book/en/Git-Tools-Submodules
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -839,17 +839,27 @@ problem. It has the following attributes/sub-elements:
|
|||
|
||||
*Default*: None
|
||||
|
||||
.. _verbosity:
|
||||
|
||||
``<verbosity>`` Element
|
||||
-----------------------
|
||||
|
||||
The ``<verbosity>`` element tells the code how much information to display to
|
||||
the standard output. A higher verbosity corresponds to more information being
|
||||
displayed. This element takes the following attributes:
|
||||
displayed. The text of this element should be an integer between between 1
|
||||
and 10. The verbosity levels are defined as follows:
|
||||
|
||||
:value:
|
||||
The specified verbosity between 1 and 10.
|
||||
:1: don't display any output
|
||||
:2: only show OpenMC logo
|
||||
:3: all of the above + headers
|
||||
:4: all of the above + results
|
||||
:5: all of the above + file I/O
|
||||
:6: all of the above + timing statistics and initialization messages
|
||||
:7: all of the above + :math:`k` by generation
|
||||
:9: all of the above + indicate when each particle starts
|
||||
:10: all of the above + event information
|
||||
|
||||
*Default*: 5
|
||||
*Default*: 7
|
||||
|
||||
``<create_fission_neutrons>`` Element
|
||||
-------------------------------------
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ Now OpenMC should be recognized within the repository and can be installed:
|
|||
|
||||
.. code-block:: sh
|
||||
|
||||
sudo apt-get install openmc
|
||||
sudo apt install openmc
|
||||
|
||||
Binary packages from this PPA may exist for earlier versions of Ubuntu, but they
|
||||
are no longer supported.
|
||||
|
|
@ -88,7 +88,16 @@ Prerequisites
|
|||
If you are using Debian or a Debian derivative such as Ubuntu, you can
|
||||
install the gfortran compiler using the following command::
|
||||
|
||||
sudo apt-get install gfortran
|
||||
sudo apt install gfortran
|
||||
|
||||
* A C/C++ compiler such as gcc_
|
||||
|
||||
OpenMC includes two libraries written in C and C++, respectively. These
|
||||
libraries have been tested to work with a wide variety of compilers. If
|
||||
you are using a Debian-based distribution, you can install the g++
|
||||
compiler using the following command::
|
||||
|
||||
sudo apt install g++
|
||||
|
||||
* CMake_ cross-platform build system
|
||||
|
||||
|
|
@ -97,7 +106,7 @@ Prerequisites
|
|||
derivative such as Ubuntu, you can install CMake using the following
|
||||
command::
|
||||
|
||||
sudo apt-get install cmake
|
||||
sudo apt install cmake
|
||||
|
||||
* HDF5_ Library for portable binary output format
|
||||
|
||||
|
|
@ -125,7 +134,7 @@ Prerequisites
|
|||
|
||||
.. code-block:: sh
|
||||
|
||||
sudo apt-get install libhdf5-8 libhdf5-dev hdf5-helpers
|
||||
sudo apt install libhdf5-dev hdf5-helpers
|
||||
|
||||
Note that the exact package names may vary depending on your particular
|
||||
distribution and version.
|
||||
|
|
@ -140,12 +149,13 @@ Prerequisites
|
|||
with the latest versions of both OpenMPI_ and MPICH_. OpenMPI and/or MPICH
|
||||
can be installed on Debian derivatives with::
|
||||
|
||||
sudo apt-get install mpich libmpich-dev
|
||||
sudo apt-get install openmpi-bin libopenmpi1.6 libopenmpi-dev
|
||||
sudo apt install mpich libmpich-dev
|
||||
sudo apt install openmpi-bin libopenmpi-dev
|
||||
|
||||
* git_ version control software for obtaining source code
|
||||
|
||||
.. _gfortran: http://gcc.gnu.org/wiki/GFortran
|
||||
.. _gcc: https://gcc.gnu.org/
|
||||
.. _CMake: http://www.cmake.org
|
||||
.. _OpenMPI: http://www.open-mpi.org
|
||||
.. _MPICH: http://www.mpich.org
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import warnings
|
||||
|
||||
from openmc.arithmetic import *
|
||||
from openmc.cell import *
|
||||
from openmc.mesh import *
|
||||
|
|
@ -28,6 +30,9 @@ from openmc.mixin import *
|
|||
from openmc.plotter import *
|
||||
|
||||
try:
|
||||
from openmc.openmoc_compatible import *
|
||||
# Ignore matplotlib warning caused by OpenMOC calling matplotlib.use()
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore")
|
||||
from openmc.openmoc_compatible import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -6,16 +6,12 @@ from six import string_types
|
|||
|
||||
from openmc import VolumeCalculation
|
||||
|
||||
_summary_indicator = "TIMING STATISTICS"
|
||||
|
||||
|
||||
def _run(args, output, cwd):
|
||||
# Launch a subprocess
|
||||
p = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||
|
||||
storage_flag = False
|
||||
|
||||
# Capture and re-print OpenMC output in real-time
|
||||
while True:
|
||||
# If OpenMC is finished, break loop
|
||||
|
|
@ -23,17 +19,9 @@ def _run(args, output, cwd):
|
|||
if not line and p.poll() is not None:
|
||||
break
|
||||
|
||||
if output == 'full':
|
||||
if output:
|
||||
# If user requested output, print to screen
|
||||
print(line, end='')
|
||||
elif output == 'summary' and _summary_indicator in line:
|
||||
# If they requested a summary, look for the start of the summary
|
||||
storage_flag = True
|
||||
|
||||
if storage_flag:
|
||||
# If a summary is requested, and we have reached the summary,
|
||||
# then print it
|
||||
print(line, end='')
|
||||
|
||||
# Return the returncode (integer, zero if no problems encountered)
|
||||
return p.returncode
|
||||
|
|
@ -52,8 +40,6 @@ def plot_geometry(output=True, openmc_exec='openmc', cwd='.'):
|
|||
Path to working directory to run in. Defaults to the current working directory.
|
||||
|
||||
"""
|
||||
if output:
|
||||
output = 'full'
|
||||
return _run([openmc_exec, '-p'], output, cwd)
|
||||
|
||||
|
||||
|
|
@ -102,13 +88,11 @@ def calculate_volumes(threads=None, output=True, cwd='.',
|
|||
if mpi_args is not None:
|
||||
args = mpi_args + args
|
||||
|
||||
if output:
|
||||
output = 'full'
|
||||
return _run(args, output, cwd)
|
||||
|
||||
|
||||
def run(particles=None, threads=None, geometry_debug=False,
|
||||
restart_file=None, tracks=False, output='full', cwd='.',
|
||||
restart_file=None, tracks=False, output=True, cwd='.',
|
||||
openmc_exec='openmc', mpi_args=None):
|
||||
"""Run an OpenMC simulation.
|
||||
|
||||
|
|
@ -127,10 +111,8 @@ def run(particles=None, threads=None, geometry_debug=False,
|
|||
Path to restart file to use
|
||||
tracks : bool, optional
|
||||
Write tracks for all particles. Defaults to False.
|
||||
output : {"full", "summary", "none", False}, optional
|
||||
Degree of OpenMC output captured from standard out. "full" prints all
|
||||
output; "summary" prints only the results summary, and "none" or False
|
||||
does not show the output. Defaults to "full".
|
||||
output : bool
|
||||
Capture OpenMC output from standard out
|
||||
cwd : str, optional
|
||||
Path to working directory to run in. Defaults to the current working
|
||||
directory.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import division
|
||||
from abc import ABCMeta
|
||||
from collections import Iterable, OrderedDict
|
||||
import copy
|
||||
|
|
@ -425,7 +426,7 @@ class Filter(object):
|
|||
df = pd.DataFrame()
|
||||
|
||||
filter_bins = np.repeat(self.bins, self.stride)
|
||||
tile_factor = data_size / len(filter_bins)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
df = pd.concat([df, pd.DataFrame(
|
||||
{self.short_name.lower(): filter_bins})])
|
||||
|
|
@ -613,7 +614,7 @@ class SurfaceFilter(IntegralFilter):
|
|||
df = pd.DataFrame()
|
||||
|
||||
filter_bins = np.repeat(self.bins, self.stride)
|
||||
tile_factor = data_size / len(filter_bins)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_bins = [_CURRENT_NAMES[x] for x in filter_bins]
|
||||
df = pd.concat([df, pd.DataFrame(
|
||||
|
|
@ -781,26 +782,26 @@ class MeshFilter(Filter):
|
|||
nz = 1
|
||||
|
||||
# Generate multi-index sub-column for x-axis
|
||||
filter_bins = np.arange(1, nx+1)
|
||||
filter_bins = np.arange(1, nx + 1)
|
||||
repeat_factor = ny * nz * self.stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size / len(filter_bins)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'x')] = filter_bins
|
||||
|
||||
# Generate multi-index sub-column for y-axis
|
||||
filter_bins = np.arange(1, ny+1)
|
||||
filter_bins = np.arange(1, ny + 1)
|
||||
repeat_factor = nz * self.stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size / len(filter_bins)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'y')] = filter_bins
|
||||
|
||||
# Generate multi-index sub-column for z-axis
|
||||
filter_bins = np.arange(1, nz+1)
|
||||
filter_bins = np.arange(1, nz + 1)
|
||||
repeat_factor = self.stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size / len(filter_bins)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'z')] = filter_bins
|
||||
|
||||
|
|
@ -1008,7 +1009,7 @@ class EnergyFilter(RealFilter):
|
|||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
tile_factor = int(data_size / len(lo_bins))
|
||||
tile_factor = data_size // len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
||||
|
|
@ -1281,7 +1282,7 @@ class DistribcellFilter(Filter):
|
|||
# Tile the Multi-index columns
|
||||
for level_key, level_bins in level_dict.items():
|
||||
level_bins = np.repeat(level_bins, self.stride)
|
||||
tile_factor = data_size / len(level_bins)
|
||||
tile_factor = data_size // len(level_bins)
|
||||
level_bins = np.tile(level_bins, tile_factor)
|
||||
level_dict[level_key] = level_bins
|
||||
|
||||
|
|
@ -1297,7 +1298,7 @@ class DistribcellFilter(Filter):
|
|||
# requests Summary geometric information
|
||||
filter_bins = np.arange(self.num_bins)
|
||||
filter_bins = np.repeat(filter_bins, self.stride)
|
||||
tile_factor = data_size / len(filter_bins)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
df = pd.DataFrame({self.short_name.lower() : filter_bins})
|
||||
|
||||
|
|
@ -1402,7 +1403,7 @@ class MuFilter(RealFilter):
|
|||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
tile_factor = data_size / len(lo_bins)
|
||||
tile_factor = data_size // len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
||||
|
|
@ -1505,7 +1506,7 @@ class PolarFilter(RealFilter):
|
|||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
tile_factor = data_size / len(lo_bins)
|
||||
tile_factor = data_size // len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
||||
|
|
@ -1608,7 +1609,7 @@ class AzimuthalFilter(RealFilter):
|
|||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
tile_factor = data_size / len(lo_bins)
|
||||
tile_factor = data_size // len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
||||
|
|
@ -1871,7 +1872,7 @@ class EnergyFunctionFilter(Filter):
|
|||
out = out[:14]
|
||||
|
||||
filter_bins = np.repeat(out, self.stride)
|
||||
tile_factor = data_size / len(filter_bins)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
df = pd.concat([df, pd.DataFrame(
|
||||
{self.short_name.lower(): filter_bins})])
|
||||
|
|
|
|||
|
|
@ -230,8 +230,8 @@ class Geometry(object):
|
|||
"""
|
||||
material_universes = OrderedDict()
|
||||
|
||||
for universe in self.get_all_universes():
|
||||
for cell in universe.cells:
|
||||
for universe in self.get_all_universes().values():
|
||||
for cell in universe.cells.values():
|
||||
if cell.fill_type in ('material', 'distribmat', 'void'):
|
||||
if universe not in material_universes:
|
||||
material_universes[universe.id] = universe
|
||||
|
|
@ -249,7 +249,7 @@ class Geometry(object):
|
|||
"""
|
||||
lattices = OrderedDict()
|
||||
|
||||
for cell in self.get_all_cells():
|
||||
for cell in self.get_all_cells().values():
|
||||
if cell.fill_type == 'lattice':
|
||||
if cell.fill not in lattices:
|
||||
lattices[cell.fill.id] = cell.fill
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class Lattice(object):
|
|||
|
||||
"""
|
||||
lattice_id = int(group.name.split('/')[-1].lstrip('lattice '))
|
||||
name = group['name'].value.decode()
|
||||
name = group['name'].value.decode() if 'name' in group else ''
|
||||
lattice_type = group['type'].value.decode()
|
||||
|
||||
if 'offsets' in group:
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ class Material(object):
|
|||
"""
|
||||
mat_id = int(group.name.split('/')[-1].lstrip('material '))
|
||||
|
||||
name = group['name'].value.decode()
|
||||
name = group['name'].value.decode() if 'name' in group else ''
|
||||
density = group['atom_density'].value
|
||||
nuc_densities = group['nuclide_densities'][...]
|
||||
nuclides = group['nuclides'].value
|
||||
|
|
|
|||
|
|
@ -331,7 +331,10 @@ class Mesh(EqualityMixin):
|
|||
|
||||
lattice = openmc.RectLattice()
|
||||
lattice.lower_left = self.lower_left
|
||||
lattice.universes = np.reshape(universes, self.dimension)
|
||||
|
||||
# Assign the universe and rotate to match the indexing expected for
|
||||
# the lattice
|
||||
lattice.universes = np.rot90(np.reshape(universes, self.dimension))
|
||||
|
||||
if self.width is not None:
|
||||
lattice.pitch = self.width
|
||||
|
|
|
|||
|
|
@ -142,7 +142,8 @@ class Settings(object):
|
|||
Mesh to be used for redistributing source sites via the uniform fision
|
||||
site (UFS) method.
|
||||
verbosity : int
|
||||
Verbosity during simulation between 1 and 10
|
||||
Verbosity during simulation between 1 and 10. Verbosity levels are
|
||||
described in :ref:`verbosity`.
|
||||
volume_calculations : VolumeCalculation or iterable of VolumeCalculation
|
||||
Stochastic volume calculation specifications
|
||||
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ class StatePoint(object):
|
|||
# Create Tally object and assign basic properties
|
||||
tally = openmc.Tally(tally_id)
|
||||
tally._sp_filename = self._f.filename
|
||||
tally.name = group['name'].value.decode()
|
||||
tally.name = group['name'].value.decode() if 'name' in group else ''
|
||||
tally.estimator = group['estimator'].value.decode()
|
||||
tally.num_realizations = n_realizations
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class Summary(object):
|
|||
|
||||
for key, group in self._f['geometry/cells'].items():
|
||||
cell_id = int(key.lstrip('cell '))
|
||||
name = group['name'].value.decode()
|
||||
name = group['name'].value.decode() if 'name' in group else ''
|
||||
fill_type = group['fill_type'].value.decode()
|
||||
|
||||
if fill_type == 'material':
|
||||
|
|
@ -115,10 +115,7 @@ class Summary(object):
|
|||
else:
|
||||
fill = group['lattice'].value
|
||||
|
||||
if 'region' in group.keys():
|
||||
region = group['region'].value.decode()
|
||||
else:
|
||||
region = []
|
||||
region = group['region'].value.decode() if 'region' in group else ''
|
||||
|
||||
# Create this Cell
|
||||
cell = openmc.Cell(cell_id=cell_id, name=name)
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class Surface(object):
|
|||
|
||||
"""
|
||||
surface_id = int(group.name.split('/')[-1].lstrip('surface '))
|
||||
name = group['name'].value.decode()
|
||||
name = group['name'].value.decode() if 'name' in group else ''
|
||||
surf_type = group['type'].value.decode()
|
||||
bc = group['boundary_type'].value.decode()
|
||||
coeffs = group['coefficients'][...]
|
||||
|
|
|
|||
|
|
@ -782,7 +782,7 @@ contains
|
|||
|
||||
! write that dhats are zero
|
||||
if (dhat_reset) then
|
||||
call write_message('Dhats reset to zero.', 1)
|
||||
call write_message('Dhats reset to zero.', 8)
|
||||
end if
|
||||
|
||||
end subroutine compute_dhat
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ contains
|
|||
integer :: i ! loop counter
|
||||
|
||||
! Print message
|
||||
call write_message("CMFD tallies reset", 7)
|
||||
call write_message("CMFD tallies reset", 6)
|
||||
|
||||
! Reset CMFD tallies
|
||||
do i = 1, size(cmfd_tallies)
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ contains
|
|||
logical :: file_exists ! does cmfd.xml exist?
|
||||
logical :: found
|
||||
character(MAX_LINE_LEN) :: filename
|
||||
character(MAX_LINE_LEN) :: temp_str
|
||||
real(8) :: gs_tol(2)
|
||||
type(Node), pointer :: doc => null()
|
||||
type(Node), pointer :: node_mesh => null()
|
||||
type(XMLDocument) :: doc
|
||||
type(XMLNode) :: root
|
||||
type(XMLNode) :: node_mesh
|
||||
|
||||
! Read cmfd input file
|
||||
filename = trim(path_input) // "cmfd.xml"
|
||||
|
|
@ -84,13 +84,14 @@ contains
|
|||
end if
|
||||
|
||||
! Parse cmfd.xml file
|
||||
call open_xmldoc(doc, filename)
|
||||
call doc % load_file(filename)
|
||||
root = doc % document_element()
|
||||
|
||||
! Get pointer to mesh XML node
|
||||
call get_node_ptr(doc, "mesh", node_mesh, found = found)
|
||||
node_mesh = root % child("mesh")
|
||||
|
||||
! Check if mesh is there
|
||||
if (.not.found) then
|
||||
if (.not. node_mesh % associated()) then
|
||||
call fatal_error("No CMFD mesh specified in CMFD XML file.")
|
||||
end if
|
||||
|
||||
|
|
@ -99,8 +100,8 @@ contains
|
|||
|
||||
! Get number of energy groups
|
||||
if (check_for_node(node_mesh, "energy")) then
|
||||
ng = get_arraysize_double(node_mesh, "energy")
|
||||
if(.not.allocated(cmfd%egrid)) allocate(cmfd%egrid(ng))
|
||||
ng = node_word_count(node_mesh, "energy")
|
||||
if(.not. allocated(cmfd%egrid)) allocate(cmfd%egrid(ng))
|
||||
call get_node_array(node_mesh, "energy", cmfd%egrid)
|
||||
cmfd % indices(4) = ng - 1 ! sets energy group dimension
|
||||
! If using MG mode, check to see if these egrid points at least match
|
||||
|
|
@ -137,11 +138,11 @@ contains
|
|||
if (check_for_node(node_mesh, "map")) then
|
||||
allocate(cmfd % coremap(cmfd % indices(1), cmfd % indices(2), &
|
||||
cmfd % indices(3)))
|
||||
if (get_arraysize_integer(node_mesh, "map") /= &
|
||||
if (node_word_count(node_mesh, "map") /= &
|
||||
product(cmfd % indices(1:3))) then
|
||||
call fatal_error('CMFD coremap not to correct dimensions')
|
||||
end if
|
||||
allocate(iarray(get_arraysize_integer(node_mesh, "map")))
|
||||
allocate(iarray(node_word_count(node_mesh, "map")))
|
||||
call get_node_array(node_mesh, "map", iarray)
|
||||
cmfd % coremap = reshape(iarray,(cmfd % indices(1:3)))
|
||||
cmfd_coremap = .true.
|
||||
|
|
@ -149,71 +150,53 @@ contains
|
|||
end if
|
||||
|
||||
! Check for normalization constant
|
||||
if (check_for_node(doc, "norm")) then
|
||||
call get_node_value(doc, "norm", cmfd % norm)
|
||||
if (check_for_node(root, "norm")) then
|
||||
call get_node_value(root, "norm", cmfd % norm)
|
||||
end if
|
||||
|
||||
! Set feedback logical
|
||||
if (check_for_node(doc, "feedback")) then
|
||||
call get_node_value(doc, "feedback", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
cmfd_feedback = .true.
|
||||
if (check_for_node(root, "feedback")) then
|
||||
call get_node_value(root, "feedback", cmfd_feedback)
|
||||
end if
|
||||
|
||||
! Set downscatter logical
|
||||
if (check_for_node(doc, "downscatter")) then
|
||||
call get_node_value(doc, "downscatter", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
cmfd_downscatter = .true.
|
||||
if (check_for_node(root, "downscatter")) then
|
||||
call get_node_value(root, "downscatter", cmfd_downscatter)
|
||||
end if
|
||||
|
||||
! Reset dhat parameters
|
||||
if (check_for_node(doc, "dhat_reset")) then
|
||||
call get_node_value(doc, "dhat_reset", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
dhat_reset = .true.
|
||||
if (check_for_node(root, "dhat_reset")) then
|
||||
call get_node_value(root, "dhat_reset", dhat_reset)
|
||||
end if
|
||||
|
||||
! Set monitoring
|
||||
if (check_for_node(doc, "power_monitor")) then
|
||||
call get_node_value(doc, "power_monitor", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
cmfd_power_monitor = .true.
|
||||
if (check_for_node(root, "power_monitor")) then
|
||||
call get_node_value(root, "power_monitor", cmfd_power_monitor)
|
||||
end if
|
||||
|
||||
! Output logicals
|
||||
if (check_for_node(doc, "write_matrices")) then
|
||||
call get_node_value(doc, "write_matrices", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
cmfd_write_matrices = .true.
|
||||
if (check_for_node(root, "write_matrices")) then
|
||||
call get_node_value(root, "write_matrices", cmfd_write_matrices)
|
||||
end if
|
||||
|
||||
! Run an adjoint calc
|
||||
if (check_for_node(doc, "run_adjoint")) then
|
||||
call get_node_value(doc, "run_adjoint", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
cmfd_run_adjoint = .true.
|
||||
if (check_for_node(root, "run_adjoint")) then
|
||||
call get_node_value(root, "run_adjoint", cmfd_run_adjoint)
|
||||
end if
|
||||
|
||||
! Batch to begin cmfd
|
||||
if (check_for_node(doc, "begin")) &
|
||||
call get_node_value(doc, "begin", cmfd_begin)
|
||||
if (check_for_node(root, "begin")) &
|
||||
call get_node_value(root, "begin", cmfd_begin)
|
||||
|
||||
! Check for cmfd tally resets
|
||||
if (check_for_node(doc, "tally_reset")) then
|
||||
n_cmfd_resets = get_arraysize_integer(doc, "tally_reset")
|
||||
if (check_for_node(root, "tally_reset")) then
|
||||
n_cmfd_resets = node_word_count(root, "tally_reset")
|
||||
else
|
||||
n_cmfd_resets = 0
|
||||
end if
|
||||
if (n_cmfd_resets > 0) then
|
||||
allocate(int_array(n_cmfd_resets))
|
||||
call get_node_array(doc, "tally_reset", int_array)
|
||||
call get_node_array(root, "tally_reset", int_array)
|
||||
do i = 1, n_cmfd_resets
|
||||
call cmfd_reset % add(int_array(i))
|
||||
end do
|
||||
|
|
@ -221,34 +204,34 @@ contains
|
|||
end if
|
||||
|
||||
! Get display
|
||||
if (check_for_node(doc, "display")) &
|
||||
call get_node_value(doc, "display", cmfd_display)
|
||||
if (check_for_node(root, "display")) &
|
||||
call get_node_value(root, "display", cmfd_display)
|
||||
|
||||
! Read in spectral radius estimate and tolerances
|
||||
if (check_for_node(doc, "spectral")) &
|
||||
call get_node_value(doc, "spectral", cmfd_spectral)
|
||||
if (check_for_node(doc, "shift")) &
|
||||
call get_node_value(doc, "shift", cmfd_shift)
|
||||
if (check_for_node(doc, "ktol")) &
|
||||
call get_node_value(doc, "ktol", cmfd_ktol)
|
||||
if (check_for_node(doc, "stol")) &
|
||||
call get_node_value(doc, "stol", cmfd_stol)
|
||||
if (check_for_node(doc, "gauss_seidel_tolerance")) then
|
||||
n_params = get_arraysize_double(doc, "gauss_seidel_tolerance")
|
||||
if (check_for_node(root, "spectral")) &
|
||||
call get_node_value(root, "spectral", cmfd_spectral)
|
||||
if (check_for_node(root, "shift")) &
|
||||
call get_node_value(root, "shift", cmfd_shift)
|
||||
if (check_for_node(root, "ktol")) &
|
||||
call get_node_value(root, "ktol", cmfd_ktol)
|
||||
if (check_for_node(root, "stol")) &
|
||||
call get_node_value(root, "stol", cmfd_stol)
|
||||
if (check_for_node(root, "gauss_seidel_tolerance")) then
|
||||
n_params = node_word_count(root, "gauss_seidel_tolerance")
|
||||
if (n_params /= 2) then
|
||||
call fatal_error('Gauss Seidel tolerance is not 2 parameters &
|
||||
&(absolute, relative).')
|
||||
end if
|
||||
call get_node_array(doc, "gauss_seidel_tolerance", gs_tol)
|
||||
call get_node_array(root, "gauss_seidel_tolerance", gs_tol)
|
||||
cmfd_atoli = gs_tol(1)
|
||||
cmfd_rtoli = gs_tol(2)
|
||||
end if
|
||||
|
||||
! Create tally objects
|
||||
call create_cmfd_tally(doc)
|
||||
call create_cmfd_tally(root)
|
||||
|
||||
! Close CMFD XML file
|
||||
call close_xmldoc(doc)
|
||||
call doc % clear()
|
||||
|
||||
end subroutine read_cmfd_xml
|
||||
|
||||
|
|
@ -261,7 +244,7 @@ contains
|
|||
! 3: Surface current
|
||||
!===============================================================================
|
||||
|
||||
subroutine create_cmfd_tally(doc)
|
||||
subroutine create_cmfd_tally(root)
|
||||
|
||||
use constants, only: MAX_LINE_LEN
|
||||
use error, only: fatal_error, warning
|
||||
|
|
@ -274,9 +257,8 @@ contains
|
|||
use tally_initialize, only: add_tallies
|
||||
use xml_interface
|
||||
|
||||
type(Node), pointer :: doc ! pointer to XML doc info
|
||||
type(XMLNode), intent(in) :: root ! XML root element
|
||||
|
||||
character(MAX_LINE_LEN) :: temp_str ! temp string
|
||||
integer :: i, j ! loop counter
|
||||
integer :: n ! size of arrays in mesh specification
|
||||
integer :: ng ! number of energy groups (default 1)
|
||||
|
|
@ -287,7 +269,7 @@ contains
|
|||
type(TallyObject), pointer :: t
|
||||
type(RegularMesh), pointer :: m
|
||||
type(TallyFilterContainer) :: filters(N_FILTER_TYPES) ! temporary filters
|
||||
type(Node), pointer :: node_mesh
|
||||
type(XMLNode) :: node_mesh
|
||||
|
||||
! Set global variables if they are 0 (this can happen if there is no tally
|
||||
! file)
|
||||
|
|
@ -304,10 +286,10 @@ contains
|
|||
m % type = LATTICE_RECT
|
||||
|
||||
! Get pointer to mesh XML node
|
||||
call get_node_ptr(doc, "mesh", node_mesh)
|
||||
node_mesh = root % child("mesh")
|
||||
|
||||
! Determine number of dimensions for mesh
|
||||
n = get_arraysize_integer(node_mesh, "dimension")
|
||||
n = node_word_count(node_mesh, "dimension")
|
||||
if (n /= 2 .and. n /= 3) then
|
||||
call fatal_error("Mesh must be two or three dimensions.")
|
||||
end if
|
||||
|
|
@ -330,7 +312,7 @@ contains
|
|||
m % dimension = iarray3(1:n)
|
||||
|
||||
! Read mesh lower-left corner location
|
||||
if (m % n_dimension /= get_arraysize_double(node_mesh, "lower_left")) then
|
||||
if (m % n_dimension /= node_word_count(node_mesh, "lower_left")) then
|
||||
call fatal_error("Number of entries on <lower_left> must be the same as &
|
||||
&the number of entries on <dimension>.")
|
||||
end if
|
||||
|
|
@ -352,8 +334,8 @@ contains
|
|||
|
||||
if (check_for_node(node_mesh, "width")) then
|
||||
! Check to ensure width has same dimensions
|
||||
if (get_arraysize_double(node_mesh, "width") /= &
|
||||
get_arraysize_double(node_mesh, "lower_left")) then
|
||||
if (node_word_count(node_mesh, "width") /= &
|
||||
node_word_count(node_mesh, "lower_left")) then
|
||||
call fatal_error("Number of entries on <width> must be the same as the &
|
||||
&number of entries on <lower_left>.")
|
||||
end if
|
||||
|
|
@ -370,8 +352,8 @@ contains
|
|||
|
||||
elseif (check_for_node(node_mesh, "upper_right")) then
|
||||
! Check to ensure width has same dimensions
|
||||
if (get_arraysize_double(node_mesh, "upper_right") /= &
|
||||
get_arraysize_double(node_mesh, "lower_left")) then
|
||||
if (node_word_count(node_mesh, "upper_right") /= &
|
||||
node_word_count(node_mesh, "lower_left")) then
|
||||
call fatal_error("Number of entries on <upper_right> must be the same &
|
||||
&as the number of entries on <lower_left>.")
|
||||
end if
|
||||
|
|
@ -404,11 +386,8 @@ contains
|
|||
t => cmfd_tallies(i)
|
||||
|
||||
! Set reset property
|
||||
if (check_for_node(doc, "reset")) then
|
||||
call get_node_value(doc, "reset", temp_str)
|
||||
temp_str = to_lower(temp_str)
|
||||
if (trim(temp_str) == 'true' .or. trim(temp_str) == '1') &
|
||||
t % reset = .true.
|
||||
if (check_for_node(root, "reset")) then
|
||||
call get_node_value(root, "reset", t % reset)
|
||||
end if
|
||||
|
||||
! Set up mesh filter
|
||||
|
|
@ -427,7 +406,7 @@ contains
|
|||
allocate(EnergyFilter :: filters(n_filters) % obj)
|
||||
select type (filt => filters(n_filters) % obj)
|
||||
type is (EnergyFilter)
|
||||
ng = get_arraysize_double(node_mesh, "energy")
|
||||
ng = node_word_count(node_mesh, "energy")
|
||||
filt % n_bins = ng - 1
|
||||
allocate(filt % bins(ng))
|
||||
call get_node_array(node_mesh, "energy", filt % bins)
|
||||
|
|
@ -492,7 +471,7 @@ contains
|
|||
allocate(EnergyoutFilter :: filters(n_filters) % obj)
|
||||
select type (filt => filters(n_filters) % obj)
|
||||
type is (EnergyoutFilter)
|
||||
ng = get_arraysize_double(node_mesh, "energy")
|
||||
ng = node_word_count(node_mesh, "energy")
|
||||
filt % n_bins = ng - 1
|
||||
allocate(filt % bins(ng))
|
||||
call get_node_array(node_mesh, "energy", filt % bins)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ module constants
|
|||
integer, parameter :: MAX_LINE_LEN = 250
|
||||
integer, parameter :: MAX_WORD_LEN = 150
|
||||
integer, parameter :: MAX_FILE_LEN = 255
|
||||
integer, parameter :: REGION_SPEC_LEN = 1000
|
||||
|
||||
! Maximum number of external source spatial resamples to encounter before an
|
||||
! error is thrown.
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ module distribution_univariate
|
|||
use error, only: fatal_error
|
||||
use random_lcg, only: prn
|
||||
use math, only: maxwell_spectrum, watt_spectrum
|
||||
use pugixml
|
||||
use string, only: to_lower
|
||||
use xml_interface
|
||||
|
||||
|
|
@ -265,7 +266,7 @@ contains
|
|||
|
||||
subroutine distribution_from_xml(dist, node_dist)
|
||||
class(Distribution), allocatable, intent(inout) :: dist
|
||||
type(Node), pointer :: node_dist
|
||||
type(XMLNode), intent(in) :: node_dist
|
||||
|
||||
character(MAX_WORD_LEN) :: type
|
||||
character(MAX_LINE_LEN) :: temp_str
|
||||
|
|
@ -279,7 +280,7 @@ contains
|
|||
|
||||
! Determine number of parameters specified
|
||||
if (check_for_node(node_dist, "parameters")) then
|
||||
n = get_arraysize_double(node_dist, "parameters")
|
||||
n = node_word_count(node_dist, "parameters")
|
||||
else
|
||||
n = 0
|
||||
end if
|
||||
|
|
|
|||
|
|
@ -1011,7 +1011,7 @@ contains
|
|||
type(VectorInt), allocatable :: neighbor_neg(:)
|
||||
|
||||
call write_message("Building neighboring cells lists for each surface...", &
|
||||
4)
|
||||
6)
|
||||
|
||||
allocate(neighbor_pos(n_surfaces))
|
||||
allocate(neighbor_neg(n_surfaces))
|
||||
|
|
|
|||
|
|
@ -1758,8 +1758,8 @@ contains
|
|||
integer(HID_T) :: dset ! data set handle
|
||||
integer(HID_T) :: dspace ! data or file space handle
|
||||
integer(HID_T) :: filetype
|
||||
integer(HID_T) :: memtype
|
||||
integer(SIZE_T) :: n
|
||||
integer(SIZE_T) :: i, n
|
||||
character(kind=C_CHAR), allocatable, target :: temp_buffer(:)
|
||||
type(c_ptr) :: f_ptr
|
||||
|
||||
! Set up collective vs. independent I/O
|
||||
|
|
@ -1770,35 +1770,38 @@ contains
|
|||
|
||||
! Create datatype for HDF5 file based on C char
|
||||
n = len_trim(buffer)
|
||||
call h5tcopy_f(H5T_C_S1, filetype, hdf5_err)
|
||||
call h5tset_size_f(filetype, n + 1, hdf5_err)
|
||||
if (n > 0) then
|
||||
call h5tcopy_f(H5T_C_S1, filetype, hdf5_err)
|
||||
call h5tset_size_f(filetype, n, hdf5_err)
|
||||
|
||||
! Create datatype in memory based on Fortran character
|
||||
call h5tcopy_f(H5T_FORTRAN_S1, memtype, hdf5_err)
|
||||
if (n > 0) call h5tset_size_f(memtype, n, hdf5_err)
|
||||
! Create dataspace/dataset
|
||||
call h5screate_f(H5S_SCALAR_F, dspace, hdf5_err)
|
||||
call h5dcreate_f(group_id, trim(name), filetype, dspace, dset, hdf5_err)
|
||||
|
||||
! Create dataspace/dataset
|
||||
call h5screate_f(H5S_SCALAR_F, dspace, hdf5_err)
|
||||
call h5dcreate_f(group_id, trim(name), filetype, dspace, dset, hdf5_err)
|
||||
! Copy string to temporary buffer
|
||||
allocate(temp_buffer(n))
|
||||
do i = 1, n
|
||||
temp_buffer(i) = buffer(i:i)
|
||||
end do
|
||||
|
||||
! Get pointer to start of string
|
||||
f_ptr = c_loc(buffer(1:1))
|
||||
! Get pointer to start of string
|
||||
f_ptr = c_loc(temp_buffer(1))
|
||||
|
||||
if (using_mpio_device(group_id)) then
|
||||
if (using_mpio_device(group_id)) then
|
||||
#ifdef PHDF5
|
||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist, hdf5_err)
|
||||
call h5pset_dxpl_mpio_f(plist, data_xfer_mode, hdf5_err)
|
||||
if (n > 0) call h5dwrite_f(dset, memtype, f_ptr, hdf5_err, xfer_prp=plist)
|
||||
call h5pclose_f(plist, hdf5_err)
|
||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist, hdf5_err)
|
||||
call h5pset_dxpl_mpio_f(plist, data_xfer_mode, hdf5_err)
|
||||
call h5dwrite_f(dset, filetype, f_ptr, hdf5_err, xfer_prp=plist)
|
||||
call h5pclose_f(plist, hdf5_err)
|
||||
#endif
|
||||
else
|
||||
if (n > 0) call h5dwrite_f(dset, memtype, f_ptr, hdf5_err)
|
||||
end if
|
||||
else
|
||||
call h5dwrite_f(dset, filetype, f_ptr, hdf5_err)
|
||||
end if
|
||||
|
||||
call h5dclose_f(dset, hdf5_err)
|
||||
call h5sclose_f(dspace, hdf5_err)
|
||||
call h5tclose_f(memtype, hdf5_err)
|
||||
call h5tclose_f(filetype, hdf5_err)
|
||||
call h5dclose_f(dset, hdf5_err)
|
||||
call h5sclose_f(dspace, hdf5_err)
|
||||
call h5tclose_f(filetype, hdf5_err)
|
||||
end if
|
||||
end subroutine write_string
|
||||
|
||||
!===============================================================================
|
||||
|
|
@ -1817,11 +1820,10 @@ contains
|
|||
integer(HID_T) :: plist ! property list
|
||||
#endif
|
||||
integer(HID_T) :: dset_id
|
||||
integer(HID_T) :: space_id
|
||||
integer(HID_T) :: filetype
|
||||
integer(HID_T) :: memtype
|
||||
integer(SIZE_T) :: size
|
||||
integer(SIZE_T) :: n
|
||||
integer(SIZE_T) :: i, n
|
||||
character(kind=C_CHAR), allocatable, target :: temp_buffer(:)
|
||||
type(c_ptr) :: f_ptr
|
||||
|
||||
if (present(name)) then
|
||||
|
|
@ -1836,40 +1838,41 @@ contains
|
|||
if (indep) data_xfer_mode = H5FD_MPIO_INDEPENDENT_F
|
||||
end if
|
||||
|
||||
! Get dataspace
|
||||
call h5dget_space_f(dset_id, space_id, hdf5_err)
|
||||
|
||||
! Make sure buffer is large enough
|
||||
call h5dget_type_f(dset_id, filetype, hdf5_err)
|
||||
call h5tget_size_f(filetype, size, hdf5_err)
|
||||
if (size > len(buffer) + 1) then
|
||||
call h5tget_size_f(filetype, n, hdf5_err)
|
||||
if (n > len(buffer)) then
|
||||
call fatal_error("Character buffer is not long enough to &
|
||||
&read HDF5 string.")
|
||||
end if
|
||||
|
||||
! Get datatype in memory based on Fortran character
|
||||
n = len(buffer)
|
||||
call h5tcopy_f(H5T_FORTRAN_S1, memtype, hdf5_err)
|
||||
call h5tset_size_f(memtype, n, hdf5_err)
|
||||
call h5tcopy_f(H5T_C_S1, memtype, hdf5_err)
|
||||
call h5tset_size_f(memtype, n + 1, hdf5_err)
|
||||
|
||||
! Get pointer to start of string
|
||||
f_ptr = c_loc(buffer(1:1))
|
||||
allocate(temp_buffer(n))
|
||||
f_ptr = c_loc(temp_buffer(1))
|
||||
|
||||
if (using_mpio_device(dset_id)) then
|
||||
#ifdef PHDF5
|
||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist, hdf5_err)
|
||||
call h5pset_dxpl_mpio_f(plist, data_xfer_mode, hdf5_err)
|
||||
call h5dread_f(dset_id, memtype, f_ptr, hdf5_err, &
|
||||
mem_space_id=space_id, xfer_prp=plist)
|
||||
call h5dread_f(dset_id, memtype, f_ptr, hdf5_err, xfer_prp=plist)
|
||||
call h5pclose_f(plist, hdf5_err)
|
||||
#endif
|
||||
else
|
||||
call h5dread_f(dset_id, memtype, f_ptr, hdf5_err, mem_space_id=space_id)
|
||||
call h5dread_f(dset_id, memtype, f_ptr, hdf5_err)
|
||||
end if
|
||||
|
||||
buffer = ''
|
||||
do i = 1, n
|
||||
if (temp_buffer(i) == C_NULL_CHAR) cycle
|
||||
buffer(i:i) = temp_buffer(i)
|
||||
end do
|
||||
|
||||
if (present(name)) call h5dclose_f(dset_id, hdf5_err)
|
||||
|
||||
call h5sclose_f(space_id, hdf5_err)
|
||||
call h5tclose_f(filetype, hdf5_err)
|
||||
call h5tclose_f(memtype, hdf5_err)
|
||||
end subroutine read_string
|
||||
|
|
@ -2372,9 +2375,9 @@ contains
|
|||
end subroutine read_attribute_integer_2D_explicit
|
||||
|
||||
subroutine read_attribute_string(buffer, obj_id, name)
|
||||
character(*), intent(inout), target :: buffer ! read data to here
|
||||
integer(HID_T), intent(in) :: obj_id
|
||||
character(*), intent(in) :: name ! name for data
|
||||
character(*), intent(inout) :: buffer ! read data to here
|
||||
integer(HID_T), intent(in) :: obj_id
|
||||
character(*), intent(in) :: name ! name for data
|
||||
|
||||
integer :: hdf5_err
|
||||
integer(HID_T) :: attr_id ! data set handle
|
||||
|
|
@ -2407,9 +2410,9 @@ contains
|
|||
call h5aread_f(attr_id, memtype, f_ptr, hdf5_err)
|
||||
buffer = ''
|
||||
do i = 1, size
|
||||
if (temp_buffer(i) == C_NULL_CHAR) cycle
|
||||
buffer(i:i) = temp_buffer(i)
|
||||
end do
|
||||
deallocate(temp_buffer)
|
||||
|
||||
call h5aclose_f(attr_id, hdf5_err)
|
||||
call h5tclose_f(filetype, hdf5_err)
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ module initialize
|
|||
use material_header, only: Material
|
||||
use message_passing
|
||||
use mgxs_data, only: read_mgxs, create_macro_xs
|
||||
use output, only: title, header, print_version, write_message, &
|
||||
print_usage, print_plot
|
||||
use output, only: print_version, write_message, print_usage, &
|
||||
print_plot
|
||||
use random_lcg, only: initialize_prng
|
||||
use state_point, only: load_state_point
|
||||
use string, only: to_str, starts_with, ends_with, str_to_int
|
||||
|
|
@ -68,12 +68,6 @@ contains
|
|||
! Read command line arguments
|
||||
call read_command_line()
|
||||
|
||||
if (master) then
|
||||
! Display title and initialization header
|
||||
call title()
|
||||
call header("INITIALIZATION", level=1)
|
||||
end if
|
||||
|
||||
! Read XML input files
|
||||
call read_input_xml()
|
||||
|
||||
|
|
@ -137,7 +131,7 @@ contains
|
|||
if (master) then
|
||||
if (run_mode == MODE_PLOTTING) then
|
||||
! Display plotting information
|
||||
call print_plot()
|
||||
if (verbosity >= 5) call print_plot()
|
||||
else
|
||||
! Write summary information
|
||||
if (output_summary) call write_summary()
|
||||
|
|
@ -148,9 +142,8 @@ contains
|
|||
if (particle_restart_run) run_mode = MODE_PARTICLE
|
||||
|
||||
! Warn if overlap checking is on
|
||||
if (master .and. check_overlaps) then
|
||||
call write_message("")
|
||||
call warning("Cell overlap checking is ON")
|
||||
if (master .and. check_overlaps .and. run_mode /= MODE_PLOTTING) then
|
||||
call warning("Cell overlap checking is ON.")
|
||||
end if
|
||||
|
||||
! Stop initialization timer
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -43,10 +43,10 @@ contains
|
|||
|
||||
! Could not find MGXS Library file
|
||||
call fatal_error("Cross sections HDF5 file '" &
|
||||
&// trim(path_cross_sections) // "' does not exist!")
|
||||
// trim(path_cross_sections) // "' does not exist!")
|
||||
end if
|
||||
|
||||
call write_message("Loading Cross Section Data...", 5)
|
||||
call write_message("Loading cross section data...", 5)
|
||||
|
||||
! Get temperatures
|
||||
call get_temperatures(cells, materials, material_dict, nuclide_dict, &
|
||||
|
|
@ -75,7 +75,7 @@ contains
|
|||
i_xsdata = xsdata_dict % get_key(to_lower(name))
|
||||
i_nuclide = mat % nuclide(j)
|
||||
|
||||
call write_message("Loading " // trim(name) // " Data...", 5)
|
||||
call write_message("Loading " // trim(name) // " data...", 6)
|
||||
|
||||
! Check to make sure cross section set exists in the library
|
||||
if (object_exists(file_id, trim(name))) then
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ module nuclide_header
|
|||
use stl_vector, only: VectorInt, VectorReal
|
||||
use string
|
||||
use urr_header, only: UrrData
|
||||
use xml_interface
|
||||
|
||||
implicit none
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ contains
|
|||
write(UNIT=OUTPUT_UNIT, FMT='(4X,"OpenMP Threads | ",A)') &
|
||||
trim(to_str(omp_get_max_threads()))
|
||||
#endif
|
||||
write(UNIT=OUTPUT_UNIT, FMT=*)
|
||||
|
||||
end subroutine title
|
||||
|
||||
|
|
@ -112,27 +113,19 @@ contains
|
|||
|
||||
!===============================================================================
|
||||
! HEADER displays a header block according to a specified level. If no level is
|
||||
! specified, it is assumed to be a minor header block (H3).
|
||||
! specified, it is assumed to be a minor header block.
|
||||
!===============================================================================
|
||||
|
||||
subroutine header(msg, unit, level)
|
||||
subroutine header(msg, level, unit)
|
||||
character(*), intent(in) :: msg ! header message
|
||||
integer, intent(in) :: level
|
||||
integer, intent(in), optional :: unit ! unit to write to
|
||||
integer, intent(in), optional :: level ! specified header level
|
||||
|
||||
integer :: n ! number of = signs on left
|
||||
integer :: m ! number of = signs on right
|
||||
integer :: unit_ ! unit to write to
|
||||
integer :: header_level ! actual header level
|
||||
character(MAX_LINE_LEN) :: line
|
||||
|
||||
! set default level
|
||||
if (present(level)) then
|
||||
header_level = level
|
||||
else
|
||||
header_level = 3
|
||||
end if
|
||||
|
||||
! set default unit
|
||||
if (present(unit)) then
|
||||
unit_ = unit
|
||||
|
|
@ -149,17 +142,10 @@ contains
|
|||
line = to_upper(msg)
|
||||
|
||||
! print header based on level
|
||||
select case (header_level)
|
||||
case (1)
|
||||
write(UNIT=unit_, FMT='(/3(1X,A/))') repeat('=', 75), &
|
||||
repeat('=', n) // '> ' // trim(line) // ' <' // &
|
||||
repeat('=', m), repeat('=', 75)
|
||||
case (2)
|
||||
write(UNIT=unit_, FMT='(/2(1X,A/))') trim(line), repeat('-', 75)
|
||||
case (3)
|
||||
if (verbosity >= level) then
|
||||
write(UNIT=unit_, FMT='(/1X,A/)') repeat('=', n) // '> ' // &
|
||||
trim(line) // ' <' // repeat('=', m)
|
||||
end select
|
||||
end if
|
||||
|
||||
end subroutine header
|
||||
|
||||
|
|
@ -460,7 +446,7 @@ contains
|
|||
type(ObjectPlot), pointer :: pl
|
||||
|
||||
! Display header for plotting
|
||||
call header("PLOTTING SUMMARY")
|
||||
call header("PLOTTING SUMMARY", 5)
|
||||
|
||||
do i = 1, n_plots
|
||||
pl => plots(i)
|
||||
|
|
@ -535,7 +521,7 @@ contains
|
|||
character(15) :: string
|
||||
|
||||
! display header block
|
||||
call header("Timing Statistics")
|
||||
call header("Timing Statistics", 6)
|
||||
|
||||
! display time elapsed for various sections
|
||||
write(ou,100) "Total time for initialization", time_initialize % elapsed
|
||||
|
|
@ -608,7 +594,7 @@ contains
|
|||
real(8) :: t_value ! t-value for confidence intervals
|
||||
|
||||
! display header block for results
|
||||
call header("Results")
|
||||
call header("Results", 4)
|
||||
|
||||
if (confidence_intervals) then
|
||||
! Calculate t-value for confidence intervals
|
||||
|
|
@ -666,7 +652,7 @@ contains
|
|||
integer :: num_sparse = 0
|
||||
|
||||
! display header block for geometry debugging section
|
||||
call header("Cell Overlap Check Summary")
|
||||
call header("Cell Overlap Check Summary", 1)
|
||||
|
||||
write(ou,100) 'Cell ID','No. Overlap Checks'
|
||||
|
||||
|
|
@ -775,11 +761,10 @@ contains
|
|||
|
||||
! Write header block
|
||||
if (t % name == "") then
|
||||
call header("TALLY " // trim(to_str(t % id)), unit=unit_tally, &
|
||||
level=3)
|
||||
call header("TALLY " // trim(to_str(t % id)), 1, unit=unit_tally)
|
||||
else
|
||||
call header("TALLY " // trim(to_str(t % id)) // ": " &
|
||||
// trim(t % name), unit=unit_tally, level=3)
|
||||
// trim(t % name), 1, unit=unit_tally)
|
||||
endif
|
||||
|
||||
! Write derivative information.
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ contains
|
|||
|
||||
! Write meessage
|
||||
call write_message("Loading particle restart file " &
|
||||
&// trim(path_particle_restart) // "...", 1)
|
||||
// trim(path_particle_restart) // "...", 5)
|
||||
|
||||
! Open file
|
||||
file_id = file_open(path_particle_restart, 'r')
|
||||
|
|
|
|||
74
src/pugixml/pugiconfig.hpp
Normal file
74
src/pugixml/pugiconfig.hpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* pugixml parser - version 1.8
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2016, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PUGICONFIG_HPP
|
||||
#define HEADER_PUGICONFIG_HPP
|
||||
|
||||
// Uncomment this to enable wchar_t mode
|
||||
// #define PUGIXML_WCHAR_MODE
|
||||
|
||||
// Uncomment this to enable compact mode
|
||||
// #define PUGIXML_COMPACT
|
||||
|
||||
// Uncomment this to disable XPath
|
||||
// #define PUGIXML_NO_XPATH
|
||||
|
||||
// Uncomment this to disable STL
|
||||
// #define PUGIXML_NO_STL
|
||||
|
||||
// Uncomment this to disable exceptions
|
||||
// #define PUGIXML_NO_EXCEPTIONS
|
||||
|
||||
// Set this to control attributes for public classes/functions, i.e.:
|
||||
// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
|
||||
// #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL
|
||||
// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
|
||||
// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead
|
||||
|
||||
// Tune these constants to adjust memory-related behavior
|
||||
// #define PUGIXML_MEMORY_PAGE_SIZE 32768
|
||||
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
|
||||
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
|
||||
|
||||
// Uncomment this to switch to header-only version
|
||||
// #define PUGIXML_HEADER_ONLY
|
||||
|
||||
// Uncomment this to enable long long support
|
||||
// #define PUGIXML_HAS_LONG_LONG
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2016 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
12622
src/pugixml/pugixml.cpp
Normal file
12622
src/pugixml/pugixml.cpp
Normal file
File diff suppressed because it is too large
Load diff
1434
src/pugixml/pugixml.hpp
Normal file
1434
src/pugixml/pugixml.hpp
Normal file
File diff suppressed because it is too large
Load diff
1
src/pugixml/pugixml_c.cpp
Normal file
1
src/pugixml/pugixml_c.cpp
Normal file
|
|
@ -0,0 +1 @@
|
|||
#include "pugixml_c.hpp"
|
||||
97
src/pugixml/pugixml_c.hpp
Normal file
97
src/pugixml/pugixml_c.hpp
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "pugixml.hpp"
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
extern "C" {
|
||||
// xml_node functions
|
||||
|
||||
const char* xml_node_name(xml_node_struct* node){
|
||||
return xml_node(node).name();
|
||||
}
|
||||
|
||||
xml_node_struct* xml_node_child(xml_node_struct* node, char* name){
|
||||
return xml_node(node).child(name).internal_object();
|
||||
}
|
||||
|
||||
xml_node_struct* xml_node_next_sibling(xml_node_struct* node, char* name){
|
||||
return xml_node(node).next_sibling(name).internal_object();
|
||||
}
|
||||
|
||||
xml_attribute_struct* xml_node_attribute(xml_node_struct* node, char* name){
|
||||
return xml_node(node).attribute(name).internal_object();
|
||||
}
|
||||
|
||||
const char* xml_node_child_value(xml_node_struct* node){
|
||||
return xml_node(node).child_value();
|
||||
}
|
||||
|
||||
xml_node_struct* xml_node_text(xml_node_struct* node){
|
||||
return xml_node(node).internal_object();
|
||||
}
|
||||
|
||||
// xml_attribute functions
|
||||
|
||||
const char* xml_attribute_name(xml_attribute_struct* attribute){
|
||||
return xml_attribute(attribute).name();
|
||||
}
|
||||
|
||||
const char* xml_attribute_value(xml_attribute_struct* attribute){
|
||||
return xml_attribute(attribute).value();
|
||||
}
|
||||
|
||||
xml_attribute_struct* xml_attribute_next_attribute(xml_attribute_struct* attribute){
|
||||
return xml_attribute(attribute).next_attribute().internal_object();
|
||||
}
|
||||
|
||||
bool xml_attribute_as_bool(xml_attribute_struct* attribute){
|
||||
return xml_attribute(attribute).as_bool();
|
||||
}
|
||||
|
||||
int xml_attribute_as_int(xml_attribute_struct* attribute){
|
||||
return xml_attribute(attribute).as_int();
|
||||
}
|
||||
|
||||
long long xml_attribute_as_llong(xml_attribute_struct* attribute){
|
||||
return xml_attribute(attribute).as_llong();
|
||||
}
|
||||
|
||||
double xml_attribute_as_double(xml_attribute_struct* attribute){
|
||||
return xml_attribute(attribute).as_double();
|
||||
}
|
||||
|
||||
// xml_text functions
|
||||
|
||||
bool xml_text_as_bool(xml_node_struct* node){
|
||||
return xml_node(node).text().as_bool();
|
||||
}
|
||||
|
||||
int xml_text_as_int(xml_node_struct* node){
|
||||
return xml_node(node).text().as_int();
|
||||
}
|
||||
|
||||
long long xml_text_as_llong(xml_node_struct* node){
|
||||
return xml_node(node).text().as_llong();
|
||||
}
|
||||
|
||||
double xml_text_as_double(xml_node_struct* node){
|
||||
return xml_node(node).text().as_double();
|
||||
}
|
||||
|
||||
// xml_document functions
|
||||
|
||||
xml_document* xml_document_load_file(char* filename){
|
||||
xml_document * doc = new xml_document();
|
||||
xml_parse_result result = doc->load_file(filename);
|
||||
return doc;
|
||||
}
|
||||
|
||||
xml_node_struct* xml_document_document_element(xml_document* doc){
|
||||
return doc->document_element().internal_object();
|
||||
}
|
||||
|
||||
void xml_document_clear(xml_document* doc){
|
||||
delete doc;
|
||||
}
|
||||
}
|
||||
451
src/pugixml/pugixml_f.F90
Normal file
451
src/pugixml/pugixml_f.F90
Normal file
|
|
@ -0,0 +1,451 @@
|
|||
module pugixml
|
||||
|
||||
use, intrinsic :: ISO_C_BINDING
|
||||
|
||||
implicit none
|
||||
private
|
||||
|
||||
interface
|
||||
function strlen(str) result(sz) bind(C)
|
||||
import C_PTR, C_SIZE_T
|
||||
type(C_PTR), value :: str
|
||||
integer(C_SIZE_T) :: sz
|
||||
end function strlen
|
||||
end interface
|
||||
|
||||
!=============================================================================
|
||||
! XMLNode C interface and derived type
|
||||
|
||||
interface
|
||||
function xml_node_name(node) result(name) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: node
|
||||
type(C_PTR) :: name
|
||||
end function xml_node_name
|
||||
|
||||
function xml_node_name_size(base) result(sz) bind(C)
|
||||
import C_PTR, C_SIZE_T
|
||||
type(C_PTR), value :: base
|
||||
integer(C_SIZE_T) :: sz
|
||||
end function xml_node_name_size
|
||||
|
||||
function xml_node_child(node, name) result(child) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: node
|
||||
type(C_PTR), value :: name
|
||||
type(C_PTR) :: child
|
||||
end function xml_node_child
|
||||
|
||||
function xml_node_next_sibling(node, name) result(next) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: node
|
||||
type(C_PTR), value :: name
|
||||
type(C_PTR) :: next
|
||||
end function xml_node_next_sibling
|
||||
|
||||
function xml_node_attribute(node, name) result(attribute) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: node
|
||||
type(C_PTR), value :: name
|
||||
type(C_PTR) :: attribute
|
||||
end function xml_node_attribute
|
||||
|
||||
function xml_node_child_value(node) result(val) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: node
|
||||
type(C_PTR) :: val
|
||||
end function xml_node_child_value
|
||||
|
||||
function xml_node_text(node) result(text) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: node
|
||||
type(C_PTR) :: text
|
||||
end function xml_node_text
|
||||
end interface
|
||||
|
||||
type :: XMLNode
|
||||
type(C_PTR) :: ptr
|
||||
contains
|
||||
procedure :: name => xmlnode_name
|
||||
procedure :: child => xmlnode_child
|
||||
procedure :: next_sibling => xmlnode_next_sibling
|
||||
procedure :: attribute => xmlnode_attribute
|
||||
procedure :: child_value => xmlnode_child_value
|
||||
procedure :: text => xmlnode_text
|
||||
procedure :: associated => xmlnode_associated
|
||||
end type XMLNode
|
||||
|
||||
!=============================================================================
|
||||
! XMLAttribute C interface and derived type
|
||||
|
||||
interface
|
||||
function xml_attribute_name(attribute) result(name) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: attribute
|
||||
type(C_PTR) :: name
|
||||
end function xml_attribute_name
|
||||
|
||||
function xml_attribute_name_size(base) result(sz) bind(C)
|
||||
import C_PTR, C_SIZE_T
|
||||
type(C_PTR), value :: base
|
||||
integer(C_SIZE_T) :: sz
|
||||
end function xml_attribute_name_size
|
||||
|
||||
function xml_attribute_value(attribute) result(val) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: attribute
|
||||
type(C_PTR) :: val
|
||||
end function xml_attribute_value
|
||||
|
||||
function xml_attribute_next_attribute(attribute) result(next) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: attribute
|
||||
type(C_PTR) :: next
|
||||
end function xml_attribute_next_attribute
|
||||
|
||||
function xml_attribute_as_bool(attribute) result(x) bind(C)
|
||||
import C_PTR, C_BOOL
|
||||
type(C_PTR), value :: attribute
|
||||
logical(C_BOOL) :: x
|
||||
end function xml_attribute_as_bool
|
||||
|
||||
function xml_attribute_as_int(attribute) result(x) bind(C)
|
||||
import C_PTR, C_INT
|
||||
type(C_PTR), value :: attribute
|
||||
integer(C_INT) :: x
|
||||
end function xml_attribute_as_int
|
||||
|
||||
function xml_attribute_as_llong(attribute) result(x) bind(C)
|
||||
import C_PTR, C_LONG_LONG
|
||||
type(C_PTR), value :: attribute
|
||||
integer(C_LONG_LONG) :: x
|
||||
end function xml_attribute_as_llong
|
||||
|
||||
function xml_attribute_as_double(attribute) result(x) bind(C)
|
||||
import C_PTR, C_DOUBLE
|
||||
type(C_PTR), value :: attribute
|
||||
real(C_DOUBLE) :: x
|
||||
end function xml_attribute_as_double
|
||||
end interface
|
||||
|
||||
type :: XMLAttribute
|
||||
type(C_PTR) :: ptr
|
||||
contains
|
||||
procedure :: name => xmlattribute_name
|
||||
procedure :: value => xmlattribute_value
|
||||
procedure :: next_attribute => xmlattribute_next_attribute
|
||||
procedure :: as_bool => xmlattribute_as_bool
|
||||
procedure :: as_int => xmlattribute_as_int
|
||||
procedure :: as_llong => xmlattribute_as_llong
|
||||
procedure :: as_double => xmlattribute_as_double
|
||||
procedure :: associated => xmlattribute_associated
|
||||
end type XMLAttribute
|
||||
|
||||
!=============================================================================
|
||||
! XMLText C interface and derived type
|
||||
|
||||
interface
|
||||
function xml_text_as_bool(text) result(x) bind(C)
|
||||
import C_PTR, C_BOOL
|
||||
type(C_PTR), value :: text
|
||||
logical(C_BOOL) :: x
|
||||
end function xml_text_as_bool
|
||||
|
||||
function xml_text_as_int(text) result(x) bind(C)
|
||||
import C_PTR, C_INT
|
||||
type(C_PTR), value :: text
|
||||
integer(C_INT) :: x
|
||||
end function xml_text_as_int
|
||||
|
||||
function xml_text_as_llong(text) result(x) bind(C)
|
||||
import C_PTR, C_LONG_LONG
|
||||
type(C_PTR), value :: text
|
||||
integer(C_LONG_LONG) :: x
|
||||
end function xml_text_as_llong
|
||||
|
||||
function xml_text_as_double(text) result(x) bind(C)
|
||||
import C_PTR, C_DOUBLE
|
||||
type(C_PTR), value :: text
|
||||
real(C_DOUBLE) :: x
|
||||
end function xml_text_as_double
|
||||
end interface
|
||||
|
||||
type :: XMLText
|
||||
type(C_PTR) :: ptr
|
||||
contains
|
||||
procedure :: as_bool => xmltext_as_bool
|
||||
procedure :: as_int => xmltext_as_int
|
||||
procedure :: as_llong => xmltext_as_llong
|
||||
procedure :: as_double => xmltext_as_double
|
||||
end type XMLText
|
||||
|
||||
!=============================================================================
|
||||
! XMLDocument C interface and derived type
|
||||
|
||||
interface
|
||||
function xml_document_load_file(filename) result(doc) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: filename
|
||||
type(C_PTR) :: doc
|
||||
end function xml_document_load_file
|
||||
|
||||
function xml_document_document_element(doc) result(node) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: doc
|
||||
type(C_PTR) :: node
|
||||
end function xml_document_document_element
|
||||
|
||||
subroutine xml_document_clear(doc) bind(C)
|
||||
import C_PTR
|
||||
type(C_PTR), value :: doc
|
||||
end subroutine xml_document_clear
|
||||
end interface
|
||||
|
||||
type, extends(XMLNode) :: XMLDocument
|
||||
contains
|
||||
procedure :: load_file => xmldocument_load_file
|
||||
procedure :: document_element => xmldocument_document_element
|
||||
procedure :: clear => xmldocument_clear
|
||||
end type XMLDocument
|
||||
|
||||
public :: XMLNode, XMLAttribute, XMLText, XMLDocument
|
||||
|
||||
contains
|
||||
|
||||
!=============================================================================
|
||||
! XMLNode Implementation
|
||||
|
||||
function xmlnode_name(this) result(name)
|
||||
class(XMLNode), intent(in) :: this
|
||||
character(len=:, kind=C_CHAR), allocatable :: name
|
||||
|
||||
character(kind=C_CHAR), pointer :: string(:)
|
||||
integer(C_SIZE_T) :: size_string
|
||||
integer(C_SIZE_T) :: i
|
||||
type(C_PTR) :: name_ptr
|
||||
|
||||
name_ptr = xml_node_name(this % ptr)
|
||||
size_string = strlen(name_ptr)
|
||||
call c_f_pointer(name_ptr, string, [size_string])
|
||||
allocate(character(len=size_string, kind=C_CHAR) :: name)
|
||||
do i = 1, size_string
|
||||
name(i:i) = string(i)
|
||||
end do
|
||||
end function xmlnode_name
|
||||
|
||||
function xmlnode_child(this, name) result(child)
|
||||
class(XMLNode), intent(in) :: this
|
||||
character(len=*), optional :: name
|
||||
type(XMLNode) :: child
|
||||
|
||||
integer :: i, n
|
||||
character(len=:, kind=C_CHAR), target, allocatable :: string
|
||||
|
||||
if (present(name)) then
|
||||
allocate(character(len=len_trim(name) + 1, kind=C_CHAR) :: string)
|
||||
n = len_trim(name)
|
||||
do i = 1, n
|
||||
string(i:i) = name(i:i)
|
||||
end do
|
||||
string(n+1:n+1) = C_NULL_CHAR
|
||||
child % ptr = xml_node_child(this % ptr, c_loc(string))
|
||||
else
|
||||
child % ptr = xml_node_child(this % ptr, C_NULL_PTR)
|
||||
end if
|
||||
end function xmlnode_child
|
||||
|
||||
function xmlnode_next_sibling(this, name) result(next)
|
||||
class(XMLNode), intent(in) :: this
|
||||
character(len=*), optional :: name
|
||||
type(XMLNode) :: next
|
||||
|
||||
integer :: i, n
|
||||
character(len=:, kind=C_CHAR), target, allocatable :: string
|
||||
|
||||
if (present(name)) then
|
||||
allocate(character(len=len_trim(name) + 1, kind=C_CHAR) :: string)
|
||||
n = len_trim(name)
|
||||
do i = 1, n
|
||||
string(i:i) = name(i:i)
|
||||
end do
|
||||
string(n+1:n+1) = C_NULL_CHAR
|
||||
next % ptr = xml_node_next_sibling(this % ptr, c_loc(string))
|
||||
else
|
||||
next % ptr = xml_node_next_sibling(this % ptr, C_NULL_PTR)
|
||||
end if
|
||||
end function xmlnode_next_sibling
|
||||
|
||||
function xmlnode_attribute(this, name) result(attribute)
|
||||
class(XMLNode), intent(in) :: this
|
||||
character(len=*), intent(in) :: name
|
||||
type(XMLAttribute) :: attribute
|
||||
|
||||
integer :: i, n
|
||||
character(kind=C_CHAR), target :: string(len_trim(name) + 1)
|
||||
|
||||
n = len_trim(name)
|
||||
do i = 1, n
|
||||
string(i) = name(i:i)
|
||||
end do
|
||||
string(n+1) = C_NULL_CHAR
|
||||
attribute % ptr = xml_node_attribute(this % ptr, c_loc(string))
|
||||
end function xmlnode_attribute
|
||||
|
||||
function xmlnode_child_value(this) result(val)
|
||||
class(XMLNode), intent(in) :: this
|
||||
character(len=:, kind=C_CHAR), allocatable :: val
|
||||
|
||||
character(kind=C_CHAR), pointer :: string(:)
|
||||
integer(C_SIZE_T) :: size_string
|
||||
integer(C_SIZE_T) :: i
|
||||
type(C_PTR) :: text
|
||||
|
||||
text = xml_node_child_value(this % ptr)
|
||||
size_string = strlen(text)
|
||||
call c_f_pointer(text, string, [size_string])
|
||||
allocate(character(len=size_string, kind=C_CHAR) :: val)
|
||||
do i = 1, size_string
|
||||
val(i:i) = string(i)
|
||||
end do
|
||||
end function xmlnode_child_value
|
||||
|
||||
function xmlnode_text(this) result(text)
|
||||
class(XMLNode), intent(in) :: this
|
||||
type(XMLText) :: text
|
||||
|
||||
text % ptr = xml_node_text(this % ptr)
|
||||
end function xmlnode_text
|
||||
|
||||
logical function xmlnode_associated(this)
|
||||
class(XMLNode), intent(in) :: this
|
||||
|
||||
xmlnode_associated = c_associated(this % ptr)
|
||||
end function xmlnode_associated
|
||||
|
||||
!=============================================================================
|
||||
! XMLAttribute Implementation
|
||||
|
||||
function xmlattribute_name(this) result(name)
|
||||
class(XMLAttribute), intent(in) :: this
|
||||
character(len=:, kind=C_CHAR), allocatable :: name
|
||||
|
||||
character(kind=C_CHAR), pointer :: string(:)
|
||||
integer(C_SIZE_T) :: size_string
|
||||
integer(C_SIZE_T) :: i
|
||||
type(C_PTR) :: name_ptr
|
||||
|
||||
name_ptr = xml_attribute_name(this % ptr)
|
||||
size_string = strlen(name_ptr)
|
||||
call c_f_pointer(name_ptr, string, [size_string])
|
||||
allocate(character(len=size_string, kind=C_CHAR) :: name)
|
||||
do i = 1, size_string
|
||||
name(i:i) = string(i)
|
||||
end do
|
||||
end function xmlattribute_name
|
||||
|
||||
function xmlattribute_value(this) result(val)
|
||||
class(XMLAttribute), intent(in) :: this
|
||||
character(len=:, kind=C_CHAR), allocatable :: val
|
||||
|
||||
character(kind=C_CHAR), pointer :: string(:)
|
||||
integer(C_SIZE_T) :: size_string
|
||||
integer(C_SIZE_T) :: i
|
||||
type(C_PTR) :: val_ptr
|
||||
|
||||
val_ptr = xml_attribute_value(this % ptr)
|
||||
size_string = strlen(val_ptr)
|
||||
call c_f_pointer(val_ptr, string, [size_string])
|
||||
allocate(character(len=size_string, kind=C_CHAR) :: val)
|
||||
do i = 1, size_string
|
||||
val(i:i) = string(i)
|
||||
end do
|
||||
end function xmlattribute_value
|
||||
|
||||
function xmlattribute_next_attribute(this) result(next)
|
||||
class(XMLAttribute), intent(in) :: this
|
||||
type(XMLAttribute) :: next
|
||||
|
||||
next % ptr = xml_attribute_next_attribute(this % ptr)
|
||||
end function xmlattribute_next_attribute
|
||||
|
||||
logical(C_BOOL) function xmlattribute_as_bool(this)
|
||||
class(XMLAttribute), intent(in) :: this
|
||||
xmlattribute_as_bool = xml_attribute_as_bool(this % ptr)
|
||||
end function xmlattribute_as_bool
|
||||
|
||||
integer(C_INT) function xmlattribute_as_int(this)
|
||||
class(XMLAttribute), intent(in) :: this
|
||||
xmlattribute_as_int = xml_attribute_as_int(this % ptr)
|
||||
end function xmlattribute_as_int
|
||||
|
||||
integer(C_LONG_LONG) function xmlattribute_as_llong(this)
|
||||
class(XMLAttribute), intent(in) :: this
|
||||
xmlattribute_as_llong = xml_attribute_as_llong(this % ptr)
|
||||
end function xmlattribute_as_llong
|
||||
|
||||
real(C_DOUBLE) function xmlattribute_as_double(this)
|
||||
class(XMLAttribute), intent(in) :: this
|
||||
xmlattribute_as_double = xml_attribute_as_double(this % ptr)
|
||||
end function xmlattribute_as_double
|
||||
|
||||
logical function xmlattribute_associated(this)
|
||||
class(XMLAttribute), intent(in) :: this
|
||||
|
||||
xmlattribute_associated = c_associated(this % ptr)
|
||||
end function xmlattribute_associated
|
||||
|
||||
!=============================================================================
|
||||
! XMLText Implementation
|
||||
|
||||
logical(C_BOOL) function xmltext_as_bool(this)
|
||||
class(XMLText), intent(in) :: this
|
||||
xmltext_as_bool = xml_text_as_bool(this % ptr)
|
||||
end function xmltext_as_bool
|
||||
|
||||
integer(C_INT) function xmltext_as_int(this)
|
||||
class(XMLText), intent(in) :: this
|
||||
xmltext_as_int = xml_text_as_int(this % ptr)
|
||||
end function xmltext_as_int
|
||||
|
||||
integer(C_LONG_LONG) function xmltext_as_llong(this)
|
||||
class(XMLText), intent(in) :: this
|
||||
xmltext_as_llong = xml_text_as_llong(this % ptr)
|
||||
end function xmltext_as_llong
|
||||
|
||||
real(C_DOUBLE) function xmltext_as_double(this)
|
||||
class(XMLText), intent(in) :: this
|
||||
xmltext_as_double = xml_text_as_double(this % ptr)
|
||||
end function xmltext_as_double
|
||||
|
||||
!=============================================================================
|
||||
! XMLDocument Implementation
|
||||
|
||||
subroutine xmldocument_load_file(this, filename)
|
||||
class(XMLDocument), intent(inout) :: this
|
||||
character(*), intent(in) :: filename
|
||||
|
||||
integer :: i, n
|
||||
character(kind=C_CHAR), target :: string(len_trim(filename) + 1)
|
||||
|
||||
n = len_trim(filename)
|
||||
do i = 1, n
|
||||
string(i) = filename(i:i)
|
||||
end do
|
||||
string(n+1) = C_NULL_CHAR
|
||||
this % ptr = xml_document_load_file(c_loc(string))
|
||||
end subroutine xmldocument_load_file
|
||||
|
||||
function xmldocument_document_element(this) result(node)
|
||||
class(XMLDocument), intent(in) :: this
|
||||
type(XMLNode) :: node
|
||||
|
||||
node % ptr = xml_document_document_element(this % ptr)
|
||||
end function xmldocument_document_element
|
||||
|
||||
subroutine xmldocument_clear(this)
|
||||
class(XMLDocument), intent(inout) :: this
|
||||
|
||||
call xml_document_clear(this % ptr)
|
||||
end subroutine xmldocument_clear
|
||||
|
||||
end module pugixml
|
||||
|
|
@ -46,10 +46,10 @@ contains
|
|||
! Display header
|
||||
if (master) then
|
||||
if (run_mode == MODE_FIXEDSOURCE) then
|
||||
call header("FIXED SOURCE TRANSPORT SIMULATION", level=1)
|
||||
call header("FIXED SOURCE TRANSPORT SIMULATION", 3)
|
||||
elseif (run_mode == MODE_EIGENVALUE) then
|
||||
call header("K EIGENVALUE SIMULATION", level=1)
|
||||
call print_columns()
|
||||
call header("K EIGENVALUE SIMULATION", 3)
|
||||
if (verbosity >= 7) call print_columns()
|
||||
end if
|
||||
end if
|
||||
|
||||
|
|
@ -110,8 +110,6 @@ contains
|
|||
! ==========================================================================
|
||||
! END OF RUN WRAPUP
|
||||
|
||||
if (master) call header("SIMULATION FINISHED", level=1)
|
||||
|
||||
call finalize_simulation()
|
||||
|
||||
! Clear particle
|
||||
|
|
@ -172,7 +170,7 @@ contains
|
|||
|
||||
if (run_mode == MODE_FIXEDSOURCE) then
|
||||
call write_message("Simulating batch " // trim(to_str(current_batch)) &
|
||||
// "...", 1)
|
||||
// "...", 6)
|
||||
end if
|
||||
|
||||
! Reset total starting particle weight used for normalizing tallies
|
||||
|
|
@ -273,7 +271,8 @@ contains
|
|||
call calculate_average_keff()
|
||||
|
||||
! Write generation output
|
||||
if (master .and. current_gen /= gen_per_batch) call print_generation()
|
||||
if (master .and. current_gen /= gen_per_batch .and. verbosity >= 7) &
|
||||
call print_generation()
|
||||
elseif (run_mode == MODE_FIXEDSOURCE) then
|
||||
! For fixed-source mode, we need to sample the external source
|
||||
if (path_source == '') then
|
||||
|
|
@ -310,7 +309,7 @@ contains
|
|||
if (cmfd_on) call execute_cmfd()
|
||||
|
||||
! Display output
|
||||
if (master) call print_batch_keff()
|
||||
if (master .and. verbosity >= 7) call print_batch_keff()
|
||||
|
||||
! Calculate combined estimate of k-effective
|
||||
if (master) call calculate_combined_keff()
|
||||
|
|
@ -356,7 +355,7 @@ contains
|
|||
|
||||
! Write message at beginning
|
||||
if (current_batch == 1) then
|
||||
call write_message("Replaying history from state point...", 1)
|
||||
call write_message("Replaying history from state point...", 6)
|
||||
end if
|
||||
|
||||
if (run_mode == MODE_EIGENVALUE) then
|
||||
|
|
@ -365,17 +364,19 @@ contains
|
|||
call calculate_average_keff()
|
||||
|
||||
! print out batch keff
|
||||
if (current_gen < gen_per_batch) then
|
||||
if (master) call print_generation()
|
||||
else
|
||||
if (master) call print_batch_keff()
|
||||
if (verbosity >= 7) then
|
||||
if (current_gen < gen_per_batch) then
|
||||
if (master) call print_generation()
|
||||
else
|
||||
if (master) call print_batch_keff()
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
|
||||
! Write message at end
|
||||
if (current_batch == restart_batch) then
|
||||
call write_message("Resuming simulation...", 1)
|
||||
call write_message("Resuming simulation...", 6)
|
||||
end if
|
||||
|
||||
end subroutine replay_batch_history
|
||||
|
|
@ -403,8 +404,8 @@ contains
|
|||
call time_finalize%stop()
|
||||
call time_total%stop()
|
||||
if (master) then
|
||||
call print_runtime()
|
||||
call print_results()
|
||||
if (verbosity >= 6) call print_runtime()
|
||||
if (verbosity >= 4) call print_results()
|
||||
if (check_overlaps) call print_overlap_check()
|
||||
end if
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ contains
|
|||
character(MAX_FILE_LEN) :: filename
|
||||
type(Bank), pointer :: src ! source bank site
|
||||
|
||||
call write_message("Initializing source particles...", 6)
|
||||
call write_message("Initializing source particles...", 5)
|
||||
|
||||
if (path_source /= '') then
|
||||
! Read the source from a binary file instead of sampling from some
|
||||
|
|
@ -84,7 +84,7 @@ contains
|
|||
|
||||
! Write out initial source
|
||||
if (write_initial_source) then
|
||||
call write_message('Writing out initial source...', 1)
|
||||
call write_message('Writing out initial source...', 5)
|
||||
filename = trim(path_output) // 'initial_source.h5'
|
||||
file_id = file_create(filename, parallel=.true.)
|
||||
call write_source_bank(file_id)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ contains
|
|||
filename = trim(filename) // '.h5'
|
||||
|
||||
! Write message
|
||||
call write_message("Creating state point " // trim(filename) // "...", 1)
|
||||
call write_message("Creating state point " // trim(filename) // "...", 5)
|
||||
|
||||
if (master) then
|
||||
! Create statepoint file
|
||||
|
|
@ -440,7 +440,7 @@ contains
|
|||
& zero_padded(current_batch, count_digits(n_max_batches))
|
||||
filename = trim(filename) // '.h5'
|
||||
call write_message("Creating source file " // trim(filename) &
|
||||
// "...", 1)
|
||||
// "...", 5)
|
||||
|
||||
! Create separate source file
|
||||
if (master .or. parallel) then
|
||||
|
|
@ -464,7 +464,7 @@ contains
|
|||
! Also check to write source separately in overwritten file
|
||||
if (source_latest) then
|
||||
filename = trim(path_output) // 'source' // '.h5'
|
||||
call write_message("Creating source file " // trim(filename) // "...", 1)
|
||||
call write_message("Creating source file " // trim(filename) // "...", 5)
|
||||
if (master .or. parallel) then
|
||||
file_id = file_create(filename, parallel=.true.)
|
||||
call write_dataset(file_id, "filetype", 'source')
|
||||
|
|
@ -627,7 +627,7 @@ contains
|
|||
|
||||
! Write message
|
||||
call write_message("Loading state point " // trim(path_state_point) &
|
||||
// "...", 1)
|
||||
// "...", 5)
|
||||
|
||||
! Open file for reading
|
||||
file_id = file_open(path_state_point, 'r', parallel=.true.)
|
||||
|
|
@ -781,7 +781,7 @@ contains
|
|||
|
||||
! Write message
|
||||
call write_message("Loading source file " // trim(path_source_point) &
|
||||
// "...", 1)
|
||||
// "...", 5)
|
||||
|
||||
! Open source file
|
||||
file_id = file_open(path_source_point, 'r', parallel=.true.)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
module string
|
||||
|
||||
use, intrinsic :: ISO_C_BINDING
|
||||
|
||||
use constants, only: MAX_WORDS, MAX_LINE_LEN, ERROR_INT, ERROR_REAL, &
|
||||
OP_LEFT_PAREN, OP_RIGHT_PAREN, OP_COMPLEMENT, OP_INTERSECTION, OP_UNION
|
||||
use error, only: fatal_error, warning
|
||||
|
|
@ -482,4 +484,34 @@ contains
|
|||
|
||||
end function real_to_str
|
||||
|
||||
!===============================================================================
|
||||
! WORD_COUNT determines the number of words in a string
|
||||
!===============================================================================
|
||||
|
||||
function word_count(str) result(n)
|
||||
character(*), intent(in) :: str
|
||||
integer :: n
|
||||
|
||||
integer :: i
|
||||
character(kind=C_CHAR) :: chr
|
||||
logical :: inword
|
||||
|
||||
! Count number of words
|
||||
inword = .false.
|
||||
n = 0
|
||||
do i = 1, len_trim(str)
|
||||
chr = str(i:i)
|
||||
select case (chr)
|
||||
case (' ', C_HORIZONTAL_TAB, C_NEW_LINE, C_CARRIAGE_RETURN)
|
||||
if (inword) then
|
||||
inword = .false.
|
||||
n = n + 1
|
||||
end if
|
||||
case default
|
||||
inword = .true.
|
||||
end select
|
||||
end do
|
||||
if (inword) n = n + 1
|
||||
end function word_count
|
||||
|
||||
end module string
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ contains
|
|||
integer(HID_T) :: universes_group, univ_group
|
||||
integer(HID_T) :: lattices_group, lattice_group
|
||||
real(8), allocatable :: coeffs(:)
|
||||
character(REGION_SPEC_LEN) :: region_spec
|
||||
character(:), allocatable :: region_spec
|
||||
character(MAX_LINE_LEN), allocatable :: paths(:)
|
||||
character(MAX_LINE_LEN) :: path
|
||||
type(Cell), pointer :: c
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ contains
|
|||
if (micro_xs(p % event_nuclide) % absorption > ZERO) then
|
||||
score = p % absorb_wgt * micro_xs(p % event_nuclide) % fission &
|
||||
* nuclides(p % event_nuclide) % nu(E, EMISSION_PROMPT) &
|
||||
/ micro_xs(p % event_nuclide) % absorption
|
||||
/ micro_xs(p % event_nuclide) % absorption * flux
|
||||
else
|
||||
score = ZERO
|
||||
end if
|
||||
|
|
@ -456,7 +456,7 @@ contains
|
|||
! bank as prompt neutrons. Since this was weighted by 1/keff, we
|
||||
! multiply by keff to get the proper score.
|
||||
score = keff * p % wgt_bank * (ONE - sum(p % n_delayed_bank) &
|
||||
/ real(p % n_bank, 8))
|
||||
/ real(p % n_bank, 8)) * flux
|
||||
end if
|
||||
|
||||
else
|
||||
|
|
@ -534,7 +534,7 @@ contains
|
|||
! Compute the score and tally to bin
|
||||
score = p % absorb_wgt * yield &
|
||||
* micro_xs(p % event_nuclide) % fission &
|
||||
/ micro_xs(p % event_nuclide) % absorption
|
||||
/ micro_xs(p % event_nuclide) % absorption * flux
|
||||
call score_fission_delayed_dg(t, d_bin, score, score_index)
|
||||
end do
|
||||
cycle SCORE_LOOP
|
||||
|
|
@ -545,7 +545,7 @@ contains
|
|||
! delayed-nu-fission xs to the absorption xs
|
||||
score = p % absorb_wgt * micro_xs(p % event_nuclide) % fission &
|
||||
* nuclides(p % event_nuclide) % nu(E, EMISSION_DELAYED) &
|
||||
/ micro_xs(p % event_nuclide) % absorption
|
||||
/ micro_xs(p % event_nuclide) % absorption * flux
|
||||
end if
|
||||
end if
|
||||
else
|
||||
|
|
@ -574,7 +574,7 @@ contains
|
|||
|
||||
! Compute the score and tally to bin
|
||||
score = keff * p % wgt_bank / p % n_bank * &
|
||||
p % n_delayed_bank(d)
|
||||
p % n_delayed_bank(d) * flux
|
||||
|
||||
call score_fission_delayed_dg(t, d_bin, score, score_index)
|
||||
end do
|
||||
|
|
@ -583,7 +583,8 @@ contains
|
|||
else
|
||||
|
||||
! Add the contribution from all delayed groups
|
||||
score = keff * p % wgt_bank / p % n_bank * sum(p % n_delayed_bank)
|
||||
score = keff * p % wgt_bank / p % n_bank * &
|
||||
sum(p % n_delayed_bank) * flux
|
||||
end if
|
||||
end if
|
||||
else
|
||||
|
|
@ -719,7 +720,7 @@ contains
|
|||
score = p % absorb_wgt * yield * &
|
||||
micro_xs(p % event_nuclide) % fission &
|
||||
/ micro_xs(p % event_nuclide) % absorption &
|
||||
* rxn % products(1 + d) % decay_rate
|
||||
* rxn % products(1 + d) % decay_rate * flux
|
||||
end associate
|
||||
|
||||
! Tally to bin
|
||||
|
|
@ -747,7 +748,7 @@ contains
|
|||
score = score + rxn % products(1 + d) % decay_rate * &
|
||||
p % absorb_wgt * micro_xs(p % event_nuclide) % fission *&
|
||||
nuclides(p % event_nuclide) % nu(E, EMISSION_DELAYED, d)&
|
||||
/ micro_xs(p % event_nuclide) % absorption
|
||||
/ micro_xs(p % event_nuclide) % absorption * flux
|
||||
end do
|
||||
end associate
|
||||
end if
|
||||
|
|
@ -782,7 +783,7 @@ contains
|
|||
|
||||
! determine score based on bank site weight and keff.
|
||||
score = score + keff * fission_bank(n_bank - p % n_bank + k) &
|
||||
% wgt * rxn % products(1 + g) % decay_rate
|
||||
% wgt * rxn % products(1 + g) % decay_rate * flux
|
||||
end associate
|
||||
|
||||
! if the delayed group filter is present, tally to corresponding
|
||||
|
|
@ -1638,7 +1639,7 @@ contains
|
|||
! bank. Since this was weighted by 1/keff, we multiply by keff
|
||||
! to get the proper score.
|
||||
score = keff * p % wgt_bank * (ONE - sum(p % n_delayed_bank) &
|
||||
/ real(p % n_bank, 8))
|
||||
/ real(p % n_bank, 8)) * flux
|
||||
if (i_nuclide > 0) then
|
||||
score = score * atom_density * &
|
||||
nucxs % get_xs('fission', p_g, UVW=p_uvw) / &
|
||||
|
|
@ -1738,7 +1739,7 @@ contains
|
|||
d = filt % groups(d_bin)
|
||||
|
||||
score = keff * p % wgt_bank / p % n_bank * &
|
||||
p % n_delayed_bank(d)
|
||||
p % n_delayed_bank(d) * flux
|
||||
|
||||
if (i_nuclide > 0) then
|
||||
score = score * atom_density * &
|
||||
|
|
@ -1751,7 +1752,7 @@ contains
|
|||
cycle SCORE_LOOP
|
||||
end select
|
||||
else
|
||||
score = keff * p % wgt_bank / p % n_bank * sum(p % n_delayed_bank)
|
||||
score = keff * p % wgt_bank / p % n_bank * sum(p % n_delayed_bank) * flux
|
||||
if (i_nuclide > 0) then
|
||||
score = score * atom_density * &
|
||||
nucxs % get_xs('fission', p_g, UVW=p_uvw) / &
|
||||
|
|
@ -1851,12 +1852,12 @@ contains
|
|||
score = score + p % absorb_wgt * &
|
||||
nucxs % get_xs('decay rate', p_g, UVW=p_uvw, dg=d) * &
|
||||
nucxs % get_xs('delayed-nu-fission', p_g, UVW=p_uvw, &
|
||||
dg=d) / matxs % get_xs('absorption', p_g, UVW=p_uvw)
|
||||
dg=d) / matxs % get_xs('absorption', p_g, UVW=p_uvw) * flux
|
||||
else
|
||||
score = score + p % absorb_wgt * &
|
||||
matxs % get_xs('decay rate', p_g, UVW=p_uvw, dg=d) * &
|
||||
matxs % get_xs('delayed-nu-fission', p_g, UVW=p_uvw, &
|
||||
dg=d) / matxs % get_xs('absorption', p_g, UVW=p_uvw)
|
||||
dg=d) / matxs % get_xs('absorption', p_g, UVW=p_uvw) * flux
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
|
|
@ -1887,11 +1888,11 @@ contains
|
|||
fission_bank(n_bank - p % n_bank + k) % wgt * &
|
||||
nucxs % get_xs('decay rate', p_g, UVW=p_uvw, dg=g) * &
|
||||
nucxs % get_xs('fission', p_g, UVW=p_uvw) / &
|
||||
matxs % get_xs('fission', p_g, UVW=p_uvw)
|
||||
matxs % get_xs('fission', p_g, UVW=p_uvw) * flux
|
||||
else
|
||||
score = score + keff * &
|
||||
fission_bank(n_bank - p % n_bank + k) % wgt * &
|
||||
matxs % get_xs('decay rate', p_g, UVW=p_uvw, dg=g)
|
||||
matxs % get_xs('decay rate', p_g, UVW=p_uvw, dg=g) * flux
|
||||
end if
|
||||
|
||||
! if the delayed group filter is present, tally to corresponding
|
||||
|
|
@ -2523,9 +2524,13 @@ contains
|
|||
|
||||
if (.not. run_CE .and. eo_filt % matches_transport_groups) then
|
||||
|
||||
! determine outgoing energy from fission bank
|
||||
! determine outgoing energy group from fission bank
|
||||
g_out = int(fission_bank(n_bank - p % n_bank + k) % E)
|
||||
|
||||
! modify the value so that g_out = 1 corresponds to the highest
|
||||
! energy bin
|
||||
g_out = size(eo_filt % bins) - g_out
|
||||
|
||||
! change outgoing energy bin
|
||||
matching_bins(i) = g_out
|
||||
|
||||
|
|
@ -2554,12 +2559,11 @@ contains
|
|||
! determine scoring index and weight for this filter combination
|
||||
i_filter = sum((matching_bins(1:size(t%filters)) - 1) * t % stride) &
|
||||
+ 1
|
||||
filter_weight = product(filter_weights(:size(t % filters)))
|
||||
|
||||
! Add score to tally
|
||||
!$omp atomic
|
||||
t % results(RESULT_VALUE, i_score, i_filter) = &
|
||||
t % results(RESULT_VALUE, i_score, i_filter) + score * filter_weight
|
||||
t % results(RESULT_VALUE, i_score, i_filter) + score
|
||||
|
||||
! Case for tallying delayed emissions
|
||||
else if (score_bin == SCORE_DELAYED_NU_FISSION .and. g /= 0) then
|
||||
|
|
@ -2583,7 +2587,15 @@ contains
|
|||
! check whether the delayed group of the particle is equal to
|
||||
! the delayed group of this bin
|
||||
if (d == g) then
|
||||
call score_fission_delayed_dg(t, d_bin, score, i_score)
|
||||
|
||||
! determine scoring index and weight for this filter
|
||||
! combination
|
||||
i_filter = sum((matching_bins(1:size(t%filters)) - 1) * &
|
||||
t % stride) + 1
|
||||
filter_weight = product(filter_weights(:size(t % filters)))
|
||||
|
||||
call score_fission_delayed_dg(t, d_bin, &
|
||||
score * filter_weight, i_score)
|
||||
end if
|
||||
end do
|
||||
end select
|
||||
|
|
@ -2624,7 +2636,6 @@ contains
|
|||
|
||||
integer :: bin_original ! original bin index
|
||||
integer :: filter_index ! index for matching filter bin combination
|
||||
real(8) :: filter_weight ! combined weight of all filters
|
||||
|
||||
! save original delayed group bin
|
||||
bin_original = matching_bins(t % find_filter(FILTER_DELAYEDGROUP))
|
||||
|
|
@ -2633,11 +2644,10 @@ contains
|
|||
! determine scoring index and weight on the modified matching_bins
|
||||
filter_index = sum((matching_bins(1:size(t % filters)) - 1) * t % stride) &
|
||||
+ 1
|
||||
filter_weight = product(filter_weights(:size(t % filters)))
|
||||
|
||||
!$omp atomic
|
||||
t % results(RESULT_VALUE, score_index, filter_index) = &
|
||||
t % results(RESULT_VALUE, score_index, filter_index) + score * filter_weight
|
||||
t % results(RESULT_VALUE, score_index, filter_index) + score
|
||||
|
||||
! reset original delayed group bin
|
||||
matching_bins(t % find_filter(FILTER_DELAYEDGROUP)) = bin_original
|
||||
|
|
|
|||
|
|
@ -46,16 +46,16 @@ contains
|
|||
! When trigger threshold is reached, write information
|
||||
if (satisfy_triggers) then
|
||||
call write_message("Triggers satisfied for batch " // &
|
||||
trim(to_str(current_batch)))
|
||||
trim(to_str(current_batch)), 7)
|
||||
|
||||
! When trigger is not reached write convergence info for user
|
||||
elseif (name == "eigenvalue") then
|
||||
call write_message("Triggers unsatisfied, max unc./thresh. is " // &
|
||||
trim(to_str(max_ratio)) // " for " // trim(name))
|
||||
trim(to_str(max_ratio)) // " for " // trim(name), 7)
|
||||
else
|
||||
call write_message("Triggers unsatisfied, max unc./thresh. is " // &
|
||||
trim(to_str(max_ratio)) // " for " // trim(name) // &
|
||||
" in tally " // trim(to_str(tally_id)))
|
||||
" in tally " // trim(to_str(tally_id)), 7)
|
||||
end if
|
||||
|
||||
! If batch_interval is not set, estimate batches till triggers are satisfied
|
||||
|
|
@ -75,7 +75,7 @@ contains
|
|||
" -- greater than max batches. ")
|
||||
else
|
||||
call write_message("The estimated number of batches is " // &
|
||||
trim(to_str(n_pred_batches)))
|
||||
trim(to_str(n_pred_batches)), 7)
|
||||
end if
|
||||
end if
|
||||
end subroutine check_triggers
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ contains
|
|||
type(VectorReal), allocatable :: uncertainty_vec(:) ! uncertainty of total # of atoms
|
||||
|
||||
if (master) then
|
||||
call header("STOCHASTIC VOLUME CALCULATION", level=1)
|
||||
call header("STOCHASTIC VOLUME CALCULATION", 3)
|
||||
call time_volume % start()
|
||||
end if
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ contains
|
|||
|
||||
if (master) then
|
||||
call write_message("Running volume calculation " // trim(to_str(i)) &
|
||||
// "...")
|
||||
// "...", 4)
|
||||
end if
|
||||
|
||||
call get_volume(volume_calcs(i), volume, nuclide_vec, atoms_vec, &
|
||||
|
|
@ -74,9 +74,10 @@ contains
|
|||
do j = 1, size(volume_calcs(i) % domain_id)
|
||||
call write_message(trim(domain_type) // " " // trim(to_str(&
|
||||
volume_calcs(i) % domain_id(j))) // ": " // trim(to_str(&
|
||||
volume(1,j))) // " +/- " // trim(to_str(volume(2,j))) // " cm^3")
|
||||
volume(1,j))) // " +/- " // trim(to_str(volume(2,j))) // &
|
||||
" cm^3", 4)
|
||||
end do
|
||||
call write_message("")
|
||||
call write_message("", 4)
|
||||
|
||||
filename = trim(path_output) // 'volume_' // trim(to_str(i)) // '.h5'
|
||||
call write_volume(volume_calcs(i), filename, volume, nuclide_vec, &
|
||||
|
|
@ -90,7 +91,7 @@ contains
|
|||
if (master) then
|
||||
call time_volume % stop()
|
||||
call write_message("Elapsed time: " // trim(to_str(time_volume % &
|
||||
get_value())) // " s")
|
||||
get_value())) // " s", 6)
|
||||
end if
|
||||
end subroutine run_volume_calculations
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ contains
|
|||
|
||||
subroutine volume_from_xml(this, node_vol)
|
||||
class(VolumeCalculation), intent(out) :: this
|
||||
type(Node), pointer :: node_vol
|
||||
type(XMLNode), intent(in) :: node_vol
|
||||
|
||||
integer :: num_domains
|
||||
character(10) :: temp_str
|
||||
|
|
@ -41,7 +41,7 @@ contains
|
|||
|
||||
! Read cell IDs
|
||||
if (check_for_node(node_vol, "domain_ids")) then
|
||||
num_domains = get_arraysize_integer(node_vol, "domain_ids")
|
||||
num_domains = node_word_count(node_vol, "domain_ids")
|
||||
else
|
||||
call fatal_error("Must specify at least one cell for a volume calculation")
|
||||
end if
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit bdc852f4f43d969fb1b179cba79295c1e095a455
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
module openmc_fox
|
||||
|
||||
use fox_m_fsys_array_str, only: str_vs, vs_str, vs_str_alloc
|
||||
use fox_m_fsys_format, only: operator(//)
|
||||
use fox_m_fsys_string, only: toLower
|
||||
use fox_m_utils_uri, only: URI, parseURI, destroyURI, isAbsoluteURI, &
|
||||
rebaseURI, expressURI
|
||||
use m_common_charset, only: checkChars, XML1_0, XML1_1
|
||||
use m_common_element, only: element_t, get_element, attribute_t, &
|
||||
attribute_has_default, get_attribute_declaration, get_attlist_size
|
||||
use m_common_namecheck, only: checkQName, prefixOfQName, localPartOfQName, &
|
||||
checkName, checkPublicId, checkNCName
|
||||
use m_common_struct, only: xml_doc_state, init_xml_doc_state, destroy_xml_doc_state
|
||||
|
||||
use m_dom_error, only: DOMException, throw_exception, inException, getExceptionCode, &
|
||||
NO_MODIFICATION_ALLOWED_ERR, NOT_FOUND_ERR, HIERARCHY_REQUEST_ERR, &
|
||||
WRONG_DOCUMENT_ERR, FoX_INTERNAL_ERROR, FoX_NODE_IS_NULL, FoX_LIST_IS_NULL, &
|
||||
INUSE_ATTRIBUTE_ERR, FoX_MAP_IS_NULL, INVALID_CHARACTER_ERR, NAMESPACE_ERR, &
|
||||
FoX_INVALID_PUBLIC_ID, FoX_INVALID_SYSTEM_ID, FoX_IMPL_IS_NULL, FoX_INVALID_NODE, &
|
||||
FoX_INVALID_CHARACTER, FoX_INVALID_COMMENT, FoX_INVALID_CDATA_SECTION, &
|
||||
FoX_INVALID_PI_DATA, NOT_SUPPORTED_ERR, FoX_INVALID_ENTITY, &
|
||||
INDEX_SIZE_ERR, FoX_NO_SUCH_ENTITY, FoX_HIERARCHY_REQUEST_ERR, &
|
||||
FoX_INVALID_URI
|
||||
|
||||
use m_dom_dom
|
||||
use fox_dom
|
||||
use fox_m_fsys_count_parse_input, only: countrts
|
||||
|
||||
implicit none
|
||||
|
||||
contains
|
||||
|
||||
function getChildrenByTagName(doc, tagName, name, ex)result(list)
|
||||
type(DOMException), intent(out), optional :: ex
|
||||
type(Node), pointer :: doc
|
||||
character(len=*), intent(in), optional :: tagName, name
|
||||
type(NodeList), pointer :: list
|
||||
|
||||
type(NodeListPtr), pointer :: nll(:), temp_nll(:)
|
||||
type(Node), pointer :: arg, this, treeroot
|
||||
logical :: doneChildren, doneAttributes, allElements
|
||||
integer :: i, i_tree
|
||||
|
||||
list => null()
|
||||
|
||||
if (.not.associated(doc)) then
|
||||
if (getFoX_checks().or.FoX_NODE_IS_NULL<200) then
|
||||
call throw_exception(FoX_NODE_IS_NULL, "getElementsByTagName", ex)
|
||||
if (present(ex)) then
|
||||
if (inException(ex)) then
|
||||
return
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if (doc%nodeType==DOCUMENT_NODE) then
|
||||
if (present(name).or..not.present(tagName)) then
|
||||
if (getFoX_checks().or.FoX_INVALID_NODE<200) then
|
||||
call throw_exception(FoX_INVALID_NODE, "getElementsByTagName", ex)
|
||||
if (present(ex)) then
|
||||
if (inException(ex)) then
|
||||
return
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
elseif (doc%nodeType==ELEMENT_NODE) then
|
||||
if (present(name).or..not.present(tagName)) then
|
||||
if (getFoX_checks().or.FoX_INVALID_NODE<200) then
|
||||
call throw_exception(FoX_INVALID_NODE, "getElementsByTagName", ex)
|
||||
if (present(ex)) then
|
||||
if (inException(ex)) then
|
||||
return
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
else
|
||||
if (getFoX_checks().or.FoX_INVALID_NODE<200) then
|
||||
call throw_exception(FoX_INVALID_NODE, "getElementsByTagName", ex)
|
||||
if (present(ex)) then
|
||||
if (inException(ex)) then
|
||||
return
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if (doc%nodeType==DOCUMENT_NODE) then
|
||||
arg => getDocumentElement(doc)
|
||||
else
|
||||
arg => doc
|
||||
endif
|
||||
|
||||
allocate(list)
|
||||
allocate(list%nodes(0))
|
||||
list%element => doc
|
||||
if (present(name)) list%nodeName => vs_str_alloc(name)
|
||||
if (present(tagName)) list%nodeName => vs_str_alloc(tagName)
|
||||
|
||||
allElements = (str_vs(list%nodeName)=="*")
|
||||
|
||||
if (doc%nodeType==DOCUMENT_NODE) then
|
||||
nll => doc%docExtras%nodelists
|
||||
elseif (doc%nodeType==ELEMENT_NODE) then
|
||||
nll => doc%ownerDocument%docExtras%nodelists
|
||||
endif
|
||||
allocate(temp_nll(size(nll)+1))
|
||||
do i = 1, size(nll)
|
||||
temp_nll(i)%this => nll(i)%this
|
||||
enddo
|
||||
temp_nll(i)%this => list
|
||||
deallocate(nll)
|
||||
if (doc%nodeType==DOCUMENT_NODE) then
|
||||
doc%docExtras%nodelists => temp_nll
|
||||
elseif (doc%nodeType==ELEMENT_NODE) then
|
||||
doc%ownerDocument%docExtras%nodelists => temp_nll
|
||||
endif
|
||||
|
||||
treeroot => arg
|
||||
|
||||
i_tree = 0
|
||||
doneChildren = .false.
|
||||
doneAttributes = .false.
|
||||
this => treeroot
|
||||
do
|
||||
if (.not.doneChildren.and..not.(getNodeType(this)==ELEMENT_NODE.and.doneAttributes)) then
|
||||
if (this%nodeType==ELEMENT_NODE) then
|
||||
if ((allElements .or. str_vs(this%nodeName)==tagName) &
|
||||
.and..not.(getNodeType(doc)==ELEMENT_NODE.and.associated(this, arg))) &
|
||||
call append(list, this)
|
||||
doneAttributes = .true.
|
||||
endif
|
||||
|
||||
else
|
||||
if (getNodeType(this)==ELEMENT_NODE.and..not.doneChildren) then
|
||||
doneAttributes = .true.
|
||||
else
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
if (.not.doneChildren) then
|
||||
if (getNodeType(this)==ELEMENT_NODE.and..not.doneAttributes) then
|
||||
if (getLength(getAttributes(this))>0) then
|
||||
this => item(getAttributes(this), 0)
|
||||
else
|
||||
doneAttributes = .true.
|
||||
endif
|
||||
elseif (hasChildNodes(this) .and. .not. associated(getParentNode(this), treeroot)) then
|
||||
this => getFirstChild(this)
|
||||
doneChildren = .false.
|
||||
doneAttributes = .false.
|
||||
else
|
||||
doneChildren = .true.
|
||||
doneAttributes = .false.
|
||||
endif
|
||||
|
||||
else ! if doneChildren
|
||||
|
||||
if (associated(this, treeroot)) exit
|
||||
if (getNodeType(this)==ATTRIBUTE_NODE) then
|
||||
if (i_tree<getLength(getAttributes(getOwnerElement(this)))-1) then
|
||||
i_tree= i_tree+ 1
|
||||
this => item(getAttributes(getOwnerElement(this)), i_tree)
|
||||
doneChildren = .false.
|
||||
else
|
||||
i_tree= 0
|
||||
this => getOwnerElement(this)
|
||||
doneAttributes = .true.
|
||||
doneChildren = .false.
|
||||
endif
|
||||
elseif (associated(getNextSibling(this))) then
|
||||
|
||||
this => getNextSibling(this)
|
||||
doneChildren = .false.
|
||||
doneAttributes = .false.
|
||||
else
|
||||
this => getParentNode(this)
|
||||
endif
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
|
||||
|
||||
end function getChildrenByTagName
|
||||
end module openmc_fox
|
||||
|
|
@ -1,30 +1,23 @@
|
|||
module xml_interface
|
||||
|
||||
use constants, only: MAX_LINE_LEN
|
||||
use error, only: fatal_error
|
||||
use openmc_fox
|
||||
use, intrinsic :: ISO_C_BINDING
|
||||
|
||||
use error, only: fatal_error
|
||||
use pugixml
|
||||
use string, only: word_count
|
||||
|
||||
implicit none
|
||||
private
|
||||
public :: Node
|
||||
public :: NodeList
|
||||
public :: open_xmldoc
|
||||
public :: close_xmldoc
|
||||
public :: XMLDocument, XMLNode, XMLText, XMLAttribute
|
||||
public :: check_for_node
|
||||
public :: get_node_ptr
|
||||
public :: get_node_list
|
||||
public :: get_list_size
|
||||
public :: get_list_item
|
||||
public :: get_node_value
|
||||
public :: get_node_array
|
||||
public :: get_arraysize_integer
|
||||
public :: get_arraysize_double
|
||||
public :: get_arraysize_string
|
||||
|
||||
integer, parameter :: ATTR_NODE = 0
|
||||
integer, parameter :: ELEM_NODE = 1
|
||||
public :: node_value_string
|
||||
public :: node_word_count
|
||||
|
||||
interface get_node_value
|
||||
module procedure get_node_value_bool
|
||||
module procedure get_node_value_integer
|
||||
module procedure get_node_value_long
|
||||
module procedure get_node_value_double
|
||||
|
|
@ -39,493 +32,305 @@ module xml_interface
|
|||
|
||||
contains
|
||||
|
||||
!===============================================================================
|
||||
! OPEN_XMLDOC opens and parses an XML and returns a pointer to the document
|
||||
!===============================================================================
|
||||
|
||||
subroutine open_xmldoc(ptr, filename)
|
||||
|
||||
character(len=*) :: filename
|
||||
type(Node), pointer :: ptr
|
||||
|
||||
ptr => parseFile(trim(filename)) ! Pointer to the whole XML document
|
||||
ptr => getDocumentElement(ptr) ! Grabs root element of XML document
|
||||
|
||||
end subroutine open_xmldoc
|
||||
|
||||
!===============================================================================
|
||||
! CLOSE_XMLDOC closes and destroys all memory associated with document
|
||||
!===============================================================================
|
||||
|
||||
subroutine close_xmldoc(ptr)
|
||||
|
||||
type(Node), pointer :: ptr
|
||||
|
||||
ptr => getParentNode(ptr) ! Go from root element ptr to document ptr
|
||||
call destroy(ptr) ! Deallocates all nodes recursively
|
||||
|
||||
end subroutine close_xmldoc
|
||||
|
||||
!===============================================================================
|
||||
! CHECK_FOR_NODE checks for an attribute or sub-element node with the given
|
||||
! node name. This should only be used for checking a single occurance of a
|
||||
! sub-element node. To check for sub-element nodes that repeat, use
|
||||
! get_node_list and get_list_size. This is to minimize number of calls
|
||||
! to getChildrenByTagName.
|
||||
! sub-element node.
|
||||
!===============================================================================
|
||||
|
||||
function check_for_node(ptr, node_name) result(found)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
function check_for_node(node, name) result(found)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(len=*), intent(in) :: name
|
||||
logical :: found
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
|
||||
type(Node), pointer :: temp_ptr
|
||||
type(NodeList), pointer :: elem_list
|
||||
type(XMLAttribute) :: attr
|
||||
type(XMLNode) :: child
|
||||
|
||||
! Default that we found it and attribute
|
||||
found = .true.
|
||||
|
||||
! Get the attribute node
|
||||
temp_ptr => getAttributeNode(ptr, trim(node_name))
|
||||
|
||||
! Check if node exists
|
||||
if (associated(temp_ptr)) return
|
||||
|
||||
! Check for a sub-element
|
||||
elem_list => getChildrenByTagName(ptr, trim(node_name))
|
||||
|
||||
! Get the length of the list
|
||||
if (getLength(elem_list) == 0) then
|
||||
found = .false.
|
||||
return
|
||||
! Check if an attribute or exists
|
||||
attr = node % attribute(name)
|
||||
if (attr % associated()) then
|
||||
found = .true.
|
||||
else
|
||||
child = node % child(name)
|
||||
if (child % associated()) then
|
||||
found = .true.
|
||||
else
|
||||
found = .false.
|
||||
end if
|
||||
end if
|
||||
|
||||
end function check_for_node
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_PTR returns a Node pointer to an attribute or sub-element node.
|
||||
! Note, this should only be used for sub-element nodes that occur only once.
|
||||
! For repeated nodes, use get_node_list and then get_item_item.
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_ptr(in_ptr, node_name, out_ptr, found)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
logical, intent(out), optional :: found
|
||||
type(Node), pointer, intent(in) :: in_ptr
|
||||
type(Node), pointer, intent(out) :: out_ptr
|
||||
|
||||
logical :: found_
|
||||
type(NodeList), pointer :: elem_list
|
||||
|
||||
! Set found to false
|
||||
found_ = .false.
|
||||
|
||||
! Check for a sub-element
|
||||
elem_list => getChildrenByTagName(in_ptr, trim(node_name))
|
||||
|
||||
! Get the length of the list
|
||||
if (getLength(elem_list) == 0) return
|
||||
|
||||
! Point to the new element
|
||||
out_ptr => item(elem_list, 0)
|
||||
found_ = .true.
|
||||
|
||||
! Check to output found
|
||||
if (present(found)) found = found_
|
||||
|
||||
end subroutine get_node_ptr
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_LIST is used to get a pointer to a list of sub-element nodes
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_list(in_ptr, node_name, out_ptr)
|
||||
subroutine get_node_list(node, name, node_list)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
type(XMLNode), allocatable, intent(out) :: node_list(:)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
type(Node), pointer, intent(in) :: in_ptr
|
||||
type(NodeList), pointer, intent(out) :: out_ptr
|
||||
integer :: i, n
|
||||
type(XMLNode) :: first, current
|
||||
|
||||
! Check for a sub-element
|
||||
out_ptr => getChildrenByTagName(in_ptr, trim(node_name))
|
||||
first = node % child(name)
|
||||
|
||||
! Determine number of nodes
|
||||
n = 0
|
||||
current = first
|
||||
do while (current % associated())
|
||||
n = n + 1
|
||||
current = current % next_sibling(name)
|
||||
end do
|
||||
|
||||
! Allocate nodes
|
||||
allocate(node_list(n))
|
||||
current = first
|
||||
do i = 1, n
|
||||
node_list(i) = current
|
||||
current = current % next_sibling(name)
|
||||
end do
|
||||
end subroutine get_node_list
|
||||
|
||||
!===============================================================================
|
||||
! GET_LIST_SIZE is used to get the number of elements from a node list
|
||||
! GET_NODE_VALUE_BOOL returns a logical value from an attribute or node
|
||||
!===============================================================================
|
||||
|
||||
function get_list_size(in_ptr) result(n_size)
|
||||
subroutine get_node_value_bool(node, name, val)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
logical, intent(out) :: val
|
||||
|
||||
integer :: n_size
|
||||
type(NodeList), pointer, intent(in) :: in_ptr
|
||||
type(XMLAttribute) :: attr
|
||||
type(XMLNode) :: child
|
||||
type(XMLText) :: text
|
||||
|
||||
! Get the size of the list
|
||||
n_size = getLength(in_ptr)
|
||||
|
||||
end function get_list_size
|
||||
|
||||
!===============================================================================
|
||||
! GET_LIST_ITEM is used to select a specific item from a node list
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_list_item(in_ptr, idx, out_ptr)
|
||||
|
||||
integer, intent(in) :: idx
|
||||
type(NodeList), pointer, intent(in) :: in_ptr
|
||||
type(Node), pointer, intent(out) :: out_ptr
|
||||
|
||||
! Check for a sub-element
|
||||
out_ptr => item(in_ptr, idx - 1)
|
||||
|
||||
end subroutine get_list_item
|
||||
attr = node % attribute(name)
|
||||
if (attr % associated()) then
|
||||
val = attr % as_bool()
|
||||
else
|
||||
child = node % child(name)
|
||||
if (child % associated()) then
|
||||
text = child % text()
|
||||
val = text % as_bool()
|
||||
else
|
||||
call fatal_error("No child XML node named '" // trim(name) // "'.")
|
||||
end if
|
||||
end if
|
||||
end subroutine get_node_value_bool
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_VALUE_INTEGER returns a integer value from an attribute or node
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_value_integer(ptr, node_name, result_int)
|
||||
subroutine get_node_value_integer(node, name, val)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
integer, intent(out) :: val
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
integer :: result_int
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
type(XMLAttribute) :: attr
|
||||
type(XMLNode) :: child
|
||||
type(XMLText) :: text
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " &
|
||||
&// getNodeName(ptr) // ".")
|
||||
end if
|
||||
|
||||
! Extract value
|
||||
if (node_type == ATTR_NODE) then
|
||||
call extractDataAttribute(ptr, node_name, result_int)
|
||||
attr = node % attribute(name)
|
||||
if (attr % associated()) then
|
||||
val = attr % as_int()
|
||||
else
|
||||
call extractDataContent(temp_ptr, result_int)
|
||||
child = node % child(name)
|
||||
if (child % associated()) then
|
||||
text = child % text()
|
||||
val = text % as_int()
|
||||
else
|
||||
call fatal_error("No XML node named '" // trim(name) // "'.")
|
||||
end if
|
||||
end if
|
||||
|
||||
end subroutine get_node_value_integer
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_VALUE_LONG returns an 8-byte integer from attribute or node
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_value_long(ptr, node_name, result_long)
|
||||
subroutine get_node_value_long(node, name, val)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
integer(C_LONG_LONG), intent(out) :: val
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
integer(8) :: result_long
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
type(XMLAttribute) :: attr
|
||||
type(XMLNode) :: child
|
||||
type(XMLText) :: text
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " &
|
||||
&// getNodeName(ptr) // ".")
|
||||
end if
|
||||
|
||||
! Extract value
|
||||
if (node_type == ATTR_NODE) then
|
||||
call extractDataAttribute(ptr, node_name, result_long)
|
||||
attr = node % attribute(name)
|
||||
if (attr % associated()) then
|
||||
val = attr % as_llong()
|
||||
else
|
||||
call extractDataContent(temp_ptr, result_long)
|
||||
child = node % child(name)
|
||||
if (child % associated()) then
|
||||
text = child % text()
|
||||
val = text % as_llong()
|
||||
else
|
||||
call fatal_error("No XML node named '" // trim(name) // "'.")
|
||||
end if
|
||||
end if
|
||||
|
||||
end subroutine get_node_value_long
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_VALUE_DOUBLE returns a double precision real from attr. or node
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_value_double(ptr, node_name, result_double)
|
||||
subroutine get_node_value_double(node, name, val)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
real(C_DOUBLE), intent(out) :: val
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
real(8) :: result_double
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
type(XMLAttribute) :: attr
|
||||
type(XMLNode) :: child
|
||||
type(XMLText) :: text
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " &
|
||||
&// getNodeName(ptr) // ".")
|
||||
end if
|
||||
|
||||
! Extract value
|
||||
if (node_type == ATTR_NODE) then
|
||||
call extractDataAttribute(ptr, node_name, result_double)
|
||||
attr = node % attribute(name)
|
||||
if (attr % associated()) then
|
||||
val = attr % as_double()
|
||||
else
|
||||
call extractDataContent(temp_ptr, result_double)
|
||||
child = node % child(name)
|
||||
if (child % associated()) then
|
||||
text = child % text()
|
||||
val = text % as_double()
|
||||
else
|
||||
call fatal_error("No XML node named '" // trim(name) // "'.")
|
||||
end if
|
||||
end if
|
||||
|
||||
end subroutine get_node_value_double
|
||||
|
||||
!===============================================================================
|
||||
! NODE_VALUE_STRING returns a single string from attr. or node
|
||||
!===============================================================================
|
||||
|
||||
function node_value_string(node, name) result(val)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
character(len=:, kind=C_CHAR), allocatable :: val
|
||||
|
||||
type(XMLAttribute) :: attr
|
||||
type(XMLNode) :: child
|
||||
|
||||
attr = node % attribute(name)
|
||||
if (attr % associated()) then
|
||||
val = adjustl(attr % value())
|
||||
else
|
||||
child = node % child(name)
|
||||
if (child % associated()) then
|
||||
val = adjustl(child % child_value())
|
||||
else
|
||||
call fatal_error("No child XML node named '" // trim(name) // "'.")
|
||||
end if
|
||||
end if
|
||||
end function node_value_string
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_VALUE_STRING returns a single string from attr. or node
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_value_string(node, name, val)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
character(*), intent(out) :: val
|
||||
|
||||
val = node_value_string(node, name)
|
||||
end subroutine get_node_value_string
|
||||
|
||||
!===============================================================================
|
||||
! NODE_WORD_COUNT returns the number of words in a text node or attribute value
|
||||
!===============================================================================
|
||||
|
||||
integer function node_word_count(node, name)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
|
||||
node_word_count = word_count(node_value_string(node, name))
|
||||
end function node_word_count
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_ARRAY_INTEGER returns a 1-D array of integers
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_array_integer(ptr, node_name, result_int)
|
||||
subroutine get_node_array_integer(node, name, array)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
integer, intent(out) :: array(:)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
integer :: result_int(:)
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
integer :: stat
|
||||
character(len=:, kind=C_CHAR), allocatable :: str
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
! Get value of text node/attribute
|
||||
str = node_value_string(node, name)
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " &
|
||||
&// getNodeName(ptr) // ".")
|
||||
! Read numbers into array
|
||||
read(UNIT=str, FMT=*, IOSTAT=stat) array
|
||||
if (stat > 0) then
|
||||
call fatal_error("Error converting XML text: " // trim(str))
|
||||
end if
|
||||
|
||||
! Extract value
|
||||
if (node_type == ATTR_NODE) then
|
||||
call extractDataAttribute(ptr, node_name, result_int)
|
||||
else
|
||||
call extractDataContent(temp_ptr, result_int)
|
||||
end if
|
||||
|
||||
end subroutine get_node_array_integer
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_ARRAY_DOUBLE returns a 1-D array of double precision reals
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_array_double(ptr, node_name, result_double)
|
||||
subroutine get_node_array_double(node, name, array)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
real(C_DOUBLE), intent(out) :: array(:)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
real(8) :: result_double(:)
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
integer :: stat
|
||||
character(len=:, kind=C_CHAR), allocatable :: str
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
! Get value of text node/attribute
|
||||
str = node_value_string(node, name)
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " &
|
||||
&// getNodeName(ptr) // ".")
|
||||
! Read numbers into array
|
||||
read(UNIT=str, FMT=*, IOSTAT=stat) array
|
||||
if (stat > 0) then
|
||||
call fatal_error("Error converting XML text: " // trim(str))
|
||||
end if
|
||||
|
||||
! Extract value
|
||||
if (node_type == ATTR_NODE) then
|
||||
call extractDataAttribute(ptr, node_name, result_double)
|
||||
else
|
||||
call extractDataContent(temp_ptr, result_double)
|
||||
end if
|
||||
|
||||
end subroutine get_node_array_double
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_ARRAY_STRING returns a 1-D array of strings
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_array_string(ptr, node_name, result_string)
|
||||
subroutine get_node_array_string(node, name, array)
|
||||
type(XMLNode), intent(in) :: node
|
||||
character(*), intent(in) :: name
|
||||
character(len=*), intent(out) :: array(:)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
character(len=*) :: result_string(:)
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
integer :: i, n
|
||||
integer :: start
|
||||
logical :: inword
|
||||
character(kind=C_CHAR) :: chr
|
||||
character(len=:, kind=C_CHAR), allocatable :: str
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
! Get value of text node/attribute
|
||||
str = node_value_string(node, name)
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " &
|
||||
&// getNodeName(ptr) // ".")
|
||||
inword = .false.
|
||||
n = 0
|
||||
do i = 1, len(str)
|
||||
chr = str(i:i)
|
||||
select case (chr)
|
||||
case (' ', C_HORIZONTAL_TAB, C_NEW_LINE, C_CARRIAGE_RETURN)
|
||||
if (inword) then
|
||||
inword = .false.
|
||||
n = n + 1
|
||||
array(n) = str(start:i-1)
|
||||
end if
|
||||
case default
|
||||
if (.not. inword) then
|
||||
start = i
|
||||
inword = .true.
|
||||
end if
|
||||
end select
|
||||
end do
|
||||
if (inword) then
|
||||
n = n + 1
|
||||
array(n) = str(start:len(str))
|
||||
end if
|
||||
|
||||
! Extract value
|
||||
if (node_type == ATTR_NODE) then
|
||||
call extractDataAttribute(ptr, node_name, result_string)
|
||||
else
|
||||
call extractDataContent(temp_ptr, result_string)
|
||||
end if
|
||||
|
||||
end subroutine get_node_array_string
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_VALUE_STRING returns a single string from attr. or node
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node_value_string(ptr, node_name, result_str)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
character(len=*) :: result_str
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " // &
|
||||
getNodeName(ptr) // ".")
|
||||
end if
|
||||
|
||||
! Extract value
|
||||
if (node_type == ATTR_NODE) then
|
||||
call extractDataAttribute(ptr, node_name, result_str)
|
||||
else
|
||||
call extractDataContent(temp_ptr, result_str)
|
||||
end if
|
||||
|
||||
end subroutine get_node_value_string
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_ARRAYSIZE_INTEGER returns the size of the integer array
|
||||
!===============================================================================
|
||||
|
||||
function get_arraysize_integer(ptr, node_name) result(n)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
integer :: n
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " &
|
||||
&// getNodeName(ptr) // ".")
|
||||
end if
|
||||
|
||||
! Get the size
|
||||
n = countrts(getTextContent(temp_ptr), 0)
|
||||
|
||||
end function get_arraysize_integer
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_ARRAYSIZE_DOUBLE returns the size of double prec. real array
|
||||
!===============================================================================
|
||||
|
||||
function get_arraysize_double(ptr, node_name) result(n)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
integer :: n
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " &
|
||||
&// getNodeName(ptr) // ".")
|
||||
end if
|
||||
|
||||
! Get the size
|
||||
n = countrts(getTextContent(temp_ptr), 0.0_8)
|
||||
|
||||
end function get_arraysize_double
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE_ARRAYSIZE_STRING returns the size of string array
|
||||
!===============================================================================
|
||||
|
||||
function get_arraysize_string(ptr, node_name) result(n)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
integer :: n
|
||||
type(Node), pointer, intent(in) :: ptr
|
||||
|
||||
integer :: node_type
|
||||
logical :: found
|
||||
type(Node), pointer :: temp_ptr
|
||||
|
||||
! Get pointer to the node
|
||||
call get_node(ptr, node_name, temp_ptr, node_type, found)
|
||||
|
||||
! Leave if it was not found
|
||||
if (.not. found) then
|
||||
call fatal_error("Node " // node_name // " not part of Node " // &
|
||||
getNodeName(ptr) // ".")
|
||||
end if
|
||||
|
||||
! Get the size
|
||||
n = countrts(getTextContent(temp_ptr), 'a')
|
||||
|
||||
end function get_arraysize_string
|
||||
|
||||
!===============================================================================
|
||||
! GET_NODE private routine that gets a pointer to a specific node
|
||||
!===============================================================================
|
||||
|
||||
subroutine get_node(in_ptr, node_name, out_ptr, node_type, found)
|
||||
|
||||
character(len=*), intent(in) :: node_name
|
||||
integer, intent(out) :: node_type
|
||||
logical, intent(out) :: found
|
||||
type(Node), pointer, intent(in) :: in_ptr
|
||||
type(Node), pointer, intent(out) :: out_ptr
|
||||
|
||||
type(NodeList), pointer :: elem_list
|
||||
|
||||
! Default that we found it and attribute
|
||||
found = .true.
|
||||
node_type = ATTR_NODE
|
||||
|
||||
! Get the attribute node
|
||||
out_ptr => getAttributeNode(in_ptr, trim(node_name))
|
||||
|
||||
! Check if node exists
|
||||
if (associated(out_ptr)) return
|
||||
|
||||
! Check for a sub-element
|
||||
elem_list => getChildrenByTagName(in_ptr, trim(node_name))
|
||||
|
||||
! Get the length of the list
|
||||
if (getLength(elem_list) == 0) then
|
||||
found = .false.
|
||||
return
|
||||
end if
|
||||
|
||||
! Point to the new element
|
||||
node_type = ELEM_NODE
|
||||
out_ptr => item(elem_list, 0)
|
||||
|
||||
end subroutine get_node
|
||||
|
||||
end module xml_interface
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
<albedo> 0.0 0.0 1.0 1.0 1.0 1.0 </albedo>
|
||||
</mesh>
|
||||
|
||||
<begin> 5 </begin>
|
||||
<display> dominance </display>
|
||||
<feedback> true </feedback>
|
||||
<gauss_seidel_tolerance> 1.e-15 1.e-20 </gauss_seidel_tolerance>
|
||||
<begin>5</begin>
|
||||
<display>dominance</display>
|
||||
<feedback>true</feedback>
|
||||
<gauss_seidel_tolerance>1.e-15 1.e-20</gauss_seidel_tolerance>
|
||||
</cmfd>
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@
|
|||
<inactive>10</inactive>
|
||||
<particles>1000</particles>
|
||||
|
||||
<!-- How verbose output should be -->
|
||||
<verbosity value="7" />
|
||||
|
||||
<!-- Starting source -->
|
||||
<source>
|
||||
<space>
|
||||
|
|
@ -26,6 +23,6 @@
|
|||
</entropy>
|
||||
|
||||
<!-- Run CMFD -->
|
||||
<run_cmfd> true </run_cmfd>
|
||||
<run_cmfd>true</run_cmfd>
|
||||
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@
|
|||
<inactive>10</inactive>
|
||||
<particles>1000</particles>
|
||||
|
||||
<!-- How verbose output should be -->
|
||||
<verbosity value="7" />
|
||||
|
||||
<!-- Starting source -->
|
||||
<source>
|
||||
<space>
|
||||
|
|
@ -26,6 +23,6 @@
|
|||
</entropy>
|
||||
|
||||
<!-- Run CMFD -->
|
||||
<run_cmfd> true </run_cmfd>
|
||||
<run_cmfd>true</run_cmfd>
|
||||
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -154,6 +154,11 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
form = '{0:12.6E} {1:12.6E}\n'
|
||||
outstr += form.format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# Enforce closing statepoint and summary files so HDF5
|
||||
# does not throw an error during the next OpenMC execution
|
||||
sp._f.close()
|
||||
sp._summary._f.close()
|
||||
|
||||
return outstr
|
||||
|
||||
def _get_results(self, outstr, hash_output=False):
|
||||
|
|
|
|||
|
|
@ -137,43 +137,95 @@
|
|||
<scores>scatter nu-scatter nu-fission</scores>
|
||||
</tally>
|
||||
<tally id="10006">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energy" />
|
||||
<scores>total absorption flux fission nu-fission scatter nu-scatter</scores>
|
||||
<estimator>analog</estimator>
|
||||
</tally>
|
||||
<tally id="10007">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energy" />
|
||||
<scores>total absorption flux fission nu-fission</scores>
|
||||
<estimator>collision</estimator>
|
||||
</tally>
|
||||
<tally id="10008">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energy" />
|
||||
<scores>total absorption flux fission nu-fission</scores>
|
||||
<estimator>tracklength</estimator>
|
||||
</tally>
|
||||
<tally id="10009">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energy" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energyout" />
|
||||
<scores>scatter nu-scatter nu-fission</scores>
|
||||
</tally>
|
||||
<tally id="10010">
|
||||
<filter bins="1" type="mesh" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>analog</estimator>
|
||||
</tally>
|
||||
<tally id="10007">
|
||||
<tally id="10011">
|
||||
<filter bins="1" type="mesh" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>tracklength</estimator>
|
||||
</tally>
|
||||
<tally id="10008">
|
||||
<tally id="10012">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="0.0 20000000.0" type="energy" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>total absorption fission nu-fission scatter nu-scatter</scores>
|
||||
<estimator>analog</estimator>
|
||||
</tally>
|
||||
<tally id="10009">
|
||||
<tally id="10013">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="0.0 20000000.0" type="energy" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>collision</estimator>
|
||||
</tally>
|
||||
<tally id="10010">
|
||||
<tally id="10014">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="0.0 20000000.0" type="energy" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>tracklength</estimator>
|
||||
</tally>
|
||||
<tally id="10011">
|
||||
<tally id="10015">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="0.0 20000000.0" type="energy" />
|
||||
<filter bins="0.0 20000000.0" type="energyout" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>scatter nu-scatter nu-fission</scores>
|
||||
</tally>
|
||||
<tally id="10016">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energy" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>total absorption fission nu-fission scatter nu-scatter</scores>
|
||||
<estimator>analog</estimator>
|
||||
</tally>
|
||||
<tally id="10017">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energy" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>collision</estimator>
|
||||
</tally>
|
||||
<tally id="10018">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energy" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>tracklength</estimator>
|
||||
</tally>
|
||||
<tally id="10019">
|
||||
<filter bins="10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011" type="material" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energy" />
|
||||
<filter bins="1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0" type="energyout" />
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<scores>scatter nu-scatter nu-fission</scores>
|
||||
</tally>
|
||||
</tallies>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
1817642a0d20d8ef437c7970cae2e77c265a566ef9843ac1b7cd33f76af09365dc8bd5c045f4297360b38d509864bd629b06dfc4d043b4b1ae7d8a5e2e93fae3
|
||||
0a17877c7cf6dbd3e432b1997669a47c588d2a4074a29406deef27332eb7a0f736ea1fdc2037fc02f8ebca39f00332563bbe2172adc26bfaab2d6144d259daee
|
||||
|
|
@ -23,6 +23,12 @@ class MGTalliesTestHarness(HashedPyAPITestHarness):
|
|||
# Instantiate some tally filters
|
||||
energy_filter = openmc.EnergyFilter([0.0, 20.0e6])
|
||||
energyout_filter = openmc.EnergyoutFilter([0.0, 20.0e6])
|
||||
matching_energy_filter = openmc.EnergyFilter([1e-5, 0.0635, 10.0,
|
||||
1.0e2, 1.0e3, 0.5e6,
|
||||
1.0e6, 20.0e6])
|
||||
matching_eout_filter = openmc.EnergyoutFilter([1e-5, 0.0635, 10.0,
|
||||
1.0e2, 1.0e3, 0.5e6,
|
||||
1.0e6, 20.0e6])
|
||||
mesh_filter = openmc.MeshFilter(mesh)
|
||||
|
||||
mat_ids = [mat.id for mat in self._input_set.materials]
|
||||
|
|
@ -34,6 +40,7 @@ class MGTalliesTestHarness(HashedPyAPITestHarness):
|
|||
True: ['total', 'absorption', 'fission', 'nu-fission']}
|
||||
|
||||
tallies = []
|
||||
|
||||
for do_nuclides in [False, True]:
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mesh_filter]
|
||||
|
|
@ -49,34 +56,43 @@ class MGTalliesTestHarness(HashedPyAPITestHarness):
|
|||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, energy_filter]
|
||||
tallies[-1].estimator = 'analog'
|
||||
tallies[-1].scores = scores[do_nuclides] + ['scatter',
|
||||
'nu-scatter']
|
||||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
# Impose energy bins that dont match the MG structure and those
|
||||
# that do
|
||||
for match_energy_bins in [False, True]:
|
||||
if match_energy_bins:
|
||||
e_filter = matching_energy_filter
|
||||
eout_filter = matching_eout_filter
|
||||
else:
|
||||
e_filter = energy_filter
|
||||
eout_filter = energyout_filter
|
||||
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, energy_filter]
|
||||
tallies[-1].estimator = 'collision'
|
||||
tallies[-1].scores = scores[do_nuclides]
|
||||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, e_filter]
|
||||
tallies[-1].estimator = 'analog'
|
||||
tallies[-1].scores = scores[do_nuclides] + ['scatter',
|
||||
'nu-scatter']
|
||||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, energy_filter]
|
||||
tallies[-1].estimator = 'tracklength'
|
||||
tallies[-1].scores = scores[do_nuclides]
|
||||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, e_filter]
|
||||
tallies[-1].estimator = 'collision'
|
||||
tallies[-1].scores = scores[do_nuclides]
|
||||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, energy_filter,
|
||||
energyout_filter]
|
||||
tallies[-1].scores = ['scatter', 'nu-scatter', 'nu-fission']
|
||||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, e_filter]
|
||||
tallies[-1].estimator = 'tracklength'
|
||||
tallies[-1].scores = scores[do_nuclides]
|
||||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, e_filter, eout_filter]
|
||||
tallies[-1].scores = ['scatter', 'nu-scatter', 'nu-fission']
|
||||
if do_nuclides:
|
||||
tallies[-1].nuclides = nuclides
|
||||
|
||||
self._input_set.tallies = openmc.Tallies(tallies)
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,11 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
if os.path.exists('./tallies.xml'):
|
||||
os.remove('./tallies.xml')
|
||||
|
||||
# Enforce closing statepoint and summary files so HDF5
|
||||
# does not throw an error during the next OpenMC execution
|
||||
sp._f.close()
|
||||
sp._summary._f.close()
|
||||
|
||||
# Re-run MG mode.
|
||||
if self._opts.mpi_exec is not None:
|
||||
mpi_args = [self._opts.mpi_exec, '-n', self._opts.mpi_np]
|
||||
|
|
|
|||
|
|
@ -180,30 +180,30 @@
|
|||
3 2 2 1 1 1 total 0.011105 0.003806
|
||||
mesh 1 delayedgroup group in nuclide mean std. dev.
|
||||
x y z
|
||||
0 1 1 1 1 1 total 0.000005 1.004630e-06
|
||||
1 1 1 1 2 1 total 0.000025 5.397934e-06
|
||||
2 1 1 1 3 1 total 0.000025 5.275008e-06
|
||||
3 1 1 1 4 1 total 0.000058 1.230434e-05
|
||||
4 1 1 1 5 1 total 0.000026 5.548702e-06
|
||||
5 1 1 1 6 1 total 0.000011 2.307003e-06
|
||||
6 1 2 1 1 1 total 0.000004 1.779307e-06
|
||||
7 1 2 1 2 1 total 0.000024 9.648450e-06
|
||||
8 1 2 1 3 1 total 0.000024 9.479453e-06
|
||||
9 1 2 1 4 1 total 0.000056 2.231366e-05
|
||||
10 1 2 1 5 1 total 0.000026 1.028267e-05
|
||||
11 1 2 1 6 1 total 0.000011 4.268087e-06
|
||||
12 2 1 1 1 1 total 0.000006 7.462931e-07
|
||||
13 2 1 1 2 1 total 0.000031 3.842628e-06
|
||||
14 2 1 1 3 1 total 0.000031 3.666739e-06
|
||||
15 2 1 1 4 1 total 0.000071 8.228956e-06
|
||||
16 2 1 1 5 1 total 0.000031 3.416811e-06
|
||||
17 2 1 1 6 1 total 0.000013 1.429034e-06
|
||||
18 2 2 1 1 1 total 0.000005 1.049553e-06
|
||||
19 2 2 1 2 1 total 0.000025 5.392757e-06
|
||||
20 2 2 1 3 1 total 0.000024 5.145263e-06
|
||||
21 2 2 1 4 1 total 0.000056 1.156820e-05
|
||||
22 2 2 1 5 1 total 0.000025 4.880083e-06
|
||||
23 2 2 1 6 1 total 0.000010 2.037276e-06
|
||||
0 1 1 1 1 1 total 0.000005 1.004638e-06
|
||||
1 1 1 1 2 1 total 0.000025 5.397978e-06
|
||||
2 1 1 1 3 1 total 0.000025 5.275050e-06
|
||||
3 1 1 1 4 1 total 0.000058 1.230443e-05
|
||||
4 1 1 1 5 1 total 0.000026 5.548743e-06
|
||||
5 1 1 1 6 1 total 0.000011 2.307020e-06
|
||||
6 1 2 1 1 1 total 0.000005 1.838266e-06
|
||||
7 1 2 1 2 1 total 0.000025 9.941991e-06
|
||||
8 1 2 1 3 1 total 0.000025 9.753804e-06
|
||||
9 1 2 1 4 1 total 0.000058 2.290678e-05
|
||||
10 1 2 1 5 1 total 0.000026 1.050498e-05
|
||||
11 1 2 1 6 1 total 0.000011 4.361882e-06
|
||||
12 2 1 1 1 1 total 0.000006 7.462654e-07
|
||||
13 2 1 1 2 1 total 0.000031 3.842479e-06
|
||||
14 2 1 1 3 1 total 0.000031 3.666594e-06
|
||||
15 2 1 1 4 1 total 0.000071 8.228616e-06
|
||||
16 2 1 1 5 1 total 0.000031 3.416659e-06
|
||||
17 2 1 1 6 1 total 0.000013 1.428970e-06
|
||||
18 2 2 1 1 1 total 0.000005 1.117984e-06
|
||||
19 2 2 1 2 1 total 0.000026 5.744801e-06
|
||||
20 2 2 1 3 1 total 0.000025 5.480526e-06
|
||||
21 2 2 1 4 1 total 0.000058 1.231604e-05
|
||||
22 2 2 1 5 1 total 0.000026 5.181495e-06
|
||||
23 2 2 1 6 1 total 0.000011 2.163732e-06
|
||||
mesh 1 delayedgroup group out nuclide mean std. dev.
|
||||
x y z
|
||||
0 1 1 1 1 1 total 0.0 0.000000
|
||||
|
|
@ -238,50 +238,50 @@
|
|||
3 1 1 1 4 1 total 0.002835 0.000748
|
||||
4 1 1 1 5 1 total 0.001300 0.000340
|
||||
5 1 1 1 6 1 total 0.000540 0.000141
|
||||
6 1 2 1 1 1 total 0.000218 0.000074
|
||||
7 1 2 1 2 1 total 0.001182 0.000400
|
||||
8 1 2 1 3 1 total 0.001160 0.000393
|
||||
9 1 2 1 4 1 total 0.002726 0.000926
|
||||
10 1 2 1 5 1 total 0.001249 0.000428
|
||||
11 1 2 1 6 1 total 0.000519 0.000177
|
||||
6 1 2 1 1 1 total 0.000226 0.000076
|
||||
7 1 2 1 2 1 total 0.001220 0.000412
|
||||
8 1 2 1 3 1 total 0.001197 0.000404
|
||||
9 1 2 1 4 1 total 0.002809 0.000949
|
||||
10 1 2 1 5 1 total 0.001284 0.000436
|
||||
11 1 2 1 6 1 total 0.000533 0.000181
|
||||
12 2 1 1 1 1 total 0.000226 0.000033
|
||||
13 2 1 1 2 1 total 0.001207 0.000174
|
||||
14 2 1 1 3 1 total 0.001175 0.000167
|
||||
15 2 1 1 4 1 total 0.002721 0.000378
|
||||
16 2 1 1 5 1 total 0.001207 0.000160
|
||||
17 2 1 1 6 1 total 0.000502 0.000067
|
||||
18 2 2 1 1 1 total 0.000220 0.000068
|
||||
19 2 2 1 2 1 total 0.001178 0.000355
|
||||
20 2 2 1 3 1 total 0.001150 0.000343
|
||||
21 2 2 1 4 1 total 0.002675 0.000783
|
||||
22 2 2 1 5 1 total 0.001199 0.000341
|
||||
23 2 2 1 6 1 total 0.000499 0.000142
|
||||
18 2 2 1 1 1 total 0.000228 0.000071
|
||||
19 2 2 1 2 1 total 0.001221 0.000373
|
||||
20 2 2 1 3 1 total 0.001190 0.000360
|
||||
21 2 2 1 4 1 total 0.002767 0.000822
|
||||
22 2 2 1 5 1 total 0.001238 0.000357
|
||||
23 2 2 1 6 1 total 0.000515 0.000149
|
||||
mesh 1 delayedgroup group in nuclide mean std. dev.
|
||||
x y z
|
||||
0 1 1 1 1 1 total 0.013362 0.003586
|
||||
1 1 1 1 2 1 total 0.032554 0.008645
|
||||
2 1 1 1 3 1 total 0.121179 0.031941
|
||||
3 1 1 1 4 1 total 0.306858 0.079971
|
||||
4 1 1 1 5 1 total 0.865303 0.220417
|
||||
5 1 1 1 6 1 total 2.906554 0.741589
|
||||
6 1 2 1 1 1 total 0.013362 0.004521
|
||||
7 1 2 1 2 1 total 0.032556 0.011045
|
||||
8 1 2 1 3 1 total 0.121174 0.041226
|
||||
9 1 2 1 4 1 total 0.306816 0.104995
|
||||
10 1 2 1 5 1 total 0.865155 0.301124
|
||||
11 1 2 1 6 1 total 2.906049 1.010025
|
||||
4 1 1 1 5 1 total 0.865303 0.220418
|
||||
5 1 1 1 6 1 total 2.906554 0.741592
|
||||
6 1 2 1 1 1 total 0.013361 0.004515
|
||||
7 1 2 1 2 1 total 0.032560 0.010992
|
||||
8 1 2 1 3 1 total 0.121165 0.040913
|
||||
9 1 2 1 4 1 total 0.306728 0.103786
|
||||
10 1 2 1 5 1 total 0.864851 0.295633
|
||||
11 1 2 1 6 1 total 2.905009 0.992039
|
||||
12 2 1 1 1 1 total 0.013353 0.002006
|
||||
13 2 1 1 2 1 total 0.032614 0.004677
|
||||
14 2 1 1 3 1 total 0.121052 0.016785
|
||||
15 2 1 1 4 1 total 0.305600 0.040199
|
||||
16 2 1 1 5 1 total 0.860792 0.101713
|
||||
17 2 1 1 6 1 total 2.891182 0.344217
|
||||
18 2 2 1 1 1 total 0.013356 0.004047
|
||||
19 2 2 1 2 1 total 0.032596 0.009453
|
||||
20 2 2 1 3 1 total 0.121091 0.034091
|
||||
21 2 2 1 4 1 total 0.305990 0.082530
|
||||
22 2 2 1 5 1 total 0.862223 0.216936
|
||||
23 2 2 1 6 1 total 2.896051 0.731528
|
||||
13 2 1 1 2 1 total 0.032614 0.004676
|
||||
14 2 1 1 3 1 total 0.121052 0.016784
|
||||
15 2 1 1 4 1 total 0.305600 0.040195
|
||||
16 2 1 1 5 1 total 0.860792 0.101702
|
||||
17 2 1 1 6 1 total 2.891182 0.344181
|
||||
18 2 2 1 1 1 total 0.013355 0.004172
|
||||
19 2 2 1 2 1 total 0.032599 0.009758
|
||||
20 2 2 1 3 1 total 0.121084 0.035213
|
||||
21 2 2 1 4 1 total 0.305920 0.085294
|
||||
22 2 2 1 5 1 total 0.861968 0.224059
|
||||
23 2 2 1 6 1 total 2.895182 0.755656
|
||||
mesh 1 delayedgroup group in group out nuclide mean std. dev.
|
||||
x y z
|
||||
0 1 1 1 1 1 1 total 0.000000 0.000000
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<verbosity>1</verbosity>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<batches>12</batches>
|
||||
<inactive>5</inactive>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue