diff --git a/.gitignore b/.gitignore
index 83fc28d783..f6f454de46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,6 @@ suffix.h
*.pyc
rs.cred
*.h5
+*.dat
+tests/run_inputs.py
+cyclus.sqlite
\ No newline at end of file
diff --git a/.travis-install.sh b/.travis-install.sh
new file mode 100755
index 0000000000..cc8aff563f
--- /dev/null
+++ b/.travis-install.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -x # print cmds
+set -e # exit as soon as an error occurs
+
+# log
+msg=`git log --pretty=oneline -1`
+echo "Building commit: $msg"
+
+# setup conda recipe to use develop cyclus
+sed -i "s/- cyclus/- cyclus 0.0/g" conda-recipe/meta.yaml
+
+# build
+conda build --no-test conda-recipe
+
+# install
+conda install --use-local cycamore=0.0
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..6a126fed6a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,44 @@
+language: python
+python:
+ # We don't actually use the Travis Python, but this keeps it organized.
+ - "2.7"
+ - "3.4"
+before_install:
+ - sudo apt-get update -qq
+install:
+ # You may want to periodically update this, although the conda update
+ # conda line below will keep everything up-to-date. We do this
+ # conditionally because it saves us some downloading if the version is
+ # the same.
+ - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
+ wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
+ else
+ wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
+ fi
+ - bash miniconda.sh -b -p $HOME/miniconda
+ - export PATH="$HOME/miniconda/bin:$PATH"
+ - hash -r
+ - conda config --set always_yes yes --set changeps1 no
+ - conda config --add channels pyne
+ - conda config --add channels cyclus
+ - conda update -q conda
+ - conda install conda-build jinja2 setuptools binstar patchelf nose
+ # Useful for debugging any issues with conda
+ - conda info -a
+
+ # install cyclus
+ - git clone https://github.com/cyclus/cyclus ../cyclus
+ - cd ../cyclus
+ - ./.travis-install.sh
+ - cd ../cycamore
+
+ # install cycamore
+ - ./.travis-install.sh
+
+script:
+ - export PATH="$HOME/miniconda/bin:$PATH"
+ - export LD_LIBRARY_PATH="$HOME/miniconda/lib:$LD_LIBRARY_PATH"
+ - cycamore_unit_tests
+ - conda install numpy pytables
+ - nosetests -w tests
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 336fb1cd1e..f2d1f2b451 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,11 +104,18 @@ IF(NOT CYCLUS_DOC_ONLY)
FIND_PACKAGE(HDF5 REQUIRED)
ADD_DEFINITIONS(${HDF5_DEFINITIONS})
set(LIBS ${LIBS} ${HDF5_LIBRARIES})
+ MESSAGE("-- HDF5 Root: ${HDF5_ROOT}")
+ MESSAGE("-- HDF5 Include directory: ${HDF5_INCLUDE_DIR}")
+ MESSAGE("-- HDF5 Library directories: ${HDF5_LIBRARY_DIRS}")
+ MESSAGE("-- HDF5 Libraries: ${HDF5_LIBRARIES}")
# find coin and link to it
FIND_PACKAGE(COIN REQUIRED)
set(LIBS ${LIBS} ${COIN_LIBRARIES})
+ FIND_PACKAGE( Sqlite3 REQUIRED )
+ SET(LIBS ${LIBS} ${SQLITE3_LIBRARIES})
+
# include the agent directories
SET(CYCAMORE_INCLUDE_DIR ${CYCAMORE_INCLUDE_DIR} tests
${CYCLUS_CORE_INCLUDE_DIR}/..)
diff --git a/cmake/FindHDF5.cmake b/cmake/FindHDF5.cmake
index 1722a7ea41..c7f7d73bee 100644
--- a/cmake/FindHDF5.cmake
+++ b/cmake/FindHDF5.cmake
@@ -20,13 +20,14 @@
# HDF5_USE_STATIC_LIBRARIES variable is set before the call to find_package.
#
# To provide the module with a hint about where to find your HDF5 installation,
-# you can set the environment variable HDF5_ROOT. The Find module will then
-# look in this path when searching for HDF5 executables, paths, and libraries.
+# you can set the CMAKE variable -OR- environment variable HDF5_ROOT. The Find
+# module will then look in this path when searching for HDF5 executables, paths,
+# and libraries.
#
# In addition to finding the includes and libraries required to compile an HDF5
# client application, this module also makes an effort to find tools that come
# with the HDF5 distribution that may be useful for regression testing.
-#
+#
# This module will define the following variables:
# HDF5_INCLUDE_DIRS - Location of the hdf5 includes
# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated)
@@ -60,268 +61,271 @@ include(SelectLibraryConfigurations)
include(FindPackageHandleStandardArgs)
# List of the valid HDF5 components
-set(HDF5_VALID_COMPONENTS
+set( HDF5_VALID_COMPONENTS
C
CXX
- )
+)
# try to find the HDF5 wrapper compilers
-find_program(HDF5_C_COMPILER_EXECUTABLE
+find_program( HDF5_C_COMPILER_EXECUTABLE
NAMES h5cc h5pcc
- HINTS ENV HDF5_ROOT
+ HINTS "${HDF5_ROOT}" ENV HDF5_ROOT
PATH_SUFFIXES bin Bin
- DOC "HDF5 Wrapper compiler. Used only to detect HDF5 compile flags.")
-mark_as_advanced(HDF5_C_COMPILER_EXECUTABLE)
+ DOC "HDF5 Wrapper compiler. Used only to detect HDF5 compile flags." )
+mark_as_advanced( HDF5_C_COMPILER_EXECUTABLE )
-find_program(HDF5_CXX_COMPILER_EXECUTABLE
+find_program( HDF5_CXX_COMPILER_EXECUTABLE
NAMES h5c++ h5pc++
- HINTS ENV HDF5_ROOT
+ HINTS "${HDF5_ROOT}" ENV HDF5_ROOT
PATH_SUFFIXES bin Bin
- DOC "HDF5 C++ Wrapper compiler. Used only to detect HDF5 compile flags.")
-mark_as_advanced(HDF5_CXX_COMPILER_EXECUTABLE)
+ DOC "HDF5 C++ Wrapper compiler. Used only to detect HDF5 compile flags." )
+mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE )
-find_program(HDF5_DIFF_EXECUTABLE
+find_program( HDF5_DIFF_EXECUTABLE
NAMES h5diff
- HINTS ENV HDF5_ROOT
- PATH_SUFFIXES bin Bin
- DOC "HDF5 file differencing tool.")
-mark_as_advanced(HDF5_DIFF_EXECUTABLE)
+ HINTS "${HDF5_ROOT}" ENV HDF5_ROOT
+ PATH_SUFFIXES bin Bin
+ DOC "HDF5 file differencing tool." )
+mark_as_advanced( HDF5_DIFF_EXECUTABLE )
# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the
# return_value argument, the text output is stored to the output variable.
-macro(_HDF5_invoke_compiler language output return_value)
- if(HDF5_${language}_COMPILER_EXECUTABLE)
- exec_program(${HDF5_${language}_COMPILER_EXECUTABLE}
+macro( _HDF5_invoke_compiler language output return_value )
+ if( HDF5_${language}_COMPILER_EXECUTABLE )
+ exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
ARGS -show
OUTPUT_VARIABLE ${output}
RETURN_VALUE ${return_value}
- )
- if(${${return_value}} EQUAL 0)
+ )
+ if( ${${return_value}} EQUAL 0 )
# do nothing
else()
- message(STATUS
- "Unable to determine HDF5 ${language} flags from HDF5 wrapper.")
+ message( STATUS
+ "Unable to determine HDF5 ${language} flags from HDF5 wrapper." )
endif()
endif()
endmacro()
# Parse a compile line for definitions, includes, library paths, and libraries.
-macro(_HDF5_parse_compile_line
- compile_line_var
- include_paths
- definitions
- library_paths
- libraries)
+macro( _HDF5_parse_compile_line
+ compile_line_var
+ include_paths
+ definitions
+ library_paths
+ libraries )
# Match the include paths
- string(REGEX MATCHALL "-I([^\" ]+)" include_path_flags
+ string( REGEX MATCHALL "-I([^\" ]+)" include_path_flags
"${${compile_line_var}}"
- )
- foreach(IPATH ${include_path_flags})
- string(REGEX REPLACE "^-I" "" IPATH ${IPATH})
- string(REGEX REPLACE "//" "/" IPATH ${IPATH})
- list(APPEND ${include_paths} ${IPATH})
+ )
+ foreach( IPATH ${include_path_flags} )
+ string( REGEX REPLACE "^-I" "" IPATH ${IPATH} )
+ string( REGEX REPLACE "//" "/" IPATH ${IPATH} )
+ list( APPEND ${include_paths} ${IPATH} )
endforeach()
# Match the definitions
- string(REGEX MATCHALL "-D[^ ]*" definition_flags "${${compile_line_var}}")
- foreach(DEF ${definition_flags})
- list(APPEND ${definitions} ${DEF})
+ string( REGEX MATCHALL "-D[^ ]*" definition_flags "${${compile_line_var}}" )
+ foreach( DEF ${definition_flags} )
+ list( APPEND ${definitions} ${DEF} )
endforeach()
# Match the library paths
- string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" library_path_flags
+ string( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" library_path_flags
"${${compile_line_var}}"
- )
-
- foreach(LPATH ${library_path_flags})
- string(REGEX REPLACE "^-L" "" LPATH ${LPATH})
- string(REGEX REPLACE "//" "/" LPATH ${LPATH})
- list(APPEND ${library_paths} ${LPATH})
+ )
+
+ foreach( LPATH ${library_path_flags} )
+ string( REGEX REPLACE "^-L" "" LPATH ${LPATH} )
+ string( REGEX REPLACE "//" "/" LPATH ${LPATH} )
+ list( APPEND ${library_paths} ${LPATH} )
endforeach()
# now search for the library names specified in the compile line (match -l...)
# match only -l's preceded by a space or comma
# this is to exclude directory names like xxx-linux/
- string(REGEX MATCHALL "[, ]-l([^\", ]+)" library_name_flags
- "${${compile_line_var}}")
+ string( REGEX MATCHALL "[, ]-l([^\", ]+)" library_name_flags
+ "${${compile_line_var}}" )
# strip the -l from all of the library flags and add to the search list
- foreach(LIB ${library_name_flags})
- string(REGEX REPLACE "^[, ]-l" "" LIB ${LIB})
- list(APPEND ${libraries} ${LIB})
+ foreach( LIB ${library_name_flags} )
+ string( REGEX REPLACE "^[, ]-l" "" LIB ${LIB} )
+ list( APPEND ${libraries} ${LIB} )
endforeach()
endmacro()
-if(HDF5_INCLUDE_DIRS AND HDF5_LIBRARIES)
+if( HDF5_INCLUDE_DIRS AND HDF5_LIBRARIES )
# Do nothing: we already have HDF5_INCLUDE_PATH and HDF5_LIBRARIES in the
# cache, it would be a shame to override them
else()
- _HDF5_invoke_compiler(C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE)
- _HDF5_invoke_compiler(CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE)
+ _HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE )
+ _HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE )
- if(NOT HDF5_FIND_COMPONENTS)
- set(HDF5_LANGUAGE_BINDINGS "C")
+ if( NOT HDF5_FIND_COMPONENTS )
+ set( HDF5_LANGUAGE_BINDINGS "C" )
else()
# add the extra specified components, ensuring that they are valid.
- foreach(component ${HDF5_FIND_COMPONENTS})
- list(FIND HDF5_VALID_COMPONENTS ${component} component_location)
- if(${component_location} EQUAL -1)
- message(FATAL_ERROR
- "\"${component}\" is not a valid HDF5 component.")
+ foreach( component ${HDF5_FIND_COMPONENTS} )
+ list( FIND HDF5_VALID_COMPONENTS ${component} component_location )
+ if( ${component_location} EQUAL -1 )
+ message( FATAL_ERROR
+ "\"${component}\" is not a valid HDF5 component." )
else()
- list(APPEND HDF5_LANGUAGE_BINDINGS ${component})
+ list( APPEND HDF5_LANGUAGE_BINDINGS ${component} )
endif()
endforeach()
endif()
-
+
# seed the initial lists of libraries to find with items we know we need
- set(HDF5_C_LIBRARY_NAMES_INIT hdf5_hl hdf5)
- set(HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT})
-
- foreach(LANGUAGE ${HDF5_LANGUAGE_BINDINGS})
- if(HDF5_${LANGUAGE}_COMPILE_LINE)
- _HDF5_parse_compile_line(HDF5_${LANGUAGE}_COMPILE_LINE
- HDF5_${LANGUAGE}_INCLUDE_FLAGS
- HDF5_${LANGUAGE}_DEFINITIONS
- HDF5_${LANGUAGE}_LIBRARY_DIRS
- HDF5_${LANGUAGE}_LIBRARY_NAMES
+ set( HDF5_C_LIBRARY_NAMES_INIT hdf5_hl hdf5 )
+ set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} )
+
+ foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} )
+ if( HDF5_${LANGUAGE}_COMPILE_LINE )
+ _HDF5_parse_compile_line( HDF5_${LANGUAGE}_COMPILE_LINE
+ HDF5_${LANGUAGE}_INCLUDE_FLAGS
+ HDF5_${LANGUAGE}_DEFINITIONS
+ HDF5_${LANGUAGE}_LIBRARY_DIRS
+ HDF5_${LANGUAGE}_LIBRARY_NAMES
)
+
+ # take a guess that the includes may be in the 'include' sibling directory
+ # of a library directory.
+ foreach( dir ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
+ list( APPEND HDF5_${LANGUAGE}_INCLUDE_FLAGS ${dir}/../include )
+ endforeach()
+ endif()
- # take a guess that the includes may be in the 'include' sibling directory
- # of a library directory.
- foreach(dir ${HDF5_${LANGUAGE}_LIBRARY_DIRS})
- list(APPEND HDF5_${LANGUAGE}_INCLUDE_FLAGS ${dir}/../include)
- endforeach()
- endif()
-
- # set the definitions for the language bindings.
- list(APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS})
-
- # find the HDF5 include directories
- find_path(HDF5_${LANGUAGE}_INCLUDE_DIR hdf5.h
- HINTS
- ${HDF5_${LANGUAGE}_INCLUDE_FLAGS}
- ENV
- HDF5_ROOT
- PATHS
- $ENV{HOME}/.local/include
- PATH_SUFFIXES
- include
- Include
+ # set the definitions for the language bindings.
+ list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} )
+
+ # find the HDF5 include directories
+ find_path( HDF5_${LANGUAGE}_INCLUDE_DIR hdf5.h
+ HINTS
+ "${HDF5_ROOT}"
+ ${HDF5_${LANGUAGE}_INCLUDE_FLAGS}
+ ENV
+ HDF5_ROOT
+ PATHS
+ $ENV{HOME}/.local/include
+ PATH_SUFFIXES
+ include
+ Include
)
- mark_as_advanced(HDF5_${LANGUAGE}_INCLUDE_DIR)
- list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${LANGUAGE}_INCLUDE_DIR})
-
- set(HDF5_${LANGUAGE}_LIBRARY_NAMES
- ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT}
- ${HDF5_${LANGUAGE}_LIBRARY_NAMES})
-
- # find the HDF5 libraries
- foreach(LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES})
- if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
- # According to bug 1643 on the CMake bug tracker, this is the
- # preferred method for searching for a static library.
- # See http://www.cmake.org/Bug/view.php?id=1643. We search
- # first for the full static library name, but fall back to a
- # generic search on the name if the static search fails.
- set(THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a ${LIB}d)
- set(THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB})
- else()
- set(THIS_LIBRARY_SEARCH_DEBUG ${LIB}d)
- set(THIS_LIBRARY_SEARCH_RELEASE ${LIB})
- endif()
- find_library(HDF5_${LIB}_LIBRARY_DEBUG
- NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
- HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
- ENV HDF5_ROOT
- PATH_SUFFIXES lib Lib)
- find_library(HDF5_${LIB}_LIBRARY_RELEASE
- NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
- HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
- ENV HDF5_ROOT
- PATH_SUFFIXES lib Lib)
- select_library_configurations(HDF5_${LIB})
- # even though we adjusted the individual library names in
- # select_library_configurations, we still need to distinguish
- # between debug and release variants because HDF5_LIBRARIES will
- # need to specify different lists for debug and optimized builds.
- # We can't just use the HDF5_${LIB}_LIBRARY variable (which was set
- # up by the selection macro above) because it may specify debug and
- # optimized variants for a particular library, but a list of
- # libraries is allowed to specify debug and optimized only once.
- list(APPEND HDF5_${LANGUAGE}_LIBRARIES_DEBUG
- ${HDF5_${LIB}_LIBRARY_DEBUG})
- list(APPEND HDF5_${LANGUAGE}_LIBRARIES_RELEASE
- ${HDF5_${LIB}_LIBRARY_RELEASE})
+ mark_as_advanced( HDF5_${LANGUAGE}_INCLUDE_DIR )
+ list( APPEND HDF5_INCLUDE_DIRS ${HDF5_${LANGUAGE}_INCLUDE_DIR} )
+
+ set( HDF5_${LANGUAGE}_LIBRARY_NAMES
+ ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT}
+ ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
+
+ # find the HDF5 libraries
+ foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
+ if( UNIX AND HDF5_USE_STATIC_LIBRARIES )
+ # According to bug 1643 on the CMake bug tracker, this is the
+ # preferred method for searching for a static library.
+ # See http://www.cmake.org/Bug/view.php?id=1643. We search
+ # first for the full static library name, but fall back to a
+ # generic search on the name if the static search fails.
+ set( THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a ${LIB}d )
+ set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} )
+ else()
+ set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d )
+ set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} )
+ endif()
+ find_library( HDF5_${LIB}_LIBRARY_DEBUG
+ NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
+ HINTS "${HDF5_ROOT}" ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
+ ENV HDF5_ROOT
+ PATH_SUFFIXES lib Lib )
+ find_library( HDF5_${LIB}_LIBRARY_RELEASE
+ NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
+ HINTS "${HDF5_ROOT}" ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
+ ENV HDF5_ROOT
+ PATH_SUFFIXES lib Lib )
+ select_library_configurations( HDF5_${LIB} )
+ # even though we adjusted the individual library names in
+ # select_library_configurations, we still need to distinguish
+ # between debug and release variants because HDF5_LIBRARIES will
+ # need to specify different lists for debug and optimized builds.
+ # We can't just use the HDF5_${LIB}_LIBRARY variable (which was set
+ # up by the selection macro above) because it may specify debug and
+ # optimized variants for a particular library, but a list of
+ # libraries is allowed to specify debug and optimized only once.
+ list( APPEND HDF5_${LANGUAGE}_LIBRARIES_DEBUG
+ ${HDF5_${LIB}_LIBRARY_DEBUG} )
+ list( APPEND HDF5_${LANGUAGE}_LIBRARIES_RELEASE
+ ${HDF5_${LIB}_LIBRARY_RELEASE} )
+ endforeach()
+ list( APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
+
+ # Append the libraries for this language binding to the list of all
+ # required libraries.
+ list( APPEND HDF5_LIBRARIES_DEBUG
+ ${HDF5_${LANGUAGE}_LIBRARIES_DEBUG} )
+ list( APPEND HDF5_LIBRARIES_RELEASE
+ ${HDF5_${LANGUAGE}_LIBRARIES_RELEASE} )
endforeach()
- list(APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS})
-
- # Append the libraries for this language binding to the list of all
- # required libraries.
- list(APPEND HDF5_LIBRARIES_DEBUG
- ${HDF5_${LANGUAGE}_LIBRARIES_DEBUG})
- list(APPEND HDF5_LIBRARIES_RELEASE
- ${HDF5_${LANGUAGE}_LIBRARIES_RELEASE})
-endforeach()
-# We may have picked up some duplicates in various lists during the above
-# process for the language bindings (both the C and C++ bindings depend on
-# libz for example). Remove the duplicates.
-if(HDF5_INCLUDE_DIRS)
- list(REMOVE_DUPLICATES HDF5_INCLUDE_DIRS)
-endif()
-if(HDF5_LIBRARIES_DEBUG)
- list(REMOVE_DUPLICATES HDF5_LIBRARIES_DEBUG)
-endif()
-if(HDF5_LIBRARIES_RELEASE)
- list(REMOVE_DUPLICATES HDF5_LIBRARIES_RELEASE)
-endif()
-if(HDF5_LIBRARY_DIRS)
- list(REMOVE_DUPLICATES HDF5_LIBRARY_DIRS)
-endif()
+ # We may have picked up some duplicates in various lists during the above
+ # process for the language bindings (both the C and C++ bindings depend on
+ # libz for example). Remove the duplicates.
+ if( HDF5_INCLUDE_DIRS )
+ list( REMOVE_DUPLICATES HDF5_INCLUDE_DIRS )
+ endif()
+ if( HDF5_LIBRARIES_DEBUG )
+ list( REMOVE_DUPLICATES HDF5_LIBRARIES_DEBUG )
+ endif()
+ if( HDF5_LIBRARIES_RELEASE )
+ list( REMOVE_DUPLICATES HDF5_LIBRARIES_RELEASE )
+ endif()
+ if( HDF5_LIBRARY_DIRS )
+ list( REMOVE_DUPLICATES HDF5_LIBRARY_DIRS )
+ endif()
-# Construct the complete list of HDF5 libraries with debug and optimized
-# variants when the generator supports them.
-if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- set(HDF5_LIBRARIES
- debug ${HDF5_LIBRARIES_DEBUG}
- optimized ${HDF5_LIBRARIES_RELEASE})
-else()
- set(HDF5_LIBRARIES ${HDF5_LIBRARIES_RELEASE})
-endif()
+ # Construct the complete list of HDF5 libraries with debug and optimized
+ # variants when the generator supports them.
+ if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ set( HDF5_LIBRARIES
+ debug ${HDF5_LIBRARIES_DEBUG}
+ optimized ${HDF5_LIBRARIES_RELEASE} )
+ else()
+ set( HDF5_LIBRARIES ${HDF5_LIBRARIES_RELEASE} )
+ endif()
-# If the HDF5 include directory was found, open H5pubconf.h to determine if
-# HDF5 was compiled with parallel IO support
-set(HDF5_IS_PARALLEL FALSE)
-foreach(_dir HDF5_INCLUDE_DIRS)
- if(EXISTS "${_dir}/H5pubconf.h")
- file(STRINGS "${_dir}/H5pubconf.h"
- HDF5_HAVE_PARALLEL_DEFINE
- REGEX "HAVE_PARALLEL 1")
- if(HDF5_HAVE_PARALLEL_DEFINE)
- set(HDF5_IS_PARALLEL TRUE)
+ # If the HDF5 include directory was found, open H5pubconf.h to determine if
+ # HDF5 was compiled with parallel IO support
+ set( HDF5_IS_PARALLEL FALSE )
+ foreach( _dir HDF5_INCLUDE_DIRS )
+ if( EXISTS "${_dir}/H5pubconf.h" )
+ file( STRINGS "${_dir}/H5pubconf.h"
+ HDF5_HAVE_PARALLEL_DEFINE
+ REGEX "HAVE_PARALLEL 1" )
+ if( HDF5_HAVE_PARALLEL_DEFINE )
+ set( HDF5_IS_PARALLEL TRUE )
+ endif()
endif()
- endif()
-endforeach()
-set(HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
- "HDF5 library compiled with parallel IO support")
-mark_as_advanced(HDF5_IS_PARALLEL)
+ endforeach()
+ set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
+ "HDF5 library compiled with parallel IO support" )
+ mark_as_advanced( HDF5_IS_PARALLEL )
endif()
-find_package_handle_standard_args(HDF5 DEFAULT_MSG
- HDF5_LIBRARIES
+find_package_handle_standard_args( HDF5 DEFAULT_MSG
+ HDF5_LIBRARIES
HDF5_INCLUDE_DIRS
- )
+)
-mark_as_advanced(
- HDF5_INCLUDE_DIRS
- HDF5_LIBRARIES
+mark_as_advanced(
+ HDF5_INCLUDE_DIRS
+ HDF5_LIBRARIES
HDF5_DEFINTIONS
HDF5_LIBRARY_DIRS
HDF5_C_COMPILER_EXECUTABLE
- HDF5_CXX_COMPILER_EXECUTABLE)
+ HDF5_CXX_COMPILER_EXECUTABLE )
# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
# HDF5_INCLUDE_DIRS
-set(HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}")
+set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
+
+
diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh
new file mode 100644
index 0000000000..86da896a41
--- /dev/null
+++ b/conda-recipe/build.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+mkdir build
+cd build
+export LD_LIBRARY_PATH=$PREFIX/lib/
+export CMAKE_LIBRARY_PATH=$PREFIX/lib/
+export PATH=$PREFIX/bin:$PATH
+export MACOSX_DEPLOYMENT_TARGET=
+
+$PREFIX/bin/cyclus --version
+
+if [[ `uname` == 'Linux' ]]; then
+ cmake .. \
+ -DCMAKE_INSTALL_PREFIX=$PREFIX \
+ -DCYCLUS_ROOT_DIR=$PREFIX \
+ -DHDF5_ROOT=$PREFIX \
+ -DBOOST_ROOT=$PREFIX \
+ -DBOOST_LIBRARYDIR=$PREFIX/lib \
+ -DBoost_NO_SYSTEM_PATHS=ON \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLAPACK_LIBRARIES=$PREFIX/lib/liblapack.so \
+ -DBLAS_LIBRARIES=$PREFIX/lib/libblas.so
+else
+ export DYLD_FALLBACK_LIBRARY_PATH=$PREFIX/lib/cyclus:$PREFIX/lib
+ cmake .. \
+ -DCMAKE_INSTALL_PREFIX=$PREFIX \
+ -DCYCLUS_ROOT_DIR=$PREFIX \
+ -DHDF5_ROOT=$PREFIX \
+ -DCOIN_ROOT_DIR=$PREFIX \
+ -DBOOST_ROOT=$PREFIX \
+ -DLAPACK_LIBRARIES=$PREFIX/lib/liblapack.dylib \
+ -DBLAS_LIBRARIES=$PREFIX/lib/libblas.dylib
+fi
+
+make
+make install
+
+echo DONE
diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml
new file mode 100644
index 0000000000..95f525c964
--- /dev/null
+++ b/conda-recipe/meta.yaml
@@ -0,0 +1,29 @@
+package:
+ name: cycamore
+ version: 0.0
+
+# Only use fn and url for polyphemus compatability
+source:
+ fn: cycamore-src.tar.gz # ["TRAVIS" not in environ]
+ url: https://github.com/cyclus/cycamore/archive/develop.tar.gz # ["TRAVIS" not in environ]
+ path: .. # ["TRAVIS" in environ]
+
+requirements:
+ build:
+ - cyclus
+ - cmake
+ - python
+ run:
+ - cyclus
+
+test:
+ requires:
+ - nose
+ - pytables
+
+build:
+ string: nightly
+
+about:
+ home: Cyclus
+ license: BSD 3 Clause
diff --git a/conda-recipe/post-link.sh b/conda-recipe/post-link.sh
new file mode 100644
index 0000000000..ed30d81a2b
--- /dev/null
+++ b/conda-recipe/post-link.sh
@@ -0,0 +1,17 @@
+
+echo "post-link.sh, PREFIX: $PREFIX"
+
+mv $PREFIX/bin/cycamore_unit_tests $PREFIX/bin/cycamore_unit_tests_base
+echo "
+#!/bin/bash
+export LD_LIBRARY_PATH=$PREFIX/lib:$PREFIX/lib/cyclus
+export DYLD_FALLBACK_LIBRARY_PATH=$PREFIX/lib/cyclus
+export CYCLUS_NUC_DATA=$PREFIX/share/cyclus/cyclus_nuc_data.h5
+export CYCLUS_PATH=$PREFIX/lib/cyclus
+export CYCLUS_RNG_SCHEMA=$PREFIX/share/cyclus/cyclus.rng.in
+export DYLD_LIBRARY_PATH=
+$PREFIX/bin/cycamore_unit_tests_base \$*
+
+" > $PREFIX/bin/cycamore_unit_tests
+chmod 755 $PREFIX/bin/cycamore_unit_tests
+
diff --git a/conda-recipe/pre-link.sh b/conda-recipe/pre-link.sh
new file mode 100644
index 0000000000..9a188008e3
--- /dev/null
+++ b/conda-recipe/pre-link.sh
@@ -0,0 +1,6 @@
+
+echo "pre-link.sh, PREFIX: $PREFIX"
+
+export LD_LIBRARY_PATH=$PREFIX/lib/:$LD_LIBRARY_PATH
+export CMAKE_LIBRARY_PATH=$PREFIX/lib/:$CMAKE_LIBRARY_PATH
+
diff --git a/input/batch_reactor/batch_rxtr_2_cycles.xml b/input/batch_reactor/batch_rxtr_2_cycles.xml
deleted file mode 100644
index 5dacac3fe4..0000000000
--- a/input/batch_reactor/batch_rxtr_2_cycles.xml
+++ /dev/null
@@ -1,199 +0,0 @@
-
-
-
-
- 27
- 1
- 2000
-
-
-
-
- cycamore
- Source
-
-
- cycamore
- BatchReactor
-
-
- cycamore
- Sink
-
-
- agents
- NullRegion
-
-
- agents
- NullInst
-
-
-
-
- Source
-
-
-
-
-
-
- LWR_Reactor
- 26
-
-
-
- enriched_u
- lwr_fuel_recipe
- waste
- lwr_used_fuel_recipe
-
- 10
- 2
- 4
- 7.8707064e4
-
- lwr_power
- 1000
- 1000
-
-
-
-
-
-
- Sink
-
-
-
- waste
-
- 1.0e10
-
-
-
-
-
- SingleRegion
-
-
- SingleInstitution
-
-
- Source
- 1
-
-
- LWR_Reactor
- 1
-
-
- Sink
- 1
-
-
-
-
-
-
-
- natl_u
- mass
-
- 922350000
- 0.711
-
-
- 922380000
- 99.289
-
-
-
-
- lwr_fuel_recipe
- mass
-
- 922350000
- 4.0
-
-
- 922380000
- 96.0
-
-
-
-
- lwr_used_fuel_recipe
- mass
-
- 922350000
- 156.729
-
-
- 922360000
- 102.103
-
-
- 922380000
- 18280.324
-
-
- 932370000
- 13.656
-
-
- 942380000
- 5.043
-
-
- 942390000
- 106.343
-
-
- 942400000
- 41.357
-
-
- 942410000
- 36.477
-
-
- 942420000
- 15.387
-
-
- 952410000
- 1.234
-
-
-
-
-
-
- 952430000
- 3.607
-
-
- 962440000
- 0.431
-
-
- 962450000
- 1.263
-
-
-
-
diff --git a/input/batch_reactor/batch_rxtr_lifetime.xml b/input/batch_reactor/batch_rxtr_lifetime.xml
deleted file mode 100644
index 3fce5536bb..0000000000
--- a/input/batch_reactor/batch_rxtr_lifetime.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-
-
-
-
- 482
- 1
- 2000
-
-
-
-
- cycamore
- Source
-
-
- cycamore
- BatchReactor
-
-
- agents
- NullRegion
-
-
- agents
- NullInst
-
-
- cycamore
- Sink
-
-
-
-
- Source
-
-
-
-
-
-
- LWR_Reactor
- 480
-
-
-
- enriched_u
- lwr_fuel_recipe
- waste
- lwr_used_fuel_recipe
-
- 10
- 2
- 4
- 19676.766
-
- lwr_power
- 1000
- 1000
-
-
-
-
-
-
- Sink
-
-
-
- waste
-
- 1.0e10
-
-
-
-
-
- SingleRegion
-
-
- SingleInstitution
-
-
- Source
- 1
-
-
- LWR_Reactor
- 1
-
-
- Sink
- 1
-
-
-
-
-
-
-
- natl_u
- mass
-
- 922350000
- 0.711
-
-
- 922380000
- 99.289
-
-
-
-
- lwr_fuel_recipe
- mass
-
- 922350000
- 4.0
-
-
- 922380000
- 96.0
-
-
-
-
- lwr_used_fuel_recipe
- mass
-
- 922350000
- 156.729
-
-
- 922360000
- 102.103
-
-
- 922380000
- 18280.324
-
-
- 932370000
- 13.656
-
-
- 942380000
- 5.043
-
-
- 942390000
- 106.343
-
-
- 942400000
- 41.357
-
-
- 942410000
- 36.477
-
-
- 942420000
- 15.387
-
-
- 952410000
- 1.234
-
-
-
-
-
-
- 952430000
- 3.607
-
-
- 962440000
- 0.431
-
-
- 962450000
- 1.263
-
-
-
-
diff --git a/input/batch_reactor/hwr.xml b/input/batch_reactor/hwr.xml
deleted file mode 100644
index 5438f256d4..0000000000
--- a/input/batch_reactor/hwr.xml
+++ /dev/null
@@ -1,249 +0,0 @@
-
-
-
-
- 482
- 11
- 2007
-
-
-
-
- cycamore
- Source
-
-
- cycamore
- BatchReactor
-
-
- cycamore
- Sink
-
-
- agents
- NullRegion
-
-
- agents
- NullInst
-
-
-
-
- Source
-
-
-
-
-
-
- HW_Reactor
- 480
-
-
-
- enriched_u
- natl_u
- waste
- hwr_used_fuel_recipe
-
- 10
- 2
- 1
- 1.39142873e5
-
- hwr_power
- 600
- 600
-
-
-
-
-
-
- Sink
-
-
-
- waste
-
-
-
-
-
-
- SingleRegion
-
-
- SingleInstitution
-
-
- Source
- 1
-
-
- HW_Reactor
- 1
-
-
- Sink
- 1
-
-
-
-
-
-
-
- natl_u
- mass
-
- 922350000
- 0.711
-
-
- 922380000
- 99.289
-
-
-
-
- lwr_fuel_recipe
- mass
-
- 922350000
- 4.0
-
-
- 922380000
- 96.0
-
-
-
-
- lwr_used_fuel_recipe
- mass
-
- 922350000
- 156.729
-
-
- 922360000
- 102.103
-
-
- 922380000
- 18280.324
-
-
- 932370000
- 13.656
-
-
- 942380000
- 5.043
-
-
- 942390000
- 106.343
-
-
- 942400000
- 41.357
-
-
- 942410000
- 36.477
-
-
- 942420000
- 15.387
-
-
- 952410000
- 1.234
-
-
-
-
-
-
- 952430000
- 3.607
-
-
- 962440000
- 0.431
-
-
- 962450000
- 1.263
-
-
-
-
- hwr_used_fuel_recipe
- mass
-
- 922350000
- 330.478
-
-
- 922360000
- 98.944
-
-
- 922380000
- 137171.079
-
-
- 932370000
- 3.604
-
-
- 942380000
- 0.459
-
-
- 942390000
- 369.87
-
-
- 942400000
- 133.16
-
-
- 942410000
- 25.227
-
-
- 942420000
- 5.468
-
-
- 952410000
- 0.195
-
-
-
-
-
-
- 952430000
- 0.167
-
-
- 962440000
- 0.07
-
-
- 962450000
- 0.014
-
-
-
-
diff --git a/input/batch_reactor/lwr.xml b/input/batch_reactor/lwr.xml
deleted file mode 100644
index 0936bd8fa2..0000000000
--- a/input/batch_reactor/lwr.xml
+++ /dev/null
@@ -1,249 +0,0 @@
-
-
-
-
- 482
- 11
- 2007
-
-
-
-
- cycamore
- Source
-
-
- cycamore
- BatchReactor
-
-
- cycamore
- Sink
-
-
- agents
- NullRegion
-
-
- agents
- NullInst
-
-
-
-
- Source
-
-
-
-
-
-
- LW_Reactor
- 480
-
-
-
- enriched_u
- lwr_fuel_recipe
- waste
- hwr_used_fuel_recipe
-
- 10
- 2
- 4
- 7.8707064e4
-
- lwr_power
- 1000
- 1000
-
-
-
-
-
-
- Sink
-
-
-
- waste
-
-
-
-
-
-
- SingleRegion
-
-
- SingleInstitution
-
-
- Source
- 1
-
-
- LW_Reactor
- 1
-
-
- Sink
- 1
-
-
-
-
-
-
-
- natl_u
- mass
-
- 922350000
- 0.711
-
-
- 922380000
- 99.289
-
-
-
-
- lwr_fuel_recipe
- mass
-
- 922350000
- 4.0
-
-
- 922380000
- 96.0
-
-
-
-
- lwr_used_fuel_recipe
- mass
-
- 922350000
- 156.729
-
-
- 922360000
- 102.103
-
-
- 922380000
- 18280.324
-
-
- 932370000
- 13.656
-
-
- 942380000
- 5.043
-
-
- 942390000
- 106.343
-
-
- 942400000
- 41.357
-
-
- 942410000
- 36.477
-
-
- 942420000
- 15.387
-
-
- 952410000
- 1.234
-
-
-
-
-
-
- 952430000
- 3.607
-
-
- 962440000
- 0.431
-
-
- 962450000
- 1.263
-
-
-
-
- hwr_used_fuel_recipe
- mass
-
- 922350000
- 330.478
-
-
- 922360000
- 98.944
-
-
- 922380000
- 137171.079
-
-
- 932370000
- 3.604
-
-
- 942380000
- 0.459
-
-
- 942390000
- 369.87
-
-
- 942400000
- 133.16
-
-
- 942410000
- 25.227
-
-
- 942420000
- 5.468
-
-
- 952410000
- 0.195
-
-
-
-
-
-
- 952430000
- 0.167
-
-
- 962440000
- 0.07
-
-
- 962450000
- 0.014
-
-
-
-
diff --git a/input/batch_reactor/preferences.xml b/input/batch_reactor/preferences.xml
deleted file mode 100644
index ec27566b45..0000000000
--- a/input/batch_reactor/preferences.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-
-
- 10
- 1
- 2000
-
-
-
-
- cycamore
- Source
-
-
- cycamore
- BatchReactor
-
-
- cycamore
- Sink
-
-
- agents
- NullRegion
-
-
- agents
- NullInst
-
-
-
-
- Source
-
-
-
-
-
-
- Reactor
-
-
-
- used_commodity
- commod_recipe
- processed_commodity
- commod_recipe
-
- 1
- 1
- 1
-
- power
- 10
- 10
-
-
- used_commodity
- 1.0
-
-
-
-
-
-
- Sink
-
-
-
- used_commodity
- processed_commodity
-
- 2
-
-
-
-
-
- SingleRegion
-
-
- SingleInstitution
-
-
- Source
- 1
-
-
- Reactor
- 1
-
-
- Sink
- 1
-
-
-
-
-
-
-
- commod_recipe
- mass
-
- 010010000
- 1
-
-
-
-
diff --git a/input/enrichment/1_src_enr_rxtr_sink.xml b/input/enrichment/1_src_enr_rxtr_sink.xml
index 7a7cc42008..ea8b519a41 100644
--- a/input/enrichment/1_src_enr_rxtr_sink.xml
+++ b/input/enrichment/1_src_enr_rxtr_sink.xml
@@ -10,8 +10,8 @@
cycamoreSink
cycamoreSource
- cycamoreEnrichmentFacility
- cycamoreBatchReactor
+ cycamoreReactor
+ cycamoreEnrichment
agentsNullRegion
agentsNullInst
@@ -20,9 +20,9 @@
Source
@@ -30,35 +30,32 @@
Enrichment
-
- natl_u
- enriched_u
- natl_u
+
+ natl_u
+ enriched_u
+ ef_tails
+ natl_u
0.003
- 500
-
+ 500
+
Reactor
-
-
- enriched_u
- fuel_recipe
- waste
- used_fuel_recipe
-
- 1
- 1
- 2
-
- power
- 10
- 10
-
-
+
+ fuel_recipe
+ used_fuel_recipe
+ enriched_u
+ waste
+
+ 1
+ 0
+ 2
+ 1
+ 1
+
diff --git a/input/enrichment/linear_src_enr_rxtr_sink.xml b/input/enrichment/linear_src_enr_rxtr_sink.xml
index bd09a23eab..1b9a720ce4 100644
--- a/input/enrichment/linear_src_enr_rxtr_sink.xml
+++ b/input/enrichment/linear_src_enr_rxtr_sink.xml
@@ -10,8 +10,8 @@
cycamoreSink
cycamoreSource
- cycamoreEnrichmentFacility
- cycamoreBatchReactor
+ cycamoreReactor
+ cycamoreEnrichment
cycamoreGrowthRegion
cycamoreManagerInst
@@ -20,9 +20,9 @@
Source
@@ -30,35 +30,35 @@
Enrichment
-
- natl_u
- natl_u
- 1000
- enriched_u
- 0.003
-
+
+ natl_u
+ natl_u
+ 1000
+ enriched_u
+ ef_tails
+ 0.003
+
Reactor
-
-
- enriched_u
- fuel_recipe
- waste
- used_fuel_recipe
-
- 1
- 1
- 2
-
- power
- 10
- 10
-
-
+
+ fuel_recipe
+ used_fuel_recipe
+ enriched_u
+ waste
+
+ 1
+ 0
+ 2
+ 1
+ 1
+
+ power
+ 10
+
@@ -78,16 +78,20 @@
SingleRegion
- power
-
- linear
-
-
- 10 0
-
-
- 1
-
+
+ -
+ power
+
+
+ 1
+
+ linear
+ 10 0
+
+
+
+
+
@@ -111,6 +115,7 @@
Source
Enrichment
+ Reactor
Sink
diff --git a/input/enrichment/natu_capacitated.xml b/input/enrichment/natu_capacitated.xml
index e363e5c392..3d94d88b20 100644
--- a/input/enrichment/natu_capacitated.xml
+++ b/input/enrichment/natu_capacitated.xml
@@ -10,8 +10,8 @@
cycamoreSink
cycamoreSource
- cycamoreEnrichmentFacility
- cycamoreBatchReactor
+ cycamoreReactor
+ cycamoreEnrichment
cycamoreGrowthRegion
cycamoreManagerInst
@@ -20,9 +20,9 @@
Source
@@ -30,35 +30,35 @@
Enrichment
-
- natl_u
- natl_u
- 100
- enriched_u
+
+ natl_u
+ natl_u
+ 100
+ enriched_u
+ ef_tails
0.003
-
+
Reactor
-
-
- enriched_u
- fuel_recipe
- waste
- used_fuel_recipe
-
- 1
- 1
- 2
-
- power
- 10
- 10
-
-
+
+ fuel_recipe
+ used_fuel_recipe
+ enriched_u
+ waste
+
+ 1
+ 0
+ 2
+ 1
+ 1
+
+ power
+ 10
+
@@ -78,16 +78,20 @@
SingleRegion
- power
-
- linear
-
-
- 10 0
-
-
- 1
-
+
+ -
+ power
+
+
+ 1
+
+ linear
+ 10 0
+
+
+
+
+
@@ -111,6 +115,7 @@
Source
Enrichment
+ Reactor
Sink
diff --git a/input/enrichment/swu_capacitated.xml b/input/enrichment/swu_capacitated.xml
index 35215a1d9f..06d961d877 100644
--- a/input/enrichment/swu_capacitated.xml
+++ b/input/enrichment/swu_capacitated.xml
@@ -10,8 +10,8 @@
cycamoreSink
cycamoreSource
- cycamoreEnrichmentFacility
- cycamoreBatchReactor
+ cycamoreReactor
+ cycamoreEnrichment
cycamoreGrowthRegion
cycamoreManagerInst
@@ -20,9 +20,9 @@
Source
@@ -30,36 +30,36 @@
Enrichment
-
- natl_u
- natl_u
- 100
- enriched_u
+
+ natl_u
+ natl_u
+ 100
+ enriched_u
+ ef_tails
0.003
30.0
-
+
Reactor
-
-
- enriched_u
- fuel_recipe
- waste
- used_fuel_recipe
-
- 1
- 1
- 2
-
- power
- 10
- 10
-
-
+
+ fuel_recipe
+ used_fuel_recipe
+ enriched_u
+ waste
+
+ 1
+ 0
+ 2
+ 1
+ 1
+
+ power
+ 10
+
@@ -79,16 +79,20 @@
SingleRegion
- power
-
- linear
-
-
- 10 0
-
-
- 1
-
+
+ -
+ power
+
+
+ 1
+
+ linear
+ 10 0
+
+
+
+
+
@@ -112,6 +116,7 @@
Source
Enrichment
+ Reactor
Sink
diff --git a/input/growth/source_sink_linear.xml b/input/growth/source_sink_linear.xml
index b9708be956..79752cc09f 100644
--- a/input/growth/source_sink_linear.xml
+++ b/input/growth/source_sink_linear.xml
@@ -18,9 +18,9 @@
Source1
@@ -29,9 +29,9 @@
Source2
@@ -51,16 +51,20 @@
SingleRegion
- commodity
-
- linear
-
-
- 1 2
-
-
- 0
-
+
+ -
+ commodity1
+
+
+ 0
+
+ linear
+ 1 2
+
+
+
+
+
diff --git a/input/minimal-input/source_1_lifetime_sink_1.xml b/input/minimal-input/source_1_lifetime_sink_1.xml
index 0cbc316658..59b59ded62 100644
--- a/input/minimal-input/source_1_lifetime_sink_1.xml
+++ b/input/minimal-input/source_1_lifetime_sink_1.xml
@@ -31,9 +31,9 @@
5
diff --git a/input/minimal-input/source_1_sink_1.xml b/input/minimal-input/source_1_sink_1.xml
index 8b96e8d193..c21acbf9b4 100644
--- a/input/minimal-input/source_1_sink_1.xml
+++ b/input/minimal-input/source_1_sink_1.xml
@@ -30,9 +30,9 @@
SomeSource
diff --git a/input/minimal-input/source_3_lifetime_sink_1.xml b/input/minimal-input/source_3_lifetime_sink_1.xml
index 07a897342e..4f7197ad74 100644
--- a/input/minimal-input/source_3_lifetime_sink_1.xml
+++ b/input/minimal-input/source_3_lifetime_sink_1.xml
@@ -19,9 +19,9 @@
5
diff --git a/input/minimal-input/source_3_sink_1.xml b/input/minimal-input/source_3_sink_1.xml
index 78621f4a24..7efc34a570 100644
--- a/input/minimal-input/source_3_sink_1.xml
+++ b/input/minimal-input/source_3_sink_1.xml
@@ -18,9 +18,9 @@
Source
diff --git a/input/physor/1_Enrichment_2_Reactor.xml b/input/physor/1_Enrichment_2_Reactor.xml
index 1a41469cbf..ddb27a2b8e 100755
--- a/input/physor/1_Enrichment_2_Reactor.xml
+++ b/input/physor/1_Enrichment_2_Reactor.xml
@@ -8,113 +8,67 @@
-
- cycamore
- EnrichmentFacility
-
-
- cycamore
- BatchReactor
-
-
- agents
- NullRegion
-
-
- agents
- NullInst
-
+ cycamore Enrichment
+ cycamore Reactor
+ agents NullRegion
+ agents NullInst
Enrichment
-
- natl_u
- natl_u
- enriched_u
+
+ natl_u
+ natl_u
+ enriched_u
+ ef_tails
0.003
- 10
- 1e5
-
+ 10.01
+ 1e5
+
Reactor1
-
-
- enriched_u
- lwr_fuel_recipe
- waste
- lwr_used_fuel_recipe
-
- 1
- 1
- 1
- 0
-
-
- 1
- enriched_u
- lwr_fuel_recipe
-
-
-
- enriched_u
- lwr_fuel_recipe2
-
-
-
- enriched_u
- lwr_fuel_recipe
-
-
-
- lwr_power
- .928
- 64
-
-
- enriched_u
- 1.0
-
-
+
+ lwr_fuel_recipe
+ lwr_used_fuel_recipe
+ enriched_u
+ waste
+ 1.0
+
+ 1
+ 0
+ 0.1
+ 10
+ 10
+
+ 1 2
+ enriched_u enriched_u
+ lwr_fuel_recipe2 lwr_fuel_recipe
+ lwr_used_fuel_recipe lwr_used_fuel_recipe
+
Reactor2
-
-
- enriched_u
- lwr_fuel_recipe
- waste
- lwr_used_fuel_recipe
-
- 1
- 1
- 1
- 0
-
-
- 1
- enriched_u
- lwr_fuel_recipe
-
-
-
- lwr_power
- .928
- 64
-
-
- enriched_u
- 0.5
-
-
+
+ lwr_fuel_recipe
+ lwr_used_fuel_recipe
+ enriched_u
+ waste
+ 0.5
+
+ 1
+ 0
+ 0.1
+ 10
+ 10
+
diff --git a/input/physor/2_Sources_3_Reactors.xml b/input/physor/2_Sources_3_Reactors.xml
index d9ee17ff8b..b7eb93131d 100755
--- a/input/physor/2_Sources_3_Reactors.xml
+++ b/input/physor/2_Sources_3_Reactors.xml
@@ -8,31 +8,19 @@
-
- cycamore
- Source
-
-
- cycamore
- BatchReactor
-
-
- agents
- NullRegion
-
-
- cycamore
- DeployInst
-
+ cycamore Source
+ cycamore Reactor
+ agents NullRegion
+ cycamore DeployInst
UOX_Source
@@ -41,9 +29,9 @@
MOX_Source
@@ -51,125 +39,63 @@
Reactor1
-
-
- uox
- uox_fuel_recipe
- waste
- uox_used_fuel_recipe
-
-
- mox
- mox_fuel_recipe
- waste
- mox_used_fuel_recipe
-
- 1
- 1
- 1
- 0
-
-
- 1
- mox
- mox_fuel_recipe
-
-
-
- lwr_power
- .928
- 64
-
-
- mox
- 1.0
-
-
- uox
- 2.0
-
-
-
+
+
+ uox_fuel_recipe mox_fuel_recipe
+ uox_used_fuel_recipe mox_used_fuel_recipe
+ uox mox
+ waste waste
+ 0.0 1.0
+
+ 1
+ 0
+ 0.1
+ 10
+ 10
+
+ 4
+ uox
+ 2.0
+
+
Reactor2
-
-
- uox
- uox_fuel_recipe
- waste
- uox_used_fuel_recipe
-
-
- mox
- mox_fuel_recipe
- waste
- mox_used_fuel_recipe
-
- 1
- 1
- 1
- 0
-
-
- 1
- mox
- mox_fuel_recipe
-
-
-
- lwr_power
- .928
- 64
-
-
- mox
- 1.0
-
-
+
+ uox_fuel_recipe mox_fuel_recipe
+ uox_used_fuel_recipe mox_used_fuel_recipe
+ uox mox
+ waste waste
+ 0.0 1.0
+
+ 1
+ 0
+ 0.1
+ 10
+ 10
+
Reactor3
-
-
- uox
- uox_fuel_recipe
- waste
- uox_used_fuel_recipe
-
-
- mox
- mox_fuel_recipe
- waste
- mox_used_fuel_recipe
-
- 1
- 1
- 1
- 0
-
-
- 1
- mox
- mox_fuel_recipe
-
-
-
- lwr_power
- .928
- 64
-
-
- mox
- 0.5
-
-
+
+ uox_fuel_recipe mox_fuel_recipe
+ uox_used_fuel_recipe mox_used_fuel_recipe
+ uox mox
+ waste waste
+ 0.0 0.5
+
+ 1
+ 0
+ 0.1
+ 10
+ 10
+
@@ -182,31 +108,29 @@
SingleInstitution
-
- UOX_Source
- 1
- 1
-
-
- MOX_Source
- 1
- 1
-
-
- Reactor1
- 1
- 1
-
-
- Reactor2
- 1
- 2
-
-
- Reactor3
- 1
- 3
-
+
+ UOX_Source
+ MOX_Source
+ Reactor1
+ Reactor2
+ Reactor3
+
+
+
+ 1
+ 1
+ 1
+ 2
+ 3
+
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+
diff --git a/input/recycle.xml b/input/recycle.xml
new file mode 100644
index 0000000000..5917ef6d31
--- /dev/null
+++ b/input/recycle.xml
@@ -0,0 +1,214 @@
+
+
+ 600
+ 1
+ 2000
+
+
+
+ agents NullInst
+ agents NullRegion
+ cycamore Source
+ cycamore Sink
+ cycamore Enrichment
+ cycamore Reactor
+ cycamore FuelFab
+ cycamore Separations
+
+
+
+ enrichment
+
+
+ natl_u
+ natl_u
+ uox
+ 0.003
+ waste
+ 1e100
+ 1e100
+
+
+
+
+
+ separations
+
+
+
+ -
+ sep_stream
+
+ 1e100
+
+
- Pu .99
+
+
+
+
+
+ waste
+ 30001
+ 30001
+ spent_uox
+ 2.0
+
+
+
+
+
+ fuelfab
+
+
+ depleted_u
+ depleted_u
+ 30001
+
+ sep_stream
+ 15000
+
+ thermal
+ mox
+ 30001
+
+
+
+
+
+ reactor
+
+
+ fresh_uox fresh_mox
+ spent_uox spent_mox
+ uox mox
+ spent_uox waste
+ 1.0 2.0
+
+ 17
+ 2
+ 30000
+ 3
+ 1
+
+
+
+
+
+ repo
+
+
+ waste
+ 1e100
+
+
+
+
+
+ depleted_src
+
+
+
+
+
+
+ SingleRegion
+
+
+ SingleInstitution
+
+
+ repo
+ 1
+
+
+ reactor
+ 1
+
+
+ depleted_src
+ 1
+
+
+ fuelfab
+ 1
+
+
+ separations
+ 1
+
+
+ enrichment
+ 1
+
+
+
+
+
+
+
+ natl_u
+ mass
+ U235 0.711
+ U238 99.289
+
+
+
+ fresh_uox
+ mass
+ U2350.04
+ U2380.96
+
+
+
+ depleted_u
+ mass
+ U2350.003
+ U2380.997
+
+
+
+ fresh_mox
+ mass
+ U235 0.0027381
+ U238 0.9099619
+ Pu238 0.001746
+ Pu239 0.045396
+ Pu240 0.020952
+ Pu241 0.013095
+ Pu242 0.005238
+
+
+
+ spent_mox
+ mass
+ U235 0.0017381
+ U238 0.90
+ Pu238 0.001746
+ Pu239 0.0134
+ Pu240 0.020952
+ Pu241 0.013095
+ Pu242 0.005238
+
+
+
+ spent_uox
+ mass
+ U235 156.729
+ U236 102.103
+ U238 18280.324
+ Np237 13.656
+ Pu238 5.043
+ Pu239 106.343
+ Pu240 41.357
+ Pu241 36.477
+ Pu242 15.387
+ Am241 1.234
+ Am243 3.607
+ Cm244 0.431
+ Cm245 1.263
+
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c7ab466fb9..37dea6319c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,10 +1,12 @@
# ------------------- Add all Concrete Agents ----------------------------
-USE_CYCLUS("cycamore" "batch_reactor")
+USE_CYCLUS("cycamore" "reactor")
-USE_CYCLUS("cycamore" "enrichment_facility")
+USE_CYCLUS("cycamore" "fuel_fab")
-#USE_CYCLUS("cycamore" "inpro_reactor")
+USE_CYCLUS("cycamore" "enrichment")
+
+USE_CYCLUS("cycamore" "separations")
USE_CYCLUS("cycamore" "sink")
diff --git a/src/batch_reactor.cc b/src/batch_reactor.cc
deleted file mode 100644
index ebde933459..0000000000
--- a/src/batch_reactor.cc
+++ /dev/null
@@ -1,1049 +0,0 @@
-// Implements the BatchReactor class
-#include "batch_reactor.h"
-
-#include
-#include
-
-namespace cycamore {
-
-// static members
-std::map BatchReactor::phase_names_ =
- std::map();
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-BatchReactor::BatchReactor(cyclus::Context* ctx)
- : cyclus::Facility(ctx),
- process_time_(1),
- preorder_time_(0),
- refuel_time_(0),
- start_time_(-1),
- to_begin_time_(std::numeric_limits::max()),
- n_batches_(1),
- n_load_(1),
- n_reserves_(0),
- batch_size_(1),
- phase_(INITIAL) {
- cyclus::Warn("the BatchReactor agent "
- "is considered experimental.");
- if (phase_names_.empty()) {
- SetUpPhaseNames_();
- }
- spillover_ = cyclus::NewBlankMaterial(0);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-BatchReactor::~BatchReactor() {}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-std::string BatchReactor::schema() {
- return
- " \n"
- + crctx_.schema() +
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n";
-}
-
-void BatchReactor::InitFrom(cyclus::QueryableBackend* b) {
- cyclus::Facility::InitFrom(b);
-
- crctx_.InitFrom(b);
-
- // facility info
- cyclus::QueryResult qr = b->Query("Info", NULL);
- process_time_ = qr.GetVal("processtime");
- preorder_time_ = qr.GetVal("preorder_t");
- refuel_time_ = qr.GetVal("refueltime");
- start_time_ = qr.GetVal("starttime");
- to_begin_time_ = qr.GetVal("tobegintime");
- n_batches_ = qr.GetVal("nbatches");
- n_load_ = qr.GetVal("nreload");
- n_reserves_ = qr.GetVal("norder");
- batch_size_ = qr.GetVal("batchsize");
- phase_ = static_cast(qr.GetVal("phase"));
-
- std::string out_commod = qr.GetVal("out_commod");
- cyclus::toolkit::CommodityProducer::Add(out_commod);
- cyclus::toolkit::CommodityProducer::
- SetCapacity(out_commod, qr.GetVal("out_commod_cap"));
- cyclus::toolkit::CommodityProducer::
- SetCost(out_commod, qr.GetVal("out_commod_cap"));
-
- // initial condition inventories
- std::vector conds;
- conds.push_back(cyclus::Cond("inventory", "==", std::string("reserves")));
- qr = b->Query("InitialInv", &conds);
- ics_.AddReserves(
- qr.GetVal("nbatches"),
- qr.GetVal("recipe"),
- qr.GetVal("commod")
- );
- conds[0] = cyclus::Cond("inventory", "==", std::string("core"));
- qr = b->Query("InitialInv", &conds);
- ics_.AddCore(
- qr.GetVal("nbatches"),
- qr.GetVal("recipe"),
- qr.GetVal("commod")
- );
- conds[0] = cyclus::Cond("inventory", "==", std::string("storage"));
- qr = b->Query("InitialInv", &conds);
- ics_.AddStorage(
- qr.GetVal("nbatches"),
- qr.GetVal("recipe"),
- qr.GetVal("commod")
- );
-
- // trade preferences
- try {
- qr.Reset();
- qr = b->Query("CommodPrefs", NULL);
- } catch(std::exception err) {} // table doesn't exist (okay)
- for (int i = 0; i < qr.rows.size(); ++i) {
- std::string c = qr.GetVal("incommodity", i);
- commod_prefs_[c] = qr.GetVal("preference", i);
- }
-
- // pref changes
- try {
- qr.Reset();
- qr = b->Query("PrefChanges", NULL);
- } catch(std::exception err) {} // table doesn't exist (okay)
- for (int i = 0; i < qr.rows.size(); ++i) {
- std::string c = qr.GetVal("incommodity", i);
- int t = qr.GetVal("time", i);
- double new_pref = qr.GetVal("new_pref", i);
- pref_changes_[t].push_back(std::make_pair(c, new_pref));
- }
-
- // pref changes
- try {
- qr.Reset();
- qr = b->Query("RecipeChanges", NULL);
- } catch(std::exception err) {} // table doesn't exist (okay)
- for (int i = 0; i < qr.rows.size(); ++i) {
- std::string c = qr.GetVal("incommodity", i);
- int t = qr.GetVal("time", i);
- std::string new_recipe = qr.GetVal("new_recipe", i);
- recipe_changes_[t].push_back(std::make_pair(c, new_recipe));
- }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::InfileToDb(cyclus::InfileTree* qe, cyclus::DbInit di) {
- cyclus::Facility::InfileToDb(qe, di);
- qe = qe->SubTree("config/*");
-
- using cyclus::toolkit::Commodity;
- using cyclus::toolkit::CommodityProducer;
- using cyclus::OptionalQuery;
- using cyclus::Query;
- using cyclus::InfileTree;
- using std::string;
-
- crctx_.InfileToDb(qe, di);
-
- // facility data
- int processtime = Query(qe, "processtime");
- int nbatches = Query(qe, "nbatches");
- double batchsize = Query(qe, "batchsize");
- int refuel_t = OptionalQuery(qe, "refueltime", refuel_time());
- int preorder_t = OptionalQuery(qe, "orderlookahead", preorder_time());
- int nreload = OptionalQuery(qe, "nreload", n_load());
- int norder = OptionalQuery(qe, "norder", n_reserves());
-
- InfileTree* commodity = qe->SubTree("commodity_production");
- std::string out_commod = commodity->GetString("commodity");
- double commod_cap = Query(commodity, "capacity");
- double commod_cost = Query(commodity, "cost");
-
- di.NewDatum("Info")
- ->AddVal("processtime", processtime)
- ->AddVal("nbatches", nbatches)
- ->AddVal("batchsize", batchsize)
- ->AddVal("refueltime", refuel_t)
- ->AddVal("preorder_t", preorder_t)
- ->AddVal("nreload", nreload)
- ->AddVal("norder", norder)
- ->AddVal("starttime", -1)
- ->AddVal("tobegintime", std::numeric_limits::max())
- ->AddVal("phase", static_cast(INITIAL))
- ->AddVal("out_commod", out_commod)
- ->AddVal("out_commod_cap", commod_cap)
- ->AddVal("out_commod_cost", commod_cost)
- ->Record();
-
- // initial condition inventories
- std::vector inv_names;
- inv_names.push_back("reserves");
- inv_names.push_back("core");
- inv_names.push_back("storage");
- for (int i = 0; i < inv_names.size(); ++i) {
- int n = 0;
- std::string recipe;
- std::string commod;
- if (qe->NMatches("initial_condition") > 0) {
- InfileTree* ic = qe->SubTree("initial_condition");
- if (ic->NMatches(inv_names[i]) > 0) {
- InfileTree* reserves = ic->SubTree(inv_names[i]);
- n = Query(reserves, "nbatches");
- recipe = reserves->GetString("recipe");
- commod = reserves->GetString("commodity");
- }
- }
- di.NewDatum("InitialInv")
- ->AddVal("inventory", inv_names[i])
- ->AddVal("nbatches", n)
- ->AddVal("recipe", recipe)
- ->AddVal("commod", commod)
- ->Record();
- }
-
- // trade preferences
- int nprefs = qe->NMatches("commod_pref");
- std::string c;
- for (int i = 0; i < nprefs; i++) {
- InfileTree* cp = qe->SubTree("commod_pref", i);
- di.NewDatum("CommodPrefs")
- ->AddVal("incommodity", cp->GetString("incommodity"))
- ->AddVal("preference", Query(cp, "preference"))
- ->Record();
- }
-
- // pref changes
- int nchanges = qe->NMatches("pref_change");
- for (int i = 0; i < nchanges; i++) {
- InfileTree* cp = qe->SubTree("pref_change", i);
- di.NewDatum("PrefChanges")
- ->AddVal("incommodity", cp->GetString("incommodity"))
- ->AddVal("new_pref", Query(cp, "new_pref"))
- ->AddVal("time", Query(cp, "time"))
- ->Record();
- }
-
- // recipe changes
- nchanges = qe->NMatches("recipe_change");
- for (int i = 0; i < nchanges; i++) {
- InfileTree* cp = qe->SubTree("recipe_change", i);
- di.NewDatum("RecipeChanges")
- ->AddVal("incommodity", cp->GetString("incommodity"))
- ->AddVal("new_recipe", cp->GetString("new_recipe"))
- ->AddVal("time", Query(cp, "time"))
- ->Record();
- }
-}
-
-void BatchReactor::Snapshot(cyclus::DbInit di) {
- cyclus::Facility::Snapshot(di);
- crctx_.Snapshot(di);
-
- std::set::
- iterator it;
- it = cyclus::toolkit::CommodityProducer::ProducedCommodities().begin();
- std::string out_commod = it->name();
- double cost = cyclus::toolkit::CommodityProducer::Cost(out_commod);
- double cap = cyclus::toolkit::CommodityProducer::Capacity(out_commod);
- di.NewDatum("Info")
- ->AddVal("processtime", process_time_)
- ->AddVal("nbatches", n_batches_)
- ->AddVal("batchsize", batch_size_)
- ->AddVal("refueltime", refuel_time_)
- ->AddVal("preorder_t", preorder_time_)
- ->AddVal("nreload", n_load_)
- ->AddVal("norder", n_reserves_)
- ->AddVal("starttime", start_time_)
- ->AddVal("tobegintime", to_begin_time_)
- ->AddVal("phase", static_cast(phase_))
- ->AddVal("out_commod", out_commod)
- ->AddVal("out_commod_cap", cap)
- ->AddVal("out_commod_cost", cost)
- ->Record();
-
- // initial condition inventories
- di.NewDatum("InitialInv")
- ->AddVal("inventory", std::string("reserves"))
- ->AddVal("nbatches", ics_.n_reserves)
- ->AddVal("recipe", ics_.reserves_rec)
- ->AddVal("commod", ics_.reserves_commod)
- ->Record();
- di.NewDatum("InitialInv")
- ->AddVal("inventory", std::string("core"))
- ->AddVal("nbatches", ics_.n_core)
- ->AddVal("recipe", ics_.core_rec)
- ->AddVal("commod", ics_.core_commod)
- ->Record();
- di.NewDatum("InitialInv")
- ->AddVal("inventory", std::string("storage"))
- ->AddVal("nbatches", ics_.n_storage)
- ->AddVal("recipe", ics_.storage_rec)
- ->AddVal("commod", ics_.storage_commod)
- ->Record();
-
- // trade preferences
- std::map::iterator it2 = commod_prefs_.begin();
- for (; it2 != commod_prefs_.end(); ++it2) {
- di.NewDatum("CommodPrefs")
- ->AddVal("incommodity", it2->first)
- ->AddVal("preference", it2->second)
- ->Record();
- }
-
- // pref changes
- std::map > >::iterator it3;
- for (it3 = pref_changes_.begin(); it3 != pref_changes_.end(); ++it3) {
- int t = it3->first;
- for (int i = 0; i < it3->second.size(); ++i) {
- std::string commod = it3->second[i].first;
- double pref = it3->second[i].second;
- di.NewDatum("PrefChanges")
- ->AddVal("incommodity", commod)
- ->AddVal("new_pref", pref)
- ->AddVal("time", t)
- ->Record();
- }
- }
-
- // recipe changes
- std::map > >::
- iterator it4;
- for (it4 = recipe_changes_.begin(); it4 != recipe_changes_.end(); ++it4) {
- int t = it4->first;
- for (int i = 0; i < it4->second.size(); ++i) {
- std::string commod = it4->second[i].first;
- std::string recipe = it4->second[i].second;
- di.NewDatum("RecipeChanges")
- ->AddVal("incommodity", commod)
- ->AddVal("new_recipe", recipe)
- ->AddVal("time", t)
- ->Record();
- }
- }
-}
-
-void BatchReactor::InitInv(cyclus::Inventories& invs) {
- reserves_.PushAll(invs["reserves"]);
- core_.PushAll(invs["core"]);
- spillover_ = cyclus::ResCast(invs["spillover"][0]);
-
- cyclus::Inventories::iterator it;
- for (it = invs.begin(); it != invs.end(); ++it) {
- std::string name = it->first;
- if (name.find("storage-") == 0) {
- storage_[name].PushAll(it->second);
- }
- }
-}
-
-cyclus::Inventories BatchReactor::SnapshotInv() {
- cyclus::Inventories invs;
- invs["reserves"] = reserves_.PopN(reserves_.count());
- reserves_.PushAll(invs["reserves"]);
- invs["core"] = core_.PopN(core_.count());
- core_.PushAll(invs["core"]);
- std::vector v;
- v.push_back(spillover_);
- invs["spillover"] = v;
- std::map::iterator it;
- for (it = storage_.begin(); it != storage_.end(); ++it) {
- std::string name = it->first;
- invs["storage-" + name] = it->second.PopN(it->second.count());
- it->second.PushAll(invs["storage-" + name]);
- }
- return invs;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-cyclus::Agent* BatchReactor::Clone() {
- BatchReactor* m = new BatchReactor(context());
- m->InitFrom(this);
- return m;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::InitFrom(BatchReactor* m) {
- Facility::InitFrom(m);
-
- // in/out
- crctx_ = m->crctx_;
-
- // facility params
- process_time(m->process_time());
- preorder_time(m->preorder_time());
- refuel_time(m->refuel_time());
- n_batches(m->n_batches());
- n_load(m->n_load());
- n_reserves(m->n_reserves());
- batch_size(m->batch_size());
-
- // commodity production
- cyclus::toolkit::CommodityProducer::Copy(m);
-
- // ics
- ics(m->ics());
-
- // trade preferences
- commod_prefs(m->commod_prefs());
- pref_changes_ = m->pref_changes_;
-
- // recipe changes
- recipe_changes_ = m->recipe_changes_;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-std::string BatchReactor::str() {
- std::stringstream ss;
- ss << cyclus::Facility::str();
- ss << " has facility parameters {" << "\n"
- << " Process Time = " << process_time() << ",\n"
- << " Refuel Time = " << refuel_time() << ",\n"
- << " Preorder Time = " << preorder_time() << ",\n"
- << " Core Loading = " << n_batches() * batch_size() << ",\n"
- << " Batches Per Core = " << n_batches() << ",\n"
- << " Batches Per Load = " << n_load() << ",\n"
- << " Batches To Reserve = " << n_reserves() << ",\n"
- << "'}";
- return ss.str();
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::Build(cyclus::Agent* parent) {
- using cyclus::Material;
-
- Facility::Build(parent);
- phase(INITIAL);
- std::string rec = crctx_.in_recipe(*crctx_.in_commods().begin());
- spillover_ = Material::Create(this, 0.0, context()->GetRecipe(rec));
-
- Material::Ptr mat;
- for (int i = 0; i < ics_.n_reserves; ++i) {
- mat = Material::Create(this,
- batch_size(),
- context()->GetRecipe(ics_.reserves_rec));
- assert(ics_.reserves_commod != "");
- crctx_.AddRsrc(ics_.reserves_commod, mat);
- reserves_.Push(mat);
- }
- for (int i = 0; i < ics_.n_core; ++i) {
- mat = Material::Create(this,
- batch_size(),
- context()->GetRecipe(ics_.core_rec));
- assert(ics_.core_commod != "");
- crctx_.AddRsrc(ics_.core_commod, mat);
- core_.Push(mat);
- }
- for (int i = 0; i < ics_.n_storage; ++i) {
- mat = Material::Create(this,
- batch_size(),
- context()->GetRecipe(ics_.storage_rec));
- assert(ics_.storage_commod != "");
- crctx_.AddRsrc(ics_.storage_commod, mat);
- storage_[ics_.storage_commod].Push(mat);
- }
-
- LOG(cyclus::LEV_DEBUG2, "BReact") << "Batch Reactor entering the simuluation";
- LOG(cyclus::LEV_DEBUG2, "BReact") << str();
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::Tick() {
- int time = context()->time();
- LOG(cyclus::LEV_INFO3, "BReact") << prototype() << " is ticking at time "
- << time << " {";
-
- LOG(cyclus::LEV_DEBUG4, "BReact") << "Current facility parameters for "
- << prototype()
- << " at the beginning of the tick are:";
- LOG(cyclus::LEV_DEBUG4, "BReact") << " Phase: " << phase_names_[phase_];
- LOG(cyclus::LEV_DEBUG4, "BReact") << " Start time: " << start_time_;
- LOG(cyclus::LEV_DEBUG4, "BReact") << " End time: " << end_time();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " Order time: " << order_time();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " NReserves: " << reserves_.count();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " NCore: " << core_.count();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " NStorage: " << StorageCount();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " Spillover Qty: "
- << spillover_->quantity();
-
- if (lifetime() != -1 && context()->time() >= enter_time() + lifetime()) {
- int ncore = core_.count();
- LOG(cyclus::LEV_DEBUG1, "BReact") << "lifetime reached, moving out:"
- << ncore << " batches.";
- for (int i = 0; i < ncore; ++i) {
- MoveBatchOut_(); // unload
- }
- } else {
- switch (phase()) {
- case WAITING:
- if (n_core() == n_batches() &&
- to_begin_time() <= context()->time()) {
- phase(PROCESS);
- }
- break;
-
- case INITIAL:
- // special case for a core primed to go
- if (n_core() == n_batches()) {
- phase(PROCESS);
- }
- break;
- }
- }
-
- // change preferences if its time
- if (pref_changes_.count(time)) {
- std::vector< std::pair< std::string, double> >&
- changes = pref_changes_[time];
- for (int i = 0; i < changes.size(); i++) {
- commod_prefs_[changes[i].first] = changes[i].second;
- }
- }
-
- // change recipes if its time
- if (recipe_changes_.count(time)) {
- std::vector< std::pair< std::string, std::string> >&
- changes = recipe_changes_[time];
- for (int i = 0; i < changes.size(); i++) {
- assert(changes[i].first != "");
- assert(changes[i].second != "");
- crctx_.UpdateInRec(changes[i].first, changes[i].second);
- }
- }
-
- LOG(cyclus::LEV_DEBUG3, "BReact") << "Current facility parameters for "
- << prototype()
- << " at the end of the tick are:";
- LOG(cyclus::LEV_DEBUG3, "BReact") << " Phase: " << phase_names_[phase_];
- LOG(cyclus::LEV_DEBUG3, "BReact") << " Start time: " << start_time_;
- LOG(cyclus::LEV_DEBUG3, "BReact") << " End time: " << end_time();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " Order time: " << order_time();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " NReserves: " << reserves_.count();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " NCore: " << core_.count();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " NStorage: " << StorageCount();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " Spillover Qty: "
- << spillover_->quantity();
- LOG(cyclus::LEV_INFO3, "BReact") << "}";
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::Tock() {
- int time = context()->time();
- LOG(cyclus::LEV_INFO3, "BReact") << prototype() << " is tocking {";
- LOG(cyclus::LEV_DEBUG4, "BReact") << "Current facility parameters for "
- << prototype()
- << " at the beginning of the tock are:";
- LOG(cyclus::LEV_DEBUG4, "BReact") << " Phase: " << phase_names_[phase_];
- LOG(cyclus::LEV_DEBUG4, "BReact") << " Start time: " << start_time_;
- LOG(cyclus::LEV_DEBUG4, "BReact") << " End time: " << end_time();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " Order time: " << order_time();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " NReserves: " << reserves_.count();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " NCore: " << core_.count();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " NStorage: " << StorageCount();
- LOG(cyclus::LEV_DEBUG4, "BReact") << " Spillover Qty: "
- << spillover_->quantity();
-
- switch (phase()) {
- case PROCESS:
- if (time == end_time()) {
- for (int i = 0; i < std::min(n_load(), core_.count()); ++i) {
- MoveBatchOut_(); // unload
- }
- Refuel_(); // reload
- phase(WAITING);
- }
- break;
- default:
- Refuel_(); // always try to reload if possible
- break;
- }
-
- LOG(cyclus::LEV_DEBUG3, "BReact") << "Current facility parameters for "
- << prototype()
- << " at the end of the tock are:";
- LOG(cyclus::LEV_DEBUG3, "BReact") << " Phase: " << phase_names_[phase_];
- LOG(cyclus::LEV_DEBUG3, "BReact") << " Start time: " << start_time_;
- LOG(cyclus::LEV_DEBUG3, "BReact") << " End time: " << end_time();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " Order time: " << order_time();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " NReserves: " << reserves_.count();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " NCore: " << core_.count();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " NStorage: " << StorageCount();
- LOG(cyclus::LEV_DEBUG3, "BReact") << " Spillover Qty: "
- << spillover_->quantity();
- LOG(cyclus::LEV_INFO3, "BReact") << "}";
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-std::set::Ptr>
-BatchReactor::GetMatlRequests() {
- using cyclus::RequestPortfolio;
- using cyclus::Material;
-
- std::set::Ptr> set;
- double order_size;
-
- switch (phase()) {
- // the initial phase requests as much fuel as necessary to achieve an entire
- // core
- case INITIAL:
- order_size = n_batches() * batch_size()
- - core_.quantity() - reserves_.quantity()
- - spillover_->quantity();
- if (preorder_time() == 0) {
- order_size += batch_size() * n_reserves();
- }
- if (order_size > 0) {
- RequestPortfolio::Ptr p = GetOrder_(order_size);
- set.insert(p);
- }
- break;
-
- // the default case is to request the reserve amount if the order time has
- // been reached
- default:
- // double fuel_need = (n_reserves() + n_batches() - n_core()) * batch_size();
- double fuel_need = (n_reserves() + n_load()) * batch_size();
- double fuel_have = reserves_.quantity() + spillover_->quantity();
- order_size = fuel_need - fuel_have;
- bool ordering = order_time() <= context()->time() && order_size > 0;
-
- LOG(cyclus::LEV_DEBUG5, "BReact") << "BatchReactor " << prototype()
- << " is deciding whether to order -";
- LOG(cyclus::LEV_DEBUG5, "BReact") << " Needs fuel amt: " << fuel_need;
- LOG(cyclus::LEV_DEBUG5, "BReact") << " Has fuel amt: " << fuel_have;
- LOG(cyclus::LEV_DEBUG5, "BReact") << " Order amt: " << order_size;
- LOG(cyclus::LEV_DEBUG5, "BReact") << " Order time: " << order_time();
- LOG(cyclus::LEV_DEBUG5, "BReact") << " Current time: "
- << context()->time();
- LOG(cyclus::LEV_DEBUG5, "BReact") << " Ordering?: "
- << ((ordering == true) ? "yes" : "no");
-
- if (ordering) {
- RequestPortfolio::Ptr p = GetOrder_(order_size);
- set.insert(p);
- }
- break;
- }
-
- return set;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::AcceptMatlTrades(
- const std::vector< std::pair,
- cyclus::Material::Ptr> >& responses) {
- using cyclus::Material;
-
- std::map mat_commods;
-
- std::vector< std::pair,
- cyclus::Material::Ptr> >::const_iterator trade;
-
- // blob each material by commodity
- std::string commod;
- Material::Ptr mat;
- for (trade = responses.begin(); trade != responses.end(); ++trade) {
- commod = trade->first.request->commodity();
- mat = trade->second;
- if (mat_commods.count(commod) == 0) {
- mat_commods[commod] = mat;
- } else {
- mat_commods[commod]->Absorb(mat);
- }
- }
-
- // add each blob to reserves
- std::map::iterator it;
- for (it = mat_commods.begin(); it != mat_commods.end(); ++it) {
- AddBatches_(it->first, it->second);
- }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-std::set::Ptr>
-BatchReactor::GetMatlBids(cyclus::CommodMap::type&
- commod_requests) {
- using cyclus::BidPortfolio;
- using cyclus::Material;
-
- std::set::Ptr> ports;
-
- const std::set& commods = crctx_.out_commods();
- std::set::const_iterator it;
- for (it = commods.begin(); it != commods.end(); ++it) {
- BidPortfolio::Ptr port = GetBids_(commod_requests,
- *it,
- &storage_[*it]);
- if (!port->bids().empty()) {
- ports.insert(port);
- }
- }
-
- return ports;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::GetMatlTrades(
- const std::vector< cyclus::Trade >& trades,
- std::vector,
- cyclus::Material::Ptr> >& responses) {
- using cyclus::Material;
- using cyclus::Trade;
-
- std::vector< cyclus::Trade >::const_iterator it;
- for (it = trades.begin(); it != trades.end(); ++it) {
- LOG(cyclus::LEV_INFO5, "BReact") << prototype()
- << " just received an order.";
-
- std::string commodity = it->request->commodity();
- double qty = it->amt;
- Material::Ptr response = TradeResponse_(qty, &storage_[commodity]);
-
- responses.push_back(std::make_pair(*it, response));
- LOG(cyclus::LEV_INFO5, "BatchReactor") << prototype()
- << " just received an order"
- << " for " << qty
- << " of " << commodity;
- }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-int BatchReactor::StorageCount() {
- int count = 0;
- std::map::const_iterator it;
- for (it = storage_.begin(); it != storage_.end(); ++it) {
- count += it->second.count();
- }
- return count;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::phase(BatchReactor::Phase p) {
- LOG(cyclus::LEV_DEBUG2, "BReact") << "BatchReactor " << prototype()
- << " is changing phases -";
- LOG(cyclus::LEV_DEBUG2, "BReact") << " * from phase: " << phase_names_[phase_];
- LOG(cyclus::LEV_DEBUG2, "BReact") << " * to phase: " << phase_names_[p];
-
- switch (p) {
- case PROCESS:
- start_time(context()->time());
- }
- phase_ = p;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::Refuel_() {
- while (n_core() < n_batches() && reserves_.count() > 0) {
- MoveBatchIn_();
- if (n_core() == n_batches()) {
- to_begin_time_ = start_time_ + process_time_ + refuel_time_;
- }
- }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::MoveBatchIn_() {
- LOG(cyclus::LEV_DEBUG2, "BReact") << "BatchReactor " << prototype()
- << " added a batch to its core.";
- try {
- core_.Push(reserves_.Pop());
- } catch (cyclus::Error& e) {
- e.msg(Agent::InformErrorMsg(e.msg()));
- throw e;
- }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::MoveBatchOut_() {
- using cyclus::Material;
- using cyclus::ResCast;
-
- LOG(cyclus::LEV_DEBUG2, "BReact") << "BatchReactor " << prototype()
- << " removed a batch from its core.";
- try {
- Material::Ptr mat = ResCast(core_.Pop());
- std::string incommod = crctx_.commod(mat);
- assert(incommod != "");
- std::string outcommod = crctx_.out_commod(incommod);
- assert(outcommod != "");
- std::string outrecipe = crctx_.out_recipe(incommod);
- assert(outrecipe != "");
- mat->Transmute(context()->GetRecipe(outrecipe));
- crctx_.UpdateRsrc(outcommod, mat);
- storage_[outcommod].Push(mat);
- } catch (cyclus::Error& e) {
- e.msg(Agent::InformErrorMsg(e.msg()));
- throw e;
- }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-cyclus::RequestPortfolio::Ptr
-BatchReactor::GetOrder_(double size) {
- using cyclus::CapacityConstraint;
- using cyclus::Material;
- using cyclus::RequestPortfolio;
- using cyclus::Request;
-
- RequestPortfolio::Ptr port(new RequestPortfolio());
-
- const std::set& commods = crctx_.in_commods();
- std::set::const_iterator it;
- std::string recipe;
- Material::Ptr mat;
-
- std::vector*> mreqs;
- for (it = commods.begin(); it != commods.end(); ++it) {
- recipe = crctx_.in_recipe(*it);
- assert(recipe != "");
- mat = Material::CreateUntracked(size, context()->GetRecipe(recipe));
- Request* r = port->AddRequest(mat, this, *it, commod_prefs_[*it]);
- mreqs.push_back(r);
-
- LOG(cyclus::LEV_DEBUG3, "BReact") << "BatchReactor " << prototype()
- << " is making an order:";
- LOG(cyclus::LEV_DEBUG3, "BReact") << " size: " << size;
- LOG(cyclus::LEV_DEBUG3, "BReact") << " commodity: " << *it;
- LOG(cyclus::LEV_DEBUG3, "BReact") << " preference: "
- << commod_prefs_[*it];
- }
- port->AddMutualReqs(mreqs);
-
- return port;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::AddBatches_(std::string commod, cyclus::Material::Ptr mat) {
- using cyclus::Material;
- using cyclus::ResCast;
-
- LOG(cyclus::LEV_DEBUG3, "BReact") << "BatchReactor " << prototype()
- << " is adding " << mat->quantity()
- << " of material to its reserves.";
-
- // this is a hack! Whatever *was* left in spillover now magically becomes this
- // new commodity. We need to do something different (maybe) for recycle.
- spillover_->Absorb(mat);
-
- while (!cyclus::IsNegative(spillover_->quantity() - batch_size())) {
- Material::Ptr batch;
- // this is a hack to deal with close-to-equal issues between batch size and
- // the amount of fuel in spillover
- if (spillover_->quantity() >= batch_size()) {
- batch = spillover_->ExtractQty(batch_size());
- } else {
- batch = spillover_->ExtractQty(spillover_->quantity());
- }
- assert(commod != "");
- crctx_.AddRsrc(commod, batch);
- reserves_.Push(batch);
- }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-cyclus::BidPortfolio::Ptr BatchReactor::GetBids_(
- cyclus::CommodMap::type& commod_requests,
- std::string commod,
- cyclus::toolkit::ResourceBuff* buffer) {
- using cyclus::Bid;
- using cyclus::BidPortfolio;
- using cyclus::CapacityConstraint;
- using cyclus::Composition;
- using cyclus::Converter;
- using cyclus::Material;
- using cyclus::Request;
- using cyclus::ResCast;
- using cyclus::toolkit::ResourceBuff;
-
- BidPortfolio::Ptr port(new BidPortfolio());
-
- if (commod_requests.count(commod) > 0 && buffer->quantity() > 0) {
- std::vector*>& requests = commod_requests[commod];
-
- // get offer composition
- Material::Ptr back = ResCast(buffer->Pop(ResourceBuff::BACK));
- Composition::Ptr comp = back->comp();
- buffer->Push(back);
-
- std::vector*>::iterator it;
- for (it = requests.begin(); it != requests.end(); ++it) {
- Request* req = *it;
- double qty = std::min(req->target()->quantity(), buffer->quantity());
- Material::Ptr offer = Material::CreateUntracked(qty, comp);
- port->AddBid(req, offer, this);
- }
-
- CapacityConstraint cc(buffer->quantity());
- port->AddConstraint(cc);
- }
-
- return port;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-cyclus::Material::Ptr BatchReactor::TradeResponse_(
- double qty,
- cyclus::toolkit::ResourceBuff* buffer) {
- using cyclus::Material;
- using cyclus::ResCast;
-
- std::vector manifest;
- try {
- // pop amount from inventory and blob it into one material
- manifest = ResCast(buffer->PopQty(qty));
- } catch (cyclus::Error& e) {
- e.msg(Agent::InformErrorMsg(e.msg()));
- throw e;
- }
-
- Material::Ptr response = manifest[0];
- crctx_.RemoveRsrc(response);
- for (int i = 1; i < manifest.size(); i++) {
- crctx_.RemoveRsrc(manifest[i]);
- response->Absorb(manifest[i]);
- }
- return response;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void BatchReactor::SetUpPhaseNames_() {
- phase_names_.insert(std::make_pair(INITIAL, "initialization"));
- phase_names_.insert(std::make_pair(PROCESS, "processing batch(es)"));
- phase_names_.insert(std::make_pair(WAITING, "waiting for fuel"));
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-extern "C" cyclus::Agent* ConstructBatchReactor(cyclus::Context* ctx) {
- return new BatchReactor(ctx);
-}
-
-} // namespace cycamore
diff --git a/src/batch_reactor.h b/src/batch_reactor.h
deleted file mode 100644
index e5d537219e..0000000000
--- a/src/batch_reactor.h
+++ /dev/null
@@ -1,445 +0,0 @@
-#ifndef CYCAMORE_SRC_BATCH_REACTOR_H_
-#define CYCAMORE_SRC_BATCH_REACTOR_H_
-
-#include