diff --git a/moose-core/.travis.yml b/moose-core/.travis.yml index 2f37437c30ae8d941c6062a7d09d5c11eaf0add4..0bf992ae852e4d7031e5c20c1e24123f3f924d5c 100644 --- a/moose-core/.travis.yml +++ b/moose-core/.travis.yml @@ -3,10 +3,10 @@ sudo: required matrix: include: - - os : linux - dist: xenial - - os : osx - osx_image: xcode10.1 + - os: linux + dist: xenial + - os: osx + osx_image: xcode10.2 notifications: email: @@ -26,12 +26,6 @@ before_script: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_prepare_osx.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.travis/travis_prepare_linux.sh; fi - -before_script: -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then nvm get head || true; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_prepare_osx.sh; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.travis/travis_prepare_linux.sh; fi - script: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_build_osx.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/travis_build_linux.sh; fi diff --git a/moose-core/.travis/travis_build_osx.sh b/moose-core/.travis/travis_build_osx.sh index bb1fffe0edf851e6cb14dfa32b00470dff05de0b..20d0638e5a19aa955e1d399034e2b3dc394f621a 100755 --- a/moose-core/.travis/travis_build_osx.sh +++ b/moose-core/.travis/travis_build_osx.sh @@ -26,23 +26,26 @@ set -e # Make sure not to pick up python from /opt. PATH=/usr/local/bin:/usr/bin:$PATH + PYTHON3=$(which python3) + # Get pylint - python -m pip install pylint --user - python -m pip install python-libsbml --user - python -m pip install pyneuroml --user + $PYTHON3 -m pip install pylint --user + $PYTHON3 -m pip install python-libsbml --user + $PYTHON3 -m pip install pyneuroml --user mkdir -p _GSL_BUILD && cd _GSL_BUILD \ && cmake -DDEBUG=ON \ - -DPYTHON_EXECUTABLE=`which python` .. + -DPYTHON_EXECUTABLE=$PYTHON3 \ + .. make pylint -j3 - make && ctest --output-on-failure -E ".*socket_streamer.*" + make && ctest --output-on-failure cd .. # Now with boost. mkdir -p _BOOST_BUILD && cd _BOOST_BUILD \ && cmake -DWITH_BOOST_ODE=ON -DDEBUG=ON \ - -DPYTHON_EXECUTABLE=`which python` .. + -DPYTHON_EXECUTABLE=`which python3` .. - make && ctest --output-on-failure -E ".*socket_streamer.*" + make -j4 && ctest --output-on-failure cd .. set +e diff --git a/moose-core/.travis/travis_prepare_osx.sh b/moose-core/.travis/travis_prepare_osx.sh index d56638ed70f802230d570697cc3d3dc3fdac8bdd..d706e68bb906973a4434c5d5b04a4c4a6b4c28c3 100755 --- a/moose-core/.travis/travis_prepare_osx.sh +++ b/moose-core/.travis/travis_prepare_osx.sh @@ -28,17 +28,20 @@ brew install python brew install numpy brew install boost +PYTHON3=$(which python3) + #brew outdated python || brew install python #brew outdated numpy || brew install homebrew/python/numpy brew unlink numpy && brew link numpy || echo "Failed to link numpy" # Numpy caveats -mkdir -p $HOME/Library/Python/2.7/lib/python/site-packages -echo 'import sys; sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")' >> $HOME/Library/Python/2.7/lib/python/site-packages/homebrew.pth +#mkdir -p $HOME/Library/Python/2.7/lib/python/site-packages +#echo 'import sys; sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")' >> $HOME/Library/Python/2.7/lib/python/site-packages/homebrew.pth # To make sure that we do not pick python from /opt etc. PATH=/usr/local/bin:/usr/bin:$PATH # ensurepip -python -m ensurepip -python -m pip install matplotlib --user --upgrade -python -m pip install pyNeuroML libNeuroML --user -python -m pip install scipy --user +$PYTHON3 -m ensurepip +$PYTHON3 -m pip install matplotlib --user --upgrade +$PYTHON3 -m pip install pyNeuroML libNeuroML --user +$PYTHON3 -m pip install scipy --user +$PYTHON3 -m pip install pylint --user diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt index 0fa33eb6051be4169d0e3182c1f976a36cfbb95e..35a86c98aebf22674ae3dba8c20972077947ffbc 100644 --- a/moose-core/CMakeLists.txt +++ b/moose-core/CMakeLists.txt @@ -4,7 +4,6 @@ project(pymoose) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules") include(CheckCXXCompiler.cmake) include(CheckIncludeFileCXX) -include(FindPkgConfig) # getgit revision number find_program( GIT_EXEC git ) @@ -78,6 +77,7 @@ option(WITH_BOOST_ODE "Use boost library ode2 library instead of GSL" OFF) option(WITH_GSL "Use gsl-library. Alternative is WITH_BOOST" ON) option(PARALLELIZED_CLOCK "High level parallelization of moose::Clock (alpha)" OFF ) option(USE_PRIVATE_RNG "Stochastic Objects use their private RNG" ON) +option(WITH_ASAN "Use AddressSanitizer in DEBUG mode." OFF) ############################ BUILD CONFIGURATION ################################# @@ -87,7 +87,7 @@ add_definitions(-DUSE_GENESIS_PARSER) if(DEBUG OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") message(STATUS "Building for Debug/Unit testing") - add_definitions(-DDO_UNIT_TESTS) + add_definitions(-DDO_UNIT_TESTS -O) set(CMAKE_BUILD_TYPE Debug) elseif(ENABLE_UNIT_TESTS) MESSAGE(STATUS "Enabled Unit tests") @@ -109,8 +109,14 @@ if(GPROF AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg") endif() -find_package(Threads) - +if(WITH_ASAN AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + message(STATUS "Compiling with ASAN") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} \ + -fno-omit-frame-pointer -fsanitize=leak -fsanitize=address") + set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} \ + -fno-omit-frame-pointer -fsanitize=leak -fsanitize=address") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address") +endif() ################################### TARGETS #################################### @@ -132,8 +138,6 @@ if(WITH_BOOST_ODE) set(WITH_GSL OFF) endif(WITH_BOOST_ODE) -include_directories(msg basecode) - set_target_properties(libmoose PROPERTIES COMPILE_DEFINITIONS "MOOSE_LIB") set_target_properties(libmoose PROPERTIES PREFIX "") @@ -143,11 +147,10 @@ set(STATIC_LIBRARIES "" ) set(SYSTEM_SHARED_LIBS ${LibXML2_LIBRARIES}) # BOOST ode library performs better than GSL and ideally should be made default. -# Making boost default means that we get rid of gsl. Boost does not have a very -# good matrix library; it has ublas which is not well maintained and emit a lot +# Unfortunately Boost does not have a very good matrix library; it has ublas +# which is not well maintained and emit a lot # of warning during compilation. Nonetheless, WITH_BOOST_ODE works fine and -# produce results quicker than GSL. Both boost ode and ublas are in moose source -# tree ./external/odeint-v2 and ./external/boost-numeric-bindings +# produce results quicker than GSL. if(WITH_GSL) find_package(GSL 1.16 REQUIRED) if(NOT GSL_FOUND) @@ -172,13 +175,14 @@ if(WITH_GSL) # top level. include_directories( ${GSL_INCLUDE_DIRS} ) elseif(WITH_BOOST_ODE) - find_package(Boost 1.44 REQUIRED) - find_package( LAPACK REQUIRED ) + find_package(Boost 1.53 REQUIRED) + find_package(LAPACK REQUIRED) endif() # if boost ode is being used, don't use GSL. if(WITH_BOOST_ODE) add_definitions(-DUSE_BOOST_ODE -UUSE_GSL) + include_directories(${Boost_INCLUDE_DIRS}) endif() # Openmpi @@ -202,6 +206,7 @@ if(WITH_BOOST_ODE) list(APPEND SYSTEM_SHARED_LIBS ${Boost_LIBRARIES}) endif(WITH_BOOST_ODE) +find_package( Threads ) list(APPEND SYSTEM_SHARED_LIBS ${CMAKE_THREAD_LIBS_INIT}) # These libraries could be static of dynamic. We need to discrimate between @@ -265,6 +270,7 @@ list(APPEND MOOSE_LIBRARIES msg benchmarks shell + randnum scheduling moose_mpi biophysics @@ -441,6 +447,7 @@ set(PYMOOSE_TEST_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/python) # Collect all python script in tests folder and run them. file(GLOB PY_TEST_SCRIPTS "${PYMOOSE_TEST_DIRECTORY}/test_*.py" ) + # Run python tests. foreach( _test_script ${PY_TEST_SCRIPTS} ) get_filename_component( _test_name ${_test_script} NAME_WE) @@ -453,6 +460,36 @@ foreach( _test_script ${PY_TEST_SCRIPTS} ) ) endforeach( ) +# Alpha tests. These should not run by default. +set(MOOSE_ALPHA_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/alpha) +file(GLOB PY_ALPHA_TEST_SCRIPTS "${PYMOOSE_ALPHA_TEST_DIRECTORY}/*.py" ) +foreach( _test_script ${PY_ALPHA_TEST_SCRIPTS} ) + get_filename_component( _test_name ${_test_script} NAME_WE) + add_test( NAME ${_test_name} + COMMAND ${PYTHON_EXECUTABLE} ${_test_script} + CONFIGURATIONS Devel + WORKING_DIRECTORY ${PYMOOSE_ALPHA_TEST_DIRECTORY} + ) + set_tests_properties( ${_test_name} + PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python" + ) +endforeach( ) + +# Regression and github issues. These should not run by default. +set(PYMOOSE_ISSUES_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/issues) +file(GLOB PY_ISSUES_SCRIPTS "${PYMOOSE_ISSUES_DIRECTORY}/*.py" ) +foreach( _test_script ${PY_ISSUES_SCRIPTS} ) + get_filename_component( _test_name ${_test_script} NAME_WE) + add_test( NAME ${_test_name} + COMMAND ${PYTHON_EXECUTABLE} ${_test_script} + CONFIGURATIONS Devel + WORKING_DIRECTORY ${PYMOOSE_ISSUES_DIRECTORY} + ) + set_tests_properties( ${_test_name} + PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python" + ) +endforeach( ) + # add pylint target. set(PYSCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/python ) file(GLOB_RECURSE PY_SCRIPTS "python/*.py") @@ -476,4 +513,5 @@ foreach( _py_script ${PY_SCRIPTS} ) endforeach( ) ############################ CPACK ###################################### +# This is not maintained anymore since packaging is done using OpenBuildService include(${CMAKE_CURRENT_SOURCE_DIR}/cmake_moose_cpack.cmake) diff --git a/moose-core/basecode/FuncOrder.h b/moose-core/basecode/FuncOrder.h index 03c4bfc17dc83579cb4e433b1d4ae09e58b2780c..b75a8360c736d206584d3687bcff6138eb933360 100644 --- a/moose-core/basecode/FuncOrder.h +++ b/moose-core/basecode/FuncOrder.h @@ -13,28 +13,31 @@ class FuncOrder { - public: - FuncOrder() - : func_( 0 ), index_( 0 ) - {;} +public: + FuncOrder() + : func_( 0 ), index_( 0 ) + {;} - const OpFunc* func() const { - return func_; - } - unsigned int index() const { - return index_; - } + const OpFunc* func() const + { + return func_; + } + unsigned int index() const + { + return index_; + } - void set( const OpFunc* func, unsigned int index ) { - func_ = func; - index_ = index; - } + void set( const OpFunc* func, unsigned int index ) + { + func_ = func; + index_ = index; + } - bool operator<( const FuncOrder& other ) const - { - return func_ < other.func_; - } - private: - const OpFunc* func_; - unsigned int index_; + bool operator<( const FuncOrder& other ) const + { + return func_ < other.func_; + } +private: + const OpFunc* func_; + unsigned int index_; }; diff --git a/moose-core/basecode/global.cpp b/moose-core/basecode/global.cpp index fadf41ef88f76f8586120c6b5a79675bc128f16d..c2c365428e72514f473071606cfbbc5151e798c2 100644 --- a/moose-core/basecode/global.cpp +++ b/moose-core/basecode/global.cpp @@ -49,7 +49,7 @@ namespace moose { { "HSolve", {0.0, 0} } }; - moose::RNG<double> rng; + moose::RNG rng; /* Check if path is OK */ int checkPath( const string& path ) @@ -104,6 +104,11 @@ namespace moose { return moose::rng.uniform( ); } + double mtrand( double a, double b ) + { + return (b-a) * mtrand() + a; + } + // MOOSE suffixes [0] to all elements to path. Remove [0] with null // character whenever possible. For n > 0, [n] should not be touched. Its // the user job to take the pain and write the correct path. diff --git a/moose-core/basecode/global.h b/moose-core/basecode/global.h index 893c55762c7fe4f1bb51f2496c4346478a1a8de0..3beab75dc583579fce039a8383bb78825ce0511a 100644 --- a/moose-core/basecode/global.h +++ b/moose-core/basecode/global.h @@ -56,7 +56,7 @@ extern unsigned int totalTests; namespace moose { - extern moose::RNG<double> rng; + extern moose::RNG rng; extern map<string, valarray<double>> solverProfMap; @@ -114,6 +114,18 @@ namespace moose */ double mtrand( void ); + /* --------------------------------------------------------------------------*/ + /** + * @Synopsis Overloaded function. Random number between a and b + * + * @Param a lower limit. + * @Param b Upper limit. + * + * @Returns + */ + /* ----------------------------------------------------------------------------*/ + double mtrand( double a, double b ); + /** * @brief Create a POSIX compatible path from a given string. * Remove/replace bad characters. diff --git a/moose-core/biophysics/Compartment.cpp b/moose-core/biophysics/Compartment.cpp index 8a137df7d39497e5ef7b0d967a59076983751c14..4f7742f7efcb54a04602aa447408958c29c9f031 100644 --- a/moose-core/biophysics/Compartment.cpp +++ b/moose-core/biophysics/Compartment.cpp @@ -268,7 +268,7 @@ void Compartment::vRandInject( const Eref& e, double prob, double current) #ifdef DO_UNIT_TESTS -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" //#include "../randnum/randnum.h" diff --git a/moose-core/biophysics/Neuron.cpp b/moose-core/biophysics/Neuron.cpp index 4d5993f1676aa1a4fe03ba6719563880115e8ee6..fc72bf01b199090879cfccf7d51d7f049fa1bdec 100644 --- a/moose-core/biophysics/Neuron.cpp +++ b/moose-core/biophysics/Neuron.cpp @@ -19,13 +19,13 @@ #include "Neuron.h" #include "../basecode/global.h" -#include "../external/muparser/include/muParser.h" +#include "../builtins/MooseParser.h" -class nuParser: public mu::Parser +class nuParser: public MooseParser { public: nuParser( const string& expr ): - mu::Parser(), + MooseParser(), p(0.0), // geometrical path distance wound through dendrite g(0.0), // geometrical path distance direct from soma. L(0.0), // electrical distance arg @@ -109,40 +109,40 @@ const Cinfo* Neuron::initCinfo() // ValueFinfos ///////////////////////////////////////////////////////////////////// static ValueFinfo< Neuron, double > RM( "RM", - "Membrane resistivity, in ohm.m^2. Default value is 1.0.", - &Neuron::setRM, - &Neuron::getRM - ); + "Membrane resistivity, in ohm.m^2. Default value is 1.0.", + &Neuron::setRM, + &Neuron::getRM + ); static ValueFinfo< Neuron, double > RA( "RA", - "Axial resistivity of cytoplasm, in ohm.m. Default value is 1.0.", - &Neuron::setRA, - &Neuron::getRA - ); + "Axial resistivity of cytoplasm, in ohm.m. Default value is 1.0.", + &Neuron::setRA, + &Neuron::getRA + ); static ValueFinfo< Neuron, double > CM( "CM", - "Membrane Capacitance, in F/m^2. Default value is 0.01", - &Neuron::setCM, - &Neuron::getCM - ); + "Membrane Capacitance, in F/m^2. Default value is 0.01", + &Neuron::setCM, + &Neuron::getCM + ); static ValueFinfo< Neuron, double > Em( "Em", - "Resting membrane potential of compartments, in Volts. " - "Default value is -0.065.", - &Neuron::setEm, - &Neuron::getEm - ); + "Resting membrane potential of compartments, in Volts. " + "Default value is -0.065.", + &Neuron::setEm, + &Neuron::getEm + ); static ValueFinfo< Neuron, double > theta( "theta", "Angle to rotate cell geometry, around long axis of neuron. " "Think Longitude. Units are radians. " "Default value is zero, which means no rotation. ", &Neuron::setTheta, &Neuron::getTheta - ); + ); static ValueFinfo< Neuron, double > phi( "phi", "Angle to rotate cell geometry, around elevation of neuron. " "Think Latitude. Units are radians. " "Default value is zero, which means no rotation. ", &Neuron::setPhi, &Neuron::getPhi - ); + ); static ValueFinfo< Neuron, string > sourceFile( "sourceFile", "Name of source file from which to load a model. " @@ -151,317 +151,317 @@ const Cinfo* Neuron::initCinfo() "definitions should have been loaded into /library. ", &Neuron::setSourceFile, &Neuron::getSourceFile - ); + ); static ValueFinfo< Neuron, double > compartmentLengthInLambdas( - "compartmentLengthInLambdas", - "Units: meters (SI). \n" - "Electrotonic length to use for the largest compartment in the " - "model. Used to define subdivision of branches into compartments. " - "For example, if we set *compartmentLengthInLambdas* to 0.1, " - "and *lambda* (electrotonic length) is 250 microns, then it " - "sets the compartment length to 25 microns. Thus a dendritic " - "branch of 500 microns is subdivided into 20 commpartments. " - "If the branch is shorter than *compartmentLengthInLambdas*, " - "then it is not subdivided. " - "If *compartmentLengthInLambdas* is set to 0 then the original " - "compartmental structure of the model is preserved. " - " Note that this routine does NOT merge branches, even if " - "*compartmentLengthInLambdas* is bigger than the branch. " - "While all this subdivision is being done, the Neuron class " - "preserves as detailed a geometry as it can, so it can rebuild " - "the more detailed version if needed. " - "Default value of *compartmentLengthInLambdas* is 0. ", - &Neuron::setCompartmentLengthInLambdas, - &Neuron::getCompartmentLengthInLambdas - ); + "compartmentLengthInLambdas", + "Units: meters (SI). \n" + "Electrotonic length to use for the largest compartment in the " + "model. Used to define subdivision of branches into compartments. " + "For example, if we set *compartmentLengthInLambdas* to 0.1, " + "and *lambda* (electrotonic length) is 250 microns, then it " + "sets the compartment length to 25 microns. Thus a dendritic " + "branch of 500 microns is subdivided into 20 commpartments. " + "If the branch is shorter than *compartmentLengthInLambdas*, " + "then it is not subdivided. " + "If *compartmentLengthInLambdas* is set to 0 then the original " + "compartmental structure of the model is preserved. " + " Note that this routine does NOT merge branches, even if " + "*compartmentLengthInLambdas* is bigger than the branch. " + "While all this subdivision is being done, the Neuron class " + "preserves as detailed a geometry as it can, so it can rebuild " + "the more detailed version if needed. " + "Default value of *compartmentLengthInLambdas* is 0. ", + &Neuron::setCompartmentLengthInLambdas, + &Neuron::getCompartmentLengthInLambdas + ); static ElementValueFinfo< Neuron, vector< string > > - channelDistribution( - "channelDistribution", - "Specification for distribution of channels, CaConcens and " - "any other model components that are defined as prototypes and " - "have to be placed on the electrical compartments.\n" - "Arguments: proto path field expr [field expr]...\n" - " Each entry is terminated with an empty string. " - "The prototype is any object created in */library*, " - "If a channel matching the prototype name already exists, then " - "all subsequent operations are applied to the extant channel and " - "a new one is not created. " - "The paired arguments are as follows: \n" - "The *field* argument specifies the name of the parameter " - "that is to be assigned by the expression.\n" - "The *expression* argument is a mathematical expression in " - "the muparser framework, which permits most operations including " - "trig and transcendental ones. Of course it also handles simple " - "numerical values like 1.0, 1e-10 and so on. " - "Available arguments for muParser are:\n" - " p, g, L, len, dia, maxP, maxG, maxL \n" - " p: path distance from soma, measured along dendrite, in metres.\n" - " g: geometrical distance from soma, in metres.\n" - " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n" - " len: length of compartment, in metres.\n" - " dia: for diameter of compartment, in metres.\n" - " maxP: Maximum value of *p* for this neuron. \n" - " maxG: Maximum value of *g* for this neuron. \n" - " maxL: Maximum value of *L* for this neuron.\n" - "The expression for the first field must evaluate to > 0 " - "for the channel to be installed. For example, for " - "channels, if Field == Gbar, and func( r, L, len, dia) < 0, \n" - "then the channel is not installed. This feature is typically " - "used with the sign() or Heaviside H() function to limit range: " - "for example: H(1 - L) will only put channels closer than " - "one length constant from the soma, and zero elsewhere. \n" - "Available fields are: \n" - "Channels: Gbar (install), Ek \n" - "CaConcen: shellDia (install), shellFrac (install), tau, min\n" - "Unless otherwise noted, all fields are scaled appropriately by " - "the dimensions of their compartment. Thus the channel " - "maximal conductance Gbar is automatically scaled by the area " - "of the compartment, and the user does not need to insert this " - "scaling into the calculations.\n" - "All parameters are expressed in SI units. Conductance, for " - "example, is Siemens/sq metre. " - "\n\n" - "Some example function forms might be for a channel Gbar: \n" - " p < 10e-6 ? 400 : 0.0 \n" - " equivalently, \n" - " H(10e-6 - p) * 400 \n" - " equivalently, \n" - " ( sign(10e-6 - p) + 1) * 200 \n" - "Each of these forms instruct the function to " - "set channel Gbar to 400 S/m^2 only within 10 microns path " - "distance of soma\n" - "\n" - " L < 1.0 ? 100 * exp( -L ) : 0.0 \n" - " ->Set channel Gbar to an exponentially falling function of " - "electrotonic distance from soma, provided L is under " - "1.0 lambdas. \n", + channelDistribution( + "channelDistribution", + "Specification for distribution of channels, CaConcens and " + "any other model components that are defined as prototypes and " + "have to be placed on the electrical compartments.\n" + "Arguments: proto path field expr [field expr]...\n" + " Each entry is terminated with an empty string. " + "The prototype is any object created in */library*, " + "If a channel matching the prototype name already exists, then " + "all subsequent operations are applied to the extant channel and " + "a new one is not created. " + "The paired arguments are as follows: \n" + "The *field* argument specifies the name of the parameter " + "that is to be assigned by the expression.\n" + "The *expression* argument is a mathematical expression in " + "the muparser framework, which permits most operations including " + "trig and transcendental ones. Of course it also handles simple " + "numerical values like 1.0, 1e-10 and so on. " + "Available arguments for muParser are:\n" + " p, g, L, len, dia, maxP, maxG, maxL \n" + " p: path distance from soma, measured along dendrite, in metres.\n" + " g: geometrical distance from soma, in metres.\n" + " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n" + " len: length of compartment, in metres.\n" + " dia: for diameter of compartment, in metres.\n" + " maxP: Maximum value of *p* for this neuron. \n" + " maxG: Maximum value of *g* for this neuron. \n" + " maxL: Maximum value of *L* for this neuron.\n" + "The expression for the first field must evaluate to > 0 " + "for the channel to be installed. For example, for " + "channels, if Field == Gbar, and func( r, L, len, dia) < 0, \n" + "then the channel is not installed. This feature is typically " + "used with the sign() or Heaviside H() function to limit range: " + "for example: H(1 - L) will only put channels closer than " + "one length constant from the soma, and zero elsewhere. \n" + "Available fields are: \n" + "Channels: Gbar (install), Ek \n" + "CaConcen: shellDia (install), shellFrac (install), tau, min\n" + "Unless otherwise noted, all fields are scaled appropriately by " + "the dimensions of their compartment. Thus the channel " + "maximal conductance Gbar is automatically scaled by the area " + "of the compartment, and the user does not need to insert this " + "scaling into the calculations.\n" + "All parameters are expressed in SI units. Conductance, for " + "example, is Siemens/sq metre. " + "\n\n" + "Some example function forms might be for a channel Gbar: \n" + " p < 10e-6 ? 400 : 0.0 \n" + " equivalently, \n" + " H(10e-6 - p) * 400 \n" + " equivalently, \n" + " ( sign(10e-6 - p) + 1) * 200 \n" + "Each of these forms instruct the function to " + "set channel Gbar to 400 S/m^2 only within 10 microns path " + "distance of soma\n" + "\n" + " L < 1.0 ? 100 * exp( -L ) : 0.0 \n" + " ->Set channel Gbar to an exponentially falling function of " + "electrotonic distance from soma, provided L is under " + "1.0 lambdas. \n", &Neuron::setChannelDistribution, &Neuron::getChannelDistribution - ); + ); static ElementValueFinfo< Neuron, vector< string > > - passiveDistribution( - "passiveDistribution", - "Specification for distribution of passive properties of cell.\n" - "Arguments: . path field expr [field expr]...\n" - "Note that the arguments list starts with a period. " - " Each entry is terminated with an empty string. " - "The paired arguments are as follows: \n" - "The *field* argument specifies the name of the parameter " - "that is to be assigned by the expression.\n" - "The *expression* argument is a mathematical expression in " - "the muparser framework, which permits most operations including " - "trig and transcendental ones. Of course it also handles simple " - "numerical values like 1.0, 1e-10 and so on. " - "Available arguments for muParser are:\n" - " p, g, L, len, dia, maxP, maxG, maxL \n" - " p: path distance from soma, measured along dendrite, in metres.\n" - " g: geometrical distance from soma, in metres.\n" - " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n" - " len: length of compartment, in metres.\n" - " dia: for diameter of compartment, in metres.\n" - " maxP: Maximum value of *p* for this neuron. \n" - " maxG: Maximum value of *g* for this neuron. \n" - " maxL: Maximum value of *L* for this neuron.\n" - "Available fields are: \n" - "RM, RA, CM, Rm, Ra, Cm, Em, initVm \n" - "The first three fields are scaled appropriately by " - "the dimensions of their compartment. Thus the membrane " - "resistivity RM (ohms.m^2) is automatically scaled by the area " - "of the compartment, and the user does not need to insert this " - "scaling into the calculations to compute Rm." - "Using the Rm field lets the user directly assign the " - "membrane resistance (in ohms), presumably using len and dia.\n" - "Similarly, RA (ohms.m) and CM (Farads/m^2) are specific units " - "and the actual values for each compartment are assigned by " - "scaling by length and diameter. Ra (ohms) and Cm (Farads) " - "require explicit evaluation of the expression. " - "All parameters are expressed in SI units. Conductance, for " - "example, is Siemens/sq metre.\n" - "Note that time these calculations do NOT currently include spines\n", + passiveDistribution( + "passiveDistribution", + "Specification for distribution of passive properties of cell.\n" + "Arguments: . path field expr [field expr]...\n" + "Note that the arguments list starts with a period. " + " Each entry is terminated with an empty string. " + "The paired arguments are as follows: \n" + "The *field* argument specifies the name of the parameter " + "that is to be assigned by the expression.\n" + "The *expression* argument is a mathematical expression in " + "the muparser framework, which permits most operations including " + "trig and transcendental ones. Of course it also handles simple " + "numerical values like 1.0, 1e-10 and so on. " + "Available arguments for muParser are:\n" + " p, g, L, len, dia, maxP, maxG, maxL \n" + " p: path distance from soma, measured along dendrite, in metres.\n" + " g: geometrical distance from soma, in metres.\n" + " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n" + " len: length of compartment, in metres.\n" + " dia: for diameter of compartment, in metres.\n" + " maxP: Maximum value of *p* for this neuron. \n" + " maxG: Maximum value of *g* for this neuron. \n" + " maxL: Maximum value of *L* for this neuron.\n" + "Available fields are: \n" + "RM, RA, CM, Rm, Ra, Cm, Em, initVm \n" + "The first three fields are scaled appropriately by " + "the dimensions of their compartment. Thus the membrane " + "resistivity RM (ohms.m^2) is automatically scaled by the area " + "of the compartment, and the user does not need to insert this " + "scaling into the calculations to compute Rm." + "Using the Rm field lets the user directly assign the " + "membrane resistance (in ohms), presumably using len and dia.\n" + "Similarly, RA (ohms.m) and CM (Farads/m^2) are specific units " + "and the actual values for each compartment are assigned by " + "scaling by length and diameter. Ra (ohms) and Cm (Farads) " + "require explicit evaluation of the expression. " + "All parameters are expressed in SI units. Conductance, for " + "example, is Siemens/sq metre.\n" + "Note that time these calculations do NOT currently include spines\n", &Neuron::setPassiveDistribution, &Neuron::getPassiveDistribution - ); + ); static ElementValueFinfo< Neuron, vector< string > >spineDistribution( - "spineDistribution", - "Specification for distribution of spines on dendrite. \n" - "Arguments: proto path spacing expr [field expr]...\n" - " Each entry is terminated with an empty string. " - "The *prototype* is any spine object created in */library*, \n" - "The *path* is the wildcard path of compartments on which to " - "place the spine.\n" - "The *spacing* is the spacing of spines, in metres. \n" - "The *expression* argument is a mathematical expression in " - "the muparser framework, which permits most operations including " - "trig and transcendental ones. Of course it also handles simple " - "numerical values like 1.0, 1e-10 and so on. " - "The paired arguments are as follows: \n" - "The *field* argument specifies the name of the parameter " - "that is to be assigned by the expression.\n" - "The *expression* argument is a mathematical expression as above. " - "Available arguments for muParser are:\n" - " p, g, L, len, dia, maxP, maxG, maxL \n" - " p: path distance from soma, measured along dendrite, in metres.\n" - " g: geometrical distance from soma, in metres.\n" - " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n" - " len: length of compartment, in metres.\n" - " dia: for diameter of compartment, in metres.\n" - " maxP: Maximum value of *p* for this neuron. \n" - " maxG: Maximum value of *g* for this neuron. \n" - " maxL: Maximum value of *L* for this neuron.\n" - "The expression for the *spacing* field must evaluate to > 0 for " - "the spine to be installed. For example, if the expresssion is\n" - " H(1 - L) \n" - "then the system will only put spines closer than " - "one length constant from the soma, and zero elsewhere. \n" - "Available spine parameters are: \n" - "spacing, minSpacing, size, sizeDistrib " - "angle, angleDistrib \n" - "minSpacing sets the granularity of sampling (typically about 0.1*" - "spacing) for the usual case where spines are spaced randomly. " - "If minSpacing < 0 then the spines are spaced equally at " - "'spacing', unless the dendritic segment length is smaller than " - "'spacing'. In that case it falls back to the regular random " - "placement method.", + "spineDistribution", + "Specification for distribution of spines on dendrite. \n" + "Arguments: proto path spacing expr [field expr]...\n" + " Each entry is terminated with an empty string. " + "The *prototype* is any spine object created in */library*, \n" + "The *path* is the wildcard path of compartments on which to " + "place the spine.\n" + "The *spacing* is the spacing of spines, in metres. \n" + "The *expression* argument is a mathematical expression in " + "the muparser framework, which permits most operations including " + "trig and transcendental ones. Of course it also handles simple " + "numerical values like 1.0, 1e-10 and so on. " + "The paired arguments are as follows: \n" + "The *field* argument specifies the name of the parameter " + "that is to be assigned by the expression.\n" + "The *expression* argument is a mathematical expression as above. " + "Available arguments for muParser are:\n" + " p, g, L, len, dia, maxP, maxG, maxL \n" + " p: path distance from soma, measured along dendrite, in metres.\n" + " g: geometrical distance from soma, in metres.\n" + " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n" + " len: length of compartment, in metres.\n" + " dia: for diameter of compartment, in metres.\n" + " maxP: Maximum value of *p* for this neuron. \n" + " maxG: Maximum value of *g* for this neuron. \n" + " maxL: Maximum value of *L* for this neuron.\n" + "The expression for the *spacing* field must evaluate to > 0 for " + "the spine to be installed. For example, if the expresssion is\n" + " H(1 - L) \n" + "then the system will only put spines closer than " + "one length constant from the soma, and zero elsewhere. \n" + "Available spine parameters are: \n" + "spacing, minSpacing, size, sizeDistrib " + "angle, angleDistrib \n" + "minSpacing sets the granularity of sampling (typically about 0.1*" + "spacing) for the usual case where spines are spaced randomly. " + "If minSpacing < 0 then the spines are spaced equally at " + "'spacing', unless the dendritic segment length is smaller than " + "'spacing'. In that case it falls back to the regular random " + "placement method.", &Neuron::setSpineDistribution, &Neuron::getSpineDistribution - ); + ); static ReadOnlyValueFinfo< Neuron, unsigned int > numCompartments( - "numCompartments", - "Number of electrical compartments in model. ", - &Neuron::getNumCompartments - ); + "numCompartments", + "Number of electrical compartments in model. ", + &Neuron::getNumCompartments + ); static ReadOnlyValueFinfo< Neuron, unsigned int > numSpines( - "numSpines", - "Number of dendritic spines in model. ", - &Neuron::getNumSpines - ); + "numSpines", + "Number of dendritic spines in model. ", + &Neuron::getNumSpines + ); static ReadOnlyValueFinfo< Neuron, unsigned int > numBranches( - "numBranches", - "Number of branches in dendrites. ", - &Neuron::getNumBranches - ); + "numBranches", + "Number of branches in dendrites. ", + &Neuron::getNumBranches + ); static ReadOnlyValueFinfo< Neuron, vector< double > > pathDistFromSoma( - "pathDistanceFromSoma", - "geometrical path distance of each segment from soma, measured by " - "threading along the dendrite.", - &Neuron::getPathDistFromSoma - ); + "pathDistanceFromSoma", + "geometrical path distance of each segment from soma, measured by " + "threading along the dendrite.", + &Neuron::getPathDistFromSoma + ); static ReadOnlyValueFinfo< Neuron, vector< double > > geomDistFromSoma( - "geometricalDistanceFromSoma", - "geometrical distance of each segment from soma.", - &Neuron::getGeomDistFromSoma - ); + "geometricalDistanceFromSoma", + "geometrical distance of each segment from soma.", + &Neuron::getGeomDistFromSoma + ); static ReadOnlyValueFinfo< Neuron, vector< double > > elecDistFromSoma( - "electrotonicDistanceFromSoma", - "geometrical distance of each segment from soma, as measured along " - "the dendrite.", - &Neuron::getElecDistFromSoma - ); + "electrotonicDistanceFromSoma", + "geometrical distance of each segment from soma, as measured along " + "the dendrite.", + &Neuron::getElecDistFromSoma + ); static ReadOnlyValueFinfo< Neuron, vector< ObjId > > compartments( - "compartments", - "Vector of ObjIds of electrical compartments. Order matches order " - "of segments, and also matches the order of the electrotonic and " - "geometricalDistanceFromSoma vectors. ", - &Neuron::getCompartments - ); + "compartments", + "Vector of ObjIds of electrical compartments. Order matches order " + "of segments, and also matches the order of the electrotonic and " + "geometricalDistanceFromSoma vectors. ", + &Neuron::getCompartments + ); static ReadOnlyLookupElementValueFinfo< Neuron, string, vector< ObjId > > - compartmentsFromExpression( - "compartmentsFromExpression", - "Vector of ObjIds of electrical compartments that match the " - "'path expression' pair in the argument string.", - &Neuron::getExprElist - ); + compartmentsFromExpression( + "compartmentsFromExpression", + "Vector of ObjIds of electrical compartments that match the " + "'path expression' pair in the argument string.", + &Neuron::getExprElist + ); static ReadOnlyLookupElementValueFinfo< Neuron, string, vector< double > > - valuesFromExpression( - "valuesFromExpression", - "Vector of values computed for each electrical compartment that " - "matches the 'path expression' pair in the argument string." - "This has 13 times the number of entries as # of compartments." - "For each compartment the entries are: \n" - "val, p, g, L, len, dia, maxP, maxG, maxL, x, y, z, 0", - &Neuron::getExprVal - ); + valuesFromExpression( + "valuesFromExpression", + "Vector of values computed for each electrical compartment that " + "matches the 'path expression' pair in the argument string." + "This has 13 times the number of entries as # of compartments." + "For each compartment the entries are: \n" + "val, p, g, L, len, dia, maxP, maxG, maxL, x, y, z, 0", + &Neuron::getExprVal + ); static ReadOnlyLookupElementValueFinfo< Neuron, string, vector< ObjId > > - spinesFromExpression( - "spinesFromExpression", - //"Vector of ObjIds of spines/heads sitting on the electrical " - //"compartments that match the 'path expression' pair in the " - //"argument string.", - "Vector of ObjIds of compartments comprising spines/heads " - "that match the 'path expression' pair in the " - "argument string.", - &Neuron::getSpinesFromExpression - ); + spinesFromExpression( + "spinesFromExpression", + //"Vector of ObjIds of spines/heads sitting on the electrical " + //"compartments that match the 'path expression' pair in the " + //"argument string.", + "Vector of ObjIds of compartments comprising spines/heads " + "that match the 'path expression' pair in the " + "argument string.", + &Neuron::getSpinesFromExpression + ); static ReadOnlyLookupElementValueFinfo< Neuron, ObjId,vector< ObjId > > - spinesOnCompartment( - "spinesOnCompartment", - "Vector of ObjIds of spines shafts/heads sitting on the specified " - "electrical compartment. If each spine has a shaft and a head," - "and there are 10 spines on the compartment, there will be 20 " - "entries in the returned vector, ordered " - "shaft0, head0, shaft1, head1, ... ", - &Neuron::getSpinesOnCompartment - ); + spinesOnCompartment( + "spinesOnCompartment", + "Vector of ObjIds of spines shafts/heads sitting on the specified " + "electrical compartment. If each spine has a shaft and a head," + "and there are 10 spines on the compartment, there will be 20 " + "entries in the returned vector, ordered " + "shaft0, head0, shaft1, head1, ... ", + &Neuron::getSpinesOnCompartment + ); static ReadOnlyLookupElementValueFinfo< Neuron, ObjId, ObjId > - parentCompartmentOfSpine( - "parentCompartmentOfSpine", - "Returns parent compartment of specified spine compartment." - "Both the spine head or its shaft will return the same parent.", - &Neuron::getParentCompartmentOfSpine - ); + parentCompartmentOfSpine( + "parentCompartmentOfSpine", + "Returns parent compartment of specified spine compartment." + "Both the spine head or its shaft will return the same parent.", + &Neuron::getParentCompartmentOfSpine + ); static ReadOnlyLookupElementValueFinfo< Neuron, vector< ObjId >, vector< ObjId > > - spineIdsFromCompartmentIds( - "spineIdsFromCompartmentIds", - "Vector of ObjIds of spine entries (FieldElements on this Neuron, " - "used for scaling) that map to the the specified " - "electrical compartments. If a bad compartment Id is given, the" - "corresponding spine entry is the root Id.", - &Neuron::getSpineIdsFromCompartmentIds - ); + spineIdsFromCompartmentIds( + "spineIdsFromCompartmentIds", + "Vector of ObjIds of spine entries (FieldElements on this Neuron, " + "used for scaling) that map to the the specified " + "electrical compartments. If a bad compartment Id is given, the" + "corresponding spine entry is the root Id.", + &Neuron::getSpineIdsFromCompartmentIds + ); ///////////////////////////////////////////////////////////////////// // DestFinfos ///////////////////////////////////////////////////////////////////// static DestFinfo buildSegmentTree( "buildSegmentTree", - "Build the reference segment tree structure using the child " - "compartments of the current Neuron. Fills in all the coords and " - "length constant information into the segments, for later use " - "when we build reduced compartment trees and channel " - "distributions. Should only be called once, since subsequent use " - "on a reduced model will lose the original full cell geometry. ", - new EpFunc0< Neuron >( &Neuron::buildSegmentTree ) - ); + "Build the reference segment tree structure using the child " + "compartments of the current Neuron. Fills in all the coords and " + "length constant information into the segments, for later use " + "when we build reduced compartment trees and channel " + "distributions. Should only be called once, since subsequent use " + "on a reduced model will lose the original full cell geometry. ", + new EpFunc0< Neuron >( &Neuron::buildSegmentTree ) + ); static DestFinfo setSpineAndPsdMesh( "setSpineAndPsdMesh", - "Assigns the spine and psd mesh to the Neuron. This is used " - "to build up a mapping from Spine entries on the Neuron to " - "chem spines and PSDs, so that volume change operations from " - "the Spine can propagate to the chem systems.", - new OpFunc2< Neuron, Id, Id >( &Neuron::setSpineAndPsdMesh ) - ); + "Assigns the spine and psd mesh to the Neuron. This is used " + "to build up a mapping from Spine entries on the Neuron to " + "chem spines and PSDs, so that volume change operations from " + "the Spine can propagate to the chem systems.", + new OpFunc2< Neuron, Id, Id >( &Neuron::setSpineAndPsdMesh ) + ); static DestFinfo setSpineAndPsdDsolve( "setSpineAndPsdDsolve", - "Assigns the Dsolves used by spine and PSD to the Neuron. " - "This is used " - "to handle the rescaling of diffusion rates when spines are " - "resized. ", - new OpFunc2< Neuron, Id, Id >( &Neuron::setSpineAndPsdDsolve ) - ); + "Assigns the Dsolves used by spine and PSD to the Neuron. " + "This is used " + "to handle the rescaling of diffusion rates when spines are " + "resized. ", + new OpFunc2< Neuron, Id, Id >( &Neuron::setSpineAndPsdDsolve ) + ); /* static DestFinfo rotateInSpace( "rotateInSpace", diff --git a/moose-core/biophysics/ReadCell.cpp b/moose-core/biophysics/ReadCell.cpp index d900e5a34475822b9564113a226d1628cb70c527..50f2ef08b47745f61ff385bda8136164ff678c32 100644 --- a/moose-core/biophysics/ReadCell.cpp +++ b/moose-core/biophysics/ReadCell.cpp @@ -11,7 +11,6 @@ #include "../shell/Shell.h" #include "ReadCell.h" #include "../utility/utility.h" -#include "../utility/numutil.h" #include "CompartmentBase.h" #include "Compartment.h" #include "SymCompartment.h" diff --git a/moose-core/builtins/CMakeLists.txt b/moose-core/builtins/CMakeLists.txt index 8b96a98ede778da45649ed00f064ff603e95576e..9b4e63994ff122dab957b0bc498a18ae925b8a84 100644 --- a/moose-core/builtins/CMakeLists.txt +++ b/moose-core/builtins/CMakeLists.txt @@ -51,7 +51,7 @@ set(SRCS Arith.cpp Group.cpp Mstring.cpp - Func.cpp + MooseParser.cpp Function.cpp Variable.cpp InputVariable.cpp diff --git a/moose-core/builtins/Function.cpp b/moose-core/builtins/Function.cpp index 3883b699a618a7b2b1e26dcb0dd45cd6b3c7fc03..16ee175ead27092b7df78c1bd61bec0bbdcb6299 100644 --- a/moose-core/builtins/Function.cpp +++ b/moose-core/builtins/Function.cpp @@ -1,81 +1,39 @@ -// Function.cpp --- -// -// Filename: Function.cpp // Description: Implementation of a wrapper around muParser. // Author: Subhasis Ray // Maintainer: Subhasis Ray -// Created: Sat May 25 16:35:17 2013 (+0530) -// Version: -// Last-Updated: Tue Jun 11 16:49:01 2013 (+0530) -// By: subha -// Update #: 619 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// - -// Change log: -// -// -// -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 3, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program; see the file COPYING. If not, write to -// the Free Software Foundation, Inc., 51 Franklin Street, Fifth -// Floor, Boston, MA 02110-1301, USA. -// -// - -// Code: #include "../basecode/header.h" #include "../utility/utility.h" #include "../utility/numutil.h" -#include "Variable.h" +#include "../utility/print_function.hpp" +#include "../builtins/MooseParser.h" +#include "Variable.h" #include "Function.h" -#include "../basecode/ElementValueFinfo.h" - -#define PARSER_MAXVARS 100 +#include "../basecode/ElementValueFinfo.h" static const double TriggerThreshold = 0.0; static SrcFinfo1<double> *valueOut() { static SrcFinfo1<double> valueOut("valueOut", - "Evaluated value of the function for the current variable values."); + "Evaluated value of the function for the current variable values." + ); return &valueOut; } static SrcFinfo1< double > *derivativeOut() { static SrcFinfo1< double > derivativeOut("derivativeOut", - "Value of derivative of the function for the current variable values"); + "Value of derivative of the function for the current variable values"); return &derivativeOut; } static SrcFinfo1< double > *rateOut() { static SrcFinfo1< double > rateOut("rateOut", - "Value of time-derivative of the function for the current variable values"); + "Value of time-derivative of the function for the current variable values"); return &rateOut; } @@ -123,19 +81,19 @@ const Cinfo * Function::initCinfo() static ValueFinfo< Function, bool > useTrigger( "useTrigger", "When *false*, disables event-driven calculation and turns on " - "Process-driven calculations. \n" + "Process-driven calculations. \n" "When *true*, enables event-driven calculation and turns off " - "Process-driven calculations. \n" - "Defaults to *false*. \n", + "Process-driven calculations. \n" + "Defaults to *false*. \n", &Function::setUseTrigger, &Function::getUseTrigger); static ValueFinfo< Function, bool > doEvalAtReinit( "doEvalAtReinit", "When *false*, disables function evaluation at reinit, and " - "just emits a value of zero to any message targets. \n" + "just emits a value of zero to any message targets. \n" "When *true*, does a function evaluation at reinit and sends " - "the computed value to any message targets. \n" - "Defaults to *false*. \n", + "the computed value to any message targets. \n" + "Defaults to *false*. \n", &Function::setDoEvalAtReinit, &Function::getDoEvalAtReinit); static ElementValueFinfo< Function, string > expr( @@ -170,8 +128,9 @@ const Cinfo * Function::initCinfo() "max var. max of all arguments\n" "sum var. sum of all arguments\n" "avg var. mean value of all arguments\n" + "rnd 0 rand(), random float between 0 and 1, honors global moose.seed.\n" "rand 1 rand(seed), random float between 0 and 1, \n" - " if seed = -1, then a 'random' seed is created.\n" + " if seed = -1, then a 'random' seed is used.\n" "rand2 3 rand(a, b, seed), random float between a and b, \n" " if seed = -1, a 'random' seed is created using either\n" " by random_device or by reading system clock\n" @@ -253,64 +212,64 @@ const Cinfo * Function::initCinfo() "time, thread, dt and so on. The second entry is a MsgDest " "for the Reinit operation. It also uses ProcInfo. ", processShared, sizeof( processShared ) / sizeof( Finfo* ) - ); - /* - static DestFinfo trigger( "trigger", - "Handles trigger input. Argument is timestamp of event. This is " - "compatible with spike events as well as chemical ones. ", - new OpFunc1< Function, double >( &Function::trigger ) ); - */ + ); + /* + static DestFinfo trigger( "trigger", + "Handles trigger input. Argument is timestamp of event. This is " + "compatible with spike events as well as chemical ones. ", + new OpFunc1< Function, double >( &Function::trigger ) ); + */ static Finfo *functionFinfos[] = - { - &value, - &rate, - &derivative, - &mode, - &useTrigger, - &doEvalAtReinit, - &expr, - &numVars, - &inputs, - &constants, - &independent, - &proc, - requestOut(), - valueOut(), - rateOut(), - derivativeOut(), - }; + { + &value, + &rate, + &derivative, + &mode, + &useTrigger, + &doEvalAtReinit, + &expr, + &numVars, + &inputs, + &constants, + &independent, + &proc, + requestOut(), + valueOut(), + rateOut(), + derivativeOut(), + }; static string doc[] = - { - "Name", "Function", - "Author", "Subhasis Ray", - "Description", - "General purpose function calculator using real numbers.\n" - "It can parse mathematical expression defining a function and evaluate" - " it and/or its derivative for specified variable values." - "You can assign expressions of the form::\n" - "\n" - "f(c0, c1, ..., cM, x0, x1, ..., xN, y0,..., yP ) \n" - "\n" - " where `ci`'s are constants and `xi`'s and `yi`'s are variables." - - "The constants must be defined before setting the expression and" - " variables are connected via messages. The constants can have any" - " name, but the variable names must be of the form x{i} or y{i}" - " where i is increasing integer starting from 0.\n" - " The variables can be input from other moose objects." - " Such variables must be named `x{i}` in the expression and the source" - " field is connected to Function.x[i]'s `input` destination field.\n" - " In case the input variable is not available as a source field, but is" - " a value field, then the value can be requested by connecting the" - " `requestOut` message to the `get{Field}` destination on the target" - " object. Such variables must be specified in the expression as y{i}" - " and connecting the messages should happen in the same order as the" - " y indices.\n" - " This class handles only real numbers (C-double). Predefined constants" - " are: pi=3.141592..., e=2.718281..." - }; + { + "Name", "Function", + "Author", "Subhasis Ray", + "Description", + "General purpose function calculator using real numbers.\n" + "It can parse mathematical expression defining a function and evaluate" + " it and/or its derivative for specified variable values." + "You can assign expressions of the form::\n" + "\n" + "f(c0, c1, ..., cM, x0, x1, ..., xN, y0,..., yP ) \n" + "\n" + " where `ci`'s are constants and `xi`'s and `yi`'s are variables." + + "The constants must be defined before setting the expression and" + " variables are connected via messages. The constants can have any" + " name, but the variable names must be of the form x{i} or y{i}" + " where i is increasing integer starting from 0.\n" + " The variables can be input from other moose objects." + " Such variables must be named `x{i}` in the expression and the source" + " field is connected to Function.x[i]'s `input` destination field.\n" + " In case the input variable is not available as a source field, but is" + " a value field, then the value can be requested by connecting the" + " `requestOut` message to the `get{Field}` destination on the target" + " object. Such variables must be specified in the expression as y{i}" + " and connecting the messages should happen in the same order as the" + " y indices.\n" + " This class handles only real numbers (C-double). Predefined constants" + " are: pi=3.141592..., e=2.718281..." + }; static Dinfo< Function > dinfo; static Cinfo functionCinfo("Function", @@ -335,9 +294,12 @@ Function::Function(): _t(0.0), _valid(false), _numVar(0), _lastValue(0.0), //extendMuParser( ); // Adding this default expression by default to avoid complains from GUI - try{ + try + { _parser.SetExpr("0"); - } catch (mu::Parser::exception_type &e) { + } + catch (moose::Parser::exception_type &e) + { _showError(e); _clearBuffer(); return; @@ -345,12 +307,13 @@ Function::Function(): _t(0.0), _valid(false), _numVar(0), _lastValue(0.0), _valid = true; } -Function::Function(const Function& rhs): _numVar(rhs._numVar), +Function::Function(const Function& rhs): + _numVar(rhs._numVar), _lastValue(rhs._lastValue), _value(rhs._value), _rate(rhs._rate), _mode(rhs._mode), _useTrigger( rhs._useTrigger), - _stoich(0) + _stoich(nullptr) { static Eref er; _independent = rhs._independent; @@ -359,10 +322,12 @@ Function::Function(const Function& rhs): _numVar(rhs._numVar), //extendMuParser( ); // Copy the constants - mu::valmap_type cmap = rhs._parser.GetConst(); - if (cmap.size()){ - mu::valmap_type::const_iterator item = cmap.begin(); - for (; item!=cmap.end(); ++item){ + moose::Parser::valmap_type cmap = rhs._parser.GetConst(); + if (cmap.size()) + { + moose::Parser::valmap_type::const_iterator item = cmap.begin(); + for (; item!=cmap.end(); ++item) + { _parser.DefineConst(item->first, item->second); } } @@ -371,11 +336,13 @@ Function::Function(const Function& rhs): _numVar(rhs._numVar), setExpr(er, rhs.getExpr( er )); // Copy the values from the var pointers in rhs assert(_varbuf.size() == rhs._varbuf.size()); - for (unsigned int ii = 0; ii < rhs._varbuf.size(); ++ii){ + for (unsigned int ii = 0; ii < rhs._varbuf.size(); ++ii) + { _varbuf[ii]->value = rhs._varbuf[ii]->value; } assert(_pullbuf.size() == rhs._pullbuf.size()); - for (unsigned int ii = 0; ii < rhs._pullbuf.size(); ++ii){ + for (unsigned int ii = 0; ii < rhs._pullbuf.size(); ++ii) + { *_pullbuf[ii] = *(rhs._pullbuf[ii]); } } @@ -390,24 +357,28 @@ Function& Function::operator=(const Function rhs) _rate = rhs._rate; _independent = rhs._independent; // Adding pi and e, the defaults are `_pi` and `_e` - _parser.DefineConst(_T("pi"), (mu::value_type)M_PI); - _parser.DefineConst(_T("e"), (mu::value_type)M_E); + _parser.DefineConst(_T("pi"), (moose::Parser::value_type)M_PI); + _parser.DefineConst(_T("e"), (moose::Parser::value_type)M_E); // Copy the constants - mu::valmap_type cmap = rhs._parser.GetConst(); - if (cmap.size()){ - mu::valmap_type::const_iterator item = cmap.begin(); - for (; item!=cmap.end(); ++item){ + moose::Parser::valmap_type cmap = rhs._parser.GetConst(); + if (cmap.size()) + { + moose::Parser::valmap_type::const_iterator item = cmap.begin(); + for (; item!=cmap.end(); ++item) + { _parser.DefineConst(item->first, item->second); } } // Copy the values from the var pointers in rhs setExpr(er, rhs.getExpr( er )); assert(_varbuf.size() == rhs._varbuf.size()); - for (unsigned int ii = 0; ii < rhs._varbuf.size(); ++ii){ + for (unsigned int ii = 0; ii < rhs._varbuf.size(); ++ii) + { _varbuf[ii]->value = rhs._varbuf[ii]->value; } assert(_pullbuf.size() == rhs._pullbuf.size()); - for (unsigned int ii = 0; ii < rhs._pullbuf.size(); ++ii){ + for (unsigned int ii = 0; ii < rhs._pullbuf.size(); ++ii) + { *_pullbuf[ii] = *(rhs._pullbuf[ii]); } return *this; @@ -415,8 +386,8 @@ Function& Function::operator=(const Function rhs) Function::~Function() { - _clearBuffer(); - } + _clearBuffer(); +} // do not know what to do about Variables that have already been // connected by message. @@ -424,28 +395,28 @@ void Function::_clearBuffer() { _numVar = 0; _parser.ClearVar(); - for (unsigned int ii = 0; ii < _varbuf.size(); ++ii){ - if ( _varbuf[ii] ){ + for (unsigned int ii = 0; ii < _varbuf.size(); ++ii) + { + if ( _varbuf[ii] ) + { delete _varbuf[ii]; } } _varbuf.clear(); - for (unsigned int ii = 0; ii < _pullbuf.size(); ++ii){ - if ( _pullbuf[ii] ){ + for (unsigned int ii = 0; ii < _pullbuf.size(); ++ii) + { + if ( _pullbuf[ii] ) + { delete _pullbuf[ii]; } } _pullbuf.clear(); } -void Function::_showError(mu::Parser::exception_type &e) const +void Function::_showError(moose::Parser::exception_type &e) const { - cout << "Error occurred in parser.\n" - << "Message: " << e.GetMsg() << "\n" - << "Formula: " << e.GetExpr() << "\n" - << "Token: " << e.GetToken() << "\n" - << "Position: " << e.GetPos() << "\n" - << "Error code: " << e.GetCode() << endl; + cerr << "Error occurred in parser.\n" + << "Message: " << e.GetMsg() << endl; } /** @@ -474,27 +445,33 @@ double * _functionAddVar(const char *name, void *data) string strname(name); // Names starting with x are variables, everything else is constant. - if (strname[0] == 'x') + if (name[0] == 'x') { int index = atoi(strname.substr(1).c_str()); - if ((unsigned)index >= function->_varbuf.size()){ + if ((unsigned)index >= function->_varbuf.size()) + { function->_varbuf.resize(index+1, 0); - for (int ii = 0; ii <= index; ++ii){ - if (function->_varbuf[ii] == 0){ + for (int ii = 0; ii <= index; ++ii) + { + if (function->_varbuf[ii] == 0) + { function->_varbuf[ii] = new Variable(); } } function->_numVar = function->_varbuf.size(); } ret = &(function->_varbuf[index]->value); - } - else if (strname[0] == 'y') + } + else if (name[0] == 'y') { int index = atoi(strname.substr(1).c_str()); - if ((unsigned)index >= function->_pullbuf.size()){ + if ((unsigned)index >= function->_pullbuf.size()) + { function->_pullbuf.resize(index+1, 0 ); - for (int ii = 0; ii <= index; ++ii){ - if (function->_pullbuf[ii] == 0){ + for (int ii = 0; ii <= index; ++ii) + { + if (function->_pullbuf[ii] == 0) + { function->_pullbuf[ii] = new double(); } } @@ -505,14 +482,14 @@ double * _functionAddVar(const char *name, void *data) { ret = &function->_t; } - else + else { - cerr << "Got an undefined symbol: " << name << endl - << "Variables must be named xi, yi, where i is integer index." - << " You must define the constants beforehand using LookupField c: c[name]" - " = value" - << endl; - throw mu::ParserError("Undefined constant."); + MOOSE_WARN( "Got an undefined symbol: " << strname << ".\n" + << "Variables must be named xi, yi, where i is integer index." + << " You must define the constants beforehand using LookupField c: c[name]" + " = value" + ); + throw moose::Parser::exception_type("Undefined constant."); } return ret; @@ -549,10 +526,13 @@ void Function::innerSetExpr(const Eref& eref, string expr) _clearBuffer(); _varbuf.resize(_numVar); // _pullbuf.resize(_num - mu::varmap_type vars; - try{ + moose::Parser::varmap_type vars; + try + { _parser.SetExpr(expr); - } catch (mu::Parser::exception_type &e) { + } + catch (moose::Parser::exception_type &e) + { cerr << "Error setting expression on: " << eref.objId().path() << endl; _showError(e); _clearBuffer(); @@ -560,17 +540,21 @@ void Function::innerSetExpr(const Eref& eref, string expr) } // Force variable creation right away. Otherwise numVar does not // get set properly - try{ + try + { _parser.Eval(); _valid = true; - } catch (mu::Parser::exception_type &e){ + } + catch (moose::Parser::exception_type &e) + { _showError(e); } } string Function::getExpr( const Eref& e ) const { - if (!_valid){ + if (!_valid) + { cout << "Error: " << e.objId().path() << "::getExpr() - invalid parser state" << endl; return ""; } @@ -610,13 +594,17 @@ bool Function::getDoEvalAtReinit() const double Function::getValue() const { double value = 0.0; - if (!_valid){ + if (!_valid) + { cout << "Error: Function::getValue() - invalid state" << endl; return value; } - try{ + try + { value = _parser.Eval(); - } catch (mu::Parser::exception_type &e){ + } + catch (moose::Parser::exception_type &e) + { _showError(e); } return value; @@ -624,7 +612,8 @@ double Function::getValue() const double Function::getRate() const { - if (!_valid){ + if (!_valid) + { cout << "Error: Function::getValue() - invalid state" << endl; } return _rate; @@ -643,7 +632,8 @@ string Function::getIndependent() const vector< double > Function::getY() const { vector < double > ret(_pullbuf.size()); - for (unsigned int ii = 0; ii < ret.size(); ++ii){ + for (unsigned int ii = 0; ii < ret.size(); ++ii) + { ret[ii] = *_pullbuf[ii]; } return ret; @@ -652,16 +642,21 @@ vector< double > Function::getY() const double Function::getDerivative() const { double value = 0.0; - if (!_valid){ + if (!_valid) + { cout << "Error: Function::getDerivative() - invalid state" << endl; return value; } - mu::varmap_type variables = _parser.GetVar(); - mu::varmap_type::const_iterator item = variables.find(_independent); - if (item != variables.end()){ - try{ + moose::Parser::varmap_type variables = _parser.GetVar(); + moose::Parser::varmap_type::const_iterator item = variables.find(_independent); + if (item != variables.end()) + { + try + { value = _parser.Diff(item->second, *(item->second)); - } catch (mu::Parser::exception_type &e){ + } + catch (moose::Parser::exception_type &e) + { _showError(e); } } @@ -682,10 +677,13 @@ unsigned int Function::getNumVar() const void Function::setVar(unsigned int index, double value) { - cout << "varbuf[" << index << "]->setValue(" << value << ")\n"; - if (index < _varbuf.size()){ + cout << "varbuf[" << index << "]->setValue(" << value << ")\n"; + if (index < _varbuf.size()) + { _varbuf[index]->setValue(value); - } else { + } + else + { cerr << "Function: index " << index << " out of bounds." << endl; } } @@ -693,7 +691,8 @@ void Function::setVar(unsigned int index, double value) Variable * Function::getVar(unsigned int ii) { static Variable dummy; - if ( ii < _varbuf.size()){ + if ( ii < _varbuf.size()) + { return _varbuf[ii]; } cout << "Warning: Function::getVar: index: " @@ -709,105 +708,114 @@ void Function::setConst(string name, double value) double Function::getConst(string name) const { - mu::valmap_type cmap = _parser.GetConst(); - if (cmap.size()){ - mu::valmap_type::const_iterator it = cmap.find(name); - if (it != cmap.end()){ + auto cmap = _parser.GetConst(); + if (cmap.size()) + { + auto it = cmap.find(name); + if (it != cmap.end()) return it->second; - } } return 0; } void Function::process(const Eref &e, ProcPtr p) { - if (!_valid){ + if (!_valid) + { return; } vector < double > databuf; requestOut()->send(e, &databuf); for (unsigned int ii = 0; - (ii < databuf.size()) && (ii < _pullbuf.size()); - ++ii){ + (ii < databuf.size()) && (ii < _pullbuf.size()); + ++ii) + { *_pullbuf[ii] = databuf[ii]; } _t = p->currTime; _value = getValue(); _rate = (_value - _lastValue) / p->dt; - if ( _useTrigger && _value < TriggerThreshold ) { - _lastValue = _value; - return; - } - switch (_mode){ - case 1: { - valueOut()->send(e, _value); - break; - } - case 2: { - derivativeOut()->send(e, getDerivative()); - break; - } - case 3: { - rateOut()->send(e, _rate); - break; - } - default: { - valueOut()->send(e, _value); - derivativeOut()->send(e, getDerivative()); - rateOut()->send(e, _rate); - break; - } + if ( _useTrigger && _value < TriggerThreshold ) + { + _lastValue = _value; + return; + } + switch (_mode) + { + case 1: + { + valueOut()->send(e, _value); + return; + } + case 2: + { + derivativeOut()->send(e, getDerivative()); + return; + } + case 3: + { + rateOut()->send(e, _rate); + return; + } + default: + { + valueOut()->send(e, _value); + derivativeOut()->send(e, getDerivative()); + rateOut()->send(e, _rate); + return; + } } _lastValue = _value; } void Function::reinit(const Eref &e, ProcPtr p) { - if (!_valid){ + if (!_valid) + { cout << "Error: Function::reinit() - invalid parser state. Will do nothing." << endl; return; } - if (moose::trim(_parser.GetExpr(), " \t\n\r").length() == 0){ + if (moose::trim(_parser.GetExpr(), " \t\n\r").length() == 0) + { cout << "Error: no expression set. Will do nothing." << endl; setExpr(e, "0.0"); _valid = false; } _t = p->currTime; - if (_doEvalAtReinit) { - _lastValue = _value = getValue(); - } else { - _lastValue = _value = 0.0; - } + if (_doEvalAtReinit) + { + _lastValue = _value = getValue(); + } + else + { + _lastValue = _value = 0.0; + } _rate = 0.0; - switch (_mode){ - case 1: { - valueOut()->send(e, _value); - break; - } - case 2: { - derivativeOut()->send(e, 0.0); - break; - } - case 3: { - rateOut()->send(e, _rate); - break; - } - default: { - valueOut()->send(e, _value); - derivativeOut()->send(e, 0.0); - rateOut()->send(e, _rate); - break; - } + switch (_mode) + { + case 1: + { + valueOut()->send(e, _value); + break; + } + case 2: + { + derivativeOut()->send(e, 0.0); + break; + } + case 3: + { + rateOut()->send(e, _rate); + break; + } + default: + { + valueOut()->send(e, _value); + derivativeOut()->send(e, 0.0); + rateOut()->send(e, _rate); + break; + } } } -#if 0 -mu::value_type Function::muCallbackFMod( mu::value_type a, mu::value_type b) -{ - cerr << "Callback: " << a << " " << b << endl; - return fmod(a, b); -} -#endif - -// // Function.cpp ends here diff --git a/moose-core/builtins/Function.h b/moose-core/builtins/Function.h index 6a9fff3f0ebd8f2cfac2456f50ef9808f0e5a890..8834b51ced8d1c2a756dd5e0d61333496c134c66 100644 --- a/moose-core/builtins/Function.h +++ b/moose-core/builtins/Function.h @@ -1,54 +1,9 @@ -// Function.h --- -// -// Filename: Function.h // Description: // Author: Subhasis Ray -// Maintainer: -// Created: Fri May 30 19:34:13 2014 (+0530) -// Version: -// Last-Updated: -// By: -// Update #: 0 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// A new version of Func with FieldElements to collect data. -// -// - -// Change log: -// -// -// -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 3, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; see the file COPYING. If not, write to -// the Free Software Foundation, Inc., 51 Franklin Street, Fifth -// Floor, Boston, MA 02110-1301, USA. -// -// - -// Code: #ifndef _MOOSE_FUNCTION_H_ #define _MOOSE_FUNCTION_H_ -#include "../external/muparser/include/muParser.h" /** Simple function parser and evaluator for MOOSE. This can take a mathematical @@ -59,7 +14,7 @@ double *_functionAddVar(const char *name, void *data); class Function { - public: +public: static const int VARMAX; Function(); Function(const Function& rhs); @@ -68,7 +23,6 @@ class Function void setExpr( const Eref& e, string expr); string getExpr( const Eref& e ) const; - // get a list of variable identifiers. // this is created by the parser vector<string> getVars() const; @@ -88,11 +42,11 @@ class Function void setMode(unsigned int mode); unsigned int getMode() const; - // set/get flag to use trigger mode. + // set/get flag to use trigger mode. void setUseTrigger(bool useTrigger); bool getUseTrigger() const; - // set/get flag to do function evaluation at reinit + // set/get flag to do function evaluation at reinit void setDoEvalAtReinit(bool doEvalAtReinit); bool getDoEvalAtReinit() const; @@ -109,24 +63,6 @@ class Function double getDerivative() const; -#if 0 - /** - * @brief Extend standard muparser library. This add some binary operators - * and user-defined functions. - */ - void extendMuParser( void ); - - /** - * @brief callback function for floating point mod-operator. - * - * @param a double - * @param b double - * - * @return double using std::fmod(a, b) - */ - static mu::value_type muCallbackFMod( mu::value_type a, mu::value_type b ); -#endif - Function& operator=(const Function rhs); unsigned int addVar(); @@ -159,18 +95,13 @@ protected: map< string, double *> _constbuf; // for constants string _independent; // index of independent variable - mu::Parser _parser; + MooseParser _parser; void _clearBuffer(); - void _showError(mu::Parser::exception_type &e) const; + void _showError(moose::Parser::exception_type &e) const; // Used by kinetic solvers when this is zombified. char* _stoich; }; - #endif - - -// -//// Function.h ends here_parser.DefineVar( _T("t"), diff --git a/moose-core/builtins/HDF5DataWriter.cpp b/moose-core/builtins/HDF5DataWriter.cpp index 72e43af9ed9b9bc5037db4ec78a3c671585b4539..5f7ba3b93dc99848d9957252dbc31f63665f7f32 100644 --- a/moose-core/builtins/HDF5DataWriter.cpp +++ b/moose-core/builtins/HDF5DataWriter.cpp @@ -12,7 +12,7 @@ #include "hdf5.h" -#include "header.h" +#include "../basecode/header.h" #include "../utility/utility.h" #include "HDF5DataWriter.h" diff --git a/moose-core/builtins/HDF5WriterBase.cpp b/moose-core/builtins/HDF5WriterBase.cpp index 747a2d8dd76bd134ef37fde2380ab5bed7bcc88e..8e423524439a08d1512b3ff8439ca41299081f58 100644 --- a/moose-core/builtins/HDF5WriterBase.cpp +++ b/moose-core/builtins/HDF5WriterBase.cpp @@ -36,7 +36,7 @@ #include "hdf5.h" -#include "header.h" +#include "../basecode/header.h" #include "../utility/utility.h" #include "HDF5WriterBase.h" diff --git a/moose-core/builtins/InputVariable.cpp b/moose-core/builtins/InputVariable.cpp index b1d47d63a0f6111e32c28f337af93146b5435656..ac018da26dc16139ece178342b0ca2af2e840c74 100644 --- a/moose-core/builtins/InputVariable.cpp +++ b/moose-core/builtins/InputVariable.cpp @@ -46,7 +46,7 @@ // Code: #ifdef USE_HDF5 -#include "header.h" +#include "../basecode/header.h" #include "hdf5.h" #include "NSDFWriter.h" diff --git a/moose-core/builtins/MooseParser.cpp b/moose-core/builtins/MooseParser.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b8cdcb74faa6897a15523b9e69552447524705fe --- /dev/null +++ b/moose-core/builtins/MooseParser.cpp @@ -0,0 +1,18 @@ +/*** + * Description: Class MooseParser. + * + * Created: 2019-05-30 + + * Author: Dilawar Singh <dilawars@ncbs.res.in> + * Organization: NCBS Bangalore + * License: MIT License + */ + +#include "MooseParser.h" + +MooseParser::MooseParser() +{} + +MooseParser::~MooseParser() +{} + diff --git a/moose-core/builtins/MooseParser.h b/moose-core/builtins/MooseParser.h new file mode 100644 index 0000000000000000000000000000000000000000..cea2c0ae9ff0c2bfa3e5f589c6190f1d3f740bae --- /dev/null +++ b/moose-core/builtins/MooseParser.h @@ -0,0 +1,56 @@ +/*** + * Description: MooseParser class. + * + * Created: 2019-05-30 + + * Author: Dilawar Singh <dilawars@ncbs.res.in> + * Organization: NCBS Bangalore + * License: MIT License + */ + +#ifndef MOOSEPARSER_H +#define MOOSEPARSER_H + +#include <map> +using namespace std; + +#include "../external/muparser/include/muParser.h" + +namespace moose { + namespace Parser { + + struct ParserException : public std::exception + { + ParserException( const std::string msg ) : msg_(msg) { ; } + + string GetMsg() + { + return msg_; + } + + string msg_; + }; + + typedef ParserException exception_type; + + + // These should be same for both muparser and EXPRTK parser. + typedef std::map<string, double> valmap_type; + typedef std::map<string, double*> varmap_type; + typedef double value_type; + + } // namespace Parser + +} // namespace moose + +class MooseParser : public mu::Parser +{ + public: + MooseParser(); + ~MooseParser(); + + private: + /* data */ +}; + +#endif /* end of include guard: MOOSEPARSER_H */ diff --git a/moose-core/builtins/NSDFWriter.cpp b/moose-core/builtins/NSDFWriter.cpp index 1e30dc4d35f4dccc40cee214df2ed0ef52abfa56..16cd787b22090f31e32eb9ae61e0f8f74b6e2bcd 100644 --- a/moose-core/builtins/NSDFWriter.cpp +++ b/moose-core/builtins/NSDFWriter.cpp @@ -52,7 +52,7 @@ #include <ctime> #include <deque> -#include "header.h" +#include "../basecode/header.h" #include "../utility/utility.h" #include "HDF5WriterBase.h" diff --git a/moose-core/builtins/Table.cpp b/moose-core/builtins/Table.cpp index be3702b13cb3cc46b569af8fc4b319d32dbd6268..4721cf05b07a1a4548864975e861ed1e8208445c 100644 --- a/moose-core/builtins/Table.cpp +++ b/moose-core/builtins/Table.cpp @@ -16,10 +16,6 @@ #include "../scheduling/Clock.h" #include "StreamerBase.h" -// Write to numpy arrays. -#include "../utility/cnpy.hpp" - - static SrcFinfo1< vector< double >* > *requestOut() { static SrcFinfo1< vector< double >* > requestOut( @@ -63,7 +59,7 @@ const Cinfo* Table::initCinfo() "useSpikeMode" , "When set to true, look for spikes in a time-series." " Normally used for monitoring Vm for action potentials." - " Could be used for any thresholded event. Default is False." + " Could be used for any thresholded event. Default is False." , &Table::setUseSpikeMode , &Table::getUseSpikeMode ); @@ -211,8 +207,8 @@ const Cinfo* Table::initCinfo() static const Cinfo* tableCinfo = Table::initCinfo(); Table::Table() : - threshold_( 0.0 ) , - lastTime_( 0.0 ) , + threshold_( 0.0 ), + lastTime_( 0.0 ), input_( 0.0 ), fired_(false), useSpikeMode_(false), @@ -258,7 +254,7 @@ void Table::process( const Eref& e, ProcPtr p ) if (useSpikeMode_) { - for ( vector< double >::const_iterator i = ret.begin(); i != ret.end(); ++i ) + for ( auto i = ret.begin(); i != ret.end(); ++i ) spike( *i ); } else @@ -270,14 +266,14 @@ void Table::process( const Eref& e, ProcPtr p ) */ if( useFileStreamer_ ) { - if( fmod(lastTime_, 5.0) == 0.0 or getVecSize() >= 10000 ) + if( fmod(lastTime_, 5.0) == 0.0 || getVecSize() >= 10000 ) { mergeWithTime( data_ ); - StreamerBase::writeToOutFile( outfile_, format_ , "a", data_, columns_ ); + StreamerBase::writeToOutFile( outfile_, format_, "a", data_, columns_ ); clearAllVecs(); } + } } -} void Table::clearAllVecs() { @@ -297,8 +293,9 @@ void Table::reinit( const Eref& e, ProcPtr p ) tablePath_ = e.id().path(); unsigned int numTick = e.element()->getTick(); Clock* clk = reinterpret_cast<Clock*>(Id(1).eref().data()); + dt_ = clk->getTickDt( numTick ); - fired_ = false; + fired_ = false; /** Create the default filepath for this table. */ if( useFileStreamer_ ) @@ -312,8 +309,8 @@ void Table::reinit( const Eref& e, ProcPtr p ) // with rootdit as path. if( ! outfileIsSet_ ) setOutfile( rootdir_ + - moose::moosePathToUserPath(tablePath_) + '.' + format_ - ); + moose::moosePathToUserPath(tablePath_) + '.' + format_ + ); } input_ = 0.0; @@ -324,7 +321,7 @@ void Table::reinit( const Eref& e, ProcPtr p ) if (useSpikeMode_) { - for (vector<double>::const_iterator i = ret.begin(); i != ret.end(); ++i ) + for ( auto i = ret.begin(); i != ret.end(); ++i ) spike( *i ); } else @@ -369,8 +366,6 @@ void Table::spike( double v ) ////////////////////////////////////////////////////////////// // Field Definitions -////////////////////////////////////////////////////////////// - void Table::setThreshold( double v ) { threshold_ = v; @@ -384,12 +379,12 @@ double Table::getThreshold() const // Set the format of table to which its data should be written. void Table::setFormat( string format ) { - if( format == "csv" or format == "npy" ) + if( format == "csv" ) format_ = format; else LOG( moose::warning - , "Unsupported format " << format - << " only npy and csv are supported" + , "Unsupported format " << format + << " only sv is supported" ); } diff --git a/moose-core/builtins/Variable.cpp b/moose-core/builtins/Variable.cpp index 6233e24853dba9217b6a1a96c0538e059732688f..e68e08ed0e6424b02847987747a4db6f93afbaba 100644 --- a/moose-core/builtins/Variable.cpp +++ b/moose-core/builtins/Variable.cpp @@ -1,51 +1,10 @@ -// Variable.cpp --- -// -// Filename: Variable.cpp // Description: // Author: Subhasis Ray // Maintainer: // Created: Fri May 30 19:56:06 2014 (+0530) -// Version: -// Last-Updated: -// By: -// Update #: 0 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// - -// Change log: -// -// -// -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 3, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; see the file COPYING. If not, write to -// the Free Software Foundation, Inc., 51 Franklin Street, Fifth -// Floor, Boston, MA 02110-1301, USA. -// -// - -// Code: #include "../basecode/header.h" +#include "MooseParser.h" #include "Variable.h" #include "Function.h" @@ -56,21 +15,26 @@ const Cinfo * Variable::initCinfo() "Variable value", &Variable::setValue, &Variable::getValue); + static DestFinfo input( "input", "Handles incoming variable value.", new EpFunc1< Variable, double >( &Variable::epSetValue )); - static Finfo * variableFinfos[] = { + static Finfo * variableFinfos[] = + { &value, &input }; - static string doc[] = { + static string doc[] = + { "Name", "Variable", "Author", "Subhasis Ray", "Description", "Variable for storing double values. This is used in Function class." }; + static Dinfo< Variable > dinfo; + static Cinfo variableCinfo("Variable", Neutral::initCinfo(), variableFinfos, @@ -79,41 +43,10 @@ const Cinfo * Variable::initCinfo() doc, sizeof(doc) / sizeof(string), true // is FieldElement, not to be created directly - ); + ); + return & variableCinfo; } static const Cinfo * variableCinfo = Variable::initCinfo(); -// This imitates Synapse::addMsgCallback -// but does not seem to be used anywhere -// - Subha, Tue Sep 9 19:37:11 IST 2014 - -void Variable::addMsgCallback(const Eref& e, const string& finfoName, ObjId msg, unsigned int msgLookup) -{ - /* - if (finfoName == "input"){ - ObjId pa = Neutral::parent(e); - Function * fn = reinterpret_cast< Function *>(pa.data()); - unsigned int varNumber = fn->addVar(); - SetGet2<unsigned int, unsigned int>::set(msg, "fieldIndex", msgLookup, varNumber); - } - */ -} - -// // This imitates Synapse::dropMsgCallback -// void Variable::dropMsgCallback( -// const Eref& e, const string& finfoName, -// ObjId msg, unsigned int msgLookup ) -// { -// if ( finfoName == "input" ) { -// ObjId pa = Neutral::parent( e ); -// SynHandlerBase* sh = -// reinterpret_cast< Function* >( pa.data() ); -// sh->dropVar( msgLookup ); -// } -// } - - -// -// Variable.cpp ends here diff --git a/moose-core/builtins/testNSDF.cpp b/moose-core/builtins/testNSDF.cpp index 86e1f96f04746ceef3930f771dfec5603679884f..9c40f8ec7380b4782176ca2a0dd19dd5e7e61b22 100644 --- a/moose-core/builtins/testNSDF.cpp +++ b/moose-core/builtins/testNSDF.cpp @@ -54,7 +54,7 @@ #include <deque> #include <cstdio> -#include "header.h" +#include "../basecode/header.h" #include "../utility/utility.h" #include "HDF5WriterBase.h" diff --git a/moose-core/diffusion/CMakeLists.txt b/moose-core/diffusion/CMakeLists.txt index 95c1ebf0fdecf799a88a7c235db02254db015021..7a0509b7c65671e3631b2ef3c58d01b4f6d9bce3 100644 --- a/moose-core/diffusion/CMakeLists.txt +++ b/moose-core/diffusion/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required(VERSION 2.8) include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) -include_directories(${GSL_INCLUDE_DIRS}) + +if(WITH_GSL) + include_directories(${GSL_INCLUDE_DIRS}) +endif(WITH_GSL) + add_library(diffusion FastMatrixElim.cpp DiffPoolVec.cpp diff --git a/moose-core/diffusion/ConcChanInfo.h b/moose-core/diffusion/ConcChanInfo.h index caf2b6b4d460b897dfd28134069f59f4163d3acf..9aeb984b5dc9c17453ad8acff3457a45ec9a73fb 100644 --- a/moose-core/diffusion/ConcChanInfo.h +++ b/moose-core/diffusion/ConcChanInfo.h @@ -14,22 +14,22 @@ */ class ConcChanInfo { - public: - ConcChanInfo(); - ConcChanInfo( unsigned int my, unsigned int other, - unsigned int chan, double perm, bool isSwapped ) - : myPool( my ), otherPool( other ), chanPool( chan ), - swapped( isSwapped ), - permeability( perm ) - {;} +public: + ConcChanInfo(); + ConcChanInfo( unsigned int my, unsigned int other, + unsigned int chan, double perm, bool isSwapped ) + : myPool( my ), otherPool( other ), chanPool( chan ), + swapped( isSwapped ), + permeability( perm ) + {;} - unsigned int myPool; - unsigned int otherPool; - unsigned int chanPool; - bool swapped; // Flag records whether myPool/otherPool are - // swapped wrt inPool/outPool. System expects - // that inPool should be in same compt as chanPool. - double permeability; + unsigned int myPool; + unsigned int otherPool; + unsigned int chanPool; + bool swapped; // Flag records whether myPool/otherPool are + // swapped wrt inPool/outPool. System expects + // that inPool should be in same compt as chanPool. + double permeability; }; #endif // _CONC_CHAN_INFO_H diff --git a/moose-core/diffusion/DiffJunction.h b/moose-core/diffusion/DiffJunction.h index a4e44d23c88d6e9898a38881cdba23af434784af..957d77d3df6097f9c50bff0b0a986c8a90a639cb 100644 --- a/moose-core/diffusion/DiffJunction.h +++ b/moose-core/diffusion/DiffJunction.h @@ -32,19 +32,19 @@ */ class DiffJunction { - public: - unsigned int otherDsolve; - vector< unsigned int > myPools; - vector< unsigned int > otherPools; +public: + unsigned int otherDsolve; + vector< unsigned int > myPools; + vector< unsigned int > otherPools; - vector< unsigned int > myXferSrc; - vector< unsigned int > otherXferDest; - - vector< unsigned int > myXferDest; - vector< unsigned int > otherXferSrc; + vector< unsigned int > myXferSrc; + vector< unsigned int > otherXferDest; - vector< unsigned int > myChannels; - vector< unsigned int > otherChannels; + vector< unsigned int > myXferDest; + vector< unsigned int > otherXferSrc; - vector< VoxelJunction > vj; + vector< unsigned int > myChannels; + vector< unsigned int > otherChannels; + + vector< VoxelJunction > vj; }; diff --git a/moose-core/diffusion/DiffPoolVec.cpp b/moose-core/diffusion/DiffPoolVec.cpp index 536d7dd737a48f9354f381661a7231db859699dd..9877c8f0accb7d64448263bdc675dc43c924b4d2 100644 --- a/moose-core/diffusion/DiffPoolVec.cpp +++ b/moose-core/diffusion/DiffPoolVec.cpp @@ -71,7 +71,7 @@ void DiffPoolVec::setNvec( const vector< double >& vec ) } void DiffPoolVec::setNvec( unsigned int start, unsigned int num, - vector< double >::const_iterator q ) + vector< double >::const_iterator q ) { assert( start + num <= n_.size() ); vector< double >::iterator p = n_.begin() + start; @@ -126,7 +126,7 @@ unsigned int DiffPoolVec::getId() const } void DiffPoolVec::setOps(const vector< Triplet< double > >& ops, - const vector< double >& diagVal ) + const vector< double >& diagVal ) { if ( ops.size() > 0 ) { @@ -144,14 +144,14 @@ void DiffPoolVec::setOps(const vector< Triplet< double > >& ops, void DiffPoolVec::advance( double dt ) { if ( ops_.size() == 0 ) return; - for ( vector< Triplet< double > >::const_iterator - i = ops_.begin(); i != ops_.end(); ++i ) + + for (auto i = ops_.cbegin(); i != ops_.end(); ++i ) n_[i->c_] -= n_[i->b_] * i->a_; assert( n_.size() == diagVal_.size() ); - vector< double >::iterator iy = n_.begin(); - for ( vector< double >::const_iterator - i = diagVal_.begin(); i != diagVal_.end(); ++i ) + + auto iy = n_.begin(); + for ( auto i = diagVal_.cbegin(); i != diagVal_.end(); ++i ) *iy++ *= *i; } diff --git a/moose-core/diffusion/DiffPoolVec.h b/moose-core/diffusion/DiffPoolVec.h index 587533eb35d0ba4715f4c7cf54947abb4359edff..ce0b2d0a5e193c6cecabe7a84c427b99c713f8db 100644 --- a/moose-core/diffusion/DiffPoolVec.h +++ b/moose-core/diffusion/DiffPoolVec.h @@ -17,50 +17,50 @@ */ class DiffPoolVec { - public: - DiffPoolVec(); - void process(); - void reinit(); - void advance( double dt ); - double getNinit( unsigned int vox ) const; - void setNinit( unsigned int vox, double value ); - double getN( unsigned int vox ) const; - void setN( unsigned int vox, double value ); - double getPrev( unsigned int vox ) const; +public: + DiffPoolVec(); + void process(); + void reinit(); + void advance( double dt ); + double getNinit( unsigned int vox ) const; + void setNinit( unsigned int vox, double value ); + double getN( unsigned int vox ) const; + void setN( unsigned int vox, double value ); + double getPrev( unsigned int vox ) const; - double getDiffConst() const; - void setDiffConst( double value ); + double getDiffConst() const; + void setDiffConst( double value ); - double getMotorConst() const; - void setMotorConst( double value ); + double getMotorConst() const; + void setMotorConst( double value ); - void setNumVoxels( unsigned int num ); - unsigned int getNumVoxels() const; + void setNumVoxels( unsigned int num ); + unsigned int getNumVoxels() const; - void setId( unsigned int id ); - unsigned int getId() const; + void setId( unsigned int id ); + unsigned int getId() const; - ///////////////////////////////////////////////// - /// Used by parent solver to manipulate 'n' - const vector< double >& getNvec() const; - /// Used by parent solver to manipulate 'n' - void setNvec( const vector< double >& n ); - void setNvec( unsigned int start, unsigned int num, - vector< double >::const_iterator q ); - void setPrevVec(); /// Assigns prev_ = n_ - void setOps( const vector< Triplet< double > >& ops_, - const vector< double >& diagVal_ ); /// Assign operations. + ///////////////////////////////////////////////// + /// Used by parent solver to manipulate 'n' + const vector< double >& getNvec() const; + /// Used by parent solver to manipulate 'n' + void setNvec( const vector< double >& n ); + void setNvec( unsigned int start, unsigned int num, + vector< double >::const_iterator q ); + void setPrevVec(); /// Assigns prev_ = n_ + void setOps( const vector< Triplet< double > >& ops_, + const vector< double >& diagVal_ ); /// Assign operations. - // static const Cinfo* initCinfo(); - private: - unsigned int id_; /// Integer conversion of Id of pool handled. - vector< double > n_; /// Number of molecules of pool in each voxel - vector< double > prev_; /// # molecules of pool on previous timestep - vector< double > nInit_; /// Boundary condition: Initial 'n'. - double diffConst_; /// Diffusion const, assumed uniform - double motorConst_; /// Motor const, ie, transport rate. - vector< Triplet< double > > ops_; - vector< double > diagVal_; + // static const Cinfo* initCinfo(); +private: + unsigned int id_; /// Integer conversion of Id of pool handled. + vector< double > n_; /// Number of molecules of pool in each voxel + vector< double > prev_; /// # molecules of pool on previous timestep + vector< double > nInit_; /// Boundary condition: Initial 'n'. + double diffConst_; /// Diffusion const, assumed uniform + double motorConst_; /// Motor const, ie, transport rate. + vector< Triplet< double > > ops_; + vector< double > diagVal_; }; #endif // _DIFF_POOL_VEC_H diff --git a/moose-core/diffusion/Dsolve.cpp b/moose-core/diffusion/Dsolve.cpp index 9f1fc45af0e0e566eec1971ca6060223552f19ef..d65b528accaa6e8bee49ffada64305ac6f139921 100644 --- a/moose-core/diffusion/Dsolve.cpp +++ b/moose-core/diffusion/Dsolve.cpp @@ -122,25 +122,26 @@ const Cinfo* Dsolve::initCinfo() /////////////////////////////////////////////////////// // DestFinfo definitions - /////////////////////////////////////////////////////// - static DestFinfo process( "process", "Handles process call", - new ProcOpFunc< Dsolve >( &Dsolve::process ) ); + new ProcOpFunc< Dsolve >( &Dsolve::process ) + ); + static DestFinfo reinit( "reinit", "Handles reinit call", - new ProcOpFunc< Dsolve >( &Dsolve::reinit ) ); + new ProcOpFunc< Dsolve >( &Dsolve::reinit ) + ); static DestFinfo buildMeshJunctions( "buildMeshJunctions", "Builds junctions between mesh on current Dsolve, and another" " Dsolve. The meshes have to be compatible. ", - new EpFunc1< Dsolve, Id >( - &Dsolve::buildMeshJunctions ) ); + new EpFunc1< Dsolve, Id >(&Dsolve::buildMeshJunctions ) + ); static DestFinfo buildNeuroMeshJunctions( "buildNeuroMeshJunctions", "Builds junctions between NeuroMesh, SpineMesh and PsdMesh", - new EpFunc2< Dsolve, Id, Id >( - &Dsolve::buildNeuroMeshJunctions ) ); + new EpFunc2< Dsolve, Id, Id >(&Dsolve::buildNeuroMeshJunctions ) + ); /////////////////////////////////////////////////////// // Shared definitions @@ -149,10 +150,11 @@ const Cinfo* Dsolve::initCinfo() { &process, &reinit }; + static SharedFinfo proc( "proc", - "Shared message for process and reinit", - procShared, sizeof( procShared ) / sizeof( const Finfo* ) - ); + "Shared message for process and reinit", + procShared, sizeof( procShared ) / sizeof( const Finfo* ) + ); static Finfo* dsolveFinfos[] = { @@ -340,8 +342,8 @@ void Dsolve::calcJnDiff( const DiffJunction& jn, Dsolve* other, double dt) // different diffusion constants. double effectiveDiffConst = sqrt( myDv.getDiffConst() * otherDv.getDiffConst() ); - for ( vector< VoxelJunction >::const_iterator - j = jn.vj.begin(); j != jn.vj.end(); ++j ) + + for (auto j = jn.vj.cbegin(); j != jn.vj.end(); ++j ) { double myN = myDv.getN( j->first ); double otherN = otherDv.getN( j->second ); @@ -517,11 +519,8 @@ void Dsolve::process( const Eref& e, ProcPtr p ) void Dsolve::reinit( const Eref& e, ProcPtr p ) { build( p->dt ); - for ( vector< DiffPoolVec >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) - { + for (auto i = pools_.begin(); i != pools_.end(); ++i ) i->reinit(); - } } void Dsolve::updateJunctions( double dt ) @@ -1236,11 +1235,10 @@ void Dsolve::setBlock( const vector< double >& values ) for ( unsigned int i = 0; i < numPools; ++i ) { unsigned int j = i + startPool; - if ( j >= poolStartIndex_ && j < poolStartIndex_ + numLocalPools_ ) + if (j >= poolStartIndex_ && j < poolStartIndex_ + numLocalPools_) { - vector< double >::const_iterator - q = values.begin() + 4 + i * numVoxels; - pools_[ j - poolStartIndex_ ].setNvec( startVoxel, numVoxels, q ); + auto q = values.cbegin() + 4 + i * numVoxels; + pools_[j-poolStartIndex_].setNvec(startVoxel, numVoxels, q); } } } diff --git a/moose-core/external/muparser/include/muParser.h b/moose-core/external/muparser/include/muParser.h index 653cd44ab19aa43d09c1f944acb5bafdc3861457..c1baf798461d155417f4af4c436e51c3144e98c5 100644 --- a/moose-core/external/muparser/include/muParser.h +++ b/moose-core/external/muparser/include/muParser.h @@ -35,7 +35,7 @@ // Get the random number generator type from here. #include "../../../randnum/RNG.h" -extern moose::RNG<double> rng; +extern moose::RNG rng; /** \file \brief Definition of the standard floating point parser. @@ -107,7 +107,8 @@ namespace mu static value_type Rand2(value_type, value_type, value_type); // Random number between 0 and 1, non-deterministic seed. - static value_type Rand( value_type ); + static value_type Rand( value_type seed ); + static value_type Rnd( ); // Prefix operators // !!! Unary Minus is a MUST if you want to use negative signs !!! diff --git a/moose-core/external/muparser/src/muParser.cpp b/moose-core/external/muparser/src/muParser.cpp index 65a1f314e20c1c8a203a0bb09d7a51c91b368e56..2f9321ee147b7b0d3a22ec0b61fb764904bb8e79 100644 --- a/moose-core/external/muparser/src/muParser.cpp +++ b/moose-core/external/muparser/src/muParser.cpp @@ -25,6 +25,7 @@ */ #include "../include/muParser.h" #include "../include/muParserTemplateMagic.h" +#include "../../../basecode/global.h" //--- Standard includes ------------------------------------------------------------------------ #include <cmath> @@ -51,7 +52,7 @@ namespace mu { // Initialize the RNG with random time. - moose::RNG<double> rng; + moose::RNG rng; //--------------------------------------------------------------------------- // Trigonometric function @@ -112,10 +113,24 @@ namespace mu value_type Parser::Fmod(value_type v1, value_type v2) { return fmod(v1, v2); } value_type Parser::Quot(value_type v1, value_type v2) { return (int)(v1 / v2); } + value_type Parser::Rand( value_type seed = -1 ) + { + static bool isSeedSet_ = false; + + if( ! isSeedSet_ ) + { + mu::rng.setSeed( seed ); + isSeedSet_ = true; + } + return rng.uniform( ); /* Between 0 and 1 */ + } + // If no seed is given, - value_type Parser::Rand( value_type seed ) + value_type Parser::Rnd( ) { static bool isSeedSet_ = false; + // check if global seed is set + size_t seed = moose::getGlobalSeed(); if( ! isSeedSet_ ) { mu::rng.setSeed( seed ); @@ -330,6 +345,7 @@ namespace mu DefineFun(_T("rint"), Rint); DefineFun(_T("abs"), Abs); DefineFun(_T("fmod"), Fmod); + DefineFun(_T("rnd"), Rnd); DefineFun(_T("rand"), Rand); DefineFun(_T("rand2"), Rand2); // Functions with variable number of arguments diff --git a/moose-core/external/odeint-v2/README.md b/moose-core/external/odeint-v2/README.md deleted file mode 100644 index 49e3a20b5ceb0ebb77ad9eafcc65762cf481e920..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/README.md +++ /dev/null @@ -1,3 +0,0 @@ -odeint is a highly flexible library for solving ordinary differential equations. - -This version is modified to suit the need of MOOSE simulator. diff --git a/moose-core/external/odeint-v2/fix-copyright.py b/moose-core/external/odeint-v2/fix-copyright.py deleted file mode 100755 index 753596e6d4b9ec230609fa82b7df7b46af83d9be..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/fix-copyright.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -from __future__ import print_function -from subprocess import check_output as run -from datetime import datetime -from itertools import groupby -from operator import itemgetter -import re -import magic - -def authors(filename): - log = run(['git', 'log', '--follow', - '--date=short','--format=%aN%x09%ad', filename], - universal_newlines=True) - for line in log.splitlines(): - author, date = line.split('\t') - if author != 'fix-copyright.py': - yield author, datetime.strptime(date, '%Y-%m-%d') - -def new_copyright(filename, previous): - def f(): - au = list(authors(filename)) - alldates = list(map(itemgetter(1), au)) - aup = sorted(au + [(a, None) for a in previous], key=itemgetter(0)) - for author, records in groupby(aup, itemgetter(0)): - dates = [_f for _f in map(itemgetter(1), records) if _f] - if not dates: dates = alldates - start = min(dates) - end = max(dates) - fmt = '{0}' if start.year == end.year else '{0}-{1}' - line = 'Copyright ' + fmt.format(start.year, end.year) + ' ' + author - key = (start, author) - yield key, line - return list(map(itemgetter(1), sorted(f()))) - -def fix_copyright(filename): - # Find copyright block in original file - prefix = set() - names = [] - lines = [] - with open(filename, 'r') as f: - content = list(f) - for i, line in enumerate(content[:15]): - m = re.match(r'^(?P<prefix>\W*)(\(c\))?\s*?copyright\s*(\(c\))?\s+\d{4}(\s*-\s*\d{4})?\s+(?P<name>.+?)\s*$', line, re.IGNORECASE) - if m: - d = m.groupdict() - prefix.add(d['prefix']) - lines.append(i) - names.append(d['name'].strip()) - if len(prefix) != 1: - print('Not found:', filename) - return - prefix = list(prefix)[0] - - print(filename) - new = iter(new_copyright(filename, names)) - with open(filename, 'w') as f: - for i, line in enumerate(content): - if i in lines: - for repl in new: - print(prefix + repl, file=f) - else: - print(line, end=' ', file=f) - pass - -def all_files(): - ls = run(['git', 'ls-files'], universal_newlines=True) - for filename in ls.splitlines(): - if magic.from_file(filename, mime=True).split('/')[0] == 'text': - yield filename - -for f in all_files(): - fix_copyright(f) diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint.hpp deleted file mode 100644 index e0100899ca16b4ab831b3e4574bae96ed9059cfe..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint.hpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint.hpp - - [begin_description] - Forward include for odeint. Includes nearly everything. - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2010-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_HPP_INCLUDED - -#include <boost/numeric/odeint/version.hpp> -#include <boost/numeric/odeint/config.hpp> - -// start with ublas wrapper because we need its specializations before including state_wrapper.hpp -#include <boost/numeric/odeint/util/ublas_wrapper.hpp> - -#include <boost/numeric/odeint/stepper/euler.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta4_classic.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta4.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp> - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> - -#include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp> - -#include <boost/numeric/odeint/stepper/bulirsch_stoer.hpp> - -#ifndef __CUDACC__ -/* Bulirsch Stoer with Dense Output does not compile with nvcc - * because of the binomial library used there which relies on unsupported SSE functions - */ -#include <boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp> -#endif - -#include <boost/numeric/odeint/stepper/symplectic_euler.hpp> -#include <boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp> -#include <boost/numeric/odeint/stepper/velocity_verlet.hpp> - -#include <boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp> - -#include <boost/numeric/odeint/stepper/implicit_euler.hpp> -#include <boost/numeric/odeint/stepper/rosenbrock4.hpp> -#include <boost/numeric/odeint/stepper/rosenbrock4_controller.hpp> -#include <boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp> - -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/multi_array_algebra.hpp> -#include <boost/numeric/odeint/util/multi_array_adaption.hpp> -/* - * Including this algebra slows down the compilation time - */ -// #include <boost/numeric/odeint/algebra/fusion_algebra.hpp> - -#include <boost/numeric/odeint/integrate/integrate.hpp> -#include <boost/numeric/odeint/integrate/integrate_adaptive.hpp> -#include <boost/numeric/odeint/integrate/integrate_const.hpp> -#include <boost/numeric/odeint/integrate/integrate_n_steps.hpp> -#include <boost/numeric/odeint/integrate/integrate_times.hpp> - -#include <boost/numeric/odeint/integrate/observer_collection.hpp> -#include <boost/numeric/odeint/integrate/max_step_checker.hpp> - -#include <boost/numeric/odeint/stepper/generation.hpp> - -#include <boost/numeric/odeint/iterator/adaptive_iterator.hpp> -#include <boost/numeric/odeint/iterator/adaptive_time_iterator.hpp> -#include <boost/numeric/odeint/iterator/const_step_iterator.hpp> -#include <boost/numeric/odeint/iterator/const_step_time_iterator.hpp> - - -#endif // BOOST_NUMERIC_ODEINT_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/algebra_dispatcher.hpp deleted file mode 100644 index bcae2d3eacf492f8006f67a7c063524197ff7aa3..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/algebra_dispatcher.hpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/algebra_dispatcher.hpp - - [begin_description] - Algebra dispatcher to automatically chose suitable algebra. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_ALGEBRA_DISPATCHER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_ALGEBRA_DISPATCHER_HPP_INCLUDED - -#include <boost/numeric/odeint/config.hpp> - -#include <complex> -#include <boost/type_traits/is_floating_point.hpp> - -#include <boost/numeric/ublas/vector.hpp> -#include <boost/numeric/ublas/matrix.hpp> - -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/array_algebra.hpp> -#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> - -#include <boost/array.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -template< class StateType , class Enabler = void > -struct algebra_dispatcher_sfinae -{ - // range_algebra is the standard algebra - typedef range_algebra algebra_type; -}; - -template< class StateType > -struct algebra_dispatcher : algebra_dispatcher_sfinae< StateType > { }; - -// specialize for array -template< class T , size_t N > -struct algebra_dispatcher< boost::array< T , N > > -{ - typedef array_algebra algebra_type; -}; - -//specialize for some integral types -template< typename T > -struct algebra_dispatcher_sfinae< T , typename boost::enable_if< typename boost::is_floating_point< T >::type >::type > -{ - typedef vector_space_algebra algebra_type; -}; - -template< typename T > -struct algebra_dispatcher< std::complex<T> > -{ - typedef vector_space_algebra algebra_type; -}; - -///* think about that again.... -// specialize for ublas vector and matrix types -template< class T , class A > -struct algebra_dispatcher< boost::numeric::ublas::vector< T , A > > -{ - typedef vector_space_algebra algebra_type; -}; - -template< class T , class L , class A > -struct algebra_dispatcher< boost::numeric::ublas::matrix< T , L , A > > -{ - typedef vector_space_algebra algebra_type; -}; -//*/ - -} -} -} - -#ifdef BOOST_NUMERIC_ODEINT_CXX11 - -// c++11 mode: specialization for std::array if available - -#include <array> - -namespace boost { -namespace numeric { -namespace odeint { - -// specialize for std::array -template< class T , size_t N > -struct algebra_dispatcher< std::array< T , N > > -{ - typedef array_algebra algebra_type; -}; - -} } } - -#endif - - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/array_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/array_algebra.hpp deleted file mode 100644 index 39b79240adfe9a304bd39d67158912a886b89eb4..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/array_algebra.hpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/array_algebra.hpp - - [begin_description] - Algebra for Arrays. Highly specialized for odeint. Const arguments are - introduce to work with odeint. - The Array algebra can be used for Array structures with two template - parameters: - Array<T, N> - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED - -#include <algorithm> -#include <boost/array.hpp> - -#include <boost/numeric/odeint/algebra/norm_result_type.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -struct array_algebra -{ - //template< typename T , size_t dim , class Op > - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each1( Array< T, dim > &s1, Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each2( Array< T, dim > &s1, const Array< T, dim > &s2, - Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each3( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] ); - } - - /* different const signature - required for the scale_sum_swap2 operation */ - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each3( Array< T , dim > &s1 , - Array< T , dim > &s2 , - const Array< T , dim > &s3 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each4( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each5( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each6( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each7( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each8( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , - const Array< T , dim > &s8 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each9( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , - const Array< T , dim > &s8 , - const Array< T , dim > &s9 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each10( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , - const Array< T , dim > &s8 , - const Array< T , dim > &s9 , - const Array< T , dim > &s10 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each11( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , - const Array< T , dim > &s8 , - const Array< T , dim > &s9 , - const Array< T , dim > &s10 , - const Array< T , dim > &s11 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each12( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , - const Array< T , dim > &s8 , - const Array< T , dim > &s9 , - const Array< T , dim > &s10 , - const Array< T , dim > &s11 , - const Array< T , dim > &s12 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each13( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , - const Array< T , dim > &s8 , - const Array< T , dim > &s9 , - const Array< T , dim > &s10 , - const Array< T , dim > &s11 , - const Array< T , dim > &s12 , - const Array< T , dim > &s13 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each14( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , - const Array< T , dim > &s8 , - const Array< T , dim > &s9 , - const Array< T , dim > &s10 , - const Array< T , dim > &s11 , - const Array< T , dim > &s12 , - const Array< T , dim > &s13 , - const Array< T , dim > &s14 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] , s14[i] ); - } - - template < template < typename, size_t > class Array, typename T, - size_t dim, class Op > - static void for_each15( Array< T , dim > &s1 , - const Array< T , dim > &s2 , - const Array< T , dim > &s3 , - const Array< T , dim > &s4 , - const Array< T , dim > &s5 , - const Array< T , dim > &s6 , - const Array< T , dim > &s7 , - const Array< T , dim > &s8 , - const Array< T , dim > &s9 , - const Array< T , dim > &s10 , - const Array< T , dim > &s11 , - const Array< T , dim > &s12 , - const Array< T , dim > &s13 , - const Array< T , dim > &s14 , - const Array< T , dim > &s15 , Op op ) - { - for( size_t i=0 ; i<dim ; ++i ) - op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] , s14[i] , s15[i] ); - } - - - template < template < typename, size_t > class Array, typename T, - size_t dim> - static typename norm_result_type< Array< T , dim > >::type norm_inf( const Array< T , dim > &s ) - { - BOOST_USING_STD_MAX(); - using std::abs; - typedef typename norm_result_type< Array< T , dim > >::type result_type; - result_type init = static_cast< result_type >( 0 ); - for( size_t i=0 ; i<dim ; ++i ) - init = max BOOST_PREVENT_MACRO_SUBSTITUTION ( init , static_cast< result_type >(abs(s[i])) ); - return init; - } - -}; - -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/default_operations.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/default_operations.hpp deleted file mode 100644 index b10944fa19cda02bb77090b0358ba639ed40e795..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/default_operations.hpp +++ /dev/null @@ -1,599 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/default_operations.hpp - - [begin_description] - Default operations. They work with the default numerical types, like float, double, complex< double> ... - [end_description] - - Copyright 2010-2012 Karsten Ahnert - Copyright 2010-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED - -#include <algorithm> - -#include <boost/config.hpp> -#include <boost/array.hpp> - -#include <boost/numeric/odeint/util/unit_helper.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - - -/* - * Notes: - * - * * the results structs are needed in order to work with fusion_algebra - */ -struct default_operations -{ - - template< class Fac1 = double > - struct scale - { - const Fac1 m_alpha1; - - scale( Fac1 alpha1 ) : m_alpha1( alpha1 ) { } - - template< class T1 > - void operator()( T1 &t1 ) const - { - t1 *= m_alpha1; - } - - typedef void result_type; - }; - - template< class Fac1 = double > - struct scale_sum1 - { - const Fac1 m_alpha1; - - scale_sum1( Fac1 alpha1 ) : m_alpha1( alpha1 ) { } - - template< class T1 , class T2 > - void operator()( T1 &t1 , const T2 &t2 ) const - { - t1 = m_alpha1 * t2; - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 > - struct scale_sum2 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - - scale_sum2( Fac1 alpha1 , Fac2 alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { } - - template< class T1 , class T2 , class T3 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3; - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 > - struct scale_sum3 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - - scale_sum3( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) { } - - template< class T1 , class T2 , class T3 , class T4 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4; - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 > - struct scale_sum4 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - - scale_sum4( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5; - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 > - struct scale_sum5 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - - scale_sum5( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , Fac5 alpha5 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6; - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 > - struct scale_sum6 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - - scale_sum6( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , Fac5 alpha5 , Fac6 alpha6 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ){ } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 ,const T7 &t7) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7; - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 > - struct scale_sum7 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - - scale_sum7( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , - Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8; - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 > - struct scale_sum8 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - const Fac8 m_alpha8; - - scale_sum8( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , - Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9; - } - - typedef void result_type; - }; - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 > - struct scale_sum9 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - const Fac8 m_alpha8; - const Fac9 m_alpha9; - - scale_sum9( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , - Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10; - } - - typedef void result_type; - }; - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 > - struct scale_sum10 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - const Fac8 m_alpha8; - const Fac9 m_alpha9; - const Fac10 m_alpha10; - - scale_sum10( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , - Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 , Fac10 alpha10 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11; - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 > - struct scale_sum11 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - const Fac8 m_alpha8; - const Fac9 m_alpha9; - const Fac10 m_alpha10; - const Fac11 m_alpha11; - - scale_sum11( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , - Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 , - Fac10 alpha10 , Fac11 alpha11 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12; - } - - typedef void result_type; - }; - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 > - struct scale_sum12 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - const Fac8 m_alpha8; - const Fac9 m_alpha9; - const Fac10 m_alpha10; - const Fac11 m_alpha11; - const Fac12 m_alpha12; - - scale_sum12( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , - Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 , - Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13; - } - - typedef void result_type; - }; - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 , class Fac13 = Fac12 > - struct scale_sum13 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - const Fac8 m_alpha8; - const Fac9 m_alpha9; - const Fac10 m_alpha10; - const Fac11 m_alpha11; - const Fac12 m_alpha12; - const Fac13 m_alpha13; - - scale_sum13( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , - Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 , - Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 , Fac13 alpha13 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) , m_alpha13( alpha13 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 , const T14 &t14 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13 + m_alpha13 * t14; - } - - typedef void result_type; - }; - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 , class Fac13 = Fac12 , class Fac14 = Fac13 > - struct scale_sum14 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - const Fac8 m_alpha8; - const Fac9 m_alpha9; - const Fac10 m_alpha10; - const Fac11 m_alpha11; - const Fac12 m_alpha12; - const Fac13 m_alpha13; - const Fac14 m_alpha14; - - scale_sum14( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , - Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 , - Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 , Fac13 alpha13 , Fac14 alpha14 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) , m_alpha13( alpha13 ) , m_alpha14( alpha14 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 , const T14 &t14 , const T15 &t15 ) const - { - t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13 + m_alpha13 * t14 + m_alpha14 * t15; - } - - typedef void result_type; - }; - - template< class Fac1 = double , class Fac2 = Fac1 > - struct scale_sum_swap2 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - - scale_sum_swap2( Fac1 alpha1 , Fac2 alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { } - - template< class T1 , class T2 , class T3 > - void operator()( T1 &t1 , T2 &t2 , const T3 &t3) const - { - const T1 tmp( t1 ); - t1 = m_alpha1 * t2 + m_alpha2 * t3; - t2 = tmp; - } - - typedef void result_type; - }; - - /* - * for usage in for_each2 - * - * Works with boost::units by eliminating the unit - */ - template< class Fac1 = double > - struct rel_error - { - const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt; - - rel_error( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt ) - : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) { } - - - template< class T1 , class T2 , class T3 > - void operator()( T3 &t3 , const T1 &t1 , const T2 &t2 ) const - { - using std::abs; - set_unit_value( t3 , abs( get_unit_value( t3 ) ) / ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( t1 ) ) + m_a_dxdt * abs( get_unit_value( t2 ) ) ) ) ); - } - - typedef void result_type; - }; - - - /* - * for usage in for_each3 - * - * used in the controller for the rosenbrock4 method - * - * Works with boost::units by eliminating the unit - */ - template< class Fac1 = double > - struct default_rel_error - { - const Fac1 m_eps_abs , m_eps_rel ; - - default_rel_error( Fac1 eps_abs , Fac1 eps_rel ) - : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) { } - - - /* - * xerr = xerr / ( eps_abs + eps_rel * max( x , x_old ) ) - */ - template< class T1 , class T2 , class T3 > - void operator()( T3 &t3 , const T1 &t1 , const T2 &t2 ) const - { - BOOST_USING_STD_MAX(); - using std::abs; - Fac1 x1 = abs( get_unit_value( t1 ) ) , x2 = abs( get_unit_value( t2 ) ); - set_unit_value( t3 , abs( get_unit_value( t3 ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( x1 , x2 ) ) ); - } - - typedef void result_type; - }; - - - - /* - * for usage in reduce - */ - - template< class Value > - struct maximum - { - template< class Fac1 , class Fac2 > - Value operator()( Fac1 t1 , const Fac2 t2 ) const - { - using std::abs; - Value a1 = abs( get_unit_value( t1 ) ) , a2 = abs( get_unit_value( t2 ) ); - return ( a1 < a2 ) ? a2 : a1 ; - } - - typedef Value result_type; - }; - - - template< class Fac1 = double > - struct rel_error_max - { - const Fac1 m_eps_abs , m_eps_rel; - - rel_error_max( Fac1 eps_abs , Fac1 eps_rel ) - : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) - { } - - template< class Res , class T1 , class T2 , class T3 > - Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &x_err ) - { - BOOST_USING_STD_MAX(); - using std::abs; - Res tmp = abs( get_unit_value( x_err ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( abs( x_old ) , abs( x ) ) ); - return max BOOST_PREVENT_MACRO_SUBSTITUTION ( r , tmp ); - } - }; - - - template< class Fac1 = double > - struct rel_error_max2 - { - const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt; - - rel_error_max2( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt ) - : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) - { } - - template< class Res , class T1 , class T2 , class T3 , class T4 > - Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &dxdt_old , const T4 &x_err ) - { - BOOST_USING_STD_MAX(); - using std::abs; - Res tmp = abs( get_unit_value( x_err ) ) / - ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( x_old ) ) + m_a_dxdt * abs( get_unit_value( dxdt_old ) ) ) ); - return max BOOST_PREVENT_MACRO_SUBSTITUTION ( r , tmp ); - } - }; - - - - - template< class Fac1 = double > - struct rel_error_l2 - { - const Fac1 m_eps_abs , m_eps_rel; - - rel_error_l2( Fac1 eps_abs , Fac1 eps_rel ) - : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) - { } - - template< class Res , class T1 , class T2 , class T3 > - Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &x_err ) - { - BOOST_USING_STD_MAX(); - using std::abs; - Res tmp = abs( get_unit_value( x_err ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( abs( x_old ) , abs( x ) ) ); - return r + tmp * tmp; - } - }; - - - - - template< class Fac1 = double > - struct rel_error_l2_2 - { - const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt; - - rel_error_l2_2( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt ) - : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) - { } - - template< class Res , class T1 , class T2 , class T3 , class T4 > - Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &dxdt_old , const T4 &x_err ) - { - using std::abs; - Res tmp = abs( get_unit_value( x_err ) ) / - ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( x_old ) ) + m_a_dxdt * abs( get_unit_value( dxdt_old ) ) ) ); - return r + tmp * tmp; - } - }; - - - - - - -}; - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/extract_value_type.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/extract_value_type.hpp deleted file mode 100644 index c5246bb6f492d7a3d9e737a3adfcade8ff2873a9..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/extract_value_type.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/detail/extract_value_type.hpp - - [begin_description] - Extract true value type from complex types (eg. std::complex) - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED - -#include <boost/utility.hpp> -#include <boost/mpl/has_xxx.hpp> - -BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< typename S , typename Enabler = void > -struct extract_value_type {}; - -// as long as value_types are defined we go down the value_type chain -// e.g. returning S::value_type::value_type::value_type - -template< typename S > -struct extract_value_type<S , typename boost::disable_if< has_value_type<S> >::type > -{ - // no value_type defined, return S - typedef S type; -}; - -template< typename S > -struct extract_value_type< S , typename boost::enable_if< has_value_type<S> >::type > -{ - // go down the value_type - typedef typename extract_value_type< typename S::value_type >::type type; -}; - -} } } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/for_each.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/for_each.hpp deleted file mode 100644 index 5387a47db6f2eabec7eeca6f5eede40223636f93..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/for_each.hpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/detail/for_each.hpp - - [begin_description] - Default for_each implementations. - [end_description] - - Copyright 2010-2012 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_FOR_EACH_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_FOR_EACH_HPP_INCLUDED - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - - - template< class Iterator1 , class Operation > - inline void for_each1( Iterator1 first1 , Iterator1 last1 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ ); - } - - - template< class Iterator1 , class Iterator2 , class Operation > - inline void for_each2( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ ); - } - - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Operation > - inline void for_each3( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ ); - } - - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Operation > - inline void for_each4( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, Iterator4 first4, Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ ); - } - - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Operation > - inline void for_each5( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ ); - } - - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Operation > - inline void for_each6( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ ); - } - - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Operation > - inline void for_each7( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ ); - } - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Operation > - inline void for_each8( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ ); - } - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Operation > - inline void for_each9( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , - Iterator9 first9 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ ); - } - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Operation > - inline void for_each10( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , - Iterator9 first9 , Iterator10 first10 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ ); - } - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Operation > - inline void for_each11( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , - Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ ); - } - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Iterator12 , class Operation > - inline void for_each12( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , - Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Iterator12 first12 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ , *first12++ ); - } - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Iterator12 , class Iterator13 , class Operation > - inline void for_each13( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , - Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Iterator12 first12 , Iterator13 first13 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ , *first12++ , *first13++ ); - } - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Iterator12 , class Iterator13 , class Iterator14 , class Operation > - inline void for_each14( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , - Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Iterator12 first12 , Iterator13 first13 , - Iterator14 first14 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ , *first12++ , *first13++ , *first14++ ); - } - - template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Iterator12 , class Iterator13 , class Iterator14 , class Iterator15 , class Operation > - inline void for_each15( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, - Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , - Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Iterator12 first12 , Iterator13 first13 , - Iterator14 first14 , Iterator15 first15 , Operation op ) - { - for( ; first1 != last1 ; ) - op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ , *first12++ , *first13++ , *first14++ , *first15++ ); - } - - -} // detail -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_FOR_EACH_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/macros.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/macros.hpp deleted file mode 100644 index 9e18a8a2f0f7c98e5b2400861a88bd29c1fb057f..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/macros.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/detail/macros.hpp - - [begin_description] - Some macros for type checking. - [end_description] - - Copyright 2010-2012 Karsten Ahnert - Copyright 2010 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED - - -//type traits aren't working with nvcc -#ifndef __CUDACC__ -#include <boost/type_traits.hpp> -#include <boost/static_assert.hpp> - -#define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 ) \ - BOOST_STATIC_ASSERT(( boost::is_same< typename boost::remove_const< Type1 >::type , Type2 >::value )) - -#else -//empty macro for nvcc -#define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 ) - -#endif // __CUDACC__ - - - -/* -#define BOOST_ODEINT_CHECK_OPERATION_ARITY( Operation , Arity ) \ - BOOST_STATIC_ASSERT(( boost::function_traits< Operation >::arity == Arity )) - */ - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/norm_inf.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/norm_inf.hpp deleted file mode 100644 index 3d32c99bee8ae5669aab81c4d5ef350f7917688d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/detail/norm_inf.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/detail/norm_inf.hpp - - [begin_description] - Default reduce implementation. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_NORM_INF_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_NORM_INF_HPP_INCLUDED - -#include <cmath> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< typename Value , class Iterator1 > -inline Value norm_inf( Iterator1 first1 , Iterator1 last1 , Value init ) -{ - using std::max; - using std::abs; - for( ; first1 != last1 ; ) - init = max( init , abs( *first1++ ) ); - return init; -} - - -} // detail -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_NORM_INF_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/fusion_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/fusion_algebra.hpp deleted file mode 100644 index 0055e5d4de446297e27cadcc34144316f1ee1924..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/fusion_algebra.hpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/fusion_algebra.hpp - - [begin_description] - Algebra for boost::fusion sequences. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_HPP_INCLUDED - -#include <algorithm> - -#include <boost/numeric/odeint/config.hpp> - -#include <boost/fusion/container/vector.hpp> -#include <boost/fusion/algorithm/iteration/for_each.hpp> -#include <boost/fusion/view/zip_view.hpp> -#include <boost/fusion/functional/generation/make_fused.hpp> -#include <boost/fusion/algorithm/iteration/accumulate.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -namespace detail { - - template< class Value > - struct fusion_maximum - { - template< class Fac1 , class Fac2 > - Value operator()( Fac1 t1 , const Fac2 t2 ) const - { - using std::abs; - Value a1 = abs( get_unit_value( t1 ) ) , a2 = abs( get_unit_value( t2 ) ); - return ( a1 < a2 ) ? a2 : a1 ; - } - - typedef Value result_type; - }; -} - -/* specialize this if the fundamental numeric type in your fusion sequence is - * anything else but double (most likely not) - */ -template< typename Sequence > -struct fusion_traits { - typedef double value_type; -}; - -struct fusion_algebra -{ - template< class S1 , class Op > - static void for_each1( S1 &s1 , Op op ) - { - boost::fusion::for_each( s1 , op ); - }; - - - template< class S1 , class S2 , class Op > - static void for_each2( S1 &s1 , S2 &s2 , Op op ) - { - typedef boost::fusion::vector< S1& , S2& > Sequences; - Sequences sequences( s1 , s2 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - - template< class S1 , class S2 , class S3 , class Op > - static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op ) - { - typedef boost::fusion::vector< S1& , S2& , S3& > Sequences; - Sequences sequences( s1 , s2 , s3 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S1 , class S2 , class S3 , class S4 , class Op > - static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) - { - typedef boost::fusion::vector< S1& , S2& , S3& , S4& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op > - static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) - { - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op > - static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) - { - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class Op > - static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) - { - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class Op > - static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) - { - BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 8 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" ); - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class Op > - static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op ) - { - BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 9 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" ); - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class Op > - static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op ) - { - BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 10 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" ); - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class Op > - static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op ) - { - BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 11 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" ); - BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 11 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" ); - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op > - static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op ) - { - BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 12 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" ); - BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 12 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" ); - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op > - static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op ) - { - BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 13 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" ); - BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 13 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" ); - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op > - static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op ) - { - BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 14 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" ); - BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 14 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" ); - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& , S14& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op > - static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op ) - { - BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 15 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" ); - BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 15 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" ); - typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& , S14& , S15& > Sequences; - Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 , s15 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) ); - } - - template< class S > - static typename fusion_traits< S >::value_type norm_inf( const S &s ) - { - typedef typename fusion_traits< S >::value_type value_type; - return boost::fusion::accumulate( s , static_cast<value_type>(0) , - detail::fusion_maximum<value_type>() ); - } - -}; - - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp deleted file mode 100644 index 4bfc5c26ba76f5770377fec5b3decd97d5ba3a26..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_DISPATCHER_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_DISPATCHER_HPP_DEFINED - -#include <boost/numeric/odeint/algebra/fusion_algebra.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> - -#include <boost/utility/enable_if.hpp> -#include <boost/fusion/include/is_sequence.hpp> - - - -namespace boost { -namespace numeric { -namespace odeint { - -// specialization for fusion sequences -template< class FusionSequence > -struct algebra_dispatcher_sfinae< FusionSequence , - typename boost::enable_if< - typename boost::fusion::traits::is_sequence< FusionSequence >::type >::type > -{ - typedef fusion_algebra algebra_type; -}; - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_DISPATCHER_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/multi_array_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/multi_array_algebra.hpp deleted file mode 100644 index 1f8c41b2eac1e3e43c082240c491b90cd7ff077a..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/multi_array_algebra.hpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/multi_array_algebra.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_MULTI_ARRAY_ALGEBRA_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_MULTI_ARRAY_ALGEBRA_HPP_DEFINED - - -#include <boost/numeric/odeint/algebra/detail/for_each.hpp> -#include <boost/numeric/odeint/algebra/detail/norm_inf.hpp> -#include <boost/numeric/odeint/algebra/norm_result_type.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -// not ready -struct multi_array_algebra -{ - template< class S1 , class Op > - static void for_each1( S1 &s1 , Op op ) - { - detail::for_each1( s1.data() , s1.data() + s1.num_elements() , op ); - } - - template< class S1 , class S2 , class Op > - static void for_each2( S1 &s1 , S2 &s2 , Op op ) - { - detail::for_each2( s1.data() , s1.data() + s1.num_elements() , s2.data() , op ); - } - - template< class S1 , class S2 , class S3 , class Op > - static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op ) - { - detail::for_each3( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class Op > - static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) - { - detail::for_each4( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op > - static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) - { - detail::for_each5( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op > - static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) - { - detail::for_each6( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op > - static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) - { - detail::for_each7( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op > - static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) - { - detail::for_each8( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class Op > - static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op ) - { - detail::for_each9( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class Op > - static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op ) - { - detail::for_each10( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class Op > - static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op ) - { - detail::for_each11( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op > - static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op ) - { - detail::for_each12( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , s12.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op > - static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op ) - { - detail::for_each13( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , s12.data() , s13.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op > - static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op ) - { - detail::for_each14( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , s12.data() , s13.data() , s14.data() , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op > - static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op ) - { - detail::for_each15( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , s12.data() , s13.data() , s14.data() , s15.data() , op ); - } - - template< typename S > - static typename norm_result_type<S>::type norm_inf( const S &s ) - { - return detail::norm_inf( s.data() , s.data() + s.num_elements() , static_cast< typename norm_result_type<S>::type >( 0 ) ); - } -}; - -// template< class T , size_t N > -// struct algebra_dispatcher< boost::array< T , N > > -// { -// typedef array_algebra algebra_type; -// }; - - - - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_MULTI_ARRAY_ALGEBRA_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/norm_result_type.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/norm_result_type.hpp deleted file mode 100644 index 0e99e8fcc23a31472f38b42df3edd585e2428aa9..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/norm_result_type.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/norm_result_type.hpp - - [begin_description] - Calculates the type of the norm_inf operation for container types - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_NORM_RESULT_TYPE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_NORM_RESULT_TYPE_HPP_INCLUDED - -#include <boost/numeric/odeint/algebra/detail/extract_value_type.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< typename S , typename Enabler = void > -struct norm_result_type { - typedef typename detail::extract_value_type< S >::type type; -}; - -} } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/operations_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/operations_dispatcher.hpp deleted file mode 100644 index 5a0b21bb81a1d9f13bd516af9ad8a77cbdb3e4f6..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/operations_dispatcher.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/operations_dispatcher.hpp - - [begin_description] - Operations dispatcher to automatically chose suitable operations. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_OPERATIONS_DISPATCHER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_OPERATIONS_DISPATCHER_HPP_INCLUDED - -#include <boost/numeric/odeint/algebra/default_operations.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< class StateType , class Enabler = void > -struct operations_dispatcher_sfinae -{ - typedef default_operations operations_type; -}; - -template< class StateType > -struct operations_dispatcher : operations_dispatcher_sfinae< StateType > {}; - -// no further specializations required - -} -} -} - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/range_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/range_algebra.hpp deleted file mode 100644 index 3d7695c8127802ba2db00576a76e23a1cf824a23..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/range_algebra.hpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/range_algebra.hpp - - [begin_description] - Default algebra, which works with the most state types, like vector< double >, boost::array< double >, boost::range. - Internally is uses boost::range to obtain the begin and end iterator of the according sequence. - [end_description] - - Copyright 2010-2013 Karsten Ahnert - Copyright 2010-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_RANGE_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_RANGE_ALGEBRA_HPP_INCLUDED - -#include <boost/range.hpp> -#include <boost/mpl/size_t.hpp> - -#include <boost/numeric/odeint/algebra/detail/macros.hpp> -#include <boost/numeric/odeint/algebra/detail/for_each.hpp> -#include <boost/numeric/odeint/algebra/detail/norm_inf.hpp> -#include <boost/numeric/odeint/algebra/norm_result_type.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -struct range_algebra -{ - template< class S1 , class Op > - static void for_each1( S1 &s1 , Op op ) - { - detail::for_each1( boost::begin( s1 ) , boost::end( s1 ) , - op ); - } - - template< class S1 , class S2 , class Op > - static void for_each2( S1 &s1 , S2 &s2 , Op op ) - { - detail::for_each2( boost::begin( s1 ) , boost::end( s1 ) , - boost::begin( s2 ) , op ); - } - - template< class S1 , class S2 , class S3 , class Op > - static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op ) - { - detail::for_each3( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class Op > - static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) - { - detail::for_each4( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op > - static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) - { - detail::for_each5( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op > - static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) - { - detail::for_each6( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op > - static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) - { - detail::for_each7( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op > - static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) - { - detail::for_each8( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class Op > - static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op ) - { - detail::for_each9( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , boost::begin( s9 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class Op > - static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op ) - { - detail::for_each10( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , boost::begin( s9 ) , boost::begin( s10 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class Op > - static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op ) - { - detail::for_each11( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op > - static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op ) - { - detail::for_each12( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , boost::begin( s12 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op > - static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op ) - { - detail::for_each13( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , boost::begin( s12 ) , boost::begin( s13 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op > - static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op ) - { - detail::for_each14( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , boost::begin( s12 ) , boost::begin( s13 ) , boost::begin( s14 ) , op ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op > - static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op ) - { - detail::for_each15( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , boost::begin( s12 ) , boost::begin( s13 ) , boost::begin( s14 ) , boost::begin( s15 ) , op ); - } - - template< typename S > - static typename norm_result_type<S>::type norm_inf( const S &s ) - { - return detail::norm_inf( boost::begin( s ) , boost::end( s ) , - static_cast< typename norm_result_type<S>::type >( 0 ) ); - } - -}; - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_RANGE_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/vector_space_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/vector_space_algebra.hpp deleted file mode 100644 index 17ff007eef09da1457550beae911b5a0272c42d7..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/algebra/vector_space_algebra.hpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/algebra/vector_space_algebra.hpp - - [begin_description] - An algebra for types which have vector space semantics, hence types on which the operators +,-,* are well defined. - [end_description] - - Copyright 2010-2012 Karsten Ahnert - Copyright 2010-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ALGEBRA_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED - -#include <complex> - -#include <boost/type_traits/remove_reference.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -/* - * This class template has to be overload in order to call vector_space_algebra::norm_inf - */ -template< class State > struct vector_space_norm_inf; - -/* - * Example: instantiation for sole doubles and complex - */ -template<> -struct vector_space_norm_inf< double > -{ - typedef double result_type; - double operator()( double x ) const - { - using std::abs; - return abs(x); - } -}; - -template<> -struct vector_space_norm_inf< float > -{ - typedef float result_type; - result_type operator()( float x ) const - { - using std::abs; - return abs(x); - } -}; - -template< typename T > -struct vector_space_norm_inf< std::complex<T> > -{ - typedef T result_type; - result_type operator()( std::complex<T> x ) const - { - using std::abs; - return abs( x ); - } -}; - -struct vector_space_algebra -{ - template< class S1 , class Op > - static void for_each1( S1 &s1 , Op op ) - { - // ToDo : build checks, that the +-*/ operators are well defined - op( s1 ); - } - - template< class S1 , class S2 , class Op > - static void for_each2( S1 &s1 , S2 &s2 , Op op ) - { - op( s1 , s2 ); - } - - template< class S1 , class S2 , class S3 , class Op > - static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op ) - { - op( s1 , s2 , s3 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class Op > - static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) - { - op( s1 , s2 , s3 , s4 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op > - static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op > - static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op > - static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op > - static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class Op > - static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class Op > - static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class Op > - static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op > - static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op > - static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op > - static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 ); - } - - template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op > - static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op ) - { - op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 , s15 ); - } - - template< class S > - static typename boost::numeric::odeint::vector_space_norm_inf< S >::result_type norm_inf( const S &s ) - { - boost::numeric::odeint::vector_space_norm_inf< S > n; - return n( s ); - } -}; - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/config.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/config.hpp deleted file mode 100644 index f1915825587a3b0520b678142638b3879cd438c4..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/config.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/config.hpp - - [begin_description] - Sets configurations for odeint and used libraries. Should be included before any other odeint library - [end_description] - - Copyright 2011-2012 Mario Mulansky - Copyright 2011-2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_CONFIG_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_CONFIG_HPP_INCLUDED - - -//increase macro variable to allow rk78 scheme -#ifndef FUSION_MAX_VECTOR_SIZE -#define FUSION_MAX_VECTOR_SIZE 15 -#endif - - -/* - * the following definitions are only required if fusion vectors are used as state types - * in the rk78 scheme - * they should be defined by the user if required, see e.g. libs/numeric/examples/harmonic_oscillator_units.cpp - */ -#ifndef BOOST_FUSION_INVOKE_MAX_ARITY -#define BOOST_FUSION_INVOKE_MAX_ARITY 15 -#endif - -#ifndef BOOST_RESULT_OF_NUM_ARGS -#define BOOST_RESULT_OF_NUM_ARGS 15 -#endif - - - - - -#include <boost/config.hpp> - -#if __cplusplus >= 201103L -#define BOOST_NUMERIC_ODEINT_CXX11 1 -#endif - - - - -#endif // BOOST_NUMERIC_ODEINT_CONFIG_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/blaze/blaze_algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/blaze/blaze_algebra_dispatcher.hpp deleted file mode 100644 index 29bf78621d1ec5e394715c503be29b022d4ce1a9..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/blaze/blaze_algebra_dispatcher.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/blaze/blaze_algebra_dispatcher.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_BLAZE_BLAZE_ALGEBRA_DISPATCHER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_BLAZE_BLAZE_ALGEBRA_DISPATCHER_HPP_INCLUDED - -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <blaze/math/dense/StaticVector.h> -#include <blaze/math/dense/DynamicVector.h> - - - - - - -namespace boost { -namespace numeric { -namespace odeint { - -template< typename T , size_t N , bool TF > -struct algebra_dispatcher< blaze::StaticVector< T , N , TF > > -{ - typedef vector_space_algebra algebra_type; -}; - -template< typename T , bool TF > -struct algebra_dispatcher< blaze::DynamicVector< T , TF > > -{ - typedef vector_space_algebra algebra_type; -}; - - - - - -} -} -} - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_BLAZE_BLAZE_ALGEBRA_DISPATCHER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/blaze/blaze_resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/blaze/blaze_resize.hpp deleted file mode 100644 index 50ad3192632c453369aba374c3db9d3901192f58..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/blaze/blaze_resize.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/blaze/blaze_resize.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_BLAZE_BLAZE_RESIZE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_BLAZE_BLAZE_RESIZE_HPP_INCLUDED - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> - -#include <blaze/math/dense/DynamicVector.h> - -namespace boost { -namespace numeric { -namespace odeint { - -template< typename T , bool TF > -struct is_resizeable< blaze::DynamicVector< T , TF > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - -template< typename T1 , bool TF1, typename T2 , bool TF2 > -struct same_size_impl< blaze::DynamicVector< T1 , TF1 > , blaze::DynamicVector< T2 , TF2 > > -{ - static bool same_size( const blaze::DynamicVector< T1 , TF1 > &x1 , const blaze::DynamicVector< T2 , TF2 > &x2 ) - { - return x1.size() == x2.size(); - } -}; - -template< typename T1 , bool TF1, typename T2 , bool TF2 > -struct resize_impl< blaze::DynamicVector< T1 , TF1 > , blaze::DynamicVector< T2 , TF2 > > -{ - static void resize( blaze::DynamicVector< T1 , TF1 > &x1 , const blaze::DynamicVector< T2 , TF2 > &x2 ) - { - x1.resize( x2.size() ); - } -}; - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_BLAZE_BLAZE_RESIZE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute.hpp deleted file mode 100644 index fe04b581e721a1950051146d6ecbec5ad16217ee..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/compute/compute.hpp - - [begin_description] - includes all headers required for using odeint with Boost.Compute - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_HPP_DEFINED - -#include <boost/numeric/odeint/external/compute/compute_algebra.hpp> -#include <boost/numeric/odeint/external/compute/compute_operations.hpp> -#include <boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp> -#include <boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp> -#include <boost/numeric/odeint/external/compute/compute_resize.hpp> - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_algebra.hpp deleted file mode 100644 index 9cd3912eea68b59a0381016e9a5f568a68ef33c6..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_algebra.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/compute/compute_algebra.hpp - - [begin_description] - An algebra for Boost.Compute vectors. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_HPP_DEFINED - -#include <boost/preprocessor/repetition.hpp> -#include <boost/compute.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -struct compute_algebra -{ - -#define BOOST_ODEINT_COMPUTE_STATE_PARAM(z, n, unused) \ - StateType ## n &s ## n, - -#define BOOST_ODEINT_COMPUTE_ALGEBRA(z, n, unused) \ - template< BOOST_PP_ENUM_PARAMS(n, class StateType), class Operation > \ - static void for_each ## n( \ - BOOST_PP_REPEAT(n, BOOST_ODEINT_COMPUTE_STATE_PARAM, ~) \ - Operation op \ - ) \ - { \ - op( BOOST_PP_ENUM_PARAMS(n, s) ); \ - } - -BOOST_PP_REPEAT_FROM_TO(3, 9, BOOST_ODEINT_COMPUTE_ALGEBRA, ~) - -#undef BOOST_ODEINT_COMPUTE_ALGEBRA -#undef BOOST_ODEINT_COMPUTE_STATE_PARAM - - template < class S > - static typename S::value_type norm_inf( const S &s ) { - typedef typename S::value_type value_type; - - BOOST_COMPUTE_FUNCTION(value_type, max_abs, (value_type, value_type), - { - return max(_1, fabs(_2)); - }); - - return boost::compute::accumulate(s.begin(), s.end(), value_type(), max_abs); - } -}; -} // odeint -} // numeric -} // boost - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp deleted file mode 100644 index 6df360b76d8376a63ac88b867f23d3033e1550f2..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp - - [begin_description] - algebra_dispatcher specialization for Boost.Compute - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_DISPATCHER_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_DISPATCHER_HPP_DEFINED - -#include <boost/compute/container/vector.hpp> - -#include <boost/numeric/odeint/external/compute/compute_algebra.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -// specialization for Boost.Compute vector -template< class T , class A > -struct algebra_dispatcher< boost::compute::vector< T , A > > -{ - typedef compute_algebra algebra_type; -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_DISPATCHER_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_operations.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_operations.hpp deleted file mode 100644 index 58d5f692ffaa2b6c1dd64693dd0ffe8ad406f6af..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_operations.hpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/compute/compute_operations.hpp - - [begin_description] - Operations of Boost.Compute zipped iterators. Is the counterpart of the compute_algebra. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_OPERATIONS_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_OPERATIONS_HPP_DEFINED - -#include <boost/preprocessor/repetition.hpp> -#include <boost/compute.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -struct compute_operations { - -#define BOOST_ODEINT_COMPUTE_TEMPL_FAC(z, n, unused) \ - , class Fac ## n = BOOST_PP_CAT(Fac, BOOST_PP_DEC(n)) - -#define BOOST_ODEINT_COMPUTE_MEMB_FAC(z, n, unused) \ - const Fac ## n m_alpha ## n; - -#define BOOST_ODEINT_COMPUTE_PRM_FAC(z, n, unused) \ - BOOST_PP_COMMA_IF(n) const Fac ## n alpha ## n - -#define BOOST_ODEINT_COMPUTE_INIT_FAC(z, n, unused) \ - BOOST_PP_COMMA_IF(n) m_alpha ## n (alpha ## n) - -#define BOOST_ODEINT_COMPUTE_PRM_STATE(z, n, unused) \ - BOOST_PP_COMMA_IF(n) StateType ## n &s ## n - -#define BOOST_ODEINT_COMPUTE_BEGIN_STATE(z, n, unused) \ - BOOST_PP_COMMA_IF( BOOST_PP_DEC(n) ) s ## n.begin() - -#define BOOST_ODEINT_COMPUTE_END_STATE(z, n, unused) \ - BOOST_PP_COMMA_IF( BOOST_PP_DEC(n) ) s ## n.end() - -#define BOOST_ODEINT_COMPUTE_LAMBDA(z, n, unused) \ - BOOST_PP_EXPR_IF(n, +) m_alpha ## n * bc::lambda::get< n >(bc::_1) - -#define BOOST_ODEINT_COMPUTE_OPERATIONS(z, n, unused) \ - template< \ - class Fac0 = double \ - BOOST_PP_REPEAT_FROM_TO(1, n, BOOST_ODEINT_COMPUTE_TEMPL_FAC, ~) \ - > \ - struct scale_sum ## n { \ - BOOST_PP_REPEAT(n, BOOST_ODEINT_COMPUTE_MEMB_FAC, ~) \ - scale_sum ## n( \ - BOOST_PP_REPEAT(n, BOOST_ODEINT_COMPUTE_PRM_FAC, ~) \ - ) \ - : BOOST_PP_REPEAT(n, BOOST_ODEINT_COMPUTE_INIT_FAC, ~) \ - { } \ - template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), class StateType) > \ - void operator()( \ - BOOST_PP_REPEAT( \ - BOOST_PP_INC(n), \ - BOOST_ODEINT_COMPUTE_PRM_STATE, ~) \ - ) const \ - { \ - namespace bc = boost::compute; \ - bc::transform( \ - bc::make_zip_iterator( \ - boost::make_tuple( \ - BOOST_PP_REPEAT_FROM_TO( \ - 1, BOOST_PP_INC(n), \ - BOOST_ODEINT_COMPUTE_BEGIN_STATE, ~) \ - ) \ - ), \ - bc::make_zip_iterator( \ - boost::make_tuple( \ - BOOST_PP_REPEAT_FROM_TO( \ - 1, BOOST_PP_INC(n), \ - BOOST_ODEINT_COMPUTE_END_STATE, ~) \ - ) \ - ), \ - s0.begin(), \ - BOOST_PP_REPEAT(n, BOOST_ODEINT_COMPUTE_LAMBDA, ~) \ - ); \ - } \ - }; - -BOOST_PP_REPEAT_FROM_TO(2, 8, BOOST_ODEINT_COMPUTE_OPERATIONS, ~) - -#undef BOOST_ODEINT_COMPUTE_TEMPL_FAC -#undef BOOST_ODEINT_COMPUTE_MEMB_FAC -#undef BOOST_ODEINT_COMPUTE_PRM_FAC -#undef BOOST_ODEINT_COMPUTE_INIT_FAC -#undef BOOST_ODEINT_COMPUTE_PRM_STATE -#undef BOOST_ODEINT_COMPUTE_BEGIN_STATE -#undef BOOST_ODEINT_COMPUTE_END_STATE -#undef BOOST_ODEINT_COMPUTE_LAMBDA -#undef BOOST_ODEINT_COMPUTE_OPERATIONS - - template<class Fac1 = double, class Fac2 = Fac1> - struct scale_sum_swap2 { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - - scale_sum_swap2(const Fac1 alpha1, const Fac2 alpha2) - : m_alpha1(alpha1), m_alpha2(alpha2) { } - - template<class State0, class State1, class State2> - void operator()(State0 &s0, State1 &s1, State2 &s2) const { - namespace bc = boost::compute; - - bc::command_queue &queue = bc::system::default_queue(); - const bc::context &context = queue.get_context(); - - const char source[] = BOOST_COMPUTE_STRINGIZE_SOURCE( - kernel void scale_sum_swap2( - F1 a1, F2 a2, - global T0 *x0, global T1 *x1, global T2 *x2, - ) - { - uint i = get_global_id(0); - T0 tmp = x0[i]; - x0[i] = a1 * x1[i] + a2 * x2[i]; - x1[i] = tmp; - } - ); - - std::stringstream options; - options - << " -DT0=" << bc::type_name<typename State0::value_type>() - << " -DT1=" << bc::type_name<typename State1::value_type>() - << " -DT2=" << bc::type_name<typename State2::value_type>() - << " -DF1=" << bc::type_name<Fac1>() - << " -DF2=" << bc::type_name<Fac2>(); - - bc::program program = - bc::program::build_with_source(source, context, options.str()); - - bc::kernel kernel(program, "scale_sum_swap2"); - kernel.set_arg(0, m_alpha1); - kernel.set_arg(1, m_alpha2); - kernel.set_arg(2, s0.get_buffer()); - kernel.set_arg(3, s1.get_buffer()); - kernel.set_arg(4, s2.get_buffer()); - - queue.enqueue_1d_range_kernel(kernel, 0, s0.size()); - - } - }; - - template<class Fac1 = double> - struct rel_error { - const Fac1 m_eps_abs, m_eps_rel, m_a_x, m_a_dxdt; - - rel_error(const Fac1 eps_abs, const Fac1 eps_rel, const Fac1 a_x, const Fac1 a_dxdt) - : m_eps_abs(eps_abs), m_eps_rel(eps_rel), m_a_x(a_x), m_a_dxdt(a_dxdt) { } - - - template <class State0, class State1, class State2> - void operator()(State0 &s0, State1 &s1, State2 &s2) const { - namespace bc = boost::compute; - using bc::_1; - using bc::lambda::get; - - bc::for_each( - bc::make_zip_iterator( - boost::make_tuple( - s0.begin(), - s1.begin(), - s2.begin() - ) - ), - bc::make_zip_iterator( - boost::make_tuple( - s0.end(), - s1.end(), - s2.end() - ) - ), - get<0>(_1) = abs( get<0>(_1) ) / - (m_eps_abs + m_eps_rel * (m_a_x * abs(get<1>(_1) + m_a_dxdt * abs(get<2>(_1))))) - ); - } - }; -}; - -} // odeint -} // numeric -} // boost - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_OPERATIONS_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp deleted file mode 100644 index 76df2f37d561a592fe7c80727a074e9b1eaef4fe..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp - - [begin_description] - operations_dispatcher specialization for Boost.Compute - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_OPERATIONS_DISPATCHER_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_OPERATIONS_DISPATCHER_HPP_DEFINED - -#include <boost/compute/container/vector.hpp> - -#include <boost/numeric/odeint/external/compute/compute_operations.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -// specialization for Boost.Compute vector -template< class T , class A > -struct operations_dispatcher< boost::compute::vector< T , A > > -{ - typedef compute_operations operations_type; -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_OPERATIONS_DISPATCHER_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_resize.hpp deleted file mode 100644 index 013a7acc41d6edc5f8c520218990c4bf7555385d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/compute/compute_resize.hpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/compute/compute_resize.hpp - - [begin_description] - Enable resizing for Boost.Compute vector - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED - -#include <boost/compute/container/vector.hpp> - -#include <boost/numeric/odeint/util/copy.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< class T, class A > -struct is_resizeable< boost::compute::vector< T , A > > -{ - struct type : public boost::true_type { }; - const static bool value = type::value; -}; - -template< class T, class A > -struct same_size_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > > -{ - static bool same_size( const boost::compute::vector< T, A > &x , const boost::compute::vector< T, A > &y ) - { - return x.size() == y.size(); - } -}; - -template< class T, class A > -struct resize_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > > -{ - static void resize( boost::compute::vector< T, A > &x , const boost::compute::vector< T, A > &y ) - { - x.resize( y.size() ); - } -}; - - -template< class Container1, class T, class A > -struct copy_impl< Container1 , boost::compute::vector< T, A > > -{ - static void copy( const Container1 &from , boost::compute::vector< T, A > &to ) - { - boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) ); - } -}; - -template< class T, class A, class Container2 > -struct copy_impl< boost::compute::vector< T, A > , Container2 > -{ - static void copy( const boost::compute::vector< T, A > &from , Container2 &to ) - { - boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) ); - } -}; - -template< class T, class A > -struct copy_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > > -{ - static void copy( const boost::compute::vector< T, A > &from , boost::compute::vector< T, A > &to ) - { - boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) ); - } -}; - - - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen.hpp deleted file mode 100644 index 620acae51f2c3e7a1e79826ea0107612e2e70997..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/eigen/eigen.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_HPP_INCLUDED - - -#include <boost/numeric/odeint/external/eigen/eigen_algebra.hpp> -#include <boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp> -#include <boost/numeric/odeint/external/eigen/eigen_resize.hpp> - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_algebra.hpp deleted file mode 100644 index 093154decb0cf321e908bd2bc2205e008a61c432..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_algebra.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/eigen/eigen_algebra.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2013 Christian Shelton - Copyright 2013 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_ALGEBRA_HPP_INCLUDED - -#include <Eigen/Dense> -#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> - -// Necessary routines for Eigen matrices to work with vector_space_algebra -// from odeint -// (that is, it lets odeint treat the eigen matrices correctly, knowing -// how to add, multiply, compute the norm, etc) - -namespace Eigen { - - -template<typename D> -inline const -typename Eigen::CwiseUnaryOp< - typename Eigen::internal::scalar_add_op< - typename Eigen::internal::traits<D>::Scalar>, - const D > -operator+(const typename Eigen::MatrixBase<D> &m, - const typename Eigen::internal::traits<D>::Scalar &s) { - return Eigen::CwiseUnaryOp< - typename Eigen::internal::scalar_add_op< - typename Eigen::internal::traits<D>::Scalar>, - const D >(m.derived(),Eigen::internal::scalar_add_op< - typename Eigen::internal::traits<D>::Scalar>(s)); -} - -template<typename D> -inline const -typename Eigen::CwiseUnaryOp< - typename Eigen::internal::scalar_add_op< - typename Eigen::internal::traits<D>::Scalar>, - const D > -operator+(const typename Eigen::internal::traits<D>::Scalar &s, -const typename Eigen::MatrixBase<D> &m) { - return Eigen::CwiseUnaryOp< - typename Eigen::internal::scalar_add_op< - typename Eigen::internal::traits<D>::Scalar>, - const D >(m.derived(),Eigen::internal::scalar_add_op< - typename Eigen::internal::traits<D>::Scalar>(s)); -} - - - -template<typename D1,typename D2> -inline const -typename Eigen::CwiseBinaryOp< - typename Eigen::internal::scalar_quotient_op< - typename Eigen::internal::traits<D1>::Scalar>, - const D1, const D2> -operator/(const Eigen::MatrixBase<D1> &x1, const Eigen::MatrixBase<D2> &x2) { - return x1.cwiseQuotient(x2); -} - - -template< typename D > -inline const -typename Eigen::CwiseUnaryOp< - typename Eigen::internal::scalar_abs_op< - typename Eigen::internal::traits< D >::Scalar > , - const D > -abs( const Eigen::MatrixBase< D > &m ) { - return m.cwiseAbs(); -} - - - -} // end Eigen namespace - - - - - -namespace boost { -namespace numeric { -namespace odeint { - -template<typename B,int S1,int S2,int O, int M1, int M2> -struct vector_space_norm_inf< Eigen::Matrix<B,S1,S2,O,M1,M2> > -{ - typedef B result_type; - result_type operator()( const Eigen::Matrix<B,S1,S2,O,M1,M2> &m ) const - { - return m.template lpNorm<Eigen::Infinity>(); - } -}; - -} } } // end boost::numeric::odeint namespace - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp deleted file mode 100644 index 24a258257b10112888540aae8e37fa651b1656bd..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_ALGEBRA_DISPATCHER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_ALGEBRA_DISPATCHER_HPP_INCLUDED - - -namespace boost { -namespace numeric { -namespace odeint { - - -template< class Derived > -struct algebra_dispatcher_sfinae< Derived , - typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type > -{ - typedef vector_space_algebra algebra_type; -}; - - -template < class Derived > -struct algebra_dispatcher_sfinae< Derived , - typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type > -{ - typedef vector_space_algebra algebra_type; -}; - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_ALGEBRA_DISPATCHER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp deleted file mode 100644 index 4066c866fa97c4736de9010fd34acca847495f7b..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/eigen/eigen_resize.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2013 Ankur Sinha - Copyright 2013 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_RESIZE_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_RESIZE_HPP_DEFINED - - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> - -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_base_of.hpp> - -#include <Eigen/Dense> - -namespace boost { -namespace numeric { -namespace odeint { - - - -template< class Derived > -struct is_resizeable_sfinae< Derived , - typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - - -template < class Derived > -struct is_resizeable_sfinae< Derived , - typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - - - -template< class Derived > -struct same_size_impl_sfinae< Derived , Derived , - typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type > -{ - static bool same_size( const Eigen::MatrixBase< Derived > &m1 , const Eigen::MatrixBase< Derived > &m2 ) - - { - return ( ( m1.innerSize () == m2.innerSize () ) && ( m1.outerSize() == m2.outerSize() ) ); - } -}; - -template< class Derived > -struct same_size_impl_sfinae< Derived , Derived , - typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type > -{ - static bool same_size( const Eigen::ArrayBase< Derived > &v1 , const Eigen::ArrayBase< Derived > &v2 ) - { - return ( ( v1.innerSize () == v2.innerSize () ) && ( v1.outerSize() == v2.outerSize() ) ); - } -}; - - - - -template< class Derived > -struct resize_impl_sfinae< Derived , Derived , - typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type > -{ - static void resize( Eigen::MatrixBase< Derived > &m1 , const Eigen::MatrixBase< Derived > &m2 ) - { - m1.derived().resizeLike(m2); - } -}; - -template< class Derived > -struct resize_impl_sfinae< Derived , Derived , - typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type > -{ - static void resize( Eigen::ArrayBase< Derived > &v1 , const Eigen::ArrayBase< Derived > &v2 ) - { - v1.derived().resizeLike(v2); - } -}; - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_RESIZE_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp deleted file mode 100644 index a856f6e8a16db90435506d2cc98b396c1b20caea..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp +++ /dev/null @@ -1,229 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/gsl/gsl_wrapper.hpp - - [begin_description] - Wrapper for gsl_vector. - [end_description] - - Copyright 2011-2012 Mario Mulansky - Copyright 2011 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_GSL_GSL_WRAPPER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_GSL_GSL_WRAPPER_HPP_INCLUDED - -#include <new> - -#include <gsl/gsl_vector.h> - -#include <boost/type_traits/integral_constant.hpp> -#include <boost/range.hpp> -#include <boost/iterator/iterator_facade.hpp> - - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/copy.hpp> - -class const_gsl_vector_iterator; - -/* - * defines an iterator for gsl_vector - */ -class gsl_vector_iterator : public boost::iterator_facade< gsl_vector_iterator , double , boost::random_access_traversal_tag > -{ -public : - - gsl_vector_iterator( void ): m_p(0) , m_stride( 0 ) { } - explicit gsl_vector_iterator( gsl_vector *p ) : m_p( p->data ) , m_stride( p->stride ) { } - friend gsl_vector_iterator end_iterator( gsl_vector * ); - -private : - - friend class boost::iterator_core_access; - friend class const_gsl_vector_iterator; - - void increment( void ) { m_p += m_stride; } - void decrement( void ) { m_p -= m_stride; } - void advance( ptrdiff_t n ) { m_p += n*m_stride; } - bool equal( const gsl_vector_iterator &other ) const { return this->m_p == other.m_p; } - bool equal( const const_gsl_vector_iterator &other ) const; - double& dereference( void ) const { return *m_p; } - - double *m_p; - size_t m_stride; -}; - - - -/* - * defines an const iterator for gsl_vector - */ -class const_gsl_vector_iterator : public boost::iterator_facade< const_gsl_vector_iterator , const double , boost::random_access_traversal_tag > -{ -public : - - const_gsl_vector_iterator( void ): m_p(0) , m_stride( 0 ) { } - explicit const_gsl_vector_iterator( const gsl_vector *p ) : m_p( p->data ) , m_stride( p->stride ) { } - const_gsl_vector_iterator( const gsl_vector_iterator &p ) : m_p( p.m_p ) , m_stride( p.m_stride ) { } - -private : - - friend class boost::iterator_core_access; - friend class gsl_vector_iterator; - friend const_gsl_vector_iterator end_iterator( const gsl_vector * ); - - void increment( void ) { m_p += m_stride; } - void decrement( void ) { m_p -= m_stride; } - void advance( ptrdiff_t n ) { m_p += n*m_stride; } - bool equal( const const_gsl_vector_iterator &other ) const { return this->m_p == other.m_p; } - bool equal( const gsl_vector_iterator &other ) const { return this->m_p == other.m_p; } - const double& dereference( void ) const { return *m_p; } - - const double *m_p; - size_t m_stride; -}; - - -bool gsl_vector_iterator::equal( const const_gsl_vector_iterator &other ) const { return this->m_p == other.m_p; } - - -gsl_vector_iterator end_iterator( gsl_vector *x ) -{ - gsl_vector_iterator iter( x ); - iter.m_p += iter.m_stride * x->size; - return iter; -} - -const_gsl_vector_iterator end_iterator( const gsl_vector *x ) -{ - const_gsl_vector_iterator iter( x ); - iter.m_p += iter.m_stride * x->size; - return iter; -} - - - - -namespace boost -{ -template<> -struct range_mutable_iterator< gsl_vector* > -{ - typedef gsl_vector_iterator type; -}; - -template<> -struct range_const_iterator< gsl_vector* > -{ - typedef const_gsl_vector_iterator type; -}; -} // namespace boost - - - - -// template<> -inline gsl_vector_iterator range_begin( gsl_vector *x ) -{ - return gsl_vector_iterator( x ); -} - -// template<> -inline const_gsl_vector_iterator range_begin( const gsl_vector *x ) -{ - return const_gsl_vector_iterator( x ); -} - -// template<> -inline gsl_vector_iterator range_end( gsl_vector *x ) -{ - return end_iterator( x ); -} - -// template<> -inline const_gsl_vector_iterator range_end( const gsl_vector *x ) -{ - return end_iterator( x ); -} - - - - - - - -namespace boost { -namespace numeric { -namespace odeint { - - -template<> -struct is_resizeable< gsl_vector* > -{ - //struct type : public boost::true_type { }; - typedef boost::true_type type; - const static bool value = type::value; -}; - -template <> -struct same_size_impl< gsl_vector* , gsl_vector* > -{ - static bool same_size( const gsl_vector* x , const gsl_vector* y ) - { - return x->size == y->size; - } -}; - -template <> -struct resize_impl< gsl_vector* , gsl_vector* > -{ - static void resize( gsl_vector* &x , const gsl_vector* y ) - { - gsl_vector_free( x ); - x = gsl_vector_alloc( y->size ); - } -}; - -template<> -struct state_wrapper< gsl_vector* > -{ - typedef double value_type; - typedef gsl_vector* state_type; - typedef state_wrapper< gsl_vector* > state_wrapper_type; - - state_type m_v; - - state_wrapper( ) - { - m_v = gsl_vector_alloc( 1 ); - } - - state_wrapper( const state_wrapper_type &x ) - { - resize( m_v , x.m_v ); - gsl_vector_memcpy( m_v , x.m_v ); - } - - - ~state_wrapper() - { - gsl_vector_free( m_v ); - } - -}; - -} // odeint -} // numeric -} // boost - - - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_GSL_GSL_WRAPPER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mkl/mkl_operations.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mkl/mkl_operations.hpp deleted file mode 100644 index 59ac4b83cb87280398025407e644a54cecfa3ac4..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mkl/mkl_operations.hpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/mkl/mkl_operations.hpp - - [begin_description] - Wrapper classes for intel math kernel library types. - Get a free, non-commercial download of MKL at - http://software.intel.com/en-us/articles/non-commercial-software-download/ - [end_description] - - Copyright 2010-2011 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MKL_MKL_OPERATIONS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_MKL_MKL_OPERATIONS_HPP_INCLUDED - -#include <iostream> - -#include <mkl_cblas.h> -#include <boost/numeric/odeint/algebra/default_operations.hpp> - -/* exemplary example for writing bindings to the Intel MKL library - * see test/mkl for how to use mkl with odeint - * this is a quick and dirty implementation showing the general possibility. - * It works only with containers based on double and sequential memory allocation. - */ - -namespace boost { -namespace numeric { -namespace odeint { - -/* only defined for doubles */ -struct mkl_operations -{ - //template< class Fac1 , class Fac2 > struct scale_sum2; - - template< class F1 = double , class F2 = F1 > - struct scale_sum2 - { - typedef double Fac1; - typedef double Fac2; - const Fac1 m_alpha1; - const Fac2 m_alpha2; - - scale_sum2( const Fac1 alpha1 , const Fac2 alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { } - - template< class T1 , class T2 , class T3 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3) const - { // t1 = m_alpha1 * t2 + m_alpha2 * t3; - // we get Containers that have size() and [i]-access - - const int n = t1.size(); - //boost::numeric::odeint::copy( t1 , t3 ); - if( &(t2[0]) != &(t1[0]) ) - { - cblas_dcopy( n , &(t2[0]) , 1 , &(t1[0]) , 1 ); - } - cblas_dscal( n , m_alpha1 , &(t1[0]) , 1 ); - cblas_daxpy( n , m_alpha2 , &(t3[0]) , 1 , &(t1[0]) , 1 ); - //daxpby( &n , &m_alpha2 , &(t3[0]) , &one , &m_alpha1 , &(t1[0]) , &one ); - } - }; - - template< class F1 = double , class F2 = F1 , class F3 = F2 > - struct scale_sum3 - { - typedef double Fac1; - typedef double Fac2; - typedef double Fac3; - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - - scale_sum3( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) { } - - template< class T1 , class T2 , class T3 , class T4 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 ) const - { // t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4; - // we get Containers that have size() and [i]-access - - const int n = t1.size(); - //boost::numeric::odeint::copy( t1 , t3 ); - if( &(t2[0]) != &(t1[0]) ) - { - cblas_dcopy( n , &(t2[0]) , 1 , &(t1[0]) , 1 ); - } - cblas_dscal( n , m_alpha1 , &(t1[0]) , 1 ); - cblas_daxpy( n , m_alpha2 , &(t3[0]) , 1 , &(t1[0]) , 1 ); - //daxpby( &n , &m_alpha2 , &(t3[0]) , &one , &m_alpha1 , &(t1[0]) , &one ); - cblas_daxpy( n , m_alpha3 , &(t4[0]) , 1 , &(t1[0]) , 1 ); - } - }; - - template< class F1 = double , class F2 = F1 , class F3 = F2 , class F4 = F3 > - struct scale_sum4 - { - typedef double Fac1; - typedef double Fac2; - typedef double Fac3; - typedef double Fac4; - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - - scale_sum4( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , const Fac4 alpha4 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 ) const - { // t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5; - // we get Containers that have size() and [i]-access - - const int n = t1.size(); - //boost::numeric::odeint::copy( t1 , t3 ); - if( &(t2[0]) != &(t1[0]) ) - { - cblas_dcopy( n , &(t2[0]) , 1 , &(t1[0]) , 1 ); - } - - cblas_dscal( n , m_alpha1 , &(t1[0]) , 1 ); - cblas_daxpy( n , m_alpha2 , &(t3[0]) , 1 , &(t1[0]) , 1 ); - //daxpby( &n , &m_alpha2 , &(t3[0]) , &one , &m_alpha1 , &(t1[0]) , &one ); - cblas_daxpy( n , m_alpha3 , &(t4[0]) , 1 , &(t1[0]) , 1 ); - cblas_daxpy( n , m_alpha4 , &(t5[0]) , 1 , &(t1[0]) , 1 ); - } - }; - - - template< class F1 = double , class F2 = F1 , class F3 = F2 , class F4 = F3 , class F5 = F4 > - struct scale_sum5 - { - typedef double Fac1; - typedef double Fac2; - typedef double Fac3; - typedef double Fac4; - typedef double Fac5; - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - - scale_sum5( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , const Fac4 alpha4 , const Fac5 alpha5 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > - void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 ) const - { // t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6; - // we get Containers that have size() and [i]-access - - const int n = t1.size(); - //boost::numeric::odeint::copy( t1 , t3 ); - if( &(t2[0]) != &(t1[0]) ) - { - cblas_dcopy( n , &(t2[0]) , 1 , &(t1[0]) , 1 ); - } - - cblas_dscal( n , m_alpha1 , &(t1[0]) , 1 ); - cblas_daxpy( n , m_alpha2 , &(t3[0]) , 1 , &(t1[0]) , 1 ); - //daxpby( &n , &m_alpha2 , &(t3[0]) , &one , &m_alpha1 , &(t1[0]) , &one ); - cblas_daxpy( n , m_alpha3 , &(t4[0]) , 1 , &(t1[0]) , 1 ); - cblas_daxpy( n , m_alpha4 , &(t5[0]) , 1 , &(t1[0]) , 1 ); - cblas_daxpy( n , m_alpha5 , &(t6[0]) , 1 , &(t1[0]) , 1 ); - } - }; - -}; - -} // odeint -} // numeric -} // boost - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MKL_MKL_OPERATIONS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi.hpp deleted file mode 100644 index 26e1ae991a7eb3e8e5af98a56de119b5a0acb50c..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi.hpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/mpi/mpi.hpp - - [begin_description] - Wrappers for MPI. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_HPP_INCLUDED - -#include <boost/numeric/odeint/external/mpi/mpi_vector_state.hpp> -#include <boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp> - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp deleted file mode 100644 index 5d9022582ac495bdded4535c9341409501c9fda2..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp - - [begin_description] - Nested parallelized algebra for MPI. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_NESTED_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_NESTED_ALGEBRA_HPP_INCLUDED - -#include <boost/numeric/odeint/algebra/norm_result_type.hpp> -#include <boost/numeric/odeint/util/n_ary_helper.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -/** \brief MPI-parallelized algebra, wrapping another algebra. - */ -template< class InnerAlgebra > -struct mpi_nested_algebra -{ - -// execute the InnerAlgebra on each node's local data. -#define BOOST_ODEINT_GEN_BODY(n) \ - InnerAlgebra::for_each##n( \ - BOOST_PP_ENUM_BINARY_PARAMS(n, s, () BOOST_PP_INTERCEPT) , \ - op \ - ); -BOOST_ODEINT_GEN_FOR_EACH(BOOST_ODEINT_GEN_BODY) -#undef BOOST_ODEINT_GEN_BODY - - - template< class NestedState > - static typename norm_result_type< typename NestedState::value_type >::type norm_inf( const NestedState &s ) - { - typedef typename norm_result_type< typename NestedState::value_type >::type result_type; - // local maximum - result_type value = InnerAlgebra::norm_inf( s() ); - // global maximum - return boost::mpi::all_reduce(s.world, value, boost::mpi::maximum<result_type>()); - } - -}; - - -} -} -} - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_state.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_state.hpp deleted file mode 100644 index aba179c09c85715f51960e959b5c74dc428472e6..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_state.hpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/mpi/mpi_state.hpp - - [begin_description] - A generic split state, storing partial data on each node. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_STATE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_STATE_HPP_INCLUDED - -#include <vector> -#include <algorithm> -#include <boost/mpi.hpp> -#include <boost/numeric/odeint/util/copy.hpp> -#include <boost/numeric/odeint/util/split.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -/** \brief A container which has its contents distributed among the nodes. - */ -template< class InnerState > -struct mpi_state -{ - typedef InnerState value_type; - - // the node's local data. - InnerState m_data; - - boost::mpi::communicator world; - - mpi_state() {} - mpi_state(boost::mpi::communicator comm) : world(comm) {} - - inline InnerState &operator()() { return m_data; } - inline const InnerState &operator()() const { return m_data; } -}; - - - - -template< class InnerState > -struct is_resizeable< mpi_state< InnerState > > - : is_resizeable< InnerState > { }; - - -template< class InnerState1 , class InnerState2 > -struct same_size_impl< mpi_state< InnerState1 > , mpi_state< InnerState2 > > -{ - static bool same_size( const mpi_state< InnerState1 > &x , const mpi_state< InnerState2 > &y ) - { - const bool local = boost::numeric::odeint::same_size(x(), y()); - return boost::mpi::all_reduce(x.world, local, mpi::bitwise_and<bool>()); - } -}; - - -template< class InnerState1 , class InnerState2 > -struct resize_impl< mpi_state< InnerState1 > , mpi_state< InnerState2 > > -{ - static void resize( mpi_state< InnerState1 > &x , const mpi_state< InnerState2 > &y ) - { - // resize local parts on each node. - boost::numeric::odeint::resize(x(), y()); - } -}; - - -/** \brief Copy data between mpi_states of same size. */ -template< class InnerState1 , class InnerState2 > -struct copy_impl< mpi_state< InnerState1 > , mpi_state< InnerState2 > > -{ - static void copy( const mpi_state< InnerState1 > &from , mpi_state< InnerState2 > &to ) - { - // copy local parts on each node. - boost::numeric::odeint::copy(from(), to()); - } -}; - - - -/** \brief Use `mpi_algebra` for `mpi_state`. */ -template< class InnerState > -struct algebra_dispatcher< mpi_state< InnerState > > -{ - typedef mpi_nested_algebra< - typename algebra_dispatcher< InnerState >::algebra_type - > algebra_type; -}; - - -} -} -} - - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_vector_state.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_vector_state.hpp deleted file mode 100644 index 096d40a65528bb4014a599da5f6d85a34f2ad62b..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mpi/mpi_vector_state.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/mpi/mpi_vector_state.hpp - - [begin_description] - Copying a container from/to an mpi_state splits/joins it. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_VECTOR_STATE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_VECTOR_STATE_HPP_INCLUDED - -#include <vector> -#include <algorithm> -#include <boost/mpi.hpp> -#include <boost/numeric/odeint/util/copy.hpp> -#include <boost/numeric/odeint/util/split_adaptor.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/external/mpi/mpi_state.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/** \brief Split data from some container on node 0 to the slaves. - * Source must be a model of Random Access Range. */ -template< class Source , class InnerState > -struct split_impl< Source, mpi_state< InnerState >, - typename boost::enable_if< boost::has_range_const_iterator<Source> >::type > -{ - typedef typename boost::range_iterator<const Source>::type iterator; - - static void split( const Source &from, mpi_state< InnerState > &to ) - { - std::vector< InnerState > pieces; - if(to.world.rank() == 0) { - const size_t num = static_cast<size_t>(to.world.size()); - pieces.resize(num); - for(size_t i = 0 ; i < num ; i++) { - iterator_range<iterator> part = detail::make_split_range(from, i, num); - boost::numeric::odeint::resize(pieces[i], part); - boost::numeric::odeint::copy(part, pieces[i]); - } - } - // send to nodes - boost::mpi::scatter(to.world, pieces, to(), 0); - } -}; - -/** \brief Merge data from an mpi_state to some container on node 0. - * Target must be a model Single Pass Range. */ -template< class Target, class InnerState > -struct unsplit_impl< mpi_state< InnerState >, Target, - typename boost::enable_if< boost::has_range_iterator<Target> >::type > -{ - typedef typename boost::range_iterator<Target>::type iterator; - - static void unsplit( const mpi_state< InnerState > &from , Target &to ) - { - std::vector< InnerState > pieces; - // send data to root - boost::mpi::gather(from.world, from(), pieces, 0); - if(from.world.rank() == 0) { - // check target size - size_t total_size = 0; - for(size_t i = 0 ; i < pieces.size() ; i++) - total_size += boost::size(pieces[i]); - BOOST_ASSERT( total_size <= boost::size(to) ); - // copy parts - iterator out = boost::begin(to); - for(size_t i = 0 ; i < pieces.size() ; i++) - out = boost::copy(pieces[i], out); - } - } -}; - - -} -} -} - - -#endif - diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp deleted file mode 100644 index 9950ce1592e53b0f4c478e9c95599ce5749b6b6d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp +++ /dev/null @@ -1,162 +0,0 @@ -/* -[begin_description] -Modification of the implicit Euler method, works with the MTL4 matrix library only. -[end_description] - -Copyright 2012-2013 Andreas Angelopoulos -Copyright 2012-2013 Karsten Ahnert -Copyright 2012-2013 Mario Mulansky - -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or -copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_IMPLICIT_EULER_MTL4_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_IMPLICIT_EULER_MTL4_HPP_INCLUDED - - -#include <utility> - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/external/mtl4/mtl4_resize.hpp> - -#include <boost/numeric/mtl/mtl.hpp> -#include <boost/numeric/itl/itl.hpp> - - - - -namespace boost { -namespace numeric { -namespace odeint { - - -template< class ValueType , class Resizer = initially_resizer > -class implicit_euler_mtl4 -{ - -public: - - typedef ValueType value_type; - typedef value_type time_type; - typedef mtl::dense_vector<value_type> state_type; - - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_type deriv_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef mtl::compressed2D< value_type > matrix_type; - typedef state_wrapper< matrix_type > wrapped_matrix_type; - - typedef Resizer resizer_type; - typedef stepper_tag stepper_category; - - typedef implicit_euler_mtl4< ValueType , Resizer > stepper_type; - - - implicit_euler_mtl4( const value_type epsilon = 1E-6 ) - : m_epsilon( epsilon ) , m_resizer() , - m_dxdt() , m_x() , - m_identity() , m_jacobi() - { } - - - template< class System > - void do_step( System system , state_type &x , time_type t , time_type dt ) - { - typedef typename odeint::unwrap_reference< System >::type system_type; - typedef typename odeint::unwrap_reference< typename system_type::first_type >::type deriv_func_type; - typedef typename odeint::unwrap_reference< typename system_type::second_type >::type jacobi_func_type; - system_type &sys = system; - deriv_func_type &deriv_func = sys.first; - jacobi_func_type &jacobi_func = sys.second; - - m_resizer.adjust_size( x , detail::bind( - &stepper_type::template resize_impl< state_type > , detail::ref( *this ) , detail::_1 ) ); - - m_identity.m_v = 1; - - t += dt; - m_x.m_v = x; - - deriv_func( x , m_dxdt.m_v , t ); - jacobi_func( x , m_jacobi.m_v , t ); - - - m_dxdt.m_v *= -dt; - - m_jacobi.m_v *= dt; - m_jacobi.m_v -= m_identity.m_v ; - - - - // using ilu_0 preconditioning -incomplete LU factorisation - // itl::pc::diagonal<matrix_type,double> L(m_jacobi.m_v); - itl::pc::ilu_0<matrix_type> L( m_jacobi.m_v ); - - solve( m_jacobi.m_v , m_x.m_v , m_dxdt.m_v , L ); - x+= m_x.m_v; - - - } - - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_impl( x ); - } - - -private: - - - /* - Applying approximate iterative linear solvers - default solver is Biconjugate gradient stabilized method - itl::bicgstab(A, x, b, L, iter); - */ - template < class LinearOperator, class HilbertSpaceX, class HilbertSpaceB, class Preconditioner> - void solve(const LinearOperator& A, HilbertSpaceX& x, const HilbertSpaceB& b, - const Preconditioner& L, int max_iteractions =500) - { - // Termination criterion: r < 1e-6 * b or N iterations - itl::basic_iteration< double > iter( b , max_iteractions , 1e-6 ); - itl::bicgstab( A , x , b , L , iter ); - - } - - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_x , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_identity , x , typename is_resizeable<matrix_type>::type() ); - resized |= adjust_size_by_resizeability( m_jacobi , x , typename is_resizeable<matrix_type>::type() ); - return resized; - } - - -private: - - value_type m_epsilon; - resizer_type m_resizer; - wrapped_deriv_type m_dxdt; - wrapped_state_type m_x; - wrapped_matrix_type m_identity; - wrapped_matrix_type m_jacobi; -}; - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_IMPLICIT_EULER_MTL4_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4.hpp deleted file mode 100644 index 9b9ebf71d05302dec0fe44c6813c25262aa3bc8b..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - [auto_generated] - /boost/numeric/odeint/external/mtl4/mtl4.hpp - - [begin_description] - includes all headers required for using mtl4 with odeint - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_MTL4_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_MTL4_HPP_INCLUDED - -#include <boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp> -#include <boost/numeric/odeint/external/mtl4/mtl4_resize.hpp> - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_MTL4_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp deleted file mode 100644 index 8f6bfbe32e93dc58a2390c84d1bb8390371c208c..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp - - [begin_description] - specialization of the algebra dispatcher for mtl4 - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_MTL4_MTL4_ALGEBRA_DISPATCHER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_MTL4_MTL4_ALGEBRA_DISPATCHER_HPP_INCLUDED - -#include <boost/numeric/mtl/mtl.hpp> - -#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template<typename Value, typename Parameters> -struct algebra_dispatcher< mtl::dense_vector< Value , Parameters > > -{ - typedef vector_space_algebra algebra_type; -}; - -template<typename Value, typename Parameters> -struct algebra_dispatcher< mtl::dense2D< Value , Parameters > > -{ - typedef vector_space_algebra algebra_type; -}; - -template<typename Value , size_t BitMask , typename Parameters> -struct algebra_dispatcher< mtl::morton_dense< Value , BitMask, Parameters > > -{ - typedef vector_space_algebra algebra_type; -}; - -template<typename Value, typename Parameters> -struct algebra_dispatcher< mtl::compressed2D< Value , Parameters > > -{ - typedef vector_space_algebra algebra_type; -}; - -// specialization of infinity norm calculation - -template<typename Value, typename Parameters> -struct vector_space_norm_inf< mtl::dense_vector< Value , Parameters > > -{ - typedef Value result_type; - Value operator()( const mtl::dense_vector< Value , Parameters > &x ) const - { - return mtl::infinity_norm(x); - } -}; - -template<typename Value, typename Parameters> -struct vector_space_norm_inf< mtl::dense2D< Value , Parameters > > -{ - typedef Value result_type; - Value operator()( const mtl::dense2D< Value , Parameters > &x ) const - { - return mtl::infinity_norm(x); - } -}; - -template<typename Value , size_t BitMask , typename Parameters> -struct vector_space_norm_inf< mtl::morton_dense< Value , BitMask , Parameters > > -{ - typedef Value result_type; - Value operator()( const mtl::morton_dense< Value , BitMask , Parameters > &x ) const - { - return mtl::infinity_norm(x); - } -}; - -template<typename Value, typename Parameters> -struct vector_space_norm_inf< mtl::compressed2D< Value , Parameters > > -{ - typedef Value result_type; - Value operator()( const mtl::compressed2D< Value , Parameters > &x ) const - { - return mtl::infinity_norm(x); - } -}; - -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_MTL4_MTL4_ALGEBRA_DISPATCHER_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp deleted file mode 100644 index 762283550b48039cbd459e5a411aed94b36331cd..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp +++ /dev/null @@ -1,133 +0,0 @@ -/* -[begin_description] -Modification of the implicit Euler method, works with the MTL4 matrix library only. -[end_description] - -Copyright 2012-2013 Andreas Angelopoulos -Copyright 2012-2013 Karsten Ahnert -Copyright 2012-2013 Mario Mulansky - -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or -copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> - -#include <boost/numeric/mtl/vector/dense_vector.hpp> -#include <boost/numeric/mtl/matrix/dense2D.hpp> -#include <boost/numeric/mtl/matrix/compressed2D.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - -template< class Value , class Parameters > -struct is_resizeable< mtl::dense_vector< Value , Parameters > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - -template< class Value , class Parameters > -struct is_resizeable< mtl::dense2D< Value , Parameters > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - -template< class Value , class Parameters > -struct is_resizeable< mtl::compressed2D< Value , Parameters > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - - - - -template< class Value , class Parameters > -struct same_size_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > > -{ - static bool same_size( const mtl::dense_vector< Value , Parameters > &v1 , - const mtl::dense_vector< Value , Parameters > &v2 ) - { - return mtl::size( v1 ) == mtl::size( v2 ); - } -}; - -template< class Value , class Parameters > -struct resize_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > > -{ - static void resize( mtl::dense_vector< Value , Parameters > &v1 , - const mtl::dense_vector< Value , Parameters > &v2 ) - { - v1.change_dim( mtl::size( v2 ) ); - } -}; - - - -template< class Value , class MatrixParameters , class VectorParameters > -struct same_size_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > > -{ - static bool same_size( const mtl::dense2D< Value , MatrixParameters > &m , - const mtl::dense_vector< Value , VectorParameters > &v ) - { - return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) ); - } -}; - -template< class Value , class MatrixParameters , class VectorParameters > -struct resize_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > > -{ - static void resize( mtl::dense2D< Value , MatrixParameters > &m , - const mtl::dense_vector< Value , VectorParameters > &v ) - { - m.change_dim( mtl::size( v ) , mtl::size( v ) , false ); - } -}; - - - - -template< class Value , class MatrixParameters , class VectorParameters > -struct same_size_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > > -{ - static bool same_size( const mtl::compressed2D< Value , MatrixParameters > &m , - const mtl::dense_vector< Value , VectorParameters > &v ) - { - return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) ); - } -}; - -template< class Value , class MatrixParameters , class VectorParameters > -struct resize_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > > -{ - static void resize( mtl::compressed2D< Value , MatrixParameters > &m , - const mtl::dense_vector< Value , VectorParameters > &v ) - { - m.change_dim( mtl::size( v ) , mtl::size( v ) ); - } -}; - - - - - - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_algebra_dispatcher.hpp deleted file mode 100644 index 7b82a8b315151a084fbe140ab10154dce734fe44..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_algebra_dispatcher.hpp +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================== -// Copyright 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI -// Copyright 2014 NumScale SAS -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -//============================================================================== -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_ALGEBRA_DISPATCHER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_ALGEBRA_DISPATCHER_HPP_INCLUDED - -#include <nt2/core/container/table/table.hpp> - -#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> - -namespace boost { namespace numeric { namespace odeint { -template<typename T, typename S> -struct algebra_dispatcher<nt2::container::table<T,S> > -{ - typedef vector_space_algebra algebra_type; -}; -} } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_copy.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_copy.hpp deleted file mode 100644 index 0fd558843c69dbc2140c0c52df49850856fce053..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_copy.hpp +++ /dev/null @@ -1,33 +0,0 @@ -//============================================================================== -// Copyright 2014 LASMEA UMR 6602 CNRS/Univ. Clermont II -// Copyright 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI -// Copyright 2014 MetaScale SAS -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -//============================================================================== -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_COPY_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_COPY_HPP_INCLUDED - -#include <nt2/core/container/table/table.hpp> - -#include <boost/numeric/odeint/util/copy.hpp> - -namespace boost { namespace numeric { namespace odeint { - -template<typename T, typename S> -struct copy_impl< nt2::container::table<T,S> - , nt2::container::table<T,S> - > -{ - static void copy ( const nt2::container::table<T,S> &v1 - , nt2::container::table<T,S> &v2 - ) - { - v2 = v1; - } -}; -} } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp deleted file mode 100644 index 81f867e35367514b5b0217564c5b2545454d0da1..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp +++ /dev/null @@ -1,31 +0,0 @@ -//============================================================================== -// Copyright 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI -// Copyright 2014 NumScale SAS -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -//============================================================================== -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_NORM_INF_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_NORM_INF_HPP_INCLUDED - -#include <nt2/core/container/table/table.hpp> -#include <nt2/include/functions/globalmax.hpp> -#include <nt2/include/functions/abs.hpp> - -#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> - -namespace boost { namespace numeric { namespace odeint -{ - template<typename T, typename S> - struct vector_space_norm_inf<nt2::container::table<T,S> > - { - typedef T result_type; - result_type operator()(const nt2::container::table<T,S> &v1) const - { - return nt2::globalmax(nt2::abs(v1)); - } - }; -} } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_resize.hpp deleted file mode 100644 index d9c2359c3ed99b44903ccae7a0abaf6ff5780333..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/nt2/nt2_resize.hpp +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================== -// Copyright 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI -// Copyright 2014 NumScale SAS -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -//============================================================================== -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_RESIZE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_RESIZE_HPP_INCLUDED - -#include <nt2/core/container/table/table.hpp> - -#include <boost/numeric/odeint/util/same_size.hpp> - -namespace boost { namespace numeric { namespace odeint { - -template<typename T, typename S> -struct is_resizeable< nt2::container::table<T,S> > -{ - typedef boost::true_type type; - static const bool value = type::value; -}; - -template<typename T, typename S> -struct same_size_impl< nt2::container::table<T,S> - , nt2::container::table<T,S> - > -{ - static bool same_size ( const nt2::container::table<T,S> &v1 - , const nt2::container::table<T,S> &v2 - ) - { - return v1.extent() == v2.extent(); - } -}; - -template<typename T, typename S> -struct resize_impl< nt2::container::table<T,S> - , nt2::container::table<T,S> - > -{ - static void resize ( nt2::container::table<T,S> &v1 - , const nt2::container::table<T,S> &v2 - ) - { - v1.resize( v2.extent() ); - } -}; -} } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp.hpp deleted file mode 100644 index 0d6fb0b85579cd31721a6d25eb52ead72d62902c..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/openmp/openmp.hpp - - [begin_description] - Wrappers for OpenMP. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_HPP_INCLUDED - -// level 1: parallel iteration over random access container -#include <boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp> - -// level 2: split range state -#include <boost/numeric/odeint/external/openmp/openmp_state.hpp> - -// level 3: process a random access container of sub-states in parallel -#include <boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp> - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp deleted file mode 100644 index a3d299f0a74238b99edcb45f1fddb99aa6f6c25f..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp +++ /dev/null @@ -1,281 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp - - [begin_description] - Nested parallelized algebra for OpenMP. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_NESTED_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_NESTED_ALGEBRA_HPP_INCLUDED - -#include <boost/assert.hpp> -#include <boost/range.hpp> -#include <boost/numeric/odeint/algebra/norm_result_type.hpp> -#include <boost/numeric/odeint/util/n_ary_helper.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -/** \brief OpenMP-parallelized algebra, wrapping another, non-parallelized algebra. - * - * NestedState must be a model of Random Access Range, where the elements are sub-states - * which will be processed in parallel. - */ -template< class InnerAlgebra > -struct openmp_nested_algebra -{ - -#if __cplusplus >= 201103L // C++11 supports _Pragma - -#define BOOST_ODEINT_GEN_LOCAL(z, n, unused) \ - BOOST_ASSERT_MSG( len == boost::size(s ## n), "All nested state ranges must have the same size." ); \ - typename boost::range_iterator<S ## n>::type beg ## n = boost::begin(s ## n); -#define BOOST_ODEINT_GEN_BODY(n) \ - const size_t len = boost::size(s0); \ - BOOST_PP_REPEAT(n, BOOST_ODEINT_GEN_LOCAL, ~) \ - _Pragma("omp parallel for schedule(runtime)") \ - for( size_t i = 0 ; i < len ; i++ ) \ - InnerAlgebra::for_each##n( \ - BOOST_PP_ENUM_BINARY_PARAMS(n, beg, [i] BOOST_PP_INTERCEPT) , \ - op \ - ); -BOOST_ODEINT_GEN_FOR_EACH(BOOST_ODEINT_GEN_BODY) -#undef BOOST_ODEINT_GEN_BODY -#undef BOOST_ODEINT_GEN_LOCAL - -#else - - template< class S0 , class Op > static void for_each1 ( S0 &s0 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each1( beg0 [i] , op ); - } - template< class S0 , class S1 , class Op > static void for_each2 ( S0 &s0 , S1 &s1 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each2( beg0 [i] , beg1 [i] , op ); - } - template< class S0 , class S1 , class S2 , class Op > static void for_each3 ( S0 &s0 , S1 &s1 , S2 &s2 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each3( beg0 [i] , beg1 [i] , beg2 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class Op > static void for_each4 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each4( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class Op > static void for_each5 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each5( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class Op > static void for_each6 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each6( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op > static void for_each7 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each7( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class Op > static void for_each8 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each8( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class Op > static void for_each9 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each9( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class Op > static void for_each10 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each10( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class Op > static void for_each11 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each11( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class Op > static void for_each12 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - typename boost::range_iterator<S11>::type beg11 = boost::begin(s11); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each12( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , beg11 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op > static void for_each13 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - typename boost::range_iterator<S11>::type beg11 = boost::begin(s11); - typename boost::range_iterator<S12>::type beg12 = boost::begin(s12); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each13( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , beg11 [i] , beg12 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op > static void for_each14 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - typename boost::range_iterator<S11>::type beg11 = boost::begin(s11); - typename boost::range_iterator<S12>::type beg12 = boost::begin(s12); - typename boost::range_iterator<S13>::type beg13 = boost::begin(s13); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each14( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , beg11 [i] , beg12 [i] , beg13 [i] , op ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op > static void for_each15 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - typename boost::range_iterator<S11>::type beg11 = boost::begin(s11); - typename boost::range_iterator<S12>::type beg12 = boost::begin(s12); - typename boost::range_iterator<S13>::type beg13 = boost::begin(s13); - typename boost::range_iterator<S14>::type beg14 = boost::begin(s14); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) InnerAlgebra::for_each15( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , beg11 [i] , beg12 [i] , beg13 [i] , beg14 [i] , op ); - } - -#endif - - - template< class NestedState > - static typename norm_result_type< typename NestedState::value_type >::type norm_inf( const NestedState &s ) - { - typedef typename boost::range_iterator<const NestedState>::type iterator; - typedef typename std::iterator_traits<iterator>::value_type value_type; - typedef typename norm_result_type<value_type>::type result_type; - result_type init = static_cast< result_type >( 0 ); - const size_t len = boost::size(s); - iterator beg = boost::begin(s); -# pragma omp parallel for reduction(max: init) schedule(dynamic) - for( size_t i = 0 ; i < len ; i++ ) - init = (std::max)( init , InnerAlgebra::norm_inf( beg[i] ) ); - return init; - } - -}; - - -} -} -} - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp deleted file mode 100644 index 295db647d46c41ccda97cc5133a772a45a403b98..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp - - [begin_description] - Range algebra for OpenMP. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_RANGE_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_RANGE_ALGEBRA_HPP_INCLUDED - -#include <boost/assert.hpp> -#include <boost/range.hpp> -#include <boost/numeric/odeint/algebra/norm_result_type.hpp> -#include <boost/numeric/odeint/util/n_ary_helper.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -/** \brief OpenMP-parallelized range algebra. - * - * State must be a model of Random Access Range. - */ -struct openmp_range_algebra -{ - -#if __cplusplus >= 201103L // C++11 supports _Pragma - -#define BOOST_ODEINT_GEN_LOCAL(z, n, unused) \ - BOOST_ASSERT_MSG( len == boost::size(s ## n), "All state ranges must have the same size." ); \ - typename boost::range_iterator<S ## n>::type beg ## n = boost::begin(s ## n); -#define BOOST_ODEINT_GEN_BODY(n) \ - const size_t len = boost::size(s0); \ - BOOST_PP_REPEAT(n, BOOST_ODEINT_GEN_LOCAL, ~) \ - _Pragma("omp parallel for schedule(runtime)") \ - for( size_t i = 0 ; i < len ; i++ ) \ - op( BOOST_PP_ENUM_BINARY_PARAMS(n, beg, [i] BOOST_PP_INTERCEPT) ); -BOOST_ODEINT_GEN_FOR_EACH(BOOST_ODEINT_GEN_BODY) -#undef BOOST_ODEINT_GEN_BODY -#undef BOOST_ODEINT_GEN_LOCAL - -#else - - template< class S0 , class Op > static void for_each1 ( S0 &s0 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] ); - } - template< class S0 , class S1 , class Op > static void for_each2 ( S0 &s0 , S1 &s1 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] ); - } - template< class S0 , class S1 , class S2 , class Op > static void for_each3 ( S0 &s0 , S1 &s1 , S2 &s2 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class Op > static void for_each4 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class Op > static void for_each5 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class Op > static void for_each6 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op > static void for_each7 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class Op > static void for_each8 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class Op > static void for_each9 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class Op > static void for_each10 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class Op > static void for_each11 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class Op > static void for_each12 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - typename boost::range_iterator<S11>::type beg11 = boost::begin(s11); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , beg11 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op > static void for_each13 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - typename boost::range_iterator<S11>::type beg11 = boost::begin(s11); - typename boost::range_iterator<S12>::type beg12 = boost::begin(s12); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , beg11 [i] , beg12 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op > static void for_each14 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - typename boost::range_iterator<S11>::type beg11 = boost::begin(s11); - typename boost::range_iterator<S12>::type beg12 = boost::begin(s12); - typename boost::range_iterator<S13>::type beg13 = boost::begin(s13); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , beg11 [i] , beg12 [i] , beg13 [i] ); - } - template< class S0 , class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op > static void for_each15 ( S0 &s0 , S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op ) { - const size_t len = boost::size(s0); - typename boost::range_iterator<S0>::type beg0 = boost::begin(s0); - typename boost::range_iterator<S1>::type beg1 = boost::begin(s1); - typename boost::range_iterator<S2>::type beg2 = boost::begin(s2); - typename boost::range_iterator<S3>::type beg3 = boost::begin(s3); - typename boost::range_iterator<S4>::type beg4 = boost::begin(s4); - typename boost::range_iterator<S5>::type beg5 = boost::begin(s5); - typename boost::range_iterator<S6>::type beg6 = boost::begin(s6); - typename boost::range_iterator<S7>::type beg7 = boost::begin(s7); - typename boost::range_iterator<S8>::type beg8 = boost::begin(s8); - typename boost::range_iterator<S9>::type beg9 = boost::begin(s9); - typename boost::range_iterator<S10>::type beg10 = boost::begin(s10); - typename boost::range_iterator<S11>::type beg11 = boost::begin(s11); - typename boost::range_iterator<S12>::type beg12 = boost::begin(s12); - typename boost::range_iterator<S13>::type beg13 = boost::begin(s13); - typename boost::range_iterator<S14>::type beg14 = boost::begin(s14); - #pragma omp parallel for schedule(runtime) - for( size_t i = 0 ; i < len ; i++ ) op( beg0 [i] , beg1 [i] , beg2 [i] , beg3 [i] , beg4 [i] , beg5 [i] , beg6 [i] , beg7 [i] , beg8 [i] , beg9 [i] , beg10 [i] , beg11 [i] , beg12 [i] , beg13 [i] , beg14 [i] ); - } - -#endif - - - template< class S > - static typename norm_result_type< S >::type norm_inf( const S &s ) - { - using std::max; - using std::abs; - typedef typename norm_result_type< S >::type result_type; - result_type init = static_cast< result_type >( 0 ); - const size_t len = boost::size(s); - typename boost::range_iterator<const S>::type beg = boost::begin(s); -# pragma omp parallel for reduction(max: init) schedule(dynamic) - for( size_t i = 0 ; i < len ; ++i ) - init = max( init , abs( beg[i] ) ); - return init; - } - -}; - - -} -} -} - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_state.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_state.hpp deleted file mode 100644 index 83bbc19232e3757d55ecd63cfca9e9db70b9901d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/openmp/openmp_state.hpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/openmp/openmp_state.hpp - - [begin_description] - Wrappers for OpenMP. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_STATE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_STATE_HPP_INCLUDED - -#include <omp.h> -#include <vector> -#include <algorithm> -#include <boost/range/adaptor/sliced.hpp> -#include <boost/numeric/odeint/util/copy.hpp> -#include <boost/numeric/odeint/util/split.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -/** \brief A container that is split into distinct parts, for threading. - * Just a wrapper for vector<vector<T>>, use `copy` for splitting/joining. - */ -template< class T > -struct openmp_state : public std::vector< std::vector< T > > -{ - openmp_state() {} - - openmp_state(size_t n, const std::vector<T>& val = std::vector<T>()) - : std::vector< std::vector< T > >(n, val) {} - - template<class InputIterator> - openmp_state(InputIterator first, InputIterator last) - : std::vector< std::vector< T > >(first, last) {} - - openmp_state(const std::vector< std::vector< T > > &orig) - : std::vector< std::vector< T > >(orig) {} - -}; - - - - -template< class T > -struct is_resizeable< openmp_state< T > > : boost::true_type { }; - - -template< class T > -struct same_size_impl< openmp_state< T > , openmp_state< T > > -{ - static bool same_size( const openmp_state< T > &x , const openmp_state< T > &y ) - { - if( x.size() != y.size() ) return false; - for( size_t i = 0 ; i != x.size() ; i++ ) - if( x[i].size() != y[i].size() ) return false; - return true; - } -}; - - -template< class T > -struct resize_impl< openmp_state< T > , openmp_state< T > > -{ - static void resize( openmp_state< T > &x , const openmp_state< T > &y ) - { - x.resize( y.size() ); -# pragma omp parallel for schedule(dynamic) - for(size_t i = 0 ; i < x.size() ; i++) - x[i].resize( y[i].size() ); - } -}; - - -/** \brief Copy data between openmp_states of same size. */ -template< class T > -struct copy_impl< openmp_state< T >, openmp_state< T > > -{ - static void copy( const openmp_state< T > &from, openmp_state< T > &to ) - { -# pragma omp parallel for schedule(dynamic) - for(size_t i = 0 ; i < from.size() ; i++) - std::copy( from[i].begin() , from[i].end() , to.begin() ); - } -}; - - - -/** \brief Copy data from some container to an openmp_state and resize it. - * Target container size will determine number of blocks to split into. - * If it is empty, it will be resized to the maximum number of OpenMP threads. - * SourceContainer must support `s::value_type`, `s::const_iterator`, `s.begin()`, `s.end()` and `s.size()`, - * with Random Access Iterators; i.e. it must be a Random Access Container. */ -template< class SourceContainer > -struct split_impl< SourceContainer, openmp_state< typename SourceContainer::value_type > > -{ - static void split( const SourceContainer &from, openmp_state< typename SourceContainer::value_type > &to ) - { - if(to.size() == 0) to.resize( omp_get_max_threads() ); - const size_t part = from.size() / to.size(); -# pragma omp parallel for schedule(dynamic) - for(size_t i = 0 ; i < to.size() ; i++) { - typedef typename SourceContainer::const_iterator it_t; - const it_t begin = from.begin() + i * part; - it_t end = begin + part; - // for cases where from.size() % to.size() > 0 - if(i + 1 == to.size() || end > from.end()) end = from.end(); - to[i].resize(end - begin); - std::copy(begin, end, to[i].begin()); - } - } -}; - -/** \brief Copy data from an openmp_state to some container and resize it. - * TargetContainer must support `s::value_type`, `s::iterator`, `s.begin()` and `s.resize(n)`, - * i.e. it must be a `std::vector`. */ -template< class TargetContainer > -struct unsplit_impl< openmp_state< typename TargetContainer::value_type >, TargetContainer > -{ - static void unsplit( const openmp_state< typename TargetContainer::value_type > &from , TargetContainer &to ) - { - // resize target - size_t total_size = 0; - for(size_t i = 0 ; i < from.size() ; i++) - total_size += from[i].size(); - to.resize( total_size ); - // copy parts - typename TargetContainer::iterator out = to.begin(); - for(size_t i = 0 ; i < from.size() ; i++) - out = std::copy(from[i].begin(), from[i].end(), out); - } -}; - - - - -/** \brief OpenMP-parallelized algebra. - * For use with openmp_state. - */ -typedef openmp_nested_algebra< range_algebra > openmp_algebra; - - - -/** \brief Use `openmp_algebra` for `openmp_state`. */ -template< class T > -struct algebra_dispatcher< openmp_state< T > > -{ - typedef openmp_algebra algebra_type; -}; - - -} -} -} - - -#endif - diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust.hpp deleted file mode 100644 index 5c4987cfbb1203672cc71dc1f4ec4cecb8dac2e3..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/thrust/thrust.hpp - - [begin_description] - includes all headers required for using odeint with thrust - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_HPP_DEFINED - -#include <boost/numeric/odeint/external/thrust/thrust_algebra.hpp> -#include <boost/numeric/odeint/external/thrust/thrust_operations.hpp> -#include <boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp> -#include <boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp> -#include <boost/numeric/odeint/external/thrust/thrust_resize.hpp> - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_algebra.hpp deleted file mode 100644 index f33e86296fd6343f9c48019ed54ae118375eadb3..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_algebra.hpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/thrust/thrust_algebra.hpp - - [begin_description] - An algebra for thrusts device_vectors. - [end_description] - - Copyright 2010-2013 Mario Mulansky - Copyright 2010-2011 Karsten Ahnert - Copyright 2013 Kyle Lutz - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_HPP_INCLUDED - - -#include <thrust/device_vector.h> -#include <thrust/for_each.h> -#include <thrust/iterator/zip_iterator.h> - -#include <boost/range.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -namespace detail { - - // to use in thrust::reduce - template< class Value > - struct maximum - { - template< class Fac1 , class Fac2 > - __host__ __device__ - Value operator()( const Fac1 t1 , const Fac2 t2 ) const - { - return ( abs( t1 ) < abs( t2 ) ) ? t2 : t1 ; - } - - typedef Value result_type; - }; - -} - - - - -/** ToDO extend until for_each14 for rk78 */ - -/* - * The const versions are needed for boost.range to work, i.e. - * it allows you to do - * for_each1( make_pair( vec1.begin() , vec1.begin() + 10 ) , op ); - */ - -struct thrust_algebra -{ - template< class StateType , class Operation > - static void for_each1( StateType &s , Operation op ) - { - thrust::for_each( boost::begin(s) , boost::end(s) , op ); - } - - template< class StateType1 , class StateType2 , class Operation > - static void for_each2( StateType1 &s1 , StateType2 &s2 , Operation op ) - { - thrust::for_each( - thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , - boost::begin(s2) ) ) , - thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , - boost::end(s2) ) ) , - op); - } - - template< class StateType1 , class StateType2 , class StateType3 , class Operation > - static void for_each3( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , Operation op ) - { - thrust::for_each( - thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , - boost::begin(s2) , - boost::begin(s3) ) ) , - thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , - boost::end(s2) , - boost::end(s3) ) ) , - op); - } - - template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , - class Operation > - static void for_each4( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 , - Operation op ) - { - thrust::for_each( - thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , - boost::begin(s2) , - boost::begin(s3) , - boost::begin(s4) ) ) , - thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , - boost::end(s2) , - boost::end(s3) , - boost::end(s4) ) ) , - op); - } - - template< class StateType1 , class StateType2 , class StateType3 , - class StateType4 , class StateType5 ,class Operation > - static void for_each5( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 , - StateType5 &s5 , Operation op ) - { - thrust::for_each( - thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , - boost::begin(s2) , - boost::begin(s3) , - boost::begin(s4) , - boost::begin(s5) ) ) , - thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , - boost::end(s2) , - boost::end(s3) , - boost::end(s4) , - boost::end(s5) ) ) , - op); - } - - template< class StateType1 , class StateType2 , class StateType3 , - class StateType4 , class StateType5 , class StateType6 , class Operation > - static void for_each6( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 , - StateType5 &s5 , StateType6 &s6 , Operation op ) - { - thrust::for_each( - thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , - boost::begin(s2) , - boost::begin(s3) , - boost::begin(s4) , - boost::begin(s5) , - boost::begin(s6) ) ) , - thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , - boost::end(s2) , - boost::end(s3) , - boost::end(s4) , - boost::end(s5) , - boost::end(s6) ) ) , - op); - } - - template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , - class StateType5 , class StateType6 , class StateType7 , class Operation > - static void for_each7( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 , - StateType5 &s5 , StateType6 &s6 , StateType7 &s7 , Operation op ) - { - thrust::for_each( - thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , - boost::begin(s2) , - boost::begin(s3) , - boost::begin(s4) , - boost::begin(s5) , - boost::begin(s6) , - boost::begin(s7) ) ) , - thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , - boost::end(s2) , - boost::end(s3) , - boost::end(s4) , - boost::end(s5) , - boost::end(s6) , - boost::end(s7) ) ) , - op); - } - - template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , - class StateType5 , class StateType6 , class StateType7 , class StateType8 , class Operation > - static void for_each8( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 , - StateType5 &s5 , StateType6 &s6 , StateType7 &s7 , StateType8 &s8 , Operation op ) - { - thrust::for_each( - thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , - boost::begin(s2) , - boost::begin(s3) , - boost::begin(s4) , - boost::begin(s5) , - boost::begin(s6) , - boost::begin(s7) , - boost::begin(s8) ) ) , - thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , - boost::end(s2) , - boost::end(s3) , - boost::end(s4) , - boost::end(s5) , - boost::end(s6) , - boost::end(s7) , - boost::end(s8) ) ) , - op); - } - - template< class S > - static typename S::value_type norm_inf( const S &s ) - { - typedef typename S::value_type value_type; - return thrust::reduce( boost::begin( s ) , boost::end( s ) , - static_cast<value_type>(0) , - detail::maximum<value_type>() ); - } - -}; - - -} // odeint -} // numeric -} // boost - - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp deleted file mode 100644 index 09613463501a42f404c5f9ff4dc9e640b22bdde9..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp - - [begin_description] - algebra_dispatcher specialization for thrust - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_DISPATCHER_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_DISPATCHER_HPP_DEFINED - -#include <thrust/host_vector.h> -#include <thrust/device_vector.h> - -#include <boost/numeric/odeint/external/thrust/thrust_algebra.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> - -// specializations for the standard thrust containers - -namespace boost { -namespace numeric { -namespace odeint { - -// specialization for thrust host_vector -template< class T , class A > -struct algebra_dispatcher< thrust::host_vector< T , A > > -{ - typedef thrust_algebra algebra_type; -}; - -// specialization for thrust device_vector -template< class T , class A > -struct algebra_dispatcher< thrust::device_vector< T , A > > -{ - typedef thrust_algebra algebra_type; -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -// add support for thrust backend vectors, if available - -#include <thrust/version.h> - -#if THRUST_VERSION >= 100600 - -// specialization for thrust cpp vector -#include <thrust/system/cpp/vector.h> -namespace boost { namespace numeric { namespace odeint { - template< class T , class A > - struct algebra_dispatcher< thrust::cpp::vector< T , A > > - { - typedef thrust_algebra algebra_type; - }; -} } } - -// specialization for thrust omp vector -#ifdef _OPENMP -#include <thrust/system/omp/vector.h> -namespace boost { namespace numeric { namespace odeint { - template< class T , class A > - struct algebra_dispatcher< thrust::omp::vector< T , A > > - { - typedef thrust_algebra algebra_type; - }; -} } } -#endif // _OPENMP - -// specialization for thrust tbb vector -#ifdef TBB_VERSION_MAJOR -#include <thrust/system/tbb/vector.h> -namespace boost { namespace numeric { namespace odeint { - template< class T , class A > - struct algebra_dispatcher< thrust::tbb::vector< T , A > > - { - typedef thrust_algebra algebra_type; - }; -} } } -#endif // TBB_VERSION_MAJOR - -// specialization for thrust cuda vector -#ifdef __CUDACC__ -#include <thrust/system/cuda/vector.h> -namespace boost { namespace numeric { namespace odeint { - template< class T , class A > - struct algebra_dispatcher< thrust::cuda::vector< T , A > > - { - typedef thrust_algebra algebra_type; - }; -} } } -#endif // __CUDACC__ - -#endif // THRUST_VERSION >= 100600 - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_DISPATCHER_HPP_DEFINED - diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_operations.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_operations.hpp deleted file mode 100644 index ce2d372925d8040d74c5d6f3e00d6724548cad8a..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_operations.hpp +++ /dev/null @@ -1,233 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/thrust/thrust_operations.hpp - - [begin_description] - Operations of thrust zipped iterators. Is the counterpart of the thrust_algebra. - [end_description] - - Copyright 2010-2013 Mario Mulansky - Copyright 2010-2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_HPP_INCLUDED - -namespace boost { -namespace numeric { -namespace odeint { - -#include <thrust/tuple.h> -#include <thrust/iterator/zip_iterator.h> - -/**ToDo extend to scale_sum13 for rk78 */ - -struct thrust_operations -{ - template< class Fac1 = double , class Fac2 = Fac1 > - struct scale_sum2 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - - scale_sum2( const Fac1 alpha1 , const Fac2 alpha2 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { } - - template< class Tuple > - __host__ __device__ - void operator()( Tuple t ) const - { - thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + m_alpha2 * thrust::get<2>(t); - } - }; - - template< class Fac1 = double , class Fac2 = Fac1 > - struct scale_sum_swap2 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - - scale_sum_swap2( const Fac1 alpha1 , const Fac2 alpha2 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { } - - template< class Tuple > - __host__ __device__ - void operator()( Tuple t ) const - { - typename thrust::tuple_element<0,Tuple>::type tmp = thrust::get<0>(t); - thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + m_alpha2 * thrust::get<2>(t); - thrust::get<1>(t) = tmp; - } - }; - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 > - struct scale_sum3 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - - scale_sum3( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) { } - - template< class Tuple > - __host__ __device__ - void operator()( Tuple t ) const - { - thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + - m_alpha2 * thrust::get<2>(t) + - m_alpha3 * thrust::get<3>(t); - } - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 > - struct scale_sum4 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - - scale_sum4( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , const Fac4 alpha4 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ){ } - - template< class Tuple > - __host__ __device__ - void operator()( Tuple t ) const - { - thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + - m_alpha2 * thrust::get<2>(t) + - m_alpha3 * thrust::get<3>(t) + - m_alpha4 * thrust::get<4>(t); - } - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , - class Fac4 = Fac3 , class Fac5 = Fac4 > - struct scale_sum5 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - - scale_sum5( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , - const Fac4 alpha4 , const Fac5 alpha5 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , - m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { } - - template< class Tuple > - __host__ __device__ - void operator()( Tuple t ) const - { - thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + - m_alpha2 * thrust::get<2>(t) + - m_alpha3 * thrust::get<3>(t) + - m_alpha4 * thrust::get<4>(t) + - m_alpha5 * thrust::get<5>(t); - } - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , - class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 > - struct scale_sum6 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - - scale_sum6( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , - const Fac4 alpha4 , const Fac5 alpha5 , const Fac6 alpha6 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , - m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) { } - - template< class Tuple > - __host__ __device__ - void operator()( Tuple t ) const - { - thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + - m_alpha2 * thrust::get<2>(t) + - m_alpha3 * thrust::get<3>(t) + - m_alpha4 * thrust::get<4>(t) + - m_alpha5 * thrust::get<5>(t) + - m_alpha6 * thrust::get<6>(t); - } - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , - class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 > - struct scale_sum7 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - const Fac6 m_alpha6; - const Fac7 m_alpha7; - - scale_sum7( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , - const Fac4 alpha4 , const Fac5 alpha5 , const Fac6 alpha6 , const Fac7 alpha7 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , - m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) { } - - template< class Tuple > - __host__ __device__ - void operator()( Tuple t ) const - { - thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + - m_alpha2 * thrust::get<2>(t) + - m_alpha3 * thrust::get<3>(t) + - m_alpha4 * thrust::get<4>(t) + - m_alpha5 * thrust::get<5>(t) + - m_alpha6 * thrust::get<6>(t) + - m_alpha7 * thrust::get<7>(t) ; - } - }; - - - - - template< class Fac1 = double > - struct rel_error - { - const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt; - - rel_error( const Fac1 eps_abs , const Fac1 eps_rel , const Fac1 a_x , const Fac1 a_dxdt ) - : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) { } - - - template< class Tuple > - __host__ __device__ - void operator()( Tuple t ) const - { - using std::abs; - thrust::get< 0 >( t ) = abs( thrust::get< 0 >( t ) ) / - ( m_eps_abs + m_eps_rel * ( m_a_x * abs( thrust::get< 1 >( t ) + m_a_dxdt * abs( thrust::get< 2 >( t ) ) ) ) ); - } - - typedef void result_type; - }; - - -}; - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp deleted file mode 100644 index e9b3a6423467d4d153a9269cb1798fa415320796..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp - - [begin_description] - operations_dispatcher specialization for thrust - [end_description] - - Copyright 2013-2014 Karsten Ahnert - Copyright 2013-2014 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_DISPATCHER_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_DISPATCHER_HPP_DEFINED - -#include <thrust/host_vector.h> -#include <thrust/device_vector.h> - -#include <boost/numeric/odeint/external/thrust/thrust_operations.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -// support for the standard thrust containers - -namespace boost { -namespace numeric { -namespace odeint { - -// specialization for thrust host_vector -template< class T , class A > -struct operations_dispatcher< thrust::host_vector< T , A > > -{ - typedef thrust_operations operations_type; -}; - -// specialization for thrust device_vector -template< class T , class A > -struct operations_dispatcher< thrust::device_vector< T , A > > -{ - typedef thrust_operations operations_type; -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - -// add support for thrust backend vectors, if available - -#include <thrust/version.h> - -#if THRUST_VERSION >= 100600 - -// specialization for thrust cpp vector -#include <thrust/system/cpp/vector.h> -namespace boost { namespace numeric { namespace odeint { - template< class T , class A > - struct operations_dispatcher< thrust::cpp::vector< T , A > > - { - typedef thrust_operations operations_type; - }; -} } } - -// specialization for thrust omp vector -#ifdef _OPENMP -#include <thrust/system/omp/vector.h> -namespace boost { namespace numeric { namespace odeint { - template< class T , class A > - struct operations_dispatcher< thrust::omp::vector< T , A > > - { - typedef thrust_operations operations_type; - }; -} } } -#endif // _OPENMP - -// specialization for thrust tbb vector -#ifdef TBB_VERSION_MAJOR -#include <thrust/system/tbb/vector.h> -namespace boost { namespace numeric { namespace odeint { - template< class T , class A > - struct operations_dispatcher< thrust::tbb::vector< T , A > > - { - typedef thrust_operations operations_type; - }; -} } } -#endif // TBB_VERSION_MAJOR - -// specialization for thrust cuda vector -#ifdef __CUDACC__ -#include <thrust/system/cuda/vector.h> -namespace boost { namespace numeric { namespace odeint { - template< class T , class A > - struct operations_dispatcher< thrust::cuda::vector< T , A > > - { - typedef thrust_operations operations_type; - }; -} } } -#endif // __CUDACC__ - -#endif // THRUST_VERSION >= 100600 - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_DISPATCHER_HPP_DEFINED - diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_resize.hpp deleted file mode 100644 index 2f7f7b23b1d45ee2db726131a4a862e786f1fa4d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/thrust/thrust_resize.hpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/thrust/thrust_resize.hpp - - [begin_description] - Enable resizing for thrusts device and host_vector. - [end_description] - - Copyright 2010-2014 Mario Mulansky - Copyright 2010-2011 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_RESIZE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_RESIZE_HPP_INCLUDED - -#include <boost/range.hpp> - -#include <thrust/device_vector.h> -#include <thrust/host_vector.h> -#include <thrust/distance.h> - -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> -#include <boost/numeric/odeint/util/copy.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -// some macros that define the necessary utilities - -#define ODEINT_THRUST_VECTOR_IS_RESIZEABLE( THRUST_VECTOR ) \ -template< class T , class A > \ -struct is_resizeable< THRUST_VECTOR<T,A> > \ -{ \ - struct type : public boost::true_type { }; \ - const static bool value = type::value; \ -}; \ - -#define ODEINT_TRHUST_VECTOR_RESIZE_IMPL( THRUST_VECTOR ) \ -template< class T, class A > \ -struct resize_impl< THRUST_VECTOR<T,A> , THRUST_VECTOR<T,A> > \ -{ \ - static void resize( THRUST_VECTOR<T,A> &x , \ - const THRUST_VECTOR<T,A> &y ) \ - { \ - x.resize( y.size() ); \ - } \ -}; \ -template< class T, class A, typename Range > \ -struct resize_impl< THRUST_VECTOR<T,A> , Range > \ -{ \ - static void resize( THRUST_VECTOR<T,A> &x , \ - const Range &y ) \ - { \ - x.resize( thrust::distance(boost::begin(y), \ - boost::end(y))); \ - } \ -}; \ - - -#define ODEINT_THRUST_SAME_SIZE_IMPL( THRUST_VECTOR ) \ -template< class T , class A > \ -struct same_size_impl< THRUST_VECTOR<T,A> , THRUST_VECTOR<T,A> > \ -{ \ - static bool same_size( const THRUST_VECTOR<T,A> &x , \ - const THRUST_VECTOR<T,A> &y ) \ - { \ - return x.size() == y.size(); \ - } \ -}; \ -template< class T , class A, typename Range > \ -struct same_size_impl< THRUST_VECTOR<T,A> , Range > \ -{ \ - static bool same_size( const THRUST_VECTOR<T,A> &x , \ - const Range &y ) \ - { \ - return x.size() == thrust::distance(boost::begin(y), \ - boost::end(y)); \ - } \ -}; \ - - -#define ODEINT_THRUST_COPY_IMPL( THRUST_VECTOR ) \ -template< class Container1 , class T , class A > \ -struct copy_impl< Container1 , THRUST_VECTOR<T,A> > \ -{ \ - static void copy( const Container1 &from , THRUST_VECTOR<T,A> &to ) \ - { \ - thrust::copy( boost::begin( from ) , boost::end( from ) , \ - boost::begin( to ) ); \ - } \ -}; \ - \ -template< class T , class A , class Container2 > \ -struct copy_impl< THRUST_VECTOR<T,A> , Container2 > \ -{ \ - static void copy( const THRUST_VECTOR<T,A> &from , Container2 &to ) \ - { \ - thrust::copy( boost::begin( from ) , boost::end( from ) , \ - boost::begin( to ) ); \ - } \ -}; \ - \ -template< class T , class A > \ -struct copy_impl< THRUST_VECTOR<T,A> , THRUST_VECTOR<T,A> > \ -{ \ - static void copy( const THRUST_VECTOR<T,A> &from , \ - THRUST_VECTOR<T,A> &to ) \ - { \ - thrust::copy( boost::begin( from ) , boost::end( from ) , \ - boost::begin( to ) ); \ - } \ -}; \ - -// add support for the standard thrust containers - -ODEINT_THRUST_VECTOR_IS_RESIZEABLE( thrust::device_vector ) -ODEINT_TRHUST_VECTOR_RESIZE_IMPL( thrust::device_vector ) -ODEINT_THRUST_SAME_SIZE_IMPL( thrust::device_vector ) -ODEINT_THRUST_COPY_IMPL( thrust::device_vector ) - - -ODEINT_THRUST_VECTOR_IS_RESIZEABLE( thrust::host_vector ) -ODEINT_TRHUST_VECTOR_RESIZE_IMPL( thrust::host_vector ) -ODEINT_THRUST_SAME_SIZE_IMPL( thrust::host_vector ) -ODEINT_THRUST_COPY_IMPL( thrust::host_vector ) - - -} // odeint -} // numeric -} // boost - -// add support for thrust backend vectors, if available - -#include <thrust/version.h> - -#if THRUST_VERSION >= 100600 - -#include <thrust/system/cpp/vector.h> -namespace boost { namespace numeric { namespace odeint { - ODEINT_THRUST_VECTOR_IS_RESIZEABLE( thrust::cpp::vector ) - ODEINT_TRHUST_VECTOR_RESIZE_IMPL( thrust::cpp::vector ) - ODEINT_THRUST_SAME_SIZE_IMPL( thrust::cpp::vector ) - ODEINT_THRUST_COPY_IMPL( thrust::cpp::vector ) -} } } - -#ifdef _OPENMP -#include <thrust/system/omp/vector.h> -namespace boost { namespace numeric { namespace odeint { - ODEINT_THRUST_VECTOR_IS_RESIZEABLE( thrust::omp::vector ) - ODEINT_TRHUST_VECTOR_RESIZE_IMPL( thrust::omp::vector ) - ODEINT_THRUST_SAME_SIZE_IMPL( thrust::omp::vector ) - ODEINT_THRUST_COPY_IMPL( thrust::omp::vector ) -} } } -#endif // _OPENMP - -#ifdef TBB_VERSION_MAJOR -#include <thrust/system/tbb/vector.h> -namespace boost { namespace numeric { namespace odeint { - ODEINT_THRUST_VECTOR_IS_RESIZEABLE( thrust::tbb::vector ) - ODEINT_TRHUST_VECTOR_RESIZE_IMPL( thrust::tbb::vector ) - ODEINT_THRUST_SAME_SIZE_IMPL( thrust::tbb::vector ) - ODEINT_THRUST_COPY_IMPL( thrust::tbb::vector ) -} } } -#endif // TBB_VERSION_MAJOR - -#ifdef __CUDACC__ -#include <thrust/system/cuda/vector.h> -namespace boost { namespace numeric { namespace odeint { - ODEINT_THRUST_VECTOR_IS_RESIZEABLE( thrust::cuda::vector ) - ODEINT_TRHUST_VECTOR_RESIZE_IMPL( thrust::cuda::vector ) - ODEINT_THRUST_SAME_SIZE_IMPL( thrust::cuda::vector ) - ODEINT_THRUST_COPY_IMPL( thrust::cuda::vector ) -} } } -#endif // __CUDACC__ - -#endif // THRUST_VERSION >= 100600 - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_RESIZE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl.hpp deleted file mode 100644 index 0a99e27c8a0266e6dae2f1a293abd2dfce5f6802..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/vexcl/vexcl.hpp - - [begin_description] - includes all headers required for using vexcl in odeint - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_HPP_DEFINED - -#include <boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp> -#include <boost/numeric/odeint/external/vexcl/vexcl_resize.hpp> -#include <boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp> -#include <boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp> -#include <boost/numeric/odeint/external/vexcl/vexcl_abs.hpp> -#include <boost/numeric/odeint/external/vexcl/vexcl_copy.hpp> - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_abs.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_abs.hpp deleted file mode 100644 index c5e5c73329c3452ec9a4b8c6c484db846154b381..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_abs.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/vexcl/vexcl_abs.hpp - - [begin_description] - abs() specialization for vexcl - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_ABS_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_ABS_HPP_DEFINED - -#include <vexcl/vector.hpp> -#include <vexcl/multivector.hpp> -#include <vexcl/operations.hpp> - -namespace vex { - -template <typename T, size_t N> -typename std::enable_if< - std::is_integral<T>::value, - typename boost::proto::result_of::make_expr< - boost::proto::tag::function, - abs_func, - const vex::multivector<T, N>& - >::type const ->::type -abs(const multivector<T, N> &arg) { - return boost::proto::make_expr<boost::proto::tag::function>( - abs_func(), - boost::ref(arg) - ); -} - -template <typename T, size_t N> -typename std::enable_if< - !std::is_integral<T>::value, - typename boost::proto::result_of::make_expr< - boost::proto::tag::function, - fabs_func, - const vex::multivector<T, N>& - >::type const ->::type -abs(const multivector<T, N> &arg) { - return boost::proto::make_expr<boost::proto::tag::function>( - fabs_func(), - boost::ref(arg) - ); -} - -} // namespace vex - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_ABS_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp deleted file mode 100644 index 95111376de912d6ff34978edc49f72e917e8e37a..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp - - [begin_description] - algebra_dispatcher specialization for vexcl - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_ALGEBRA_DISPATCHER_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_ALGEBRA_DISPATCHER_HPP_DEFINED - -#include <vexcl/vector.hpp> -#include <vexcl/multivector.hpp> - -#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -// specialization for vexcl vector -template< typename T > -struct algebra_dispatcher< vex::vector< T > > -{ - typedef vector_space_algebra algebra_type; -}; - -// specialization for vexcl multivector -template< typename T , size_t N > -struct algebra_dispatcher< vex::multivector< T , N > > -{ - typedef vector_space_algebra algebra_type; -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_ALGEBRA_DISPATCHER_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_copy.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_copy.hpp deleted file mode 100644 index 6a5afac9faf77019b9a55c4d5735970544dd6885..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_copy.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/vexcl/vexcl_copy.hpp - - [begin_description] - copy_impl specializations for vexcl - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_COPY_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_COPY_HPP_INCLUDED - -#include <vexcl/vector.hpp> -#include <vexcl/multivector.hpp> - -#include <boost/numeric/odeint/util/copy.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< typename T1, typename T2 > -struct copy_impl< vex::vector<T1>, vex::vector<T2> > -{ - static void copy( const vex::vector<T1> &from , vex::vector<T2> &to ) - { - to = from; - } -}; - -template< typename T1, typename T2, size_t N > -struct copy_impl< vex::multivector<T1, N>, vex::multivector<T2, N> > -{ - static void copy( const vex::multivector<T1, N> &from , vex::multivector<T2, N> &to ) - { - to = from; - } -}; - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_COPY_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp deleted file mode 100644 index a0a62afc04379309b564fd163bac67054bf78bf6..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp - - [begin_description] - vector_space_norm_inf specialization for vexcl - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED - -#include <map> -#include <algorithm> - -#include <vexcl/vector.hpp> -#include <vexcl/multivector.hpp> -#include <vexcl/reductor.hpp> - -#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -// specialization for vexcl vector -template <typename T> -struct vector_space_norm_inf< vex::vector<T> > { - typedef T result_type; - - T operator()( const vex::vector<T> &x ) const { - const auto &max = vex::get_reductor<T, vex::MAX>(x.queue_list()); - - return max( fabs(x) ); - } -}; - -// specialization for vexcl multivector -template <typename T, size_t N> -struct vector_space_norm_inf< vex::multivector<T, N> > { - typedef T result_type; - - T operator()( const vex::multivector<T, N> &x ) const { - const auto &max = vex::get_reductor<T, vex::MAX>(x.queue_list()); - - // Reducing a multivector results in std::array<T, N>: - auto m = max( fabs(x) ); - - // We will need to reduce it even further: - return *std::max_element(m.begin(), m.end()); - } -}; - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp deleted file mode 100644 index 2d6291edfeb3bee374438285449e135d348b47e0..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/vexcl/vexcl_resize.hpp - - [begin_description] - Enable resizing for vexcl vector and multivector. - [end_description] - - Copyright 2012 Karsten Ahnert - Copyright 2012 Mario Mulansky - Copyright 2012 Denis Demidov - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED - -#include <vexcl/vector.hpp> -#include <vexcl/multivector.hpp> - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - - -/* - * specializations for vex::vector< T > - */ -template< typename T > -struct is_resizeable< vex::vector< T > > : boost::true_type { }; - -template< typename T > -struct resize_impl< vex::vector< T > , vex::vector< T > > -{ - static void resize( vex::vector< T > &x1 , const vex::vector< T > &x2 ) - { - x1.resize( x2.queue_list() , x2.size() ); - } -}; - -template< typename T > -struct same_size_impl< vex::vector< T > , vex::vector< T > > -{ - static bool same_size( const vex::vector< T > &x1 , const vex::vector< T > &x2 ) - { - return x1.size() == x2.size(); - } -}; - - - - - -/* - * specializations for vex::multivector< T > - */ -template< typename T , size_t N > -struct is_resizeable< vex::multivector< T , N > > : boost::true_type { }; - -template< typename T , size_t N > -struct resize_impl< vex::multivector< T , N > , vex::multivector< T , N > > -{ - static void resize( vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 ) - { - x1.resize( x2.queue_list() , x2.size() ); - } -}; - -template< typename T , size_t N > -struct same_size_impl< vex::multivector< T , N > , vex::multivector< T , N > > -{ - static bool same_size( const vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 ) - { - return x1.size() == x2.size(); - } -}; - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp deleted file mode 100644 index f5a7378cd8ee287f9f4fdb4b3d9962b98a6d8325..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp - - [begin_description] - Check if two VexCL containers are the same instance. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_SAME_INSTANCE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_SAME_INSTANCE_HPP_INCLUDED - -#include <vexcl/vector.hpp> -#include <vexcl/multivector.hpp> - -#include <boost/numeric/odeint/util/same_instance.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template <typename T> -struct same_instance_impl< vex::vector<T> , vex::vector<T> > -{ - static bool same_instance( const vex::vector<T> &x1 , const vex::vector<T> &x2 ) - { - return - static_cast<const vex::vector<T>*>(&x1) == - static_cast<const vex::vector<T>*>(&x2); - } -}; - -template <typename T, size_t N> -struct same_instance_impl< vex::multivector<T, N> , vex::multivector<T, N> > -{ - static bool same_instance( const vex::multivector<T, N> &x1 , const vex::multivector<T, N> &x2 ) - { - return - static_cast<const vex::multivector<T, N>*>(&x1) == - static_cast<const vex::multivector<T, N>*>(&x2); - } -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_SAME_INSTANCE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp deleted file mode 100644 index 662c36a1ed1ffd352168aab7eeb183e782efbf2e..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/viennacl_operations.hpp - - [begin_description] - ViennaCL operations. - [end_description] - - Copyright 2012 Denis Demidov - Copyright 2012 Karsten Ahnert - Copyright 2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_OPERATIONS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_OPERATIONS_HPP_INCLUDED - -#include <viennacl/vector.hpp> - -#ifdef VIENNACL_WITH_OPENCL -# include <viennacl/generator/custom_operation.hpp> -#endif - -namespace boost { -namespace numeric { -namespace odeint { - - -#ifdef VIENNACL_WITH_OPENCL -struct viennacl_operations -{ - - template< class Fac1 = double , class Fac2 = Fac1 > - struct scale_sum2 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - - scale_sum2( Fac1 alpha1 , Fac2 alpha2 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) - { } - - template< class T1 , class T2 , class T3 > - void operator()( viennacl::vector<T1> &v1 , - const viennacl::vector<T2> &v2 , - const viennacl::vector<T3> &v3 - ) const - { - using namespace viennacl; - - static generator::symbolic_vector <0, T1> sym_v1; - static generator::symbolic_vector <1, T2> sym_v2; - static generator::symbolic_vector <2, T3> sym_v3; - static generator::cpu_symbolic_scalar<3, Fac1> sym_a1; - static generator::cpu_symbolic_scalar<4, Fac2> sym_a2; - - static generator::custom_operation op( - sym_v1 = sym_a1 * sym_v2 - + sym_a2 * sym_v3, - "scale_sum2" - ); - - ocl::enqueue( op(v1, v2, v3, m_alpha1, m_alpha2) ); - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 > - struct scale_sum3 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - - scale_sum3( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) - { } - - template< class T1 , class T2 , class T3 , class T4 > - void operator()( viennacl::vector<T1> &v1 , - const viennacl::vector<T2> &v2 , - const viennacl::vector<T3> &v3 , - const viennacl::vector<T4> &v4 - ) const - { - using namespace viennacl; - - static generator::symbolic_vector <0, T1> sym_v1; - static generator::symbolic_vector <1, T2> sym_v2; - static generator::symbolic_vector <2, T3> sym_v3; - static generator::symbolic_vector <3, T4> sym_v4; - static generator::cpu_symbolic_scalar<4, Fac1> sym_a1; - static generator::cpu_symbolic_scalar<5, Fac2> sym_a2; - static generator::cpu_symbolic_scalar<6, Fac3> sym_a3; - - static generator::custom_operation op( - sym_v1 = sym_a1 * sym_v2 - + sym_a2 * sym_v3 - + sym_a3 * sym_v4, - "scale_sum3" - ); - - ocl::enqueue( op(v1, v2, v3, v4, m_alpha1, m_alpha2, m_alpha3) ); - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 > - struct scale_sum4 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - - scale_sum4( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 > - void operator()( viennacl::vector<T1> &v1 , - const viennacl::vector<T2> &v2 , - const viennacl::vector<T3> &v3 , - const viennacl::vector<T4> &v4 , - const viennacl::vector<T5> &v5 - ) const - { - using namespace viennacl; - - static generator::symbolic_vector <0, T1> sym_v1; - static generator::symbolic_vector <1, T2> sym_v2; - static generator::symbolic_vector <2, T3> sym_v3; - static generator::symbolic_vector <3, T4> sym_v4; - static generator::symbolic_vector <4, T5> sym_v5; - static generator::cpu_symbolic_scalar<5, Fac1> sym_a1; - static generator::cpu_symbolic_scalar<6, Fac2> sym_a2; - static generator::cpu_symbolic_scalar<7, Fac3> sym_a3; - static generator::cpu_symbolic_scalar<8, Fac4> sym_a4; - - static generator::custom_operation op( - sym_v1 = sym_a1 * sym_v2 - + sym_a2 * sym_v3 - + sym_a3 * sym_v4 - + sym_a4 * sym_v5, - "scale_sum4" - ); - - ocl::enqueue( op(v1, v2, v3, v4, v5, - m_alpha1, m_alpha2, m_alpha3, m_alpha4) ); - } - - typedef void result_type; - }; - - - template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 > - struct scale_sum5 - { - const Fac1 m_alpha1; - const Fac2 m_alpha2; - const Fac3 m_alpha3; - const Fac4 m_alpha4; - const Fac5 m_alpha5; - - scale_sum5( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , Fac5 alpha5 ) - : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { } - - template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > - void operator()( viennacl::vector<T1> &v1 , - const viennacl::vector<T2> &v2 , - const viennacl::vector<T3> &v3 , - const viennacl::vector<T4> &v4 , - const viennacl::vector<T5> &v5 , - const viennacl::vector<T6> &v6 - ) const - { - using namespace viennacl; - - static generator::symbolic_vector < 0, T1> sym_v1; - static generator::symbolic_vector < 1, T2> sym_v2; - static generator::symbolic_vector < 2, T3> sym_v3; - static generator::symbolic_vector < 3, T4> sym_v4; - static generator::symbolic_vector < 4, T5> sym_v5; - static generator::symbolic_vector < 5, T6> sym_v6; - static generator::cpu_symbolic_scalar< 6, Fac1> sym_a1; - static generator::cpu_symbolic_scalar< 7, Fac2> sym_a2; - static generator::cpu_symbolic_scalar< 8, Fac3> sym_a3; - static generator::cpu_symbolic_scalar< 9, Fac4> sym_a4; - static generator::cpu_symbolic_scalar<10, Fac5> sym_a5; - - static generator::custom_operation op( - sym_v1 = sym_a1 * sym_v2 - + sym_a2 * sym_v3 - + sym_a3 * sym_v4 - + sym_a4 * sym_v5 - + sym_a5 * sym_v6, - "scale_sum5" - ); - - ocl::enqueue( op(v1, v2, v3, v4, v5, v6, - m_alpha1, m_alpha2, m_alpha3, m_alpha4, m_alpha5) ); - } - - typedef void result_type; - }; - - -}; -#else -struct viennacl_operations : public default_operations {}; -#endif - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_OPERATIONS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp deleted file mode 100644 index d3240705be0562b21ef7270508e53c8cce0aafe3..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/external/viennacl/viennacl_resize.hpp - - [begin_description] - Enable resizing for viennacl vector. - [end_description] - - Copyright 2012 Denis Demidov - Copyright 2012 Karsten Ahnert - Copyright 2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED - -#include <viennacl/vector.hpp> - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - - -/* - * specializations for viennacl::vector< T > - */ -template< typename T > -struct is_resizeable< viennacl::vector< T > > : boost::true_type { }; - -template< typename T > -struct resize_impl< viennacl::vector< T > , viennacl::vector< T > > -{ - static void resize( viennacl::vector< T > &x1 , const viennacl::vector< T > &x2 ) - { - x1.resize( x2.size() , false ); - } -}; - -template< typename T > -struct same_size_impl< viennacl::vector< T > , viennacl::vector< T > > -{ - static bool same_size( const viennacl::vector< T > &x1 , const viennacl::vector< T > &x2 ) - { - return x1.size() == x2.size(); - } -}; - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/check_adapter.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/check_adapter.hpp deleted file mode 100644 index 3d3ebd6c88d5b60e5c43255f34e9d2df50c31d08..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/check_adapter.hpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/check_adapter.hpp - - [begin_description] - Adapters to add checking facility to stepper and observer - [end_description] - - Copyright 2015 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_CHECK_ADAPTER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_CHECK_ADAPTER_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -template<class Stepper, class Checker, - class StepperCategory = typename base_tag<typename Stepper::stepper_category>::type> -class checked_stepper; - - -/** - * \brief Adapter to combine basic stepper and checker. - */ -template<class Stepper, class Checker> -class checked_stepper<Stepper, Checker, stepper_tag> -{ - -public: - typedef Stepper stepper_type; - typedef Checker checker_type; - // forward stepper typedefs - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::time_type time_type; - -private: - stepper_type &m_stepper; - checker_type &m_checker; - -public: - /** - * \brief Construct the checked_stepper. - */ - checked_stepper(stepper_type &stepper, checker_type &checker) - : m_stepper(stepper), m_checker(checker) { } - - /** - * \brief forward of the do_step method - */ - template<class System, class StateInOut> - void do_step(System system, StateInOut &state, const time_type t, const time_type dt) - { - // do the step - m_stepper.do_step(system, state, t, dt); - // call the checker - m_checker(); - } -}; - - -/** - * \brief Adapter to combine controlled stepper and checker. - */ -template<class ControlledStepper, class Checker> -class checked_stepper<ControlledStepper, Checker, controlled_stepper_tag> -{ - -public: - typedef ControlledStepper stepper_type; - typedef Checker checker_type; - // forward stepper typedefs - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::time_type time_type; - -private: - stepper_type &m_stepper; - checker_type &m_checker; - -public: - /** - * \brief Construct the checked_stepper. - */ - checked_stepper(stepper_type &stepper, checker_type &checker) - : m_stepper(stepper), m_checker(checker) { } - - /** - * \brief forward of the do_step method - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , StateInOut &state , time_type &t , time_type &dt ) - { - // do the step - if( m_stepper.try_step(system, state, t, dt) == success ) - { - // call the checker if step was successful - m_checker(); - return success; - } else - { - // step failed -> return fail - return fail; - } - } -}; - - -/** - * \brief Adapter to combine dense out stepper and checker. - */ -template<class DenseOutStepper, class Checker> -class checked_stepper<DenseOutStepper, Checker, dense_output_stepper_tag> -{ - -public: - typedef DenseOutStepper stepper_type; - typedef Checker checker_type; - // forward stepper typedefs - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::time_type time_type; - -private: - stepper_type &m_stepper; - checker_type &m_checker; - -public: - /** - * \brief Construct the checked_stepper. - */ - checked_stepper(stepper_type &stepper, checker_type &checker) - : m_stepper(stepper), m_checker(checker) { } - - - template< class System > - std::pair< time_type , time_type > do_step( System system ) - { - m_checker(); - return m_stepper.do_step(system); - } - - /* provide the remaining dense out stepper interface */ - template< class StateType > - void initialize( const StateType &x0 , time_type t0 , time_type dt0 ) - { m_stepper.initialize(x0, t0, dt0); } - - - template< class StateOut > - void calc_state( time_type t , StateOut &x ) const - { m_stepper.calc_state(t, x); } - - template< class StateOut > - void calc_state( time_type t , const StateOut &x ) const - { m_stepper.calc_state(t, x); } - - const state_type& current_state( void ) const - { return m_stepper.current_state(); } - - time_type current_time( void ) const - { return m_stepper.current_time(); } - - const state_type& previous_state( void ) const - { return m_stepper.previous_state(); } - - time_type previous_time( void ) const - { return m_stepper.previous_time(); } - - time_type current_time_step( void ) const - { return m_stepper.current_time_step(); } - -}; - - -/** - * \brief Adapter to combine observer and checker. - */ -template<class Observer, class Checker> -class checked_observer -{ -public: - typedef Observer observer_type; - typedef Checker checker_type; - -private: - observer_type &m_observer; - checker_type &m_checker; - -public: - checked_observer(observer_type &observer, checker_type &checker) - : m_observer(observer), m_checker(checker) - {} - - template< class State , class Time > - void operator()(const State& state, Time t) const - { - // call the observer - m_observer(state, t); - // reset the checker - m_checker.reset(); - } -}; - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif \ No newline at end of file diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/functors.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/functors.hpp deleted file mode 100644 index b239217ac4cbc9713ae0b7a93998ebcb4e6bd633..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/functors.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/functors.hpp - - [begin_description] - some functors for the iterator based integrate routines - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED - -#include <utility> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - - -template< class Observer > -struct obs_caller { - - size_t &m_n; - Observer m_obs; - - obs_caller( size_t &m , Observer &obs ) : m_n(m) , m_obs( obs ) {} - - template< class State , class Time > - void operator()( std::pair< const State & , const Time & > x ) - { - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - observer_type &obs = m_obs; - obs( x.first , x.second ); - m_n++; - } -}; - -template< class Observer , class Time > -struct obs_caller_time { - - Time &m_t; - Observer m_obs; - - obs_caller_time( Time &t , Observer &obs ) : m_t(t) , m_obs( obs ) {} - - template< class State > - void operator()( std::pair< const State & , const Time & > x ) - { - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - observer_type &obs = m_obs; - obs( x.first , x.second ); - m_t = x.second; - } -}; - -} // namespace detail -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp deleted file mode 100644 index 7516d44087c5ab34242b9d24d320241102f79000..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp - - [begin_description] - Default Integrate adaptive implementation. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2015 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED - -#include <stdexcept> - -#include <boost/throw_exception.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/integrate/max_step_checker.hpp> -#include <boost/numeric/odeint/integrate/detail/integrate_const.hpp> -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/util/copy.hpp> - -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - - -#include <iostream> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -// forward declaration -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , stepper_tag ); - -/* - * integrate_adaptive for simple stepper is basically an integrate_const + some last step - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , stepper_tag -) -{ - size_t steps = detail::integrate_const( stepper , system , start_state , start_time , - end_time , dt , observer , stepper_tag() ); - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - Time end = start_time + dt*steps; - if( less_with_sign( end , end_time , dt ) ) - { //make a last step to end exactly at end_time - st.do_step( system , start_state , end , end_time - end ); - steps++; - obs( start_state , end_time ); - } - return steps; -} - - -/* - * integrate adaptive for controlled stepper - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time &start_time , Time end_time , Time &dt , - Observer observer , controlled_stepper_tag -) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - failed_step_checker fail_checker; // to throw a runtime_error if step size adjustment fails - size_t count = 0; - while( less_with_sign( start_time , end_time , dt ) ) - { - obs( start_state , start_time ); - if( less_with_sign( end_time , static_cast<Time>(start_time + dt) , dt ) ) - { - dt = end_time - start_time; - } - - controlled_step_result res; - do - { - res = st.try_step( system , start_state , start_time , dt ); - fail_checker(); // check number of failed steps - } - while( res == fail ); - fail_checker.reset(); // if we reach here, the step was successful -> reset fail checker - - ++count; - } - obs( start_state , start_time ); - return count; -} - - -/* - * integrate adaptive for dense output steppers - * - * step size control is used if the stepper supports it - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , dense_output_stepper_tag ) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - size_t count = 0; - st.initialize( start_state , start_time , dt ); - - while( less_with_sign( st.current_time() , end_time , st.current_time_step() ) ) - { - while( less_eq_with_sign( static_cast<Time>(st.current_time() + st.current_time_step()) , - end_time , - st.current_time_step() ) ) - { //make sure we don't go beyond the end_time - obs( st.current_state() , st.current_time() ); - st.do_step( system ); - ++count; - } - // calculate time step to arrive exactly at end time - st.initialize( st.current_state() , st.current_time() , static_cast<Time>(end_time - st.current_time()) ); - } - obs( st.current_state() , st.current_time() ); - // overwrite start_state with the final point - boost::numeric::odeint::copy( st.current_state() , start_state ); - return count; -} - - - - -} // namespace detail -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_const.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_const.hpp deleted file mode 100644 index 52c04a8e13d5916819e4000b419c77e2c44331f4..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_const.hpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/integrate_const.hpp - - [begin_description] - integrate const implementation - [end_description] - - Copyright 2012-2015 Mario Mulansky - Copyright 2012 Christoph Koke - Copyright 2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_CONST_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_CONST_HPP_INCLUDED - -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> -#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp> - -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -// forward declaration -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time &start_time , Time end_time , Time &dt , - Observer observer , controlled_stepper_tag -); - - -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , stepper_tag -) -{ - - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - Time time = start_time; - int step = 0; - // cast time+dt explicitely in case of expression templates (e.g. multiprecision) - while( less_eq_with_sign( static_cast<Time>(time+dt) , end_time , dt ) ) - { - obs( start_state , time ); - st.do_step( system , start_state , time , dt ); - // direct computation of the time avoids error propagation happening when using time += dt - // we need clumsy type analysis to get boost units working here - ++step; - time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * dt; - } - obs( start_state , time ); - - return step; -} - - - -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , controlled_stepper_tag -) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - - Time time = start_time; - const Time time_step = dt; - int real_steps = 0; - int step = 0; - - while( less_eq_with_sign( static_cast<Time>(time+time_step) , end_time , dt ) ) - { - obs( start_state , time ); - // integrate_adaptive_checked uses the given checker to throw if an overflow occurs - real_steps += detail::integrate_adaptive(stepper, system, start_state, time, - static_cast<Time>(time + time_step), dt, - null_observer(), controlled_stepper_tag()); - // direct computation of the time avoids error propagation happening when using time += dt - // we need clumsy type analysis to get boost units working here - step++; - time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * time_step; - } - obs( start_state , time ); - - return real_steps; -} - - -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , dense_output_stepper_tag -) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - Time time = start_time; - - st.initialize( start_state , time , dt ); - obs( start_state , time ); - time += dt; - - int obs_step( 1 ); - int real_step( 0 ); - - while( less_eq_with_sign( static_cast<Time>(time+dt) , end_time , dt ) ) - { - while( less_eq_with_sign( time , st.current_time() , dt ) ) - { - st.calc_state( time , start_state ); - obs( start_state , time ); - ++obs_step; - // direct computation of the time avoids error propagation happening when using time += dt - // we need clumsy type analysis to get boost units working here - time = start_time + static_cast< typename unit_value_type<Time>::type >(obs_step) * dt; - } - // we have not reached the end, do another real step - if( less_with_sign( static_cast<Time>(st.current_time()+st.current_time_step()) , - end_time , - st.current_time_step() ) ) - { - while( less_eq_with_sign( st.current_time() , time , dt ) ) - { - st.do_step( system ); - ++real_step; - } - } - else if( less_with_sign( st.current_time() , end_time , st.current_time_step() ) ) - { // do the last step ending exactly on the end point - st.initialize( st.current_state() , st.current_time() , end_time - st.current_time() ); - st.do_step( system ); - ++real_step; - } - - } - // last observation, if we are still in observation interval - // might happen due to finite precision problems when computing the the time - if( less_eq_with_sign( time , end_time , dt ) ) - { - st.calc_state( time , start_state ); - obs( start_state , time ); - } - - return real_step; -} - - -} } } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp deleted file mode 100644 index 2ef490d5929d52224e3f6825b46f9ab37d2c1f08..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp - - [begin_description] - integrate steps implementation - [end_description] - - Copyright 2012-2015 Mario Mulansky - Copyright 2012 Christoph Koke - Copyright 2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED - -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> - -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -// forward declaration -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive_checked( - Stepper stepper , System system , State &start_state , - Time &start_time , Time end_time , Time &dt , - Observer observer, controlled_stepper_tag -); - - -/* basic version */ -template< class Stepper , class System , class State , class Time , class Observer> -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer , stepper_tag ) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - Time time = start_time; - - for( size_t step = 0; step < num_of_steps ; ++step ) - { - obs( start_state , time ); - st.do_step( system , start_state , time , dt ); - // direct computation of the time avoids error propagation happening when using time += dt - // we need clumsy type analysis to get boost units working here - time = start_time + static_cast< typename unit_value_type<Time>::type >( step+1 ) * dt; - } - obs( start_state , time ); - - return time; -} - - -/* controlled version */ -template< class Stepper , class System , class State , class Time , class Observer > -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer , controlled_stepper_tag ) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - - Time time = start_time; - Time time_step = dt; - - for( size_t step = 0; step < num_of_steps ; ++step ) - { - obs( start_state , time ); - // integrate_adaptive_checked uses the given checker to throw if an overflow occurs - detail::integrate_adaptive(stepper, system, start_state, time, static_cast<Time>(time + time_step), dt, - null_observer(), controlled_stepper_tag()); - // direct computation of the time avoids error propagation happening when using time += dt - // we need clumsy type analysis to get boost units working here - time = start_time + static_cast< typename unit_value_type<Time>::type >(step+1) * time_step; - } - obs( start_state , time ); - - return time; -} - - -/* dense output version */ -template< class Stepper , class System , class State , class Time , class Observer > -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer , dense_output_stepper_tag ) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - Time time = start_time; - const Time end_time = start_time + static_cast< typename unit_value_type<Time>::type >(num_of_steps) * dt; - - st.initialize( start_state , time , dt ); - - size_t step = 0; - - while( step < num_of_steps ) - { - while( less_with_sign( time , st.current_time() , st.current_time_step() ) ) - { - st.calc_state( time , start_state ); - obs( start_state , time ); - ++step; - // direct computation of the time avoids error propagation happening when using time += dt - // we need clumsy type analysis to get boost units working here - time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * dt; - } - - // we have not reached the end, do another real step - if( less_with_sign( static_cast<Time>(st.current_time()+st.current_time_step()) , - end_time , - st.current_time_step() ) ) - { - st.do_step( system ); - } - else if( less_with_sign( st.current_time() , end_time , st.current_time_step() ) ) - { // do the last step ending exactly on the end point - st.initialize( st.current_state() , st.current_time() , static_cast<Time>(end_time - st.current_time()) ); - st.do_step( system ); - } - } - - // make sure we really end exactly where we should end - while( st.current_time() < end_time ) - { - if( less_with_sign( end_time , - static_cast<Time>(st.current_time()+st.current_time_step()) , - st.current_time_step() ) ) - st.initialize( st.current_state() , st.current_time() , static_cast<Time>(end_time - st.current_time()) ); - st.do_step( system ); - } - - // observation at final point - obs( st.current_state() , end_time ); - - return time; -} - - -} -} -} -} - -#endif /* BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED */ diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_times.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_times.hpp deleted file mode 100644 index 2e279904124574979800e1b3a3aee33fc09c32aa..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/detail/integrate_times.hpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/integrate_times.hpp - - [begin_description] - Default integrate times implementation. - [end_description] - - Copyright 2011-2015 Mario Mulansky - Copyright 2012 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED - -#include <stdexcept> - -#include <boost/config.hpp> -#include <boost/throw_exception.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> -#include <boost/numeric/odeint/integrate/max_step_checker.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - - - -/* - * integrate_times for simple stepper - */ -template<class Stepper, class System, class State, class TimeIterator, class Time, class Observer> -size_t integrate_times( - Stepper stepper , System system , State &start_state , - TimeIterator start_time , TimeIterator end_time , Time dt , - Observer observer , stepper_tag -) -{ - typedef typename odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - - stepper_type &st = stepper; - observer_type &obs = observer; - typedef typename unit_value_type<Time>::type time_type; - - size_t steps = 0; - Time current_dt = dt; - while( true ) - { - Time current_time = *start_time++; - obs( start_state , current_time ); - if( start_time == end_time ) - break; - while( less_with_sign( current_time , static_cast<time_type>(*start_time) , current_dt ) ) - { - current_dt = min_abs( dt , *start_time - current_time ); - st.do_step( system , start_state , current_time , current_dt ); - current_time += current_dt; - steps++; - } - } - return steps; -} - -/* - * integrate_times for controlled stepper - */ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - TimeIterator start_time , TimeIterator end_time , Time dt , - Observer observer , controlled_stepper_tag -) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - typedef typename unit_value_type<Time>::type time_type; - - failed_step_checker fail_checker; // to throw a runtime_error if step size adjustment fails - size_t steps = 0; - while( true ) - { - Time current_time = *start_time++; - obs( start_state , current_time ); - if( start_time == end_time ) - break; - while( less_with_sign( current_time , static_cast<time_type>(*start_time) , dt ) ) - { - // adjust stepsize to end up exactly at the observation point - Time current_dt = min_abs( dt , *start_time - current_time ); - if( st.try_step( system , start_state , current_time , current_dt ) == success ) - { - ++steps; - // successful step -> reset the fail counter, see #173 - fail_checker.reset(); - // continue with the original step size if dt was reduced due to observation - dt = max_abs( dt , current_dt ); - } - else - { - fail_checker(); // check for possible overflow of failed steps in step size adjustment - dt = current_dt; - } - } - } - return steps; -} - -/* - * integrate_times for dense output stepper - */ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - TimeIterator start_time , TimeIterator end_time , Time dt , - Observer observer , dense_output_stepper_tag -) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - typedef typename unit_value_type<Time>::type time_type; - - if( start_time == end_time ) - return 0; - - TimeIterator last_time_iterator = end_time; - --last_time_iterator; - Time last_time_point = static_cast<time_type>(*last_time_iterator); - - st.initialize( start_state , *start_time , dt ); - obs( start_state , *start_time++ ); - - size_t count = 0; - while( start_time != end_time ) - { - while( ( start_time != end_time ) && less_eq_with_sign( static_cast<time_type>(*start_time) , st.current_time() , st.current_time_step() ) ) - { - st.calc_state( *start_time , start_state ); - obs( start_state , *start_time ); - start_time++; - } - - // we have not reached the end, do another real step - if( less_eq_with_sign( st.current_time() + st.current_time_step() , - last_time_point , - st.current_time_step() ) ) - { - st.do_step( system ); - ++count; - } - else if( start_time != end_time ) - { // do the last step ending exactly on the end point - st.initialize( st.current_state() , st.current_time() , last_time_point - st.current_time() ); - st.do_step( system ); - ++count; - } - } - return count; -} - - -} // namespace detail -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate.hpp deleted file mode 100644 index bb380f43b0dbbf07ccb88a965f60e486a99cb3a7..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate.hpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate.hpp - - [begin_description] - Convenience methods which choose the stepper for the current ODE. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED - -#include <boost/utility/enable_if.hpp> - -#include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp> -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/integrate/null_observer.hpp> -#include <boost/numeric/odeint/integrate/integrate_adaptive.hpp> - -// for has_value_type trait -#include <boost/numeric/odeint/algebra/detail/extract_value_type.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * ToDo : - * - * determine type of dxdt for units - * - */ -template< class System , class State , class Time , class Observer > -typename boost::enable_if< typename has_value_type<State>::type , size_t >::type -integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) -{ - typedef controlled_runge_kutta< runge_kutta_dopri5< State , typename State::value_type , State , Time > > stepper_type; - return integrate_adaptive( stepper_type() , system , start_state , start_time , end_time , dt , observer ); -} - -template< class Value , class System , class State , class Time , class Observer > -size_t -integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) -{ - typedef controlled_runge_kutta< runge_kutta_dopri5< State , Value , State , Time > > stepper_type; - return integrate_adaptive( stepper_type() , system , start_state , start_time , end_time , dt , observer ); -} - - - - -/* - * the two overloads are needed in order to solve the forwarding problem - */ -template< class System , class State , class Time > -size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt ) -{ - return integrate( system , start_state , start_time , end_time , dt , null_observer() ); -} - -template< class Value , class System , class State , class Time > -size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt ) -{ - return integrate< Value >( system , start_state , start_time , end_time , dt , null_observer() ); -} - - - -/** - * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) - * \brief Integrates the ODE. - * - * Integrates the ODE given by system from start_time to end_time starting - * with start_state as initial condition and dt as initial time step. - * This function uses a dense output dopri5 stepper and performs an adaptive - * integration with step size control, thus dt changes during the integration. - * This method uses standard error bounds of 1E-6. - * After each step, the observer is called. - * - * \attention A second version of this function template exists which explicitly - * expects the value type as template parameter, i.e. integrate< double >( sys , x , t0 , t1 , dt , obs ); - * - * \param system The system function to solve, hence the r.h.s. of the - * ordinary differential equation. - * \param start_state The initial state. - * \param start_time Start time of the integration. - * \param end_time End time of the integration. - * \param dt Initial step size, will be adjusted during the integration. - * \param observer Observer that will be called after each time step. - * \return The number of steps performed. - */ - - -/** - * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt ) - * \brief Integrates the ODE without observer calls. - * - * Integrates the ODE given by system from start_time to end_time starting - * with start_state as initial condition and dt as initial time step. - * This function uses a dense output dopri5 stepper and performs an adaptive - * integration with step size control, thus dt changes during the integration. - * This method uses standard error bounds of 1E-6. - * No observer is called. - * - * \attention A second version of this function template exists which explicitly - * expects the value type as template parameter, i.e. integrate< double >( sys , x , t0 , t1 , dt ); - * - * \param system The system function to solve, hence the r.h.s. of the - * ordinary differential equation. - * \param start_state The initial state. - * \param start_time Start time of the integration. - * \param end_time End time of the integration. - * \param dt Initial step size, will be adjusted during the integration. - * \return The number of steps performed. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_adaptive.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_adaptive.hpp deleted file mode 100644 index e7d6cf7e861b0a82c834d96ecdb450e523f52aa9..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_adaptive.hpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate_adaptive.hpp - - [begin_description] - Adaptive integration of ODEs. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2015 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED - -#include <boost/type_traits/is_same.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/integrate/null_observer.hpp> -#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * the two overloads are needed in order to solve the forwarding problem - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_adaptive( - stepper , system , start_state , - start_time , end_time , dt , - observer , stepper_category() ); - - /* - * Suggestion for a new extendable version: - * - * integrator_adaptive< Stepper , System, State , Time , Observer , typename Stepper::stepper_category > integrator; - * return integrator.run( stepper , system , start_state , start_time , end_time , dt , observer ); - */ -} - -/** - * \brief Second version to solve the forwarding problem, - * can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , const State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_adaptive( - stepper , system , start_state , - start_time , end_time , dt , - observer , stepper_category() ); -} - - - - -/** - * \brief integrate_adaptive without an observer. - */ -template< class Stepper , class System , class State , class Time > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt ) -{ - return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , null_observer() ); -} - -/** - * \brief Second version to solve the forwarding problem, - * can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time > -size_t integrate_adaptive( - Stepper stepper , System system , const State &start_state , - Time start_time , Time end_time , Time dt ) -{ - return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , null_observer() ); -} - - -/************* DOXYGEN ************/ - - /** - * \fn integrate_adaptive( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) - * \brief Integrates the ODE with adaptive step size. - * - * This function integrates the ODE given by system with the given stepper. - * The observer is called after each step. If the stepper has no error - * control, the step size remains constant and the observer is called at - * equidistant time points t0+n*dt. If the stepper is a ControlledStepper, - * the step size is adjusted and the observer is called in non-equidistant - * intervals. - * - * \param stepper The stepper to be used for numerical integration. - * \param system Function/Functor defining the rhs of the ODE. - * \param start_state The initial condition x0. - * \param start_time The initial time t0. - * \param end_time The final integration time tend. - * \param dt The time step between observer calls, _not_ necessarily the - * time step of the integration. - * \param observer Function/Functor called at equidistant time intervals. - * \return The number of steps performed. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_const.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_const.hpp deleted file mode 100644 index fae683f9782557541983bc1e813ab4a9912b2613..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_const.hpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate_const.hpp - - [begin_description] - Constant integration of ODEs, meaning that the state of the ODE is observed on constant time intervals. - The routines makes full use of adaptive and dense-output methods. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2015 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED - -#include <boost/type_traits/is_same.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/integrate/null_observer.hpp> -#include <boost/numeric/odeint/integrate/check_adapter.hpp> -#include <boost/numeric/odeint/integrate/detail/integrate_const.hpp> -#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * Integrates with constant time step dt. - */ -template<class Stepper, class System, class State, class Time, class Observer, class StepOverflowChecker> -size_t integrate_const( - Stepper stepper, System system, State &start_state, - Time start_time, Time end_time, Time dt, - Observer observer, StepOverflowChecker checker -) { - typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category; - // we want to get as fast as possible to the end - // no overflow checks needed - if (boost::is_same<null_observer, Observer>::value) { - return detail::integrate_adaptive( - stepper, system, start_state, - start_time, end_time, dt, - observer, stepper_category()); - } - else { - // unwrap references - typedef typename odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type; - - return detail::integrate_const(checked_stepper<stepper_type, checker_type>(stepper, checker), - system, start_state, - start_time, end_time, dt, - checked_observer<observer_type, checker_type>(observer, checker), - stepper_category()); - } -} - -/** -* \brief Second version to solve the forwarding problem, -* can be called with Boost.Range as start_state. -*/ -template<class Stepper, class System, class State, class Time, class Observer, class StepOverflowChecker > -size_t integrate_const( - Stepper stepper, System system, const State &start_state, - Time start_time, Time end_time, Time dt, - Observer observer, StepOverflowChecker checker -) { - typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category; - // we want to get as fast as possible to the end - - if (boost::is_same<null_observer, Observer>::value) { - return detail::integrate_adaptive( - stepper, system, start_state, - start_time, end_time, dt, - observer, stepper_category()); - } - else { - typedef typename odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type; - - return detail::integrate_const(checked_stepper<stepper_type, checker_type>(stepper, checker), - system, start_state, - start_time, end_time, dt, - checked_observer<observer_type, checker_type>(observer, checker), - stepper_category()); - } -} - - -/** -* \brief integrate_const without step overflow checker -*/ -template<class Stepper, class System, class State, class Time, class Observer> -size_t integrate_const( - Stepper stepper, System system, State &start_state, - Time start_time, Time end_time, Time dt, Observer observer) -{ - typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category; - return detail::integrate_const(stepper, system, start_state, - start_time, end_time, dt, observer, stepper_category()); -} - -/** -* \brief Second version to solve the forwarding problem, -* can be called with Boost.Range as start_state. -*/ -template<class Stepper, class System, class State, class Time, class Observer> -size_t integrate_const( - Stepper stepper, System system, const State &start_state, - Time start_time, Time end_time, Time dt, Observer observer -) { - typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category; - return detail::integrate_const(stepper, system, start_state, - start_time, end_time, dt, observer, stepper_category()); -} - - -/** -* \brief integrate_const without observer calls -*/ -template<class Stepper, class System, class State, class Time> -size_t integrate_const( - Stepper stepper, System system, State &start_state, - Time start_time, Time end_time, Time dt -) { - return integrate_const(stepper, system, start_state, start_time, end_time, dt, null_observer()); -} - -/** -* \brief Second version to solve the forwarding problem, -* can be called with Boost.Range as start_state. -*/ -template<class Stepper, class System, class State, class Time> -size_t integrate_const( - Stepper stepper, System system, const State &start_state, - Time start_time, Time end_time, Time dt -) { - return integrate_const(stepper, system, start_state, start_time, end_time, dt, null_observer()); -} - - - - - - -/********* DOXYGEN *********/ -/** - * \fn integrate_const( Stepper stepper , System system , State &start_state , Time start_time , - * Time end_time , Time dt , Observer observer , StepOverflowChecker checker ) - * \brief Integrates the ODE with constant step size. - * - * Integrates the ODE defined by system using the given stepper. - * This method ensures that the observer is called at constant intervals dt. - * If the Stepper is a normal stepper without step size control, dt is also - * used for the numerical scheme. If a ControlledStepper is provided, the - * algorithm might reduce the step size to meet the error bounds, but it is - * ensured that the observer is always called at equidistant time points - * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary - * and the dense output is used to call the observer at equidistant time - * points. - * If a max_step_checker is provided as StepOverflowChecker, a - * no_progress_error is thrown if too many steps (default: 500) are performed - * without progress, i.e. in between observer calls. If no checker is provided, - * no such overflow check is performed. - * - * \param stepper The stepper to be used for numerical integration. - * \param system Function/Functor defining the rhs of the ODE. - * \param start_state The initial condition x0. - * \param start_time The initial time t0. - * \param end_time The final integration time tend. - * \param dt The time step between observer calls, _not_ necessarily the - * time step of the integration. - * \param observer [optional] Function/Functor called at equidistant time intervals. - * \param checker [optional] Functor to check for step count overflows, if no - * checker is provided, no exception is thrown. - * \return The number of steps performed. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_n_steps.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_n_steps.hpp deleted file mode 100644 index c95e695193047d521d0ab9fafe508f53ad204d74..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_n_steps.hpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate_n_steps.hpp - - [begin_description] - Integration of n steps with constant time size. Adaptive and dense-output methods are fully supported. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2015 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED - -#include <boost/type_traits/is_same.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/integrate/null_observer.hpp> -#include <boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp> -#include <boost/numeric/odeint/integrate/check_adapter.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * Integrates n steps - * - * the two overloads are needed in order to solve the forwarding problem - */ -template< class Stepper , class System , class State , class Time , class Observer , class StepOverflowChecker > -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer , StepOverflowChecker checker ) -{ - // unwrap references - typedef typename odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type; - typedef typename stepper_type::stepper_category stepper_category; - - return detail::integrate_n_steps( - checked_stepper<stepper_type, checker_type>(stepper, checker), - system , start_state , - start_time , dt , num_of_steps , - checked_observer<observer_type, checker_type>(observer, checker), - stepper_category() ); -} - -/** - * \brief Solves the forwarding problem, can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time , class Observer , class StepOverflowChecker > -Time integrate_n_steps( - Stepper stepper , System system , const State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer , StepOverflowChecker checker ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type; - typedef typename stepper_type::stepper_category stepper_category; - - return detail::integrate_n_steps( - checked_stepper<stepper_type, checker_type>(stepper, checker), - system , start_state , - start_time , dt , num_of_steps , - checked_observer<observer_type, checker_type>(observer, checker), - stepper_category() ); -} - - -/** -* \brief The same function as above, but without checker. -*/ -template< class Stepper , class System , class State , class Time , class Observer > -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , Observer observer ) -{ - typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category; - - return detail::integrate_n_steps( - stepper , system , start_state , - start_time , dt , num_of_steps , - observer , stepper_category() ); -} - -/** -* \brief Solves the forwarding problem, can be called with Boost.Range as start_state. -*/ -template< class Stepper , class System , class State , class Time , class Observer > -Time integrate_n_steps( - Stepper stepper , System system , const State &start_state , - Time start_time , Time dt , size_t num_of_steps , Observer observer ) -{ - typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category; - - return detail::integrate_n_steps( - stepper , system , start_state , - start_time , dt , num_of_steps , - observer , stepper_category() ); -} - -/** - * \brief The same function as above, but without observer calls. - */ -template< class Stepper , class System , class State , class Time > -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps ) -{ - return integrate_n_steps(stepper, system, start_state, start_time, - dt, num_of_steps, null_observer()); -} - -/** - * \brief Solves the forwarding problem, can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time > -Time integrate_n_steps( - Stepper stepper , System system , const State &start_state , - Time start_time , Time dt , size_t num_of_steps ) -{ - return integrate_n_steps(stepper, system, start_state, start_time, - dt, num_of_steps, null_observer()); -} - - - -/************* DOXYGEN *************/ - /** - * \fn Time integrate_n_steps( Stepper stepper , System system , State &start_state , Time start_time , Time dt , size_t num_of_steps , Observer observer ) - * \brief Integrates the ODE with constant step size. - * - * This function is similar to integrate_const. The observer is called at - * equidistant time intervals t0 + n*dt. - * If the Stepper is a normal stepper without step size control, dt is also - * used for the numerical scheme. If a ControlledStepper is provided, the - * algorithm might reduce the step size to meet the error bounds, but it is - * ensured that the observer is always called at equidistant time points - * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary - * and the dense output is used to call the observer at equidistant time - * points. The final integration time is always t0 + num_of_steps*dt. - * If a max_step_checker is provided as StepOverflowChecker, a - * no_progress_errror is thrown if too many steps (default: 500) are - * performed without progress, i.e. in between observer calls. If no - * checker is provided, no such overflow check is performed. - - * - * \param stepper The stepper to be used for numerical integration. - * \param system Function/Functor defining the rhs of the ODE. - * \param start_state The initial condition x0. - * \param start_time The initial time t0. - * \param dt The time step between observer calls, _not_ necessarily the - * time step of the integration. - * \param num_of_steps Number of steps to be performed - * \param observer Function/Functor called at equidistant time intervals. - * \param checker [optional] Functor to check for step count overflows, if no - * checker is provided, no exception is thrown. - * \return The number of steps performed. - */ - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_times.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_times.hpp deleted file mode 100644 index 29662257fc973a8aafab6ef215d83a2a2abf6389..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/integrate_times.hpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate_times.hpp - - [begin_description] - Integration of ODEs with observation at user defined points - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2015 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED - -#include <boost/type_traits/is_same.hpp> - -#include <boost/range.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/integrate/null_observer.hpp> -#include <boost/numeric/odeint/integrate/check_adapter.hpp> -#include <boost/numeric/odeint/integrate/detail/integrate_times.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * \brief Integrates while calling the observer at the time points given by sequence [times_start, time_end) - * the two overloads are needed in order to solve the forwarding problem - */ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer , class StepOverflowChecker > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - TimeIterator times_start , TimeIterator times_end , Time dt , - Observer observer , StepOverflowChecker checker ) -{ - // unwrap references - typedef typename odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type; - typedef typename stepper_type::stepper_category stepper_category; - - // pass on checked stepper and observer - // checked_stepper/observer use references internally, so passing by value is fine - return detail::integrate_times( - checked_stepper<stepper_type, checker_type>(stepper, checker) , - system , start_state , - times_start , times_end , dt , - checked_observer<observer_type, checker_type>(observer, checker), - stepper_category() ); -} - -/** - * \brief Solves the forwarding problem, can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer , class StepOverflowChecker > -size_t integrate_times( - Stepper stepper , System system , const State &start_state , - TimeIterator times_start , TimeIterator times_end , Time dt , - Observer observer , StepOverflowChecker checker ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type; - typedef typename stepper_type::stepper_category stepper_category; - - stepper_type &st = stepper; - observer_type &obs = observer; - checker_type &chk = checker; - - return detail::integrate_times( - checked_stepper<stepper_type, checker_type>(stepper, checker) , - system , start_state , - times_start , times_end , dt , - checked_observer<observer_type, checker_type>(observer, checker), - stepper_category() ); -} - -/** - * \brief The same function as above, but with the observation times given as range. - */ -template< class Stepper , class System , class State , class TimeRange , class Time , class Observer , class StepOverflowChecker > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - const TimeRange × , Time dt , - Observer observer , StepOverflowChecker checker ) -{ - return integrate_times( - stepper , system , start_state , - boost::begin( times ) , boost::end( times ) , dt , observer , checker ); -} - -/** - * \brief Solves the forwarding problem, can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class TimeRange , class Time , class Observer , class StepOverflowChecker > -size_t integrate_times( - Stepper stepper , System system , const State &start_state , - const TimeRange × , Time dt , - Observer observer , StepOverflowChecker checker ) -{ - return integrate_times( - stepper , system , start_state , - boost::begin( times ) , boost::end( times ) , dt , observer , checker ); -} - - - - -/* -* The same functions as above, but without a StepOverflowChecker -*/ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - TimeIterator times_start , TimeIterator times_end , Time dt , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - // simply don't use checked_* adapters - return detail::integrate_times( - stepper , system , start_state , - times_start , times_end , dt , - observer , stepper_category() ); -} - -/** -* \brief Solves the forwarding problem, can be called with Boost.Range as start_state. -*/ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , const State &start_state , - TimeIterator times_start , TimeIterator times_end , Time dt , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_times( - stepper , system , start_state , - times_start , times_end , dt , - observer , stepper_category() ); -} - -/** -* \brief The same function as above, but with the observation times given as range. -*/ -template< class Stepper , class System , class State , class TimeRange , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - const TimeRange × , Time dt , - Observer observer ) -{ - return integrate_times( - stepper , system , start_state , - boost::begin( times ) , boost::end( times ) , dt , observer ); -} - -/** -* \brief Solves the forwarding problem, can be called with Boost.Range as start_state. -*/ -template< class Stepper , class System , class State , class TimeRange , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , const State &start_state , - const TimeRange × , Time dt , - Observer observer ) -{ - return integrate_times( - stepper , system , start_state , - boost::begin( times ) , boost::end( times ) , dt , observer); -} - - -/********* DOXYGEN ***********/ - - /** - * \fn size_t integrate_times( Stepper stepper , System system , State &start_state , TimeIterator times_start , TimeIterator times_end , Time dt , Observer observer ) - * \brief Integrates the ODE with observer calls at given time points. - * - * Integrates the ODE given by system using the given stepper. This function - * does observer calls at the subsequent time points given by the range - * times_start, times_end. If the stepper has not step size control, the - * step size might be reduced occasionally to ensure observer calls exactly - * at the time points from the given sequence. If the stepper is a - * ControlledStepper, the step size is adjusted to meet the error bounds, - * but also might be reduced occasionally to ensure correct observer calls. - * If a DenseOutputStepper is provided, the dense output functionality is - * used to call the observer at the given times. The end time of the - * integration is always *(end_time-1). - * If a max_step_checker is provided as StepOverflowChecker, a - * no_progress_error is thrown if too many steps (default: 500) are - * performed without progress, i.e. in between observer calls. If no - * checker is provided, no such overflow check is performed. - * - * \param stepper The stepper to be used for numerical integration. - * \param system Function/Functor defining the rhs of the ODE. - * \param start_state The initial condition x0. - * \param times_start Iterator to the start time - * \param times_end Iterator to the end time - * \param dt The time step between observer calls, _not_ necessarily the - * time step of the integration. - * \param observer Function/Functor called at equidistant time intervals. - * \param checker [optional] Functor to check for step count overflows, if no - * checker is provided, no exception is thrown. - * \return The number of steps performed. - */ - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/max_step_checker.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/max_step_checker.hpp deleted file mode 100644 index 6808a57bdbf2318474b0b72395c39c4a9cda2335..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/max_step_checker.hpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/max_step_checker.hpp - - [begin_description] - Throws exception if too many steps are performed. - [end_description] - - Copyright 2015 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_MAX_STEP_CHECKER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_MAX_STEP_CHECKER_HPP_INCLUDED - -#include <stdexcept> -#include <cstdio> - -#include <boost/throw_exception.hpp> -#include <boost/numeric/odeint/util/odeint_error.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -/** - * \brief A class for performing overflow checks on the step count in integrate functions. - * - * Provide an instance of this class to integrate functions if you want to throw a runtime error if - * too many steps are performed without progress during the integrate routine. - */ -class max_step_checker -{ -public: - -protected: - const int m_max_steps; - int m_steps; - -public: - /** - * \brief Construct the max_step_checker. - * max_steps is the maximal number of iterations allowed before runtime_error is thrown. - */ - max_step_checker(const int max_steps = 500) - : m_max_steps(max_steps) - { - reset(); - } - - /** - * \brief Resets the max_step_checker by setting the internal counter to 0. - */ - void reset() - { - m_steps = 0; - } - - /** - * \brief Increases the counter and performs the iteration check - */ - void operator()(void) - { - if( m_steps++ >= m_max_steps ) - { - char error_msg[200]; - sprintf(error_msg, "Max number of iterations exceeded (%d).", m_max_steps); - BOOST_THROW_EXCEPTION( no_progress_error(error_msg) ); - } - } -}; - - -/** - * \brief A class for performing overflow checks on the failed step count in step size adjustments. - * - * Used internally within the dense output stepper and integrate routines. - */ -class failed_step_checker : public max_step_checker -{ - -public: - /** - * \brief Construct the failed_step_checker. - * max_steps is the maximal number of iterations allowed before runtime_error is thrown. - */ - failed_step_checker(const int max_steps = 500) - : max_step_checker(max_steps) - {} - - /** - * \brief Increases the counter and performs the iteration check - */ - void operator()(void) - { - if( m_steps++ >= m_max_steps ) - { - char error_msg[200]; - sprintf(error_msg, "Max number of iterations exceeded (%d). A new step size was not found.", m_max_steps); - BOOST_THROW_EXCEPTION( step_adjustment_error(error_msg) ); - } - } -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif \ No newline at end of file diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/null_observer.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/null_observer.hpp deleted file mode 100644 index 82b86b4582e2ec4daf94e5b9f27ebb79cbfa777f..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/null_observer.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/null_observer.hpp - - [begin_description] - null_observer - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED - -namespace boost { -namespace numeric { -namespace odeint { - -struct null_observer -{ - template< class State , class Time > - void operator()( const State& /* x */ , Time /* t */ ) const - { - - } -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/observer_collection.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/observer_collection.hpp deleted file mode 100644 index f8c9af8e24f5232fc54a46486128c02c7e45cba8..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/integrate/observer_collection.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/observer_collection.hpp - - [begin_description] - Collection of observers, which are all called during the evolution of the ODE. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED - -#include <vector> - -#include <boost/function.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< class State , class Time > -class observer_collection -{ -public: - - typedef boost::function< void( const State& , const Time& ) > observer_type; - typedef std::vector< observer_type > collection_type; - - void operator()( const State& x , Time t ) - { - for( size_t i=0 ; i<m_observers.size() ; ++i ) - m_observers[i]( x , t ); - } - - collection_type& observers( void ) { return m_observers; } - const collection_type& observers( void ) const { return m_observers; } - -private: - - collection_type m_observers; -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/adaptive_iterator.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/adaptive_iterator.hpp deleted file mode 100644 index d57fe72db0fc18cf0e87e59b5de4c19716c3a7c8..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/adaptive_iterator.hpp +++ /dev/null @@ -1,183 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/adaptive_iterator.hpp - - [begin_description] - Iterator for iterating throught the solution of an ODE with adaptive step size. The dereferenced types containes also the time. - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED - -#include <boost/numeric/odeint/util/stepper_traits.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - /* use the adaptive_iterator_impl with the right tags */ - template< class Stepper , class System , class State -#ifndef DOXYGEN_SKIP - , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type -#endif - > - class adaptive_iterator : public adaptive_iterator_impl< - adaptive_iterator< Stepper , System , State , StepperTag > , - Stepper , System , State , detail::ode_state_iterator_tag , StepperTag - > - { - typedef typename traits::time_type< Stepper >::type time_type; - typedef adaptive_iterator< Stepper , System , State , StepperTag > iterator_type; - - public: - adaptive_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt ) - : adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt ) - {} - - adaptive_iterator( Stepper stepper , System sys , State &s ) - : adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s ) - {} - }; - - - - - template< class Stepper , class System , class State > - adaptive_iterator< Stepper , System , State > make_adaptive_iterator_begin( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - { - return adaptive_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ); - } - - - template< class Stepper , class System , class State > - adaptive_iterator< Stepper , System , State > make_adaptive_iterator_end( - Stepper stepper , - System system , - State &x ) - { - return adaptive_iterator< Stepper , System , State >( stepper , system , x ); - } - - - template< class Stepper , class System , class State > - std::pair< adaptive_iterator< Stepper , System , State > , adaptive_iterator< Stepper , System , State > > - make_adaptive_range( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - { - return std::make_pair( - adaptive_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) , - adaptive_iterator< Stepper , System , State >( stepper , system , x ) - ); - } - - /** - * \class adaptive_iterator - * - * \brief ODE Iterator with adaptive step size. The value type of this iterator is the state type of the stepper. - * - * Implements an iterator representing the solution of an ODE from t_start - * to t_end evaluated at steps with an adaptive step size dt. - * After each iteration the iterator dereferences to the state x at the next - * time t+dt where dt is controlled by the stepper. - * This iterator can be used with ControlledSteppers and - * DenseOutputSteppers and it always makes use of the all the given steppers - * capabilities. A for_each over such an iterator range behaves similar to - * the integrate_adaptive routine. - * - * adaptive_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - * \tparam State The state type of the ODE. - */ - - - - - - - /** - * \fn make_adaptive_iterator_begin( Stepper stepper , System system , State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function for adaptive_iterator. Constructs a begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. - * \param t_start The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - * \returns The adaptive iterator. - */ - - - /** - * \fn make_adaptive_iterator_end( Stepper stepper , System system , State &x ) - * \brief Factory function for adaptive_iterator. Constructs a end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. - * \returns The adaptive iterator. - */ - - - /** - * \fn make_adaptive_range( Stepper stepper , System system , State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function to construct a single pass range of adaptive iterators. A range is here a pair of adaptive_iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. - * \param t_start The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - * \returns The adaptive range. - */ - - - - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp deleted file mode 100644 index b55b7a744307cf8a706a14d51910946133b9feec..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp +++ /dev/null @@ -1,175 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/adaptive_time_iterator.hpp - - [begin_description] - Iterator for iterating throught the solution of an ODE with adaptive step size. The dereferenced types containes also the time. - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2012-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED - - - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/util/stepper_traits.hpp> -#include <boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - /* use the adaptive_iterator_impl with the right tags */ - template< class Stepper , class System , class State -#ifndef DOXYGEN_SKIP - , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type -#endif - > - class adaptive_time_iterator : public adaptive_iterator_impl< - adaptive_time_iterator< Stepper , System , State , StepperTag > , - Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag - > - { - typedef typename traits::time_type< Stepper >::type time_type; - typedef adaptive_time_iterator< Stepper , System , State , StepperTag > iterator_type; - - public: - adaptive_time_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt ) - : adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt ) - {} - - adaptive_time_iterator( Stepper stepper , System sys , State &s ) - : adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s ) - {} - }; - - - - - template< class Stepper , class System , class State > - adaptive_time_iterator< Stepper , System , State > make_adaptive_time_iterator_begin( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - { - return adaptive_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ); - } - - template< class Stepper , class System , class State > - adaptive_time_iterator< Stepper , System , State > make_adaptive_time_iterator_end( - Stepper stepper , - System system , - State &x ) - { - return adaptive_time_iterator< Stepper , System , State >( stepper , system , x ); - } - - - template< class Stepper , class System , class State > - std::pair< adaptive_time_iterator< Stepper , System , State > , adaptive_time_iterator< Stepper , System , State > > - make_adaptive_time_range( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - { - return std::make_pair( - adaptive_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) , - adaptive_time_iterator< Stepper , System , State >( stepper , system , x ) ); - } - - - - /** - * \class adaptive_time_iterator - * - * \brief ODE Iterator with adaptive step size. The value type of this iterator is a std::pair containing state and time. - * - * Implements an iterator representing the solution of an ODE from t_start - * to t_end evaluated at steps with an adaptive step size dt. - * After each iteration the iterator dereferences to a pair containing state - * and time at the next time point t+dt where dt is controlled by the stepper. - * This iterator can be used with ControlledSteppers and - * DenseOutputSteppers and it always makes use of the all the given steppers - * capabilities. A for_each over such an iterator range behaves similar to - * the integrate_adaptive routine. - * - * adaptive_iterator is a model of single-pass iterator. - * - * The value type of this iterator is a std::pair of state and time of the stepper. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - * \tparam State The state type of the ODE. - */ - - - - /** - * \fn make_adaptive_time_iterator_begin( Stepper stepper , System system , State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function for adaptive_time_iterator. Constructs a begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. adaptive_time_iterator stores a reference of s and changes its value during the iteration. - * \param t_start The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - * \returns The adaptive time iterator. - */ - - - /** - * \fn make_adaptive_time_iterator_end( Stepper stepper , System system , State &x ) - * \brief Factory function for adaptive_time_iterator. Constructs a end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. adaptive_time_iterator stores a reference of s and changes its value during the iteration. - * \returns The adaptive time iterator. - */ - - - /** - * \fn make_adaptive_time_range( Stepper stepper , System system , State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function to construct a single pass range of adaptive time iterators. A range is here a pair of adaptive_time_iterators. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. adaptive_time_iterator stores a reference of s and changes its value during the iteration. - * \param t_start The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - * \returns The adaptive time range. - */ - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/const_step_iterator.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/const_step_iterator.hpp deleted file mode 100644 index f3885b074f205612361db0d94cd23bba60f90c41..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/const_step_iterator.hpp +++ /dev/null @@ -1,180 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/const_step_iterator.hpp - - [begin_description] - Iterator for iterating through the solution of an ODE with constant step size. - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/stepper_traits.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> -#include <boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - - /* use the const_step_iterator_impl with the right tags */ - template< class Stepper , class System , class State -#ifndef DOXYGEN_SKIP - , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type -#endif - > - class const_step_iterator : public const_step_iterator_impl< - const_step_iterator< Stepper , System , State , StepperTag > , - Stepper , System , State , detail::ode_state_iterator_tag , StepperTag - > - { - typedef typename traits::time_type< Stepper >::type time_type; - typedef const_step_iterator< Stepper , System , State , StepperTag > iterator_type; - - public: - const_step_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt ) - : const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt ) - {} - - const_step_iterator( Stepper stepper , System sys , State &s ) - : const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s ) - {} - }; - - /* make functions */ - - template< class Stepper , class System , class State > - const_step_iterator< Stepper , System, State > make_const_step_iterator_begin( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - { - return const_step_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ); - } - - template< class Stepper , class System , class State > - const_step_iterator< Stepper , System , State > make_const_step_iterator_end( - Stepper stepper , - System system , - State &x ) - { - return const_step_iterator< Stepper , System , State >( stepper , system , x ); - } - - template< class Stepper , class System , class State > - std::pair< const_step_iterator< Stepper , System , State > , const_step_iterator< Stepper , System , State > > - make_const_step_range( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - { - return std::make_pair( - const_step_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) , - const_step_iterator< Stepper , System , State >( stepper , system , x ) - ); - } - - - - /** - * \class const_step_iterator - * - * \brief ODE Iterator with constant step size. The value type of this iterator is the state type of the stepper. - * - * Implements an iterator representing the solution of an ODE from t_start - * to t_end evaluated at steps with constant step size dt. - * After each iteration the iterator dereferences to the state x at the next - * time t+dt. - * This iterator can be used with Steppers and - * DenseOutputSteppers and it always makes use of the all the given steppers - * capabilities. A for_each over such an iterator range behaves similar to - * the integrate_const routine. - * - * const_step_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - * \tparam State The state type of the ODE. - */ - - - /** - * \fn make_const_step_iterator_begin( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function for const_step_iterator. Constructs a begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t_start The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - * \returns The const step iterator. - */ - - - /** - * \fn make_const_step_iterator_end( Stepper stepper , System system , State &x ) - * \brief Factory function for const_step_iterator. Constructs a end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \returns The const_step_iterator. - */ - - - /** - * \fn make_const_step_range( Stepper stepper , System system , State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function to construct a single pass range of const step iterators. A range is here a pair - * of const_step_iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration. - * \param t_start The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - * \returns The const step range. - */ - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -//#include <boost/numeric/odeint/iterator/impl/const_step_iterator_dense_output_impl.hpp> - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/const_step_time_iterator.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/const_step_time_iterator.hpp deleted file mode 100644 index cdc6d56fa120606ce519e6798a07bb951ff6fb02..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/const_step_time_iterator.hpp +++ /dev/null @@ -1,173 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/const_step_time_iterator.hpp - - [begin_description] - Iterator for iterating throught the solution of an ODE with constant step size. The dereferences types containes also the time. - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/util/stepper_traits.hpp> -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> -#include <boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - /* use the const_step_iterator_impl with the right tags */ - template< class Stepper , class System , class State -#ifndef DOXYGEN_SKIP - , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type -#endif - > - class const_step_time_iterator : public const_step_iterator_impl< - const_step_time_iterator< Stepper , System , State , StepperTag > , - Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag - > - { - typedef typename traits::time_type< Stepper >::type time_type; - typedef const_step_time_iterator< Stepper , System , State , StepperTag > iterator_type; - - public: - const_step_time_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt ) - : const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt ) - {} - - const_step_time_iterator( Stepper stepper , System sys , State &s ) - : const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s ) - {} - }; - - template< class Stepper , class System , class State > - const_step_time_iterator< Stepper , System , State > make_const_step_time_iterator_begin( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - { - return const_step_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ); - } - - template< class Stepper , class System , class State > - const_step_time_iterator< Stepper , System , State > make_const_step_time_iterator_end( - Stepper stepper , - System system , - State &x ) - { - return const_step_time_iterator< Stepper , System , State >( stepper , system , x ); - } - - - template< class Stepper , class System , class State > - std::pair< const_step_time_iterator< Stepper , System , State > , const_step_time_iterator< Stepper , System , State > > - make_const_step_time_range( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - { - return std::make_pair( - const_step_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) , - const_step_time_iterator< Stepper , System , State >( stepper , system , x ) ); - } - - /** - * \class const_step_time_iterator - * - * \brief ODE Iterator with constant step size. The value type of this iterator is a std::pair containing state and time. - * - * Implements an iterator representing the solution of an ODE from t_start - * to t_end evaluated at steps with constant step size dt. - * After each iteration the iterator dereferences to a pair containing - * state and time at the next time point t+dt.. - * This iterator can be used with Steppers and - * DenseOutputSteppers and it always makes use of the all the given steppers - * capabilities. A for_each over such an iterator range behaves similar to - * the integrate_const routine. - * - * const_step_time_iterator is a model of single-pass iterator. - * - * The value type of this iterator is a pair with the state type and time type of the stepper. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - * \tparam State The state type of the ODE. - */ - - - /** - * \fn make_const_step_time_iterator_begin( Stepper stepper , System system , State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function for const_step_time_iterator. Constructs a begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_time_iterator stores a reference of s and changes its value during the iteration. - * \param t_start The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - * \returns The const step time iterator. - */ - - - /** - * \fn make_const_step_time_iterator_end( Stepper stepper , System system , State &x ) - * \brief Factory function for const_step_time_iterator. Constructs a end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_time_iterator store a reference of s and changes its value during the iteration. - * \returns The const step time iterator. - */ - - - /** - * \fn make_const_step_time_range( Stepper stepper , System system , State &x , - typename traits::time_type< Stepper >::type t_start , - typename traits::time_type< Stepper >::type t_end , - typename traits::time_type< Stepper >::type dt) - * - * \brief Factory function to construct a single pass range of const_step_time_iterator. A range is here a pair of const_step_time_iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_time_iterator stores a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - * \returns The const step time range. - */ - - - - - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp deleted file mode 100644 index fcab45fc17951aa7650445ebb7dc7ebc0c66aa52..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp +++ /dev/null @@ -1,199 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp - - [begin_description] - Base class for const_step_iterator and adaptive_iterator. - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2012-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED - -#include <boost/iterator/iterator_facade.hpp> - -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - - struct ode_state_iterator_tag {}; - struct ode_state_time_iterator_tag {}; - - template< class Iterator , class Stepper , class System , class State , typename Tag > - class ode_iterator_base; - - - /* Specialization for the state iterator that has only state_type as its value_type */ - template< class Iterator , class Stepper , class System , class State > - class ode_iterator_base< Iterator , Stepper , System , State , ode_state_iterator_tag > - : public boost::iterator_facade - < - Iterator , - typename traits::state_type< Stepper >::type const , - boost::single_pass_traversal_tag - > - { - private: - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef typename unwrapped_stepper_type::time_type time_type; - typedef typename unwrapped_stepper_type::value_type ode_value_type; - - public: - - ode_iterator_base( stepper_type stepper , system_type sys , time_type t , time_type dt ) - : m_stepper( stepper ) , m_system( sys ) , - m_t( t ) , m_dt( dt ) , m_at_end( false ) - { } - - ode_iterator_base( stepper_type stepper , system_type sys ) - : m_stepper( stepper ) , m_system( sys ) , - m_t() , m_dt() , m_at_end( true ) - { } - - // this function is only for testing - bool same( const ode_iterator_base &iter ) const - { - return ( - //( static_cast<Iterator>(*this).get_state() == - // static_cast<Iterator>(iter).get_state ) && - ( m_t == iter.m_t ) && - ( m_dt == iter.m_dt ) && - ( m_at_end == iter.m_at_end ) - ); - } - - - protected: - - friend class boost::iterator_core_access; - - bool equal( ode_iterator_base const& other ) const - { - if( m_at_end == other.m_at_end ) - { - return true; - } - else - { - return false; - } - } - - const state_type& dereference() const - { - return static_cast<const Iterator*>(this)->get_state(); - } - - protected: - - stepper_type m_stepper; - system_type m_system; - time_type m_t; - time_type m_dt; - bool m_at_end; - }; - - - - /* Specialization for the state-time iterator that has pair<state_type,time_type> as its value_type */ - - template< class Iterator , class Stepper , class System , class State > - class ode_iterator_base< Iterator , Stepper , System , State , ode_state_time_iterator_tag > - : public boost::iterator_facade - < - Iterator , - std::pair< const State , const typename traits::time_type< Stepper >::type > , - boost::single_pass_traversal_tag , - std::pair< const State& , const typename traits::time_type< Stepper >::type& > - > - { - private: - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef typename unwrapped_stepper_type::time_type time_type; - typedef typename unwrapped_stepper_type::value_type ode_value_type; - - public: - - ode_iterator_base( stepper_type stepper , system_type sys , - time_type t , time_type dt ) - : m_stepper( stepper ) , m_system( sys ) , - m_t( t ) , m_dt( dt ) , m_at_end( false ) - { } - - ode_iterator_base( stepper_type stepper , system_type sys ) - : m_stepper( stepper ) , m_system( sys ) , m_at_end( true ) - { } - - bool same( ode_iterator_base const& iter ) - { - return ( - //( static_cast<Iterator>(*this).get_state() == - // static_cast<Iterator>(iter).get_state ) && - ( m_t == iter.m_t ) && - ( m_dt == iter.m_dt ) && - ( m_at_end == iter.m_at_end ) - ); - } - - - protected: - - friend class boost::iterator_core_access; - - bool equal( ode_iterator_base const& other ) const - { - if( m_at_end == other.m_at_end ) - { - return true; - } - else - { - return false; - } - } - - std::pair< const state_type& , const time_type& > dereference() const - { - return std::pair< const state_type & , const time_type & >( - static_cast<const Iterator*>(this)->get_state() , m_t ); - } - - stepper_type m_stepper; - system_type m_system; - time_type m_t; - time_type m_dt; - bool m_at_end; - - }; - - - -} // namespace detail -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp deleted file mode 100644 index e5b4b3cf48a67e1bde8379d240a89d2d7982e84a..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp +++ /dev/null @@ -1,253 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/iterator/detail/adaptive_iterator_impl.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ADAPTIVE_ITERATOR_IMPL_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ADAPTIVE_ITERATOR_IMPL_HPP_DEFINED - -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/throw_exception.hpp> - -#include <boost/numeric/odeint/util/unit_helper.hpp> -#include <boost/numeric/odeint/util/copy.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - - template< class Iterator , class Stepper , class System , class State , typename Tag , typename StepperTag > - class adaptive_iterator_impl; - - /* - * Specilization for controlled steppers - */ - /** - * \brief ODE Iterator with adaptive step size control. The value type of this iterator is the state type of the stepper. - * - * Implements an ODE iterator with adaptive step size control. Uses controlled steppers. adaptive_iterator is a model - * of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - */ - template< class Iterator , class Stepper , class System , class State , typename Tag > - class adaptive_iterator_impl< Iterator , Stepper , System , State , Tag , controlled_stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - public: - - /** - * \brief Constructs an adaptive_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. adaptive_iterator stores a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - */ - adaptive_iterator_impl( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt ) - : base_type( stepper , sys , t , dt ) , m_t_end( t_end ) , m_state( &s ) - { - if( detail::less_with_sign( this->m_t_end , this->m_t , this->m_dt ) ) - this->m_at_end = true; - } - - /** - * \brief Constructs an adaptive_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. adaptive_iterator store a reference of s and changes its value during the iteration. - */ - adaptive_iterator_impl( stepper_type stepper , system_type sys , state_type &s ) - : base_type( stepper , sys ) , m_state( &s ) { } - - protected: - - friend class boost::iterator_core_access; - - void increment() - { - if( detail::less_with_sign( this->m_t , this->m_t_end , this->m_dt) ) - { - if( detail::less_with_sign( this->m_t_end , - static_cast<time_type>(this->m_t + this->m_dt) , - this->m_dt ) ) - { - this->m_dt = this->m_t_end - this->m_t; - } - unwrapped_stepper_type &stepper = this->m_stepper; - const size_t max_attempts = 1000; - size_t trials = 0; - controlled_step_result res = success; - do - { - res = stepper.try_step( this->m_system , *( this->m_state ) , this->m_t , this->m_dt ); - ++trials; - } - while( ( res == fail ) && ( trials < max_attempts ) ); - if( trials == max_attempts ) - { - BOOST_THROW_EXCEPTION( std::overflow_error( "Adaptive iterator : Maximal number of iterations reached. A step size could not be found." )); - } - } else { - this->m_at_end = true; - } - } - public: - const state_type& get_state() const - { - return *this->m_state; - } - - private: - time_type m_t_end; - state_type* m_state; - }; - - - - /* - * Specilization for dense outputer steppers - */ - /** - * \brief ODE Iterator with adaptive step size control. The value type of this iterator is the state type of the stepper. - * - * Implements an ODE iterator with adaptive step size control. Uses dense-output steppers. adaptive_iterator is a model - * of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - */ - template< class Iterator , class Stepper , class System , class State , typename Tag > - class adaptive_iterator_impl< Iterator , Stepper , System , State , Tag , dense_output_stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - - public: - - - /** - * \brief Constructs an adaptive_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. - * \param t The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - */ - adaptive_iterator_impl( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt ) - : base_type( stepper , sys , t , dt ) , m_t_end( t_end ) - { - if( detail::less_eq_with_sign( this->m_t , this->m_t_end , this->m_dt ) ) - { - unwrapped_stepper_type &st = this->m_stepper; - st.initialize( s , this->m_t , this->m_dt ); - } else { - this->m_at_end = true; - } - } - - /** - * \brief Constructs an adaptive_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. - */ - adaptive_iterator_impl( stepper_type stepper , system_type sys , state_type& /* s */ ) - : base_type( stepper , sys ) { } - - protected: - - friend class boost::iterator_core_access; - - void increment() - { - unwrapped_stepper_type &stepper = this->m_stepper; - if( detail::less_with_sign( this->m_t , - this->m_t_end , - stepper.current_time_step() ) ) - { - if( detail::less_with_sign( this->m_t_end , - static_cast<time_type>(this->m_t + stepper.current_time_step()) , - stepper.current_time_step() ) ) - { - // make stpper to end exactly at t_end - stepper.initialize( stepper.current_state() , stepper.current_time() , - static_cast<time_type>(this->m_t_end-this->m_t) ); - } - stepper.do_step( this->m_system ); - this->m_t = stepper.current_time(); - } else { // we have reached t_end - this->m_at_end = true; - } - } - - public: - const state_type& get_state() const - { - const unwrapped_stepper_type &stepper = this->m_stepper; - return stepper.current_state(); - } - - private: - time_type m_t_end; - }; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ADAPTIVE_ITERATOR_IMPL_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp deleted file mode 100644 index 54b0727485d378e96c014db01163283de741eb60..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/iterator/detail/const_step_iterator_impl.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_CONST_STEP_ITERATOR_IMPL_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_CONST_STEP_ITERATOR_IMPL_HPP_DEFINED - -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> - - - -namespace boost { -namespace numeric { -namespace odeint { - - - template< class Iterator , class Stepper , class System , class State , typename Tag , class StepperTag > - class const_step_iterator_impl; - - - /* - * Specilization for steppers and error steppers - */ - template< class Iterator , class Stepper , class System , class State , typename Tag > - class const_step_iterator_impl< Iterator , Stepper , System , State , Tag , stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - public: - - /** - * \brief Constructs a const_step_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - */ - const_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt ) - : base_type( stepper , sys , t , dt ) , m_t_start( t ) , m_t_end( t_end ) , m_state( &s ) , m_step( 0 ) - { - if( detail::less_with_sign( this->m_t_end , this->m_t , this->m_dt ) ) - this->m_at_end = true; - } - - /** - * \brief Constructs a const_step_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - */ - const_step_iterator_impl( stepper_type stepper , system_type sys , state_type& /* s */ ) - : base_type( stepper , sys ) { } - - protected: - - friend class boost::iterator_core_access; - - void increment() - { - if( detail::less_eq_with_sign( static_cast<time_type>(this->m_t+this->m_dt) , - this->m_t_end , this->m_dt ) ) - { - unwrapped_stepper_type &stepper = this->m_stepper; - stepper.do_step( this->m_system , *this->m_state , this->m_t , this->m_dt ); - // use integer to compute current time to reduce roundoff errors - this->m_step++; - this->m_t = this->m_t_start + static_cast< typename unit_value_type<time_type>::type >(this->m_step)*this->m_dt; - } else { - this->m_at_end = true; - } - } - - public: - const state_type& get_state() const - { - return *m_state; - } - - private: - time_type m_t_start; - time_type m_t_end; - state_type* m_state; - size_t m_step; - - }; - - - - /* - * Specilization for dense output stepper - */ - /** - * \brief ODE Iterator with constant step size. The value type of this iterator is the state type of the stepper. - * - * Implements an ODE iterator solving the ODE with constant steps. Uses dense-output steppers. - * const_step_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - */ - template< class Iterator , class Stepper , class System , class State , typename Tag > - class const_step_iterator_impl< Iterator , Stepper , System , State , Tag , dense_output_stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - public: - - /** - * \brief Constructs a const_step_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param t_end The end time, at which the iteration should stop. - * \param dt The initial time step. - */ - const_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt ) - : base_type( stepper , sys , t , dt ) , m_t_start( t ) , m_t_end( t_end ) , m_state( &s ) , m_step( 0 ) - { - if( detail::less_eq_with_sign( this->m_t , this->m_t_end , this->m_dt ) ) - { - unwrapped_stepper_type &st = this->m_stepper; - st.initialize( * ( this->m_state ) , this->m_t , this->m_dt ); - } else { - this->m_at_end = true; - } - } - - /** - * \brief Constructs a const_step_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - */ - const_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s ) - : base_type( stepper , sys ) , m_state( &s ) - { - } - - - - protected: - - friend class boost::iterator_core_access; - - void increment( void ) - { - if( detail::less_eq_with_sign( static_cast<time_type>(this->m_t+this->m_dt) , - this->m_t_end , this->m_dt ) ) - { - unwrapped_stepper_type &stepper = this->m_stepper; - // use integer to compute current time to reduce roundoff errors - this->m_step++; - this->m_t = this->m_t_start + static_cast< typename unit_value_type<time_type>::type >(this->m_step)*this->m_dt; - while( detail::less_with_sign( stepper.current_time() , this->m_t , - stepper.current_time_step() ) ) - { - stepper.do_step( this->m_system ); - } - stepper.calc_state( this->m_t , *( this->m_state ) ); - } else { - this->m_at_end = true; - } - } - - public: - const state_type& get_state() const - { - return *m_state; - } - - private: - time_type m_t_start; - time_type m_t_end; - state_type* m_state; - size_t m_step; - }; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_CONST_STEP_ITERATOR_IMPL_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp deleted file mode 100644 index 6e5b85994e1b3ba090d9895ea8a2b4f0b16b1930..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp +++ /dev/null @@ -1,239 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/iterator/detail/n_step_iterator_impl.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_N_STEP_ITERATOR_IMPL_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_N_STEP_ITERATOR_IMPL_HPP_DEFINED - -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> - - - -namespace boost { -namespace numeric { -namespace odeint { - - - template< class Iterator , class Stepper , class System , class State , typename Tag , class StepperTag > - class n_step_iterator_impl; - - - /* - * Specilization for steppers and error steppers - */ - /** - * \brief ODE Iterator performing exactly n steps with constant step size. The value type of this iterator is the state type of the stepper. - * - * Implements an ODE iterator solving the ODE with constant step size. Uses steppers fulfilling the Stepper concept. - * n_step_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - */ - template< class Iterator , class Stepper , class System , class State , typename Tag > - class n_step_iterator_impl< Iterator , Stepper , System , State , Tag , stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - public: - - /** - * \brief Constructs a n_step_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param dt The initial time step. - * \param num_of_steps the number of steps to be executed. - */ - n_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s , - time_type t , time_type dt , size_t num_of_steps ) - : base_type( stepper , sys , t , dt ) , m_t_start( t ) , m_state( &s ) , - m_steps(num_of_steps) , m_step( 0 ) - { } - - /** - * \brief Constructs a const_step_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - */ - n_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s ) - : base_type( stepper , sys ) , m_state( &s ) { } - - protected: - - friend class boost::iterator_core_access; - - void increment() - { - if( this->m_step < this->m_steps ) - { - unwrapped_stepper_type &stepper = this->m_stepper; - stepper.do_step( this->m_system , *this->m_state , this->m_t , this->m_dt ); - // use integer to compute current time to reduce roundoff errors - this->m_step++; - this->m_t = this->m_t_start + static_cast< typename unit_value_type<time_type>::type >(this->m_step)*this->m_dt; - } else { - this->m_at_end = true; - - } - } - - public: - const state_type& get_state() const - { - return *m_state; - } - - - private: - time_type m_t_start; - time_type m_t_end; - state_type* m_state; - size_t m_steps; - size_t m_step; - - }; - - - - - /* - * Specilization for dense output stepper - */ - /** - * \brief ODE Iterator with step-size control and dense output. - * - * Implements an ODE iterator solving the ODE with constant steps. Uses dense-output steppers. - * n_step_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - */ - template< class Iterator , class Stepper , class System , class State , typename Tag > - class n_step_iterator_impl< Iterator , Stepper , System , State , Tag , dense_output_stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - public: - - /** - * \brief Constructs a const_step_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param dt The initial time step. - * \param num_of_steps the number of steps to be executed. - */ - n_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s , - time_type t , time_type dt , size_t num_of_steps ) - : base_type( stepper , sys , t , dt ) , m_t_start( t ) , m_state( &s ) , - m_steps( num_of_steps ) , m_step( 0 ) - { - unwrapped_stepper_type &st = this->m_stepper; - st.initialize( * ( this->m_state ) , this->m_t , this->m_dt ); - } - - /** - * \brief Constructs a const_step_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - */ - n_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s ) - : base_type( stepper , sys ) , m_state( &s ) - { - } - - - - protected: - - friend class boost::iterator_core_access; - - void increment( void ) - { - if( this->m_step < this->m_steps ) - { - unwrapped_stepper_type &stepper = this->m_stepper; - // use integer to compute current time to reduce roundoff errors - this->m_step++; - this->m_t = this->m_t_start + static_cast< typename unit_value_type<time_type>::type >(this->m_step)*this->m_dt; - while( detail::less_with_sign( stepper.current_time() , this->m_t , - stepper.current_time_step() ) ) - { - stepper.do_step( this->m_system ); - } - stepper.calc_state( this->m_t , *( this->m_state ) ); - } else { - this->m_at_end = true; - } - } - - public: - const state_type& get_state() const - { - return *m_state; - } - - - private: - time_type m_t_start; - time_type m_t_end; - state_type* m_state; - size_t m_steps; - size_t m_step; - }; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_N_STEP_ITERATOR_IMPL_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp deleted file mode 100644 index 7a2b48d829dd286501301c222380452b33801493..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp +++ /dev/null @@ -1,371 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/iterator/detail/times_iterator_impl.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_TIMES_ITERATOR_IMPL_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_TIMES_ITERATOR_IMPL_HPP_DEFINED - -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/throw_exception.hpp> - -#include <boost/numeric/odeint/util/unit_helper.hpp> -#include <boost/numeric/odeint/util/copy.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - - template< class Iterator , class Stepper , class System , class State , class TimeIterator , - typename Tag , typename StepperTag > - class times_iterator_impl; - - /* - * Specilization for basic steppers - */ - /** - * \brief ODE Iterator with constant step size. - * - * Implements an ODE iterator with observer calls at predefined times. - * Uses controlled steppers. times_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - */ - template< class Iterator , class Stepper , class System , class State , class TimeIterator , typename Tag > - class times_iterator_impl< Iterator , Stepper , System , State , TimeIterator , Tag , stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef TimeIterator time_iterator_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - public: - - /** - * \brief Constructs a times_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. adaptive_iterator stores a reference of s and changes its value during the iteration. - * \param t_start Iterator to the begin of a sequence of time values. - * \param t_end Iterator to the begin of a sequence of time values. - * \param dt The (initial) time step. - */ - times_iterator_impl( stepper_type stepper , system_type sys , state_type &s , - time_iterator_type t_start , time_iterator_type t_end , time_type dt ) - : base_type( stepper , sys , *t_start , dt ) , - m_t_start( t_start ) , m_t_end( t_end ) , m_state( &s ) - { - if( t_start == t_end ) - this->m_at_end = true; - } - - /** - * \brief Constructs an adaptive_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. adaptive_iterator store a reference of s and changes its value during the iteration. - */ - times_iterator_impl( stepper_type stepper , system_type sys , state_type &s ) - : base_type( stepper , sys ) , m_state( &s ) { } - - protected: - - friend class boost::iterator_core_access; - - void increment() - { - unwrapped_stepper_type &stepper = this->m_stepper; - if( ++m_t_start != m_t_end ) - { - while( detail::less_with_sign( this->m_t , static_cast<time_type>(*m_t_start) , this->m_dt ) ) - { - const time_type current_dt = detail::min_abs( this->m_dt , static_cast<time_type>(*m_t_start) - this->m_t ); - stepper.do_step( this->m_system , *( this->m_state ) , this->m_t , current_dt ); - this->m_t += current_dt; - } - - } else { - this->m_at_end = true; - } - } - - public: - const state_type& get_state() const - { - return *m_state; - } - - private: - time_iterator_type m_t_start; - time_iterator_type m_t_end; - state_type* m_state; - }; - - - - /* - * Specilization for controlled steppers - */ - /** - * \brief ODE Iterator with adaptive step size control. The value type of this iterator is the state type of the stepper. - * - * Implements an ODE iterator with observer calls at predefined times. - * Uses controlled steppers. times_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - */ - template< class Iterator , class Stepper , class System , class State , class TimeIterator , typename Tag > - class times_iterator_impl< Iterator , Stepper , System , State , TimeIterator , Tag , controlled_stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef TimeIterator time_iterator_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - public: - - /** - * \brief Constructs a times_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. adaptive_iterator stores a reference of s and changes its value during the iteration. - * \param t_start Iterator to the begin of a sequence of time values. - * \param t_end Iterator to the begin of a sequence of time values. - * \param dt The (initial) time step. - */ - times_iterator_impl( stepper_type stepper , system_type sys , state_type &s , - time_iterator_type t_start , time_iterator_type t_end , time_type dt ) - : base_type( stepper , sys , *t_start , dt ) , - m_t_start( t_start ) , m_t_end( t_end ) , m_state( &s ) - { - if( t_start == t_end ) - this->m_at_end = true; - } - - /** - * \brief Constructs an adaptive_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. adaptive_iterator store a reference of s and changes its value during the iteration. - */ - times_iterator_impl( stepper_type stepper , system_type sys , state_type &s ) - : base_type( stepper , sys ) , m_state( &s ) { } - - protected: - - friend class boost::iterator_core_access; - - void increment() - { - if( ++m_t_start != m_t_end ) - { - while( detail::less_with_sign( this->m_t , static_cast<time_type>(*m_t_start) , this->m_dt ) ) - { - if( detail::less_with_sign( static_cast<time_type>(*m_t_start) - this->m_t , this->m_dt , this->m_dt ) ) - { - // we want to end exactly at the time point - time_type current_dt = static_cast<time_type>(*m_t_start) - this->m_t; - step_loop( current_dt ); - } else { - step_loop( this->m_dt ); - } - } - - } else { - this->m_at_end = true; - } - } - - private: - void step_loop( time_type &dt ) - { - unwrapped_stepper_type &stepper = this->m_stepper; - const size_t max_attempts = 1000; - size_t trials = 0; - controlled_step_result res = success; - do - { - res = stepper.try_step( this->m_system , *( this->m_state ) , this->m_t , dt ); - ++trials; - } - while( ( res == fail ) && ( trials < max_attempts ) ); - if( trials == max_attempts ) - { - BOOST_THROW_EXCEPTION( std::overflow_error( "Adaptive iterator : Maximal number of iterations reached. A step size could not be found." ) ); - } - } - - public: - const state_type& get_state() const - { - return *m_state; - } - - - private: - time_iterator_type m_t_start; - time_iterator_type m_t_end; - state_type* m_state; - }; - - - /* - * Specilization for dense outputer steppers - */ - /** - * \brief ODE Iterator with step size control and dense output. - * Implements an ODE iterator with adaptive step size control. Uses dense-output steppers. - * times_iterator is a model of single-pass iterator. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - */ - template< class Iterator , class Stepper , class System , class State , class TimeIterator , typename Tag > - class times_iterator_impl< Iterator , Stepper , System , State , TimeIterator , Tag , dense_output_stepper_tag > - : public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > - { - private: - - - typedef Stepper stepper_type; - typedef System system_type; - typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type; - typedef State state_type; - typedef TimeIterator time_iterator_type; - typedef typename traits::time_type< stepper_type >::type time_type; - typedef typename traits::value_type< stepper_type >::type ode_value_type; - #ifndef DOXYGEN_SKIP - typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type; - #endif - - - public: - - - /** - * \brief Constructs a times_iterator. This constructor should be used to construct the begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. - * \param t_start Iterator to the begin of a sequence of time values. - * \param t_end Iterator to the begin of a sequence of time values. - * \param dt The (initial) time step. - */ - times_iterator_impl( stepper_type stepper , system_type sys , state_type &s , - time_iterator_type t_start , time_iterator_type t_end , time_type dt ) - : base_type( stepper , sys , *t_start , dt ) , - m_t_start( t_start ) , m_t_end( t_end ) , m_final_time( *(t_end-1) ) , - m_state( &s ) - { - if( t_start != t_end ) - { - unwrapped_stepper_type &st = this->m_stepper; - st.initialize( *( this->m_state ) , this->m_t , this->m_dt ); - } else { - this->m_at_end = true; - } - } - - /** - * \brief Constructs a times_iterator. This constructor should be used to construct the end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param sys The system function (ODE) to solve. - * \param s The initial state. - */ - times_iterator_impl( stepper_type stepper , system_type sys , state_type &s ) - : base_type( stepper , sys ) , m_state( &s ) { } - - protected: - - friend class boost::iterator_core_access; - - void increment() - { - unwrapped_stepper_type &st = this->m_stepper; - if( ++m_t_start != m_t_end ) - { - this->m_t = static_cast<time_type>(*m_t_start); - while( detail::less_with_sign( st.current_time() , this->m_t , this->m_dt ) ) - { - // make sure we don't go beyond the last point - if( detail::less_with_sign( m_final_time-st.current_time() , st.current_time_step() , st.current_time_step() ) ) - { - st.initialize( st.current_state() , st.current_time() , m_final_time-st.current_time() ); - } - st.do_step( this->m_system ); - } - st.calc_state( this->m_t , *( this->m_state ) ); - } else { - this->m_at_end = true; - } - } - - public: - const state_type& get_state() const - { - return *m_state; - } - - - private: - time_iterator_type m_t_start; - time_iterator_type m_t_end; - time_type m_final_time; - state_type* m_state; - }; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_TIMES_ITERATOR_IMPL_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/functors.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/functors.hpp deleted file mode 100644 index b239217ac4cbc9713ae0b7a93998ebcb4e6bd633..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/functors.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/functors.hpp - - [begin_description] - some functors for the iterator based integrate routines - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED - -#include <utility> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - - -template< class Observer > -struct obs_caller { - - size_t &m_n; - Observer m_obs; - - obs_caller( size_t &m , Observer &obs ) : m_n(m) , m_obs( obs ) {} - - template< class State , class Time > - void operator()( std::pair< const State & , const Time & > x ) - { - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - observer_type &obs = m_obs; - obs( x.first , x.second ); - m_n++; - } -}; - -template< class Observer , class Time > -struct obs_caller_time { - - Time &m_t; - Observer m_obs; - - obs_caller_time( Time &t , Observer &obs ) : m_t(t) , m_obs( obs ) {} - - template< class State > - void operator()( std::pair< const State & , const Time & > x ) - { - typedef typename odeint::unwrap_reference< Observer >::type observer_type; - observer_type &obs = m_obs; - obs( x.first , x.second ); - m_t = x.second; - } -}; - -} // namespace detail -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp deleted file mode 100644 index ccbbf497f3ae14162c27ea8a0b3ed28857866de5..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp - - [begin_description] - Default Integrate adaptive implementation. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED - -#include <stdexcept> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp> -#include <boost/numeric/odeint/iterator/adaptive_time_iterator.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/functors.hpp> -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/util/copy.hpp> - -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -// forward declaration -template< class Stepper , class System , class State , class Time , class Observer> -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , stepper_tag ); - -/* - * integrate_adaptive for simple stepper is basically an integrate_const + some last step - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , stepper_tag -) -{ - size_t steps = detail::integrate_const( stepper , system , start_state , start_time , - end_time , dt , observer , stepper_tag() ); - typename odeint::unwrap_reference< Observer >::type &obs = observer; - typename odeint::unwrap_reference< Stepper >::type &st = stepper; - - Time end = start_time + dt*steps; - if( less_with_sign( end , end_time , dt ) ) - { //make a last step to end exactly at end_time - st.do_step( system , start_state , end , end_time - end ); - steps++; - obs( start_state , end_time ); - } - return steps; -} - - -/* - * classical integrate adaptive - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time &start_time , Time end_time , Time &dt , - Observer observer , controlled_stepper_tag -) -{ - size_t obs_calls = 0; - - boost::for_each( make_adaptive_time_range( stepper , system , start_state , - start_time , end_time , dt ) , - obs_caller< Observer >( obs_calls , observer ) ); - - return obs_calls-1; -} - - -/* - * integrate adaptive for dense output steppers - * - * step size control is used if the stepper supports it - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , dense_output_stepper_tag ) -{ - size_t obs_calls = 0; - - boost::for_each( make_adaptive_time_range( stepper , system , start_state , - start_time , end_time , dt ) , - obs_caller< Observer >( obs_calls , observer ) ); - - return obs_calls-1; -} - - - - -} // namespace detail -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp deleted file mode 100644 index bdafff2e852b2708f22e9bfacee1feccc213d5c1..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/integrate_const.hpp - - [begin_description] - integrate const implementation - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_CONST_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_CONST_HPP_INCLUDED - -#include <boost/range/algorithm/for_each.hpp> - -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> -#include <boost/numeric/odeint/iterator/const_step_time_iterator.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/functors.hpp> -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -// forward declaration -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time &start_time , Time end_time , Time &dt , - Observer observer , controlled_stepper_tag -); - - -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , stepper_tag -) -{ - size_t obs_calls = 0; - - boost::for_each( make_const_step_time_range( stepper , system , start_state , - start_time , end_time , dt ) , - // should we use traits<Stepper>::state_type here instead of State? NO! - obs_caller< Observer >( obs_calls , observer ) ); - - // step integration steps gives step+1 observer calls - return obs_calls-1; -} - - - -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , controlled_stepper_tag -) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - - Time time = start_time; - const Time time_step = dt; - int step = 0; - - while( less_eq_with_sign( static_cast<Time>(time+time_step) , end_time , dt ) ) - { - obs( start_state , time ); - detail::integrate_adaptive( stepper , system , start_state , time , time+time_step , dt , - null_observer() , controlled_stepper_tag() ); - // direct computation of the time avoids error propagation happening when using time += dt - // we need clumsy type analysis to get boost units working here - ++step; - time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * time_step; - } - obs( start_state , time ); - - return step; -} - - -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer , dense_output_stepper_tag -) -{ - size_t obs_calls = 0; - - boost::for_each( make_const_step_time_range( stepper , system , start_state , - start_time , end_time , dt ) , - obs_caller< Observer >( obs_calls , observer ) ); - return obs_calls-1; -} - - -} } } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp deleted file mode 100644 index f90f8875cefbaf1a712126ae15a4b42d47651398..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp - - [begin_description] - integrate steps implementation - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED - -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/functors.hpp> -#include <boost/numeric/odeint/iterator/n_step_time_iterator.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> - -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -// forward declaration -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time &start_time , Time end_time , Time &dt , - Observer observer , controlled_stepper_tag -); - - -/* basic version */ -template< class Stepper , class System , class State , class Time , class Observer> -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer , stepper_tag ) -{ - // ToDo: is there a better way to extract the final time? - Time t = start_time; // Assignment is only here to avoid warnings. - boost::for_each( make_n_step_time_range( stepper , system , start_state , - start_time , dt , num_of_steps ) , - obs_caller_time< Observer , Time >( t , observer ) ); - return t; -} - - -/* controlled version */ -template< class Stepper , class System , class State , class Time , class Observer> -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer , controlled_stepper_tag ) -{ - typename odeint::unwrap_reference< Observer >::type &obs = observer; - - Time time = start_time; - Time time_step = dt; - - for( size_t step = 0; step < num_of_steps ; ++step ) - { - obs( start_state , time ); - detail::integrate_adaptive( stepper , system , start_state , time , static_cast<Time>(time+time_step) , dt , - null_observer() , controlled_stepper_tag() ); - // direct computation of the time avoids error propagation happening when using time += dt - // we need clumsy type analysis to get boost units working here - time = start_time + static_cast< typename unit_value_type<Time>::type >(step+1) * time_step; - } - obs( start_state , time ); - - return time; -} - - -/* dense output version */ -template< class Stepper , class System , class State , class Time , class Observer> -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer , dense_output_stepper_tag ) -{ - // ToDo: is there a better way to extract the final time? - Time t = start_time; // Assignment is only here to avoid warnings. - boost::for_each( make_n_step_time_range( stepper , system , start_state , - start_time , dt , num_of_steps ) , - obs_caller_time< Observer , Time >( t , observer ) ); - return t; -} - - -} -} -} -} - -#endif /* BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED */ diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_times.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_times.hpp deleted file mode 100644 index bccc7c6b039dd8764c136f6822bbd28dc9bd7723..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/detail/integrate_times.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/detail/integrate_times.hpp - - [begin_description] - Default integrate times implementation. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED - -#include <stdexcept> - -#include <boost/config.hpp> -#include <boost/range/algorithm/for_each.hpp> - -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> -#include <boost/numeric/odeint/iterator/times_time_iterator.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/functors.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - - - -/* - * integrate_times for all steppers - */ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer , class StepperTag > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - TimeIterator start_time , TimeIterator end_time , Time dt , - Observer observer , StepperTag -) -{ - size_t obs_calls = 0; - - boost::for_each( make_times_time_range( stepper , system , start_state , - start_time , end_time , dt ) , - // should we use traits<Stepper>::state_type here instead of State? NO! - obs_caller< Observer >( obs_calls , observer ) ); - - // step integration steps gives step+1 observer calls - return obs_calls-1; -} - - -} // namespace detail -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate.hpp deleted file mode 100644 index 5300da2ba159f04d6da84495f5955081825befad..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate.hpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate.hpp - - [begin_description] - Convenience methods which choose the stepper for the current ODE. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED - -#include <boost/utility/enable_if.hpp> - -#include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp> -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/iterator/integrate/null_observer.hpp> -#include <boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp> - -// for has_value_type trait -#include <boost/numeric/odeint/algebra/detail/extract_value_type.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * ToDo : - * - * determine type of dxdt for units - * - */ -template< class System , class State , class Time , class Observer > -typename boost::enable_if< typename has_value_type<State>::type , size_t >::type -integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) -{ - typedef controlled_runge_kutta< runge_kutta_dopri5< State , typename State::value_type , State , Time > > stepper_type; - return integrate_adaptive( stepper_type() , system , start_state , start_time , end_time , dt , observer ); -} - - - -/* - * the two overloads are needed in order to solve the forwarding problem - */ -template< class System , class State , class Time > -size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt ) -{ - return integrate( system , start_state , start_time , end_time , dt , null_observer() ); -} - - -/** - * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) - * \brief Integrates the ODE. - * - * Integrates the ODE given by system from start_time to end_time starting - * with start_state as initial condition and dt as initial time step. - * This function uses a dense output dopri5 stepper and performs an adaptive - * integration with step size control, thus dt changes during the integration. - * This method uses standard error bounds of 1E-6. - * After each step, the observer is called. - * - * \param system The system function to solve, hence the r.h.s. of the - * ordinary differential equation. - * \param start_state The initial state. - * \param start_time Start time of the integration. - * \param end_time End time of the integration. - * \param dt Initial step size, will be adjusted during the integration. - * \param observer Observer that will be called after each time step. - * \return The number of steps performed. - */ - - -/** - * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt ) - * \brief Integrates the ODE without observer calls. - * - * Integrates the ODE given by system from start_time to end_time starting - * with start_state as initial condition and dt as initial time step. - * This function uses a dense output dopri5 stepper and performs an adaptive - * integration with step size control, thus dt changes during the integration. - * This method uses standard error bounds of 1E-6. - * No observer is called. - * - * \param system The system function to solve, hence the r.h.s. of the - * ordinary differential equation. - * \param start_state The initial state. - * \param start_time Start time of the integration. - * \param end_time End time of the integration. - * \param dt Initial step size, will be adjusted during the integration. - * \return The number of steps performed. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp deleted file mode 100644 index a8d034d4112d66ed8c196c66fd99d1f72aaab4e9..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate_adaptive.hpp - - [begin_description] - Adaptive integration of ODEs. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED - -#include <boost/type_traits/is_same.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/integrate/null_observer.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * the two overloads are needed in order to solve the forwarding problem - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_adaptive( - stepper , system , start_state , - start_time , end_time , dt , - observer , stepper_category() ); - - /* - * Suggestion for a new extendable version: - * - * integrator_adaptive< Stepper , System, State , Time , Observer , typename Stepper::stepper_category > integrator; - * return integrator.run( stepper , system , start_state , start_time , end_time , dt , observer ); - */ -} - -/** - * \brief Second version to solve the forwarding problem, - * can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_adaptive( - Stepper stepper , System system , const State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_adaptive( - stepper , system , start_state , - start_time , end_time , dt , - observer , stepper_category() ); -} - - - - -/** - * \brief integrate_adaptive without an observer. - */ -template< class Stepper , class System , class State , class Time > -size_t integrate_adaptive( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt ) -{ - return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , null_observer() ); -} - -/** - * \brief Second version to solve the forwarding problem, - * can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time > -size_t integrate_adaptive( - Stepper stepper , System system , const State &start_state , - Time start_time , Time end_time , Time dt ) -{ - return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , null_observer() ); -} - - -/************* DOXYGEN ************/ - - /** - * \fn integrate_adaptive( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) - * \brief Integrates the ODE with adaptive step size. - * - * This function integrates the ODE given by system with the given stepper. - * The observer is called after each step. If the stepper has no error - * control, the step size remains constant and the observer is called at - * equidistant time points t0+n*dt. If the stepper is a ControlledStepper, - * the step size is adjusted and the observer is called in non-equidistant - * intervals. - * - * \param stepper The stepper to be used for numerical integration. - * \param system Function/Functor defining the rhs of the ODE. - * \param start_state The initial condition x0. - * \param start_time The initial time t0. - * \param end_time The final integration time tend. - * \param dt The time step between observer calls, _not_ necessarily the - * time step of the integration. - * \param observer Function/Functor called at equidistant time intervals. - * \return The number of steps performed. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_const.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_const.hpp deleted file mode 100644 index b00024f807aa5ab3b36cbb94ff9a95a7ef105577..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_const.hpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate_const.hpp - - [begin_description] - Constant integration of ODEs, meaning that the state of the ODE is observed on constant time intervals. - The routines makes full use of adaptive and dense-output methods. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED - -#include <boost/type_traits/is_same.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/integrate/null_observer.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - - - - -/* - * Integrates with constant time step dt. - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer -) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - // we want to get as fast as possible to the end - if( boost::is_same< null_observer , Observer >::value ) - { - return detail::integrate_adaptive( - stepper , system , start_state , - start_time , end_time , dt , - observer , stepper_category() ); - } - else - { - return detail::integrate_const( stepper , system , start_state , - start_time , end_time , dt , - observer , stepper_category() ); - } -} - -/** - * \brief Second version to solve the forwarding problem, - * can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time , class Observer > -size_t integrate_const( - Stepper stepper , System system , const State &start_state , - Time start_time , Time end_time , Time dt , - Observer observer -) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - // we want to get as fast as possible to the end - if( boost::is_same< null_observer , Observer >::value ) - { - return detail::integrate_adaptive( - stepper , system , start_state , - start_time , end_time , dt , - observer , stepper_category() ); - } - else - { - return detail::integrate_const( stepper , system , start_state , - start_time , end_time , dt , - observer , stepper_category() ); - } -} - - - - - -/** - * \brief integrate_const without observer calls - */ -template< class Stepper , class System , class State , class Time > -size_t integrate_const( - Stepper stepper , System system , State &start_state , - Time start_time , Time end_time , Time dt -) -{ - return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() ); -} - -/** - * \brief Second version to solve the forwarding problem, - * can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time > -size_t integrate_const( - Stepper stepper , System system , const State &start_state , - Time start_time , Time end_time , Time dt -) -{ - return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() ); -} - - - - - - -/********* DOXYGEN *********/ - /** - * \fn integrate_const( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) - * \brief Integrates the ODE with constant step size. - * - * Integrates the ODE defined by system using the given stepper. - * This method ensures that the observer is called at constant intervals dt. - * If the Stepper is a normal stepper without step size control, dt is also - * used for the numerical scheme. If a ControlledStepper is provided, the - * algorithm might reduce the step size to meet the error bounds, but it is - * ensured that the observer is always called at equidistant time points - * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary - * and the dense output is used to call the observer at equidistant time - * points. - * - * \param stepper The stepper to be used for numerical integration. - * \param system Function/Functor defining the rhs of the ODE. - * \param start_state The initial condition x0. - * \param start_time The initial time t0. - * \param end_time The final integration time tend. - * \param dt The time step between observer calls, _not_ necessarily the - * time step of the integration. - * \param observer Function/Functor called at equidistant time intervals. - * \return The number of steps performed. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_n_steps.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_n_steps.hpp deleted file mode 100644 index d75cb306a372d15fd248c571560afccc26de516c..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_n_steps.hpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate_n_steps.hpp - - [begin_description] - Integration of n steps with constant time size. Adaptive and dense-output methods are fully supported. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED - -#include <boost/type_traits/is_same.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/integrate/null_observer.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * Integrates n steps - * - * the two overloads are needed in order to solve the forwarding problem - */ -template< class Stepper , class System , class State , class Time , class Observer> -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_n_steps( - stepper , system , start_state , - start_time , dt , num_of_steps , - observer , stepper_category() ); -} - -/** - * \brief Solves the forwarding problem, can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time , class Observer > -Time integrate_n_steps( - Stepper stepper , System system , const State &start_state , - Time start_time , Time dt , size_t num_of_steps , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_n_steps( - stepper , system , start_state , - start_time , dt , num_of_steps , - observer , stepper_category() ); -} - - -/** - * \brief The same function as above, but without observer calls. - */ -template< class Stepper , class System , class State , class Time > -Time integrate_n_steps( - Stepper stepper , System system , State &start_state , - Time start_time , Time dt , size_t num_of_steps ) -{ - return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , null_observer() ); -} - -/** - * \brief Solves the forwarding problem, can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class Time > -Time integrate_n_steps( - Stepper stepper , System system , const State &start_state , - Time start_time , Time dt , size_t num_of_steps ) -{ - return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , null_observer() ); -} - - - -/************* DOXYGEN *************/ - /** - * \fn Time integrate_n_steps( Stepper stepper , System system , State &start_state , Time start_time , Time dt , size_t num_of_steps , Observer observer ) - * \brief Integrates the ODE with constant step size. - * - * This function is similar to integrate_const. The observer is called at - * equidistant time intervals t0 + n*dt. - * If the Stepper is a normal stepper without step size control, dt is also - * used for the numerical scheme. If a ControlledStepper is provided, the - * algorithm might reduce the step size to meet the error bounds, but it is - * ensured that the observer is always called at equidistant time points - * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary - * and the dense output is used to call the observer at equidistant time - * points. The final integration time is always t0 + num_of_steps*dt. - * - * \param stepper The stepper to be used for numerical integration. - * \param system Function/Functor defining the rhs of the ODE. - * \param start_state The initial condition x0. - * \param start_time The initial time t0. - * \param dt The time step between observer calls, _not_ necessarily the - * time step of the integration. - * \param num_of_steps Number of steps to be performed - * \param observer Function/Functor called at equidistant time intervals. - * \return The number of steps performed. - */ - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_times.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_times.hpp deleted file mode 100644 index 55101ec9d00b254fbc933d0fba7ac65122188c3b..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/integrate_times.hpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/integrate_times.hpp - - [begin_description] - Integration of ODEs with observation at user defined points - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED - -#include <boost/type_traits/is_same.hpp> - -#include <boost/range.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/integrate/null_observer.hpp> -#include <boost/numeric/odeint/iterator/integrate/detail/integrate_times.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * the two overloads are needed in order to solve the forwarding problem - */ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - TimeIterator times_start , TimeIterator times_end , Time dt , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_times( - stepper , system , start_state , - times_start , times_end , dt , - observer , stepper_category() ); -} - -/** - * \brief Solves the forwarding problem, can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , const State &start_state , - TimeIterator times_start , TimeIterator times_end , Time dt , - Observer observer ) -{ - typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; - return detail::integrate_times( - stepper , system , start_state , - times_start , times_end , dt , - observer , stepper_category() ); -} - -/** - * \brief The same function as above, but without observer calls. - */ -template< class Stepper , class System , class State , class TimeRange , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , State &start_state , - const TimeRange × , Time dt , - Observer observer ) -{ - return integrate_times( - stepper , system , start_state , - boost::begin( times ) , boost::end( times ) , dt , observer ); -} - -/** - * \brief Solves the forwarding problem, can be called with Boost.Range as start_state. - */ -template< class Stepper , class System , class State , class TimeRange , class Time , class Observer > -size_t integrate_times( - Stepper stepper , System system , const State &start_state , - const TimeRange × , Time dt , - Observer observer ) -{ - return integrate_times( - stepper , system , start_state , - boost::begin( times ) , boost::end( times ) , dt , observer ); -} - - - - -/********* DOXYGEN ***********/ - - /** - * \fn size_t integrate_times( Stepper stepper , System system , State &start_state , TimeIterator times_start , TimeIterator times_end , Time dt , Observer observer ) - * \brief Integrates the ODE with observer calls at given time points. - * - * Integrates the ODE given by system using the given stepper. This function - * does observer calls at the subsequent time points given by the range - * times_start, times_end. If the stepper has not step size control, the - * step size might be reduced occasionally to ensure observer calls exactly - * at the time points from the given sequence. If the stepper is a - * ControlledStepper, the step size is adjusted to meet the error bounds, - * but also might be reduced occasionally to ensure correct observer calls. - * If a DenseOutputStepper is provided, the dense output functionality is - * used to call the observer at the given times. The end time of the - * integration is always *(end_time-1). - * - * \param stepper The stepper to be used for numerical integration. - * \param system Function/Functor defining the rhs of the ODE. - * \param start_state The initial condition x0. - * \param times_start Iterator to the start time - * \param times_end Iterator to the end time - * \param dt The time step between observer calls, _not_ necessarily the - * time step of the integration. - * \param observer Function/Functor called at equidistant time intervals. - * \return The number of steps performed. - */ - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/null_observer.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/null_observer.hpp deleted file mode 100644 index 4d9a070a62d0102f2dcdfe44e224522651417327..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/null_observer.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/null_observer.hpp - - [begin_description] - null_observer - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED - -namespace boost { -namespace numeric { -namespace odeint { - -struct null_observer -{ - template< class State , class Time > - void operator()( const State& /* x */ , Time /* t */ ) const - { - - } -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/observer_collection.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/observer_collection.hpp deleted file mode 100644 index 26101a3afc16fa4061a18f1fe646ba143a2effea..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/integrate/observer_collection.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/integrate/observer_collection.hpp - - [begin_description] - Collection of observers, which are all called during the evolution of the ODE. - [end_description] - - Copyright 2009-2011 Karsten Ahnert - Copyright 2009-2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED - -#include <vector> - -#include <boost/function.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< class State , class Time > -class observer_collection -{ -public: - - typedef boost::function< void( const State& , const Time& ) > observer_type; - typedef std::vector< observer_type > collection_type; - - void operator()( const State& x , Time t ) - { - for( size_t i=0 ; i<m_observers.size() ; ++i ) - m_observers[i]( x , t ); - } - - collection_type& observers( void ) { return m_observers; } - const collection_type& observers( void ) const { return m_observers; } - -private: - - collection_type m_observers; -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/n_step_iterator.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/n_step_iterator.hpp deleted file mode 100644 index c9733107b5e38a4e2d9d2844d3d99970e480bd54..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/n_step_iterator.hpp +++ /dev/null @@ -1,168 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/n_step_iterator.hpp - - [begin_description] - Iterator for iterating through the solution of an ODE with constant step size performing exactly n steps. - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_N_STEP_ITERATOR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_N_STEP_ITERATOR_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/stepper_traits.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> -#include <boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - - /* use the n_step_iterator_impl with the right tags */ - template< class Stepper , class System , class State -#ifndef DOXYGEN_SKIP - , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type -#endif - > - class n_step_iterator : public n_step_iterator_impl< - n_step_iterator< Stepper , System , State , StepperTag > , - Stepper , System , State , detail::ode_state_iterator_tag , StepperTag - > - { - typedef typename traits::time_type< Stepper >::type time_type; - typedef n_step_iterator< Stepper , System , State , StepperTag > iterator_type; - - public: - n_step_iterator( Stepper stepper , System sys , State &s , time_type t , time_type dt , size_t num_of_steps ) - : n_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t , dt , num_of_steps ) - {} - - n_step_iterator( Stepper stepper , System sys , State &s ) - : n_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s ) - {} - }; - - /* make functions */ - - template< class Stepper , class System , class State > - n_step_iterator< Stepper , System, State > make_n_step_iterator_begin( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t , - typename traits::time_type< Stepper >::type dt , - size_t num_of_steps ) - { - return n_step_iterator< Stepper , System , State >( stepper , system , x , t , dt , num_of_steps ); - } - - template< class Stepper , class System , class State > - n_step_iterator< Stepper , System , State > make_n_step_iterator_end( - Stepper stepper , - System system , - State &x ) - { - return n_step_iterator< Stepper , System , State >( stepper , system , x ); - } - - template< class Stepper , class System , class State > - std::pair< n_step_iterator< Stepper , System , State > , n_step_iterator< Stepper , System , State > > - make_n_step_range( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t , - typename traits::time_type< Stepper >::type dt , - size_t num_of_steps ) - { - return std::make_pair( - n_step_iterator< Stepper , System , State >( stepper , system , x , t , dt , num_of_steps ) , - n_step_iterator< Stepper , System , State >( stepper , system , x ) - ); - } - - - /** - * \class n_step_iterator - * - * \brief ODE Iterator with constant step size. The value type of this iterator is the state type of the stepper. - * - * Implements an iterator representing the solution of an ODE starting from t - * with n steps and a constant step size dt. - * After each iteration the iterator dereferences to the state x at the next - * time t+dt. - * This iterator can be used with Steppers and - * DenseOutputSteppers and it always makes use of the all the given steppers - * capabilities. A for_each over such an iterator range behaves similar to - * the integrate_n_steps routine. - * - * n_step_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - * \tparam State The state type of the ODE. - */ - - - /** - * \fn make_n_step_iterator_begin( Stepper stepper , System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , size_t num_of_steps ) - * - * \brief Factory function for n_step_iterator. Constructs a begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param dt The initial time step. - * \param num_of_steps The number of steps to be executed. - * \returns The n-step iterator. - */ - - - /** - * \fn make_n_step_iterator_end( Stepper stepper , System system , State &x ) - * \brief Factory function for n_step_iterator. Constructs an end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \returns The const_step_iterator. - */ - - - /** - * \fn make_n_step_range( Stepper stepper , System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , , size_t num_of_steps ) - * - * \brief Factory function to construct a single pass range of n-step iterators. A range is here a pair - * of n_step_iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param dt The initial time step. - * \param num_of_steps The number of steps to be executed. - * \returns The n-step range. - */ - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_N_STEP_ITERATOR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/n_step_time_iterator.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/n_step_time_iterator.hpp deleted file mode 100644 index acede2ca3c7534b5ff40793e5fc6dddc5f97f43b..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/n_step_time_iterator.hpp +++ /dev/null @@ -1,169 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/n_step_time_iterator.hpp - - [begin_description] - Iterator for iterating through the solution of an ODE with constant step size performing exactly n steps. - The dereferenced type contains also the time. - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_N_STEP_TIME_ITERATOR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_N_STEP_TIME_ITERATOR_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/stepper_traits.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> -#include <boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - - /* use the n_step_iterator_impl with the right tags */ - template< class Stepper , class System , class State -#ifndef DOXYGEN_SKIP - , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type -#endif - > - class n_step_time_iterator : public n_step_iterator_impl< - n_step_time_iterator< Stepper , System , State , StepperTag > , - Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag - > - { - typedef typename traits::time_type< Stepper >::type time_type; - typedef n_step_time_iterator< Stepper , System , State , StepperTag > iterator_type; - - public: - n_step_time_iterator( Stepper stepper , System sys , State &s , time_type t , time_type dt , size_t num_of_steps ) - : n_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s , t , dt , num_of_steps ) - {} - - n_step_time_iterator( Stepper stepper , System sys , State &s ) - : n_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s ) - {} - }; - - /* make functions */ - - template< class Stepper , class System , class State > - n_step_time_iterator< Stepper , System, State > make_n_step_time_iterator_begin( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t , - typename traits::time_type< Stepper >::type dt , - size_t num_of_steps ) - { - return n_step_time_iterator< Stepper , System , State >( stepper , system , x , t , dt , num_of_steps ); - } - - template< class Stepper , class System , class State > - n_step_time_iterator< Stepper , System , State > make_n_step_time_iterator_end( - Stepper stepper , - System system , - State &x ) - { - return n_step_time_iterator< Stepper , System , State >( stepper , system , x ); - } - - template< class Stepper , class System , class State > - std::pair< n_step_time_iterator< Stepper , System , State > , n_step_time_iterator< Stepper , System , State > > - make_n_step_time_range( - Stepper stepper , - System system , - State &x , - typename traits::time_type< Stepper >::type t , - typename traits::time_type< Stepper >::type dt , - size_t num_of_steps ) - { - return std::make_pair( - n_step_time_iterator< Stepper , System , State >( stepper , system , x , t , dt , num_of_steps ) , - n_step_time_iterator< Stepper , System , State >( stepper , system , x ) - ); - } - - - /** - * \class n_step_time_iterator - * - * \brief ODE Iterator with constant step size. The value type of this iterator is a std::pair containing state and time. - * - * Implements an iterator representing the solution of an ODE starting from t - * with n steps and a constant step size dt. - * After each iteration the iterator dereferences to a pair of state and time at the next - * time t+dt. - * This iterator can be used with Steppers and - * DenseOutputSteppers and it always makes use of the all the given steppers - * capabilities. A for_each over such an iterator range behaves similar to - * the integrate_n_steps routine. - * - * n_step_time_iterator is a model of single-pass iterator. - * - * The value type of this iterator is pair of state and time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - * \tparam State The state type of the ODE. - */ - - - /** - * \fn make_n_step_time_iterator_begin( Stepper stepper , System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , size_t num_of_steps ) - * - * \brief Factory function for n_step_time_iterator. Constructs a begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param dt The initial time step. - * \param num_of_steps The number of steps to be executed. - * \returns The n-step iterator. - */ - - - /** - * \fn make_n_step_time_iterator_end( Stepper stepper , System system , State &x ) - * \brief Factory function for n_step_time_iterator. Constructs an end iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \returns The const_step_iterator. - */ - - - /** - * \fn make_n_step_time_range( Stepper stepper , System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , size_t num_of_steps ) - * - * \brief Factory function to construct a single pass range of n-step iterators. A range is here a pair - * of n_step_time_iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration. - * \param t The initial time. - * \param dt The initial time step. - * \param num_of_steps The number of steps to be executed. - * \returns The n-step range. - */ - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_N_STEP_TIME_ITERATOR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/times_iterator.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/times_iterator.hpp deleted file mode 100644 index dcf5733269f7d12f88cfe446d3aa9b4c78095325..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/times_iterator.hpp +++ /dev/null @@ -1,189 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/times_iterator.hpp - - [begin_description] - Iterator for iterating through the solution of an ODE with oscillator calls at times from a given sequence. - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_ITERATOR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_ITERATOR_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/stepper_traits.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> -#include <boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - - /* use the times_iterator_impl with the right tags */ - template< class Stepper , class System , class State , class TimeIterator -#ifndef DOXYGEN_SKIP - , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type -#endif - > - class times_iterator : public times_iterator_impl< - times_iterator< Stepper , System , State , TimeIterator , StepperTag > , - Stepper , System , State , TimeIterator , detail::ode_state_iterator_tag , StepperTag - > - { - typedef typename traits::time_type< Stepper >::type time_type; - typedef times_iterator< Stepper , System , State , TimeIterator , StepperTag > iterator_type; - - public: - times_iterator( Stepper stepper , System sys , State &s , - TimeIterator t_start , TimeIterator t_end , time_type dt ) - : times_iterator_impl< iterator_type , Stepper , System , State , TimeIterator, detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt ) - {} - - times_iterator( Stepper stepper , System sys , State &s ) - : times_iterator_impl< iterator_type , Stepper , System , State , TimeIterator , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s ) - {} - }; - - /* make functions */ - - template< class Stepper , class System , class State , class TimeIterator > - times_iterator< Stepper , System, State , TimeIterator > make_times_iterator_begin( - Stepper stepper , - System system , - State &x , - TimeIterator t_start , - TimeIterator t_end , - typename traits::time_type< Stepper >::type dt ) - { - return times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x , t_start , t_end , dt ); - } - - // ToDo: requires to specifically provide the TimeIterator template parameter, can this be improved? - template< class TimeIterator , class Stepper , class System , class State > - times_iterator< Stepper , System , State , TimeIterator > make_times_iterator_end( - Stepper stepper , - System system , - State &x ) - //TimeIterator t_end ) - { - return times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x ); - } - - template< class Stepper , class System , class State , class TimeIterator > - std::pair< times_iterator< Stepper , System , State , TimeIterator > , - times_iterator< Stepper , System , State , TimeIterator > > - make_times_range( - Stepper stepper , - System system , - State &x , - TimeIterator t_start , - TimeIterator t_end , - typename traits::time_type< Stepper >::type dt ) - { - return std::make_pair( - times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x , t_start , t_end , dt ) , - times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x ) - ); - } - - - /** - * \class times_iterator - * - * \brief ODE Iterator with given evaluation points. The value type of this iterator is the state type of the stepper. - * - * Implements an iterator representing the solution of an ODE from *t_start - * to *t_end evaluated at time points given by the sequence t_start to t_end. - * t_start and t_end are iterators representing a sequence of time points - * where the solution of the ODE should be evaluated. - * After each iteration the iterator dereferences to the state x at the next - * time *t_start++ until t_end is reached. - * This iterator can be used with Steppers, ControlledSteppers and - * DenseOutputSteppers and it always makes use of the all the given steppers - * capabilities. A for_each over such an iterator range behaves similar to - * the integrate_times routine. - * - * times_iterator is a model of single-pass iterator. - * - * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - * \tparam State The state type of the ODE. - * \tparam TimeIterator The iterator type for the sequence of time points. - */ - - - - /** - * \fn make_times_iterator_begin( Stepper stepper , - System system , - State &x , - TimeIterator t_start , - TimeIterator t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function for times_iterator. Constructs a begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t_start Begin iterator of the sequence of evaluation time points. - * \param t_end End iterator of the sequence of evaluation time points. - * \param dt The initial time step. - * \returns The times iterator. - */ - - - /** - * \fn make_times_iterator_end( Stepper stepper , System system , State &x ) - * \brief Factory function for times_iterator. Constructs an end iterator. - * - * \tparam TimesIterator The iterator type of the time sequence, must be specifically provided. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \returns The times iterator. - * - * This function needs the TimeIterator type specifically defined as a - * template parameter. - */ - - - /** - * \fn make_times_range( Stepper stepper , System system , State &x , - TimeIterator t_start , - TimeIterator t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function to construct a single pass range of times iterators. A range is here a pair - * of times_iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration. - * \param t_start Begin iterator of the sequence of evaluation time points. - * \param t_end End iterator of the sequence of evaluation time points. - * \param dt The initial time step. - * \returns The times iterator range. - */ - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_ITERATOR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/times_time_iterator.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/times_time_iterator.hpp deleted file mode 100644 index 1935d053ffc1c5a8a38ee442d8da443ec6426dc4..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/iterator/times_time_iterator.hpp +++ /dev/null @@ -1,193 +0,0 @@ - -/* - [auto_generated] - boost/numeric/odeint/iterator/times_time_iterator.hpp - - [begin_description] - Iterator for iterating through the solution of an ODE with oscillator calls at times from a given sequence. - The dereferenced type contains also the time. - [end_description] - - Copyright 2009-2013 Karsten Ahnert - Copyright 2009-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_TIME_ITERATOR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_TIME_ITERATOR_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/stepper_traits.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp> -#include <boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - - /* use the times_iterator_impl with the right tags */ - template< class Stepper , class System , class State , class TimeIterator -#ifndef DOXYGEN_SKIP - , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type -#endif - > - class times_time_iterator : public times_iterator_impl< - times_time_iterator< Stepper , System , State , TimeIterator , StepperTag > , - Stepper , System , State , TimeIterator , detail::ode_state_time_iterator_tag , StepperTag - > - { - typedef typename traits::time_type< Stepper >::type time_type; - typedef times_time_iterator< Stepper , System , State , TimeIterator , StepperTag > iterator_type; - - public: - times_time_iterator( Stepper stepper , System sys , State &s , - TimeIterator t_start , TimeIterator t_end , time_type dt ) - : times_iterator_impl< iterator_type , Stepper , System , State , TimeIterator, detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt ) - {} - - times_time_iterator( Stepper stepper , System sys , State &s ) - : times_iterator_impl< iterator_type , Stepper , System , State , TimeIterator , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s ) - {} - }; - - /* make functions */ - - template< class Stepper , class System , class State , class TimeIterator > - times_time_iterator< Stepper , System, State , TimeIterator > make_times_time_iterator_begin( - Stepper stepper , - System system , - State &x , - TimeIterator t_start , - TimeIterator t_end , - typename traits::time_type< Stepper >::type dt ) - { - return times_time_iterator< Stepper , System , State , TimeIterator >( stepper , system , x , t_start , t_end , dt ); - } - - // ToDo: requires to specifically provide the TimeIterator template parameter, can this be improved? - template< class TimeIterator , class Stepper , class System , class State > - times_time_iterator< Stepper , System , State , TimeIterator > make_times_time_iterator_end( - Stepper stepper , - System system , - State &x ) - //TimeIterator t_end ) - { - return times_time_iterator< Stepper , System , State , TimeIterator >( stepper , system , x ); - } - - template< class Stepper , class System , class State , class TimeIterator > - std::pair< times_time_iterator< Stepper , System , State , TimeIterator > , - times_time_iterator< Stepper , System , State , TimeIterator > > - make_times_time_range( - Stepper stepper , - System system , - State &x , - TimeIterator t_start , - TimeIterator t_end , - typename traits::time_type< Stepper >::type dt ) - { - return std::make_pair( - times_time_iterator< Stepper , System , State , TimeIterator >( stepper , system , x , t_start , t_end , dt ) , - times_time_iterator< Stepper , System , State , TimeIterator >( stepper , system , x ) - ); - } - - - - - - /** - * \class times_time_iterator - * - * \brief ODE Iterator with given evaluation points. The value type of this iterator is a std::pair containing state and time. - * - * Implements an iterator representing the solution of an ODE from *t_start - * to *t_end evaluated at time points given by the sequence t_start to t_end. - * t_start and t_end are iterators representing a sequence of time points - * where the solution of the ODE should be evaluated. - * After each iteration the iterator dereferences to a pair with the state - * and the time at the next evaluation point *t_start++ until t_end is reached. - * This iterator can be used with Steppers, ControlledSteppers and - * DenseOutputSteppers and it always makes use of the all the given steppers - * capabilities. A for_each over such an iterator range behaves similar to - * the integrate_times routine. - * - * times_time_iterator is a model of single-pass iterator. - * - * The value type of this iterator is a pair of state and time type. - * - * \tparam Stepper The stepper type which should be used during the iteration. - * \tparam System The type of the system function (ODE) which should be solved. - * \tparam State The state type of the ODE. - * \tparam TimeIterator The iterator type for the sequence of time points. - */ - - - - /** - * \fn make_times_time_iterator_begin( Stepper stepper , - System system , - State &x , - TimeIterator t_start , - TimeIterator t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function for times_time_iterator. Constructs a begin iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \param t_start Begin iterator of the sequence of evaluation time points. - * \param t_end End iterator of the sequence of evaluation time points. - * \param dt The initial time step. - * \returns The times_time iterator. - */ - - - /** - * \fn make_times_time_iterator_end( Stepper stepper , System system , State &x ) - * \brief Factory function for times_time_iterator. Constructs an end iterator. - * - * \tparam TimesIterator The iterator type of the time sequence, must be specifically provided. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. - * \returns The times_time iterator. - * - * This function needs the TimeIterator type specifically defined as a - * template parameter. - */ - - - /** - * \fn make_times_time_range( Stepper stepper , System system , State &x , - TimeIterator t_start , - TimeIterator t_end , - typename traits::time_type< Stepper >::type dt ) - * - * \brief Factory function to construct a single pass range of times_time iterators. A range is here a pair - * of times_iterator. - * - * \param stepper The stepper to use during the iteration. - * \param system The system function (ODE) to solve. - * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration. - * \param t_start Begin iterator of the sequence of evaluation time points. - * \param t_end End iterator of the sequence of evaluation time points. - * \param dt The initial time step. - * \returns The times_time iterator range. - */ - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_TIME_ITERATOR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_bashforth.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_bashforth.hpp deleted file mode 100644 index 47c3b939ee89cdf378a5e9d620b73534013f3f5f..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_bashforth.hpp +++ /dev/null @@ -1,420 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/adams_bashforth.hpp - - [begin_description] - Implementaton of the Adam-Bashforth method a multistep method used for the predictor step in the - Adams-Bashforth-Moulton method. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2013 Mario Mulansky - Copyright 2012 Christoph Koke - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_HPP_INCLUDED - -#include <boost/static_assert.hpp> - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> - -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta4.hpp> -#include <boost/numeric/odeint/stepper/extrapolation_stepper.hpp> - -#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp> - -#include <boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp> -#include <boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp> -#include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp> - -#include <boost/mpl/arithmetic.hpp> -#include <boost/mpl/min_max.hpp> -#include <boost/mpl/equal_to.hpp> - -namespace mpl = boost::mpl; - - -namespace boost { -namespace numeric { -namespace odeint { - - using mpl::int_; - - /* if N >= 4, returns the smallest even number > N, otherwise returns 4 */ - template < int N > - struct order_helper - : mpl::max< typename mpl::eval_if< - mpl::equal_to< mpl::modulus< int_< N >, int_< 2 > >, - int_< 0 > >, - int_< N >, int_< N + 1 > >::type, - int_< 4 > >::type - { }; - -template< -size_t Steps , -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer , -class InitializingStepper = extrapolation_stepper< order_helper<Steps>::value, - State, Value, Deriv, Time, - Algebra, Operations, Resizer > -> -class adams_bashforth : public algebra_stepper_base< Algebra , Operations > -{ - -#ifndef DOXYGEN_SKIP - BOOST_STATIC_ASSERT(( Steps > 0 )); - BOOST_STATIC_ASSERT(( Steps < 9 )); -#endif - -public : - - typedef State state_type; - typedef state_wrapper< state_type > wrapped_state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef Time time_type; - typedef Resizer resizer_type; - typedef stepper_tag stepper_category; - - typedef InitializingStepper initializing_stepper_type; - - typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type; - typedef typename algebra_stepper_base_type::algebra_type algebra_type; - typedef typename algebra_stepper_base_type::operations_type operations_type; -#ifndef DOXYGEN_SKIP - typedef adams_bashforth< Steps , State , Value , Deriv , Time , Algebra , Operations , Resizer , InitializingStepper > stepper_type; -#endif - static const size_t steps = Steps; - - - - typedef unsigned short order_type; - static const order_type order_value = steps; - - typedef detail::rotating_buffer< wrapped_deriv_type , steps > step_storage_type; - - - - order_type order( void ) const { return order_value; } - - adams_bashforth( const algebra_type &algebra = algebra_type() ) - : algebra_stepper_base_type( algebra ) , - m_step_storage() , m_resizer() , m_coefficients() , - m_steps_initialized( 0 ) , m_initializing_stepper() - { } - - - - /* - * Version 1 : do_step( system , x , t , dt ); - * - * solves the forwarding problem - */ - template< class System , class StateInOut > - void do_step( System system , StateInOut &x , time_type t , time_type dt ) - { - do_step( system , x , t , x , dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. - */ - template< class System , class StateInOut > - void do_step( System system , const StateInOut &x , time_type t , time_type dt ) - { - do_step( system , x , t , x , dt ); - } - - - - /* - * Version 2 : do_step( system , in , t , out , dt ); - * - * solves the forwarding problem - */ - - template< class System , class StateIn , class StateOut > - void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - { - do_step_impl( system , in , t , out , dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateOut. - */ - template< class System , class StateIn , class StateOut > - void do_step( System system , const StateIn &in , time_type t , const StateOut &out , time_type dt ) - { - do_step_impl( system , in , t , out , dt ); - } - - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_impl( x ); - } - - const step_storage_type& step_storage( void ) const - { - return m_step_storage; - } - - step_storage_type& step_storage( void ) - { - return m_step_storage; - } - - template< class ExplicitStepper , class System , class StateIn > - void initialize( ExplicitStepper explicit_stepper , System system , StateIn &x , time_type &t , time_type dt ) - { - typename odeint::unwrap_reference< ExplicitStepper >::type &stepper = explicit_stepper; - typename odeint::unwrap_reference< System >::type &sys = system; - - m_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); - - for( size_t i=0 ; i+1<steps ; ++i ) - { - if( i != 0 ) m_step_storage.rotate(); - sys( x , m_step_storage[0].m_v , t ); - stepper.do_step_dxdt_impl( system, x, m_step_storage[0].m_v, t, - dt ); - t += dt; - } - m_steps_initialized = steps; - } - - template< class System , class StateIn > - void initialize( System system , StateIn &x , time_type &t , time_type dt ) - { - initialize( detail::ref( m_initializing_stepper ) , system , x , t , dt ); - } - - void reset( void ) - { - m_steps_initialized = 0; - } - - bool is_initialized( void ) const - { - return m_steps_initialized >= ( steps - 1 ); - } - - const initializing_stepper_type& initializing_stepper( void ) const { return m_initializing_stepper; } - - initializing_stepper_type& initializing_stepper( void ) { return m_initializing_stepper; } - -private: - - template< class System , class StateIn , class StateOut > - void do_step_impl( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - if( m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ) ) - { - m_steps_initialized = 0; - } - - if( m_steps_initialized + 1 < steps ) - { - if( m_steps_initialized != 0 ) m_step_storage.rotate(); - sys( in , m_step_storage[0].m_v , t ); - m_initializing_stepper.do_step_dxdt_impl( - system, in, m_step_storage[0].m_v, t, out, dt ); - ++m_steps_initialized; - } - else - { - m_step_storage.rotate(); - sys( in , m_step_storage[0].m_v , t ); - detail::adams_bashforth_call_algebra< steps , algebra_type , operations_type >()( this->m_algebra , in , out , m_step_storage , m_coefficients , dt ); - } - } - - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized( false ); - for( size_t i=0 ; i<steps ; ++i ) - { - resized |= adjust_size_by_resizeability( m_step_storage[i] , x , typename is_resizeable<deriv_type>::type() ); - } - return resized; - } - - step_storage_type m_step_storage; - resizer_type m_resizer; - detail::adams_bashforth_coefficients< value_type , steps > m_coefficients; - size_t m_steps_initialized; - initializing_stepper_type m_initializing_stepper; - -}; - - -/***** DOXYGEN *****/ - -/** - * \class adams_bashforth - * \brief The Adams-Bashforth multistep algorithm. - * - * The Adams-Bashforth method is a multi-step algorithm with configurable step - * number. The step number is specified as template parameter Steps and it - * then uses the result from the previous Steps steps. See also - * <a href="http://en.wikipedia.org/wiki/Linear_multistep_method">en.wikipedia.org/wiki/Linear_multistep_method</a>. - * Currently, a maximum of Steps=8 is supported. - * The method is explicit and fulfills the Stepper concept. Step size control - * or continuous output are not provided. - * - * This class derives from algebra_base and inherits its interface via - * CRTP (current recurring template pattern). For more details see - * algebra_stepper_base. - * - * \tparam Steps The number of steps (maximal 8). - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - * \tparam InitializingStepper The stepper for the first two steps. - */ - - /** - * \fn adams_bashforth::adams_bashforth( const algebra_type &algebra ) - * \brief Constructs the adams_bashforth class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored. - */ - - /** - * \fn order_type adams_bashforth::order( void ) const - * \brief Returns the order of the algorithm, which is equal to the number of steps. - * \return order of the method. - */ - - /** - * \fn void adams_bashforth::do_step( System system , StateInOut &x , time_type t , time_type dt ) - * \brief This method performs one step. It transforms the result in-place. - * - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - /** - * \fn void adams_bashforth::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - /** - * \fn void adams_bashforth::adjust_size( const StateType &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - - - /** - * \fn const step_storage_type& adams_bashforth::step_storage( void ) const - * \brief Returns the storage of intermediate results. - * \return The storage of intermediate results. - */ - - /** - * \fn step_storage_type& adams_bashforth::step_storage( void ) - * \brief Returns the storage of intermediate results. - * \return The storage of intermediate results. - */ - - /** - * \fn void adams_bashforth::initialize( ExplicitStepper explicit_stepper , System system , StateIn &x , time_type &t , time_type dt ) - * \brief Initialized the stepper. Does Steps-1 steps with the explicit_stepper to fill the buffer. - * \param explicit_stepper the stepper used to fill the buffer of previous step results - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - /** - * \fn void adams_bashforth::initialize( System system , StateIn &x , time_type &t , time_type dt ) - * \brief Initialized the stepper. Does Steps-1 steps with an internal instance of InitializingStepper to fill the buffer. - * \note The state x and time t are updated to the values after Steps-1 initial steps. - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The initial state of the ODE which should be solved, updated in this method. - * \param t The initial value of the time, updated in this method. - * \param dt The step size. - */ - - /** - * \fn void adams_bashforth::reset( void ) - * \brief Resets the internal buffer of the stepper. - */ - - /** - * \fn bool adams_bashforth::is_initialized( void ) const - * \brief Returns true if the stepper has been initialized. - * \return bool true if stepper is initialized, false otherwise - */ - - /** - * \fn const initializing_stepper_type& adams_bashforth::initializing_stepper( void ) const - * \brief Returns the internal initializing stepper instance. - * \return initializing_stepper - */ - - /** - * \fn const initializing_stepper_type& adams_bashforth::initializing_stepper( void ) const - * \brief Returns the internal initializing stepper instance. - * \return initializing_stepper - */ - - /** - * \fn initializing_stepper_type& adams_bashforth::initializing_stepper( void ) - * \brief Returns the internal initializing stepper instance. - * \return initializing_stepper - */ - -} // odeint -} // numeric -} // boost - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp deleted file mode 100644 index c7b487fb13ac0fac27254196f469fb282664abce..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp +++ /dev/null @@ -1,314 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp - - [begin_description] - Implementation of the Adams-Bashforth-Moulton method, a predictor-corrector multistep method. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2013 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_MOULTON_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_MOULTON_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/bind.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/numeric/odeint/stepper/adams_bashforth.hpp> -#include <boost/numeric/odeint/stepper/adams_moulton.hpp> - - - -namespace boost { -namespace numeric { -namespace odeint { - - -template< -size_t Steps , -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer, -class InitializingStepper = runge_kutta4< State , Value , Deriv , Time , Algebra , Operations, Resizer > -> -class adams_bashforth_moulton -{ - -#ifndef DOXYGEN_SKIP - BOOST_STATIC_ASSERT(( Steps > 0 )); - BOOST_STATIC_ASSERT(( Steps < 9 )); -#endif - -public : - - typedef State state_type; - typedef state_wrapper< state_type > wrapped_state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef Time time_type; - typedef Algebra algebra_type; - typedef Operations operations_type; - typedef Resizer resizer_type; - typedef stepper_tag stepper_category; - typedef InitializingStepper initializing_stepper_type; - - static const size_t steps = Steps; -#ifndef DOXYGEN_SKIP - typedef adams_bashforth< steps , state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type, initializing_stepper_type > adams_bashforth_type; - typedef adams_moulton< steps , state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > adams_moulton_type; - typedef adams_bashforth_moulton< steps , state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type , initializing_stepper_type> stepper_type; -#endif //DOXYGEN_SKIP - typedef unsigned short order_type; - static const order_type order_value = steps; - - /** \brief Constructs the adams_bashforth class. */ - adams_bashforth_moulton( void ) - : m_adams_bashforth() , m_adams_moulton( m_adams_bashforth.algebra() ) - , m_x() , m_resizer() - { } - - adams_bashforth_moulton( const algebra_type &algebra ) - : m_adams_bashforth( algebra ) , m_adams_moulton( m_adams_bashforth.algebra() ) - , m_x() , m_resizer() - { } - - order_type order( void ) const { return order_value; } - - template< class System , class StateInOut > - void do_step( System system , StateInOut &x , time_type t , time_type dt ) - { - do_step_impl1( system , x , t , dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. - */ - template< class System , class StateInOut > - void do_step( System system , const StateInOut &x , time_type t , time_type dt ) - { - do_step_impl1( system , x , t , dt ); - } - - template< class System , class StateIn , class StateOut > - void do_step( System system , const StateIn &in , time_type t , const StateOut &out , time_type dt ) - { - do_step_impl2( system , in , t , out , dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateOut. - */ - template< class System , class StateIn , class StateOut > - void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - { - do_step_impl2( system , in ,t , out , dt ); - } - - - template< class StateType > - void adjust_size( const StateType &x ) - { - m_adams_bashforth.adjust_size( x ); - m_adams_moulton.adjust_size( x ); - resize_impl( x ); - } - - - template< class ExplicitStepper , class System , class StateIn > - void initialize( ExplicitStepper explicit_stepper , System system , StateIn &x , time_type &t , time_type dt ) - { - m_adams_bashforth.initialize( explicit_stepper , system , x , t , dt ); - } - - - template< class System , class StateIn > - void initialize( System system , StateIn &x , time_type &t , time_type dt ) - { - m_adams_bashforth.initialize( system , x , t , dt ); - } - - - void reset(void) - { - m_adams_bashforth.reset(); - } - - - -private: - - template< typename System , typename StateInOut > - void do_step_impl1( System system , StateInOut &x , time_type t , time_type dt ) - { - if( m_adams_bashforth.is_initialized() ) - { - m_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - m_adams_bashforth.do_step( system , x , t , m_x.m_v , dt ); - m_adams_moulton.do_step( system , x , m_x.m_v , t+dt , x , dt , m_adams_bashforth.step_storage() ); - } - else - { - m_adams_bashforth.do_step( system , x , t , dt ); - } - } - - template< typename System , typename StateIn , typename StateInOut > - void do_step_impl2( System system , StateIn const &in , time_type t , StateInOut & out , time_type dt ) - { - if( m_adams_bashforth.is_initialized() ) - { - m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - m_adams_bashforth.do_step( system , in , t , m_x.m_v , dt ); - m_adams_moulton.do_step( system , in , m_x.m_v , t+dt , out , dt , m_adams_bashforth.step_storage() ); - } - else - { - m_adams_bashforth.do_step( system , in , t , out , dt ); - } - } - - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_x , x , typename is_resizeable< state_type >::type() ); - } - - adams_bashforth_type m_adams_bashforth; - adams_moulton_type m_adams_moulton; - wrapped_state_type m_x; - resizer_type m_resizer; -}; - - -/********* DOXYGEN ********/ - -/** - * \class adams_bashforth_moulton - * \brief The Adams-Bashforth-Moulton multistep algorithm. - * - * The Adams-Bashforth method is a multi-step predictor-corrector algorithm - * with configurable step number. The step number is specified as template - * parameter Steps and it then uses the result from the previous Steps steps. - * See also - * <a href="http://en.wikipedia.org/wiki/Linear_multistep_method">en.wikipedia.org/wiki/Linear_multistep_method</a>. - * Currently, a maximum of Steps=8 is supported. - * The method is explicit and fulfills the Stepper concept. Step size control - * or continuous output are not provided. - * - * This class derives from algebra_base and inherits its interface via - * CRTP (current recurring template pattern). For more details see - * algebra_stepper_base. - * - * \tparam Steps The number of steps (maximal 8). - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - * \tparam InitializingStepper The stepper for the first two steps. - */ - - /** - * \fn adams_bashforth_moulton::adams_bashforth_moulton( const algebra_type &algebra ) - * \brief Constructs the adams_bashforth class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored. - */ - - /** - * \fn adams_bashforth_moulton::order( void ) const - * \brief Returns the order of the algorithm, which is equal to the number of steps+1. - * \return order of the method. - */ - - /** - * \fn adams_bashforth_moulton::do_step( System system , StateInOut &x , time_type t , time_type dt ) - * \brief This method performs one step. It transforms the result in-place. - * - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - - /** - * \fn adams_bashforth_moulton::do_step( System system , const StateIn &in , time_type t , const StateOut &out , time_type dt ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - /** - * \fn adams_bashforth_moulton::adjust_size( const StateType &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - - /** - * \fn adams_bashforth_moulton::initialize( ExplicitStepper explicit_stepper , System system , StateIn &x , time_type &t , time_type dt ) - * \brief Initialized the stepper. Does Steps-1 steps with the explicit_stepper to fill the buffer. - * \note The state x and time t are updated to the values after Steps-1 initial steps. - * \param explicit_stepper the stepper used to fill the buffer of previous step results - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The initial state of the ODE which should be solved, updated after in this method. - * \param t The initial time, updated in this method. - * \param dt The step size. - */ - - /** - * \fn adams_bashforth_moulton::initialize( System system , StateIn &x , time_type &t , time_type dt ) - * \brief Initialized the stepper. Does Steps-1 steps using the standard initializing stepper - * of the underlying adams_bashforth stepper. - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - /** - * \fn adams_bashforth_moulton::reset( void ) - * \brief Resets the internal buffers of the stepper. - */ - - -} // odeint -} // numeric -} // boost - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_MOULTON_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_moulton.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_moulton.hpp deleted file mode 100644 index 05b42777355be822ecb34a300207fb2c8c254c79..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/adams_moulton.hpp +++ /dev/null @@ -1,201 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/adams_moulton.hpp - - [begin_description] - Implementation of the Adams-Moulton method. This is method is not a real stepper, it is more a helper class - which computes the corrector step in the Adams-Bashforth-Moulton method. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2013 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_MOULTON_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_MOULTON_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/bind.hpp> - -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta4_classic.hpp> - -#include <boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp> -#include <boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp> -#include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp> - - - - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * Static implicit Adams-Moulton multistep-solver without step size control and without dense output. - */ -template< -size_t Steps , -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -class adams_moulton -{ -private: - - -public : - - typedef State state_type; - typedef state_wrapper< state_type > wrapped_state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef Time time_type; - typedef Algebra algebra_type; - typedef Operations operations_type; - typedef Resizer resizer_type; - typedef stepper_tag stepper_category; - - typedef adams_moulton< Steps , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_type; - - static const size_t steps = Steps; - - typedef unsigned short order_type; - static const order_type order_value = steps + 1; - - typedef detail::rotating_buffer< wrapped_deriv_type , steps > step_storage_type; - - adams_moulton( ) - : m_coefficients() , m_dxdt() , m_resizer() , - m_algebra_instance() , m_algebra( m_algebra_instance ) - { } - - adams_moulton( algebra_type &algebra ) - : m_coefficients() , m_dxdt() , m_resizer() , - m_algebra_instance() , m_algebra( algebra ) - { } - - adams_moulton& operator=( const adams_moulton &stepper ) - { - m_dxdt = stepper.m_dxdt; - m_resizer = stepper.m_resizer; - m_algebra = stepper.m_algebra; - return *this; - } - - order_type order( void ) const { return order_value; } - - - /* - * Version 1 : do_step( system , x , t , dt , buf ); - * - * solves the forwarding problem - */ - template< class System , class StateInOut , class StateIn , class ABBuf > - void do_step( System system , StateInOut &x , StateIn const & pred , time_type t , time_type dt , const ABBuf &buf ) - { - do_step( system , x , pred , t , x , dt , buf ); - } - - template< class System , class StateInOut , class StateIn , class ABBuf > - void do_step( System system , const StateInOut &x , StateIn const & pred , time_type t , time_type dt , const ABBuf &buf ) - { - do_step( system , x , pred , t , x , dt , buf ); - } - - - - /* - * Version 2 : do_step( system , in , t , out , dt , buf ); - * - * solves the forwarding problem - */ - template< class System , class StateIn , class PredIn , class StateOut , class ABBuf > - void do_step( System system , const StateIn &in , const PredIn &pred , time_type t , StateOut &out , time_type dt , const ABBuf &buf ) - { - do_step_impl( system , in , pred , t , out , dt , buf ); - } - - template< class System , class StateIn , class PredIn , class StateOut , class ABBuf > - void do_step( System system , const StateIn &in , const PredIn &pred , time_type t , const StateOut &out , time_type dt , const ABBuf &buf ) - { - do_step_impl( system , in , pred , t , out , dt , buf ); - } - - - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_impl( x ); - } - - algebra_type& algebra() - { return m_algebra; } - - const algebra_type& algebra() const - { return m_algebra; } - - -private: - - - template< class System , class StateIn , class PredIn , class StateOut , class ABBuf > - void do_step_impl( System system , const StateIn &in , const PredIn &pred , time_type t , StateOut &out , time_type dt , const ABBuf &buf ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); - sys( pred , m_dxdt.m_v , t ); - detail::adams_moulton_call_algebra< steps , algebra_type , operations_type >()( m_algebra , in , out , m_dxdt.m_v , buf , m_coefficients , dt ); - } - - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - } - - - const detail::adams_moulton_coefficients< value_type , steps > m_coefficients; - wrapped_deriv_type m_dxdt; - resizer_type m_resizer; - -protected: - - algebra_type m_algebra_instance; - algebra_type &m_algebra; -}; - - - - -} // odeint -} // numeric -} // boost - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_MOULTON_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp deleted file mode 100644 index 66c2b84a81f26e791664d437b24389625142ff10..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp - - [begin_description] - Base class for all steppers with an algebra and operations. - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_ALGEBRA_STEPPER_BASE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_ALGEBRA_STEPPER_BASE_HPP_INCLUDED - - -namespace boost { -namespace numeric { -namespace odeint { - -template< class Algebra , class Operations > -class algebra_stepper_base -{ -public: - - typedef Algebra algebra_type; - typedef Operations operations_type; - - algebra_stepper_base( const algebra_type &algebra = algebra_type() ) - : m_algebra( algebra ) { } - - algebra_type& algebra() - { - return m_algebra; - } - - const algebra_type& algebra() const - { - return m_algebra; - } - -protected: - - algebra_type m_algebra; -}; - - -/******* DOXYGEN *******/ - -/** - * \class algebra_stepper_base - * \brief Base class for all steppers with algebra and operations. - * - * This class serves a base class for all steppers with algebra and operations. It holds the - * algebra and provides access to the algebra. The operations are not instantiated, since they are - * static classes inside the operations class. - * - * \tparam Algebra The type of the algebra. Must fulfill the Algebra Concept, at least partially to work - * with the stepper. - * \tparam Operations The type of the operations. Must fulfill the Operations Concept, at least partially - * to work with the stepper. - */ - - /** - * \fn algebra_stepper_base::algebra_stepper_base( const algebra_type &algebra = algebra_type() ) - * \brief Constructs a algebra_stepper_base and creates the algebra. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra The algebra_stepper_base stores and uses a copy of algebra. - */ - - /** - * \fn algebra_type& algebra_stepper_base::algebra() - * \return A reference to the algebra which is held by this class. - */ - - /** - * \fn const algebra_type& algebra_stepper_base::algebra() const - * \return A const reference to the algebra which is held by this class. - */ - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_ALGEBRA_STEPPER_BASE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp deleted file mode 100644 index bb6ea3d0a716eaa5162b8745adc9e91075657619..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp +++ /dev/null @@ -1,588 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp - - [begin_description] - Base class for all explicit Runge Kutta stepper which are also error steppers. - [end_description] - - Copyright 2010-2013 Karsten Ahnert - Copyright 2010-2012 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED - -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> - - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * base class for explicit stepper and error steppers - * models the stepper AND the error stepper concept - * - * this class provides the following do_step variants: - * do_step( sys , x , t , dt ) - * do_step( sys , x , dxdt , t , dt ) - * do_step( sys , in , t , out , dt ) - * do_step( sys , in , dxdt , t , out , dt ) - * do_step( sys , x , t , dt , xerr ) - * do_step( sys , x , dxdt , t , dt , xerr ) - * do_step( sys , in , t , out , dt , xerr ) - * do_step( sys , in , dxdt , t , out , dt , xerr ) - */ -template< -class Stepper , -unsigned short Order , -unsigned short StepperOrder , -unsigned short ErrorOrder , -class State , -class Value , -class Deriv , -class Time , -class Algebra , -class Operations , -class Resizer -> -class explicit_error_stepper_base : public algebra_stepper_base< Algebra , Operations > -{ -public: - - typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type; - typedef typename algebra_stepper_base_type::algebra_type algebra_type; - - - typedef State state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef Time time_type; - typedef Resizer resizer_type; - typedef Stepper stepper_type; - typedef explicit_error_stepper_tag stepper_category; - #ifndef DOXYGEN_SKIP - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef explicit_error_stepper_base< Stepper , Order , StepperOrder , ErrorOrder , - State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type; - #endif - - typedef unsigned short order_type; - static const order_type order_value = Order; - static const order_type stepper_order_value = StepperOrder; - static const order_type error_order_value = ErrorOrder; - - - explicit_error_stepper_base( const algebra_type &algebra = algebra_type() ) - : algebra_stepper_base_type( algebra ) - { } - - order_type order( void ) const - { - return order_value; - } - - order_type stepper_order( void ) const - { - return stepper_order_value; - } - - order_type error_order( void ) const - { - return error_order_value; - } - - - - /* - * Version 1 : do_step( sys , x , t , dt ) - * - * the two overloads are needed in order to solve the forwarding problem - */ - template< class System , class StateInOut > - void do_step( System system , StateInOut &x , time_type t , time_type dt ) - { - do_step_v1( system , x , t , dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. - */ - template< class System , class StateInOut > - void do_step( System system , const StateInOut &x , time_type t , time_type dt ) - { - do_step_v1( system , x , t , dt ); - } - - - - /* - * Version 2 : do_step( sys , x , dxdt , t , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - * - * the disable is needed to avoid ambiguous overloads if state_type = time_type - */ - template< class System , class StateInOut , class DerivIn > - typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type - do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt ) - { - this->stepper().do_step_impl( system , x , dxdt , t , x , dt ); - } - - - /* - * named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt ) - * - * this version is needed when this stepper is used for initializing - * multistep stepper like adams-bashforth. Hence we provide an explicitely - * named version that is not disabled. Meant for internal use only. - */ - template < class System, class StateInOut, class DerivIn > - void do_step_dxdt_impl( System system, StateInOut &x, const DerivIn &dxdt, - time_type t, time_type dt ) - { - this->stepper().do_step_impl( system , x , dxdt , t , x , dt ); - } - - - - /* - * Version 3 : do_step( sys , in , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - * - * the disable is needed to avoid ambiguous overloads if state_type = time_type - */ - template< class System , class StateIn , class StateOut > - typename boost::disable_if< boost::is_same< StateIn , time_type > , void >::type - do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); - sys( in , m_dxdt.m_v ,t ); - this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt ); - } - - /* - * Version 4 :do_step( sys , in , dxdt , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - * - * the disable is needed to avoid ambiguous overloads if state_type = time_type - */ - template< class System , class StateIn , class DerivIn , class StateOut > - typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type - do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - { - this->stepper().do_step_impl( system , in , dxdt , t , out , dt ); - } - - /* - * named Version 4: do_step_dxdt_impl( sys , in , dxdt , t , out, dt ) - * - * this version is needed when this stepper is used for initializing - * multistep stepper like adams-bashforth. Hence we provide an explicitely - * named version that is not disabled. Meant for internal use only. - */ - template < class System, class StateIn, class DerivIn, class StateOut > - void do_step_dxdt_impl( System system, const StateIn &in, - const DerivIn &dxdt, time_type t, StateOut &out, - time_type dt ) - { - this->stepper().do_step_impl( system , in , dxdt , t , out , dt ); - } - - /* - * Version 5 :do_step( sys , x , t , dt , xerr ) - * - * the two overloads are needed in order to solve the forwarding problem - */ - template< class System , class StateInOut , class Err > - void do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) - { - do_step_v5( system , x , t , dt , xerr ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. - */ - template< class System , class StateInOut , class Err > - void do_step( System system , const StateInOut &x , time_type t , time_type dt , Err &xerr ) - { - do_step_v5( system , x , t , dt , xerr ); - } - - - /* - * Version 6 :do_step( sys , x , dxdt , t , dt , xerr ) - * - * this version does not solve the forwarding problem, boost.range can not be used - * - * the disable is needed to avoid ambiguous overloads if state_type = time_type - */ - template< class System , class StateInOut , class DerivIn , class Err > - typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type - do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt , Err &xerr ) - { - this->stepper().do_step_impl( system , x , dxdt , t , x , dt , xerr ); - } - - - /* - * Version 7 : do_step( sys , in , t , out , dt , xerr ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateIn , class StateOut , class Err > - void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); - sys( in , m_dxdt.m_v ,t ); - this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt , xerr ); - } - - - /* - * Version 8 : do_step( sys , in , dxdt , t , out , dt , xerr ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateIn , class DerivIn , class StateOut , class Err > - void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr ) - { - this->stepper().do_step_impl( system , in , dxdt , t , out , dt , xerr ); - } - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_impl( x ); - } - - - -private: - - template< class System , class StateInOut > - void do_step_v1( System system , StateInOut &x , time_type t , time_type dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl<StateInOut> , detail::ref( *this ) , detail::_1 ) ); - sys( x , m_dxdt.m_v , t ); - this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt ); - } - - template< class System , class StateInOut , class Err > - void do_step_v5( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl<StateInOut> , detail::ref( *this ) , detail::_1 ) ); - sys( x , m_dxdt.m_v ,t ); - this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt , xerr ); - } - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - } - - stepper_type& stepper( void ) - { - return *static_cast< stepper_type* >( this ); - } - - const stepper_type& stepper( void ) const - { - return *static_cast< const stepper_type* >( this ); - } - - - resizer_type m_resizer; - -protected: - - wrapped_deriv_type m_dxdt; -}; - - - - -/******** DOXYGEN *******/ - -/** - * \class explicit_error_stepper_base - * \brief Base class for explicit steppers with error estimation. This class can used with - * controlled steppers for step size control. - * - * This class serves as the base class for all explicit steppers with algebra and operations. In contrast to - * explicit_stepper_base it also estimates the error and can be used in a controlled stepper to provide - * step size control. - * - * \note This stepper provides `do_step` methods with and without error estimation. It has therefore three orders, - * one for the order of a step if the error is not estimated. The other two orders are the orders of the step and - * the error step if the error estimation is performed. - * - * explicit_error_stepper_base is used as the interface in a CRTP (currently recurring template - * pattern). In order to work correctly the parent class needs to have a method - * `do_step_impl( system , in , dxdt_in , t , out , dt , xerr )`. - * explicit_error_stepper_base derives from algebra_stepper_base. - * - * explicit_error_stepper_base provides several overloaded `do_step` methods, see the list below. Only two of them - * are needed to fulfill the Error Stepper concept. The other ones are for convenience and for performance. Some - * of them simply update the state out-of-place, while other expect that the first derivative at `t` is passed to the - * stepper. - * - * - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fulfill the Error Stepper concept. The - * state is updated in-place. A type modelling a Boost.Range can be used for x. - * - `do_step( sys , x , dxdt , t , dt )` - This method updates the state in-place, but the derivative at the point `t` - * must be explicitly passed in `dxdt`. - * - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step - * is stored in `out`. - * - `do_step( sys , in , dxdt , t , out , dt )` - This method update the state out-of-place and expects that the - * derivative at the point `t` is explicitly passed in `dxdt`. It is a combination of the two `do_step` methods - * above. - * - `do_step( sys , x , t , dt , xerr )` - This `do_step` method is needed to fulfill the Error Stepper concept. The - * state is updated in-place and an error estimate is calculated. A type modelling a Boost.Range can be used for x. - * - `do_step( sys , x , dxdt , t , dt , xerr )` - This method updates the state in-place, but the derivative at the - * point `t` must be passed in `dxdt`. An error estimate is calculated. - * - `do_step( sys , in , t , out , dt , xerr )` - This method updates the state out-of-place and estimates the error - * during the step. - * - `do_step( sys , in , dxdt , t , out , dt , xerr )` - This methods updates the state out-of-place and estimates - * the error during the step. Furthermore, the derivative at `t` must be passed in `dxdt`. - * - * \note The system is always passed as value, which might result in poor performance if it contains data. In this - * case it can be used with `boost::ref` or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );` - * - * \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate` - * routines or `iterator`s. - * - * \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base - * provides the interface for the Stepper. - * \tparam Order The order of a stepper if the stepper is used without error estimation. - * \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have - * the same value. - * \tparam ErrorOrder The order of the error step if the stepper is used with error estimation. - * \tparam State The state type for the stepper. - * \tparam Value The value type for the stepper. This should be a floating point type, like float, - * double, or a multiprecision type. It must not necessary be the value_type of the State. For example - * the State can be a `vector< complex< double > >` in this case the Value must be double. - * The default value is double. - * \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the - * state type, only if used with Boost.Units both types differ. - * \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is - * used, this type has usually a unit. - * \tparam Algebra The algebra type which must fulfill the Algebra Concept. - * \tparam Operations The type for the operations which must fulfill the Operations Concept. - * \tparam Resizer The resizer policy class. - */ - - - /** - * \fn explicit_error_stepper_base::explicit_error_stepper_base( const algebra_type &algebra = algebra_type() ) - * - * \brief Constructs a explicit_error_stepper_base class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - /** - * \fn explicit_error_stepper_base::order( void ) const - * \return Returns the order of the stepper if it used without error estimation. - */ - - /** - * \fn explicit_error_stepper_base::stepper_order( void ) const - * \return Returns the order of a step if the stepper is used without error estimation. - */ - - /** - * \fn explicit_error_stepper_base::error_order( void ) const - * \return Returns the order of an error step if the stepper is used without error estimation. - */ - - /** - * \fn explicit_error_stepper_base::do_step( System system , StateInOut &x , time_type t , time_type dt ) - * \brief This method performs one step. It transforms the result in-place. - * - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - /** - * \fn explicit_error_stepper_base::do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt ) - * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method - * the derivative of x is also passed to this method. It is supposed to be used in the following way: - * - * \code - * sys( x , dxdt , t ); - * stepper.do_step( sys , x , dxdt , t , dt ); - * \endcode - * - * The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this - * case the method could not be distinguished from other `do_step` versions. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - /** - * \fn explicit_error_stepper_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * This method is disabled if StateIn and Time are the same type. In this case the method can not be distinguished from - * other `do_step` variants. - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - - /** - * \fn explicit_error_stepper_base::do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * Furthermore, the derivative of x at t is passed to the stepper. It is supposed to be used in the following way: - * - * \code - * sys( in , dxdt , t ); - * stepper.do_step( sys , in , dxdt , t , out , dt ); - * \endcode - * - * This method is disabled if DerivIn and Time are of same type. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - /** - * \fn explicit_error_stepper_base::do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) - * \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE - * is updated in-place. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. x is updated by this method. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - * \param xerr The estimation of the error is stored in xerr. - */ - - /** - * \fn explicit_error_stepper_base::do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt , Err &xerr ) - * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method - * the derivative of x is also passed to this method. It is supposed to be used in the following way: - * - * \code - * sys( x , dxdt , t ); - * stepper.do_step( sys , x , dxdt , t , dt , xerr ); - * \endcode - * - * The result is updated in place in x. This method is disabled if Time and DerivIn are of the same type. In this - * case the method could not be distinguished from other `do_step` versions. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - * \param xerr The error estimate is stored in xerr. - */ - - /** - * \fn explicit_error_stepper_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * Furthermore, the error is estimated. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - * \param xerr The error estimate. - */ - - - /** - * \fn explicit_error_stepper_base::do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * Furthermore, the derivative of x at t is passed to the stepper and the error is estimated. It is supposed to be used in the following way: - * - * \code - * sys( in , dxdt , t ); - * stepper.do_step( sys , in , dxdt , t , out , dt ); - * \endcode - * - * This method is disabled if DerivIn and Time are of same type. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - * \param xerr The error estimate. - */ - - - /** - * \fn explicit_error_stepper_base::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} // odeint -} // numeric -} // boost - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp deleted file mode 100644 index 34381eaf27460414083dbcb1a8eb3bdfeeb9abe5..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp +++ /dev/null @@ -1,677 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp - - [begin_description] - Base class for all explicit first-same-as-last Runge Kutta steppers. - [end_description] - - Copyright 2010-2013 Karsten Ahnert - Copyright 2010-2012 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED - -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> - - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/copy.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -/* - * base class for explicit stepper and error steppers with the fsal property - * models the stepper AND the error stepper fsal concept - * - * this class provides the following do_step overloads - * do_step( sys , x , t , dt ) - * do_step( sys , x , dxdt , t , dt ) - * do_step( sys , in , t , out , dt ) - * do_step( sys , in , dxdt_in , t , out , dxdt_out , dt ) - * do_step( sys , x , t , dt , xerr ) - * do_step( sys , x , dxdt , t , dt , xerr ) - * do_step( sys , in , t , out , dt , xerr ) - * do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr ) - */ -template< -class Stepper , -unsigned short Order , -unsigned short StepperOrder , -unsigned short ErrorOrder , -class State , -class Value , -class Deriv , -class Time , -class Algebra , -class Operations , -class Resizer -> -class explicit_error_stepper_fsal_base : public algebra_stepper_base< Algebra , Operations > -{ -public: - - typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type; - typedef typename algebra_stepper_base_type::algebra_type algebra_type; - - typedef State state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef Time time_type; - typedef Resizer resizer_type; - typedef Stepper stepper_type; - typedef explicit_error_stepper_fsal_tag stepper_category; - - #ifndef DOXYGEN_SKIP - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef explicit_error_stepper_fsal_base< Stepper , Order , StepperOrder , ErrorOrder , - State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type; - #endif - - - typedef unsigned short order_type; - static const order_type order_value = Order; - static const order_type stepper_order_value = StepperOrder; - static const order_type error_order_value = ErrorOrder; - - explicit_error_stepper_fsal_base( const algebra_type &algebra = algebra_type() ) - : algebra_stepper_base_type( algebra ) , m_first_call( true ) - { } - - order_type order( void ) const - { - return order_value; - } - - order_type stepper_order( void ) const - { - return stepper_order_value; - } - - order_type error_order( void ) const - { - return error_order_value; - } - - - /* - * version 1 : do_step( sys , x , t , dt ) - * - * the two overloads are needed in order to solve the forwarding problem - */ - template< class System , class StateInOut > - void do_step( System system , StateInOut &x , time_type t , time_type dt ) - { - do_step_v1( system , x , t , dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. - */ - template< class System , class StateInOut > - void do_step( System system , const StateInOut &x , time_type t , time_type dt ) - { - do_step_v1( system , x , t , dt ); - } - - - /* - * version 2 : do_step( sys , x , dxdt , t , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - * - * the disable is needed to avoid ambiguous overloads if state_type = time_type - */ - template< class System , class StateInOut , class DerivInOut > - typename boost::disable_if< boost::is_same< StateInOut , time_type > , void >::type - do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt ) - { - m_first_call = true; - this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt ); - } - - - /* - * named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt ) - * - * this version is needed when this stepper is used for initializing - * multistep stepper like adams-bashforth. Hence we provide an explicitely - * named version that is not disabled. Meant for internal use only. - */ - template< class System , class StateInOut , class DerivInOut > - void do_step_dxdt_impl( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt ) - { - m_first_call = true; - this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt ); - } - - /* - * version 3 : do_step( sys , in , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not - * be used. - * - * the disable is needed to avoid ambiguous overloads if - * state_type = time_type - */ - template< class System , class StateIn , class StateOut > - typename boost::disable_if< boost::is_same< StateIn , time_type > , void >::type - do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - { - if( m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) - { - initialize( system , in , t ); - } - this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , m_dxdt.m_v , dt ); - } - - - /* - * version 4 : do_step( sys , in , dxdt_in , t , out , dxdt_out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System, class StateIn, class DerivIn, class StateOut, - class DerivOut > - void do_step( System system, const StateIn &in, const DerivIn &dxdt_in, - time_type t, StateOut &out, DerivOut &dxdt_out, time_type dt ) - { - m_first_call = true; - this->stepper().do_step_impl( system, in, dxdt_in, t, out, dxdt_out, - dt ); - } - - - - - - /* - * version 5 : do_step( sys , x , t , dt , xerr ) - * - * the two overloads are needed in order to solve the forwarding problem - */ - template< class System , class StateInOut , class Err > - void do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) - { - do_step_v5( system , x , t , dt , xerr ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. - */ - template< class System , class StateInOut , class Err > - void do_step( System system , const StateInOut &x , time_type t , time_type dt , Err &xerr ) - { - do_step_v5( system , x , t , dt , xerr ); - } - - - /* - * version 6 : do_step( sys , x , dxdt , t , dt , xerr ) - * - * this version does not solve the forwarding problem, boost.range can not be used - * - * the disable is needed to avoid ambiguous overloads if state_type = time_type - */ - template< class System , class StateInOut , class DerivInOut , class Err > - typename boost::disable_if< boost::is_same< StateInOut , time_type > , void >::type - do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt , Err &xerr ) - { - m_first_call = true; - this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt , xerr ); - } - - - - - /* - * version 7 : do_step( sys , in , t , out , dt , xerr ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateIn , class StateOut , class Err > - void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr ) - { - if( m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) - { - initialize( system , in , t ); - } - this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , m_dxdt.m_v , dt , xerr ); - } - - - /* - * version 8 : do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err > - void do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , - StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr ) - { - m_first_call = true; - this->stepper().do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr ); - } - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_impl( x ); - } - - void reset( void ) - { - m_first_call = true; - } - - template< class DerivIn > - void initialize( const DerivIn &deriv ) - { - boost::numeric::odeint::copy( deriv , m_dxdt.m_v ); - m_first_call = false; - } - - template< class System , class StateIn > - void initialize( System system , const StateIn &x , time_type t ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - sys( x , m_dxdt.m_v , t ); - m_first_call = false; - } - - bool is_initialized( void ) const - { - return ! m_first_call; - } - - - -private: - - template< class System , class StateInOut > - void do_step_v1( System system , StateInOut &x , time_type t , time_type dt ) - { - if( m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) - { - initialize( system , x , t ); - } - this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , m_dxdt.m_v , dt ); - } - - template< class System , class StateInOut , class Err > - void do_step_v5( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) - { - if( m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) - { - initialize( system , x , t ); - } - this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , m_dxdt.m_v , dt , xerr ); - } - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - } - - - stepper_type& stepper( void ) - { - return *static_cast< stepper_type* >( this ); - } - - const stepper_type& stepper( void ) const - { - return *static_cast< const stepper_type* >( this ); - } - - - resizer_type m_resizer; - bool m_first_call; - -protected: - - - wrapped_deriv_type m_dxdt; -}; - - -/******* DOXYGEN *******/ - -/** - * \class explicit_error_stepper_fsal_base - * \brief Base class for explicit steppers with error estimation and stepper fulfilling the FSAL (first-same-as-last) - * property. This class can be used with controlled steppers for step size control. - * - * This class serves as the base class for all explicit steppers with algebra and operations and which fulfill the FSAL - * property. In contrast to explicit_stepper_base it also estimates the error and can be used in a controlled stepper - * to provide step size control. - * - * The FSAL property means that the derivative of the system at t+dt is already used in the current step going from - * t to t +dt. Therefore, some more do_steps method can be introduced and the controlled steppers can explicitly make use - * of this property. - * - * \note This stepper provides `do_step` methods with and without error estimation. It has therefore three orders, - * one for the order of a step if the error is not estimated. The other two orders are the orders of the step and - * the error step if the error estimation is performed. - * - * explicit_error_stepper_fsal_base is used as the interface in a CRTP (currently recurring template - * pattern). In order to work correctly the parent class needs to have a method - * `do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr )`. - * explicit_error_stepper_fsal_base derives from algebra_stepper_base. - * - * This class can have an intrinsic state depending on the explicit usage of the `do_step` method. This means that some - * `do_step` methods are expected to be called in order. For example the `do_step( sys , x , t , dt , xerr )` will keep track - * of the derivative of `x` which is the internal state. The first call of this method is recognized such that one - * does not explicitly initialize the internal state, so it is safe to use this method like - * - * \code - * stepper_type stepper; - * stepper.do_step( sys , x , t , dt , xerr ); - * stepper.do_step( sys , x , t , dt , xerr ); - * stepper.do_step( sys , x , t , dt , xerr ); - * \endcode - * - * But it is unsafe to call this method with different system functions after each other. Do do so, one must initialize the - * internal state with the `initialize` method or reset the internal state with the `reset` method. - * - * explicit_error_stepper_fsal_base provides several overloaded `do_step` methods, see the list below. Only two of them are needed - * to fulfill the Error Stepper concept. The other ones are for convenience and for better performance. Some of them - * simply update the state out-of-place, while other expect that the first derivative at `t` is passed to the stepper. - * - * - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fulfill the Error Stepper concept. The - * state is updated in-place. A type modelling a Boost.Range can be used for x. - * - `do_step( sys , x , dxdt , t , dt )` - This method updates the state x and the derivative dxdt in-place. It is expected - * that dxdt has the value of the derivative of x at time t. - * - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step - * is stored in `out`. - * - `do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )` - This method updates the state and the derivative - * out-of-place. It expects that the derivative at the point `t` is explicitly passed in `dxdt_in`. - * - `do_step( sys , x , t , dt , xerr )` - This `do_step` method is needed to fulfill the Error Stepper concept. The - * state is updated in-place and an error estimate is calculated. A type modelling a Boost.Range can be used for x. - * - `do_step( sys , x , dxdt , t , dt , xerr )` - This method updates the state and the derivative in-place. It is assumed - * that the dxdt has the value of the derivative of x at time t. An error estimate is calculated. - * - `do_step( sys , in , t , out , dt , xerr )` - This method updates the state out-of-place and estimates the error - * during the step. - * - `do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr )` - This methods updates the state and the derivative - * out-of-place and estimates the error during the step. It is assumed the dxdt_in is derivative of in at time t. - * - * \note The system is always passed as value, which might result in poor performance if it contains data. In this - * case it can be used with `boost::ref` or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );` - * - * \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate` - * routines or `iterator`s. - * - * \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base - * provides the interface for the Stepper. - * \tparam Order The order of a stepper if the stepper is used without error estimation. - * \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have - * the same value. - * \tparam ErrorOrder The order of the error step if the stepper is used with error estimation. - * \tparam State The state type for the stepper. - * \tparam Value The value type for the stepper. This should be a floating point type, like float, - * double, or a multiprecision type. It must not necessary be the value_type of the State. For example - * the State can be a `vector< complex< double > >` in this case the Value must be double. - * The default value is double. - * \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the - * state type, only if used with Boost.Units both types differ. - * \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is - * used, this type has usually a unit. - * \tparam Algebra The algebra type which must fulfill the Algebra Concept. - * \tparam Operations The type for the operations which must fulfill the Operations Concept. - * \tparam Resizer The resizer policy class. - */ - - - - /** - * \fn explicit_error_stepper_fsal_base::explicit_error_stepper_fsal_base( const algebra_type &algebra ) - * \brief Constructs a explicit_stepper_fsal_base class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - - /** - * \fn explicit_error_stepper_fsal_base::order( void ) const - * \return Returns the order of the stepper if it used without error estimation. - */ - - /** - * \fn explicit_error_stepper_fsal_base::stepper_order( void ) const - * \return Returns the order of a step if the stepper is used without error estimation. - */ - - - /** - * \fn explicit_error_stepper_fsal_base::error_order( void ) const - * \return Returns the order of an error step if the stepper is used without error estimation. - */ - - /** - * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , time_type t , time_type dt ) - * \brief This method performs one step. It transforms the result in-place. - * - * \note This method uses the internal state of the stepper. - * - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - - /** - * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt ) - * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other methods - * the derivative of x is also passed to this method. Therefore, dxdt must be evaluated initially: - * - * \code - * ode( x , dxdt , t ); - * for( ... ) - * { - * stepper.do_step( ode , x , dxdt , t , dt ); - * t += dt; - * } - * \endcode - * - * \note This method does NOT use the initial state, since the first derivative is explicitly passed to this method. - * - * The result is updated in place in x as well as the derivative dxdt. This method is disabled if - * Time and StateInOut are of the same type. In this case the method could not be distinguished from other `do_step` - * versions. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param dxdt The derivative of x at t. After calling `do_step` dxdt is updated to the new value. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - /** - * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * This method is disabled if StateIn and Time are the same type. In this case the method can not be distinguished from - * other `do_step` variants. - * - * \note This method uses the internal state of the stepper. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - /** - * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , StateOut &out , DerivOut &dxdt_out , time_type dt ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * Furthermore, the derivative of x at t is passed to the stepper and updated by the stepper to its new value at - * t+dt. - * - * \note This method does not solve the forwarding problem. - * - * \note This method does NOT use the internal state of the stepper. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt_in The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dxdt_out The updated derivative of `out` at `t+dt`. - * \param dt The step size. - */ - - /** - * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) - * \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE - * is updated in-place. - * - * - * \note This method uses the internal state of the stepper. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. x is updated by this method. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - * \param xerr The estimation of the error is stored in xerr. - */ - - /** - * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt , Err &xerr ) - * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method - * the derivative of x is also passed to this method and updated by this method. - * - * \note This method does NOT use the internal state of the stepper. - * - * The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this - * case the method could not be distinguished from other `do_step` versions. This method is disabled if StateInOut and - * Time are of the same type. - * - * \note This method does NOT use the internal state of the stepper. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param dxdt The derivative of x at t. After calling `do_step` this value is updated to the new value at `t+dt`. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - * \param xerr The error estimate is stored in xerr. - */ - - - /** - * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * Furthermore, the error is estimated. - * - * \note This method uses the internal state of the stepper. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - * \param xerr The error estimate. - */ - - /** - * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr ) - * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. - * Furthermore, the derivative of x at t is passed to the stepper and the error is estimated. - * - * \note This method does NOT use the internal state of the stepper. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt_in The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dxdt_out The new derivative at `t+dt` is written into this variable. - * \param dt The step size. - * \param xerr The error estimate. - */ - - /** - * \fn explicit_error_stepper_fsal_base::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - - /** - * \fn explicit_error_stepper_fsal_base::reset( void ) - * \brief Resets the internal state of this stepper. After calling this method it is safe to use all - * `do_step` method without explicitly initializing the stepper. - */ - - /** - * \fn explicit_error_stepper_fsal_base::initialize( const DerivIn &deriv ) - * \brief Initializes the internal state of the stepper. - * \param deriv The derivative of x. The next call of `do_step` expects that the derivative of `x` passed to `do_step` - * has the value of `deriv`. - */ - - /** - * \fn explicit_error_stepper_fsal_base::initialize( System system , const StateIn &x , time_type t ) - * \brief Initializes the internal state of the stepper. - * - * This method is equivalent to - * \code - * Deriv dxdt; - * system( x , dxdt , t ); - * stepper.initialize( dxdt ); - * \endcode - * - * \param system The system function for the next calls of `do_step`. - * \param x The current state of the ODE. - * \param t The current time of the ODE. - */ - - /** - * \fn explicit_error_stepper_fsal_base::is_initialized( void ) const - * \brief Returns if the stepper is already initialized. If the stepper is not initialized, the first - * call of `do_step` will initialize the state of the stepper. If the stepper is already initialized - * the system function can not be safely exchanged between consecutive `do_step` calls. - */ - -} // odeint -} // numeric -} // boost - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp deleted file mode 100644 index 4dca52572973871ab20f278cd31192e8c6919a2a..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp +++ /dev/null @@ -1,415 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp - - [begin_description] - Base class for all explicit Runge Kutta steppers. - [end_description] - - Copyright 2010-2013 Karsten Ahnert - Copyright 2010-2012 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED - - -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -/* - * base class for explicit steppers - * models the stepper concept - * - * this class provides the following overloads - * do_step( sys , x , t , dt ) - * do_step( sys , in , t , out , dt ) - * do_step( sys , x , dxdt_in , t , dt ) - * do_step( sys , in , dxdt_in , t , out , dt ) - */ - -template< -class Stepper , -unsigned short Order , -class State , -class Value , -class Deriv , -class Time , -class Algebra , -class Operations , -class Resizer -> -class explicit_stepper_base : public algebra_stepper_base< Algebra , Operations > -{ -public: - - #ifndef DOXYGEN_SKIP - typedef explicit_stepper_base< Stepper , Order , State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type; - #endif // DOXYGEN_SKIP - - - typedef State state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef Time time_type; - typedef Resizer resizer_type; - typedef Stepper stepper_type; - typedef stepper_tag stepper_category; - typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type; - typedef typename algebra_stepper_base_type::algebra_type algebra_type; - typedef typename algebra_stepper_base_type::operations_type operations_type; - typedef unsigned short order_type; - - #ifndef DOXYGEN_SKIP - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - #endif // DOXYGEN_SKIP - - - static const order_type order_value = Order; - - - explicit_stepper_base( const algebra_type &algebra = algebra_type() ) - : algebra_stepper_base_type( algebra ) - { } - - /** - * \return Returns the order of the stepper. - */ - order_type order( void ) const - { - return order_value; - } - - - /* - * Version 1 : do_step( sys , x , t , dt ) - * - * the two overloads are needed in order to solve the forwarding problem - */ - template< class System , class StateInOut > - void do_step( System system , StateInOut &x , time_type t , time_type dt ) - { - do_step_v1( system , x , t , dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. - */ - template< class System , class StateInOut > - void do_step( System system , const StateInOut &x , time_type t , time_type dt ) - { - do_step_v1( system , x , t , dt ); - } - - /* - * Version 2 : do_step( sys , x , dxdt , t , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - * - * the disable is needed to avoid ambiguous overloads if state_type = time_type - */ - template< class System , class StateInOut , class DerivIn > - typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type - do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt ) - { - this->stepper().do_step_impl( system , x , dxdt , t , x , dt ); - } - - - /* - * named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt ) - * - * this version is needed when this stepper is used for initializing - * multistep stepper like adams-bashforth. Hence we provide an explicitely - * named version that is not disabled. Meant for internal use only. - */ - template < class System, class StateInOut, class DerivIn > - void do_step_dxdt_impl( System system, StateInOut &x, const DerivIn &dxdt, - time_type t, time_type dt ) - { - this->stepper().do_step_impl( system , x , dxdt , t , x , dt ); - } - - - /* - * Version 3 : do_step( sys , in , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateIn , class StateOut > - void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); - sys( in , m_dxdt.m_v ,t ); - this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt ); - } - - - /* - * Version 4 : do_step( sys , in , dxdt , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateIn , class DerivIn , class StateOut > - void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - { - this->stepper().do_step_impl( system , in , dxdt , t , out , dt ); - } - - - /* - * named Version 4: do_step_dxdt_impl( sys , in , dxdt , t , out, dt ) - * - * this version is needed when this stepper is used for initializing - * multistep stepper like adams-bashforth. Hence we provide an explicitely - * named version. Meant for internal use only. - */ - template < class System, class StateIn, class DerivIn, class StateOut > - void do_step_dxdt_impl( System system, const StateIn &in, - const DerivIn &dxdt, time_type t, StateOut &out, - time_type dt ) - { - this->stepper().do_step_impl( system , in , dxdt , t , out , dt ); - } - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_impl( x ); - } - -private: - - stepper_type& stepper( void ) - { - return *static_cast< stepper_type* >( this ); - } - - const stepper_type& stepper( void ) const - { - return *static_cast< const stepper_type* >( this ); - } - - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - } - - - template< class System , class StateInOut > - void do_step_v1( System system , StateInOut &x , time_type t , time_type dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - sys( x , m_dxdt.m_v ,t ); - this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt ); - } - - - resizer_type m_resizer; - -protected: - - wrapped_deriv_type m_dxdt; -}; - - -/******* DOXYGEN *********/ - -/** - * \class explicit_stepper_base - * \brief Base class for explicit steppers without step size control and without dense output. - * - * This class serves as the base class for all explicit steppers with algebra and operations. - * Step size control and error estimation as well as dense output are not provided. explicit_stepper_base - * is used as the interface in a CRTP (currently recurring template pattern). In order to work - * correctly the parent class needs to have a method `do_step_impl( system , in , dxdt_in , t , out , dt )`. - * This is method is used by explicit_stepper_base. explicit_stepper_base derives from - * algebra_stepper_base. An example how this class can be used is - * - * \code - * template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resizer > - * class custom_euler : public explicit_stepper_base< 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > - * { - * public: - * - * typedef explicit_stepper_base< 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > base_type; - * - * custom_euler( const Algebra &algebra = Algebra() ) { } - * - * template< class Sys , class StateIn , class DerivIn , class StateOut > - * void do_step_impl( Sys sys , const StateIn &in , const DerivIn &dxdt , Time t , StateOut &out , Time dt ) - * { - * m_algebra.for_each3( out , in , dxdt , Operations::scale_sum2< Value , Time >( 1.0 , dt ); - * } - * - * template< class State > - * void adjust_size( const State &x ) - * { - * base_type::adjust_size( x ); - * } - * }; - * \endcode - * - * For the Stepper concept only the `do_step( sys , x , t , dt )` needs to be implemented. But this class - * provides additional `do_step` variants since the stepper is explicit. These methods can be used to increase - * the performance in some situation, for example if one needs to analyze `dxdt` during each step. In this case - * one can use - * - * \code - * sys( x , dxdt , t ); - * stepper.do_step( sys , x , dxdt , t , dt ); // the value of dxdt is used here - * t += dt; - * \endcode - * - * In detail explicit_stepper_base provides the following `do_step` variants - * - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fulfill the Stepper concept. The state is updated in-place. - * A type modelling a Boost.Range can be used for x. - * - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step is stored in `out`. - * - `do_step( sys , x , dxdt , t , dt )` - This method updates the state in-place, but the derivative at the point `t` must be - * explicitly passed in `dxdt`. For an example see the code snippet above. - * - `do_step( sys , in , dxdt , t , out , dt )` - This method update the state out-of-place and expects that the derivative at the point - * `t` is explicitly passed in `dxdt`. It is a combination of the two `do_step` methods above. - * - * \note The system is always passed as value, which might result in poor performance if it contains data. In this case it can be used with `boost::ref` - * or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );` - * - * \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate` routines or `iterator`s. - * - * \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base - * provides the interface for the Stepper. - * \tparam Order The order of the stepper. - * \tparam State The state type for the stepper. - * \tparam Value The value type for the stepper. This should be a floating point type, like float, - * double, or a multiprecision type. It must not necessary be the value_type of the State. For example - * the State can be a `vector< complex< double > >` in this case the Value must be double. - * The default value is double. - * \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the - * state type, only if used with Boost.Units both types differ. - * \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is - * used, this type has usually a unit. - * \tparam Algebra The algebra type which must fulfill the Algebra Concept. - * \tparam Operations The type for the operations which must fulfill the Operations Concept. - * \tparam Resizer The resizer policy class. - */ - - - /** - * \fn explicit_stepper_base::explicit_stepper_base( const algebra_type &algebra ) - * \brief Constructs a explicit_stepper_base class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - /** - * \fn explicit_stepper_base::order_type order( void ) const - * \return Returns the order of the stepper. - */ - - /** - * \fn explicit_stepper_base::do_step( System system , StateInOut &x , time_type t , time_type dt ) - * \brief This method performs one step. It transforms the result in-place. - * - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - - /** - * \fn explicit_stepper_base::do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt ) - - * \brief The method performs one step. Additionally to the other method - * the derivative of x is also passed to this method. It is supposed to be used in the following way: - * - * \code - * sys( x , dxdt , t ); - * stepper.do_step( sys , x , dxdt , t , dt ); - * \endcode - * - * The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this - * case the method could not be distinguished from other `do_step` versions. - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - /** - * \fn void explicit_stepper_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - * \brief The method performs one step. The state of the ODE is updated out-of-place. - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - /** - * \fn void explicit_stepper_base::do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - * \brief The method performs one step. The state of the ODE is updated out-of-place. - * Furthermore, the derivative of x at t is passed to the stepper. - * It is supposed to be used in the following way: - * - * \code - * sys( in , dxdt , t ); - * stepper.do_step( sys , in , dxdt , t , out , dt ); - * \endcode - * - * \note This method does not solve the forwarding problem. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - /** - * \fn void explicit_stepper_base::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} // odeint -} // numeric -} // boost - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp deleted file mode 100644 index e026b068c6610d6200ba655a825a6f27e4754671..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp +++ /dev/null @@ -1,431 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp - - [begin_description] - Base class for symplectic Runge-Kutta-Nystrom steppers. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2013 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_SYMPLECTIC_RKN_STEPPER_BASE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_SYMPLECTIC_RKN_STEPPER_BASE_HPP_INCLUDED - -#include <boost/array.hpp> - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> - -#include <boost/numeric/odeint/util/copy.hpp> -#include <boost/numeric/odeint/util/is_pair.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp> - - - - -namespace boost { -namespace numeric { -namespace odeint { - - -template< -size_t NumOfStages , -unsigned short Order , -class Coor , -class Momentum , -class Value , -class CoorDeriv , -class MomentumDeriv , -class Time , -class Algebra , -class Operations , -class Resizer -> -class symplectic_nystroem_stepper_base : public algebra_stepper_base< Algebra , Operations > -{ - -public: - - typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type; - typedef typename algebra_stepper_base_type::algebra_type algebra_type; - typedef typename algebra_stepper_base_type::operations_type operations_type; - - const static size_t num_of_stages = NumOfStages; - typedef Coor coor_type; - typedef Momentum momentum_type; - typedef std::pair< coor_type , momentum_type > state_type; - typedef CoorDeriv coor_deriv_type; - typedef state_wrapper< coor_deriv_type> wrapped_coor_deriv_type; - typedef MomentumDeriv momentum_deriv_type; - typedef state_wrapper< momentum_deriv_type > wrapped_momentum_deriv_type; - typedef std::pair< coor_deriv_type , momentum_deriv_type > deriv_type; - typedef Value value_type; - typedef Time time_type; - typedef Resizer resizer_type; - typedef stepper_tag stepper_category; - - #ifndef DOXYGEN_SKIP - typedef symplectic_nystroem_stepper_base< NumOfStages , Order , Coor , Momentum , Value , - CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type; - #endif - typedef unsigned short order_type; - - static const order_type order_value = Order; - - typedef boost::array< value_type , num_of_stages > coef_type; - - symplectic_nystroem_stepper_base( const coef_type &coef_a , const coef_type &coef_b , const algebra_type &algebra = algebra_type() ) - : algebra_stepper_base_type( algebra ) , m_coef_a( coef_a ) , m_coef_b( coef_b ) , - m_dqdt_resizer() , m_dpdt_resizer() , m_dqdt() , m_dpdt() - { } - - - order_type order( void ) const - { - return order_value; - } - - /* - * Version 1 : do_step( system , x , t , dt ) - * - * This version does not solve the forwarding problem, boost.range can not be used. - */ - template< class System , class StateInOut > - void do_step( System system , const StateInOut &state , time_type t , time_type dt ) - { - typedef typename odeint::unwrap_reference< System >::type system_type; - do_step_impl( system , state , t , state , dt , typename is_pair< system_type >::type() ); - } - - /** - * \brief Same function as above. It differs only in a different const specifier in order - * to solve the forwarding problem, can be used with Boost.Range. - */ - template< class System , class StateInOut > - void do_step( System system , StateInOut &state , time_type t , time_type dt ) - { - typedef typename odeint::unwrap_reference< System >::type system_type; - do_step_impl( system , state , t , state , dt , typename is_pair< system_type >::type() ); - } - - - - - /* - * Version 2 : do_step( system , q , p , t , dt ); - * - * For Convenience - * - * The two overloads are needed in order to solve the forwarding problem. - */ - template< class System , class CoorInOut , class MomentumInOut > - void do_step( System system , CoorInOut &q , MomentumInOut &p , time_type t , time_type dt ) - { - do_step( system , std::make_pair( detail::ref( q ) , detail::ref( p ) ) , t , dt ); - } - - /** - * \brief Same function as do_step( system , q , p , t , dt ). It differs only in a different const specifier in order - * to solve the forwarding problem, can be called with Boost.Range. - */ - template< class System , class CoorInOut , class MomentumInOut > - void do_step( System system , const CoorInOut &q , const MomentumInOut &p , time_type t , time_type dt ) - { - do_step( system , std::make_pair( detail::ref( q ) , detail::ref( p ) ) , t , dt ); - } - - - - - - /* - * Version 3 : do_step( system , in , t , out , dt ) - * - * The forwarding problem is not solved in this version - */ - template< class System , class StateIn , class StateOut > - void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - { - typedef typename odeint::unwrap_reference< System >::type system_type; - do_step_impl( system , in , t , out , dt , typename is_pair< system_type >::type() ); - } - - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_dqdt( x ); - resize_dpdt( x ); - } - - /** \brief Returns the coefficients a. */ - const coef_type& coef_a( void ) const { return m_coef_a; } - - /** \brief Returns the coefficients b. */ - const coef_type& coef_b( void ) const { return m_coef_b; } - -private: - - // stepper for systems with function for dq/dt = f(p) and dp/dt = -f(q) - template< class System , class StateIn , class StateOut > - void do_step_impl( System system , const StateIn &in , time_type /* t */ , StateOut &out , time_type dt , boost::mpl::true_ ) - { - typedef typename odeint::unwrap_reference< System >::type system_type; - typedef typename odeint::unwrap_reference< typename system_type::first_type >::type coor_deriv_func_type; - typedef typename odeint::unwrap_reference< typename system_type::second_type >::type momentum_deriv_func_type; - system_type &sys = system; - coor_deriv_func_type &coor_func = sys.first; - momentum_deriv_func_type &momentum_func = sys.second; - - typedef typename odeint::unwrap_reference< StateIn >::type state_in_type; - typedef typename odeint::unwrap_reference< typename state_in_type::first_type >::type coor_in_type; - typedef typename odeint::unwrap_reference< typename state_in_type::second_type >::type momentum_in_type; - const state_in_type &state_in = in; - const coor_in_type &coor_in = state_in.first; - const momentum_in_type &momentum_in = state_in.second; - - typedef typename odeint::unwrap_reference< StateOut >::type state_out_type; - typedef typename odeint::unwrap_reference< typename state_out_type::first_type >::type coor_out_type; - typedef typename odeint::unwrap_reference< typename state_out_type::second_type >::type momentum_out_type; - state_out_type &state_out = out; - coor_out_type &coor_out = state_out.first; - momentum_out_type &momentum_out = state_out.second; - - m_dqdt_resizer.adjust_size( coor_in , detail::bind( &internal_stepper_base_type::template resize_dqdt< coor_in_type > , detail::ref( *this ) , detail::_1 ) ); - m_dpdt_resizer.adjust_size( momentum_in , detail::bind( &internal_stepper_base_type::template resize_dpdt< momentum_in_type > , detail::ref( *this ) , detail::_1 ) ); - - // ToDo: check sizes? - - for( size_t l=0 ; l<num_of_stages ; ++l ) - { - if( l == 0 ) - { - coor_func( momentum_in , m_dqdt.m_v ); - this->m_algebra.for_each3( coor_out , coor_in , m_dqdt.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) ); - momentum_func( coor_out , m_dpdt.m_v ); - this->m_algebra.for_each3( momentum_out , momentum_in , m_dpdt.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * dt ) ); - } - else - { - coor_func( momentum_out , m_dqdt.m_v ); - this->m_algebra.for_each3( coor_out , coor_out , m_dqdt.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) ); - momentum_func( coor_out , m_dpdt.m_v ); - this->m_algebra.for_each3( momentum_out , momentum_out , m_dpdt.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * dt ) ); - } - } - } - - - // stepper for systems with only function dp /dt = -f(q), dq/dt = p, time not required but still expected for compatibility reasons - template< class System , class StateIn , class StateOut > - void do_step_impl( System system , const StateIn &in , time_type /* t */ , StateOut &out , time_type dt , boost::mpl::false_ ) - { - typedef typename odeint::unwrap_reference< System >::type momentum_deriv_func_type; - momentum_deriv_func_type &momentum_func = system; - - typedef typename odeint::unwrap_reference< StateIn >::type state_in_type; - typedef typename odeint::unwrap_reference< typename state_in_type::first_type >::type coor_in_type; - typedef typename odeint::unwrap_reference< typename state_in_type::second_type >::type momentum_in_type; - const state_in_type &state_in = in; - const coor_in_type &coor_in = state_in.first; - const momentum_in_type &momentum_in = state_in.second; - - typedef typename odeint::unwrap_reference< StateOut >::type state_out_type; - typedef typename odeint::unwrap_reference< typename state_out_type::first_type >::type coor_out_type; - typedef typename odeint::unwrap_reference< typename state_out_type::second_type >::type momentum_out_type; - state_out_type &state_out = out; - coor_out_type &coor_out = state_out.first; - momentum_out_type &momentum_out = state_out.second; - - - // m_dqdt not required when called with momentum_func only - don't resize - // m_dqdt_resizer.adjust_size( coor_in , detail::bind( &internal_stepper_base_type::template resize_dqdt< coor_in_type > , detail::ref( *this ) , detail::_1 ) ); - m_dpdt_resizer.adjust_size( momentum_in , detail::bind( &internal_stepper_base_type::template resize_dpdt< momentum_in_type > , detail::ref( *this ) , detail::_1 ) ); - - - // ToDo: check sizes? - - // step 0 - this->m_algebra.for_each3( coor_out , coor_in , momentum_in , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[0] * dt ) ); - momentum_func( coor_out , m_dpdt.m_v ); - this->m_algebra.for_each3( momentum_out , momentum_in , m_dpdt.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[0] * dt ) ); - - for( size_t l=1 ; l<num_of_stages ; ++l ) - { - this->m_algebra.for_each3( coor_out , coor_out , momentum_out , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) ); - momentum_func( coor_out , m_dpdt.m_v ); - this->m_algebra.for_each3( momentum_out , momentum_out , m_dpdt.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * dt ) ); - } - } - - template< class StateIn > - bool resize_dqdt( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dqdt , x , typename is_resizeable<coor_deriv_type>::type() ); - } - - template< class StateIn > - bool resize_dpdt( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dpdt , x , typename is_resizeable<momentum_deriv_type>::type() ); - } - - - const coef_type m_coef_a; - const coef_type m_coef_b; - - resizer_type m_dqdt_resizer; - resizer_type m_dpdt_resizer; - wrapped_coor_deriv_type m_dqdt; - wrapped_momentum_deriv_type m_dpdt; - -}; - -/********* DOXYGEN *********/ - -/** - * \class symplectic_nystroem_stepper_base - * \brief Base class for all symplectic steppers of Nystroem type. - * - * This class is the base class for the symplectic Runge-Kutta-Nystroem steppers. Symplectic steppers are usually - * used to solve Hamiltonian systems and they conserve the phase space volume, see - * <a href="http://en.wikipedia.org/wiki/Symplectic_integrator">en.wikipedia.org/wiki/Symplectic_integrator</a>. - * Furthermore, the energy is conserved - * in average. In detail this class of steppers can be used to solve separable Hamiltonian systems which can be written - * in the form H(q,p) = H1(p) + H2(q). q is usually called the coordinate, while p is the momentum. The equations of motion - * are dq/dt = dH1/dp, dp/dt = -dH2/dq. - * - * ToDo : add formula for solver and explanation of the coefficients - * - * symplectic_nystroem_stepper_base uses odeints algebra and operation system. Step size and error estimation are not - * provided for this class of solvers. It derives from algebra_stepper_base. Several `do_step` variants are provided: - * - * - `do_step( sys , x , t , dt )` - The classical `do_step` method. The sys can be either a pair of function objects - * for the coordinate or the momentum part or one function object for the momentum part. `x` is a pair of coordinate - * and momentum. The state is updated in-place. - * - `do_step( sys , q , p , t , dt )` - This method is similar to the method above with the difference that the coordinate - * and the momentum are passed explicitly and not packed into a pair. - * - `do_step( sys , x_in , t , x_out , dt )` - This method transforms the state out-of-place. `x_in` and `x_out` are here pairs - * of coordinate and momentum. - * - * \tparam NumOfStages Number of stages. - * \tparam Order The order of the stepper. - * \tparam Coor The type representing the coordinates q. - * \tparam Momentum The type representing the coordinates p. - * \tparam Value The basic value type. Should be something like float, double or a high-precision type. - * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt. - * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt. - * \tparam Time The type representing the time t. - * \tparam Algebra The algebra. - * \tparam Operations The operations. - * \tparam Resizer The resizer policy. - */ - - /** - * \fn symplectic_nystroem_stepper_base::symplectic_nystroem_stepper_base( const coef_type &coef_a , const coef_type &coef_b , const algebra_type &algebra ) - * \brief Constructs a symplectic_nystroem_stepper_base class. The parameters of the specific Nystroem method and the - * algebra have to be passed. - * \param coef_a The coefficients a. - * \param coef_b The coefficients b. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - /** - * \fn symplectic_nystroem_stepper_base::order( void ) const - * \return Returns the order of the stepper. - */ - - /** - * \fn symplectic_nystroem_stepper_base::do_step( System system , const StateInOut &state , time_type t , time_type dt ) - * \brief This method performs one step. The system can be either a pair of two function object - * describing the momentum part and the coordinate part or one function object describing only - * the momentum part. In this case the coordinate is assumed to be trivial dq/dt = p. The state - * is updated in-place. - * - * \note boost::ref or std::ref can be used for the system as well as for the state. So, it is correct - * to write `stepper.do_step( make_pair( std::ref( fq ) , std::ref( fp ) ) , make_pair( std::ref( q ) , std::ref( p ) ) , t , dt )`. - * - * \note This method solves the forwarding problem. - * - * \param system The system, can be represented as a pair of two function object or one function object. See above. - * \param state The state of the ODE. It is a pair of Coor and Momentum. The state is updated in-place, therefore, the - * new value of the state will be written into this variable. - * \param t The time of the ODE. It is not advanced by this method. - * \param dt The time step. - */ - - /** - * \fn symplectic_nystroem_stepper_base::do_step( System system , CoorInOut &q , MomentumInOut &p , time_type t , time_type dt ) - * \brief This method performs one step. The system can be either a pair of two function object - * describing the momentum part and the coordinate part or one function object describing only - * the momentum part. In this case the coordinate is assumed to be trivial dq/dt = p. The state - * is updated in-place. - * - * \note boost::ref or std::ref can be used for the system. So, it is correct - * to write `stepper.do_step( make_pair( std::ref( fq ) , std::ref( fp ) ) , q , p , t , dt )`. - * - * \note This method solves the forwarding problem. - * - * \param system The system, can be represented as a pair of two function object or one function object. See above. - * \param q The coordinate of the ODE. It is updated in-place. Therefore, the new value of the coordinate will be written - * into this variable. - * \param p The momentum of the ODE. It is updated in-place. Therefore, the new value of the momentum will be written info - * this variable. - * \param t The time of the ODE. It is not advanced by this method. - * \param dt The time step. - */ - - /** - * \fn symplectic_nystroem_stepper_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) - * \brief This method performs one step. The system can be either a pair of two function object - * describing the momentum part and the coordinate part or one function object describing only - * the momentum part. In this case the coordinate is assumed to be trivial dq/dt = p. The state - * is updated out-of-place. - * - * \note boost::ref or std::ref can be used for the system. So, it is correct - * to write `stepper.do_step( make_pair( std::ref( fq ) , std::ref( fp ) ) , x_in , t , x_out , dt )`. - * - * \note This method NOT solve the forwarding problem. - * - * \param system The system, can be represented as a pair of two function object or one function object. See above. - * \param in The state of the ODE, which is a pair of coordinate and momentum. The state is updated out-of-place, therefore the - * new value is written into out - * \param t The time of the ODE. It is not advanced by this method. - * \param out The new state of the ODE. - * \param dt The time step. - */ - - /** - * \fn symplectic_nystroem_stepper_base::adjust_size( const StateType &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_SYMPLECTIC_RKN_STEPPER_BASE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/bulirsch_stoer.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/bulirsch_stoer.hpp deleted file mode 100644 index 0f5553fdd248aed8b883334f16c819f45c428a94..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/bulirsch_stoer.hpp +++ /dev/null @@ -1,642 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/bulirsch_stoer.hpp - - [begin_description] - Implementation of the Burlish-Stoer method. As described in - Ernst Hairer, Syvert Paul Norsett, Gerhard Wanner - Solving Ordinary Differential Equations I. Nonstiff Problems. - Springer Series in Comput. Mathematics, Vol. 8, Springer-Verlag 1987, Second revised edition 1993. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED - - -#include <iostream> - -#include <algorithm> - -#include <boost/config.hpp> // for min/max guidelines - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/modified_midpoint.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< - class State , - class Value = double , - class Deriv = State , - class Time = Value , - class Algebra = typename algebra_dispatcher< State >::algebra_type , - class Operations = typename operations_dispatcher< State >::operations_type , - class Resizer = initially_resizer - > -class bulirsch_stoer { - -public: - - typedef State state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef Time time_type; - typedef Algebra algebra_type; - typedef Operations operations_type; - typedef Resizer resizer_type; -#ifndef DOXYGEN_SKIP - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef controlled_stepper_tag stepper_category; - - typedef bulirsch_stoer< State , Value , Deriv , Time , Algebra , Operations , Resizer > controlled_error_bs_type; - - typedef typename inverse_time< time_type >::type inv_time_type; - - typedef std::vector< value_type > value_vector; - typedef std::vector< time_type > time_vector; - typedef std::vector< inv_time_type > inv_time_vector; //should be 1/time_type for boost.units - typedef std::vector< value_vector > value_matrix; - typedef std::vector< size_t > int_vector; - typedef std::vector< wrapped_state_type > state_table_type; -#endif //DOXYGEN_SKIP - const static size_t m_k_max = 8; - - bulirsch_stoer( - value_type eps_abs = 1E-6 , value_type eps_rel = 1E-6 , - value_type factor_x = 1.0 , value_type factor_dxdt = 1.0 , - time_type max_dt = static_cast<time_type>(0)) - : m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) , m_midpoint() , - m_last_step_rejected( false ) , m_first( true ) , - m_max_dt(max_dt) , - m_interval_sequence( m_k_max+1 ) , - m_coeff( m_k_max+1 ) , - m_cost( m_k_max+1 ) , - m_facmin_table( m_k_max+1 ) , - m_table( m_k_max ) , - STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 ) - { - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - /* initialize sequence of stage numbers and work */ - for( unsigned short i = 0; i < m_k_max+1; i++ ) - { - m_interval_sequence[i] = 2 * (i+1); - if( i == 0 ) - m_cost[i] = m_interval_sequence[i]; - else - m_cost[i] = m_cost[i-1] + m_interval_sequence[i]; - m_coeff[i].resize(i); - m_facmin_table[i] = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , static_cast< value_type >(1) / static_cast< value_type >( 2*i+1 ) ); - for( size_t k = 0 ; k < i ; ++k ) - { - const value_type r = static_cast< value_type >( m_interval_sequence[i] ) / static_cast< value_type >( m_interval_sequence[k] ); - m_coeff[i][k] = 1.0 / ( r*r - static_cast< value_type >( 1.0 ) ); // coefficients for extrapolation - } - } - reset(); - } - - - /* - * Version 1 : try_step( sys , x , t , dt ) - * - * The overloads are needed to solve the forwarding problem - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt ) - { - return try_step_v1( system , x , t, dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be used with Boost.Range as StateInOut. - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt ) - { - return try_step_v1( system , x , t, dt ); - } - - /* - * Version 2 : try_step( sys , x , dxdt , t , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateInOut , class DerivIn > - controlled_step_result try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt ) - { - m_xnew_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_xnew< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , dt ); - if( res == success ) - { - boost::numeric::odeint::copy( m_xnew.m_v , x ); - } - return res; - } - - /* - * Version 3 : try_step( sys , in , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateIn , class StateOut > - typename boost::disable_if< boost::is_same< StateIn , time_type > , controlled_step_result >::type - try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateIn > , detail::ref( *this ) , detail::_1 ) ); - sys( in , m_dxdt.m_v , t ); - return try_step( system , in , m_dxdt.m_v , t , out , dt ); - } - - - /* - * Full version : try_step( sys , in , dxdt_in , t , out , dt ) - * - * contains the actual implementation - */ - template< class System , class StateIn , class DerivIn , class StateOut > - controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt ) - { - if( m_max_dt != static_cast<time_type>(0) && detail::less_with_sign(m_max_dt, dt, dt) ) - { - // given step size is bigger then max_dt - // set limit and return fail - dt = m_max_dt; - return fail; - } - - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - - static const value_type val1( 1.0 ); - - if( m_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) ) - { - reset(); // system resized -> reset - } - - if( dt != m_dt_last ) - { - reset(); // step size changed from outside -> reset - } - - bool reject( true ); - - time_vector h_opt( m_k_max+1 ); - inv_time_vector work( m_k_max+1 ); - - time_type new_h = dt; - - /* m_current_k_opt is the estimated current optimal stage number */ - for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ ) - { - /* the stage counts are stored in m_interval_sequence */ - m_midpoint.set_steps( m_interval_sequence[k] ); - if( k == 0 ) - { - m_midpoint.do_step( system , in , dxdt , t , out , dt ); - /* the first step, nothing more to do */ - } - else - { - m_midpoint.do_step( system , in , dxdt , t , m_table[k-1].m_v , dt ); - extrapolate( k , m_table , m_coeff , out ); - // get error estimate - m_algebra.for_each3( m_err.m_v , out , m_table[0].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( val1 , -val1 ) ); - const value_type error = m_error_checker.error( m_algebra , in , dxdt , m_err.m_v , dt ); - h_opt[k] = calc_h_opt( dt , error , k ); - work[k] = static_cast<value_type>( m_cost[k] ) / h_opt[k]; - - if( (k == m_current_k_opt-1) || m_first ) - { // convergence before k_opt ? - if( error < 1.0 ) - { - //convergence - reject = false; - if( (work[k] < KFAC2*work[k-1]) || (m_current_k_opt <= 2) ) - { - // leave order as is (except we were in first round) - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k)+1 ) ); - new_h = h_opt[k]; - new_h *= static_cast<value_type>( m_cost[k+1] ) / static_cast<value_type>( m_cost[k] ); - } else { - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k) ) ); - new_h = h_opt[k]; - } - break; - } - else if( should_reject( error , k ) && !m_first ) - { - reject = true; - new_h = h_opt[k]; - break; - } - } - if( k == m_current_k_opt ) - { // convergence at k_opt ? - if( error < 1.0 ) - { - //convergence - reject = false; - if( (work[k-1] < KFAC2*work[k]) ) - { - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 ); - new_h = h_opt[m_current_k_opt]; - } - else if( (work[k] < KFAC2*work[k-1]) && !m_last_step_rejected ) - { - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max-1) , static_cast<int>(m_current_k_opt)+1 ); - new_h = h_opt[k]; - new_h *= static_cast<value_type>(m_cost[m_current_k_opt])/static_cast<value_type>(m_cost[k]); - } else - new_h = h_opt[m_current_k_opt]; - break; - } - else if( should_reject( error , k ) ) - { - reject = true; - new_h = h_opt[m_current_k_opt]; - break; - } - } - if( k == m_current_k_opt+1 ) - { // convergence at k_opt+1 ? - if( error < 1.0 ) - { //convergence - reject = false; - if( work[k-2] < KFAC2*work[k-1] ) - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 ); - if( (work[k] < KFAC2*work[m_current_k_opt]) && !m_last_step_rejected ) - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(k) ); - new_h = h_opt[m_current_k_opt]; - } else - { - reject = true; - new_h = h_opt[m_current_k_opt]; - } - break; - } - } - } - - if( !reject ) - { - t += dt; - } - - if( !m_last_step_rejected || boost::numeric::odeint::detail::less_with_sign(new_h, dt, dt) ) - { - // limit step size - if( m_max_dt != static_cast<time_type>(0) ) - { - new_h = detail::min_abs(m_max_dt, new_h); - } - m_dt_last = new_h; - dt = new_h; - } - - m_last_step_rejected = reject; - m_first = false; - - if( reject ) - return fail; - else - return success; - } - - /** \brief Resets the internal state of the stepper */ - void reset() - { - m_first = true; - m_last_step_rejected = false; - // crude estimate of optimal order - m_current_k_opt = 4; - /* no calculation because log10 might not exist for value_type! - const value_type logfact( -log10( max BOOST_PREVENT_MACRO_SUBSTITUTION( eps_rel , static_cast< value_type >(1.0E-12) ) ) * 0.6 + 0.5 ); - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>( 1 ) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>( m_k_max-1 ) , logfact )); - */ - } - - - /* Resizer methods */ - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_m_dxdt( x ); - resize_m_xnew( x ); - resize_impl( x ); - m_midpoint.adjust_size( x ); - } - - -private: - - template< class StateIn > - bool resize_m_dxdt( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - } - - template< class StateIn > - bool resize_m_xnew( const StateIn &x ) - { - return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() ); - } - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized( false ); - for( size_t i = 0 ; i < m_k_max ; ++i ) - resized |= adjust_size_by_resizeability( m_table[i] , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable<state_type>::type() ); - return resized; - } - - - template< class System , class StateInOut > - controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - sys( x , m_dxdt.m_v ,t ); - return try_step( system , x , m_dxdt.m_v , t , dt ); - } - - - template< class StateInOut > - void extrapolate( size_t k , state_table_type &table , const value_matrix &coeff , StateInOut &xest ) - /* polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf - uses the obtained intermediate results to extrapolate to dt->0 - */ - { - static const value_type val1 = static_cast< value_type >( 1.0 ); - for( int j=k-1 ; j>0 ; --j ) - { - m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][j] , -coeff[k][j] ) ); - } - m_algebra.for_each3( xest , table[0].m_v , xest , - typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][0] , -coeff[k][0]) ); - } - - time_type calc_h_opt( time_type h , value_type error , size_t k ) const - /* calculates the optimal step size for a given error and stage number */ - { - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - using std::pow; - value_type expo( 1.0/(2*k+1) ); - value_type facmin = m_facmin_table[k]; - value_type fac; - if (error == 0.0) - fac=1.0/facmin; - else - { - fac = STEPFAC2 / pow BOOST_PREVENT_MACRO_SUBSTITUTION( error / STEPFAC1 , expo ); - fac = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>(facmin/STEPFAC4) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>(1.0/facmin) , fac ) ); - } - return h*fac; - } - - controlled_step_result set_k_opt( size_t k , const inv_time_vector &work , const time_vector &h_opt , time_type &dt ) - /* calculates the optimal stage number */ - { - if( k == 1 ) - { - m_current_k_opt = 2; - return success; - } - if( (work[k-1] < KFAC1*work[k]) || (k == m_k_max) ) - { // order decrease - m_current_k_opt = k-1; - dt = h_opt[ m_current_k_opt ]; - return success; - } - else if( (work[k] < KFAC2*work[k-1]) || m_last_step_rejected || (k == m_k_max-1) ) - { // same order - also do this if last step got rejected - m_current_k_opt = k; - dt = h_opt[ m_current_k_opt ]; - return success; - } - else - { // order increase - only if last step was not rejected - m_current_k_opt = k+1; - dt = h_opt[ m_current_k_opt-1 ] * m_cost[ m_current_k_opt ] / m_cost[ m_current_k_opt-1 ] ; - return success; - } - } - - bool in_convergence_window( size_t k ) const - { - if( (k == m_current_k_opt-1) && !m_last_step_rejected ) - return true; // decrease stepsize only if last step was not rejected - return ( (k == m_current_k_opt) || (k == m_current_k_opt+1) ); - } - - bool should_reject( value_type error , size_t k ) const - { - if( k == m_current_k_opt-1 ) - { - const value_type d = m_interval_sequence[m_current_k_opt] * m_interval_sequence[m_current_k_opt+1] / - (m_interval_sequence[0]*m_interval_sequence[0]); - //step will fail, criterion 17.3.17 in NR - return ( error > d*d ); - } - else if( k == m_current_k_opt ) - { - const value_type d = m_interval_sequence[m_current_k_opt] / m_interval_sequence[0]; - return ( error > d*d ); - } else - return error > 1.0; - } - - default_error_checker< value_type, algebra_type , operations_type > m_error_checker; - modified_midpoint< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint; - - bool m_last_step_rejected; - bool m_first; - - time_type m_dt_last; - time_type m_t_last; - time_type m_max_dt; - - size_t m_current_k_opt; - - algebra_type m_algebra; - - resizer_type m_dxdt_resizer; - resizer_type m_xnew_resizer; - resizer_type m_resizer; - - wrapped_state_type m_xnew; - wrapped_state_type m_err; - wrapped_deriv_type m_dxdt; - - int_vector m_interval_sequence; // stores the successive interval counts - value_matrix m_coeff; - int_vector m_cost; // costs for interval count - value_vector m_facmin_table; // for precomputed facmin to save pow calls - - state_table_type m_table; // sequence of states for extrapolation - - value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2; -}; - - -/******** DOXYGEN ********/ -/** - * \class bulirsch_stoer - * \brief The Bulirsch-Stoer algorithm. - * - * The Bulirsch-Stoer is a controlled stepper that adjusts both step size - * and order of the method. The algorithm uses the modified midpoint and - * a polynomial extrapolation compute the solution. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - /** - * \fn bulirsch_stoer::bulirsch_stoer( value_type eps_abs , value_type eps_rel , value_type factor_x , value_type factor_dxdt ) - * \brief Constructs the bulirsch_stoer class, including initialization of - * the error bounds. - * - * \param eps_abs Absolute tolerance level. - * \param eps_rel Relative tolerance level. - * \param factor_x Factor for the weight of the state. - * \param factor_dxdt Factor for the weight of the derivative. - */ - - /** - * \fn bulirsch_stoer::try_step( System system , StateInOut &x , time_type &t , time_type &dt ) - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - /** - * \fn bulirsch_stoer::try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt ) - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - /** - * \fn bulirsch_stoer::try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt ) - * \brief Tries to perform one step. - * - * \note This method is disabled if state_type=time_type to avoid ambiguity. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param in The state of the ODE which should be solved. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - - /** - * \fn bulirsch_stoer::try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt ) - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param in The state of the ODE which should be solved. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - - /** - * \fn bulirsch_stoer::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp deleted file mode 100644 index e74a2641c92f892efca674d033645cfe345c5963..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp +++ /dev/null @@ -1,838 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp - - [begin_description] - Implementaiton of the Burlish-Stoer method with dense output - [end_description] - - Copyright 2011-2015 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_DENSE_OUT_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_DENSE_OUT_HPP_INCLUDED - - -#include <iostream> - -#include <algorithm> - -#include <boost/config.hpp> // for min/max guidelines - -#include <boost/numeric/odeint/util/bind.hpp> - -#include <boost/math/special_functions/binomial.hpp> - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/modified_midpoint.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> - -#include <boost/numeric/odeint/integrate/max_step_checker.hpp> - -#include <boost/type_traits.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -template< - class State , - class Value = double , - class Deriv = State , - class Time = Value , - class Algebra = typename algebra_dispatcher< State >::algebra_type , - class Operations = typename operations_dispatcher< State >::operations_type , - class Resizer = initially_resizer - > -class bulirsch_stoer_dense_out { - - -public: - - typedef State state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef Time time_type; - typedef Algebra algebra_type; - typedef Operations operations_type; - typedef Resizer resizer_type; - typedef dense_output_stepper_tag stepper_category; -#ifndef DOXYGEN_SKIP - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - - typedef bulirsch_stoer_dense_out< State , Value , Deriv , Time , Algebra , Operations , Resizer > controlled_error_bs_type; - - typedef typename inverse_time< time_type >::type inv_time_type; - - typedef std::vector< value_type > value_vector; - typedef std::vector< time_type > time_vector; - typedef std::vector< inv_time_type > inv_time_vector; //should be 1/time_type for boost.units - typedef std::vector< value_vector > value_matrix; - typedef std::vector< size_t > int_vector; - typedef std::vector< wrapped_state_type > state_vector_type; - typedef std::vector< wrapped_deriv_type > deriv_vector_type; - typedef std::vector< deriv_vector_type > deriv_table_type; -#endif //DOXYGEN_SKIP - - const static size_t m_k_max = 8; - - - - bulirsch_stoer_dense_out( - value_type eps_abs = 1E-6 , value_type eps_rel = 1E-6 , - value_type factor_x = 1.0 , value_type factor_dxdt = 1.0 , - time_type max_dt = static_cast<time_type>(0) , - bool control_interpolation = false ) - : m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) , - m_max_dt(max_dt) , - m_control_interpolation( control_interpolation) , - m_last_step_rejected( false ) , m_first( true ) , - m_current_state_x1( true ) , - m_error( m_k_max ) , - m_interval_sequence( m_k_max+1 ) , - m_coeff( m_k_max+1 ) , - m_cost( m_k_max+1 ) , - m_facmin_table( m_k_max+1 ) , - m_table( m_k_max ) , - m_mp_states( m_k_max+1 ) , - m_derivs( m_k_max+1 ) , - m_diffs( 2*m_k_max+2 ) , - STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 ) - { - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - - for( unsigned short i = 0; i < m_k_max+1; i++ ) - { - /* only this specific sequence allows for dense output */ - m_interval_sequence[i] = 2 + 4*i; // 2 6 10 14 ... - m_derivs[i].resize( m_interval_sequence[i] ); - if( i == 0 ) - { - m_cost[i] = m_interval_sequence[i]; - } else - { - m_cost[i] = m_cost[i-1] + m_interval_sequence[i]; - } - m_facmin_table[i] = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , static_cast< value_type >(1) / static_cast< value_type >( 2*i+1 ) ); - m_coeff[i].resize(i); - for( size_t k = 0 ; k < i ; ++k ) - { - const value_type r = static_cast< value_type >( m_interval_sequence[i] ) / static_cast< value_type >( m_interval_sequence[k] ); - m_coeff[i][k] = 1.0 / ( r*r - static_cast< value_type >( 1.0 ) ); // coefficients for extrapolation - } - // crude estimate of optimal order - - m_current_k_opt = 4; - /* no calculation because log10 might not exist for value_type! - const value_type logfact( -log10( max BOOST_PREVENT_MACRO_SUBSTITUTION( eps_rel , static_cast< value_type >( 1.0E-12 ) ) ) * 0.6 + 0.5 ); - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 1 , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>( m_k_max-1 ) , static_cast<int>( logfact ) )); - */ - } - int num = 1; - for( int i = 2*(m_k_max)+1 ; i >=0 ; i-- ) - { - m_diffs[i].resize( num ); - num += (i+1)%2; - } - } - - template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut > - controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , DerivOut &dxdt_new , time_type &dt ) - { - if( m_max_dt != static_cast<time_type>(0) && detail::less_with_sign(m_max_dt, dt, dt) ) - { - // given step size is bigger then max_dt - // set limit and return fail - dt = m_max_dt; - return fail; - } - - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - using std::pow; - - static const value_type val1( 1.0 ); - - bool reject( true ); - - time_vector h_opt( m_k_max+1 ); - inv_time_vector work( m_k_max+1 ); - - m_k_final = 0; - time_type new_h = dt; - - //std::cout << "t=" << t <<", dt=" << dt << ", k_opt=" << m_current_k_opt << ", first: " << m_first << std::endl; - - for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ ) - { - m_midpoint.set_steps( m_interval_sequence[k] ); - if( k == 0 ) - { - m_midpoint.do_step( system , in , dxdt , t , out , dt , m_mp_states[k].m_v , m_derivs[k]); - } - else - { - m_midpoint.do_step( system , in , dxdt , t , m_table[k-1].m_v , dt , m_mp_states[k].m_v , m_derivs[k] ); - extrapolate( k , m_table , m_coeff , out ); - // get error estimate - m_algebra.for_each3( m_err.m_v , out , m_table[0].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( val1 , -val1 ) ); - const value_type error = m_error_checker.error( m_algebra , in , dxdt , m_err.m_v , dt ); - h_opt[k] = calc_h_opt( dt , error , k ); - work[k] = static_cast<value_type>( m_cost[k] ) / h_opt[k]; - - m_k_final = k; - - if( (k == m_current_k_opt-1) || m_first ) - { // convergence before k_opt ? - if( error < 1.0 ) - { - //convergence - reject = false; - if( (work[k] < KFAC2*work[k-1]) || (m_current_k_opt <= 2) ) - { - // leave order as is (except we were in first round) - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k)+1 ) ); - new_h = h_opt[k] * static_cast<value_type>( m_cost[k+1] ) / static_cast<value_type>( m_cost[k] ); - } else { - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k) ) ); - new_h = h_opt[k]; - } - break; - } - else if( should_reject( error , k ) && !m_first ) - { - reject = true; - new_h = h_opt[k]; - break; - } - } - if( k == m_current_k_opt ) - { // convergence at k_opt ? - if( error < 1.0 ) - { - //convergence - reject = false; - if( (work[k-1] < KFAC2*work[k]) ) - { - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 ); - new_h = h_opt[m_current_k_opt]; - } - else if( (work[k] < KFAC2*work[k-1]) && !m_last_step_rejected ) - { - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(m_current_k_opt)+1 ); - new_h = h_opt[k]*static_cast<value_type>( m_cost[m_current_k_opt] ) / static_cast<value_type>( m_cost[k] ); - } else - new_h = h_opt[m_current_k_opt]; - break; - } - else if( should_reject( error , k ) ) - { - reject = true; - new_h = h_opt[m_current_k_opt]; - break; - } - } - if( k == m_current_k_opt+1 ) - { // convergence at k_opt+1 ? - if( error < 1.0 ) - { //convergence - reject = false; - if( work[k-2] < KFAC2*work[k-1] ) - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 ); - if( (work[k] < KFAC2*work[m_current_k_opt]) && !m_last_step_rejected ) - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(k) ); - new_h = h_opt[m_current_k_opt]; - } else - { - reject = true; - new_h = h_opt[m_current_k_opt]; - } - break; - } - } - } - - if( !reject ) - { - - //calculate dxdt for next step and dense output - typename odeint::unwrap_reference< System >::type &sys = system; - sys( out , dxdt_new , t+dt ); - - //prepare dense output - value_type error = prepare_dense_output( m_k_final , in , dxdt , out , dxdt_new , dt ); - - if( error > static_cast<value_type>(10) ) // we are not as accurate for interpolation as for the steps - { - reject = true; - new_h = dt * pow BOOST_PREVENT_MACRO_SUBSTITUTION( error , static_cast<value_type>(-1)/(2*m_k_final+2) ); - } else { - t += dt; - } - } - //set next stepsize - if( !m_last_step_rejected || (new_h < dt) ) - { - // limit step size - if( m_max_dt != static_cast<time_type>(0) ) - { - new_h = detail::min_abs(m_max_dt, new_h); - } - dt = new_h; - } - - m_last_step_rejected = reject; - if( reject ) - return fail; - else - return success; - } - - template< class StateType > - void initialize( const StateType &x0 , const time_type &t0 , const time_type &dt0 ) - { - m_resizer.adjust_size( x0 , detail::bind( &controlled_error_bs_type::template resize_impl< StateType > , detail::ref( *this ) , detail::_1 ) ); - boost::numeric::odeint::copy( x0 , get_current_state() ); - m_t = t0; - m_dt = dt0; - reset(); - } - - - /* ======================================================= - * the actual step method that should be called from outside (maybe make try_step private?) - */ - template< class System > - std::pair< time_type , time_type > do_step( System system ) - { - if( m_first ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - sys( get_current_state() , get_current_deriv() , m_t ); - } - - failed_step_checker fail_checker; // to throw a runtime_error if step size adjustment fails - controlled_step_result res = fail; - m_t_last = m_t; - while( res == fail ) - { - res = try_step( system , get_current_state() , get_current_deriv() , m_t , get_old_state() , get_old_deriv() , m_dt ); - m_first = false; - fail_checker(); // check for overflow of failed steps - } - toggle_current_state(); - return std::make_pair( m_t_last , m_t ); - } - - /* performs the interpolation from a calculated step */ - template< class StateOut > - void calc_state( time_type t , StateOut &x ) const - { - do_interpolation( t , x ); - } - - const state_type& current_state( void ) const - { - return get_current_state(); - } - - time_type current_time( void ) const - { - return m_t; - } - - const state_type& previous_state( void ) const - { - return get_old_state(); - } - - time_type previous_time( void ) const - { - return m_t_last; - } - - time_type current_time_step( void ) const - { - return m_dt; - } - - /** \brief Resets the internal state of the stepper. */ - void reset() - { - m_first = true; - m_last_step_rejected = false; - } - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_impl( x ); - m_midpoint.adjust_size( x ); - } - - -private: - - template< class StateInOut , class StateVector > - void extrapolate( size_t k , StateVector &table , const value_matrix &coeff , StateInOut &xest , size_t order_start_index = 0 ) - //polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf - { - static const value_type val1( 1.0 ); - for( int j=k-1 ; j>0 ; --j ) - { - m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][j + order_start_index] , - -coeff[k + order_start_index][j + order_start_index] ) ); - } - m_algebra.for_each3( xest , table[0].m_v , xest , - typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][0 + order_start_index] , - -coeff[k + order_start_index][0 + order_start_index]) ); - } - - - template< class StateVector > - void extrapolate_dense_out( size_t k , StateVector &table , const value_matrix &coeff , size_t order_start_index = 0 ) - //polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf - { - // result is written into table[0] - static const value_type val1( 1.0 ); - for( int j=k ; j>1 ; --j ) - { - m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][j + order_start_index - 1] , - -coeff[k + order_start_index][j + order_start_index - 1] ) ); - } - m_algebra.for_each3( table[0].m_v , table[1].m_v , table[0].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][order_start_index] , - -coeff[k + order_start_index][order_start_index]) ); - } - - time_type calc_h_opt( time_type h , value_type error , size_t k ) const - { - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - using std::pow; - - value_type expo = static_cast<value_type>(1)/(m_interval_sequence[k-1]); - value_type facmin = m_facmin_table[k]; - value_type fac; - if (error == 0.0) - fac = static_cast<value_type>(1)/facmin; - else - { - fac = STEPFAC2 / pow BOOST_PREVENT_MACRO_SUBSTITUTION( error / STEPFAC1 , expo ); - fac = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>( facmin/STEPFAC4 ) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>(static_cast<value_type>(1)/facmin) , fac ) ); - } - return h*fac; - } - - bool in_convergence_window( size_t k ) const - { - if( (k == m_current_k_opt-1) && !m_last_step_rejected ) - return true; // decrease order only if last step was not rejected - return ( (k == m_current_k_opt) || (k == m_current_k_opt+1) ); - } - - bool should_reject( value_type error , size_t k ) const - { - if( k == m_current_k_opt-1 ) - { - const value_type d = m_interval_sequence[m_current_k_opt] * m_interval_sequence[m_current_k_opt+1] / - (m_interval_sequence[0]*m_interval_sequence[0]); - //step will fail, criterion 17.3.17 in NR - return ( error > d*d ); - } - else if( k == m_current_k_opt ) - { - const value_type d = m_interval_sequence[m_current_k_opt+1] / m_interval_sequence[0]; - return ( error > d*d ); - } else - return error > 1.0; - } - - template< class StateIn1 , class DerivIn1 , class StateIn2 , class DerivIn2 > - value_type prepare_dense_output( int k , const StateIn1 &x_start , const DerivIn1 &dxdt_start , - const StateIn2 & /* x_end */ , const DerivIn2 & /*dxdt_end */ , time_type dt ) - /* k is the order to which the result was approximated */ - { - - /* compute the coefficients of the interpolation polynomial - * we parametrize the interval t .. t+dt by theta = -1 .. 1 - * we use 2k+3 values at the interval center theta=0 to obtain the interpolation coefficients - * the values are x(t+dt/2) and the derivatives dx/dt , ... d^(2k+2) x / dt^(2k+2) at the midpoints - * the derivatives are approximated via finite differences - * all values are obtained from interpolation of the results from the increasing orders of the midpoint calls - */ - - // calculate finite difference approximations to derivatives at the midpoint - for( int j = 0 ; j<=k ; j++ ) - { - /* not working with boost units... */ - const value_type d = m_interval_sequence[j] / ( static_cast<value_type>(2) * dt ); - value_type f = 1.0; //factor 1/2 here because our interpolation interval has length 2 !!! - for( int kappa = 0 ; kappa <= 2*j+1 ; ++kappa ) - { - calculate_finite_difference( j , kappa , f , dxdt_start ); - f *= d; - } - - if( j > 0 ) - extrapolate_dense_out( j , m_mp_states , m_coeff ); - } - - time_type d = dt/2; - - // extrapolate finite differences - for( int kappa = 0 ; kappa<=2*k+1 ; kappa++ ) - { - for( int j=1 ; j<=(k-kappa/2) ; ++j ) - extrapolate_dense_out( j , m_diffs[kappa] , m_coeff , kappa/2 ); - - // extrapolation results are now stored in m_diffs[kappa][0] - - // divide kappa-th derivative by kappa because we need these terms for dense output interpolation - m_algebra.for_each1( m_diffs[kappa][0].m_v , typename operations_type::template scale< time_type >( static_cast<time_type>(d) ) ); - - d *= dt/(2*(kappa+2)); - } - - // dense output coefficients a_0 is stored in m_mp_states[0], a_i for i = 1...2k are stored in m_diffs[i-1][0] - - // the error is just the highest order coefficient of the interpolation polynomial - // this is because we use only the midpoint theta=0 as support for the interpolation (remember that theta = -1 .. 1) - - value_type error = 0.0; - if( m_control_interpolation ) - { - boost::numeric::odeint::copy( m_diffs[2*k+1][0].m_v , m_err.m_v ); - error = m_error_checker.error( m_algebra , x_start , dxdt_start , m_err.m_v , dt ); - } - - return error; - } - - template< class DerivIn > - void calculate_finite_difference( size_t j , size_t kappa , value_type fac , const DerivIn &dxdt ) - { - const int m = m_interval_sequence[j]/2-1; - if( kappa == 0) // no calculation required for 0th derivative of f - { - m_algebra.for_each2( m_diffs[0][j].m_v , m_derivs[j][m].m_v , - typename operations_type::template scale_sum1< value_type >( fac ) ); - } - else - { - // calculate the index of m_diffs for this kappa-j-combination - const int j_diffs = j - kappa/2; - - m_algebra.for_each2( m_diffs[kappa][j_diffs].m_v , m_derivs[j][m+kappa].m_v , - typename operations_type::template scale_sum1< value_type >( fac ) ); - value_type sign = -1.0; - int c = 1; - //computes the j-th order finite difference for the kappa-th derivative of f at t+dt/2 using function evaluations stored in m_derivs - for( int i = m+static_cast<int>(kappa)-2 ; i >= m-static_cast<int>(kappa) ; i -= 2 ) - { - if( i >= 0 ) - { - m_algebra.for_each3( m_diffs[kappa][j_diffs].m_v , m_diffs[kappa][j_diffs].m_v , m_derivs[j][i].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( 1.0 , - sign * fac * boost::math::binomial_coefficient< value_type >( kappa , c ) ) ); - } - else - { - m_algebra.for_each3( m_diffs[kappa][j_diffs].m_v , m_diffs[kappa][j_diffs].m_v , dxdt , - typename operations_type::template scale_sum2< value_type , value_type >( 1.0 , sign * fac ) ); - } - sign *= -1; - ++c; - } - } - } - - template< class StateOut > - void do_interpolation( time_type t , StateOut &out ) const - { - // interpolation polynomial is defined for theta = -1 ... 1 - // m_k_final is the number of order-iterations done for the last step - it governs the order of the interpolation polynomial - const value_type theta = 2 * get_unit_value( (t - m_t_last) / (m_t - m_t_last) ) - 1; - // we use only values at interval center, that is theta=0, for interpolation - // our interpolation polynomial is thus of order 2k+2, hence we have 2k+3 terms - - boost::numeric::odeint::copy( m_mp_states[0].m_v , out ); - // add remaining terms: x += a_1 theta + a2 theta^2 + ... + a_{2k} theta^{2k} - value_type theta_pow( theta ); - for( size_t i=0 ; i<=2*m_k_final+1 ; ++i ) - { - m_algebra.for_each3( out , out , m_diffs[i][0].m_v , - typename operations_type::template scale_sum2< value_type >( static_cast<value_type>(1) , theta_pow ) ); - theta_pow *= theta; - } - } - - /* Resizer methods */ - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized( false ); - - resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxdt1 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxdt2 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable<state_type>::type() ); - - for( size_t i = 0 ; i < m_k_max ; ++i ) - resized |= adjust_size_by_resizeability( m_table[i] , x , typename is_resizeable<state_type>::type() ); - for( size_t i = 0 ; i < m_k_max+1 ; ++i ) - resized |= adjust_size_by_resizeability( m_mp_states[i] , x , typename is_resizeable<state_type>::type() ); - for( size_t i = 0 ; i < m_k_max+1 ; ++i ) - for( size_t j = 0 ; j < m_derivs[i].size() ; ++j ) - resized |= adjust_size_by_resizeability( m_derivs[i][j] , x , typename is_resizeable<deriv_type>::type() ); - for( size_t i = 0 ; i < 2*m_k_max+2 ; ++i ) - for( size_t j = 0 ; j < m_diffs[i].size() ; ++j ) - resized |= adjust_size_by_resizeability( m_diffs[i][j] , x , typename is_resizeable<deriv_type>::type() ); - - return resized; - } - - - state_type& get_current_state( void ) - { - return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ; - } - - const state_type& get_current_state( void ) const - { - return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ; - } - - state_type& get_old_state( void ) - { - return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ; - } - - const state_type& get_old_state( void ) const - { - return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ; - } - - deriv_type& get_current_deriv( void ) - { - return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ; - } - - const deriv_type& get_current_deriv( void ) const - { - return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ; - } - - deriv_type& get_old_deriv( void ) - { - return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ; - } - - const deriv_type& get_old_deriv( void ) const - { - return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ; - } - - - void toggle_current_state( void ) - { - m_current_state_x1 = ! m_current_state_x1; - } - - - - default_error_checker< value_type, algebra_type , operations_type > m_error_checker; - modified_midpoint_dense_out< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint; - - time_type m_max_dt; - - bool m_control_interpolation; - - bool m_last_step_rejected; - bool m_first; - - time_type m_t; - time_type m_dt; - time_type m_dt_last; - time_type m_t_last; - - size_t m_current_k_opt; - size_t m_k_final; - - algebra_type m_algebra; - - resizer_type m_resizer; - - wrapped_state_type m_x1 , m_x2; - wrapped_deriv_type m_dxdt1 , m_dxdt2; - wrapped_state_type m_err; - bool m_current_state_x1; - - - - value_vector m_error; // errors of repeated midpoint steps and extrapolations - int_vector m_interval_sequence; // stores the successive interval counts - value_matrix m_coeff; - int_vector m_cost; // costs for interval count - value_vector m_facmin_table; // for precomputed facmin to save pow calls - - state_vector_type m_table; // sequence of states for extrapolation - - //for dense output: - state_vector_type m_mp_states; // sequence of approximations of x at distance center - deriv_table_type m_derivs; // table of function values - deriv_table_type m_diffs; // table of function values - - //wrapped_state_type m_a1 , m_a2 , m_a3 , m_a4; - - value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2; -}; - - - -/********** DOXYGEN **********/ - -/** - * \class bulirsch_stoer_dense_out - * \brief The Bulirsch-Stoer algorithm. - * - * The Bulirsch-Stoer is a controlled stepper that adjusts both step size - * and order of the method. The algorithm uses the modified midpoint and - * a polynomial extrapolation compute the solution. This class also provides - * dense output facility. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - /** - * \fn bulirsch_stoer_dense_out::bulirsch_stoer_dense_out( value_type eps_abs , value_type eps_rel , value_type factor_x , value_type factor_dxdt , bool control_interpolation ) - * \brief Constructs the bulirsch_stoer class, including initialization of - * the error bounds. - * - * \param eps_abs Absolute tolerance level. - * \param eps_rel Relative tolerance level. - * \param factor_x Factor for the weight of the state. - * \param factor_dxdt Factor for the weight of the derivative. - * \param control_interpolation Set true to additionally control the error of - * the interpolation. - */ - - /** - * \fn bulirsch_stoer_dense_out::try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , DerivOut &dxdt_new , time_type &dt ) - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param in The state of the ODE which should be solved. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - /** - * \fn bulirsch_stoer_dense_out::initialize( const StateType &x0 , const time_type &t0 , const time_type &dt0 ) - * \brief Initializes the dense output stepper. - * - * \param x0 The initial state. - * \param t0 The initial time. - * \param dt0 The initial time step. - */ - - /** - * \fn bulirsch_stoer_dense_out::do_step( System system ) - * \brief Does one time step. This is the main method that should be used to - * integrate an ODE with this stepper. - * \note initialize has to be called before using this method to set the - * initial conditions x,t and the stepsize. - * \param system The system function to solve, hence the r.h.s. of the - * ordinary differential equation. It must fulfill the Simple System concept. - * \return Pair with start and end time of the integration step. - */ - - /** - * \fn bulirsch_stoer_dense_out::calc_state( time_type t , StateOut &x ) const - * \brief Calculates the solution at an intermediate point within the last step - * \param t The time at which the solution should be calculated, has to be - * in the current time interval. - * \param x The output variable where the result is written into. - */ - - /** - * \fn bulirsch_stoer_dense_out::current_state( void ) const - * \brief Returns the current state of the solution. - * \return The current state of the solution x(t). - */ - - /** - * \fn bulirsch_stoer_dense_out::current_time( void ) const - * \brief Returns the current time of the solution. - * \return The current time of the solution t. - */ - - /** - * \fn bulirsch_stoer_dense_out::previous_state( void ) const - * \brief Returns the last state of the solution. - * \return The last state of the solution x(t-dt). - */ - - /** - * \fn bulirsch_stoer_dense_out::previous_time( void ) const - * \brief Returns the last time of the solution. - * \return The last time of the solution t-dt. - */ - - /** - * \fn bulirsch_stoer_dense_out::current_time_step( void ) const - * \brief Returns the current step size. - * \return The current step size. - */ - - /** - * \fn bulirsch_stoer_dense_out::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp deleted file mode 100644 index 2c0bef62131316932ec3c4a5c7f6d3e005b12f27..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp +++ /dev/null @@ -1,1014 +0,0 @@ -/* [auto_generated] - boost/numeric/odeint/stepper/controlled_runge_kutta.hpp - - [begin_description] - The default controlled stepper which can be used with all explicit Runge-Kutta error steppers. - [end_description] - - Copyright 2010-2013 Karsten Ahnert - Copyright 2010-2015 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED - - - -#include <cmath> - -#include <boost/config.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/util/copy.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> - -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -template -< -class Value , -class Algebra , -class Operations -> -class default_error_checker -{ -public: - - typedef Value value_type; - typedef Algebra algebra_type; - typedef Operations operations_type; - - default_error_checker( - value_type eps_abs = static_cast< value_type >( 1.0e-6 ) , - value_type eps_rel = static_cast< value_type >( 1.0e-6 ) , - value_type a_x = static_cast< value_type >( 1 ) , - value_type a_dxdt = static_cast< value_type >( 1 )) - : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) - { } - - - template< class State , class Deriv , class Err, class Time > - value_type error( const State &x_old , const Deriv &dxdt_old , Err &x_err , Time dt ) const - { - return error( algebra_type() , x_old , dxdt_old , x_err , dt ); - } - - template< class State , class Deriv , class Err, class Time > - value_type error( algebra_type &algebra , const State &x_old , const Deriv &dxdt_old , Err &x_err , Time dt ) const - { - using std::abs; - // this overwrites x_err ! - algebra.for_each3( x_err , x_old , dxdt_old , - typename operations_type::template rel_error< value_type >( m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt * abs(get_unit_value( dt )) ) ); - - // value_type res = algebra.reduce( x_err , - // typename operations_type::template maximum< value_type >() , static_cast< value_type >( 0 ) ); - return algebra.norm_inf( x_err ); - } - -private: - - value_type m_eps_abs; - value_type m_eps_rel; - value_type m_a_x; - value_type m_a_dxdt; - -}; - - -template< typename Value, typename Time > -class default_step_adjuster -{ -public: - typedef Time time_type; - typedef Value value_type; - - default_step_adjuster(const time_type max_dt=static_cast<time_type>(0)) - : m_max_dt(max_dt) - {} - - - time_type decrease_step(time_type dt, const value_type error, const int error_order) const - { - // returns the decreased time step - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - using std::pow; - - dt *= max - BOOST_PREVENT_MACRO_SUBSTITUTION( - static_cast<value_type>( static_cast<value_type>(9) / static_cast<value_type>(10) * - pow(error, static_cast<value_type>(-1) / (error_order - 1))), - static_cast<value_type>( static_cast<value_type>(1) / static_cast<value_type> (5))); - if(m_max_dt != static_cast<time_type >(0)) - // limit to maximal stepsize even when decreasing - dt = detail::min_abs(dt, m_max_dt); - return dt; - } - - time_type increase_step(time_type dt, value_type error, const int stepper_order) const - { - // returns the increased time step - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - using std::pow; - - // adjust the size if dt is smaller than max_dt (providede max_dt is not zero) - if(error < 0.5) - { - // error should be > 0 - error = max BOOST_PREVENT_MACRO_SUBSTITUTION ( - static_cast<value_type>( pow( static_cast<value_type>(5.0) , -static_cast<value_type>(stepper_order) ) ) , - error); - time_type dt_old = dt; - //error too small - increase dt and keep the evolution and limit scaling factor to 5.0 - dt *= static_cast<value_type>(9)/static_cast<value_type>(10) * - pow(error, static_cast<value_type>(-1) / stepper_order); - if(m_max_dt != static_cast<time_type >(0)) - // limit to maximal stepsize - dt = detail::min_abs(dt, m_max_dt); - } - return dt; - } - - bool check_step_size_limit(const time_type dt) - { - if(m_max_dt != static_cast<time_type >(0)) - return detail::less_eq_with_sign(dt, m_max_dt, dt); - return true; - } - - time_type get_max_dt() { return m_max_dt; } - -private: - time_type m_max_dt; -}; - - - -/* - * error stepper category dispatcher - */ -template< -class ErrorStepper , -class ErrorChecker = default_error_checker< typename ErrorStepper::value_type , - typename ErrorStepper::algebra_type , - typename ErrorStepper::operations_type > , -class StepAdjuster = default_step_adjuster< typename ErrorStepper::value_type , - typename ErrorStepper::time_type > , -class Resizer = typename ErrorStepper::resizer_type , -class ErrorStepperCategory = typename ErrorStepper::stepper_category -> -class controlled_runge_kutta ; - - - -/* - * explicit stepper version - * - * this class introduces the following try_step overloads - * try_step( sys , x , t , dt ) - * try_step( sys , x , dxdt , t , dt ) - * try_step( sys , in , t , out , dt ) - * try_step( sys , in , dxdt , t , out , dt ) - */ -/** - * \brief Implements step size control for Runge-Kutta steppers with error - * estimation. - * - * This class implements the step size control for standard Runge-Kutta - * steppers with error estimation. - * - * \tparam ErrorStepper The stepper type with error estimation, has to fulfill the ErrorStepper concept. - * \tparam ErrorChecker The error checker - * \tparam Resizer The resizer policy type. - */ -template< -class ErrorStepper, -class ErrorChecker, -class StepAdjuster, -class Resizer -> -class controlled_runge_kutta< ErrorStepper , ErrorChecker , StepAdjuster, Resizer , - explicit_error_stepper_tag > -{ - -public: - - typedef ErrorStepper stepper_type; - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::time_type time_type; - typedef typename stepper_type::algebra_type algebra_type; - typedef typename stepper_type::operations_type operations_type; - typedef Resizer resizer_type; - typedef ErrorChecker error_checker_type; - typedef StepAdjuster step_adjuster_type; - typedef explicit_controlled_stepper_tag stepper_category; - -#ifndef DOXYGEN_SKIP - typedef typename stepper_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type; - - typedef controlled_runge_kutta< ErrorStepper , ErrorChecker , StepAdjuster , - Resizer , explicit_error_stepper_tag > controlled_stepper_type; -#endif //DOXYGEN_SKIP - - - /** - * \brief Constructs the controlled Runge-Kutta stepper. - * \param error_checker An instance of the error checker. - * \param stepper An instance of the underlying stepper. - */ - controlled_runge_kutta( - const error_checker_type &error_checker = error_checker_type( ) , - const step_adjuster_type &step_adjuster = step_adjuster_type() , - const stepper_type &stepper = stepper_type( ) - ) - : m_stepper(stepper), m_error_checker(error_checker) , m_step_adjuster(step_adjuster) - { } - - - - /* - * Version 1 : try_step( sys , x , t , dt ) - * - * The overloads are needed to solve the forwarding problem - */ - /** - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt ) - { - return try_step_v1( system , x , t, dt ); - } - - /** - * \brief Tries to perform one step. Solves the forwarding problem and - * allows for using boost range as state_type. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. Can be a boost range. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt ) - { - return try_step_v1( system , x , t, dt ); - } - - - - /* - * Version 2 : try_step( sys , x , dxdt , t , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - /** - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateInOut , class DerivIn > - controlled_step_result try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt ) - { - m_xnew_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_xnew_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , dt ); - if( res == success ) - { - boost::numeric::odeint::copy( m_xnew.m_v , x ); - } - return res; - } - - /* - * Version 3 : try_step( sys , in , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - * - * the disable is needed to avoid ambiguous overloads if state_type = time_type - */ - /** - * \brief Tries to perform one step. - * - * \note This method is disabled if state_type=time_type to avoid ambiguity. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateIn , class StateOut > - typename boost::disable_if< boost::is_same< StateIn , time_type > , controlled_step_result >::type - try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ); - sys( in , m_dxdt.m_v , t ); - return try_step( system , in , m_dxdt.m_v , t , out , dt ); - } - - - /* - * Version 4 : try_step( sys , in , dxdt , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - /** - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateIn , class DerivIn , class StateOut > - controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt ) - { - if( !m_step_adjuster.check_step_size_limit(dt) ) - { - // given dt was above step size limit - adjust and return fail; - dt = m_step_adjuster.get_max_dt(); - return fail; - } - - m_xerr_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_xerr_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ); - - // do one step with error calculation - m_stepper.do_step( system , in , dxdt , t , out , dt , m_xerr.m_v ); - - value_type max_rel_err = m_error_checker.error( m_stepper.algebra() , in , dxdt , m_xerr.m_v , dt ); - - if( max_rel_err > 1.0 ) - { - // error too big, decrease step size and reject this step - dt = m_step_adjuster.decrease_step(dt, max_rel_err, m_stepper.error_order()); - return fail; - } else - { - // otherwise, increase step size and accept - t += dt; - dt = m_step_adjuster.increase_step(dt, max_rel_err, m_stepper.stepper_order()); - return success; - } - } - - /** - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_m_xerr_impl( x ); - resize_m_dxdt_impl( x ); - resize_m_xnew_impl( x ); - m_stepper.adjust_size( x ); - } - - /** - * \brief Returns the instance of the underlying stepper. - * \returns The instance of the underlying stepper. - */ - stepper_type& stepper( void ) - { - return m_stepper; - } - - /** - * \brief Returns the instance of the underlying stepper. - * \returns The instance of the underlying stepper. - */ - const stepper_type& stepper( void ) const - { - return m_stepper; - } - -private: - - - template< class System , class StateInOut > - controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - sys( x , m_dxdt.m_v ,t ); - return try_step( system , x , m_dxdt.m_v , t , dt ); - } - - template< class StateIn > - bool resize_m_xerr_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_xerr , x , typename is_resizeable<state_type>::type() ); - } - - template< class StateIn > - bool resize_m_dxdt_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - } - - template< class StateIn > - bool resize_m_xnew_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() ); - } - - - - stepper_type m_stepper; - error_checker_type m_error_checker; - step_adjuster_type m_step_adjuster; - - resizer_type m_dxdt_resizer; - resizer_type m_xerr_resizer; - resizer_type m_xnew_resizer; - - wrapped_deriv_type m_dxdt; - wrapped_state_type m_xerr; - wrapped_state_type m_xnew; -}; - - - - - - - - - - -/* - * explicit stepper fsal version - * - * the class introduces the following try_step overloads - * try_step( sys , x , t , dt ) - * try_step( sys , in , t , out , dt ) - * try_step( sys , x , dxdt , t , dt ) - * try_step( sys , in , dxdt_in , t , out , dxdt_out , dt ) - */ -/** - * \brief Implements step size control for Runge-Kutta FSAL steppers with - * error estimation. - * - * This class implements the step size control for FSAL Runge-Kutta - * steppers with error estimation. - * - * \tparam ErrorStepper The stepper type with error estimation, has to fulfill the ErrorStepper concept. - * \tparam ErrorChecker The error checker - * \tparam Resizer The resizer policy type. - */ -template< -class ErrorStepper , -class ErrorChecker , -class StepAdjuster , -class Resizer -> -class controlled_runge_kutta< ErrorStepper , ErrorChecker , StepAdjuster , Resizer , explicit_error_stepper_fsal_tag > -{ - -public: - - typedef ErrorStepper stepper_type; - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::time_type time_type; - typedef typename stepper_type::algebra_type algebra_type; - typedef typename stepper_type::operations_type operations_type; - typedef Resizer resizer_type; - typedef ErrorChecker error_checker_type; - typedef StepAdjuster step_adjuster_type; - typedef explicit_controlled_stepper_fsal_tag stepper_category; - -#ifndef DOXYGEN_SKIP - typedef typename stepper_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type; - - typedef controlled_runge_kutta< ErrorStepper , ErrorChecker , StepAdjuster , Resizer , explicit_error_stepper_tag > controlled_stepper_type; -#endif // DOXYGEN_SKIP - - /** - * \brief Constructs the controlled Runge-Kutta stepper. - * \param error_checker An instance of the error checker. - * \param stepper An instance of the underlying stepper. - */ - controlled_runge_kutta( - const error_checker_type &error_checker = error_checker_type() , - const step_adjuster_type &step_adjuster = step_adjuster_type() , - const stepper_type &stepper = stepper_type() - ) - : m_stepper( stepper ) , m_error_checker( error_checker ) , m_step_adjuster(step_adjuster) , - m_first_call( true ) - { } - - /* - * Version 1 : try_step( sys , x , t , dt ) - * - * The two overloads are needed in order to solve the forwarding problem - */ - /** - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt ) - { - return try_step_v1( system , x , t , dt ); - } - - - /** - * \brief Tries to perform one step. Solves the forwarding problem and - * allows for using boost range as state_type. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. Can be a boost range. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt ) - { - return try_step_v1( system , x , t , dt ); - } - - - - /* - * Version 2 : try_step( sys , in , t , out , dt ); - * - * This version does not solve the forwarding problem, boost::range can not be used. - * - * The disabler is needed to solve ambiguous overloads - */ - /** - * \brief Tries to perform one step. - * - * \note This method is disabled if state_type=time_type to avoid ambiguity. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateIn , class StateOut > - typename boost::disable_if< boost::is_same< StateIn , time_type > , controlled_step_result >::type - try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt ) - { - if( m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) - { - initialize( system , in , t ); - } - return try_step( system , in , m_dxdt.m_v , t , out , dt ); - } - - - /* - * Version 3 : try_step( sys , x , dxdt , t , dt ) - * - * This version does not solve the forwarding problem, boost::range can not be used. - */ - /** - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateInOut , class DerivInOut > - controlled_step_result try_step( System system , StateInOut &x , DerivInOut &dxdt , time_type &t , time_type &dt ) - { - m_xnew_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_xnew_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - m_dxdt_new_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_new_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , m_dxdtnew.m_v , dt ); - if( res == success ) - { - boost::numeric::odeint::copy( m_xnew.m_v , x ); - boost::numeric::odeint::copy( m_dxdtnew.m_v , dxdt ); - } - return res; - } - - - /* - * Version 4 : try_step( sys , in , dxdt_in , t , out , dxdt_out , dt ) - * - * This version does not solve the forwarding problem, boost::range can not be used. - */ - /** - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut > - controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type &t , - StateOut &out , DerivOut &dxdt_out , time_type &dt ) - { - if( !m_step_adjuster.check_step_size_limit(dt) ) - { - // given dt was above step size limit - adjust and return fail; - dt = m_step_adjuster.get_max_dt(); - return fail; - } - - m_xerr_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_xerr_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ); - - //fsal: m_stepper.get_dxdt( dxdt ); - //fsal: m_stepper.do_step( sys , x , dxdt , t , dt , m_x_err ); - m_stepper.do_step( system , in , dxdt_in , t , out , dxdt_out , dt , m_xerr.m_v ); - - // this potentially overwrites m_x_err! (standard_error_checker does, at least) - value_type max_rel_err = m_error_checker.error( m_stepper.algebra() , in , dxdt_in , m_xerr.m_v , dt ); - - if( max_rel_err > 1.0 ) - { - // error too big, decrease step size and reject this step - dt = m_step_adjuster.decrease_step(dt, max_rel_err, m_stepper.error_order()); - return fail; - } - // otherwise, increase step size and accept - t += dt; - dt = m_step_adjuster.increase_step(dt, max_rel_err, m_stepper.stepper_order()); - return success; - } - - - /** - * \brief Resets the internal state of the underlying FSAL stepper. - */ - void reset( void ) - { - m_first_call = true; - } - - /** - * \brief Initializes the internal state storing an internal copy of the derivative. - * - * \param deriv The initial derivative of the ODE. - */ - template< class DerivIn > - void initialize( const DerivIn &deriv ) - { - boost::numeric::odeint::copy( deriv , m_dxdt.m_v ); - m_first_call = false; - } - - /** - * \brief Initializes the internal state storing an internal copy of the derivative. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param x The initial state of the ODE which should be solved. - * \param t The initial time. - */ - template< class System , class StateIn > - void initialize( System system , const StateIn &x , time_type t ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - sys( x , m_dxdt.m_v , t ); - m_first_call = false; - } - - /** - * \brief Returns true if the stepper has been initialized, false otherwise. - * - * \return true, if the stepper has been initialized, false otherwise. - */ - bool is_initialized( void ) const - { - return ! m_first_call; - } - - - /** - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_m_xerr_impl( x ); - resize_m_dxdt_impl( x ); - resize_m_dxdt_new_impl( x ); - resize_m_xnew_impl( x ); - } - - - /** - * \brief Returns the instance of the underlying stepper. - * \returns The instance of the underlying stepper. - */ - stepper_type& stepper( void ) - { - return m_stepper; - } - - /** - * \brief Returns the instance of the underlying stepper. - * \returns The instance of the underlying stepper. - */ - const stepper_type& stepper( void ) const - { - return m_stepper; - } - - - -private: - - - template< class StateIn > - bool resize_m_xerr_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_xerr , x , typename is_resizeable<state_type>::type() ); - } - - template< class StateIn > - bool resize_m_dxdt_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - } - - template< class StateIn > - bool resize_m_dxdt_new_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdtnew , x , typename is_resizeable<deriv_type>::type() ); - } - - template< class StateIn > - bool resize_m_xnew_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() ); - } - - - template< class System , class StateInOut > - controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt ) - { - if( m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) - { - initialize( system , x , t ); - } - return try_step( system , x , m_dxdt.m_v , t , dt ); - } - - - stepper_type m_stepper; - error_checker_type m_error_checker; - step_adjuster_type m_step_adjuster; - - resizer_type m_dxdt_resizer; - resizer_type m_xerr_resizer; - resizer_type m_xnew_resizer; - resizer_type m_dxdt_new_resizer; - - wrapped_deriv_type m_dxdt; - wrapped_state_type m_xerr; - wrapped_state_type m_xnew; - wrapped_deriv_type m_dxdtnew; - bool m_first_call; -}; - - -/********** DOXYGEN **********/ - -/**** DEFAULT ERROR CHECKER ****/ - -/** - * \class default_error_checker - * \brief The default error checker to be used with Runge-Kutta error steppers - * - * This class provides the default mechanism to compare the error estimates - * reported by Runge-Kutta error steppers with user defined error bounds. - * It is used by the controlled_runge_kutta steppers. - * - * \tparam Value The value type. - * \tparam Time The time type. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - */ - - /** - * \fn default_error_checker( value_type eps_abs , value_type eps_rel , value_type a_x , value_type a_dxdt , - * time_type max_dt) - * \brief Constructs the error checker. - * - * The error is calculated as follows: ???? - * - * \param eps_abs Absolute tolerance level. - * \param eps_rel Relative tolerance level. - * \param a_x Factor for the weight of the state. - * \param a_dxdt Factor for the weight of the derivative. - * \param max_dt Maximum allowed step size. - */ - - /** - * \fn error( const State &x_old , const Deriv &dxdt_old , Err &x_err , time_type dt ) const - * \brief Calculates the error level. - * - * If the returned error level is greater than 1, the estimated error was - * larger than the permitted error bounds and the step should be repeated - * with a smaller step size. - * - * \param x_old State at the beginning of the step. - * \param dxdt_old Derivative at the beginning of the step. - * \param x_err Error estimate. - * \param dt Time step. - * \return error - */ - - /** - * \fn error( algebra_type &algebra , const State &x_old , const Deriv &dxdt_old , Err &x_err , time_type dt ) const - * \brief Calculates the error level using a given algebra. - * - * If the returned error level is greater than 1, the estimated error was - * larger than the permitted error bounds and the step should be repeated - * with a smaller step size. - * - * \param algebra The algebra used for calculation of the error. - * \param x_old State at the beginning of the step. - * \param dxdt_old Derivative at the beginning of the step. - * \param x_err Error estimate. - * \param dt Time step. - * \return error - */ - - /** - * \fn time_type decrease_step(const time_type dt, const value_type error, const int error_order) - * \brief Returns a decreased step size based on the given error and order - * - * Calculates a new smaller step size based on the given error and its order. - * - * \param dt The old step size. - * \param error The computed error estimate. - * \param error_order The error order of the stepper. - * \return dt_new The new, reduced step size. - */ - - /** - * \fn time_type increase_step(const time_type dt, const value_type error, const int error_order) - * \brief Returns an increased step size based on the given error and order. - * - * Calculates a new bigger step size based on the given error and its order. If max_dt != 0, the - * new step size is limited to max_dt. - * - * \param dt The old step size. - * \param error The computed error estimate. - * \param error_order The order of the stepper. - * \return dt_new The new, increased step size. - */ - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/controlled_step_result.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/controlled_step_result.hpp deleted file mode 100644 index 7f17726c570ee2f53da8e17476f3f227a24b0b7d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/controlled_step_result.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/controlled_step_result.hpp - - [begin_description] - Defines the result type for all controlled stepper. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_STEP_RESULT_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_STEP_RESULT_HPP_INCLUDED - - -namespace boost { -namespace numeric { -namespace odeint { - -/** - * \enum controlled_step_result - * - * \brief Enum representing the return values of the controlled steppers. - */ -typedef enum -{ - success , /**< The trial step was successful, hence the state and the time have been advanced. */ - fail /**< The step was not successful and might possibly be repeated with a small step size. */ -} controlled_step_result; - -} // namespace odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_STEP_RESULT_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp deleted file mode 100644 index 0b69f70370f71fad37e405593e81cdd0bdc80d46..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp +++ /dev/null @@ -1,476 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp - - [begin_description] - Implementation of the Dense-output stepper for all steppers. Note, that this class does - not computes the result but serves as an interface. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2015 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED - - -#include <utility> -#include <stdexcept> - -#include <boost/throw_exception.hpp> - -#include <boost/numeric/odeint/util/bind.hpp> - -#include <boost/numeric/odeint/util/copy.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/integrate/max_step_checker.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< class Stepper , class StepperCategory = typename Stepper::stepper_category > -class dense_output_runge_kutta; - - -/** - * \brief The class representing dense-output Runge-Kutta steppers. - * \note In this stepper, the initialize method has to be called before using - * the do_step method. - * - * The dense-output functionality allows to interpolate the solution between - * subsequent integration points using intermediate results obtained during the - * computation. This version works based on a normal stepper without step-size - * control. - * - * - * \tparam Stepper The stepper type of the underlying algorithm. - */ -template< class Stepper > -class dense_output_runge_kutta< Stepper , stepper_tag > -{ - -public: - - /* - * We do not need all typedefs. - */ - typedef Stepper stepper_type; - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_type::time_type time_type; - typedef typename stepper_type::algebra_type algebra_type; - typedef typename stepper_type::operations_type operations_type; - typedef typename stepper_type::resizer_type resizer_type; - typedef dense_output_stepper_tag stepper_category; - typedef dense_output_runge_kutta< Stepper > dense_output_stepper_type; - - - /** - * \brief Constructs the dense_output_runge_kutta class. An instance of the - * underlying stepper can be provided. - * \param stepper An instance of the underlying stepper. - */ - dense_output_runge_kutta( const stepper_type &stepper = stepper_type() ) - : m_stepper( stepper ) , m_resizer() , - m_x1() , m_x2() , m_current_state_x1( true ) , - m_t() , m_t_old() , m_dt() - { } - - - /** - * \brief Initializes the stepper. Has to be called before do_step can be - * used to set the initial conditions and the step size. - * \param x0 The initial state of the ODE which should be solved. - * \param t0 The initial time, at which the step should be performed. - * \param dt0 The step size. - */ - template< class StateType > - void initialize( const StateType &x0 , time_type t0 , time_type dt0 ) - { - m_resizer.adjust_size( x0 , detail::bind( &dense_output_stepper_type::template resize_impl< StateType > , detail::ref( *this ) , detail::_1 ) ); - boost::numeric::odeint::copy( x0 , get_current_state() ); - m_t = t0; - m_dt = dt0; - } - - /** - * \brief Does one time step. - * \note initialize has to be called before using this method to set the - * initial conditions x,t and the stepsize. - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Simple System concept. - * \return Pair with start and end time of the integration step. - */ - template< class System > - std::pair< time_type , time_type > do_step( System system ) - { - m_stepper.do_step( system , get_current_state() , m_t , get_old_state() , m_dt ); - m_t_old = m_t; - m_t += m_dt; - toggle_current_state(); - return std::make_pair( m_t_old , m_dt ); - } - - /* - * The next two overloads are needed to solve the forwarding problem - */ - - /** - * \brief Calculates the solution at an intermediate point. - * \param t The time at which the solution should be calculated, has to be - * in the current time interval. - * \param x The output variable where the result is written into. - */ - template< class StateOut > - void calc_state( time_type t , StateOut &x ) const - { - if( t == current_time() ) - { - boost::numeric::odeint::copy( get_current_state() , x ); - } - m_stepper.calc_state( x , t , get_old_state() , m_t_old , get_current_state() , m_t ); - } - - /** - * \brief Calculates the solution at an intermediate point. Solves the forwarding problem - * \param t The time at which the solution should be calculated, has to be - * in the current time interval. - * \param x The output variable where the result is written into, can be a boost range. - */ - template< class StateOut > - void calc_state( time_type t , const StateOut &x ) const - { - m_stepper.calc_state( x , t , get_old_state() , m_t_old , get_current_state() , m_t ); - } - - /** - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_impl( x ); - m_stepper.stepper().resize( x ); - } - - /** - * \brief Returns the current state of the solution. - * \return The current state of the solution x(t). - */ - const state_type& current_state( void ) const - { - return get_current_state(); - } - - /** - * \brief Returns the current time of the solution. - * \return The current time of the solution t. - */ - time_type current_time( void ) const - { - return m_t; - } - - /** - * \brief Returns the last state of the solution. - * \return The last state of the solution x(t-dt). - */ - const state_type& previous_state( void ) const - { - return get_old_state(); - } - - /** - * \brief Returns the last time of the solution. - * \return The last time of the solution t-dt. - */ - time_type previous_time( void ) const - { - return m_t_old; - } - - /** - * \brief Returns the current time step. - * \return dt. - */ - time_type current_time_step( void ) const - { - return m_dt; - } - - -private: - - state_type& get_current_state( void ) - { - return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ; - } - - const state_type& get_current_state( void ) const - { - return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ; - } - - state_type& get_old_state( void ) - { - return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ; - } - - const state_type& get_old_state( void ) const - { - return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ; - } - - void toggle_current_state( void ) - { - m_current_state_x1 = ! m_current_state_x1; - } - - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() ); - return resized; - } - - - stepper_type m_stepper; - resizer_type m_resizer; - wrapped_state_type m_x1 , m_x2; - bool m_current_state_x1; // if true, the current state is m_x1 - time_type m_t , m_t_old , m_dt; - -}; - - - - - -/** - * \brief The class representing dense-output Runge-Kutta steppers with FSAL property. - * - * The interface is the same as for dense_output_runge_kutta< Stepper , stepper_tag >. - * This class provides dense output functionality based on methods with step size controlled - * - * - * \tparam Stepper The stepper type of the underlying algorithm. - */ -template< class Stepper > -class dense_output_runge_kutta< Stepper , explicit_controlled_stepper_fsal_tag > -{ -public: - - /* - * We do not need all typedefs. - */ - typedef Stepper controlled_stepper_type; - - typedef typename controlled_stepper_type::stepper_type stepper_type; - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_type::time_type time_type; - typedef typename stepper_type::algebra_type algebra_type; - typedef typename stepper_type::operations_type operations_type; - typedef typename stepper_type::resizer_type resizer_type; - typedef dense_output_stepper_tag stepper_category; - typedef dense_output_runge_kutta< Stepper > dense_output_stepper_type; - - - dense_output_runge_kutta( const controlled_stepper_type &stepper = controlled_stepper_type() ) - : m_stepper( stepper ) , m_resizer() , - m_current_state_x1( true ) , - m_x1() , m_x2() , m_dxdt1() , m_dxdt2() , - m_t() , m_t_old() , m_dt() , - m_is_deriv_initialized( false ) - { } - - - template< class StateType > - void initialize( const StateType &x0 , time_type t0 , time_type dt0 ) - { - m_resizer.adjust_size( x0 , detail::bind( &dense_output_stepper_type::template resize< StateType > , detail::ref( *this ) , detail::_1 ) ); - boost::numeric::odeint::copy( x0 , get_current_state() ); - m_t = t0; - m_dt = dt0; - m_is_deriv_initialized = false; - } - - template< class System > - std::pair< time_type , time_type > do_step( System system ) - { - if( !m_is_deriv_initialized ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - sys( get_current_state() , get_current_deriv() , m_t ); - m_is_deriv_initialized = true; - } - - failed_step_checker fail_checker; // to throw a runtime_error if step size adjustment fails - controlled_step_result res = fail; - m_t_old = m_t; - do - { - res = m_stepper.try_step( system , get_current_state() , get_current_deriv() , m_t , - get_old_state() , get_old_deriv() , m_dt ); - fail_checker(); // check for overflow of failed steps - } - while( res == fail ); - toggle_current_state(); - return std::make_pair( m_t_old , m_t ); - } - - - /* - * The two overloads are needed in order to solve the forwarding problem. - */ - template< class StateOut > - void calc_state( time_type t , StateOut &x ) const - { - m_stepper.stepper().calc_state( t , x , get_old_state() , get_old_deriv() , m_t_old , - get_current_state() , get_current_deriv() , m_t ); - } - - template< class StateOut > - void calc_state( time_type t , const StateOut &x ) const - { - m_stepper.stepper().calc_state( t , x , get_old_state() , get_old_deriv() , m_t_old , - get_current_state() , get_current_deriv() , m_t ); - } - - - template< class StateIn > - bool resize( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxdt1 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxdt2 , x , typename is_resizeable<deriv_type>::type() ); - return resized; - } - - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize( x ); - m_stepper.stepper().resize( x ); - } - - const state_type& current_state( void ) const - { - return get_current_state(); - } - - time_type current_time( void ) const - { - return m_t; - } - - const state_type& previous_state( void ) const - { - return get_old_state(); - } - - time_type previous_time( void ) const - { - return m_t_old; - } - - time_type current_time_step( void ) const - { - return m_dt; - } - - -private: - - state_type& get_current_state( void ) - { - return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ; - } - - const state_type& get_current_state( void ) const - { - return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ; - } - - state_type& get_old_state( void ) - { - return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ; - } - - const state_type& get_old_state( void ) const - { - return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ; - } - - deriv_type& get_current_deriv( void ) - { - return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ; - } - - const deriv_type& get_current_deriv( void ) const - { - return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ; - } - - deriv_type& get_old_deriv( void ) - { - return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ; - } - - const deriv_type& get_old_deriv( void ) const - { - return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ; - } - - - void toggle_current_state( void ) - { - m_current_state_x1 = ! m_current_state_x1; - } - - - controlled_stepper_type m_stepper; - resizer_type m_resizer; - bool m_current_state_x1; - wrapped_state_type m_x1 , m_x2; - wrapped_deriv_type m_dxdt1 , m_dxdt2; - time_type m_t , m_t_old , m_dt; - bool m_is_deriv_initialized; - -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp deleted file mode 100644 index cc279abbe0eb574e1a67a7ac608169e287cb84e5..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp - - [begin_description] - Algebra caller for the Adams Bashforth stepper. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED - -#include <boost/assert.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< size_t Step , class Algebra , class Operations > -struct adams_bashforth_call_algebra; - -template< class Algebra , class Operations > -struct adams_bashforth_call_algebra< 1 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each3( out , in , steps[0].m_v , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_bashforth_call_algebra< 2 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each4( out , in , steps[0].m_v , steps[1].m_v , - typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_bashforth_call_algebra< 3 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each5( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , - typename Operations::template scale_sum4< value_type , Time , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_bashforth_call_algebra< 4 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each6( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , - typename Operations::template scale_sum5< value_type , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_bashforth_call_algebra< 5 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each7( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , - typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_bashforth_call_algebra< 6 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each8( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , - typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_bashforth_call_algebra< 7 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - //BOOST_ASSERT( false ); // not implemented - typedef typename Coefficients::value_type value_type; - algebra.for_each9( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v , - typename Operations::template scale_sum8< value_type , Time , Time , Time , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_bashforth_call_algebra< 8 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - //BOOST_ASSERT( false ); // not implemented - typedef typename Coefficients::value_type value_type; - algebra.for_each10( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v , steps[7].m_v , - typename Operations::template scale_sum9< value_type , Time , Time , Time , Time , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] , dt * coef[7] ) ); - } -}; - - - - -} // detail -} // odeint -} // numeric -} // boost - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp deleted file mode 100644 index 26a9f9a6b46980803d72e683896569c08b62b53c..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp - - [begin_description] - Definition of the coefficients for the Adams-Bashforth method. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED - -#include <boost/array.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< class Value , size_t Steps > -class adams_bashforth_coefficients ; - -template< class Value > -class adams_bashforth_coefficients< Value , 1 > : public boost::array< Value , 1 > -{ -public: - adams_bashforth_coefficients( void ) - : boost::array< Value , 1 >() - { - (*this)[0] = static_cast< Value >( 1 ); - } -}; - - -template< class Value > -class adams_bashforth_coefficients< Value , 2 > : public boost::array< Value , 2 > -{ -public: - adams_bashforth_coefficients( void ) - : boost::array< Value , 2 >() - { - (*this)[0] = static_cast< Value >( 3 ) / static_cast< Value >( 2 ); - (*this)[1] = -static_cast< Value >( 1 ) / static_cast< Value >( 2 ); - } -}; - - -template< class Value > -class adams_bashforth_coefficients< Value , 3 > : public boost::array< Value , 3 > -{ -public: - adams_bashforth_coefficients( void ) - : boost::array< Value , 3 >() - { - (*this)[0] = static_cast< Value >( 23 ) / static_cast< Value >( 12 ); - (*this)[1] = -static_cast< Value >( 4 ) / static_cast< Value >( 3 ); - (*this)[2] = static_cast< Value >( 5 ) / static_cast< Value >( 12 ); - } -}; - - -template< class Value > -class adams_bashforth_coefficients< Value , 4 > : public boost::array< Value , 4 > -{ -public: - adams_bashforth_coefficients( void ) - : boost::array< Value , 4 >() - { - (*this)[0] = static_cast< Value >( 55 ) / static_cast< Value >( 24 ); - (*this)[1] = -static_cast< Value >( 59 ) / static_cast< Value >( 24 ); - (*this)[2] = static_cast< Value >( 37 ) / static_cast< Value >( 24 ); - (*this)[3] = -static_cast< Value >( 3 ) / static_cast< Value >( 8 ); - } -}; - - -template< class Value > -class adams_bashforth_coefficients< Value , 5 > : public boost::array< Value , 5 > -{ -public: - adams_bashforth_coefficients( void ) - : boost::array< Value , 5 >() - { - (*this)[0] = static_cast< Value >( 1901 ) / static_cast< Value >( 720 ); - (*this)[1] = -static_cast< Value >( 1387 ) / static_cast< Value >( 360 ); - (*this)[2] = static_cast< Value >( 109 ) / static_cast< Value >( 30 ); - (*this)[3] = -static_cast< Value >( 637 ) / static_cast< Value >( 360 ); - (*this)[4] = static_cast< Value >( 251 ) / static_cast< Value >( 720 ); - } -}; - - -template< class Value > -class adams_bashforth_coefficients< Value , 6 > : public boost::array< Value , 6 > -{ -public: - adams_bashforth_coefficients( void ) - : boost::array< Value , 6 >() - { - (*this)[0] = static_cast< Value >( 4277 ) / static_cast< Value >( 1440 ); - (*this)[1] = -static_cast< Value >( 2641 ) / static_cast< Value >( 480 ); - (*this)[2] = static_cast< Value >( 4991 ) / static_cast< Value >( 720 ); - (*this)[3] = -static_cast< Value >( 3649 ) / static_cast< Value >( 720 ); - (*this)[4] = static_cast< Value >( 959 ) / static_cast< Value >( 480 ); - (*this)[5] = -static_cast< Value >( 95 ) / static_cast< Value >( 288 ); - } -}; - - -template< class Value > -class adams_bashforth_coefficients< Value , 7 > : public boost::array< Value , 7 > -{ -public: - adams_bashforth_coefficients( void ) - : boost::array< Value , 7 >() - { - (*this)[0] = static_cast< Value >( 198721 ) / static_cast< Value >( 60480 ); - (*this)[1] = -static_cast< Value >( 18637 ) / static_cast< Value >( 2520 ); - (*this)[2] = static_cast< Value >( 235183 ) / static_cast< Value >( 20160 ); - (*this)[3] = -static_cast< Value >( 10754 ) / static_cast< Value >( 945 ); - (*this)[4] = static_cast< Value >( 135713 ) / static_cast< Value >( 20160 ); - (*this)[5] = -static_cast< Value >( 5603 ) / static_cast< Value >( 2520 ); - (*this)[6] = static_cast< Value >( 19087 ) / static_cast< Value >( 60480 ); - } -}; - - -template< class Value > -class adams_bashforth_coefficients< Value , 8 > : public boost::array< Value , 8 > -{ -public: - adams_bashforth_coefficients( void ) - : boost::array< Value , 8 >() - { - (*this)[0] = static_cast< Value >( 16083 ) / static_cast< Value >( 4480 ); - (*this)[1] = -static_cast< Value >( 1152169 ) / static_cast< Value >( 120960 ); - (*this)[2] = static_cast< Value >( 242653 ) / static_cast< Value >( 13440 ); - (*this)[3] = -static_cast< Value >( 296053 ) / static_cast< Value >( 13440 ); - (*this)[4] = static_cast< Value >( 2102243 ) / static_cast< Value >( 120960 ); - (*this)[5] = -static_cast< Value >( 115747 ) / static_cast< Value >( 13440 ); - (*this)[6] = static_cast< Value >( 32863 ) / static_cast< Value >( 13440 ); - (*this)[7] = -static_cast< Value >( 5257 ) / static_cast< Value >( 17280 ); - } -}; - - - - - - - -} // detail -} // odeint -} // numeric -} // boost - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp deleted file mode 100644 index 7ed79d2e15070224b34892dd9cd02088cd67fcbe..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp - - [begin_description] - Algebra caller for the Adams Moulton method. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED - -#include <boost/assert.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< size_t Step , class Algebra , class Operations > -struct adams_moulton_call_algebra; - -template< class Algebra , class Operations > -struct adams_moulton_call_algebra< 1 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage& /* steps */ , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each3( out , in , dxdt , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_moulton_call_algebra< 2 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each4( out , in , dxdt , steps[0].m_v , - typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_moulton_call_algebra< 3 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each5( out , in , dxdt , steps[0].m_v , steps[1].m_v , - typename Operations::template scale_sum4< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_moulton_call_algebra< 4 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each6( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , - typename Operations::template scale_sum5< value_type , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_moulton_call_algebra< 5 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each7( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , - typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_moulton_call_algebra< 6 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each8( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , - typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_moulton_call_algebra< 7 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each9( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , - typename Operations::template scale_sum8< value_type , Time , Time , Time , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] ) ); - } -}; - - -template< class Algebra , class Operations > -struct adams_moulton_call_algebra< 8 , Algebra , Operations > -{ - template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time > - void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const - { - typedef typename Coefficients::value_type value_type; - algebra.for_each10( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v , - typename Operations::template scale_sum9< value_type , Time , Time , Time , Time , Time , Time , Time >( - 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] , dt * coef[7] ) ); - } -}; - - - - -} // detail -} // odeint -} // numeric -} // boost - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp deleted file mode 100644 index 8047fa8ae108b59c2d1b9665b89bd71aadd8c441..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp - - [begin_description] - Coefficients for the Adams Moulton method. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED - - -#include <boost/array.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< class Value , size_t Steps > -class adams_moulton_coefficients ; - -template< class Value > -class adams_moulton_coefficients< Value , 1 > : public boost::array< Value , 1 > -{ -public: - adams_moulton_coefficients( void ) - : boost::array< Value , 1 >() - { - (*this)[0] = static_cast< Value >( 1 ); - } -}; - - -template< class Value > -class adams_moulton_coefficients< Value , 2 > : public boost::array< Value , 2 > -{ -public: - adams_moulton_coefficients( void ) - : boost::array< Value , 2 >() - { - (*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ); - (*this)[1] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ); - } -}; - - -template< class Value > -class adams_moulton_coefficients< Value , 3 > : public boost::array< Value , 3 > -{ -public: - adams_moulton_coefficients( void ) - : boost::array< Value , 3 >() - { - (*this)[0] = static_cast< Value >( 5 ) / static_cast< Value >( 12 ); - (*this)[1] = static_cast< Value >( 2 ) / static_cast< Value >( 3 ); - (*this)[2] = -static_cast< Value >( 1 ) / static_cast< Value >( 12 ); - } -}; - - -template< class Value > -class adams_moulton_coefficients< Value , 4 > : public boost::array< Value , 4 > -{ -public: - adams_moulton_coefficients( void ) - : boost::array< Value , 4 >() - { - (*this)[0] = static_cast< Value >( 3 ) / static_cast< Value >( 8 ); - (*this)[1] = static_cast< Value >( 19 ) / static_cast< Value >( 24 ); - (*this)[2] = -static_cast< Value >( 5 ) / static_cast< Value >( 24 ); - (*this)[3] = static_cast< Value >( 1 ) / static_cast< Value >( 24 ); - } -}; - - -template< class Value > -class adams_moulton_coefficients< Value , 5 > : public boost::array< Value , 5 > -{ -public: - adams_moulton_coefficients( void ) - : boost::array< Value , 5 >() - { - (*this)[0] = static_cast< Value >( 251 ) / static_cast< Value >( 720 ); - (*this)[1] = static_cast< Value >( 323 ) / static_cast< Value >( 360 ); - (*this)[2] = -static_cast< Value >( 11 ) / static_cast< Value >( 30 ); - (*this)[3] = static_cast< Value >( 53 ) / static_cast< Value >( 360 ); - (*this)[4] = -static_cast< Value >( 19 ) / static_cast< Value >( 720 ); - } -}; - - -template< class Value > -class adams_moulton_coefficients< Value , 6 > : public boost::array< Value , 6 > -{ -public: - adams_moulton_coefficients( void ) - : boost::array< Value , 6 >() - { - (*this)[0] = static_cast< Value >( 95 ) / static_cast< Value >( 288 ); - (*this)[1] = static_cast< Value >( 1427 ) / static_cast< Value >( 1440 ); - (*this)[2] = -static_cast< Value >( 133 ) / static_cast< Value >( 240 ); - (*this)[3] = static_cast< Value >( 241 ) / static_cast< Value >( 720 ); - (*this)[4] = -static_cast< Value >( 173 ) / static_cast< Value >( 1440 ); - (*this)[5] = static_cast< Value >( 3 ) / static_cast< Value >( 160 ); - } -}; - -template< class Value > -class adams_moulton_coefficients< Value , 7 > : public boost::array< Value , 7 > -{ -public: - adams_moulton_coefficients( void ) - : boost::array< Value , 7 >() - { - (*this)[0] = static_cast< Value >( 19087 ) / static_cast< Value >( 60480 ); - (*this)[1] = static_cast< Value >( 2713 ) / static_cast< Value >( 2520 ); - (*this)[2] = -static_cast< Value >( 15487 ) / static_cast< Value >( 20160 ); - (*this)[3] = static_cast< Value >( 586 ) / static_cast< Value >( 945 ); - (*this)[4] = -static_cast< Value >( 6737 ) / static_cast< Value >( 20160 ); - (*this)[5] = static_cast< Value >( 263 ) / static_cast< Value >( 2520 ); - (*this)[6] = -static_cast< Value >( 863 ) / static_cast< Value >( 60480 ); - } -}; - - -template< class Value > -class adams_moulton_coefficients< Value , 8 > : public boost::array< Value , 8 > -{ -public: - adams_moulton_coefficients( void ) - : boost::array< Value , 8 >() - { - (*this)[0] = static_cast< Value >( 5257 ) / static_cast< Value >( 17280 ); - (*this)[1] = static_cast< Value >( 139849 ) / static_cast< Value >( 120960 ); - (*this)[2] = -static_cast< Value >( 4511 ) / static_cast< Value >( 4480 ); - (*this)[3] = static_cast< Value >( 123133 ) / static_cast< Value >( 120960 ); - (*this)[4] = -static_cast< Value >( 88547 ) / static_cast< Value >( 120960 ); - (*this)[5] = static_cast< Value >( 1537 ) / static_cast< Value >( 4480 ); - (*this)[6] = -static_cast< Value >( 11351 ) / static_cast< Value >( 120960 ); - (*this)[7] = static_cast< Value >( 275 ) / static_cast< Value >( 24192 ); - } -}; - - - - - - - -} // detail -} // odeint -} // numeric -} // boost - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp deleted file mode 100644 index ab74b24ee2a3c7af3e142668809cbba8a4cfb3b4..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp +++ /dev/null @@ -1,247 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp - - [begin_description] - Implementation of the generic Runge-Kutta method. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2012 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED - -#include <boost/static_assert.hpp> - -#include <boost/mpl/vector.hpp> -#include <boost/mpl/push_back.hpp> -#include <boost/mpl/for_each.hpp> -#include <boost/mpl/range_c.hpp> -#include <boost/mpl/copy.hpp> -#include <boost/mpl/size_t.hpp> - -#include <boost/fusion/algorithm.hpp> -#include <boost/fusion/iterator.hpp> -#include <boost/fusion/mpl.hpp> -#include <boost/fusion/sequence.hpp> - -#include <boost/array.hpp> - -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp> -#include <boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp> -#include <boost/numeric/odeint/util/bind.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< class T , class Constant > -struct array_wrapper -{ - typedef const typename boost::array< T , Constant::value > type; -}; - -template< class T , size_t i > -struct stage -{ - T c; - boost::array< T , i > a; -}; - - -template< class T , class Constant > -struct stage_wrapper -{ - typedef stage< T , Constant::value > type; -}; - - -template< -size_t StageCount, -class Value , -class Algebra , -class Operations -> -class generic_rk_algorithm { - -public: - typedef mpl::range_c< size_t , 1 , StageCount > stage_indices; - - typedef typename boost::fusion::result_of::as_vector - < - typename boost::mpl::copy - < - stage_indices , - boost::mpl::inserter - < - boost::mpl::vector0< > , - boost::mpl::push_back< boost::mpl::_1 , array_wrapper< Value , boost::mpl::_2 > > - > - >::type - >::type coef_a_type; - - typedef boost::array< Value , StageCount > coef_b_type; - typedef boost::array< Value , StageCount > coef_c_type; - - typedef typename boost::fusion::result_of::as_vector - < - typename boost::mpl::push_back - < - typename boost::mpl::copy - < - stage_indices, - boost::mpl::inserter - < - boost::mpl::vector0<> , - boost::mpl::push_back< boost::mpl::_1 , stage_wrapper< Value , boost::mpl::_2 > > - > - >::type , - stage< Value , StageCount > - >::type - >::type stage_vector_base; - - - struct stage_vector : public stage_vector_base - { - struct do_insertion - { - stage_vector_base &m_base; - const coef_a_type &m_a; - const coef_c_type &m_c; - - do_insertion( stage_vector_base &base , const coef_a_type &a , const coef_c_type &c ) - : m_base( base ) , m_a( a ) , m_c( c ) { } - - template< class Index > - void operator()( Index ) const - { - //boost::fusion::at< Index >( m_base ) = stage< double , Index::value+1 , intermediate_stage >( m_c[ Index::value ] , boost::fusion::at< Index >( m_a ) ); - boost::fusion::at< Index >( m_base ).c = m_c[ Index::value ]; - boost::fusion::at< Index >( m_base ).a = boost::fusion::at< Index >( m_a ); - } - }; - - struct print_butcher - { - const stage_vector_base &m_base; - std::ostream &m_os; - - print_butcher( const stage_vector_base &base , std::ostream &os ) - : m_base( base ) , m_os( os ) - { } - - template<class Index> - void operator()(Index) const { - m_os << boost::fusion::at<Index>(m_base).c << " | "; - for( size_t i=0 ; i<Index::value ; ++i ) - m_os << boost::fusion::at<Index>(m_base).a[i] << " "; - m_os << std::endl; - } - }; - - - stage_vector( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c ) - { - typedef boost::mpl::range_c< size_t , 0 , StageCount-1 > indices; - boost::mpl::for_each< indices >( do_insertion( *this , a , c ) ); - boost::fusion::at_c< StageCount - 1 >( *this ).c = c[ StageCount - 1 ]; - boost::fusion::at_c< StageCount - 1 >( *this ).a = b; - } - - void print( std::ostream &os ) const - { - typedef boost::mpl::range_c< size_t , 0 , StageCount > indices; - boost::mpl::for_each< indices >( print_butcher( *this , os ) ); - } - }; - - - - template< class System , class StateIn , class StateTemp , class DerivIn , class Deriv , - class StateOut , class Time > - struct calculate_stage - { - Algebra &algebra; - System &system; - const StateIn &x; - StateTemp &x_tmp; - StateOut &x_out; - const DerivIn &dxdt; - Deriv *F; - Time t; - Time dt; - - calculate_stage( Algebra &_algebra , System &_system , const StateIn &_x , const DerivIn &_dxdt , StateOut &_out , - StateTemp &_x_tmp , Deriv *_F , Time _t , Time _dt ) - : algebra( _algebra ) , system( _system ) , x( _x ) , x_tmp( _x_tmp ) , x_out( _out) , dxdt( _dxdt ) , F( _F ) , t( _t ) , dt( _dt ) - {} - - - template< typename T , size_t stage_number > - void inline operator()( stage< T , stage_number > const &stage ) const - //typename stage_fusion_wrapper< T , mpl::size_t< stage_number > , intermediate_stage >::type const &stage ) const - { - if( stage_number > 1 ) - { -#ifdef BOOST_MSVC -#pragma warning( disable : 4307 34 ) -#endif - system( x_tmp , F[stage_number-2].m_v , t + stage.c * dt ); -#ifdef BOOST_MSVC -#pragma warning( default : 4307 34 ) -#endif - } - //std::cout << stage_number-2 << ", t': " << t + stage.c * dt << std::endl; - - if( stage_number < StageCount ) - detail::template generic_rk_call_algebra< stage_number , Algebra >()( algebra , x_tmp , x , dxdt , F , - detail::generic_rk_scale_sum< stage_number , Operations , Value , Time >( stage.a , dt) ); - // algebra_type::template for_eachn<stage_number>( x_tmp , x , dxdt , F , - // typename operations_type::template scale_sumn< stage_number , time_type >( stage.a , dt ) ); - else - detail::template generic_rk_call_algebra< stage_number , Algebra >()( algebra , x_out , x , dxdt , F , - detail::generic_rk_scale_sum< stage_number , Operations , Value , Time >( stage.a , dt ) ); - // algebra_type::template for_eachn<stage_number>( x_out , x , dxdt , F , - // typename operations_type::template scale_sumn< stage_number , time_type >( stage.a , dt ) ); - } - - }; - - generic_rk_algorithm( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c ) - : m_stages( a , b , c ) - { } - - template< class System , class StateIn , class DerivIn , class Time , class StateOut , class StateTemp , class Deriv > - void inline do_step( Algebra &algebra , System system , const StateIn &in , const DerivIn &dxdt , - Time t , StateOut &out , Time dt , - StateTemp &x_tmp , Deriv F[StageCount-1] ) const - { - typedef typename odeint::unwrap_reference< System >::type unwrapped_system_type; - unwrapped_system_type &sys = system; - boost::fusion::for_each( m_stages , calculate_stage< - unwrapped_system_type , StateIn , StateTemp , DerivIn , Deriv , StateOut , Time > - ( algebra , sys , in , dxdt , out , x_tmp , F , t , dt ) ); - } - -private: - stage_vector m_stages; -}; - - -} -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp deleted file mode 100644 index 0249d86405ba92dfd60691583c1ea630867eed01..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp - - [begin_description] - Algebra caller for the generic Runge-Kutta methods. - [end_description] - - Copyright 2011-2012 Mario Mulansky - Copyright 2011-2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED - - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< size_t StageNumber , class Algebra > -struct generic_rk_call_algebra; - -template< class Algebra > -struct generic_rk_call_algebra< 1 , Algebra > -{ - typedef Algebra algebra_type; - - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( algebra_type &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 * /* s4_array */ , Op op ) const - { - algebra.for_each3( s1 , s2 , s3 , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( algebra_type &algebra , S1 &s1 , S2 &s2 , S4 * /* s4_array */ , Op op ) const - { - algebra.for_each2( s1 , s2 , op ); - } -}; - -template< class Algebra > -struct generic_rk_call_algebra< 2 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[1] , Op op ) const - { - algebra.for_each4( s1 , s2 , s3 , s4_array[0].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[1] , Op op ) const - { - algebra.for_each3( s1 , s2 , s4_array[0].m_v , op ); - } -}; - - -template< class Algebra > -struct generic_rk_call_algebra< 3 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[2] , Op op ) const - { - algebra.for_each5( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[2] , Op op ) const - { - algebra.for_each4( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , op ); - } -}; - - -template< class Algebra > -struct generic_rk_call_algebra< 4 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[3] , Op op ) const - { - algebra.for_each6( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[3] , Op op ) const - { - algebra.for_each5( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , op ); - } -}; - - -template< class Algebra > -struct generic_rk_call_algebra< 5 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[4] , Op op ) const - { - algebra.for_each7( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[4] , Op op ) const - { - algebra.for_each6( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , op ); - } -}; - -template< class Algebra > -struct generic_rk_call_algebra< 6 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[5] , Op op ) const - { - algebra.for_each8( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[5] , Op op ) const - { - algebra.for_each7( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , op ); - } -}; - -template< class Algebra > -struct generic_rk_call_algebra< 7 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[6] , Op op ) const - { - algebra.for_each9( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[6] , Op op ) const - { - algebra.for_each8( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , op ); - } -}; - -template< class Algebra > -struct generic_rk_call_algebra< 8 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[7] , Op op ) const - { - algebra.for_each10( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[7] , Op op ) const - { - algebra.for_each9( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , op ); - } -}; - -template< class Algebra > -struct generic_rk_call_algebra< 9 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[8] , Op op ) const - { - algebra.for_each11( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[8] , Op op ) const - { - algebra.for_each10( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , op ); - } -}; - -template< class Algebra > -struct generic_rk_call_algebra< 10 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[9] , Op op ) const - { - algebra.for_each12( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[9] , Op op ) const - { - algebra.for_each11( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , op ); - } -}; - - -template< class Algebra > -struct generic_rk_call_algebra< 11 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[10] , Op op ) const - { - algebra.for_each13( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[10] , Op op ) const - { - algebra.for_each12( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , op ); - } -}; - -template< class Algebra > -struct generic_rk_call_algebra< 12 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[11] , Op op ) const - { - algebra.for_each14( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[11] , Op op ) const - { - algebra.for_each13( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , op ); - } -}; - -template< class Algebra > -struct generic_rk_call_algebra< 13 , Algebra > -{ - template< class S1 , class S2 , class S3 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[12] , Op op ) const - { - algebra.for_each15( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , s4_array[11].m_v , op ); - } - - template< class S1 , class S2 , class S4 , class Op> - void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[12] , Op op ) const - { - algebra.for_each14( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , - s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , s4_array[11].m_v , op ); - } -}; - -} -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp deleted file mode 100644 index 2cce3f4d0bdc5bc975543597800bf0b4c8450762..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp +++ /dev/null @@ -1,252 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp - - [begin_description] - Operations caller for the generic Runge Kutta method. - [end_description] - - Copyright 2011 Mario Mulansky - Copyright 2011-2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED - - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< size_t StageNumber , class Operations , class Fac , class Time > -struct generic_rk_scale_sum; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 1 , Operations , Fac , Time > : public Operations::template scale_sum2< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,1> &a , Time dt ) : Operations::template scale_sum2< Fac , Time >( 1.0 , a[0]*dt ) - { } - - typedef void result_type; -}; - - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 2 , Operations , Fac , Time > : public Operations::template scale_sum3< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,2> &a , Time dt ) - : Operations::template scale_sum3< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 3 , Operations , Fac , Time > : public Operations::template scale_sum4< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,3> &a , Time dt ) - : Operations::template scale_sum4< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 4 , Operations , Fac , Time > : public Operations::template scale_sum5< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,4> &a , Time dt ) - : Operations::template scale_sum5< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 5 , Operations , Fac , Time > : public Operations::template scale_sum6< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,5> &a , Time dt ) - : Operations::template scale_sum6< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 6 , Operations , Fac , Time > : public Operations::template scale_sum7< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,6> &a , Time dt ) - : Operations::template scale_sum7< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 7 , Operations , Fac , Time > : public Operations::template scale_sum8< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,7> &a , Time dt ) - : Operations::template scale_sum8< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt , a[6]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 8 , Operations , Fac , Time > : public Operations::template scale_sum9< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,8> &a , Time dt ) - : Operations::template scale_sum9< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , - a[5]*dt , a[6]*dt , a[7]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 9 , Operations , Fac , Time > : public Operations::template scale_sum10< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,9> &a , Time dt ) - : Operations::template scale_sum10< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , - a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 10 , Operations , Fac , Time > : public Operations::template scale_sum11< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,10> &a , Time dt ) - : Operations::template scale_sum11< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , - a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 11 , Operations , Fac , Time > : public Operations::template scale_sum12< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,11> &a , Time dt ) - : Operations::template scale_sum12< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , - a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 12 , Operations , Fac , Time > : public Operations::template scale_sum13< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,12> &a , Time dt ) - : Operations::template scale_sum13< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , - a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum< 13 , Operations , Fac , Time > : public Operations::template scale_sum14< Fac , Time > -{ - generic_rk_scale_sum( const boost::array<Fac,13> &a , Time dt ) - : Operations::template scale_sum14< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , - a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt , a[12]*dt ) - { } - - typedef void result_type; -}; - - -// for error estimates -template< size_t StageNumber , class Operations , class Fac , class Time > -struct generic_rk_scale_sum_err; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum_err< 1 , Operations , Fac , Time > : public Operations::template scale_sum1< Time > -{ - generic_rk_scale_sum_err( const boost::array<Fac,1> &a , Time dt ) : Operations::template scale_sum1< Time >( a[0]*dt ) - { } - - typedef void result_type; -}; - - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum_err< 2 , Operations , Fac , Time > : public Operations::template scale_sum2< Time > -{ - generic_rk_scale_sum_err( const boost::array<Fac,2> &a , Time dt ) - : Operations::template scale_sum2< Time >( a[0]*dt , a[1]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum_err< 3 , Operations , Fac , Time > : public Operations::template scale_sum3< Time > -{ - generic_rk_scale_sum_err( const boost::array<Fac,3> &a , Time dt ) - : Operations::template scale_sum3< Time >( a[0]*dt , a[1]*dt , a[2]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum_err< 4 , Operations , Fac , Time > : public Operations::template scale_sum4< Time > -{ - generic_rk_scale_sum_err( const boost::array<Fac,4> &a , Time dt ) - : Operations::template scale_sum4< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt ) - { } - - typedef void result_type; -}; - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum_err< 5 , Operations , Fac , Time > : public Operations::template scale_sum5< Fac > -{ - generic_rk_scale_sum_err( const boost::array<Fac,5> &a , Time dt ) - : Operations::template scale_sum5< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ) - { } - - typedef void result_type; -}; - - -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum_err< 6 , Operations , Fac , Time > : public Operations::template scale_sum6< Time > -{ - generic_rk_scale_sum_err( const boost::array<Fac,6> &a , Time dt ) - : Operations::template scale_sum6< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt ) - { } - - typedef void result_type; -}; - - -// for rk87 -template< class Operations , class Fac , class Time > -struct generic_rk_scale_sum_err< 13 , Operations , Fac , Time > : public Operations::template scale_sum13< Time > -{ - generic_rk_scale_sum_err( const boost::array<Fac,13> &a , Time dt ) - : Operations::template scale_sum13< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt , - a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt , a[12]*dt ) - { } - - typedef void result_type; -}; - - -} -} -} -} - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp deleted file mode 100644 index 2338afd94a22bbd262e9587aab72fd466842dcf2..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/detail/rotating_buffer.hpp - - [begin_description] - Implemetation of a rotating (cyclic) buffer for use in the Adam Bashforth stepper - [end_description] - - Copyright 2011 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED - -#include <boost/array.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -template< class T , size_t N > -class rotating_buffer -{ -public: - - typedef T value_type; - const static size_t dim = N; - - rotating_buffer( void ) : m_first( 0 ) - { } - - size_t size( void ) const - { - return dim; - } - - value_type& operator[]( size_t i ) - { - return m_data[ get_index( i ) ]; - } - - const value_type& operator[]( size_t i ) const - { - return m_data[ get_index( i ) ]; - } - - void rotate( void ) - { - if( m_first == 0 ) - m_first = dim-1; - else - --m_first; - } - -protected: - - value_type m_data[N]; - -private: - - size_t get_index( size_t i ) const - { - return ( ( i + m_first ) % dim ); - } - - size_t m_first; - -}; - - -} // detail -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/euler.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/euler.hpp deleted file mode 100644 index 4941379d6c64de2f8980102e40fc29f6a5f612a1..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/euler.hpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/euler.hpp - - [begin_description] - Implementation of the classical explicit Euler stepper. This method is really simple and should only - be used for demonstration purposes. - [end_description] - - Copyright 2010-2013 Karsten Ahnert - Copyright 2010-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED - - -#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -template< -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -#ifndef DOXYGEN_SKIP -class euler -: public explicit_stepper_base< - euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > -#else -class euler : public explicit_stepper_base -#endif -{ -public : - - #ifndef DOXYGEN_SKIP - typedef explicit_stepper_base< euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > , 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type; - #else - typedef explicit_stepper_base< euler< ... > , ... > stepper_base_type; - #endif - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - - #ifndef DOXYGEN_SKIP - typedef typename stepper_base_type::stepper_type stepper_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - #endif - - - euler( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra ) - { } - - template< class System , class StateIn , class DerivIn , class StateOut > - void do_step_impl( System /* system */ , const StateIn &in , const DerivIn &dxdt , time_type /* t */ , StateOut &out , time_type dt ) - { - stepper_base_type::m_algebra.for_each3( out , in , dxdt , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) ); - - } - - template< class StateOut , class StateIn1 , class StateIn2 > - void calc_state( StateOut &x , time_type t , const StateIn1 &old_state , time_type t_old , const StateIn2 & /*current_state*/ , time_type /* t_new */ ) const - { - const time_type delta = t - t_old; - stepper_base_type::m_algebra.for_each3( x , old_state , stepper_base_type::m_dxdt.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) ); - } - - template< class StateType > - void adjust_size( const StateType &x ) - { - stepper_base_type::adjust_size( x ); - } -}; - - - -/********** DOXYGEN ***********/ - -/** - * \class euler - * \brief An implementation of the Euler method. - * - * The Euler method is a very simply solver for ordinary differential equations. This method should not be used - * for real applications. It is only useful for demonstration purposes. Step size control is not provided but - * trivial continuous output is available. - * - * This class derives from explicit_stepper_base and inherits its interface via CRTP (current recurring template pattern), - * see explicit_stepper_base - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - /** - * \fn euler::euler( const algebra_type &algebra ) - * \brief Constructs the euler class. This constructor can be used as a default - * constructor of the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - /** - * \fn euler::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method. - * The result is updated out of place, hence the input is in `in` and the output in `out`. - * Access to this step functionality is provided by explicit_stepper_base and - * `do_step_impl` should not be called directly. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - - /** - * \fn euler::calc_state( StateOut &x , time_type t , const StateIn1 &old_state , time_type t_old , const StateIn2 ¤t_state , time_type t_new ) const - * \brief This method is used for continuous output and it calculates the state `x` at a time `t` from the - * knowledge of two states `old_state` and `current_state` at time points `t_old` and `t_new`. - */ - - /** - * \fn euler::adjust_size( const StateType &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp deleted file mode 100644 index cf028d8b07fb87d3b86d95acb02765b7caae8a37..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp +++ /dev/null @@ -1,255 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp - - [begin_description] - Implementation of the generic Runge Kutta error stepper. Base class for many RK error steppers. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_ERROR_GENERIC_RK_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_ERROR_GENERIC_RK_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp> - -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> -#include <boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp> -#include <boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp> -#include <boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - - - -namespace boost { -namespace numeric { -namespace odeint { - - -template< -size_t StageCount, -size_t Order, -size_t StepperOrder , -size_t ErrorOrder , -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -#ifndef DOXYGEN_SKIP -class explicit_error_generic_rk -: public explicit_error_stepper_base< - explicit_error_generic_rk< StageCount , Order , StepperOrder , ErrorOrder , State , - Value , Deriv , Time , Algebra , Operations , Resizer > , - Order , StepperOrder , ErrorOrder , State , Value , Deriv , Time , Algebra , - Operations , Resizer > -#else -class explicit_error_generic_rk : public explicit_error_stepper_base -#endif -{ - -public: -#ifndef DOXYGEN_SKIP - typedef explicit_error_stepper_base< - explicit_error_generic_rk< StageCount , Order , StepperOrder , ErrorOrder , State , - Value , Deriv , Time , Algebra , Operations , Resizer > , - Order , StepperOrder , ErrorOrder , State , Value , Deriv , Time , Algebra , - Operations , Resizer > stepper_base_type; -#else - typedef explicit_stepper_base< ... > stepper_base_type; -#endif - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; -#ifndef DOXYGEN_SKIP - typedef explicit_error_generic_rk< StageCount , Order , StepperOrder , ErrorOrder , State , - Value , Deriv , Time , Algebra , Operations , Resizer > stepper_type; -#endif - typedef detail::generic_rk_algorithm< StageCount , Value , Algebra , Operations > rk_algorithm_type; - - typedef typename rk_algorithm_type::coef_a_type coef_a_type; - typedef typename rk_algorithm_type::coef_b_type coef_b_type; - typedef typename rk_algorithm_type::coef_c_type coef_c_type; - - static const size_t stage_count = StageCount; - -private: - - -public: - - // we use an explicit_generic_rk to do the normal rk step - // and add a separate calculation of the error estimate afterwards - explicit_error_generic_rk( const coef_a_type &a , - const coef_b_type &b , - const coef_b_type &b2 , - const coef_c_type &c , - const algebra_type &algebra = algebra_type() ) - : stepper_base_type( algebra ) , m_rk_algorithm( a , b , c ) , m_b2( b2 ) - { } - - - template< class System , class StateIn , class DerivIn , class StateOut , class Err > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , - time_type t , StateOut &out , time_type dt , Err &xerr ) - { - // normal step - do_step_impl( system , in , dxdt , t , out , dt ); - - // additionally, perform the error calculation - detail::template generic_rk_call_algebra< StageCount , algebra_type >()( stepper_base_type::m_algebra , - xerr , dxdt , m_F , detail::generic_rk_scale_sum_err< StageCount , operations_type , value_type , time_type >( m_b2 , dt) ); - } - - - template< class System , class StateIn , class DerivIn , class StateOut > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , - time_type t , StateOut &out , time_type dt ) - { - m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ); - - // actual calculation done in generic_rk.hpp - m_rk_algorithm.do_step( stepper_base_type::m_algebra , system , in , dxdt , t , out , dt , m_x_tmp.m_v , m_F ); - } - - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_impl( x ); - stepper_base_type::adjust_size( x ); - } - - -private: - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized( false ); - resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() ); - for( size_t i = 0 ; i < StageCount-1 ; ++i ) - { - resized |= adjust_size_by_resizeability( m_F[i] , x , typename is_resizeable<deriv_type>::type() ); - } - return resized; - } - - - rk_algorithm_type m_rk_algorithm; - coef_b_type m_b2; - - resizer_type m_resizer; - - wrapped_state_type m_x_tmp; - wrapped_deriv_type m_F[StageCount-1]; - -}; - - -/********* DOXYGEN *********/ - -/** - * \class explicit_error_generic_rk - * \brief A generic implementation of explicit Runge-Kutta algorithms with error estimation. This class is as a - * base class for all explicit Runge-Kutta steppers with error estimation. - * - * This class implements the explicit Runge-Kutta algorithms with error estimation in a generic way. - * The Butcher tableau is passed to the stepper which constructs the stepper scheme with the help of a - * template-metaprogramming algorithm. ToDo : Add example! - * - * This class derives explicit_error_stepper_base which provides the stepper interface. - * - * \tparam StageCount The number of stages of the Runge-Kutta algorithm. - * \tparam Order The order of a stepper if the stepper is used without error estimation. - * \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have - * the same value. - * \tparam ErrorOrder The order of the error step if the stepper is used with error estimation. - * \tparam State The type representing the state of the ODE. - * \tparam Value The floating point type which is used in the computations. - * \tparam Time The type representing the independent variable - the time - of the ODE. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - - /** - * \fn explicit_error_generic_rk::explicit_error_generic_rk( const coef_a_type &a , const coef_b_type &b , const coef_b_type &b2 , const coef_c_type &c , const algebra_type &algebra ) - * \brief Constructs the explicit_error_generik_rk class with the given parameters a, b, b2 and c. See examples section for details on the coefficients. - * - * \param a Triangular matrix of parameters b in the Butcher tableau. - * \param b Last row of the butcher tableau. - * \param b2 Parameters for lower-order evaluation to estimate the error. - * \param c Parameters to calculate the time points in the Butcher tableau. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - - /** - * \fn explicit_error_generic_rk::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr ) - * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method. - * The result is updated out-of-place, hence the input is in `in` and the output in `out`. Futhermore, an - * estimation of the error is stored in `xerr`. `do_step_impl` is used by explicit_error_stepper_base. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - * \param xerr The result of the error estimation is written in xerr. - */ - - /** - * \fn explicit_error_generic_rk::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method. - * The result is updated out-of-place, hence the input is in `in` and the output in `out`. - * Access to this step functionality is provided by explicit_stepper_base and - * `do_step_impl` should not be called directly. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - /** - * \fn explicit_error_generic_rk::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} -} -} - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_ERROR_GENERIC_RK_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/explicit_generic_rk.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/explicit_generic_rk.hpp deleted file mode 100644 index 620c8b733f22be53eefce5abb79f7ee32c31aa70..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/explicit_generic_rk.hpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/explicit_generic_rk.hpp - - [begin_description] - Implementation of the generic Runge-Kutta steppers. This is the base class for many Runge-Kutta steppers. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED - - -#include <boost/array.hpp> - - -#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> -#include <boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -//forward declarations - -#ifndef DOXYGEN_SKIP -template< -size_t StageCount, -size_t Order, -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -class explicit_generic_rk; - - -struct stage_vector; - -template< class T , class Constant > -struct array_wrapper -{ - typedef const typename boost::array< T , Constant::value > type; -}; - -template< class T , size_t i > -struct stage -{ - T c; - boost::array< T , i > a; -}; - - -template< class T , class Constant > -struct stage_wrapper -{ - typedef stage< T , Constant::value > type; -}; -#endif - - -template< -size_t StageCount, -size_t Order, -class State , -class Value , -class Deriv , -class Time , -class Algebra , -class Operations , -class Resizer -> -#ifndef DOXYGEN_SKIP -class explicit_generic_rk : public explicit_stepper_base< -explicit_generic_rk< StageCount , Order , State , Value , Deriv , Time , Algebra , Operations , Resizer > , -Order , State , Value , Deriv , Time , Algebra , Operations , Resizer > -#else -class explicit_generic_rk : public explicit_stepper_base -#endif -{ - -public: - - #ifndef DOXYGEN_SKIP - typedef explicit_stepper_base< - explicit_generic_rk< StageCount , Order , State , Value , Deriv ,Time , Algebra , Operations , Resizer > , - Order , State , Value , Deriv , Time , Algebra , - Operations , Resizer > stepper_base_type; - #else - typedef explicit_stepper_base< ... > stepper_base_type; - #endif - - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - - #ifndef DOXYGEN_SKIP - typedef explicit_generic_rk< StageCount , Order , State , Value , Deriv ,Time , Algebra , Operations , Resizer > stepper_type; - #endif - - typedef detail::generic_rk_algorithm< StageCount , Value , Algebra , Operations > rk_algorithm_type; - - typedef typename rk_algorithm_type::coef_a_type coef_a_type; - typedef typename rk_algorithm_type::coef_b_type coef_b_type; - typedef typename rk_algorithm_type::coef_c_type coef_c_type; - - #ifndef DOXYGEN_SKIP - static const size_t stage_count = StageCount; - #endif - -public: - - explicit_generic_rk( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c , - const algebra_type &algebra = algebra_type() ) - : stepper_base_type( algebra ) , m_rk_algorithm( a , b , c ) - { } - - - template< class System , class StateIn , class DerivIn , class StateOut > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , - time_type t , StateOut &out , time_type dt ) - { - m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ); - - // actual calculation done in generic_rk.hpp - m_rk_algorithm.do_step( stepper_base_type::m_algebra , system , in , dxdt , t , out , dt , m_x_tmp.m_v , m_F ); - } - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_impl( x ); - stepper_base_type::adjust_size( x ); - } - -private: - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized( false ); - resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() ); - for( size_t i = 0 ; i < StageCount-1 ; ++i ) - { - resized |= adjust_size_by_resizeability( m_F[i] , x , typename is_resizeable<deriv_type>::type() ); - } - return resized; - } - - - rk_algorithm_type m_rk_algorithm; - - resizer_type m_resizer; - - wrapped_state_type m_x_tmp; - wrapped_deriv_type m_F[StageCount-1]; - -}; - - - -/*********** DOXYGEN *************/ - -/** - * \class explicit_generic_rk - * \brief A generic implementation of explicit Runge-Kutta algorithms. This class is as a base class - * for all explicit Runge-Kutta steppers. - * - * This class implements the explicit Runge-Kutta algorithms without error estimation in a generic way. - * The Butcher tableau is passed to the stepper which constructs the stepper scheme with the help of a - * template-metaprogramming algorithm. ToDo : Add example! - * - * This class derives explicit_stepper_base which provides the stepper interface. - * - * \tparam StageCount The number of stages of the Runge-Kutta algorithm. - * \tparam Order The order of the stepper. - * \tparam State The type representing the state of the ODE. - * \tparam Value The floating point type which is used in the computations. - * \tparam Time The type representing the independent variable - the time - of the ODE. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - /** - * \fn explicit_generic_rk::explicit_generic_rk( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c , const algebra_type &algebra ) - * \brief Constructs the explicit_generic_rk class. See examples section for details on the coefficients. - * \param a Triangular matrix of parameters b in the Butcher tableau. - * \param b Last row of the butcher tableau. - * \param c Parameters to calculate the time points in the Butcher tableau. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - /** - * \fn explicit_generic_rk::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method. - * The result is updated out of place, hence the input is in `in` and the output in `out`. - * Access to this step functionality is provided by explicit_stepper_base and - * `do_step_impl` should not be called directly. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - - /** - * \fn explicit_generic_rk::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} -} -} -#endif // BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/extrapolation_stepper.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/extrapolation_stepper.hpp deleted file mode 100644 index 3b688e958baf15d005d9b4d5d7d1a2e4c64f6982..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/extrapolation_stepper.hpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/extrapolation_stepper.hpp - - [begin_description] - extrapolation stepper - [end_description] - - Copyright 2009-2015 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EXTRAPOLATION_STEPPER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_EXTRAPOLATION_STEPPER_HPP_INCLUDED - -#include <iostream> - -#include <algorithm> - -#include <boost/config.hpp> // for min/max guidelines -#include <boost/static_assert.hpp> - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> - -#include <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp> -#include <boost/numeric/odeint/stepper/modified_midpoint.hpp> -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/unit_helper.hpp> -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -namespace boost -{ -namespace numeric -{ -namespace odeint -{ - -template < unsigned short Order, class State, class Value = double, - class Deriv = State, class Time = Value, - class Algebra = typename algebra_dispatcher< State >::algebra_type, - class Operations = - typename operations_dispatcher< State >::operations_type, - class Resizer = initially_resizer > -#ifndef DOXYGEN_SKIP -class extrapolation_stepper - : public explicit_error_stepper_base< - extrapolation_stepper< Order, State, Value, Deriv, Time, Algebra, - Operations, Resizer >, - Order, Order, Order - 2, State, Value, Deriv, Time, Algebra, - Operations, Resizer > -#else -class extrapolation_stepper : public explicit_error_stepper_base -#endif -{ - - private: - // check for Order being odd - BOOST_STATIC_ASSERT_MSG( - ( ( Order % 2 ) == 0 ) && ( Order > 2 ), - "extrapolation_stepper requires even Order larger than 2" ); - - public: -#ifndef DOXYGEN_SKIP - typedef explicit_error_stepper_base< - extrapolation_stepper< Order, State, Value, Deriv, Time, Algebra, - Operations, Resizer >, - Order, Order, Order - 2, State, Value, Deriv, Time, Algebra, Operations, - Resizer > stepper_base_type; -#else - typedef explicit_error_stepper_base< extrapolation_stepper< ... >, ... > - stepper_base_type; -#endif - - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - -#ifndef DOXYGEN_SKIP - typedef typename stepper_base_type::stepper_type stepper_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - - typedef std::vector< value_type > value_vector; - typedef std::vector< value_vector > value_matrix; - typedef std::vector< size_t > int_vector; - typedef std::vector< wrapped_state_type > state_table_type; - typedef modified_midpoint< state_type, value_type, deriv_type, time_type, - algebra_type, operations_type, - resizer_type > midpoint_stepper_type; - -#endif // DOXYGEN_SKIP - - typedef unsigned short order_type; - static const order_type order_value = stepper_base_type::order_value; - static const order_type stepper_order_value = - stepper_base_type::stepper_order_value; - static const order_type error_order_value = - stepper_base_type::error_order_value; - - const static size_t m_k_max = ( order_value - 2 ) / 2; - - extrapolation_stepper( const algebra_type &algebra = algebra_type() ) - : stepper_base_type( algebra ), m_interval_sequence( m_k_max + 1 ), - m_coeff( m_k_max + 1 ), m_table( m_k_max ) - { - for ( unsigned short i = 0; i < m_k_max + 1; i++ ) - { - m_interval_sequence[i] = 2 * ( i + 1 ); - m_coeff[i].resize( i ); - for ( size_t k = 0; k < i; ++k ) - { - const value_type r = - static_cast< value_type >( m_interval_sequence[i] ) / - static_cast< value_type >( m_interval_sequence[k] ); - m_coeff[i][k] = - static_cast< value_type >( 1 ) / - ( r * r - static_cast< value_type >( - 1 ) ); // coefficients for extrapolation - } - } - } - - template < class System, class StateIn, class DerivIn, class StateOut, - class Err > - void do_step_impl( System system, const StateIn &in, const DerivIn &dxdt, - time_type t, StateOut &out, time_type dt, Err &xerr ) - { - // std::cout << "dt: " << dt << std::endl; - // normal step - do_step_impl( system, in, dxdt, t, out, dt ); - - static const value_type val1( 1.0 ); - // additionally, perform the error calculation - stepper_base_type::m_algebra.for_each3( - xerr, out, m_table[0].m_v, - typename operations_type::template scale_sum2< - value_type, value_type >( val1, -val1 ) ); - } - - template < class System, class StateInOut, class DerivIn, class Err > - void do_step_impl_io( System system, StateInOut &inout, const DerivIn &dxdt, - time_type t, time_type dt, Err &xerr ) - { - // normal step - do_step_impl_io( system, inout, dxdt, t, dt ); - - static const value_type val1( 1.0 ); - // additionally, perform the error calculation - stepper_base_type::m_algebra.for_each3( - xerr, inout, m_table[0].m_v, - typename operations_type::template scale_sum2< - value_type, value_type >( val1, -val1 ) ); - } - - template < class System, class StateIn, class DerivIn, class StateOut > - void do_step_impl( System system, const StateIn &in, const DerivIn &dxdt, - time_type t, StateOut &out, time_type dt ) - { - m_resizer.adjust_size( - in, detail::bind( &stepper_type::template resize_impl< StateIn >, - detail::ref( *this ), detail::_1 ) ); - size_t k = 0; - m_midpoint.set_steps( m_interval_sequence[k] ); - m_midpoint.do_step( system, in, dxdt, t, out, dt ); - for ( k = 1; k <= m_k_max; ++k ) - { - m_midpoint.set_steps( m_interval_sequence[k] ); - m_midpoint.do_step( system, in, dxdt, t, m_table[k - 1].m_v, dt ); - extrapolate( k, m_table, m_coeff, out ); - } - } - - template < class System, class StateInOut, class DerivIn > - void do_step_impl_io( System system, StateInOut &inout, const DerivIn &dxdt, - time_type t, time_type dt ) - { - // special care for inout - m_xout_resizer.adjust_size( - inout, - detail::bind( &stepper_type::template resize_m_xout< StateInOut >, - detail::ref( *this ), detail::_1 ) ); - do_step_impl( system, inout, dxdt, t, m_xout.m_v, dt ); - boost::numeric::odeint::copy( m_xout.m_v, inout ); - } - - template < class System, class StateInOut, class DerivIn > - void do_step_dxdt_impl( System system, StateInOut &x, const DerivIn &dxdt, - time_type t, time_type dt ) - { - do_step_impl_io( system , x , dxdt , t , dt ); - } - - template < class System, class StateIn, class DerivIn, class StateOut > - void do_step_dxdt_impl( System system, const StateIn &in, - const DerivIn &dxdt, time_type t, StateOut &out, - time_type dt ) - { - do_step_impl( system , in , dxdt , t , out , dt ); - } - - - template < class StateIn > void adjust_size( const StateIn &x ) - { - resize_impl( x ); - m_midpoint.adjust_size( x ); - } - - private: - template < class StateIn > bool resize_impl( const StateIn &x ) - { - bool resized( false ); - for ( size_t i = 0; i < m_k_max; ++i ) - resized |= adjust_size_by_resizeability( - m_table[i], x, typename is_resizeable< state_type >::type() ); - return resized; - } - - template < class StateIn > bool resize_m_xout( const StateIn &x ) - { - return adjust_size_by_resizeability( - m_xout, x, typename is_resizeable< state_type >::type() ); - } - - template < class StateInOut > - void extrapolate( size_t k, state_table_type &table, - const value_matrix &coeff, StateInOut &xest ) - /* polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf - uses the obtained intermediate results to extrapolate to dt->0 - */ - { - static const value_type val1 = static_cast< value_type >( 1.0 ); - - for ( int j = k - 1; j > 0; --j ) - { - stepper_base_type::m_algebra.for_each3( - table[j - 1].m_v, table[j].m_v, table[j - 1].m_v, - typename operations_type::template scale_sum2< - value_type, value_type >( val1 + coeff[k][j], - -coeff[k][j] ) ); - } - stepper_base_type::m_algebra.for_each3( - xest, table[0].m_v, xest, - typename operations_type::template scale_sum2< - value_type, value_type >( val1 + coeff[k][0], -coeff[k][0] ) ); - } - - private: - midpoint_stepper_type m_midpoint; - - resizer_type m_resizer; - resizer_type m_xout_resizer; - - int_vector m_interval_sequence; // stores the successive interval counts - value_matrix m_coeff; - - wrapped_state_type m_xout; - state_table_type m_table; // sequence of states for extrapolation -}; - -/******** DOXYGEN *******/ - -/** - * \class extrapolation_stepper - * \brief Extrapolation stepper with configurable order, and error estimation. - * - * The extrapolation stepper is a stepper with error estimation and configurable - * order. The order is given as template parameter and needs to be an _odd_ - * number. The stepper is based on several executions of the modified midpoint - * method and a Richardson extrapolation. This is essentially the same technique - * as for bulirsch_stoer, but without the variable order. - * - * \note The Order parameter has to be an even number greater 2. - */ -} -} -} -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation.hpp deleted file mode 100644 index 90ad2b9a76f500b74b961d40ad2ba8968fc07287..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation.hpp - - [begin_description] - Forward header for the factory functions. Includes all files from the generation directory. - [end_description] - - Copyright 2011 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp> -#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp> - -#include <boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp> - -#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp> -#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp> -#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp> -#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp> - - -#include <boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp> - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp deleted file mode 100644 index bad2bedfef11a61f4923acd34f42969b33328f30..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp - - [begin_description] - Specialization of the controller factory for the controlled_runge_kutta class. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - -// controller factory for controlled_runge_kutta -template< class Stepper > -struct controller_factory< Stepper , controlled_runge_kutta< Stepper > > -{ - typedef Stepper stepper_type; - typedef controlled_runge_kutta< stepper_type > controller_type; - typedef typename controller_type::error_checker_type error_checker_type; - typedef typename controller_type::step_adjuster_type step_adjuster_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::value_type time_type; - - controller_type operator()( value_type abs_error , value_type rel_error , const stepper_type &stepper ) - { - return controller_type( error_checker_type( abs_error , rel_error ) , - step_adjuster_type() , stepper ); - } - - controller_type operator()( value_type abs_error , value_type rel_error , - time_type max_dt, const stepper_type &stepper ) - { - return controller_type( error_checker_type( abs_error , rel_error ) , - step_adjuster_type(max_dt) , stepper ); - } -}; - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp deleted file mode 100644 index 276358a12e525e0dfad996e870b3b4bcce70bf88..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp - - [begin_description] - Specialization of the controller factory for the dense_output_runge_kutta class. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -// controller factory for controlled_runge_kutta -template< class Stepper > -struct dense_output_factory< Stepper , dense_output_runge_kutta< controlled_runge_kutta< Stepper > > > -{ - typedef Stepper stepper_type; - typedef controlled_runge_kutta< stepper_type > controller_type; - typedef typename controller_type::error_checker_type error_checker_type; - typedef typename controller_type::step_adjuster_type step_adjuster_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::time_type time_type; - typedef dense_output_runge_kutta< controller_type > dense_output_type; - - dense_output_type operator()( value_type abs_error , value_type rel_error , const stepper_type &stepper ) - { - return dense_output_type( controller_type( error_checker_type( abs_error , rel_error ) , - step_adjuster_type() , stepper ) ); - } - - dense_output_type operator()( value_type abs_error , value_type rel_error , - time_type max_dt , const stepper_type &stepper ) - { - return dense_output_type( - controller_type( error_checker_type( abs_error , rel_error) , - step_adjuster_type( max_dt ) , stepper ) ); - } -}; - - - - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp deleted file mode 100644 index 366cb5e9c4979547a6b61ce9388df015164f65c9..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp - - [begin_description] - Enable the factory functions for the controller and the dense output of the Rosenbrock4 method. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/rosenbrock4.hpp> -#include <boost/numeric/odeint/stepper/rosenbrock4_controller.hpp> -#include <boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - -template< class Value , class Coefficients , class Resize > -struct get_controller< rosenbrock4< Value , Coefficients , Resize > > -{ - typedef rosenbrock4< Value , Coefficients , Resize > stepper_type; - typedef rosenbrock4_controller< stepper_type > type; -}; - - - -template< class Value , class Coefficients , class Resize > -struct get_dense_output< rosenbrock4< Value , Coefficients , Resize > > -{ - typedef rosenbrock4< Value , Coefficients , Resize > stepper_type; - typedef rosenbrock4_controller< stepper_type > controller_type; - typedef rosenbrock4_dense_output< controller_type > type; -}; - - - -// controller factory for controlled_runge_kutta -template< class Stepper > -struct dense_output_factory< Stepper , rosenbrock4_dense_output< rosenbrock4_controller< Stepper > > > -{ - typedef Stepper stepper_type; - typedef rosenbrock4_controller< stepper_type > controller_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::time_type time_type; - typedef rosenbrock4_dense_output< controller_type > dense_output_type; - - dense_output_type operator()( value_type abs_error , value_type rel_error , const stepper_type &stepper ) - { - return dense_output_type( controller_type( abs_error , rel_error , stepper ) ); - } - - dense_output_type operator()( value_type abs_error , value_type rel_error , - time_type max_dt, const stepper_type &stepper ) - { - return dense_output_type( controller_type( abs_error , rel_error , max_dt , stepper ) ); - } -}; - - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp deleted file mode 100644 index 24ae54799e56e72dcce3987842d414c5d956a99f..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp - - [begin_description] - Enable the factory functions for the controller and the dense output of the Runge-Kutta-Cash-Karp 54 method. - [end_description] - - Copyright 2011 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp> -#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -// Specializations for runge_kutta_cash_karp54 -template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize > -struct get_controller< runge_kutta_cash_karp54< State , Value , Deriv , Time , Algebra , Operations , Resize > > -{ - typedef runge_kutta_cash_karp54< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type; - typedef controlled_runge_kutta< stepper_type > type; -}; - - - - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp deleted file mode 100644 index 1cc0f91d7f3507fc21b9537e0baa9f506a37b2fa..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp - - [begin_description] - Enable the factory functions for the controller and the dense output of the - Runge-Kutta-Cash-Karp 54 method with the classical implementation. - [end_description] - - Copyright 2011 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp> -#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - -// Specializations for runge_kutta_cash_karp54 -template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize > -struct get_controller< runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resize > > -{ - typedef runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type; - typedef controlled_runge_kutta< stepper_type > type; -}; - - - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp deleted file mode 100644 index 1a607f39277854e2cc5cd65d855e75a17a53108d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp - - [begin_description] - Enable the factory functions for the controller and the dense output of the Runge-Kutta-Dormand-Prince5 method. - [end_description] - - Copyright 2011 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp> -#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp> -#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize > -struct get_controller< runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > > -{ - typedef runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type; - typedef controlled_runge_kutta< stepper_type > type; -}; - - -template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize > -struct get_dense_output< runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > > -{ - typedef runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type; - typedef controlled_runge_kutta< stepper_type > controller_type; - typedef dense_output_runge_kutta< controller_type > type; -}; - - - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp deleted file mode 100644 index d89343bf44cd164845444e980338ca5335808ee1..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp - - [begin_description] - Enable the factory functions for the controller and the dense output of the Runge-Kutta-Fehlberg 78 method. - [end_description] - - Copyright 2011 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED - -#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> -#include <boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp> -#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize > -struct get_controller< runge_kutta_fehlberg78< State , Value , Deriv , Time , Algebra , Operations , Resize > > -{ - typedef runge_kutta_fehlberg78< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type; - typedef controlled_runge_kutta< stepper_type > type; -}; - - - - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp deleted file mode 100644 index 61bc8f19204ac21f58c101120066a716f5d4cca3..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/make_controlled.hpp - - [begin_description] - Factory function to simplify the creation of controlled steppers from error steppers. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED - - - - -namespace boost { -namespace numeric { -namespace odeint { - - - -// default template for the controller -template< class Stepper > struct get_controller { }; - - - -// default controller factory -template< class Stepper , class Controller > -struct controller_factory -{ - Controller operator()( - typename Stepper::value_type abs_error , - typename Stepper::value_type rel_error , - const Stepper &stepper ) - { - return Controller( abs_error , rel_error , stepper ); - } - - Controller operator()( - typename Stepper::value_type abs_error , - typename Stepper::value_type rel_error , - typename Stepper::time_type max_dt , - const Stepper &stepper ) - { - return Controller( abs_error , rel_error , max_dt, stepper ); - } -}; - - - - -namespace result_of -{ - template< class Stepper > - struct make_controlled - { - typedef typename get_controller< Stepper >::type type; - }; -} - - -template< class Stepper > -typename result_of::make_controlled< Stepper >::type make_controlled( - typename Stepper::value_type abs_error , - typename Stepper::value_type rel_error , - const Stepper & stepper = Stepper() ) -{ - typedef Stepper stepper_type; - typedef typename result_of::make_controlled< stepper_type >::type controller_type; - typedef controller_factory< stepper_type , controller_type > factory_type; - factory_type factory; - return factory( abs_error , rel_error , stepper ); -} - - -template< class Stepper > -typename result_of::make_controlled< Stepper >::type make_controlled( - typename Stepper::value_type abs_error , - typename Stepper::value_type rel_error , - typename Stepper::time_type max_dt , - const Stepper & stepper = Stepper() ) -{ - typedef Stepper stepper_type; - typedef typename result_of::make_controlled< stepper_type >::type controller_type; - typedef controller_factory< stepper_type , controller_type > factory_type; - factory_type factory; - return factory( abs_error , rel_error , max_dt, stepper ); -} - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/make_dense_output.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/make_dense_output.hpp deleted file mode 100644 index fff3590525e14f691fc44940e5a33695e4207576..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/generation/make_dense_output.hpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/generation/make_dense_output.hpp - - [begin_description] - Factory function to simplify the creation of dense output steppers from error steppers. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED - -namespace boost { -namespace numeric { -namespace odeint { - - -// default template for the dense output -template< class Stepper > struct get_dense_output { }; - - - -// default dense output factory -template< class Stepper , class DenseOutput > -struct dense_output_factory -{ - DenseOutput operator()( - typename Stepper::value_type abs_error , - typename Stepper::value_type rel_error , - const Stepper &stepper ) - { - return DenseOutput( abs_error , rel_error , stepper ); - } - - DenseOutput operator()( - typename Stepper::value_type abs_error , - typename Stepper::value_type rel_error , - typename Stepper::time_type max_dt , - const Stepper &stepper ) - { - return DenseOutput( abs_error , rel_error , max_dt , stepper ); - } -}; - - - -namespace result_of -{ - template< class Stepper > - struct make_dense_output - { - typedef typename get_dense_output< Stepper >::type type; - }; -} - - - -template< class Stepper > -typename result_of::make_dense_output< Stepper >::type make_dense_output( - typename Stepper::value_type abs_error , - typename Stepper::value_type rel_error , - const Stepper &stepper = Stepper() ) -{ - typedef Stepper stepper_type; - typedef typename result_of::make_dense_output< stepper_type >::type dense_output_type; - typedef dense_output_factory< stepper_type , dense_output_type > factory_type; - factory_type factory; - return factory( abs_error , rel_error , stepper ); -} - - -template< class Stepper > -typename result_of::make_dense_output< Stepper >::type make_dense_output( - typename Stepper::value_type abs_error , - typename Stepper::value_type rel_error , - typename Stepper::time_type max_dt , - const Stepper &stepper = Stepper() ) -{ - typedef Stepper stepper_type; - typedef typename result_of::make_dense_output< stepper_type >::type dense_output_type; - typedef dense_output_factory< stepper_type , dense_output_type > factory_type; - factory_type factory; - return factory( abs_error , rel_error , max_dt, stepper ); -} - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/implicit_euler.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/implicit_euler.hpp deleted file mode 100644 index 24a56e93c383b7e9f6223daf267dc69afcffaafc..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/implicit_euler.hpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/implicit_euler.hpp - - [begin_description] - Impementation of the implicit Euler method. Works with ublas::vector as state type. - [end_description] - - Copyright 2010-2012 Mario Mulansky - Copyright 2010-2012 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED - - -#include <utility> - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/util/ublas_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/numeric/ublas/vector.hpp> -#include <boost/numeric/ublas/matrix.hpp> -#include <boost/numeric/ublas/lu.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - - - - - - - -template< class ValueType , class Resizer = initially_resizer > -class implicit_euler -{ - -public: - - typedef ValueType value_type; - typedef value_type time_type; - typedef boost::numeric::ublas::vector< value_type > state_type; - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_type deriv_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef boost::numeric::ublas::matrix< value_type > matrix_type; - typedef state_wrapper< matrix_type > wrapped_matrix_type; - typedef boost::numeric::ublas::permutation_matrix< size_t > pmatrix_type; - typedef state_wrapper< pmatrix_type > wrapped_pmatrix_type; - typedef Resizer resizer_type; - typedef stepper_tag stepper_category; - typedef implicit_euler< ValueType , Resizer > stepper_type; - - implicit_euler( value_type epsilon = 1E-6 ) - : m_epsilon( epsilon ) - { } - - - template< class System > - void do_step( System system , state_type &x , time_type t , time_type dt ) - { - typedef typename odeint::unwrap_reference< System >::type system_type; - typedef typename odeint::unwrap_reference< typename system_type::first_type >::type deriv_func_type; - typedef typename odeint::unwrap_reference< typename system_type::second_type >::type jacobi_func_type; - system_type &sys = system; - deriv_func_type &deriv_func = sys.first; - jacobi_func_type &jacobi_func = sys.second; - - m_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_impl<state_type> , detail::ref( *this ) , detail::_1 ) ); - - for( size_t i=0 ; i<x.size() ; ++i ) - m_pm.m_v[i] = i; - - t += dt; - - // apply first Newton step - deriv_func( x , m_dxdt.m_v , t ); - - m_b.m_v = dt * m_dxdt.m_v; - - jacobi_func( x , m_jacobi.m_v , t ); - m_jacobi.m_v *= dt; - m_jacobi.m_v -= boost::numeric::ublas::identity_matrix< value_type >( x.size() ); - - solve( m_b.m_v , m_jacobi.m_v ); - - m_x.m_v = x - m_b.m_v; - - // iterate Newton until some precision is reached - // ToDo: maybe we should apply only one Newton step -> linear implicit one-step scheme - while( boost::numeric::ublas::norm_2( m_b.m_v ) > m_epsilon ) - { - deriv_func( m_x.m_v , m_dxdt.m_v , t ); - m_b.m_v = x - m_x.m_v + dt*m_dxdt.m_v; - - // simplified version, only the first Jacobian is used - // jacobi( m_x , m_jacobi , t ); - // m_jacobi *= dt; - // m_jacobi -= boost::numeric::ublas::identity_matrix< value_type >( x.size() ); - - solve( m_b.m_v , m_jacobi.m_v ); - - m_x.m_v -= m_b.m_v; - } - x = m_x.m_v; - } - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_impl( x ); - } - - -private: - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_x , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_b , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_jacobi , x , typename is_resizeable<matrix_type>::type() ); - resized |= adjust_size_by_resizeability( m_pm , x , typename is_resizeable<pmatrix_type>::type() ); - return resized; - } - - - void solve( state_type &x , matrix_type &m ) - { - int res = boost::numeric::ublas::lu_factorize( m , m_pm.m_v ); - if( res != 0 ) exit(0); - boost::numeric::ublas::lu_substitute( m , m_pm.m_v , x ); - } - -private: - - value_type m_epsilon; - resizer_type m_resizer; - wrapped_deriv_type m_dxdt; - wrapped_state_type m_x; - wrapped_deriv_type m_b; - wrapped_matrix_type m_jacobi; - wrapped_pmatrix_type m_pm; - - -}; - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/modified_midpoint.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/modified_midpoint.hpp deleted file mode 100644 index af0c522ff2df1618760326dd4e202a460f8ae842..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/modified_midpoint.hpp +++ /dev/null @@ -1,315 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/modified_midpoint.hpp - - [begin_description] - Modified midpoint method for the use in Burlish-Stoer stepper. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED - -#include <vector> - -#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> -#include <boost/numeric/odeint/util/copy.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -#ifndef DOXYGEN_SKIP -class modified_midpoint -: public explicit_stepper_base< - modified_midpoint< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 2 , State , Value , Deriv , Time , Algebra , Operations , Resizer > -#else -class modified_midpoint : public explicit_stepper_base -#endif -{ - -public : - - typedef explicit_stepper_base< - modified_midpoint< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 2 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type; - - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - typedef typename stepper_base_type::stepper_type stepper_type; - - - modified_midpoint( unsigned short steps = 2 , const algebra_type &algebra = algebra_type() ) - : stepper_base_type( algebra ) , m_steps( steps ) - { } - - template< class System , class StateIn , class DerivIn , class StateOut > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - { - static const value_type val1 = static_cast< value_type >( 1 ); - static const value_type val05 = static_cast< value_type >( 1 ) / static_cast< value_type >( 2 ); - - m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ); - - const time_type h = dt / static_cast<value_type>( m_steps ); - const time_type h2 = static_cast<value_type>(2) * h; - - typename odeint::unwrap_reference< System >::type &sys = system; - - time_type th = t + h; - - // m_x1 = x + h*dxdt - stepper_base_type::m_algebra.for_each3( m_x1.m_v , in , dxdt , - typename operations_type::template scale_sum2< value_type , time_type >( val1 , h ) ); - - sys( m_x1.m_v , m_dxdt.m_v , th ); - - boost::numeric::odeint::copy( in , m_x0.m_v ); - - unsigned short i = 1; - while( i != m_steps ) - { - // general step - //tmp = m_x1; m_x1 = m_x0 + h2*m_dxdt; m_x0 = tmp - stepper_base_type::m_algebra.for_each3( m_x1.m_v , m_x0.m_v , m_dxdt.m_v , - typename operations_type::template scale_sum_swap2< value_type , time_type >( val1 , h2 ) ); - th += h; - sys( m_x1.m_v , m_dxdt.m_v , th); - i++; - } - - // last step - // x = 0.5*( m_x0 + m_x1 + h*m_dxdt ) - stepper_base_type::m_algebra.for_each4( out , m_x0.m_v , m_x1.m_v , m_dxdt.m_v , - typename operations_type::template scale_sum3< value_type , value_type , time_type >( val05 , val05 , val05*h ) ); - } - - - void set_steps( unsigned short steps ) - { m_steps = steps; } - - - unsigned short steps( void ) const - { return m_steps; } - - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_impl( x ); - stepper_base_type::adjust_size( x ); - } - -private: - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized( false ); - resized |= adjust_size_by_resizeability( m_x0 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - return resized; - } - - - unsigned short m_steps; - - resizer_type m_resizer; - - wrapped_state_type m_x0; - wrapped_state_type m_x1; - wrapped_deriv_type m_dxdt; - -}; - - -/* Modified midpoint which stores derivatives and state at dt/2 in some external storage for later usage in dense output calculation - * This Stepper is for use in Bulirsch Stoer only. It DOES NOT meet any stepper concept. - */ -template< -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -class modified_midpoint_dense_out -{ - -public : - - typedef State state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef Time time_type; - typedef Algebra algebra_type; - typedef Operations operations_type; - typedef Resizer resizer_type; - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - - typedef modified_midpoint_dense_out< State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_type; - typedef std::vector< wrapped_deriv_type > deriv_table_type; - - modified_midpoint_dense_out( unsigned short steps = 2 , const algebra_type &algebra = algebra_type() ) - : m_algebra( algebra ) , m_steps( steps ) - { } - - /* - * performs a modified midpoint step with m_steps intermediate points - * stores approximation for x(t+dt/2) in x_mp and all evaluated function results in derivs - * - */ - - template< class System , class StateIn , class DerivIn , class StateOut > - void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , - state_type &x_mp , deriv_table_type &derivs ) - { - - static const value_type val1 = static_cast< value_type >( 1 ); - static const value_type val05 = static_cast< value_type >( 1 ) / static_cast< value_type >( 2 ); - - m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize< StateIn > , detail::ref( *this ) , detail::_1 ) ); - - const time_type h = dt / static_cast<value_type>( m_steps ); - const time_type h2 = static_cast<value_type>( 2 ) * h; - - typename odeint::unwrap_reference< System >::type &sys = system; - - time_type th = t + h; - - // m_x1 = x + h*dxdt - m_algebra.for_each3( m_x1.m_v , in , dxdt , - typename operations_type::template scale_sum2< value_type , time_type >( val1 , h ) ); - - if( m_steps == 2 ) - // result of first step already gives approximation at the center of the interval - boost::numeric::odeint::copy( m_x1.m_v , x_mp ); - - sys( m_x1.m_v , derivs[0].m_v , th ); - - boost::numeric::odeint::copy( in , m_x0.m_v ); - - unsigned short i = 1; - while( i != m_steps ) - { - // general step - //tmp = m_x1; m_x1 = m_x0 + h2*m_dxdt; m_x0 = tmp - m_algebra.for_each3( m_x1.m_v , m_x0.m_v , derivs[i-1].m_v , - typename operations_type::template scale_sum_swap2< value_type , time_type >( val1 , h2 ) ); - if( i == m_steps/2-1 ) - // save approximation at the center of the interval - boost::numeric::odeint::copy( m_x1.m_v , x_mp ); - - th += h; - sys( m_x1.m_v , derivs[i].m_v , th); - i++; - } - - // last step - // x = 0.5*( m_x0 + m_x1 + h*m_dxdt ) - m_algebra.for_each4( out , m_x0.m_v , m_x1.m_v , derivs[m_steps-1].m_v , - typename operations_type::template scale_sum3< value_type , value_type , time_type >( val05 , val05 , val05*h ) ); - } - - - void set_steps( unsigned short steps ) - { m_steps = steps; } - - - unsigned short steps( void ) const - { return m_steps; } - - - template< class StateIn > - bool resize( const StateIn &x ) - { - bool resized( false ); - resized |= adjust_size_by_resizeability( m_x0 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() ); - return resized; - } - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize( x ); - } - -private: - - algebra_type m_algebra; - - unsigned short m_steps; - - resizer_type m_resizer; - - wrapped_state_type m_x0; - wrapped_state_type m_x1; - -}; - - - -/********** DOXYGEN ***********/ - -/** - * \class modified_midpoint - * - * Implementation of the modified midpoint method with a configurable - * number of intermediate steps. This class is used by the Bulirsch-Stoer - * algorithm and is not meant for direct usage. - */ - - -/** - * \class modified_midpoint_dense_out - * - * Implementation of the modified midpoint method with a configurable - * number of intermediate steps. This class is used by the dense output - * Bulirsch-Stoer algorithm and is not meant for direct usage. - * \note This stepper is for internal use only and does not meet - * any stepper concept. - */ - - -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4.hpp deleted file mode 100644 index 564577c8fc41ccfebdfc329683411b5f500d659d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4.hpp +++ /dev/null @@ -1,346 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/rosenbrock4.hpp - - [begin_description] - Implementation of the Rosenbrock 4 method for solving stiff ODEs. Note, that a - controller and a dense-output stepper exist for this method, - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> -#include <boost/numeric/ublas/vector.hpp> -#include <boost/numeric/ublas/matrix.hpp> -#include <boost/numeric/ublas/lu.hpp> - -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/util/ublas_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/numeric/ublas/vector.hpp> -#include <boost/numeric/ublas/matrix.hpp> -#include <boost/numeric/ublas/lu.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * ToDo: - * - * 2. Interfacing for odeint, check if controlled_error_stepper can be used - * 3. dense output - */ - - - -template< class Value > -struct default_rosenbrock_coefficients -{ - typedef Value value_type; - typedef unsigned short order_type; - - default_rosenbrock_coefficients( void ) - : gamma ( static_cast< value_type >( 0.25 ) ) , - d1 ( static_cast< value_type >( 0.25 ) ) , - d2 ( static_cast< value_type >( -0.1043 ) ) , - d3 ( static_cast< value_type >( 0.1035 ) ) , - d4 ( static_cast< value_type >( 0.3620000000000023e-01 ) ) , - c2 ( static_cast< value_type >( 0.386 ) ) , - c3 ( static_cast< value_type >( 0.21 ) ) , - c4 ( static_cast< value_type >( 0.63 ) ) , - c21 ( static_cast< value_type >( -0.5668800000000000e+01 ) ) , - a21 ( static_cast< value_type >( 0.1544000000000000e+01 ) ) , - c31 ( static_cast< value_type >( -0.2430093356833875e+01 ) ) , - c32 ( static_cast< value_type >( -0.2063599157091915e+00 ) ) , - a31 ( static_cast< value_type >( 0.9466785280815826e+00 ) ) , - a32 ( static_cast< value_type >( 0.2557011698983284e+00 ) ) , - c41 ( static_cast< value_type >( -0.1073529058151375e+00 ) ) , - c42 ( static_cast< value_type >( -0.9594562251023355e+01 ) ) , - c43 ( static_cast< value_type >( -0.2047028614809616e+02 ) ) , - a41 ( static_cast< value_type >( 0.3314825187068521e+01 ) ) , - a42 ( static_cast< value_type >( 0.2896124015972201e+01 ) ) , - a43 ( static_cast< value_type >( 0.9986419139977817e+00 ) ) , - c51 ( static_cast< value_type >( 0.7496443313967647e+01 ) ) , - c52 ( static_cast< value_type >( -0.1024680431464352e+02 ) ) , - c53 ( static_cast< value_type >( -0.3399990352819905e+02 ) ) , - c54 ( static_cast< value_type >( 0.1170890893206160e+02 ) ) , - a51 ( static_cast< value_type >( 0.1221224509226641e+01 ) ) , - a52 ( static_cast< value_type >( 0.6019134481288629e+01 ) ) , - a53 ( static_cast< value_type >( 0.1253708332932087e+02 ) ) , - a54 ( static_cast< value_type >( -0.6878860361058950e+00 ) ) , - c61 ( static_cast< value_type >( 0.8083246795921522e+01 ) ) , - c62 ( static_cast< value_type >( -0.7981132988064893e+01 ) ) , - c63 ( static_cast< value_type >( -0.3152159432874371e+02 ) ) , - c64 ( static_cast< value_type >( 0.1631930543123136e+02 ) ) , - c65 ( static_cast< value_type >( -0.6058818238834054e+01 ) ) , - d21 ( static_cast< value_type >( 0.1012623508344586e+02 ) ) , - d22 ( static_cast< value_type >( -0.7487995877610167e+01 ) ) , - d23 ( static_cast< value_type >( -0.3480091861555747e+02 ) ) , - d24 ( static_cast< value_type >( -0.7992771707568823e+01 ) ) , - d25 ( static_cast< value_type >( 0.1025137723295662e+01 ) ) , - d31 ( static_cast< value_type >( -0.6762803392801253e+00 ) ) , - d32 ( static_cast< value_type >( 0.6087714651680015e+01 ) ) , - d33 ( static_cast< value_type >( 0.1643084320892478e+02 ) ) , - d34 ( static_cast< value_type >( 0.2476722511418386e+02 ) ) , - d35 ( static_cast< value_type >( -0.6594389125716872e+01 ) ) - {} - - const value_type gamma; - const value_type d1 , d2 , d3 , d4; - const value_type c2 , c3 , c4; - const value_type c21 ; - const value_type a21; - const value_type c31 , c32; - const value_type a31 , a32; - const value_type c41 , c42 , c43; - const value_type a41 , a42 , a43; - const value_type c51 , c52 , c53 , c54; - const value_type a51 , a52 , a53 , a54; - const value_type c61 , c62 , c63 , c64 , c65; - const value_type d21 , d22 , d23 , d24 , d25; - const value_type d31 , d32 , d33 , d34 , d35; - - static const order_type stepper_order = 4; - static const order_type error_order = 3; -}; - - - -template< class Value , class Coefficients = default_rosenbrock_coefficients< Value > , class Resizer = initially_resizer > -class rosenbrock4 -{ -private: - -public: - - typedef Value value_type; - typedef boost::numeric::ublas::vector< value_type > state_type; - typedef state_type deriv_type; - typedef value_type time_type; - typedef boost::numeric::ublas::matrix< value_type > matrix_type; - typedef boost::numeric::ublas::permutation_matrix< size_t > pmatrix_type; - typedef Resizer resizer_type; - typedef Coefficients rosenbrock_coefficients; - typedef stepper_tag stepper_category; - typedef unsigned short order_type; - - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef state_wrapper< matrix_type > wrapped_matrix_type; - typedef state_wrapper< pmatrix_type > wrapped_pmatrix_type; - - typedef rosenbrock4< Value , Coefficients , Resizer > stepper_type; - - const static order_type stepper_order = rosenbrock_coefficients::stepper_order; - const static order_type error_order = rosenbrock_coefficients::error_order; - - rosenbrock4( void ) - : m_resizer() , m_x_err_resizer() , - m_jac() , m_pm() , - m_dfdt() , m_dxdt() , m_dxdtnew() , - m_g1() , m_g2() , m_g3() , m_g4() , m_g5() , - m_cont3() , m_cont4() , m_xtmp() , m_x_err() , - m_coef() - { } - - - order_type order() const { return stepper_order; } - - template< class System > - void do_step( System system , const state_type &x , time_type t , state_type &xout , time_type dt , state_type &xerr ) - { - // get the system and jacobi function - typedef typename odeint::unwrap_reference< System >::type system_type; - typedef typename odeint::unwrap_reference< typename system_type::first_type >::type deriv_func_type; - typedef typename odeint::unwrap_reference< typename system_type::second_type >::type jacobi_func_type; - system_type &sys = system; - deriv_func_type &deriv_func = sys.first; - jacobi_func_type &jacobi_func = sys.second; - - const size_t n = x.size(); - - m_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_impl<state_type> , detail::ref( *this ) , detail::_1 ) ); - - for( size_t i=0 ; i<n ; ++i ) - m_pm.m_v( i ) = i; - - deriv_func( x , m_dxdt.m_v , t ); - jacobi_func( x , m_jac.m_v , t , m_dfdt.m_v ); - - m_jac.m_v *= -1.0; - m_jac.m_v += 1.0 / m_coef.gamma / dt * boost::numeric::ublas::identity_matrix< value_type >( n ); - boost::numeric::ublas::lu_factorize( m_jac.m_v , m_pm.m_v ); - - for( size_t i=0 ; i<n ; ++i ) - m_g1.m_v[i] = m_dxdt.m_v[i] + dt * m_coef.d1 * m_dfdt.m_v[i]; - boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g1.m_v ); - - - for( size_t i=0 ; i<n ; ++i ) - m_xtmp.m_v[i] = x[i] + m_coef.a21 * m_g1.m_v[i]; - deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + m_coef.c2 * dt ); - for( size_t i=0 ; i<n ; ++i ) - m_g2.m_v[i] = m_dxdtnew.m_v[i] + dt * m_coef.d2 * m_dfdt.m_v[i] + m_coef.c21 * m_g1.m_v[i] / dt; - boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g2.m_v ); - - - for( size_t i=0 ; i<n ; ++i ) - m_xtmp.m_v[i] = x[i] + m_coef.a31 * m_g1.m_v[i] + m_coef.a32 * m_g2.m_v[i]; - deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + m_coef.c3 * dt ); - for( size_t i=0 ; i<n ; ++i ) - m_g3.m_v[i] = m_dxdtnew.m_v[i] + dt * m_coef.d3 * m_dfdt.m_v[i] + ( m_coef.c31 * m_g1.m_v[i] + m_coef.c32 * m_g2.m_v[i] ) / dt; - boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g3.m_v ); - - - for( size_t i=0 ; i<n ; ++i ) - m_xtmp.m_v[i] = x[i] + m_coef.a41 * m_g1.m_v[i] + m_coef.a42 * m_g2.m_v[i] + m_coef.a43 * m_g3.m_v[i]; - deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + m_coef.c4 * dt ); - for( size_t i=0 ; i<n ; ++i ) - m_g4.m_v[i] = m_dxdtnew.m_v[i] + dt * m_coef.d4 * m_dfdt.m_v[i] + ( m_coef.c41 * m_g1.m_v[i] + m_coef.c42 * m_g2.m_v[i] + m_coef.c43 * m_g3.m_v[i] ) / dt; - boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g4.m_v ); - - - for( size_t i=0 ; i<n ; ++i ) - m_xtmp.m_v[i] = x[i] + m_coef.a51 * m_g1.m_v[i] + m_coef.a52 * m_g2.m_v[i] + m_coef.a53 * m_g3.m_v[i] + m_coef.a54 * m_g4.m_v[i]; - deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + dt ); - for( size_t i=0 ; i<n ; ++i ) - m_g5.m_v[i] = m_dxdtnew.m_v[i] + ( m_coef.c51 * m_g1.m_v[i] + m_coef.c52 * m_g2.m_v[i] + m_coef.c53 * m_g3.m_v[i] + m_coef.c54 * m_g4.m_v[i] ) / dt; - boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g5.m_v ); - - for( size_t i=0 ; i<n ; ++i ) - m_xtmp.m_v[i] += m_g5.m_v[i]; - deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + dt ); - for( size_t i=0 ; i<n ; ++i ) - xerr[i] = m_dxdtnew.m_v[i] + ( m_coef.c61 * m_g1.m_v[i] + m_coef.c62 * m_g2.m_v[i] + m_coef.c63 * m_g3.m_v[i] + m_coef.c64 * m_g4.m_v[i] + m_coef.c65 * m_g5.m_v[i] ) / dt; - boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , xerr ); - - for( size_t i=0 ; i<n ; ++i ) - xout[i] = m_xtmp.m_v[i] + xerr[i]; - } - - template< class System > - void do_step( System system , state_type &x , time_type t , time_type dt , state_type &xerr ) - { - do_step( system , x , t , x , dt , xerr ); - } - - /* - * do_step without error output - just calls above functions with and neglects the error estimate - */ - template< class System > - void do_step( System system , const state_type &x , time_type t , state_type &xout , time_type dt ) - { - m_x_err_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_x_err<state_type> , detail::ref( *this ) , detail::_1 ) ); - do_step( system , x , t , xout , dt , m_x_err.m_v ); - } - - template< class System > - void do_step( System system , state_type &x , time_type t , time_type dt ) - { - m_x_err_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_x_err<state_type> , detail::ref( *this ) , detail::_1 ) ); - do_step( system , x , t , dt , m_x_err.m_v ); - } - - void prepare_dense_output() - { - const size_t n = m_g1.m_v.size(); - for( size_t i=0 ; i<n ; ++i ) - { - m_cont3.m_v[i] = m_coef.d21 * m_g1.m_v[i] + m_coef.d22 * m_g2.m_v[i] + m_coef.d23 * m_g3.m_v[i] + m_coef.d24 * m_g4.m_v[i] + m_coef.d25 * m_g5.m_v[i]; - m_cont4.m_v[i] = m_coef.d31 * m_g1.m_v[i] + m_coef.d32 * m_g2.m_v[i] + m_coef.d33 * m_g3.m_v[i] + m_coef.d34 * m_g4.m_v[i] + m_coef.d35 * m_g5.m_v[i]; - } - } - - - void calc_state( time_type t , state_type &x , - const state_type &x_old , time_type t_old , - const state_type &x_new , time_type t_new ) - { - const size_t n = m_g1.m_v.size(); - time_type dt = t_new - t_old; - time_type s = ( t - t_old ) / dt; - time_type s1 = 1.0 - s; - for( size_t i=0 ; i<n ; ++i ) - x[i] = x_old[i] * s1 + s * ( x_new[i] + s1 * ( m_cont3.m_v[i] + s * m_cont4.m_v[i] ) ); - } - - - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_impl( x ); - resize_x_err( x ); - } - - -protected: - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_dfdt , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxdtnew , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_xtmp , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_g1 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_g2 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_g3 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_g4 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_g5 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_cont3 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_cont4 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_jac , x , typename is_resizeable<matrix_type>::type() ); - resized |= adjust_size_by_resizeability( m_pm , x , typename is_resizeable<pmatrix_type>::type() ); - return resized; - } - - template< class StateIn > - bool resize_x_err( const StateIn &x ) - { - return adjust_size_by_resizeability( m_x_err , x , typename is_resizeable<state_type>::type() ); - } - -private: - - - resizer_type m_resizer; - resizer_type m_x_err_resizer; - - wrapped_matrix_type m_jac; - wrapped_pmatrix_type m_pm; - wrapped_deriv_type m_dfdt , m_dxdt , m_dxdtnew; - wrapped_state_type m_g1 , m_g2 , m_g3 , m_g4 , m_g5; - wrapped_state_type m_cont3 , m_cont4; - wrapped_state_type m_xtmp; - wrapped_state_type m_x_err; - - const rosenbrock_coefficients m_coef; -}; - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp deleted file mode 100644 index e361a1addf9ae49e76d877afb60123c1235132e3..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/rosenbrock4_controller.hpp - - [begin_description] - Controller for the Rosenbrock4 method. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_CONTROLLER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_CONTROLLER_HPP_INCLUDED - -#include <boost/config.hpp> -#include <boost/numeric/odeint/util/bind.hpp> - -#include <boost/numeric/odeint/stepper/controlled_step_result.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/util/copy.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/detail/less_with_sign.hpp> - -#include <boost/numeric/odeint/stepper/rosenbrock4.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< class Stepper > -class rosenbrock4_controller -{ -private: - - -public: - - typedef Stepper stepper_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_type::time_type time_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_type::resizer_type resizer_type; - typedef controlled_stepper_tag stepper_category; - - typedef rosenbrock4_controller< Stepper > controller_type; - - - rosenbrock4_controller( value_type atol = 1.0e-6 , value_type rtol = 1.0e-6 , - const stepper_type &stepper = stepper_type() ) - : m_stepper( stepper ) , m_atol( atol ) , m_rtol( rtol ) , - m_max_dt( static_cast<time_type>(0) ) , - m_first_step( true ) , m_err_old( 0.0 ) , m_dt_old( 0.0 ) , - m_last_rejected( false ) - { } - - rosenbrock4_controller( value_type atol, value_type rtol, time_type max_dt, - const stepper_type &stepper = stepper_type() ) - : m_stepper( stepper ) , m_atol( atol ) , m_rtol( rtol ) , m_max_dt( max_dt ) , - m_first_step( true ) , m_err_old( 0.0 ) , m_dt_old( 0.0 ) , - m_last_rejected( false ) - { } - - value_type error( const state_type &x , const state_type &xold , const state_type &xerr ) - { - BOOST_USING_STD_MAX(); - using std::abs; - using std::sqrt; - - const size_t n = x.size(); - value_type err = 0.0 , sk = 0.0; - for( size_t i=0 ; i<n ; ++i ) - { - sk = m_atol + m_rtol * max BOOST_PREVENT_MACRO_SUBSTITUTION ( abs( xold[i] ) , abs( x[i] ) ); - err += xerr[i] * xerr[i] / sk / sk; - } - return sqrt( err / value_type( n ) ); - } - - value_type last_error( void ) const - { - return m_err_old; - } - - - - - template< class System > - boost::numeric::odeint::controlled_step_result - try_step( System sys , state_type &x , time_type &t , time_type &dt ) - { - m_xnew_resizer.adjust_size( x , detail::bind( &controller_type::template resize_m_xnew< state_type > , detail::ref( *this ) , detail::_1 ) ); - boost::numeric::odeint::controlled_step_result res = try_step( sys , x , t , m_xnew.m_v , dt ); - if( res == success ) - { - boost::numeric::odeint::copy( m_xnew.m_v , x ); - } - return res; - } - - - template< class System > - boost::numeric::odeint::controlled_step_result - try_step( System sys , const state_type &x , time_type &t , state_type &xout , time_type &dt ) - { - if( m_max_dt != static_cast<time_type>(0) && detail::less_with_sign(m_max_dt, dt, dt) ) - { - // given step size is bigger then max_dt - // set limit and return fail - dt = m_max_dt; - return fail; - } - - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - using std::pow; - - static const value_type safe = 0.9 , fac1 = 5.0 , fac2 = 1.0 / 6.0; - - m_xerr_resizer.adjust_size( x , detail::bind( &controller_type::template resize_m_xerr< state_type > , detail::ref( *this ) , detail::_1 ) ); - - m_stepper.do_step( sys , x , t , xout , dt , m_xerr.m_v ); - value_type err = error( xout , x , m_xerr.m_v ); - - value_type fac = max BOOST_PREVENT_MACRO_SUBSTITUTION ( - fac2 , min BOOST_PREVENT_MACRO_SUBSTITUTION ( - fac1 , - static_cast< value_type >( pow( err , 0.25 ) / safe ) ) ); - value_type dt_new = dt / fac; - if ( err <= 1.0 ) - { - if( m_first_step ) - { - m_first_step = false; - } - else - { - value_type fac_pred = ( m_dt_old / dt ) * pow( err * err / m_err_old , 0.25 ) / safe; - fac_pred = max BOOST_PREVENT_MACRO_SUBSTITUTION ( - fac2 , min BOOST_PREVENT_MACRO_SUBSTITUTION ( fac1 , fac_pred ) ); - fac = max BOOST_PREVENT_MACRO_SUBSTITUTION ( fac , fac_pred ); - dt_new = dt / fac; - } - - m_dt_old = dt; - m_err_old = max BOOST_PREVENT_MACRO_SUBSTITUTION ( static_cast< value_type >( 0.01 ) , err ); - if( m_last_rejected ) - dt_new = ( dt >= 0.0 ? - min BOOST_PREVENT_MACRO_SUBSTITUTION ( dt_new , dt ) : - max BOOST_PREVENT_MACRO_SUBSTITUTION ( dt_new , dt ) ); - t += dt; - // limit step size to max_dt - if( m_max_dt != static_cast<time_type>(0) ) - { - dt = detail::min_abs(m_max_dt, dt_new); - } else { - dt = dt_new; - } - m_last_rejected = false; - return success; - } - else - { - dt = dt_new; - m_last_rejected = true; - return fail; - } - } - - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_m_xerr( x ); - resize_m_xnew( x ); - } - - - - stepper_type& stepper( void ) - { - return m_stepper; - } - - const stepper_type& stepper( void ) const - { - return m_stepper; - } - - - - -private: - - template< class StateIn > - bool resize_m_xerr( const StateIn &x ) - { - return adjust_size_by_resizeability( m_xerr , x , typename is_resizeable<state_type>::type() ); - } - - template< class StateIn > - bool resize_m_xnew( const StateIn &x ) - { - return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() ); - } - - - stepper_type m_stepper; - resizer_type m_xerr_resizer; - resizer_type m_xnew_resizer; - wrapped_state_type m_xerr; - wrapped_state_type m_xnew; - value_type m_atol , m_rtol; - time_type m_max_dt; - bool m_first_step; - value_type m_err_old , m_dt_old; - bool m_last_rejected; -}; - - - - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_CONTROLLER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp deleted file mode 100644 index 72ef437476b99b50763b6c12aadf89db2e6c2265..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp - - [begin_description] - Dense output for Rosenbrock 4. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2015 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_DENSE_OUTPUT_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_DENSE_OUTPUT_HPP_INCLUDED - - -#include <utility> - -#include <boost/numeric/odeint/util/bind.hpp> - -#include <boost/numeric/odeint/stepper/rosenbrock4_controller.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> - -#include <boost/numeric/odeint/integrate/max_step_checker.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -template< class ControlledStepper > -class rosenbrock4_dense_output -{ - -public: - - typedef ControlledStepper controlled_stepper_type; - typedef typename controlled_stepper_type::stepper_type stepper_type; - typedef typename stepper_type::value_type value_type; - typedef typename stepper_type::state_type state_type; - typedef typename stepper_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_type::time_type time_type; - typedef typename stepper_type::deriv_type deriv_type; - typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_type::resizer_type resizer_type; - typedef dense_output_stepper_tag stepper_category; - - typedef rosenbrock4_dense_output< ControlledStepper > dense_output_stepper_type; - - rosenbrock4_dense_output( const controlled_stepper_type &stepper = controlled_stepper_type() ) - : m_stepper( stepper ) , - m_x1() , m_x2() , - m_current_state_x1( true ) , - m_t() , m_t_old() , m_dt() - { - } - - - - template< class StateType > - void initialize( const StateType &x0 , time_type t0 , time_type dt0 ) - { - m_resizer.adjust_size( x0 , detail::bind( &dense_output_stepper_type::template resize_impl< StateType > , detail::ref( *this ) , detail::_1 ) ); - get_current_state() = x0; - m_t = t0; - m_dt = dt0; - } - - template< class System > - std::pair< time_type , time_type > do_step( System system ) - { - failed_step_checker fail_checker; // to throw a runtime_error if step size adjustment fails - controlled_step_result res = fail; - m_t_old = m_t; - do - { - res = m_stepper.try_step( system , get_current_state() , m_t , get_old_state() , m_dt ); - fail_checker(); // check for overflow of failed steps - } - while( res == fail ); - m_stepper.stepper().prepare_dense_output(); - this->toggle_current_state(); - return std::make_pair( m_t_old , m_t ); - } - - - /* - * The two overloads are needed in order to solve the forwarding problem. - */ - template< class StateOut > - void calc_state( time_type t , StateOut &x ) - { - m_stepper.stepper().calc_state( t , x , get_old_state() , m_t_old , get_current_state() , m_t ); - } - - template< class StateOut > - void calc_state( time_type t , const StateOut &x ) - { - m_stepper.stepper().calc_state( t , x , get_old_state() , m_t_old , get_current_state() , m_t ); - } - - - template< class StateType > - void adjust_size( const StateType &x ) - { - m_stepper.adjust_size( x ); - resize_impl( x ); - } - - - - - const state_type& current_state( void ) const - { - return get_current_state(); - } - - time_type current_time( void ) const - { - return m_t; - } - - const state_type& previous_state( void ) const - { - return get_old_state(); - } - - time_type previous_time( void ) const - { - return m_t_old; - } - - time_type current_time_step( void ) const - { - return m_dt; - } - - - - -private: - - state_type& get_current_state( void ) - { - return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ; - } - - const state_type& get_current_state( void ) const - { - return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ; - } - - state_type& get_old_state( void ) - { - return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ; - } - - const state_type& get_old_state( void ) const - { - return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ; - } - - void toggle_current_state( void ) - { - m_current_state_x1 = ! m_current_state_x1; - } - - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() ); - return resized; - } - - - controlled_stepper_type m_stepper; - resizer_type m_resizer; - wrapped_state_type m_x1 , m_x2; - bool m_current_state_x1; - time_type m_t , m_t_old , m_dt; -}; - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_DENSE_OUTPUT_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta4.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta4.hpp deleted file mode 100644 index c0c4e166fe8947daa6af2bf572f3c5710b18751c..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta4.hpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/runge_kutta4.hpp - - [begin_description] - Implementation of the classical Runge-Kutta stepper with the generic stepper. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_HPP_INCLUDED - - - - -#include <boost/fusion/container/vector.hpp> -#include <boost/fusion/container/generation/make_vector.hpp> - -#include <boost/numeric/odeint/stepper/explicit_generic_rk.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/array.hpp> - -#include <boost/numeric/odeint/util/resizer.hpp> - - - -namespace boost { -namespace numeric { -namespace odeint { - -#ifndef DOXYGEN_SKIP -template< class Value = double > -struct rk4_coefficients_a1 : boost::array< Value , 1 > -{ - rk4_coefficients_a1( void ) - { - (*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ); - } -}; - -template< class Value = double > -struct rk4_coefficients_a2 : boost::array< Value , 2 > -{ - rk4_coefficients_a2( void ) - { - (*this)[0] = static_cast<Value>(0); - (*this)[1] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ); - } -}; - - -template< class Value = double > -struct rk4_coefficients_a3 : boost::array< Value , 3 > -{ - rk4_coefficients_a3( void ) - { - (*this)[0] = static_cast<Value>(0); - (*this)[1] = static_cast<Value>(0); - (*this)[2] = static_cast<Value>(1); - } -}; - -template< class Value = double > -struct rk4_coefficients_b : boost::array< Value , 4 > -{ - rk4_coefficients_b( void ) - { - (*this)[0] = static_cast<Value>(1)/static_cast<Value>(6); - (*this)[1] = static_cast<Value>(1)/static_cast<Value>(3); - (*this)[2] = static_cast<Value>(1)/static_cast<Value>(3); - (*this)[3] = static_cast<Value>(1)/static_cast<Value>(6); - } -}; - -template< class Value = double > -struct rk4_coefficients_c : boost::array< Value , 4 > -{ - rk4_coefficients_c( void ) - { - (*this)[0] = static_cast<Value>(0); - (*this)[1] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ); - (*this)[2] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ); - (*this)[3] = static_cast<Value>(1); - } -}; -#endif - - - -template< -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -#ifndef DOXYGEN_SKIP -class runge_kutta4 : public explicit_generic_rk< 4 , 4 , State , Value , Deriv , Time , -Algebra , Operations , Resizer > -#else -class runge_kutta4 : public explicit_generic_rk -#endif -{ - -public: - -#ifndef DOXYGEN_SKIP - typedef explicit_generic_rk< 4 , 4 , State , Value , Deriv , Time , - Algebra , Operations , Resizer > stepper_base_type; -#endif - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - - #ifndef DOXYGEN_SKIP - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_base_type::stepper_type stepper_type; - #endif - - runge_kutta4( const algebra_type &algebra = algebra_type() ) : stepper_base_type( - boost::fusion::make_vector( rk4_coefficients_a1<Value>() , rk4_coefficients_a2<Value>() , rk4_coefficients_a3<Value>() ) , - rk4_coefficients_b<Value>() , rk4_coefficients_c<Value>() , algebra ) - { } - -}; - -/** - * \class runge_kutta4 - * \brief The classical Runge-Kutta stepper of fourth order. - * - * The Runge-Kutta method of fourth order is one standard method for - * solving ordinary differential equations and is widely used, see also - * <a href="http://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods">en.wikipedia.org/wiki/Runge-Kutta_methods</a> - * The method is explicit and fulfills the Stepper concept. Step size control - * or continuous output are not provided. - * - * This class derives from explicit_stepper_base and inherits its interface via CRTP (current recurring template pattern). - * Furthermore, it derivs from explicit_generic_rk which is a generic Runge-Kutta algorithm. For more details see - * explicit_stepper_base and explicit_generic_rk. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - -/** - * \fn runge_kutta4::runge_kutta4( const algebra_type &algebra = algebra_type() ) - * \brief Constructs the runge_kutta4 class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - -} -} -} - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp deleted file mode 100644 index 215448c74cbbab61f28925f5f932766481a36d7f..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp +++ /dev/null @@ -1,232 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/runge_kutta4_classic.hpp - - [begin_description] - Implementation for the classical Runge Kutta stepper. - [end_description] - - Copyright 2010-2013 Karsten Ahnert - Copyright 2010-2013 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_CLASSIC_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_CLASSIC_HPP_INCLUDED - - - -#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -#ifndef DOXYGEN_SKIP -class runge_kutta4_classic -: public explicit_stepper_base< - runge_kutta4_classic< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > -#else -class runge_kutta4_classic : public explicit_stepper_base -#endif -{ - -public : - - #ifndef DOXYGEN_SKIP - typedef explicit_stepper_base< - runge_kutta4_classic< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type; - #else - typedef explicit_stepper_base< runge_kutta4_classic< ... > , ... > stepper_base_type; - #endif - - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - - #ifndef DOXYGEN_SKIP - typedef typename stepper_base_type::stepper_type stepper_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - #endif // DOXYGEN_SKIP - - - - runge_kutta4_classic( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra ) - { } - - - template< class System , class StateIn , class DerivIn , class StateOut > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - { - // ToDo : check if size of in,dxdt,out are equal? - - static const value_type val1 = static_cast< value_type >( 1 ); - - m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ); - - typename odeint::unwrap_reference< System >::type &sys = system; - - const time_type dh = dt / static_cast< value_type >( 2 ); - const time_type th = t + dh; - - // dt * dxdt = k1 - // m_x_tmp = x + dh*dxdt - stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , dxdt , - typename operations_type::template scale_sum2< value_type , time_type >( val1 , dh ) ); - - - // dt * m_dxt = k2 - sys( m_x_tmp.m_v , m_dxt.m_v , th ); - - // m_x_tmp = x + dh*m_dxt - stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , m_dxt.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( val1 , dh ) ); - - - // dt * m_dxm = k3 - sys( m_x_tmp.m_v , m_dxm.m_v , th ); - //m_x_tmp = x + dt*m_dxm - stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , m_dxm.m_v , - typename operations_type::template scale_sum2< value_type , time_type >( val1 , dt ) ); - - - // dt * m_dxh = k4 - sys( m_x_tmp.m_v , m_dxh.m_v , t + dt ); - - //x += dt/6 * ( m_dxdt + m_dxt + val2*m_dxm ) - time_type dt6 = dt / static_cast< value_type >( 6 ); - time_type dt3 = dt / static_cast< value_type >( 3 ); - stepper_base_type::m_algebra.for_each6( out , in , dxdt , m_dxt.m_v , m_dxm.m_v , m_dxh.m_v , - typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt6 , dt3 , dt3 , dt6 ) ); - - // x += dt/6 * m_dxdt + dt/3 * m_dxt ) - // stepper_base_type::m_algebra.for_each4( out , in , dxdt , m_dxt.m_v , - // typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt6 , dt3 ) ); - // // x += dt/3 * m_dxm + dt/6 * m_dxh ) - // stepper_base_type::m_algebra.for_each4( out , out , m_dxm.m_v , m_dxh.m_v , - // typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt3 , dt6 ) ); - - } - - template< class StateType > - void adjust_size( const StateType &x ) - { - resize_impl( x ); - stepper_base_type::adjust_size( x ); - } - -private: - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxm , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxt , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_dxh , x , typename is_resizeable<deriv_type>::type() ); - return resized; - } - - - resizer_type m_resizer; - - wrapped_deriv_type m_dxt; - wrapped_deriv_type m_dxm; - wrapped_deriv_type m_dxh; - wrapped_state_type m_x_tmp; - -}; - - -/********* DOXYGEN *********/ - -/** - * \class runge_kutta4_classic - * \brief The classical Runge-Kutta stepper of fourth order. - * - * The Runge-Kutta method of fourth order is one standard method for - * solving ordinary differential equations and is widely used, see also - * <a href="http://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods">en.wikipedia.org/wiki/Runge-Kutta_methods</a> - * The method is explicit and fulfills the Stepper concept. Step size control - * or continuous output are not provided. This class implements the method directly, hence the - * generic Runge-Kutta algorithm is not used. - * - * This class derives from explicit_stepper_base and inherits its interface via - * CRTP (current recurring template pattern). For more details see - * explicit_stepper_base. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - /** - * \fn runge_kutta4_classic::runge_kutta4_classic( const algebra_type &algebra ) - * \brief Constructs the runge_kutta4_classic class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - - /** - * \fn runge_kutta4_classic::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method. - * The result is updated out of place, hence the input is in `in` and the output in `out`. - * Access to this step functionality is provided by explicit_stepper_base and - * `do_step_impl` should not be called directly. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - - /** - * \fn runge_kutta4_classic::adjust_size( const StateType &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_CLASSIC_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp deleted file mode 100644 index 74734e6f193e2d864590ff18f400983c6b284fe3..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp +++ /dev/null @@ -1,231 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp - - [begin_description] - Implementation of the Runge Kutta Cash Karp 5(4) method. It uses the generic error stepper. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED - -#include <boost/fusion/container/vector.hpp> -#include <boost/fusion/container/generation/make_vector.hpp> - -#include <boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/array.hpp> - - - - -namespace boost { -namespace numeric { -namespace odeint { - - -#ifndef DOXYGEN_SKIP -template< class Value = double > -struct rk54_ck_coefficients_a1 : boost::array< Value , 1 > -{ - rk54_ck_coefficients_a1( void ) - { - (*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 5 ); - } -}; - -template< class Value = double > -struct rk54_ck_coefficients_a2 : boost::array< Value , 2 > -{ - rk54_ck_coefficients_a2( void ) - { - (*this)[0] = static_cast<Value>( 3 )/static_cast<Value>( 40 ); - (*this)[1] = static_cast<Value>( 9 )/static_cast<Value>( 40 ); - } -}; - - -template< class Value = double > -struct rk54_ck_coefficients_a3 : boost::array< Value , 3 > -{ - rk54_ck_coefficients_a3( void ) - { - (*this)[0] = static_cast<Value>( 3 )/static_cast<Value>( 10 ); - (*this)[1] = static_cast<Value>( -9 )/static_cast<Value>( 10 ); - (*this)[2] = static_cast<Value>( 6 )/static_cast<Value>( 5 ); - } -}; - -template< class Value = double > -struct rk54_ck_coefficients_a4 : boost::array< Value , 4 > -{ - rk54_ck_coefficients_a4( void ) - { - (*this)[0] = static_cast<Value>( -11 )/static_cast<Value>( 54 ); - (*this)[1] = static_cast<Value>( 5 )/static_cast<Value>( 2 ); - (*this)[2] = static_cast<Value>( -70 )/static_cast<Value>( 27 ); - (*this)[3] = static_cast<Value>( 35 )/static_cast<Value>( 27 ); - } -}; - -template< class Value = double > -struct rk54_ck_coefficients_a5 : boost::array< Value , 5 > -{ - rk54_ck_coefficients_a5( void ) - { - (*this)[0] = static_cast<Value>( 1631 )/static_cast<Value>( 55296 ); - (*this)[1] = static_cast<Value>( 175 )/static_cast<Value>( 512 ); - (*this)[2] = static_cast<Value>( 575 )/static_cast<Value>( 13824 ); - (*this)[3] = static_cast<Value>( 44275 )/static_cast<Value>( 110592 ); - (*this)[4] = static_cast<Value>( 253 )/static_cast<Value>( 4096 ); - } -}; - -template< class Value = double > -struct rk54_ck_coefficients_b : boost::array< Value , 6 > -{ - rk54_ck_coefficients_b( void ) - { - (*this)[0] = static_cast<Value>( 37 )/static_cast<Value>( 378 ); - (*this)[1] = static_cast<Value>( 0 ); - (*this)[2] = static_cast<Value>( 250 )/static_cast<Value>( 621 ); - (*this)[3] = static_cast<Value>( 125 )/static_cast<Value>( 594 ); - (*this)[4] = static_cast<Value>( 0 ); - (*this)[5] = static_cast<Value>( 512 )/static_cast<Value>( 1771 ); - } -}; - -template< class Value = double > -struct rk54_ck_coefficients_db : boost::array< Value , 6 > -{ - rk54_ck_coefficients_db( void ) - { - (*this)[0] = static_cast<Value>( 37 )/static_cast<Value>( 378 ) - static_cast<Value>( 2825 )/static_cast<Value>( 27648 ); - (*this)[1] = static_cast<Value>( 0 ); - (*this)[2] = static_cast<Value>( 250 )/static_cast<Value>( 621 ) - static_cast<Value>( 18575 )/static_cast<Value>( 48384 ); - (*this)[3] = static_cast<Value>( 125 )/static_cast<Value>( 594 ) - static_cast<Value>( 13525 )/static_cast<Value>( 55296 ); - (*this)[4] = static_cast<Value>( -277 )/static_cast<Value>( 14336 ); - (*this)[5] = static_cast<Value>( 512 )/static_cast<Value>( 1771 ) - static_cast<Value>( 1 )/static_cast<Value>( 4 ); - } -}; - - -template< class Value = double > -struct rk54_ck_coefficients_c : boost::array< Value , 6 > -{ - rk54_ck_coefficients_c( void ) - { - (*this)[0] = static_cast<Value>(0); - (*this)[1] = static_cast<Value>( 1 )/static_cast<Value>( 5 ); - (*this)[2] = static_cast<Value>( 3 )/static_cast<Value>( 10 ); - (*this)[3] = static_cast<Value>( 3 )/static_cast<Value>( 5 ); - (*this)[4] = static_cast<Value>( 1 ); - (*this)[5] = static_cast<Value>( 7 )/static_cast<Value>( 8 ); - } -}; -#endif - - -template< - class State , - class Value = double , - class Deriv = State , - class Time = Value , - class Algebra = typename algebra_dispatcher< State >::algebra_type , - class Operations = typename operations_dispatcher< State >::operations_type , - class Resizer = initially_resizer - > -#ifndef DOXYGEN_SKIP -class runge_kutta_cash_karp54 : public explicit_error_generic_rk< 6 , 5 , 5 , 4 , - State , Value , Deriv , Time , Algebra , Operations , Resizer > -#else -class runge_kutta_cash_karp54 : public explicit_error_generic_rk -#endif -{ - -public: -#ifndef DOXYGEN_SKIP - typedef explicit_error_generic_rk< 6 , 5 , 5 , 4 , State , Value , Deriv , Time , - Algebra , Operations , Resizer > stepper_base_type; -#endif - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_typ; - - #ifndef DOXYGEN_SKIP - typedef typename stepper_base_type::stepper_type stepper_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - #endif - - - runge_kutta_cash_karp54( const algebra_type &algebra = algebra_type() ) : stepper_base_type( - boost::fusion::make_vector( rk54_ck_coefficients_a1<Value>() , - rk54_ck_coefficients_a2<Value>() , - rk54_ck_coefficients_a3<Value>() , - rk54_ck_coefficients_a4<Value>() , - rk54_ck_coefficients_a5<Value>() ) , - rk54_ck_coefficients_b<Value>() , rk54_ck_coefficients_db<Value>() , rk54_ck_coefficients_c<Value>() , - algebra ) - { } -}; - - -/********** DOXYGEN **********/ - -/** - * \class runge_kutta_cash_karp54 - * \brief The Runge-Kutta Cash-Karp method. - * - * The Runge-Kutta Cash-Karp method is one of the standard methods for - * solving ordinary differential equations, see - * <a href="http://en.wikipedia.org/wiki/Cash%E2%80%93Karp_methods">en.wikipedia.org/wiki/Cash-Karp_methods</a>. - * The method is explicit and fulfills the Error Stepper concept. Step size control - * is provided but continuous output is not available for this method. - * - * This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring template pattern). - * Furthermore, it derivs from explicit_error_generic_rk which is a generic Runge-Kutta algorithm with error estimation. - * For more details see explicit_error_stepper_base and explicit_error_generic_rk. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - - /** - * \fn runge_kutta_cash_karp54::runge_kutta_cash_karp54( const algebra_type &algebra ) - * \brief Constructs the runge_kutta_cash_karp54 class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp deleted file mode 100644 index 7600d6efc8b02b77f5bc3b5a47b279797b600e1b..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp +++ /dev/null @@ -1,289 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp - - [begin_description] - Classical implementation of the Runge-Kutta Cash-Karp 5(4) method. - [end_description] - - Copyright 2010-2013 Mario Mulansky - Copyright 2010-2013 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/bind.hpp> - -#include <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - - - -template< -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -#ifndef DOXYGEN_SKIP -class runge_kutta_cash_karp54_classic -: public explicit_error_stepper_base< - runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > -#else -class runge_kutta_cash_karp54_classic : public explicit_error_stepper_base -#endif -{ - - -public : - - #ifndef DOXYGEN_SKIP - typedef explicit_error_stepper_base< - runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type; - #else - typedef explicit_error_stepper_base< runge_kutta_cash_karp54_classic< ... > , ... > stepper_base_type; - #endif - - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - - #ifndef DOXYGEN_SKIP - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - typedef typename stepper_base_type::stepper_type stepper_type; - #endif - - - runge_kutta_cash_karp54_classic( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra ) - { } - - - - template< class System , class StateIn , class DerivIn , class StateOut , class Err > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr ) - { - const value_type c1 = static_cast<value_type> ( 37 ) / static_cast<value_type>( 378 ); - const value_type c3 = static_cast<value_type> ( 250 ) / static_cast<value_type>( 621 ); - const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 594 ); - const value_type c6 = static_cast<value_type> ( 512 ) / static_cast<value_type>( 1771 ); - - const value_type dc1 = c1 - static_cast<value_type> ( 2825 ) / static_cast<value_type>( 27648 ); - const value_type dc3 = c3 - static_cast<value_type> ( 18575 ) / static_cast<value_type>( 48384 ); - const value_type dc4 = c4 - static_cast<value_type> ( 13525 ) / static_cast<value_type>( 55296 ); - const value_type dc5 = static_cast<value_type> ( -277 ) / static_cast<value_type>( 14336 ); - const value_type dc6 = c6 - static_cast<value_type> ( 1 ) / static_cast<value_type> ( 4 ); - - do_step_impl( system , in , dxdt , t , out , dt ); - - //error estimate - stepper_base_type::m_algebra.for_each6( xerr , dxdt , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , - typename operations_type::template scale_sum5< time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 )); - - } - - - - template< class System , class StateIn , class DerivIn , class StateOut > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - { - const value_type a2 = static_cast<value_type> ( 1 ) / static_cast<value_type> ( 5 ); - const value_type a3 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 10 ); - const value_type a4 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 5 ); - const value_type a5 = static_cast<value_type> ( 1 ); - const value_type a6 = static_cast<value_type> ( 7 ) / static_cast<value_type> ( 8 ); - - const value_type b21 = static_cast<value_type> ( 1 ) / static_cast<value_type> ( 5 ); - const value_type b31 = static_cast<value_type> ( 3 ) / static_cast<value_type>( 40 ); - const value_type b32 = static_cast<value_type> ( 9 ) / static_cast<value_type>( 40 ); - const value_type b41 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 10 ); - const value_type b42 = static_cast<value_type> ( -9 ) / static_cast<value_type> ( 10 ); - const value_type b43 = static_cast<value_type> ( 6 ) / static_cast<value_type> ( 5 ); - const value_type b51 = static_cast<value_type> ( -11 ) / static_cast<value_type>( 54 ); - const value_type b52 = static_cast<value_type> ( 5 ) / static_cast<value_type> ( 2 ); - const value_type b53 = static_cast<value_type> ( -70 ) / static_cast<value_type>( 27 ); - const value_type b54 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 27 ); - const value_type b61 = static_cast<value_type> ( 1631 ) / static_cast<value_type>( 55296 ); - const value_type b62 = static_cast<value_type> ( 175 ) / static_cast<value_type>( 512 ); - const value_type b63 = static_cast<value_type> ( 575 ) / static_cast<value_type>( 13824 ); - const value_type b64 = static_cast<value_type> ( 44275 ) / static_cast<value_type>( 110592 ); - const value_type b65 = static_cast<value_type> ( 253 ) / static_cast<value_type>( 4096 ); - - const value_type c1 = static_cast<value_type> ( 37 ) / static_cast<value_type>( 378 ); - const value_type c3 = static_cast<value_type> ( 250 ) / static_cast<value_type>( 621 ); - const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 594 ); - const value_type c6 = static_cast<value_type> ( 512 ) / static_cast<value_type>( 1771 ); - - typename odeint::unwrap_reference< System >::type &sys = system; - - m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); - - //m_x1 = x + dt*b21*dxdt - stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , dxdt , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) ); - - sys( m_x_tmp.m_v , m_k2.m_v , t + dt*a2 ); - // m_x_tmp = x + dt*b31*dxdt + dt*b32*m_x2 - stepper_base_type::m_algebra.for_each4( m_x_tmp.m_v , in , dxdt , m_k2.m_v , - typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 )); - - sys( m_x_tmp.m_v , m_k3.m_v , t + dt*a3 ); - // m_x_tmp = x + dt * (b41*dxdt + b42*m_x2 + b43*m_x3) - stepper_base_type::m_algebra.for_each5( m_x_tmp.m_v , in , dxdt , m_k2.m_v , m_k3.m_v , - typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 )); - - sys( m_x_tmp.m_v, m_k4.m_v , t + dt*a4 ); - stepper_base_type::m_algebra.for_each6( m_x_tmp.m_v , in , dxdt , m_k2.m_v , m_k3.m_v , m_k4.m_v , - typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 )); - - sys( m_x_tmp.m_v , m_k5.m_v , t + dt*a5 ); - stepper_base_type::m_algebra.for_each7( m_x_tmp.m_v , in , dxdt , m_k2.m_v , m_k3.m_v , m_k4.m_v , m_k5.m_v , - typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 )); - - sys( m_x_tmp.m_v , m_k6.m_v , t + dt*a6 ); - stepper_base_type::m_algebra.for_each6( out , in , dxdt , m_k3.m_v , m_k4.m_v , m_k6.m_v , - typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c6 )); - - } - - /** - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_impl( x ); - stepper_base_type::adjust_size( x ); - } - -private: - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_k2 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_k3 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_k4 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_k5 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_k6 , x , typename is_resizeable<deriv_type>::type() ); - return resized; - } - - - wrapped_state_type m_x_tmp; - wrapped_deriv_type m_k2, m_k3, m_k4, m_k5, m_k6; - resizer_type m_resizer; - -}; - - - -/************ DOXYGEN *************/ - -/** - * \class runge_kutta_cash_karp54_classic - * \brief The Runge-Kutta Cash-Karp method implemented without the generic Runge-Kutta algorithm. - * - * The Runge-Kutta Cash-Karp method is one of the standard methods for - * solving ordinary differential equations, see - * <a href="http://en.wikipedia.org/wiki/Cash%E2%80%93Karp_method">en.wikipedia.org/wiki/Cash-Karp_method</a>. - * The method is explicit and fulfills the Error Stepper concept. Step size control - * is provided but continuous output is not available for this method. - * - * This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring - * template pattern). This class implements the method directly, hence the generic Runge-Kutta algorithm is not used. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - - /** - * \fn runge_kutta_cash_karp54_classic::runge_kutta_cash_karp54_classic( const algebra_type &algebra ) - * \brief Constructs the runge_kutta_cash_karp54_classic class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - - /** - * \fn runge_kutta_cash_karp54_classic::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr ) - * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method. - * - * The result is updated out-of-place, hence the input is in `in` and the output in `out`. Futhermore, an - * estimation of the error is stored in `xerr`. - * Access to this step functionality is provided by explicit_error_stepper_base and - * `do_step_impl` should not be called directly. - - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - * \param xerr The result of the error estimation is written in xerr. - */ - - /** - * \fn runge_kutta_cash_karp54_classic::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) - * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method. - * The result is updated out-of-place, hence the input is in `in` and the output in `out`. - * Access to this step functionality is provided by explicit_error_stepper_base and - * `do_step_impl` should not be called directly. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt The derivative of x at t. - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dt The step size. - */ - -} // odeint -} // numeric -} // boost - - - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp deleted file mode 100644 index 5d1b1159093961a2113f354cdd2240d3afd91758..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp +++ /dev/null @@ -1,403 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp - - [begin_description] - Implementation of the Dormand-Prince 5(4) method. This stepper can also be used with the dense-output controlled stepper. - [end_description] - - Copyright 2010-2013 Karsten Ahnert - Copyright 2010-2013 Mario Mulansky - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/bind.hpp> - -#include <boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/same_instance.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - - -template< -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -class runge_kutta_dopri5 -#ifndef DOXYGEN_SKIP -: public explicit_error_stepper_fsal_base< - runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > -#else -: public explicit_error_stepper_fsal_base -#endif -{ - -public : - - #ifndef DOXYGEN_SKIP - typedef explicit_error_stepper_fsal_base< - runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resizer > , - 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type; - #else - typedef explicit_error_stepper_fsal_base< runge_kutta_dopri5< ... > , ... > stepper_base_type; - #endif - - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - - #ifndef DOXYGEN_SKIP - typedef typename stepper_base_type::stepper_type stepper_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - #endif // DOXYGEN_SKIP - - - runge_kutta_dopri5( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra ) - { } - - - template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , - StateOut &out , DerivOut &dxdt_out , time_type dt ) - { - const value_type a2 = static_cast<value_type> ( 1 ) / static_cast<value_type>( 5 ); - const value_type a3 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 10 ); - const value_type a4 = static_cast<value_type> ( 4 ) / static_cast<value_type> ( 5 ); - const value_type a5 = static_cast<value_type> ( 8 )/static_cast<value_type> ( 9 ); - - const value_type b21 = static_cast<value_type> ( 1 ) / static_cast<value_type> ( 5 ); - - const value_type b31 = static_cast<value_type> ( 3 ) / static_cast<value_type>( 40 ); - const value_type b32 = static_cast<value_type> ( 9 ) / static_cast<value_type>( 40 ); - - const value_type b41 = static_cast<value_type> ( 44 ) / static_cast<value_type> ( 45 ); - const value_type b42 = static_cast<value_type> ( -56 ) / static_cast<value_type> ( 15 ); - const value_type b43 = static_cast<value_type> ( 32 ) / static_cast<value_type> ( 9 ); - - const value_type b51 = static_cast<value_type> ( 19372 ) / static_cast<value_type>( 6561 ); - const value_type b52 = static_cast<value_type> ( -25360 ) / static_cast<value_type> ( 2187 ); - const value_type b53 = static_cast<value_type> ( 64448 ) / static_cast<value_type>( 6561 ); - const value_type b54 = static_cast<value_type> ( -212 ) / static_cast<value_type>( 729 ); - - const value_type b61 = static_cast<value_type> ( 9017 ) / static_cast<value_type>( 3168 ); - const value_type b62 = static_cast<value_type> ( -355 ) / static_cast<value_type>( 33 ); - const value_type b63 = static_cast<value_type> ( 46732 ) / static_cast<value_type>( 5247 ); - const value_type b64 = static_cast<value_type> ( 49 ) / static_cast<value_type>( 176 ); - const value_type b65 = static_cast<value_type> ( -5103 ) / static_cast<value_type>( 18656 ); - - const value_type c1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 ); - const value_type c3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 ); - const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 ); - const value_type c5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 ); - const value_type c6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 ); - - typename odeint::unwrap_reference< System >::type &sys = system; - - m_k_x_tmp_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_k_x_tmp_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); - - //m_x_tmp = x + dt*b21*dxdt - stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , dxdt_in , - typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) ); - - sys( m_x_tmp.m_v , m_k2.m_v , t + dt*a2 ); - // m_x_tmp = x + dt*b31*dxdt + dt*b32*m_k2 - stepper_base_type::m_algebra.for_each4( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , - typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 )); - - sys( m_x_tmp.m_v , m_k3.m_v , t + dt*a3 ); - // m_x_tmp = x + dt * (b41*dxdt + b42*m_k2 + b43*m_k3) - stepper_base_type::m_algebra.for_each5( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v , - typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 )); - - sys( m_x_tmp.m_v, m_k4.m_v , t + dt*a4 ); - stepper_base_type::m_algebra.for_each6( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v , m_k4.m_v , - typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 )); - - sys( m_x_tmp.m_v , m_k5.m_v , t + dt*a5 ); - stepper_base_type::m_algebra.for_each7( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v , m_k4.m_v , m_k5.m_v , - typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 )); - - sys( m_x_tmp.m_v , m_k6.m_v , t + dt ); - stepper_base_type::m_algebra.for_each7( out , in , dxdt_in , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , - typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c5 , dt*c6 )); - - // the new derivative - sys( out , dxdt_out , t + dt ); - } - - - - template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err > - void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , - StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr ) - { - const value_type c1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 ); - const value_type c3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 ); - const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 ); - const value_type c5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 ); - const value_type c6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 ); - - const value_type dc1 = c1 - static_cast<value_type> ( 5179 ) / static_cast<value_type>( 57600 ); - const value_type dc3 = c3 - static_cast<value_type> ( 7571 ) / static_cast<value_type>( 16695 ); - const value_type dc4 = c4 - static_cast<value_type> ( 393 ) / static_cast<value_type>( 640 ); - const value_type dc5 = c5 - static_cast<value_type> ( -92097 ) / static_cast<value_type>( 339200 ); - const value_type dc6 = c6 - static_cast<value_type> ( 187 ) / static_cast<value_type>( 2100 ); - const value_type dc7 = static_cast<value_type>( -1 ) / static_cast<value_type> ( 40 ); - - /* ToDo: copy only if &dxdt_in == &dxdt_out ? */ - if( same_instance( dxdt_in , dxdt_out ) ) - { - m_dxdt_tmp_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_dxdt_tmp_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); - boost::numeric::odeint::copy( dxdt_in , m_dxdt_tmp.m_v ); - do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt ); - //error estimate - stepper_base_type::m_algebra.for_each7( xerr , m_dxdt_tmp.m_v , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , dxdt_out , - typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 , dt*dc7 ) ); - - } - else - { - do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt ); - //error estimate - stepper_base_type::m_algebra.for_each7( xerr , dxdt_in , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , dxdt_out , - typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 , dt*dc7 ) ); - - } - - } - - - /* - * Calculates Dense-Output for Dopri5 - * - * See Hairer, Norsett, Wanner: Solving Ordinary Differential Equations, Nonstiff Problems. I, p.191/192 - * - * y(t+theta) = y(t) + h * sum_i^7 b_i(theta) * k_i - * - * A = theta^2 * ( 3 - 2 theta ) - * B = theta^2 * ( theta - 1 ) - * C = theta^2 * ( theta - 1 )^2 - * D = theta * ( theta - 1 )^2 - * - * b_1( theta ) = A * b_1 - C * X1( theta ) + D - * b_2( theta ) = 0 - * b_3( theta ) = A * b_3 + C * X3( theta ) - * b_4( theta ) = A * b_4 - C * X4( theta ) - * b_5( theta ) = A * b_5 + C * X5( theta ) - * b_6( theta ) = A * b_6 - C * X6( theta ) - * b_7( theta ) = B + C * X7( theta ) - * - * An alternative Method is described in: - * - * www-m2.ma.tum.de/homepages/simeon/numerik3/kap3.ps - */ - template< class StateOut , class StateIn1 , class DerivIn1 , class StateIn2 , class DerivIn2 > - void calc_state( time_type t , StateOut &x , - const StateIn1 &x_old , const DerivIn1 &deriv_old , time_type t_old , - const StateIn2 & /* x_new */ , const DerivIn2 &deriv_new , time_type t_new ) const - { - const value_type b1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 ); - const value_type b3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 ); - const value_type b4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 ); - const value_type b5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 ); - const value_type b6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 ); - - const time_type dt = ( t_new - t_old ); - const value_type theta = ( t - t_old ) / dt; - const value_type X1 = static_cast< value_type >( 5 ) * ( static_cast< value_type >( 2558722523LL ) - static_cast< value_type >( 31403016 ) * theta ) / static_cast< value_type >( 11282082432LL ); - const value_type X3 = static_cast< value_type >( 100 ) * ( static_cast< value_type >( 882725551 ) - static_cast< value_type >( 15701508 ) * theta ) / static_cast< value_type >( 32700410799LL ); - const value_type X4 = static_cast< value_type >( 25 ) * ( static_cast< value_type >( 443332067 ) - static_cast< value_type >( 31403016 ) * theta ) / static_cast< value_type >( 1880347072LL ) ; - const value_type X5 = static_cast< value_type >( 32805 ) * ( static_cast< value_type >( 23143187 ) - static_cast< value_type >( 3489224 ) * theta ) / static_cast< value_type >( 199316789632LL ); - const value_type X6 = static_cast< value_type >( 55 ) * ( static_cast< value_type >( 29972135 ) - static_cast< value_type >( 7076736 ) * theta ) / static_cast< value_type >( 822651844 ); - const value_type X7 = static_cast< value_type >( 10 ) * ( static_cast< value_type >( 7414447 ) - static_cast< value_type >( 829305 ) * theta ) / static_cast< value_type >( 29380423 ); - - const value_type theta_m_1 = theta - static_cast< value_type >( 1 ); - const value_type theta_sq = theta * theta; - const value_type A = theta_sq * ( static_cast< value_type >( 3 ) - static_cast< value_type >( 2 ) * theta ); - const value_type B = theta_sq * theta_m_1; - const value_type C = theta_sq * theta_m_1 * theta_m_1; - const value_type D = theta * theta_m_1 * theta_m_1; - - const value_type b1_theta = A * b1 - C * X1 + D; - const value_type b3_theta = A * b3 + C * X3; - const value_type b4_theta = A * b4 - C * X4; - const value_type b5_theta = A * b5 + C * X5; - const value_type b6_theta = A * b6 - C * X6; - const value_type b7_theta = B + C * X7; - - // const state_type &k1 = *m_old_deriv; - // const state_type &k3 = dopri5().m_k3; - // const state_type &k4 = dopri5().m_k4; - // const state_type &k5 = dopri5().m_k5; - // const state_type &k6 = dopri5().m_k6; - // const state_type &k7 = *m_current_deriv; - - stepper_base_type::m_algebra.for_each8( x , x_old , deriv_old , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , deriv_new , - typename operations_type::template scale_sum7< value_type , time_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt * b1_theta , dt * b3_theta , dt * b4_theta , dt * b5_theta , dt * b6_theta , dt * b7_theta ) ); - } - - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_k_x_tmp_impl( x ); - resize_dxdt_tmp_impl( x ); - stepper_base_type::adjust_size( x ); - } - - -private: - - template< class StateIn > - bool resize_k_x_tmp_impl( const StateIn &x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() ); - resized |= adjust_size_by_resizeability( m_k2 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_k3 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_k4 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_k5 , x , typename is_resizeable<deriv_type>::type() ); - resized |= adjust_size_by_resizeability( m_k6 , x , typename is_resizeable<deriv_type>::type() ); - return resized; - } - - template< class StateIn > - bool resize_dxdt_tmp_impl( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt_tmp , x , typename is_resizeable<deriv_type>::type() ); - } - - - - wrapped_state_type m_x_tmp; - wrapped_deriv_type m_k2 , m_k3 , m_k4 , m_k5 , m_k6 ; - wrapped_deriv_type m_dxdt_tmp; - resizer_type m_k_x_tmp_resizer; - resizer_type m_dxdt_tmp_resizer; -}; - - - -/************* DOXYGEN ************/ -/** - * \class runge_kutta_dopri5 - * \brief The Runge-Kutta Dormand-Prince 5 method. - * - * The Runge-Kutta Dormand-Prince 5 method is a very popular method for solving ODEs, see - * <a href=""></a>. - * The method is explicit and fulfills the Error Stepper concept. Step size control - * is provided but continuous output is available which make this method favourable for many applications. - * - * This class derives from explicit_error_stepper_fsal_base and inherits its interface via CRTP (current recurring - * template pattern). The method possesses the FSAL (first-same-as-last) property. See - * explicit_error_stepper_fsal_base for more details. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - - /** - * \fn runge_kutta_dopri5::runge_kutta_dopri5( const algebra_type &algebra ) - * \brief Constructs the runge_kutta_dopri5 class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - - /** - * \fn runge_kutta_dopri5::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , StateOut &out , DerivOut &dxdt_out , time_type dt ) - * \brief This method performs one step. The derivative `dxdt_in` of `in` at the time `t` is passed to the - * method. The result is updated out-of-place, hence the input is in `in` and the output in `out`. Furthermore, - * the derivative is update out-of-place, hence the input is assumed to be in `dxdt_in` and the output in - * `dxdt_out`. - * Access to this step functionality is provided by explicit_error_stepper_fsal_base and - * `do_step_impl` should not be called directly. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt_in The derivative of x at t. dxdt_in is not modified by this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dxdt_out The result of the new derivative at time t+dt. - * \param dt The step size. - */ - - /** - * \fn runge_kutta_dopri5::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr ) - * \brief This method performs one step. The derivative `dxdt_in` of `in` at the time `t` is passed to the - * method. The result is updated out-of-place, hence the input is in `in` and the output in `out`. Furthermore, - * the derivative is update out-of-place, hence the input is assumed to be in `dxdt_in` and the output in - * `dxdt_out`. - * Access to this step functionality is provided by explicit_error_stepper_fsal_base and - * `do_step_impl` should not be called directly. - * An estimation of the error is calculated. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the - * Simple System concept. - * \param in The state of the ODE which should be solved. in is not modified in this method - * \param dxdt_in The derivative of x at t. dxdt_in is not modified by this method - * \param t The value of the time, at which the step should be performed. - * \param out The result of the step is written in out. - * \param dxdt_out The result of the new derivative at time t+dt. - * \param dt The step size. - * \param xerr An estimation of the error. - */ - - /** - * \fn runge_kutta_dopri5::calc_state( time_type t , StateOut &x , const StateIn1 &x_old , const DerivIn1 &deriv_old , time_type t_old , const StateIn2 & , const DerivIn2 &deriv_new , time_type t_new ) const - * \brief This method is used for continuous output and it calculates the state `x` at a time `t` from the - * knowledge of two states `old_state` and `current_state` at time points `t_old` and `t_new`. It also uses - * internal variables to calculate the result. Hence this method must be called after two successful `do_step` - * calls. - */ - - /** - * \fn runge_kutta_dopri5::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp deleted file mode 100644 index 956b5b62e18d6ee38431c0073432f157ba84abf5..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp +++ /dev/null @@ -1,374 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/runge_kutta_fehlberg87.hpp - - [begin_description] - Implementation of the Runge-Kutta-Fehlberg stepper with the generic stepper. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2012-2013 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED - - -#include <boost/fusion/container/vector.hpp> -#include <boost/fusion/container/generation/make_vector.hpp> - -#include <boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp> -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/array.hpp> - -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> - - - - -namespace boost { -namespace numeric { -namespace odeint { - - -#ifndef DOXYGEN_SKIP -template< class Value = double > -struct rk78_coefficients_a1 : boost::array< Value , 1 > -{ - rk78_coefficients_a1( void ) - { - (*this)[0] = static_cast< Value >( 2 )/static_cast< Value >( 27 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a2 : boost::array< Value , 2 > -{ - rk78_coefficients_a2( void ) - { - (*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 36 ); - (*this)[1] = static_cast< Value >( 1 )/static_cast< Value >( 12 ); - } -}; - - -template< class Value = double > -struct rk78_coefficients_a3 : boost::array< Value , 3 > -{ - rk78_coefficients_a3( void ) - { - (*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 24 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 1 )/static_cast< Value >( 8 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a4 : boost::array< Value , 4 > -{ - rk78_coefficients_a4( void ) - { - (*this)[0] = static_cast< Value >( 5 )/static_cast< Value >( 12 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( -25 )/static_cast< Value >( 16 ); - (*this)[3] = static_cast< Value >( 25 )/static_cast< Value >( 16 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a5 : boost::array< Value , 5 > -{ - rk78_coefficients_a5( void ) - { - (*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 20 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( 1 )/static_cast< Value >( 4 ); - (*this)[4] = static_cast< Value >( 1 )/static_cast< Value >( 5 ); - } -}; - - -template< class Value = double > -struct rk78_coefficients_a6 : boost::array< Value , 6 > -{ - rk78_coefficients_a6( void ) - { - (*this)[0] = static_cast< Value >( -25 )/static_cast< Value >( 108 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( 125 )/static_cast< Value >( 108 ); - (*this)[4] = static_cast< Value >( -65 )/static_cast< Value >( 27 ); - (*this)[5] = static_cast< Value >( 125 )/static_cast< Value >( 54 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a7 : boost::array< Value , 7 > -{ - rk78_coefficients_a7( void ) - { - (*this)[0] = static_cast< Value >( 31 )/static_cast< Value >( 300 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( 0 ); - (*this)[4] = static_cast< Value >( 61 )/static_cast< Value >( 225 ); - (*this)[5] = static_cast< Value >( -2 )/static_cast< Value >( 9 ); - (*this)[6] = static_cast< Value >( 13 )/static_cast< Value >( 900 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a8 : boost::array< Value , 8 > -{ - rk78_coefficients_a8( void ) - { - (*this)[0] = static_cast< Value >( 2 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( -53 )/static_cast< Value >( 6 ); - (*this)[4] = static_cast< Value >( 704 )/static_cast< Value >( 45 ); - (*this)[5] = static_cast< Value >( -107 )/static_cast< Value >( 9 ); - (*this)[6] = static_cast< Value >( 67 )/static_cast< Value >( 90 ); - (*this)[7] = static_cast< Value >( 3 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a9 : boost::array< Value , 9 > -{ - rk78_coefficients_a9( void ) - { - (*this)[0] = static_cast< Value >( -91 )/static_cast< Value >( 108 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( 23 )/static_cast< Value >( 108 ); - (*this)[4] = static_cast< Value >( -976 )/static_cast< Value >( 135 ); - (*this)[5] = static_cast< Value >( 311 )/static_cast< Value >( 54 ); - (*this)[6] = static_cast< Value >( -19 )/static_cast< Value >( 60 ); - (*this)[7] = static_cast< Value >( 17 )/static_cast< Value >( 6 ); - (*this)[8] = static_cast< Value >( -1 )/static_cast< Value >( 12 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a10 : boost::array< Value , 10 > -{ - rk78_coefficients_a10( void ) - { - (*this)[0] = static_cast< Value >( 2383 )/static_cast< Value >( 4100 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( -341 )/static_cast< Value >( 164 ); - (*this)[4] = static_cast< Value >( 4496 )/static_cast< Value >( 1025 ); - (*this)[5] = static_cast< Value >( -301 )/static_cast< Value >( 82 ); - (*this)[6] = static_cast< Value >( 2133 )/static_cast< Value >( 4100 ); - (*this)[7] = static_cast< Value >( 45 )/static_cast< Value >( 82 ); - (*this)[8] = static_cast< Value >( 45 )/static_cast< Value >( 164 ); - (*this)[9] = static_cast< Value >( 18 )/static_cast< Value >( 41 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a11 : boost::array< Value , 11 > -{ - rk78_coefficients_a11( void ) - { - (*this)[0] = static_cast< Value >( 3 )/static_cast< Value >( 205 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( 0 ); - (*this)[4] = static_cast< Value >( 0 ); - (*this)[5] = static_cast< Value >( -6 )/static_cast< Value >( 41 ); - (*this)[6] = static_cast< Value >( -3 )/static_cast< Value >( 205 ); - (*this)[7] = static_cast< Value >( -3 )/static_cast< Value >( 41 ); - (*this)[8] = static_cast< Value >( 3 )/static_cast< Value >( 41 ); - (*this)[9] = static_cast< Value >( 6 )/static_cast< Value >( 41 ); - (*this)[10] = static_cast< Value >( 0 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_a12 : boost::array< Value , 12 > -{ - rk78_coefficients_a12( void ) - { - (*this)[0] = static_cast< Value >( -1777 )/static_cast< Value >( 4100 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( -341 )/static_cast< Value >( 164 ); - (*this)[4] = static_cast< Value >( 4496 )/static_cast< Value >( 1025 ); - (*this)[5] = static_cast< Value >( -289 )/static_cast< Value >( 82 ); - (*this)[6] = static_cast< Value >( 2193 )/static_cast< Value >( 4100 ); - (*this)[7] = static_cast< Value >( 51 )/static_cast< Value >( 82 ); - (*this)[8] = static_cast< Value >( 33 )/static_cast< Value >( 164 ); - (*this)[9] = static_cast< Value >( 12 )/static_cast< Value >( 41 ); - (*this)[10] = static_cast< Value >( 0 ); - (*this)[11] = static_cast< Value >( 1 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_b : boost::array< Value , 13 > -{ - rk78_coefficients_b( void ) - { - (*this)[0] = static_cast< Value >( 0 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( 0 ); - (*this)[4] = static_cast< Value >( 0 ); - (*this)[5] = static_cast< Value >( 34 )/static_cast<Value>( 105 ); - (*this)[6] = static_cast< Value >( 9 )/static_cast<Value>( 35 ); - (*this)[7] = static_cast< Value >( 9 )/static_cast<Value>( 35 ); - (*this)[8] = static_cast< Value >( 9 )/static_cast<Value>( 280 ); - (*this)[9] = static_cast< Value >( 9 )/static_cast<Value>( 280 ); - (*this)[10] = static_cast< Value >( 0 ); - (*this)[11] = static_cast< Value >( 41 )/static_cast<Value>( 840 ); - (*this)[12] = static_cast< Value >( 41 )/static_cast<Value>( 840 ); - } -}; - -template< class Value = double > -struct rk78_coefficients_db : boost::array< Value , 13 > -{ - rk78_coefficients_db( void ) - { - (*this)[0] = static_cast< Value >( 0 ) - static_cast< Value >( 41 )/static_cast<Value>( 840 ); - (*this)[1] = static_cast< Value >( 0 ); - (*this)[2] = static_cast< Value >( 0 ); - (*this)[3] = static_cast< Value >( 0 ); - (*this)[4] = static_cast< Value >( 0 ); - (*this)[5] = static_cast< Value >( 0 ); - (*this)[6] = static_cast< Value >( 0 ); - (*this)[7] = static_cast< Value >( 0 ); - (*this)[8] = static_cast< Value >( 0 ); - (*this)[9] = static_cast< Value >( 0 ); - (*this)[10] = static_cast< Value >( 0 ) - static_cast< Value >( 41 )/static_cast<Value>( 840 ); - (*this)[11] = static_cast< Value >( 41 )/static_cast<Value>( 840 ); - (*this)[12] = static_cast< Value >( 41 )/static_cast<Value>( 840 ); - } -}; - - -template< class Value = double > -struct rk78_coefficients_c : boost::array< Value , 13 > -{ - rk78_coefficients_c( void ) - { - (*this)[0] = static_cast< Value >( 0 ); - (*this)[1] = static_cast< Value >( 2 )/static_cast< Value >( 27 ); - (*this)[2] = static_cast< Value >( 1 )/static_cast< Value >( 9 ); - (*this)[3] = static_cast< Value >( 1 )/static_cast<Value>( 6 ); - (*this)[4] = static_cast< Value >( 5 )/static_cast<Value>( 12 ); - (*this)[5] = static_cast< Value >( 1 )/static_cast<Value>( 2 ); - (*this)[6] = static_cast< Value >( 5 )/static_cast<Value>( 6 ); - (*this)[7] = static_cast< Value >( 1 )/static_cast<Value>( 6 ); - (*this)[8] = static_cast< Value >( 2 )/static_cast<Value>( 3 ); - (*this)[9] = static_cast< Value >( 1 )/static_cast<Value>( 3 ); - (*this)[10] = static_cast< Value >( 1 ); - (*this)[11] = static_cast< Value >( 0 ); - (*this)[12] = static_cast< Value >( 1 ); - } -}; -#endif // DOXYGEN_SKIP - - - - - -template< -class State , -class Value = double , -class Deriv = State , -class Time = Value , -class Algebra = typename algebra_dispatcher< State >::algebra_type , -class Operations = typename operations_dispatcher< State >::operations_type , -class Resizer = initially_resizer -> -#ifndef DOXYGEN_SKIP -class runge_kutta_fehlberg78 : public explicit_error_generic_rk< 13 , 8 , 8 , 7 , State , Value , Deriv , Time , -Algebra , Operations , Resizer > -#else -class runge_kutta_fehlberg78 : public explicit_error_generic_rk -#endif -{ - -public: -#ifndef DOXYGEN_SKIP - typedef explicit_error_generic_rk< 13 , 8 , 8 , 7 , State , Value , Deriv , Time , - Algebra , Operations , Resizer > stepper_base_type; -#endif - typedef typename stepper_base_type::state_type state_type; - typedef typename stepper_base_type::value_type value_type; - typedef typename stepper_base_type::deriv_type deriv_type; - typedef typename stepper_base_type::time_type time_type; - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::operations_type operations_type; - typedef typename stepper_base_type::resizer_type resizer_type; - - #ifndef DOXYGEN_SKIP - typedef typename stepper_base_type::stepper_type stepper_type; - typedef typename stepper_base_type::wrapped_state_type wrapped_state_type; - typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type; - #endif // DOXYGEN_SKIP - - - runge_kutta_fehlberg78( const algebra_type &algebra = algebra_type() ) : stepper_base_type( - boost::fusion::make_vector( rk78_coefficients_a1<Value>() , rk78_coefficients_a2<Value>() , rk78_coefficients_a3<Value>() , - rk78_coefficients_a4<Value>() , rk78_coefficients_a5<Value>() , rk78_coefficients_a6<Value>() , - rk78_coefficients_a7<Value>() , rk78_coefficients_a8<Value>() , rk78_coefficients_a9<Value>() , - rk78_coefficients_a10<Value>() , rk78_coefficients_a11<Value>() , rk78_coefficients_a12<Value>() ) , - rk78_coefficients_b<Value>() , rk78_coefficients_db<Value>() , rk78_coefficients_c<Value>() , algebra ) - { } -}; - - - -/************* DOXYGEN *************/ - -/** - * \class runge_kutta_fehlberg78 - * \brief The Runge-Kutta Fehlberg 78 method. - * - * The Runge-Kutta Fehlberg 78 method is a standard method for high-precision applications. - * The method is explicit and fulfills the Error Stepper concept. Step size control - * is provided but continuous output is not available for this method. - * - * This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring template pattern). - * Furthermore, it derivs from explicit_error_generic_rk which is a generic Runge-Kutta algorithm with error estimation. - * For more details see explicit_error_stepper_base and explicit_error_generic_rk. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - - /** - * \fn runge_kutta_fehlberg78::runge_kutta_fehlberg78( const algebra_type &algebra ) - * \brief Constructs the runge_kutta_cash_fehlberg78 class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - -} -} -} - -#endif //BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/stepper_categories.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/stepper_categories.hpp deleted file mode 100644 index 9bc5372344f95348f90b86ba8a1df38b7e52c818..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/stepper_categories.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/stepper_categories.hpp - - [begin_description] - Definition of all stepper categories. - [end_description] - - Copyright 2010-2011 Mario Mulansky - Copyright 2010-2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_STEPPER_CATEGORIES_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_STEPPER_CATEGORIES_HPP_INCLUDED - -#include <boost/type_traits/integral_constant.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -/* - * Tags to specify stepper types - * - * These tags are used by integrate() to choose which integration method is used - */ - -struct stepper_tag {}; -// struct explicit_stepper_tag : stepper_tag {}; -// struct implicit_stepper_tag : stepper_tag {}; - - -struct error_stepper_tag : stepper_tag {}; -struct explicit_error_stepper_tag : error_stepper_tag {}; -struct explicit_error_stepper_fsal_tag : error_stepper_tag {}; - -struct controlled_stepper_tag {}; -struct explicit_controlled_stepper_tag : controlled_stepper_tag {}; -struct explicit_controlled_stepper_fsal_tag : controlled_stepper_tag {}; - -struct dense_output_stepper_tag {}; - - -template< class tag > struct base_tag ; -template< > struct base_tag< stepper_tag > { typedef stepper_tag type; }; -template< > struct base_tag< error_stepper_tag > { typedef stepper_tag type; }; -template< > struct base_tag< explicit_error_stepper_tag > { typedef stepper_tag type; }; -template< > struct base_tag< explicit_error_stepper_fsal_tag > { typedef stepper_tag type; }; - -template< > struct base_tag< controlled_stepper_tag > { typedef controlled_stepper_tag type; }; -template< > struct base_tag< explicit_controlled_stepper_tag > { typedef controlled_stepper_tag type; }; -template< > struct base_tag< explicit_controlled_stepper_fsal_tag > { typedef controlled_stepper_tag type; }; - -template< > struct base_tag< dense_output_stepper_tag > { typedef dense_output_stepper_tag type; }; - - -} // odeint -} // numeric -} // boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_STEPPER_CATEGORIES_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_euler.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_euler.hpp deleted file mode 100644 index bd40860b0b4b5bf6b2764c53ff285c2748e6e556..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_euler.hpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/symplectic_euler.hpp - - [begin_description] - Implementation of the symplectic Euler for separable Hamiltonian systems. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED - - -#include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp> - -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/array.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -#ifndef DOXYGEN_SKIP -namespace detail { -namespace symplectic_euler_coef { - -template< class Value > -struct coef_a_type : public boost::array< Value , 1 > -{ - coef_a_type( void ) - { - (*this)[0] = static_cast< Value >( 1 ); - } -}; - -template< class Value > -struct coef_b_type : public boost::array< Value , 1 > -{ - coef_b_type( void ) - { - (*this)[0] = static_cast< Value >( 1 ); - } -}; - -} // namespace symplectic_euler_coef -} // namespace detail -#endif - - - -template< -class Coor , -class Momentum = Coor , -class Value = double , -class CoorDeriv = Coor , -class MomentumDeriv = Coor , -class Time = Value , -class Algebra = typename algebra_dispatcher< Coor >::algebra_type , -class Operations = typename operations_dispatcher< Coor >::operations_type , -class Resizer = initially_resizer -> -#ifndef DOXYGEN_SKIP -class symplectic_euler : -public symplectic_nystroem_stepper_base -< -1 , 1 , -Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer -> -#else -class symplectic_euler : public symplectic_nystroem_stepper_base -#endif -{ -public: - -#ifndef DOXYGEN_SKIP - typedef symplectic_nystroem_stepper_base< - 1 , 1 , Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > stepper_base_type; -#endif - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::value_type value_type; - - - symplectic_euler( const algebra_type &algebra = algebra_type() ) - : stepper_base_type( detail::symplectic_euler_coef::coef_a_type< value_type >() , - detail::symplectic_euler_coef::coef_b_type< value_type >() , - algebra ) - { } -}; - - -/*************** DOXYGEN ***************/ - -/** - * \class symplectic_euler - * \brief Implementation of the symplectic Euler method. - * - * The method is of first order and has one stage. It is described HERE. - * - * \tparam Order The order of the stepper. - * \tparam Coor The type representing the coordinates q. - * \tparam Momentum The type representing the coordinates p. - * \tparam Value The basic value type. Should be something like float, double or a high-precision type. - * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt. - * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt. - * \tparam Time The type representing the time t. - * \tparam Algebra The algebra. - * \tparam Operations The operations. - * \tparam Resizer The resizer policy. - */ - - /** - * \fn symplectic_euler::symplectic_euler( const algebra_type &algebra ) - * \brief Constructs the symplectic_euler. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp deleted file mode 100644 index b33773e2f701cbdc5b2a945dfb5ebed848ad07ed..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2012-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED - -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/resizer.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -#ifndef DOXYGEN_SKIP -namespace detail { -namespace symplectic_rkn_sb3a_m4_mclachlan { - - /* - exp( a1 t A ) exp( b1 t B ) - exp( a2 t A ) exp( b2 t B ) - exp( a3 t A ) - exp( b2 t B ) exp( a2 t A ) - exp( b1 t B ) exp( a1 t A ) - */ - - - - template< class Value > - struct coef_a_type : public boost::array< Value , 5 > - { - coef_a_type( void ) - { - using std::sqrt; - - Value z = sqrt( static_cast< Value >( 7 ) / static_cast< Value >( 8 ) ) / static_cast< Value >( 3 ); - (*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - z ; - (*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 3 ) + z ; - (*this)[2] = static_cast< Value >( 2 ) / static_cast< Value >( 3 ); - (*this)[3] = (*this)[1]; - (*this)[4] = (*this)[0]; - } - }; - - template< class Value > - struct coef_b_type : public boost::array< Value , 5 > - { - coef_b_type( void ) - { - (*this)[0] = static_cast< Value >( 1 ); - (*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 2 ); - (*this)[2] = (*this)[1]; - (*this)[3] = (*this)[0]; - (*this)[4] = static_cast< Value >( 0 ); - } - }; - -} // namespace symplectic_rkn_sb3a_m4_mclachlan -} // namespace detail -#endif // DOXYGEN_SKIP - - - - -template< - class Coor , - class Momentum = Coor , - class Value = double , - class CoorDeriv = Coor , - class MomentumDeriv = Coor , - class Time = Value , - class Algebra = typename algebra_dispatcher< Coor >::algebra_type , - class Operations = typename operations_dispatcher< Coor >::operations_type , - class Resizer = initially_resizer - > -#ifndef DOXYGEN_SKIP -class symplectic_rkn_sb3a_m4_mclachlan : - public symplectic_nystroem_stepper_base -< - 5 , 4 , - Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer - > -#else -class symplectic_rkn_sb3a_m4_mclachlan : public symplectic_nystroem_stepper_base -#endif -{ -public: -#ifndef DOXYGEN_SKIP - typedef symplectic_nystroem_stepper_base - < - 5 , 4 , - Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer - > stepper_base_type; -#endif - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::value_type value_type; - - - symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra = algebra_type() ) - : stepper_base_type( - detail::symplectic_rkn_sb3a_m4_mclachlan::coef_a_type< value_type >() , - detail::symplectic_rkn_sb3a_m4_mclachlan::coef_b_type< value_type >() , - algebra ) - { } -}; - - -/***************** DOXYGEN ***************/ - -/** - * \class symplectic_rkn_sb3a_m4_mclachlan - * \brief Implementation of the symmetric B3A Runge-Kutta Nystroem method of fifth order. - * - * The method is of fourth order and has five stages. It is described HERE. This method can be used - * with multiprecision types since the coefficients are defined analytically. - * - * ToDo: add reference to paper. - * - * \tparam Order The order of the stepper. - * \tparam Coor The type representing the coordinates q. - * \tparam Momentum The type representing the coordinates p. - * \tparam Value The basic value type. Should be something like float, double or a high-precision type. - * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt. - * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt. - * \tparam Time The type representing the time t. - * \tparam Algebra The algebra. - * \tparam Operations The operations. - * \tparam Resizer The resizer policy. - */ - - /** - * \fn symplectic_rkn_sb3a_m4_mclachlan::symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra ) - * \brief Constructs the symplectic_rkn_sb3a_m4_mclachlan. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp deleted file mode 100644 index 5a23b3081d354c0964f5008d6261f0ee89442d1c..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp +++ /dev/null @@ -1,162 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp - - [begin_description] - Implementation of the symplectic MacLachlan stepper for separable Hamiltonian system. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED - - -#include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp> - -#include <boost/numeric/odeint/algebra/range_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> - -#include <boost/numeric/odeint/util/resizer.hpp> - -#include <boost/array.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -#ifndef DOXYGEN_SKIP -namespace detail { -namespace symplectic_rkn_sb3a_mclachlan { - - /* - exp( a1 t A ) exp( b1 t B ) - exp( a2 t A ) exp( b2 t B ) - exp( a3 t A ) exp( b3 t B ) exp( a3 t A ) - exp( b2 t B ) exp( a2 t A ) - exp( b1 t B ) exp( a1 t A ) - */ - - template< class Value > - struct coef_a_type : public boost::array< Value , 6 > - { - coef_a_type( void ) - { - (*this)[0] = static_cast< Value >( 0.40518861839525227722 ); - (*this)[1] = static_cast< Value >( -0.28714404081652408900 ); - (*this)[2] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - ( (*this)[0] + (*this)[1] ); - (*this)[3] = (*this)[2]; - (*this)[4] = (*this)[1]; - (*this)[5] = (*this)[0]; - - } - }; - - template< class Value > - struct coef_b_type : public boost::array< Value , 6 > - { - coef_b_type( void ) - { - (*this)[0] = static_cast< Value >( -3 ) / static_cast< Value >( 73 ); - (*this)[1] = static_cast< Value >( 17 ) / static_cast< Value >( 59 ); - (*this)[2] = static_cast< Value >( 1 ) - static_cast< Value >( 2 ) * ( (*this)[0] + (*this)[1] ); - (*this)[3] = (*this)[1]; - (*this)[4] = (*this)[0]; - (*this)[5] = static_cast< Value >( 0 ); - } - }; - -} // namespace symplectic_rkn_sb3a_mclachlan -} // namespace detail -#endif // DOXYGEN_SKIP - - - -template< - class Coor , - class Momentum = Coor , - class Value = double , - class CoorDeriv = Coor , - class MomentumDeriv = Coor , - class Time = Value , - class Algebra = typename algebra_dispatcher< Coor >::algebra_type , - class Operations = typename operations_dispatcher< Coor >::operations_type , - class Resizer = initially_resizer - > -#ifndef DOXYGEN_SKIP -class symplectic_rkn_sb3a_mclachlan : - public symplectic_nystroem_stepper_base -< - 6 , 4 , - Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer - > -#else -class symplectic_rkn_sb3a_mclachlan : public symplectic_nystroem_stepper_base -#endif -{ -public: -#ifndef DOXYGEN_SKIP - typedef symplectic_nystroem_stepper_base - < - 6 , 4 , - Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer - > stepper_base_type; -#endif - typedef typename stepper_base_type::algebra_type algebra_type; - typedef typename stepper_base_type::value_type value_type; - - - symplectic_rkn_sb3a_mclachlan( const algebra_type &algebra = algebra_type() ) - : stepper_base_type( - detail::symplectic_rkn_sb3a_mclachlan::coef_a_type< value_type >() , - detail::symplectic_rkn_sb3a_mclachlan::coef_b_type< value_type >() , - algebra ) - { } -}; - - -/************* DOXYGEN ***********/ - -/** - * \class symplectic_rkn_sb3a_mclachlan - * \brief Implement of the symmetric B3A method of Runge-Kutta-Nystroem method of sixth order. - * - * The method is of fourth order and has six stages. It is described HERE. This method cannot be used - * with multiprecision types since the coefficients are not defined analytically. - * - * ToDo Add reference to the paper. - * - * \tparam Order The order of the stepper. - * \tparam Coor The type representing the coordinates q. - * \tparam Momentum The type representing the coordinates p. - * \tparam Value The basic value type. Should be something like float, double or a high-precision type. - * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt. - * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt. - * \tparam Time The type representing the time t. - * \tparam Algebra The algebra. - * \tparam Operations The operations. - * \tparam Resizer The resizer policy. - */ - - /** - * \fn symplectic_rkn_sb3a_mclachlan::symplectic_rkn_sb3a_mclachlan( const algebra_type &algebra ) - * \brief Constructs the symplectic_rkn_sb3a_mclachlan. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. - */ - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/velocity_verlet.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/velocity_verlet.hpp deleted file mode 100644 index 6868aad87edd06e18ce8542917d6f7a92cb59aec..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/stepper/velocity_verlet.hpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/stepper/velocity_verlet.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_VELOCITY_VERLET_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_STEPPER_VELOCITY_VERLET_HPP_DEFINED - -#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp> -#include <boost/numeric/odeint/stepper/stepper_categories.hpp> - -#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> -#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -#include <boost/numeric/odeint/util/state_wrapper.hpp> -#include <boost/numeric/odeint/util/unwrap_reference.hpp> - -#include <boost/numeric/odeint/util/bind.hpp> -#include <boost/numeric/odeint/util/copy.hpp> -#include <boost/numeric/odeint/util/resizer.hpp> -// #include <boost/numeric/odeint/util/is_pair.hpp> -// #include <boost/array.hpp> - - - -namespace boost { -namespace numeric { -namespace odeint { - - - -template < - class Coor , - class Velocity = Coor , - class Value = double , - class Acceleration = Coor , - class Time = Value , - class TimeSq = Time , - class Algebra = typename algebra_dispatcher< Coor >::algebra_type , - class Operations = typename operations_dispatcher< Coor >::operations_type , - class Resizer = initially_resizer - > -class velocity_verlet : public algebra_stepper_base< Algebra , Operations > -{ -public: - - typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type; - typedef typename algebra_stepper_base_type::algebra_type algebra_type; - typedef typename algebra_stepper_base_type::operations_type operations_type; - - typedef Coor coor_type; - typedef Velocity velocity_type; - typedef Acceleration acceleration_type; - typedef std::pair< coor_type , velocity_type > state_type; - typedef std::pair< velocity_type , acceleration_type > deriv_type; - typedef state_wrapper< acceleration_type > wrapped_acceleration_type; - typedef Value value_type; - typedef Time time_type; - typedef TimeSq time_square_type; - typedef Resizer resizer_type; - typedef stepper_tag stepper_category; - - typedef unsigned short order_type; - - static const order_type order_value = 1; - - /** - * \return Returns the order of the stepper. - */ - order_type order( void ) const - { - return order_value; - } - - - velocity_verlet( const algebra_type & algebra = algebra_type() ) - : algebra_stepper_base_type( algebra ) , m_first_call( true ) - , m_a1() , m_a2() , m_current_a1( true ) { } - - - template< class System , class StateInOut > - void do_step( System system , StateInOut & x , time_type t , time_type dt ) - { - do_step_v1( system , x , t , dt ); - } - - - template< class System , class StateInOut > - void do_step( System system , const StateInOut & x , time_type t , time_type dt ) - { - do_step_v1( system , x , t , dt ); - } - - - template< class System , class CoorIn , class VelocityIn , class AccelerationIn , - class CoorOut , class VelocityOut , class AccelerationOut > - void do_step( System system , CoorIn const & qin , VelocityIn const & pin , AccelerationIn const & ain , - CoorOut & qout , VelocityOut & pout , AccelerationOut & aout , time_type t , time_type dt ) - { - const value_type one = static_cast< value_type >( 1.0 ); - const value_type one_half = static_cast< value_type >( 0.5 ); - - algebra_stepper_base_type::m_algebra.for_each4( - qout , qin , pin , ain , - typename operations_type::template scale_sum3< value_type , time_type , time_square_type >( one , one * dt , one_half * dt * dt ) ); - - typename odeint::unwrap_reference< System >::type & sys = system; - - sys( qout , pin , aout , t + dt ); - - algebra_stepper_base_type::m_algebra.for_each4( - pout , pin , ain , aout , - typename operations_type::template scale_sum3< value_type , time_type , time_type >( one , one_half * dt , one_half * dt ) ); - } - - - template< class StateIn > - void adjust_size( const StateIn & x ) - { - if( resize_impl( x ) ) - m_first_call = true; - } - - void reset( void ) - { - m_first_call = true; - } - - - /** - * \fn velocity_verlet::initialize( const AccelerationIn &qin ) - * \brief Initializes the internal state of the stepper. - * \param deriv The acceleration of x. The next call of `do_step` expects that the acceleration of `x` passed to `do_step` - * has the value of `qin`. - */ - template< class AccelerationIn > - void initialize( const AccelerationIn & ain ) - { - // alloc a - m_resizer.adjust_size( ain , - detail::bind( &velocity_verlet::template resize_impl< AccelerationIn > , - detail::ref( *this ) , detail::_1 ) ); - boost::numeric::odeint::copy( ain , get_current_acc() ); - m_first_call = false; - } - - - template< class System , class CoorIn , class VelocityIn > - void initialize( System system , const CoorIn & qin , const VelocityIn & pin , time_type t ) - { - m_resizer.adjust_size( qin , - detail::bind( &velocity_verlet::template resize_impl< CoorIn > , - detail::ref( *this ) , detail::_1 ) ); - initialize_acc( system , qin , pin , t ); - } - - bool is_initialized( void ) const - { - return ! m_first_call; - } - - -private: - - template< class System , class CoorIn , class VelocityIn > - void initialize_acc( System system , const CoorIn & qin , const VelocityIn & pin , time_type t ) - { - typename odeint::unwrap_reference< System >::type & sys = system; - sys( qin , pin , get_current_acc() , t ); - m_first_call = false; - } - - template< class System , class StateInOut > - void do_step_v1( System system , StateInOut & x , time_type t , time_type dt ) - { - typedef typename odeint::unwrap_reference< StateInOut >::type state_in_type; - typedef typename odeint::unwrap_reference< typename state_in_type::first_type >::type coor_in_type; - typedef typename odeint::unwrap_reference< typename state_in_type::second_type >::type momentum_in_type; - - typedef typename boost::remove_reference< coor_in_type >::type xyz_type; - state_in_type & statein = x; - coor_in_type & qinout = statein.first; - momentum_in_type & pinout = statein.second; - - // alloc a - if( m_resizer.adjust_size( qinout , - detail::bind( &velocity_verlet::template resize_impl< xyz_type > , - detail::ref( *this ) , detail::_1 ) ) - || m_first_call ) - { - initialize_acc( system , qinout , pinout , t ); - } - - // check first - do_step( system , qinout , pinout , get_current_acc() , qinout , pinout , get_old_acc() , t , dt ); - toggle_current_acc(); - } - - template< class StateIn > - bool resize_impl( const StateIn & x ) - { - bool resized = false; - resized |= adjust_size_by_resizeability( m_a1 , x , typename is_resizeable< acceleration_type >::type() ); - resized |= adjust_size_by_resizeability( m_a2 , x , typename is_resizeable< acceleration_type >::type() ); - return resized; - } - - acceleration_type & get_current_acc( void ) - { - return m_current_a1 ? m_a1.m_v : m_a2.m_v ; - } - - const acceleration_type & get_current_acc( void ) const - { - return m_current_a1 ? m_a1.m_v : m_a2.m_v ; - } - - acceleration_type & get_old_acc( void ) - { - return m_current_a1 ? m_a2.m_v : m_a1.m_v ; - } - - const acceleration_type & get_old_acc( void ) const - { - return m_current_a1 ? m_a2.m_v : m_a1.m_v ; - } - - void toggle_current_acc( void ) - { - m_current_a1 = ! m_current_a1; - } - - resizer_type m_resizer; - bool m_first_call; - wrapped_acceleration_type m_a1 , m_a2; - bool m_current_a1; -}; - -/** - * \class velocity_verlet - * \brief The Velocity-Verlet algorithm. - * - * <a href="http://en.wikipedia.org/wiki/Verlet_integration" >The Velocity-Verlet algorithm</a> is a method for simulation of molecular dynamics systems. It solves the ODE - * a=f(r,v',t) where r are the coordinates, v are the velocities and a are the accelerations, hence v = dr/dt, a=dv/dt. - * - * \tparam Coor The type representing the coordinates. - * \tparam Velocity The type representing the velocities. - * \tparam Value The type value type. - * \tparam Acceleration The type representing the acceleration. - * \tparam Time The time representing the independent variable - the time. - * \tparam TimeSq The time representing the square of the time. - * \tparam Algebra The algebra. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - - /** - * \fn velocity_verlet::velocity_verlet( const algebra_type &algebra ) - * \brief Constructs the velocity_verlet class. This constructor can be used as a default - * constructor if the algebra has a default constructor. - * \param algebra A copy of algebra is made and stored. - */ - - - /** - * \fn velocity_verlet::do_step( System system , StateInOut &x , time_type t , time_type dt ) - * \brief This method performs one step. It transforms the result in-place. - * - * It can be used like - * \code - * pair< coordinates , velocities > state; - * stepper.do_step( sys , x , t , dt ); - * \endcode - * - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Second Order System concept. - * \param x The state of the ODE which should be solved. The state is pair of Coor and Velocity. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - /** - * \fn velocity_verlet::do_step( System system , const StateInOut &x , time_type t , time_type dt ) - * \brief This method performs one step. It transforms the result in-place. - * - * It can be used like - * \code - * pair< coordinates , velocities > state; - * stepper.do_step( sys , x , t , dt ); - * \endcode - * - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Second Order System concept. - * \param x The state of the ODE which should be solved. The state is pair of Coor and Velocity. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - - - /** - * \fn velocity_verlet::do_step( System system , CoorIn const & qin , VelocityIn const & pin , AccelerationIn const & ain , CoorOut & qout , VelocityOut & pout , AccelerationOut & aout , time_type t , time_type dt ) - * \brief This method performs one step. It transforms the result in-place. Additionally to the other methods - * the coordinates, velocities and accelerations are passed directly to do_step and they are transformed out-of-place. - * - * It can be used like - * \code - * coordinates qin , qout; - * velocities pin , pout; - * accelerations ain, aout; - * stepper.do_step( sys , qin , pin , ain , qout , pout , aout , t , dt ); - * \endcode - * - * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the - * Second Order System concept. - * \param x The state of the ODE which should be solved. The state is pair of Coor and Velocity. - * \param t The value of the time, at which the step should be performed. - * \param dt The step size. - */ - - - /** - * \fn void velocity_verlet::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - - - /** - * \fn velocity_verlet::reset( void ) - * \brief Resets the internal state of this stepper. After calling this method it is safe to use all - * `do_step` method without explicitly initializing the stepper. - */ - - - - /** - * \fn velocity_verlet::initialize( System system , const CoorIn &qin , const VelocityIn &pin , time_type t ) - * \brief Initializes the internal state of the stepper. - * - * This method is equivalent to - * \code - * Acceleration a; - * system( qin , pin , a , t ); - * stepper.initialize( a ); - * \endcode - * - * \param system The system function for the next calls of `do_step`. - * \param qin The current coordinates of the ODE. - * \param pin The current velocities of the ODE. - * \param t The current time of the ODE. - */ - - - /** - * \fn velocity_verlet::is_initialized() - * \returns Returns if the stepper is initialized. - */ - - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_VELOCITY_VERLET_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/bind.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/bind.hpp deleted file mode 100644 index ead0fc0e98fa52368be2c85fc69c971f8bbcf621..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/bind.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * [begin_description] - * Boost bind pull the placeholders, _1, _2, ... into global - * namespace. This can conflict with the C++03 TR1 and C++11 - * std::placeholders. This header provides a workaround for - * this problem. - * [end_description] - * - * Copyright 2012 Christoph Koke - * Copyright 2012 Karsten Ahnert - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or - * copy at http://www.boost.org/LICENSE_1_0.txt) - * */ - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED - - -#include <boost/numeric/odeint/config.hpp> - - -#if BOOST_NUMERIC_ODEINT_CXX11 - #include <functional> -#else -#define BOOST_BIND_NO_PLACEHOLDERS -#include <boost/bind.hpp> -#endif - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -#if BOOST_NUMERIC_ODEINT_CXX11 - -using ::std::bind; -using namespace ::std::placeholders; - - -#else - -// unnamed namespace to avoid multiple declarations (#138) -namespace { -using ::boost::bind; -boost::arg<1> _1; -boost::arg<2> _2; -} -// using ::boost::bind; -// using ::_1; -// using ::_2; - -#endif - -} -} -} -} - - - - - -/* - -// the following is the suggested way. Unfortunately it does not work with all compilers. - -#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL -#include <boost/bind.hpp> -#else -#include <functional> -#endif - - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - - -#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL - -using ::boost::bind; -using ::_1; -using ::_2; - -#else - -using ::std::bind; -using namespace ::std::placeholders; - -#endif - - -} -} -} -}*/ - -#endif // BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/copy.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/copy.hpp deleted file mode 100644 index 161f135534783c9c08d55d1d95e278a66883c326..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/copy.hpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/copy.hpp - - [begin_description] - Copy abstraction for the usage in the steppers. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED - - -#include <boost/range/algorithm/copy.hpp> - -#include <boost/utility/enable_if.hpp> - -#include <boost/numeric/odeint/util/detail/is_range.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -namespace detail { - - template< class Container1 , class Container2 > - void do_copying( const Container1 &from , Container2 &to , boost::mpl::true_ ) - { - boost::range::copy( from , boost::begin( to ) ); - } - - template< class Container1 , class Container2 > - void do_copying( const Container1 &from , Container2 &to , boost::mpl::false_ ) - { - to = from; - } - -} // namespace detail - - - -/* - * Default implementation of the copy operation used the assign operator - * gsl_vector must copied differently - */ -template< class Container1 , class Container2 , class Enabler = void > -struct copy_impl_sfinae -{ - static void copy( const Container1 &from , Container2 &to ) - { - typedef typename boost::numeric::odeint::detail::is_range< Container1 >::type is_range_type; - detail::do_copying( from , to , is_range_type() ); - } - -}; - -template< class Container1, class Container2 > -struct copy_impl -{ - static void copy( const Container1 &from , Container2 &to ) - { - copy_impl_sfinae< Container1 , Container2 >::copy( from , to ); - } -}; - -// ToDo: allow also to copy INTO a range, not only from a range! Needs "const Container2 &to" -template< class Container1 , class Container2 > -void copy( const Container1 &from , Container2 &to ) -{ - copy_impl< Container1 , Container2 >::copy( from , to ); -} - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/detail/is_range.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/detail/is_range.hpp deleted file mode 100644 index a1768554119c1644c1f8275d1b8777a6d73260e9..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/detail/is_range.hpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/detail/is_range.hpp - - [begin_description] - is_range implementation. Taken from the boost::range library. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011-2013 Thorsten Ottosen - - - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED - - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif - -#include <cstddef> -#include <boost/range/config.hpp> -#include <boost/mpl/has_xxx.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/and.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - - -namespace range_detail -{ -BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator) - BOOST_MPL_HAS_XXX_TRAIT_DEF(const_iterator) -} - -namespace detail -{ - -template< typename Range > -struct is_range : boost::mpl::and_<range_detail::has_iterator<Range>, range_detail::has_const_iterator<Range> > -{ -}; - -////////////////////////////////////////////////////////////////////////// -// pair -////////////////////////////////////////////////////////////////////////// - -template< typename iteratorT > -struct is_range< std::pair<iteratorT,iteratorT> > : boost::mpl::true_ -{ -}; - -template< typename iteratorT > -struct is_range< const std::pair<iteratorT,iteratorT> > : boost::mpl::true_ -{ -}; - -////////////////////////////////////////////////////////////////////////// -// array -////////////////////////////////////////////////////////////////////////// - -template< typename elementT, std::size_t sz > -struct is_range< elementT[sz] > : boost::mpl::true_ -{ -}; - -template< typename elementT, std::size_t sz > -struct is_range< const elementT[sz] > : boost::mpl::true_ -{ -}; - -////////////////////////////////////////////////////////////////////////// -// string -////////////////////////////////////////////////////////////////////////// - -template<> -struct is_range< char* > : boost::mpl::true_ -{ -}; - -template<> -struct is_range< wchar_t* > : boost::mpl::true_ -{ -}; - -template<> -struct is_range< const char* > : boost::mpl::true_ -{ -}; - -template<> -struct is_range< const wchar_t* > : boost::mpl::true_ -{ -}; - -template<> -struct is_range< char* const > : boost::mpl::true_ -{ -}; - -template<> -struct is_range< wchar_t* const > : boost::mpl::true_ -{ -}; - -template<> -struct is_range< const char* const > : boost::mpl::true_ -{ -}; - -template<> -struct is_range< const wchar_t* const > : boost::mpl::true_ -{ -}; - -} // namespace detail - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/detail/less_with_sign.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/detail/less_with_sign.hpp deleted file mode 100644 index 3ffa7ca179252479dd5e1ac075c69fe9f40ccd10..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/detail/less_with_sign.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/detail/less_with_sign.hpp - - [begin_description] - Helper function to compare times taking into account the sign of dt - [end_description] - - Copyright 2012-2015 Mario Mulansky - Copyright 2012 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_LESS_WITH_SIGN_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_LESS_WITH_SIGN_HPP_INCLUDED - -#include <limits> - -#include <boost/numeric/odeint/util/unit_helper.hpp> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -/** - * return t1 < t2 if dt > 0 and t1 > t2 if dt < 0 with epsilon accuracy - */ -template< typename T > -bool less_with_sign( T t1 , T t2 , T dt ) -{ - if( get_unit_value(dt) > 0 ) - //return t1 < t2; - return t2-t1 > std::numeric_limits<T>::epsilon(); - else - //return t1 > t2; - return t1-t2 > std::numeric_limits<T>::epsilon(); -} - -/** - * return t1 <= t2 if dt > 0 and t1 => t2 if dt < 0 with epsilon accuracy - */ -template< typename T > -bool less_eq_with_sign( T t1 , T t2 , T dt ) -{ - if( get_unit_value(dt) > 0 ) - return t1-t2 <= std::numeric_limits<T>::epsilon(); - else - return t2-t1 <= std::numeric_limits<T>::epsilon(); -} - -template< typename T > -T min_abs( T t1 , T t2 ) -{ - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - if( get_unit_value(t1)>0 ) - return min BOOST_PREVENT_MACRO_SUBSTITUTION ( t1 , t2 ); - else - return max BOOST_PREVENT_MACRO_SUBSTITUTION ( t1 , t2 ); -} - -template< typename T > -T max_abs( T t1 , T t2 ) -{ - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - if( get_unit_value(t1)>0 ) - return max BOOST_PREVENT_MACRO_SUBSTITUTION ( t1 , t2 ); - else - return min BOOST_PREVENT_MACRO_SUBSTITUTION ( t1 , t2 ); -} -} } } } - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/is_pair.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/is_pair.hpp deleted file mode 100644 index 1827840fe2b84b9bb2ad242baf0f26398869b905..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/is_pair.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/is_pair.hpp - - [begin_description] - Metafunction to determine if a type is a std::pair<>. - [end_description] - - Copyright 2011 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_IS_PAIR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_IS_PAIR_HPP_INCLUDED - - -#include <boost/mpl/bool.hpp> -#include <utility> - - -namespace boost { -namespace numeric { -namespace odeint { - -template< class T > -struct is_pair : public boost::mpl::false_ -{ -}; - -template< class T1 , class T2 > -struct is_pair< std::pair< T1 , T2 > > : public boost::mpl::true_ -{ -}; - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_IS_PAIR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/is_resizeable.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/is_resizeable.hpp deleted file mode 100644 index 6db42183227702ba775be13ffc11dc63dbf49c3c..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/is_resizeable.hpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/is_resizeable.hpp - - [begin_description] - Metafunction to determine if a state type can resized. For usage in the steppers. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED - - -#include <vector> - -#include <boost/type_traits/integral_constant.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/fusion/include/front.hpp> -#include <boost/fusion/include/is_sequence.hpp> - -#include <boost/mpl/find_if.hpp> -#include <boost/mpl/end.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_same.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -/* - * by default any type is not resizable - */ -template< typename Container , typename Enabler = void > -struct is_resizeable_sfinae : boost::false_type {}; - -template< typename Container > -struct is_resizeable : is_resizeable_sfinae< Container > {}; - - - -/* - * specialization for std::vector - */ -template< class V, class A > -struct is_resizeable< std::vector< V , A > > : boost::true_type {}; - - -/* - * sfinae specialization for fusion sequences - */ -template< typename FusionSequence > -struct is_resizeable_sfinae< - FusionSequence , - typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSequence >::type >::type > -{ - typedef typename boost::mpl::find_if< FusionSequence , is_resizeable< boost::mpl::_1 > >::type iter; - typedef typename boost::mpl::end< FusionSequence >::type last; - - typedef typename boost::mpl::if_< boost::is_same< iter , last > , boost::false_type , boost::true_type >::type type; - const static bool value = type::value; -}; - - - - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/multi_array_adaption.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/multi_array_adaption.hpp deleted file mode 100644 index a7c35fe2cff3f97968f1443cd65130f69f49d029..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/multi_array_adaption.hpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/multi_array_adaption.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_MULTI_ARRAY_ADAPTION_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_UTIL_MULTI_ARRAY_ADAPTION_HPP_DEFINED - - - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> - -#include <boost/mpl/and.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/multi_array.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -template< typename T > -struct is_multi_array -{ - typedef boost::false_type type; - const static bool value = type::value; -}; - -template< typename T > -struct is_resizeable_multi_array -{ - typedef boost::false_type type; - const static bool value = type::value; -}; - - - -template< typename V , size_t Dim , typename A > -struct is_multi_array< boost::multi_array< V , Dim , A > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - -template< typename V , size_t Dim , typename A > -struct is_resizeable_multi_array< boost::multi_array< V , Dim , A > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - - - - -template< typename T > -struct is_resizeable_sfinae< T , typename boost::enable_if< typename is_resizeable_multi_array< T >::type >::type > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - - - - - -template< typename T1 , typename T2 > -struct same_size_impl_sfinae< T1 , T2 , - typename boost::enable_if< - typename boost::mpl::and_< - is_multi_array< T1 > , - is_multi_array< T2 > , - boost::mpl::bool_< T1::dimensionality == T2::dimensionality > - >::type - >::type > -{ - static bool same_size( T1 const &x1 , T2 const &x2 ) - { - for( size_t i=0 ; i<T1::dimensionality ; ++i ) - { - if( x1.shape()[i] != x2.shape()[i] ) return false; - if( x1.index_bases()[i] != x2.index_bases()[i] ) return false; - } - return true; - } -}; - - -template< typename T1 , typename T2 > -struct resize_impl_sfinae< T1 , T2 , - typename boost::enable_if< - typename boost::mpl::and_< - is_resizeable_multi_array< T1 > , - is_multi_array< T2 > , - boost::mpl::bool_< T1::dimensionality == T2::dimensionality > - >::type - >::type > -{ - static void resize( T1 &x1 , const T2 &x2 ) - { - boost::array< int , T1::dimensionality > extents; - for( size_t i=0 ; i<T1::dimensionality ; ++i ) extents[i] = x2.shape()[i]; - x1.resize( extents ); - boost::array< int , T1::dimensionality > origins; - for( size_t i=0 ; i<T1::dimensionality ; ++i ) origins[i] = x2.index_bases()[i]; - x1.reindex( origins ); - } -}; - - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_MULTI_ARRAY_ADAPTION_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/n_ary_helper.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/n_ary_helper.hpp deleted file mode 100644 index 61380742074812e6b30a38290600ea4d547e8514..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/n_ary_helper.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/n_ary_helper.hpp - - Macros to generate scale_sumN and for_eachN functors. - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_N_ARY_HELPER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_N_ARY_HELPER_HPP_INCLUDED - -#include <boost/preprocessor/repetition.hpp> - -// like BOOST_PP_ENUM_SHIFTED but with a comma in front like _TRAILING -#define BOOST_ODEINT_ENUM_TRAILING_SHIFTED_PARAMS(count, param) \ - BOOST_PP_COMMA_IF(BOOST_PP_DEC(count)) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(count, param) - -#define BOOST_ODEINT_ENUM_TRAILING_SHIFTED_BINARY_PARAMS(count, p1, p2) \ - BOOST_PP_COMMA_IF(BOOST_PP_DEC(count)) \ - BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(count, p1, p2) - -// like BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(n, p1, p2) but p2 is shifted left. -// generate "p1 ## 0 = p2, p1 ## 1 = p3 ## 0, p1 ## 2 = p3 ## 1" -#define BOOST_ODEINT_ENUM_LSHIFTED_BINARY_PARAMS(count, p1, p2, p3) \ - BOOST_PP_ENUM(count, BOOST_ODEINT_ENUM_LSHIFTED_BINARY_PARAMS_, (p1, p2, p3)) -#define BOOST_ODEINT_ENUM_LSHIFTED_BINARY_PARAMS_(z, n, data) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 0, data), n) \ - BOOST_PP_IF(n, \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 2, data), BOOST_PP_DEC(n)), \ - BOOST_PP_TUPLE_ELEM(3, 1, data)) - -// like BOOST_PP_ENUM_BINARY_PARAMS(n, p1, p2) but with statements. -// "p1 ## 0 p2 ## 0 ; p1 ## 1 p2 ## 1 ; ..." -#define BOOST_ODEINT_ENUM_BINARY_STATEMENTS(count, p1, p2) \ - BOOST_PP_REPEAT(count, BOOST_ODEINT_ENUM_BINARY_STATEMENTS_, (p1, p2)) -#define BOOST_ODEINT_ENUM_BINARY_STATEMENTS_(z, n, data) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, data), n) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, data), n) ; - -// like BOOST_PP_ENUM_BINARY_PARAMS(n, p1, p2) but p2 is in parens. -// "p1 ## 0 (p2 ## 0) , p1 ## 1 (p2 ## 1) , ..." -#define BOOST_ODEINT_ENUM_UNARY_CALLS(count, p1, p2) \ - BOOST_PP_ENUM(count, BOOST_ODEINT_ENUM_UNARY_CALLS_, (p1, p2)) -#define BOOST_ODEINT_ENUM_SHIFTED_UNARY_CALLS(count, p1, p2) \ - BOOST_PP_ENUM_SHIFTED(count, BOOST_ODEINT_ENUM_UNARY_CALLS_, (p1, p2)) -#define BOOST_ODEINT_ENUM_TRAILING_SHIFTED_UNARY_CALLS(count, p1, p2) \ - BOOST_PP_COMMA_IF(BOOST_PP_DEC(count)) \ - BOOST_PP_ENUM_SHIFTED(count, BOOST_ODEINT_ENUM_UNARY_CALLS_, (p1, p2)) -#define BOOST_ODEINT_ENUM_UNARY_CALLS_(z, n, data) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, data), n) \ - ( BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, data), n) ) - - -// maximum arity + 1 for scale_sum and for_each -#define BOOST_ODEINT_N_ARY_MAX 16 - - -// generate scale_sum1 to scale_sumN, operator body generated by macro(N) -#define BOOST_ODEINT_GEN_SCALE_SUM(macro) \ - BOOST_PP_REPEAT_FROM_TO(1, BOOST_ODEINT_N_ARY_MAX, BOOST_ODEINT_GEN_SCALE_SUM_, macro) -#define BOOST_ODEINT_GEN_SCALE_SUM_(z, n, macro) \ - template< BOOST_ODEINT_ENUM_LSHIFTED_BINARY_PARAMS(n, class Fac, = double, = Fac) > \ - struct BOOST_PP_CAT(scale_sum, n) \ - { \ - BOOST_ODEINT_ENUM_BINARY_STATEMENTS(n, const Fac, m_alpha) \ - \ - BOOST_PP_CAT(scale_sum, n) \ - ( BOOST_PP_ENUM_BINARY_PARAMS(n, Fac, alpha) ) \ - : BOOST_ODEINT_ENUM_UNARY_CALLS(n, m_alpha, alpha) {} \ - \ - template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), class T) > \ - void operator()( T0 &t0 \ - BOOST_ODEINT_ENUM_TRAILING_SHIFTED_BINARY_PARAMS(BOOST_PP_INC(n), const T, &t) \ - ) const \ - { macro(n) } \ - typedef void result_type; \ - }; - -// generate for_each1 to for_eachN, body generated by macro(N) -#define BOOST_ODEINT_GEN_FOR_EACH(macro) \ - BOOST_PP_REPEAT_FROM_TO(1, BOOST_ODEINT_N_ARY_MAX, BOOST_ODEINT_GEN_FOR_EACH_, macro) -#define BOOST_ODEINT_GEN_FOR_EACH_(z, n, macro) \ - template< BOOST_PP_ENUM_PARAMS(n, class S) , class Op > \ - static void for_each##n ( BOOST_PP_ENUM_BINARY_PARAMS(n, S, &s) , Op op ) \ - { macro(n) } - - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/odeint_error.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/odeint_error.hpp deleted file mode 100644 index 312e5b1afa7485baca946f89f3e1eb7b36f448d2..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/odeint_error.hpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/odeint_error.hpp - - [begin_description] - Runtime Exceptions thrown by odeint - [end_description] - - Copyright 2015 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_ODEINT_ERROR_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_ODEINT_ERROR_HPP_INCLUDED - -#include <stdexcept> -#include <string> - - -namespace boost { -namespace numeric { -namespace odeint { - - -/** - * \brief Runtime error thrown by odeint - */ -class odeint_error : public std::runtime_error -{ -public: - odeint_error(const std::string &s) - : std::runtime_error(s) - { } -}; - - -/** - * \brief Runtime error thrown from integrate routines - * - * This Error occures when too many iterations are performed in between two - * observer calls in the integrate routines. - */ -class no_progress_error : public odeint_error -{ -public: - no_progress_error(const std::string &s) - : odeint_error(s) - { } -}; - - -/** - * \brief Runtime error thrown during stepsize adjustment - * - * This Error occures when too many iterations are performed without finding - * an appropriate new step size. This usually indicates non-continuous points - * in the ODE. - */ -class step_adjustment_error : public odeint_error -{ -public: - step_adjustment_error(const std::string &s) - : odeint_error(s) - { } -}; - -} -} -} - - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_ODEINT_ERROR_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/resize.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/resize.hpp deleted file mode 100644 index 75e9eff448a167a40488f6d51c4685937eb19f20..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/resize.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/state_wrapper.hpp - - [begin_description] - State wrapper for the state type in all stepper. The state wrappers are responsible for construction, - destruction, copying construction, assignment and resizing. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED - -#include <boost/range.hpp> - -#include <boost/utility/enable_if.hpp> -#include <boost/fusion/include/is_sequence.hpp> -#include <boost/fusion/include/zip_view.hpp> -#include <boost/fusion/include/vector.hpp> -#include <boost/fusion/include/make_fused.hpp> -#include <boost/fusion/include/for_each.hpp> - -#include <boost/numeric/odeint/util/is_resizeable.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - - -template< class StateOut , class StateIn , class Enabler = void > -struct resize_impl_sfinae -{ - static void resize( StateOut &x1 , const StateIn &x2 ) - { - x1.resize( boost::size( x2 ) ); - } -}; - -// resize function -// standard implementation relies on boost.range and resize member function -template< class StateOut , class StateIn > -struct resize_impl -{ - static void resize( StateOut &x1 , const StateIn &x2 ) - { - resize_impl_sfinae< StateOut , StateIn >::resize( x1 , x2 ); - } -}; - - -// do not overload or specialize this function, specialize resize_impl<> instead -template< class StateOut , class StateIn > -void resize( StateOut &x1 , const StateIn &x2 ) -{ - resize_impl< StateOut , StateIn >::resize( x1 , x2 ); -} - - -namespace detail { - - struct resizer - { - typedef void result_type; - - template< class StateOut , class StateIn > - void operator()( StateOut &x1 , const StateIn &x2 ) const - { - resize_op( x1 , x2 , typename is_resizeable< StateOut >::type() ); - } - - template< class StateOut , class StateIn > - void resize_op( StateOut &x1 , const StateIn &x2 , boost::true_type ) const - { - resize( x1 , x2 ); - } - - template< class StateOut , class StateIn > - void resize_op( StateOut &x1 , const StateIn &x2 , boost::false_type ) const - { - } - - }; -} // namespace detail - - -/* - * specialization for fusion sequences - */ -template< class FusionSeq > -struct resize_impl_sfinae< FusionSeq , FusionSeq , - typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type > -{ - static void resize( FusionSeq &x1 , const FusionSeq &x2 ) - { - typedef boost::fusion::vector< FusionSeq& , const FusionSeq& > Sequences; - Sequences sequences( x1 , x2 ); - boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( detail::resizer() ) ); - } -}; - - - - -} -} -} - - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/resizer.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/resizer.hpp deleted file mode 100644 index fd969ec3b95cb62e99afa60a0b621a77a4f3822d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/resizer.hpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/resizer.hpp - - [begin_description] - Implementation of the resizers. - [end_description] - - Copyright 2011-2012 Mario Mulansky - Copyright 2011 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED - - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> -#include <boost/numeric/odeint/util/resize.hpp> - -namespace boost { -namespace numeric { -namespace odeint { - -template< class ResizeWrappedState , class State > -bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , boost::true_type ) -{ - if ( !same_size( x.m_v , y ) ) - { - resize( x.m_v , y ); - return true; - } - else - return false; -} - -template< class ResizeWrappedState , class State > -bool adjust_size_by_resizeability( ResizeWrappedState & /* x */ , const State & /* y */ , boost::false_type ) -{ - return false; -} - -struct always_resizer -{ - template< class State , class ResizeFunction > - bool adjust_size( const State &x , ResizeFunction f ) - { - return f( x ); - } -}; - - -struct initially_resizer -{ - - bool m_initialized; - - initially_resizer() : m_initialized( false ) - { } - - template< class State , class ResizeFunction > - bool adjust_size( const State &x , ResizeFunction f ) - { - if( !m_initialized ) - { - m_initialized = true; - return f( x ); - } else - return false; - } -}; - - -struct never_resizer -{ - template< class State , class ResizeFunction > - bool adjust_size( const State &x , ResizeFunction f ) - { - return false; - } -}; - - -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/same_instance.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/same_instance.hpp deleted file mode 100644 index 0d47b79ac03bc353b6a501dd3cfeae928768266d..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/same_instance.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/same_instance.hpp - - [begin_description] - Basic check if two variables are the same instance - [end_description] - - Copyright 2012 Karsten Ahnert - Copyright 2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_INSTANCE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_SAME_INSTANCE_HPP_INCLUDED - -namespace boost { -namespace numeric { -namespace odeint { - -template< class T1 , class T2 , class Enabler=void > -struct same_instance_impl -{ - static bool same_instance( const T1& /* x1 */ , const T2& /* x2 */ ) - { - return false; - } -}; - -template< class T > -struct same_instance_impl< T , T > -{ - static bool same_instance( const T &x1 , const T &x2 ) - { - // check pointers - return (&x1 == &x2); - } -}; - - -template< class T1 , class T2 > -bool same_instance( const T1 &x1 , const T2 &x2 ) -{ - return same_instance_impl< T1 , T2 >::same_instance( x1 , x2 ); -} - - -} // namespace odeint -} // namespace numeric -} // namespace boost - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/same_size.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/same_size.hpp deleted file mode 100644 index a11e30abd5bcf9a827ebd5910834b3795d25aca5..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/same_size.hpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/state_wrapper.hpp - - [begin_description] - State wrapper for the state type in all stepper. The state wrappers are responsible for construction, - destruction, copying construction, assignment and resizing. - [end_description] - - Copyright 2011-2013 Karsten Ahnert - Copyright 2011 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED - -#include <boost/numeric/odeint/util/is_resizeable.hpp> - -#include <boost/utility/enable_if.hpp> -#include <boost/fusion/include/is_sequence.hpp> -#include <boost/fusion/include/zip_view.hpp> -#include <boost/fusion/include/vector.hpp> -#include <boost/fusion/include/make_fused.hpp> -#include <boost/fusion/include/all.hpp> - -#include <boost/range.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - -template< typename State1 , typename State2 , class Enabler = void > -struct same_size_impl_sfinae -{ - static bool same_size( const State1 &x1 , const State2 &x2 ) - { - return ( boost::size( x1 ) == boost::size( x2 ) ); - } - -}; - -// same_size function -// standard implementation relies on boost.range -template< class State1 , class State2 > -struct same_size_impl -{ - static bool same_size( const State1 &x1 , const State2 &x2 ) - { - return same_size_impl_sfinae< State1 , State2 >::same_size( x1 , x2 ); - } -}; - - -// do not overload or specialize this function, specialize resize_impl<> instead -template< class State1 , class State2 > -bool same_size( const State1 &x1 , const State2 &x2 ) -{ - return same_size_impl< State1 , State2 >::same_size( x1 , x2 ); -} - -namespace detail { - -struct same_size_fusion -{ - typedef bool result_type; - - template< class S1 , class S2 > - bool operator()( const S1 &x1 , const S2 &x2 ) const - { - return same_size_op( x1 , x2 , typename is_resizeable< S1 >::type() ); - } - - template< class S1 , class S2 > - bool same_size_op( const S1 &x1 , const S2 &x2 , boost::true_type ) const - { - return same_size( x1 , x2 ); - } - - template< class S1 , class S2 > - bool same_size_op( const S1 &x1 , const S2 &x2 , boost::false_type ) const - { - return true; - } -}; - -} // namespace detail - - - -template< class FusionSeq > -struct same_size_impl_sfinae< FusionSeq , FusionSeq , typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type > -{ - static bool same_size( const FusionSeq &x1 , const FusionSeq &x2 ) - { - typedef boost::fusion::vector< const FusionSeq& , const FusionSeq& > Sequences; - Sequences sequences( x1 , x2 ); - return boost::fusion::all( boost::fusion::zip_view< Sequences >( sequences ) , - boost::fusion::make_fused( detail::same_size_fusion() ) ); - } -}; - - -} -} -} - - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/split.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/split.hpp deleted file mode 100644 index ba9875a49a0e7d9f0186f8711b28a88f285cb319..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/split.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/split.hpp - - [begin_description] - Split abstraction for parallel backends. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_SPLIT_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_SPLIT_HPP_INCLUDED - -namespace boost { -namespace numeric { -namespace odeint { - -/* - * No default implementation of the split operation - */ -template< class Container1, class Container2 , class Enabler = void > -struct split_impl -{ - static void split( const Container1 &from , Container2 &to ); -}; - -template< class Container1 , class Container2 > -void split( const Container1 &from , Container2 &to ) -{ - split_impl< Container1 , Container2 >::split( from , to ); -} - - -/* - * No default implementation of the unsplit operation - */ -template< class Container1, class Container2 , class Enabler = void > -struct unsplit_impl -{ - static void unsplit( const Container1 &from , Container2 &to ); -}; - -template< class Container1 , class Container2 > -void unsplit( const Container1 &from , Container2 &to ) -{ - unsplit_impl< Container1 , Container2 >::unsplit( from , to ); -} - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED - diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/split_adaptor.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/split_adaptor.hpp deleted file mode 100644 index cf0d6238147ada11f9a2511b4490ea0e17255bce..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/split_adaptor.hpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/split_adaptor.hpp - - [begin_description] - A range adaptor which returns even-sized slices. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - Copyright 2013 Pascal Germroth - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_SPLIT_ADAPTOR_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_SPLIT_ADAPTOR_INCLUDED - -#include <boost/range/adaptor/argument_fwd.hpp> -#include <boost/range/size_type.hpp> -#include <boost/range/iterator_range.hpp> -#include <algorithm> - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - -/** \brief Returns the begin and end offset for a sub-range */ -inline std::pair<std::size_t, std::size_t> -split_offsets( std::size_t total_length, std::size_t index, std::size_t parts ) -{ - BOOST_ASSERT( parts > 0 ); - BOOST_ASSERT( index < parts ); - const std::size_t - slice = total_length / parts, - partial = total_length % parts, - lo = (std::min)(index, partial), - hi = (std::max<std::ptrdiff_t>)(0, index - partial), - begin_offset = lo * (slice + 1) + hi * slice, - length = slice + (index < partial ? 1 : 0), - end_offset = begin_offset + length; - return std::make_pair( begin_offset, end_offset ); -} - -/** \brief Return the sub-range `index` from a range which is split into `parts`. - * - * For example, splitting a range into three about equal-sized sub-ranges: - * \code - * sub0 = make_split_range(rng, 0, 3); - * sub1 = rng | split(1, 3); - * sub2 = rng | split(2, 3); - * \endcode - */ -template< class RandomAccessRange > -inline iterator_range< typename range_iterator<RandomAccessRange>::type > -make_split_range( RandomAccessRange& rng, std::size_t index, std::size_t parts ) -{ - const std::pair<std::size_t, std::size_t> off = split_offsets(boost::size(rng), index, parts); - return make_iterator_range( boost::begin(rng) + off.first, boost::begin(rng) + off.second ); -} - -template< class RandomAccessRange > -inline iterator_range< typename range_iterator<const RandomAccessRange>::type > -make_split_range( const RandomAccessRange& rng, std::size_t index, std::size_t parts ) -{ - const std::pair<std::size_t, std::size_t> off = split_offsets(boost::size(rng), index, parts); - return make_iterator_range( boost::begin(rng) + off.first, boost::begin(rng) + off.second ); -} - - -struct split -{ - split(std::size_t index, std::size_t parts) - : index(index), parts(parts) {} - std::size_t index, parts; -}; - -template< class RandomAccessRange > -inline iterator_range< typename range_iterator<RandomAccessRange>::type > -operator|( RandomAccessRange& rng, const split& f ) -{ - return make_split_range( rng, f.index, f.parts ); -} - -template< class RandomAccessRange > -inline iterator_range< typename range_iterator<const RandomAccessRange>::type > -operator|( const RandomAccessRange& rng, const split& f ) -{ - return make_split_range( rng, f.index, f.parts ); -} - - -} -} -} -} - -#endif diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/state_wrapper.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/state_wrapper.hpp deleted file mode 100644 index 10f8ecde3123e6b3c58751619eceedd61ee19020..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/state_wrapper.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/state_wrapper.hpp - - [begin_description] - State wrapper for the state type in all stepper. The state wrappers are responsible for construction, - destruction, copying construction, assignment and resizing. - [end_description] - - Copyright 2011-2012 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_STATE_WRAPPER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_STATE_WRAPPER_HPP_INCLUDED - - -#include <boost/type_traits/integral_constant.hpp> - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/resize.hpp> -#include <boost/numeric/odeint/util/same_size.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { - - -template< class V , class Enabler = void > -struct state_wrapper -{ - typedef state_wrapper< V > state_wrapper_type; - - V m_v; -}; - - -} -} -} - - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_STATE_WRAPPER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/stepper_traits.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/stepper_traits.hpp deleted file mode 100644 index 5d1d31ae6af566da06d99b32ec885a8607e30259..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/stepper_traits.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/stepper_traits.hpp - - [begin_description] - tba. - [end_description] - - Copyright 2013 Karsten Ahnert - Copyright 2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_STEPPER_TRAITS_HPP_DEFINED -#define BOOST_NUMERIC_ODEINT_UTIL_STEPPER_TRAITS_HPP_DEFINED - -#include <boost/numeric/odeint/util/unwrap_reference.hpp> - - -namespace boost { -namespace numeric { -namespace odeint { -namespace traits { - -template< class Stepper > -struct state_type -{ - typedef typename boost::numeric::odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename stepper_type::state_type type; -}; - -template< class Stepper > -struct time_type -{ - typedef typename boost::numeric::odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename stepper_type::time_type type; -}; - -template< class Stepper > -struct stepper_category -{ - typedef typename boost::numeric::odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename stepper_type::stepper_category type; -}; - -template< class Stepper > -struct value_type -{ - typedef typename boost::numeric::odeint::unwrap_reference< Stepper >::type stepper_type; - typedef typename stepper_type::value_type type; -}; - -} // namespace traits -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_STEPPER_TRAITS_HPP_DEFINED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/ublas_matrix_expression.patch b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/ublas_matrix_expression.patch deleted file mode 100644 index 4e8ac6c96462cdd66c1e62fbab688276beeb66b0..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/ublas_matrix_expression.patch +++ /dev/null @@ -1,6 +0,0 @@ -3390,3392c3390 -< typename enable_if< is_convertible<typename E1::value_type , T2>, -< typename matrix_binary_scalar2_traits<E1, const T2, scalar_divides<typename E1::value_type, T2> >::result_type -< > ::result_type ---- -> typename matrix_binary_scalar2_traits<E1, const T2, scalar_divides<typename E1::value_type, T2> >::result_type diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/ublas_wrapper.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/ublas_wrapper.hpp deleted file mode 100644 index c8facfc46b4e8f03f4cd6ea956ca5e4dd89cdaae..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/ublas_wrapper.hpp +++ /dev/null @@ -1,297 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/ublas_wrapper.hpp - - [begin_description] - Resizing for ublas::vector and ublas::matrix - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_UBLAS_WRAPPER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_UBLAS_WRAPPER_HPP_INCLUDED - - -#include <boost/type_traits/integral_constant.hpp> -#include <boost/numeric/ublas/vector.hpp> -#include <boost/numeric/ublas/matrix.hpp> -#include <boost/numeric/ublas/lu.hpp> -#include <boost/numeric/ublas/vector_expression.hpp> -#include <boost/numeric/ublas/matrix_expression.hpp> - -#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> -#include <boost/numeric/odeint/algebra/default_operations.hpp> - -#include <boost/numeric/odeint/util/is_resizeable.hpp> -#include <boost/numeric/odeint/util/state_wrapper.hpp> - - -/* extend ublas by a few operations */ - -/* map norm_inf onto reduce( v , default_operations::maximum ) */ -namespace boost { namespace numeric { namespace odeint { - - template< typename T , typename A > - struct vector_space_norm_inf< boost::numeric::ublas::vector<T,A> > - { - typedef T result_type; - - result_type operator()( const boost::numeric::ublas::vector<T,A> &x ) const - { - return boost::numeric::ublas::norm_inf( x ); - } - }; - - - template< class T , class L , class A > - struct vector_space_norm_inf< boost::numeric::ublas::matrix<T,L,A> > - { - typedef T result_type; - - result_type operator()( const boost::numeric::ublas::matrix<T,L,A> &x ) const - { - return boost::numeric::ublas::norm_inf( x ); - } - }; -} } } - -/* additional operations: - * abs( v ) - * v / w - * a + v - */ -namespace boost { namespace numeric { namespace ublas { - - - // elementwise abs - calculates absolute values of the elements - template<class T> - struct scalar_abs: public scalar_unary_functor<T> { - typedef typename scalar_unary_functor<T>::value_type value_type; - typedef typename scalar_unary_functor<T>::argument_type argument_type; - typedef typename scalar_unary_functor<T>::result_type result_type; - - static BOOST_UBLAS_INLINE - result_type apply (argument_type t) { - using std::abs; - return abs (t); - } - }; - - - // (abs v) [i] = abs (v [i]) - template<class E> - BOOST_UBLAS_INLINE - typename vector_unary_traits<E, scalar_abs<typename E::value_type> >::result_type - abs (const vector_expression<E> &e) { - typedef typename vector_unary_traits<E, scalar_abs<typename E::value_type> >::expression_type expression_type; - return expression_type (e ()); - } - - // (abs m) [i] = abs (m [i]) - template<class E> - BOOST_UBLAS_INLINE - typename matrix_unary1_traits<E, scalar_abs<typename E::value_type> >::result_type - abs (const matrix_expression<E> &e) { - typedef typename matrix_unary1_traits<E, scalar_abs<typename E::value_type> >::expression_type expression_type; - return expression_type (e ()); - } - - - // elementwise division (v1 / v2) [i] = v1 [i] / v2 [i] - template<class E1, class E2> - BOOST_UBLAS_INLINE - typename vector_binary_traits<E1, E2, scalar_divides<typename E1::value_type, - typename E2::value_type> >::result_type - operator / (const vector_expression<E1> &e1, - const vector_expression<E2> &e2) { - typedef typename vector_binary_traits<E1, E2, scalar_divides<typename E1::value_type, - typename E2::value_type> >::expression_type expression_type; - return expression_type (e1 (), e2 ()); - } - - - // elementwise division (m1 / m2) [i] = m1 [i] / m2 [i] - template<class E1, class E2> - BOOST_UBLAS_INLINE - typename matrix_binary_traits<E1, E2, scalar_divides<typename E1::value_type, - typename E2::value_type> >::result_type - operator / (const matrix_expression<E1> &e1, - const matrix_expression<E2> &e2) { - typedef typename matrix_binary_traits<E1, E2, scalar_divides<typename E1::value_type, - typename E2::value_type> >::expression_type expression_type; - return expression_type (e1 (), e2 ()); - } - - // addition with scalar - // (t + v) [i] = t + v [i] - template<class T1, class E2> - BOOST_UBLAS_INLINE - typename enable_if< is_convertible<T1, typename E2::value_type >, - typename vector_binary_scalar1_traits<const T1, E2, scalar_plus<T1, typename E2::value_type> >::result_type - >::type - operator + (const T1 &e1, - const vector_expression<E2> &e2) { - typedef typename vector_binary_scalar1_traits<const T1, E2, scalar_plus<T1, typename E2::value_type> >::expression_type expression_type; - return expression_type (e1, e2 ()); - } - - // addition with scalar - // (t + m) [i] = t + m [i] - template<class T1, class E2> - BOOST_UBLAS_INLINE - typename enable_if< is_convertible<T1, typename E2::value_type >, - typename matrix_binary_scalar1_traits<const T1, E2, scalar_plus<T1, typename E2::value_type> >::result_type - >::type - operator + (const T1 &e1, - const matrix_expression<E2> &e2) { - typedef typename matrix_binary_scalar1_traits<const T1, E2, scalar_plus<T1, typename E2::value_type> >::expression_type expression_type; - return expression_type (e1, e2 ()); - } - -} } } - - - - -/* add resize functionality */ -namespace boost { -namespace numeric { -namespace odeint { - -/* - * resizeable specialization for boost::numeric::ublas::vector - */ -template< class T , class A > -struct is_resizeable< boost::numeric::ublas::vector< T , A > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - - -/* - * resizeable specialization for boost::numeric::ublas::matrix - */ -template< class T , class L , class A > -struct is_resizeable< boost::numeric::ublas::matrix< T , L , A > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - - -/* - * resizeable specialization for boost::numeric::ublas::permutation_matrix - */ -template< class T , class A > -struct is_resizeable< boost::numeric::ublas::permutation_matrix< T , A > > -{ - typedef boost::true_type type; - const static bool value = type::value; -}; - - -// specialization for ublas::matrix -// same size and resize specialization for matrix-matrix resizing -template< class T , class L , class A , class T2 , class L2 , class A2 > -struct same_size_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::matrix< T2 , L2 , A2 > > -{ - static bool same_size( const boost::numeric::ublas::matrix< T , L , A > &m1 , - const boost::numeric::ublas::matrix< T2 , L2 , A2 > &m2 ) - { - return ( ( m1.size1() == m2.size1() ) && ( m1.size2() == m2.size2() ) ); - } -}; - -template< class T , class L , class A , class T2 , class L2 , class A2 > -struct resize_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::matrix< T2 , L2 , A2 > > -{ - static void resize( boost::numeric::ublas::matrix< T , L , A > &m1 , - const boost::numeric::ublas::matrix< T2 , L2 , A2 > &m2 ) - { - m1.resize( m2.size1() , m2.size2() ); - } -}; - - - -// same size and resize specialization for matrix-vector resizing -template< class T , class L , class A , class T_V , class A_V > -struct same_size_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::vector< T_V , A_V > > -{ - static bool same_size( const boost::numeric::ublas::matrix< T , L , A > &m , - const boost::numeric::ublas::vector< T_V , A_V > &v ) - { - return ( ( m.size1() == v.size() ) && ( m.size2() == v.size() ) ); - } -}; - -template< class T , class L , class A , class T_V , class A_V > -struct resize_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::vector< T_V , A_V > > -{ - static void resize( boost::numeric::ublas::matrix< T , L , A > &m , - const boost::numeric::ublas::vector< T_V , A_V > &v ) - { - m.resize( v.size() , v.size() ); - } -}; - - - -// specialization for ublas::permutation_matrix -// same size and resize specialization for matrix-vector resizing -template< class T , class A , class T_V , class A_V > -struct same_size_impl< boost::numeric::ublas::permutation_matrix< T , A > , - boost::numeric::ublas::vector< T_V , A_V > > -{ - static bool same_size( const boost::numeric::ublas::permutation_matrix< T , A > &m , - const boost::numeric::ublas::vector< T_V , A_V > &v ) - { - return ( m.size() == v.size() ); // && ( m.size2() == v.size() ) ); - } -}; - -template< class T , class A , class T_V , class A_V > -struct resize_impl< boost::numeric::ublas::vector< T_V , A_V > , - boost::numeric::ublas::permutation_matrix< T , A > > -{ - static void resize( const boost::numeric::ublas::vector< T_V , A_V > &v, - boost::numeric::ublas::permutation_matrix< T , A > &m ) - { - m.resize( v.size() , v.size() ); - } -}; - - - - - - - -template< class T , class A > -struct state_wrapper< boost::numeric::ublas::permutation_matrix< T , A > > // with resizing -{ - typedef boost::numeric::ublas::permutation_matrix< T , A > state_type; - typedef state_wrapper< state_type > state_wrapper_type; - - state_type m_v; - - state_wrapper() : m_v( 1 ) // permutation matrix constructor requires a size, choose 1 as default - { } - -}; - - - - -} } } - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_UBLAS_WRAPPER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/unit_helper.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/unit_helper.hpp deleted file mode 100644 index 2e6a38c5c040f0e72d06b2d2d7daabf6d22ee030..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/unit_helper.hpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/unit_helper.hpp - - [begin_description] - Get and set the value of a unit. - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2012-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED - - -#ifndef __CUDACC__ -#include <boost/units/quantity.hpp> -#include <boost/units/get_dimension.hpp> -#include <boost/units/get_system.hpp> -#endif - - - -namespace boost { -namespace numeric { -namespace odeint { - - -namespace detail { - - template<class T , class Enabler = void > - struct get_unit_value_impl - { - static T value(const T &t) - { - return t; - } - typedef T result_type; - }; - -#ifndef __CUDACC__ - template<class Unit , class T> - struct get_unit_value_impl< boost::units::quantity< Unit , T> > - { - static T value( const boost::units::quantity< Unit , T> &t ) - { - return t.value(); - } - typedef T result_type; - }; -#endif - - - - - - template<class T , class V , class Enabler = void > - struct set_unit_value_impl - { - static void set_value(T &t , const V &v) - { - t = v; - } - }; - -#ifndef __CUDACC__ - template<class Unit , class T , class V> - struct set_unit_value_impl<boost::units::quantity<Unit , T> , V> - { - static void set_value(boost::units::quantity<Unit , T> &t , const V &v) - { - t = boost::units::quantity<Unit , T>::from_value(v); - } - }; -#endif - - - -} // namespace detail - - - template<class T> - typename detail::get_unit_value_impl<T>::result_type get_unit_value(const T &t) - { - return detail::get_unit_value_impl<T>::value(t); - } - - - template<class T , class V> - void set_unit_value(T &t , const V &v) - { - return detail::set_unit_value_impl<T , V>::set_value(t , v); - } - - - - template< class T > - struct unit_value_type - { - typedef T type; - }; - -#ifndef __CUDACC__ - template< class Unit , class Y > - struct unit_value_type< boost::units::quantity< Unit , Y > > - { - typedef Y type; - }; -#endif - - - - - - - - - - - template< typename Time > - struct inverse_time - { - typedef Time type; - }; - -#ifndef __CUDACC__ - template< typename Unit , typename Value > - struct inverse_time< boost::units::quantity< Unit , Value > > - { - typedef boost::units::quantity< Unit , Value > time_type; - typedef typename boost::units::get_dimension< time_type >::type dimension; - typedef typename boost::units::get_system< time_type >::type system; - typedef typename boost::mpl::divides< boost::units::dimensionless_type , dimension >::type inv_dimension; - typedef boost::units::unit< inv_dimension , system > inv_unit; - typedef boost::units::quantity< inv_unit , Value > type; - }; -#endif - - -} // namespace odeint -} // namespace numeric -} // namespace boost - - -#endif // BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/unwrap_reference.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/unwrap_reference.hpp deleted file mode 100644 index be93dc0ed2505eb176b5b26c4eb48d1161f07732..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/util/unwrap_reference.hpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/util/unwrap_reference.hpp - - [begin_description] - unwrap_reference - [end_description] - - Copyright 2012-2013 Karsten Ahnert - Copyright 2012-2013 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - - -#ifndef BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED - - -#include <boost/numeric/odeint/config.hpp> - - -#if BOOST_NUMERIC_ODEINT_CXX11 -#include <functional> -#else -#include <boost/ref.hpp> -#endif - -namespace boost { - -#if BOOST_NUMERIC_ODEINT_CXX11 -template<typename T> struct reference_wrapper; - -template<typename T> struct unwrap_reference; -#endif - -namespace numeric { -namespace odeint { - - -#if BOOST_NUMERIC_ODEINT_CXX11 - -template<typename T> -struct unwrap_reference -{ - typedef typename std::remove_reference<T>::type type; -}; - -template<typename T> -struct unwrap_reference< std::reference_wrapper<T> > -{ - typedef typename std::remove_reference<T>::type type; -}; - -template<typename T> -struct unwrap_reference< boost::reference_wrapper<T> > -{ - typedef typename boost::unwrap_reference<T>::type type; -}; - -#else - -using ::boost::unwrap_reference; - -#endif - -namespace detail -{ - -#if BOOST_NUMERIC_ODEINT_CXX11 - -using ::std::ref; - -#else - -using ::boost::ref; - -#endif -} - -} -} -} - - - -/* - * - * the following is the suggested way, but unfortunately it does not work with all compilers. - */ - -/* - -#include <boost/config.hpp> - - -#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL -#include <boost/ref.hpp> -#else -#include <functional> -#endif - - - -namespace boost { -namespace numeric { -namespace odeint { - - -#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL - -template<typename T> -struct unwrap_reference -{ - typedef typename std::remove_reference<T>::type type; -}; - -template<typename T> -struct unwrap_reference< std::reference_wrapper<T> > -{ - typedef typename std::remove_reference<T>::type type; -}; - -template<typename T> -struct unwrap_reference< boost::reference_wrapper<T> > -{ - typedef typename boost::unwrap_reference<T>::type type; -}; - -#else - -using ::boost::unwrap_reference; - -#endif - -} -} -} - -namespace boost { -namespace numeric { -namespace odeint { -namespace detail { - - -#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL - -using ::std::ref; - -#else - -using ::boost::ref; - -#endif - - -} -} -} -} - -*/ - -#endif // BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED diff --git a/moose-core/external/odeint-v2/include/boost/numeric/odeint/version.hpp b/moose-core/external/odeint-v2/include/boost/numeric/odeint/version.hpp deleted file mode 100644 index 379c9065992b39d3754d27add9d78bc4d6516c9f..0000000000000000000000000000000000000000 --- a/moose-core/external/odeint-v2/include/boost/numeric/odeint/version.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - [auto_generated] - boost/numeric/odeint/version.hpp - - [begin_description] - Defines the current version of odeint. - [end_description] - - Copyright 2011-2012 Karsten Ahnert - Copyright 2011-2012 Mario Mulansky - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NUMERIC_ODEINT_VERSION_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_VERSION_HPP_INCLUDED - -#include <string> -#include <sstream> - - -#define ODEINT_MAJOR_VERSION 2 -#define ODEINT_MINOR_VERSION 2 -#define ODEINT_PATCH_LEVEL 0 -#define ODEINT_VERSION ( ODEINT_MAJOR_VERSION * 100000 + ODEINT_MINOR_VERSION * 100 + ODEINT_PATCH_LEVEL ) - - -namespace boost { -namespace numeric { -namespace odeint { - -namespace version { - -const int major = ODEINT_MAJOR_VERSION ; -const int minor = ODEINT_MINOR_VERSION ; -const int patch_level = ODEINT_PATCH_LEVEL ; - -} - -inline std::string get_version_string( void ) -{ - std::ostringstream str; - str << "v" << version::major << "." << version::minor; - if( version::patch_level != 0 ) str << "_" << version::patch_level; - return str.str(); -} - - -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_VERSION_HPP_INCLUDED diff --git a/moose-core/hsolve/HSolve.cpp b/moose-core/hsolve/HSolve.cpp index 5d04a7775fc8d7eff00e38d0f20f411f32a6f2fc..b9151d9820809d03b2695a29be6274539e9d9785 100644 --- a/moose-core/hsolve/HSolve.cpp +++ b/moose-core/hsolve/HSolve.cpp @@ -304,7 +304,6 @@ void HSolve::setSeed( Id seed ) << "' is not derived from type 'Compartment'." << endl; return; } - seed_ = seed; } diff --git a/moose-core/hsolve/HSolveActive.cpp b/moose-core/hsolve/HSolveActive.cpp index ecb48c4baac39b1c5322a74080d0af635cbbefd6..e2ddd770f094b36aca42ae5c8abde456d4f6fe2f 100644 --- a/moose-core/hsolve/HSolveActive.cpp +++ b/moose-core/hsolve/HSolveActive.cpp @@ -59,11 +59,9 @@ void HSolveActive::step( ProcPtr info ) HSolvePassive::backwardSubstitute(); advanceCalcium(); advanceSynChans( info ); - sendValues( info ); sendSpikes( info ); - - prevExtCurr_ = externalCurrent_; + prevExtCurr_ = externalCurrent_; externalCurrent_.assign( externalCurrent_.size(), 0.0 ); } diff --git a/moose-core/hsolve/ZombieCompartment.h b/moose-core/hsolve/ZombieCompartment.h index e4ef5ca4ccdcb03f4fdfb6ca14a7258be7d6134f..dd8472681d84e9826499a87c4e8b763e903a1612 100644 --- a/moose-core/hsolve/ZombieCompartment.h +++ b/moose-core/hsolve/ZombieCompartment.h @@ -144,7 +144,7 @@ private: void copyFields( moose::Compartment* c ); - moose::RNG<double> rng; + moose::RNG rng; }; diff --git a/moose-core/ksolve/CMakeLists.txt b/moose-core/ksolve/CMakeLists.txt index f5124aab4ce889bb72bd829c759c7b33d6248af8..8dd567a73b87e89867f0300aa524b9edcf3b5a88 100644 --- a/moose-core/ksolve/CMakeLists.txt +++ b/moose-core/ksolve/CMakeLists.txt @@ -3,26 +3,17 @@ include(CheckIncludeFileCXX) include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) if(WITH_BOOST) - find_package(Boost REQUIRED COMPONENTS thread) + find_package(Boost 1.53 REQUIRED COMPONENTS thread) add_definitions( -DUSE_BOOST_ASYNC ) - if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - add_definitions( -UBOOST_UBLAS_TYPE_CHECK ) - else() - add_definitions( -DBOOST_UBLAS_TYPE_CHECK ) - endif() set(WITH_BOOST_ODE ON) include_directories( ${Boost_INCLUDE_DIRS} ) + # This is still not part of official bindings. + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/boost-numeric-bindings) endif() IF(WITH_BOOST_ODE) - check_include_file_cxx( ${Boost_INCLUDE_DIRS}/boost/numeric/odeint.hpp - ODEINT_EXISTS) - # If boost distribution does not have its own odeint library, use the - # private one. - if(NOT ODEINT_EXISTS) - include_directories( ../external/odeint-v2/include ) - endif(NOT ODEINT_EXISTS) - include_directories( ../external/boost-numeric-bindings ) + include_directories(${Boost_INCLUDE_DIRS}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/boost-numeric-bindings) elseif(WITH_GSL) include_directories( ${GSL_INCLUDE_DIRS} ) endif(WITH_BOOST_ODE) diff --git a/moose-core/ksolve/FuncTerm.cpp b/moose-core/ksolve/FuncTerm.cpp index c8690071379ac127444a64d4dd7064af889959f7..527744f7055116f16e3f0cdb768f133389284da6 100644 --- a/moose-core/ksolve/FuncTerm.cpp +++ b/moose-core/ksolve/FuncTerm.cpp @@ -23,7 +23,6 @@ #include <sstream> using namespace std; -#include "../external/muparser/include/muParser.h" #include "FuncTerm.h" #include "../utility/numutil.h" diff --git a/moose-core/ksolve/FuncTerm.h b/moose-core/ksolve/FuncTerm.h index fe735278adad1f6ba3c1feec04023df5fa313ec7..71bf2de7255580fe3967e309b5f9bcdc42cdb176 100644 --- a/moose-core/ksolve/FuncTerm.h +++ b/moose-core/ksolve/FuncTerm.h @@ -10,7 +10,7 @@ #ifndef _FUNC_TERM_H #define _FUNC_TERM_H -#include "../external/muparser/include/muParser.h" +#include "../builtins/MooseParser.h" class FuncTerm { @@ -44,7 +44,7 @@ class FuncTerm double* args_; // Look up reactants in the S vec. vector< unsigned int > reactantIndex_; - mu::Parser parser_; + MooseParser parser_; string expr_; /** * Scale factor to account for pool volume if we are assigning conc @@ -53,6 +53,7 @@ class FuncTerm */ double volScale_; unsigned int target_; /// Index of the entity to be updated by Func + }; #endif // _FUNC_TERM_H diff --git a/moose-core/ksolve/Gsolve.cpp b/moose-core/ksolve/Gsolve.cpp index 332005a696dbabebf08f98d0a60b46c62548450a..4b31deec508dfde94aabb6b3e5c0dd55d481e9d7 100644 --- a/moose-core/ksolve/Gsolve.cpp +++ b/moose-core/ksolve/Gsolve.cpp @@ -10,6 +10,7 @@ #include "../basecode/global.h" #include "../mesh/VoxelJunction.h" +#include "../utility/print_function.hpp" #include "VoxelPoolsBase.h" #include "XferInfo.h" @@ -42,6 +43,14 @@ #define SIMPLE_ROUNDING 0 +// When set use std::async rather than std::thread +// TODO: Profiling. +#define USING_ASYNC 1 + +#if USING_ASYNC +#define THREAD_LAUNCH_POLICY std::launch::async +#endif + const unsigned int OFFNODE = ~0; const Cinfo* Gsolve::initCinfo() @@ -138,10 +147,7 @@ const Cinfo* Gsolve::initCinfo() &Gsolve::getNumFire ); - /////////////////////////////////////////////////////// // DestFinfo definitions - /////////////////////////////////////////////////////// - static DestFinfo process( "process", "Handles process call", new ProcOpFunc< Gsolve >( &Gsolve::process ) ); @@ -163,13 +169,12 @@ const Cinfo* Gsolve::initCinfo() "Handles initReinit call from Clock", new ProcOpFunc< Gsolve >( &Gsolve::initReinit ) ); - /////////////////////////////////////////////////////// // Shared definitions - /////////////////////////////////////////////////////// static Finfo* procShared[] = { &process, &reinit }; + static SharedFinfo proc( "proc", "Shared message for process and reinit", procShared, sizeof( procShared ) / sizeof( const Finfo* ) @@ -227,10 +232,11 @@ Gsolve::Gsolve() : pools_( 1 ), startVoxel_( 0 ), dsolve_(), - dsolvePtr_( 0 ), + dsolvePtr_(nullptr), useClockedUpdate_( false ) { - ; + // Initialize with global seed. + rng_.setSeed(moose::getGlobalSeed()); } Gsolve& Gsolve::operator=(const Gsolve& ) @@ -257,8 +263,7 @@ void Gsolve::setCompartment( Id compt ) if ( ( compt.element()->cinfo()->isA( "ChemCompt" ) ) ) { compartment_ = compt; - vector< double > vols = - Field< vector< double > >::get( compt, "voxelVolume" ); + vector< double > vols = Field< vector< double > >::get( compt, "voxelVolume" ); if ( vols.size() > 0 ) { pools_.resize( vols.size() ); @@ -336,7 +341,7 @@ void Gsolve::setNvec( unsigned int voxel, vector< double > nVec ) double* s = pools_[voxel].varS(); for ( unsigned int i = 0; i < nVec.size(); ++i ) { - s[i] = round( nVec[i] ); + s[i] = std::round( nVec[i] ); if ( s[i] < 0.0 ) s[i] = 0.0; } @@ -402,45 +407,25 @@ void Gsolve::process( const Eref& e, ProcPtr p ) // one would use a stochastic (integral) diffusion method with // the GSSA, but in mixed models it may be more complicated. vector< double >::iterator i = dvalues.begin() + 4; - for ( ; i != dvalues.end(); ++i ) { - // cout << *i << " " << round( *i ) << " "; #if SIMPLE_ROUNDING - *i = round( *i ); + *i = std::round( *i ); #else - double base = floor( *i ); - - // Use global RNG. - if ( moose::mtrand() >= (*i - base) ) - *i = base; - else - *i = base + 1.0; + // *i = approximateWithInteger_debug(__FUNCTION__, *i, rng_); + *i = approximateWithInteger(*i, rng_); #endif } setBlock( dvalues ); } - // Third: Fix the rates if we have had any diffusion or xreacs - // happening. This is very inefficient at this point, need to fix. if ( dsolvePtr_ ) { for ( auto i = pools_.begin(); i != pools_.end(); ++i ) i->refreshAtot( &sys_ ); } - // Fourth, update the mol #s. - // First we advance the simulation. - size_t nvPools = pools_.size( ); - - // Third, do the numerical integration for all reactions. - size_t grainSize = max( (size_t)1, min( nvPools, nvPools / numThreads_)); - - // Make sure that we cover all the pools. - while( (numThreads_ * grainSize) < nvPools ) - grainSize += 1; - - if( 1 == numThreads_ || 1 == nvPools ) + if( 1 == numThreads_ || 1 == pools_.size()) { if( numThreads_ > 1 ) { @@ -448,7 +433,7 @@ void Gsolve::process( const Eref& e, ProcPtr p ) numThreads_ = 1; } - for ( size_t i = 0; i < nvPools; i++ ) + for ( size_t i = 0; i < pools_.size(); i++ ) pools_[i].advance( p, &sys_ ); } else @@ -457,20 +442,36 @@ void Gsolve::process( const Eref& e, ProcPtr p ) * Somewhat complicated computation to compute the number of threads. 1 * thread per (at least) voxel pool is ideal situation. *-----------------------------------------------------------------------------*/ +#if USING_ASYNC + vector<std::future<size_t>> vecFutures; + for (size_t i = 0; i < numThreads_; i++) + vecFutures.push_back( + std::async( THREAD_LAUNCH_POLICY + , [this, i, p](){ + return this->advance_chunk(i*this->grainSize_, (i+1)*this->grainSize_, p); + }) + ); + // Block in same order + size_t tot = 0; + for (auto& fut : vecFutures) tot += fut.get(); + // We have processed all the pools. + assert( tot >= pools_.size() ); +#else vector<std::thread> vecThreads; - for (size_t i = 0; i < numThreads_; i++) { // Use lambda. It is roughly 10% faster than std::bind and does not // involve copying data. - std::thread t( - [this, i, grainSize, p](){ this->advance_chunk(i*grainSize, (i+1)*grainSize, p); } - ); - vecThreads.push_back( std::move(t) ); + vecThreads.push_back( + std::thread( + [this, i, p](){ this->advance_chunk(i*this->grainSize_, (i+1)*this->grainSize_, p); } + ) + ); } for( auto &v : vecThreads ) v.join(); +#endif } @@ -483,20 +484,38 @@ void Gsolve::process( const Eref& e, ProcPtr p ) } else { +#if USING_ASYNC + vector<std::future<size_t>> vecFutures; + for (size_t i = 0; i < numThreads_; i++) + vecFutures.push_back( + std::async( THREAD_LAUNCH_POLICY + , [this, i, p](){ + return this->recalcTimeChunk(i*this->grainSize_, (i+1)*this->grainSize_, p); + }) + ); + // Block in same order + size_t tot = 0; + for (auto& fut : vecFutures) tot += fut.get(); + assert( tot >= pools_.size() ); // We have processed all the pools. +#else vector<std::thread> vecThreads; for (size_t i = 0; i < numThreads_; i++) { // Use lambda. It is roughly 10% faster than std::bind and does not // involve copying data. - std::thread t( - [this, i, grainSize, p](){ this->recalcTimeChunk(i*grainSize, (i+1)*grainSize, p); } - ); - vecThreads.push_back( std::move(t) ); + vecThreads.push_back( + std::thread( + [this, i, p](){ + this->recalcTimeChunk(i*this->grainSize_, (i+1)*this->grainSize_, p); + } + ) + ); } - for( auto &v : vecThreads ) v.join(); +#endif + } } @@ -518,38 +537,54 @@ void Gsolve::process( const Eref& e, ProcPtr p ) } } -void Gsolve::recalcTimeChunk( const size_t begin, const size_t end, ProcPtr p) +size_t Gsolve::recalcTimeChunk( const size_t begin, const size_t end, ProcPtr p) { - for (size_t i = begin; i < std::min(pools_.size(), end); i++) + assert( begin >= std::min(pools_.size(), end)); + + size_t tot = 0; + for (size_t i = begin; i < std::min(pools_.size(), end); i++) { + tot += 1; pools_[i].recalcTime( &sys_, p->currTime ); + } + return tot; } -void Gsolve::advance_chunk( const size_t begin, const size_t end, ProcPtr p ) +size_t Gsolve::advance_chunk( const size_t begin, const size_t end, ProcPtr p ) { + assert( begin <= std::min(end, pools_.size()) ); + size_t tot = 0; for (size_t i = begin; i < std::min(end, pools_.size() ); i++) + { pools_[i].advance( p, &sys_ ); + tot += 1; + } + return tot; } void Gsolve::reinit( const Eref& e, ProcPtr p ) { if ( !stoichPtr_ ) return; + if ( !sys_.isReady ) rebuildGssaSystem(); + // First reinit concs. - for ( vector< GssaVoxelPools >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) - { + for (auto i = pools_.begin(); i != pools_.end(); ++i ) i->reinit( &sys_ ); - } + // Second, update the atots. - for ( vector< GssaVoxelPools >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) - { + for ( auto i = pools_.begin(); i != pools_.end(); ++i ) i->refreshAtot( &sys_ ); - } - if( 1 < getNumThreads( ) ) + // LoadBalancing. Recompute the optimal number of threads. + size_t nvPools = pools_.size( ); + grainSize_ = (size_t) std::ceil((double)nvPools / (double)numThreads_); + assert( grainSize_ * numThreads_ >= nvPools); + numThreads_ = nvPools / grainSize_; + MOOSE_DEBUG( "Grain size is " << grainSize_ << ". Num threads " << numThreads_); + + if(1 < getNumThreads()) cout << "Info: Setting up threaded gsolve with " << getNumThreads( ) << " threads. " << endl; } @@ -564,10 +599,9 @@ void Gsolve::initReinit( const Eref& e, ProcPtr p ) { if ( !stoichPtr_ ) return; - for ( unsigned int i = 0 ; i < pools_.size(); ++i ) - { + + for( size_t i = 0 ; i < pools_.size(); ++i ) pools_[i].reinit( &sys_ ); - } } ////////////////////////////////////////////////////////////// // Solver setup @@ -858,11 +892,8 @@ void Gsolve::makeReacDepsUnique() vector< unsigned int >::iterator k = dep.begin(); /// STL stuff follows, with the usual weirdness. - vector< unsigned int >::iterator pos = - unique( dep.begin(), dep.end() ); + vector<unsigned int>::iterator pos = unique( dep.begin(), dep.end() ); dep.resize( pos - dep.begin() ); - /* - */ } } @@ -877,7 +908,7 @@ unsigned int Gsolve::getPoolIndex( const Eref& e ) const unsigned int Gsolve::getVoxelIndex( const Eref& e ) const { unsigned int ret = e.dataIndex(); - if ( ret < startVoxel_ || ret >= startVoxel_ + pools_.size() ) + if ( (ret < startVoxel_) || (ret >= startVoxel_ + pools_.size())) return OFFNODE; return ret - startVoxel_; } @@ -892,8 +923,7 @@ void Gsolve::setDsolve( Id dsolve ) else if ( dsolve.element()->cinfo()->isA( "Dsolve" ) ) { dsolve_ = dsolve; - dsolvePtr_ = reinterpret_cast< ZombiePoolInterface* >( - dsolve.eref().data() ); + dsolvePtr_ = reinterpret_cast<ZombiePoolInterface*>(dsolve.eref().data()); } else { @@ -923,7 +953,7 @@ void Gsolve::setN( const Eref& e, double v ) } else { - pools_[vox].setN( getPoolIndex( e ), round( v ) ); + pools_[vox].setN( getPoolIndex( e ), std::round( v ) ); } } } diff --git a/moose-core/ksolve/Gsolve.h b/moose-core/ksolve/Gsolve.h index 7eb1275c3bf6d01b79d0c5295fc46fca8d2d9696..594b560751e4f6e11e7cdb257eaebffae92c10ed 100644 --- a/moose-core/ksolve/Gsolve.h +++ b/moose-core/ksolve/Gsolve.h @@ -10,7 +10,10 @@ #ifndef _GSOLVE_H #define _GSOLVE_H +#include "../randnum/RNG.h" + class Stoich; + class Gsolve: public ZombiePoolInterface { public: @@ -30,6 +33,7 @@ public: unsigned int getNumLocalVoxels() const; unsigned int getNumAllVoxels() const; + /** * Assigns the number of voxels used in the entire reac-diff * system. Note that fewer than this may be used on any given node. @@ -70,8 +74,7 @@ public: void fillMmEnzDep(); void fillPoolFuncDep(); void fillIncrementFuncDep(); - void insertMathDepReacs( unsigned int mathDepIndex, - unsigned int firedReac ); + void insertMathDepReacs(unsigned int mathDepIndex, unsigned int firedReac); void makeReacDepsUnique(); ////////////////////////////////////////////////////////////////// @@ -109,8 +112,8 @@ public: void updateRateTerms( unsigned int index ); // Function for multithreading. - void advance_chunk( const size_t begin, const size_t end, ProcPtr p ); - void recalcTimeChunk( const size_t begin, const size_t end, ProcPtr p); + size_t advance_chunk( const size_t begin, const size_t end, ProcPtr p ); + size_t recalcTimeChunk( const size_t begin, const size_t end, ProcPtr p); ////////////////////////////////////////////////////////////////// /// Flag: returns true if randomized round to integers is done. @@ -134,9 +137,13 @@ private: * @brief Number of threads to use when parallel version of Gsolve is * used. */ - unsigned int numThreads_; + size_t numThreads_; + size_t grainSize_; GssaSystem sys_; + + moose::RNG rng_; + /** * Each VoxelPools entry handles all the pools in a single voxel. * Each entry knows how to update itself in order to complete diff --git a/moose-core/ksolve/GssaVoxelPools.cpp b/moose-core/ksolve/GssaVoxelPools.cpp index a12d693e86eb89ca71a496d4629075ea3fb04b76..85c4b6b3278e66db8f76eafce18cbb549484550a 100644 --- a/moose-core/ksolve/GssaVoxelPools.cpp +++ b/moose-core/ksolve/GssaVoxelPools.cpp @@ -39,13 +39,10 @@ */ const double SAFETY_FACTOR = 1.0 + 1.0e-9; -////////////////////////////////////////////////////////////// -// Class definitions -////////////////////////////////////////////////////////////// -GssaVoxelPools::GssaVoxelPools() : - VoxelPoolsBase(), t_( 0.0 ), atot_( 0.0 ) -{ ; } +// Class definitions +GssaVoxelPools::GssaVoxelPools(): VoxelPoolsBase(), t_( 0.0 ), atot_( 0.0 ) +{;} GssaVoxelPools::~GssaVoxelPools() { @@ -88,15 +85,14 @@ void GssaVoxelPools::updateDependentMathExpn( void GssaVoxelPools::updateDependentRates( const vector< unsigned int >& deps, const Stoich* stoich ) { - for ( vector< unsigned int >::const_iterator - i = deps.begin(); i != deps.end(); ++i ) + for ( auto i = deps.cbegin(); i != deps.end(); ++i ) { atot_ -= fabs( v_[ *i ] ); - // atot_ += ( v[ *i ] = ( *rates_[ *i ] )( S() ); atot_ += fabs( v_[ *i ] = getReacVelocity( *i, S() ) ); } } + unsigned int GssaVoxelPools::pickReac() { double r = rng_.uniform( ) * atot_; @@ -108,8 +104,7 @@ unsigned int GssaVoxelPools::pickReac() // of overhead in managing the tree. // Slepoy, Thompson and Plimpton 2008 // report a linear time version. - for ( vector< double >::const_iterator - i = v_.begin(); i != v_.end(); ++i ) + for ( auto i = v_.cbegin(); i != v_.end(); ++i ) { if ( r < ( sum += fabs( *i ) ) ) { @@ -138,15 +133,14 @@ bool GssaVoxelPools::refreshAtot( const GssaSystem* g ) g->stoich->updateFuncs( varS(), t_ ); updateReacVelocities( g, S(), v_ ); atot_ = 0; - for ( vector< double >::const_iterator - i = v_.begin(); i != v_.end(); ++i ) + for ( auto i = v_.cbegin(); i != v_.cend(); ++i ) atot_ += fabs(*i); + atot_ *= SAFETY_FACTOR; + // Check if the system is in a stuck state. If so, terminate. if ( atot_ <= 0.0 ) - { return false; - } return true; } @@ -175,7 +169,6 @@ void GssaVoxelPools::advance( const ProcInfo* p, const GssaSystem* g ) { t_ = nextt; g->stoich->updateFuncs( varS(), t_ ); - // updateDependentMathExpn( g, 0, t_ ); return; } unsigned int rindex = pickReac(); @@ -188,7 +181,6 @@ void GssaVoxelPools::advance( const ProcInfo* p, const GssaSystem* g ) { t_ = nextt; g->stoich->updateFuncs( varS(), t_ ); - // updateDependentMathExpn( g, 0, t_ ); return; } // We had a roundoff error, fixed it, but now need to be sure @@ -210,68 +202,49 @@ void GssaVoxelPools::advance( const ProcInfo* p, const GssaSystem* g ) numFire_[rindex]++; double r = rng_.uniform(); - while ( r <= 0.0 ) r = rng_.uniform(); t_ -= ( 1.0 / atot_ ) * log( r ); g->stoich->updateFuncs( varS(), t_ ); - // updateDependentMathExpn( g, rindex, t_ ); updateDependentRates( g->dependency[ rindex ], g->stoich ); } } void GssaVoxelPools::reinit( const GssaSystem* g ) { - rng_.setSeed( moose::__rng_seed__ ); + rng_.setSeed( moose::getGlobalSeed() ); VoxelPoolsBase::reinit(); // Assigns S = Sinit; unsigned int numVarPools = g->stoich->getNumVarPools(); g->stoich->updateFuncs( varS(), 0 ); double* n = varS(); - double totalN = 0; + double error = 0.0; + double _prev = 0.0; if( g->useRandInit ) { - vector<double> error(numVarPools, 0.0); map<double, vector<Eref>> groupByVal; - for ( unsigned int i = 0; i < numVarPools; ++i ) { - error[i] = n[i]; - double base = std::floor( n[i] ); - assert( base >= 0.0 ); - totalN += n[i]; - double frac = n[i] - base; - if ( rng_.uniform() >= frac ) - n[i] = base; - else - n[i] = base + 1.0; - - error[i] -= n[i]; + _prev = n[i]; + n[i] = approximateWithInteger(_prev, rng_); + error += (_prev - n[i]); } - double extra = std::accumulate( error.begin(), error.end(), 0.0 ); - // Show warning to user if extra molecules in the system after // converting flots to integer is larger 1%. - if( std::abs(extra) / totalN > 0.01 ) + if( std::abs(error) >= 1.0 ) { - cout << "Warn: Extra " << extra - << " molecules in system after converting fractional to integer e.g. 1.1 becomes " - " 1 roughly 90% of times or 2 roughly 10% of times." - << endl; + MOOSE_WARN( "Extra " << error + << " molecules in system after converting fractional to integer." + ); } } else // Just round to the nearest int. { for ( unsigned int i = 0; i < numVarPools; ++i ) - { - // Just like rint but does not raise exception. - // See http://en.cppreference.com/w/cpp/numeric/math/nearbyint for - // details. - n[i] = std::nearbyint(n[i]); - } + n[i] = std::round(n[i]); } t_ = 0.0; @@ -347,10 +320,7 @@ double GssaVoxelPools::getReacVelocity( unsigned int r, const double* s ) const { double v = rates_[r]->operator()( s ); - // assert( v >= 0.0 ); return v; - - // return rates_[r]->operator()( s ); } void GssaVoxelPools::setStoich( const Stoich* stoichPtr ) @@ -362,47 +332,25 @@ void GssaVoxelPools::setStoich( const Stoich* stoichPtr ) void GssaVoxelPools::setVolumeAndDependencies( double vol ) { VoxelPoolsBase::setVolumeAndDependencies( vol ); - updateAllRateTerms( stoichPtr_->getRateTerms(), - stoichPtr_->getNumCoreRates() ); + updateAllRateTerms(stoichPtr_->getRateTerms(), stoichPtr_->getNumCoreRates()); } -////////////////////////////////////////////////////////////// // Handle cross compartment reactions -////////////////////////////////////////////////////////////// - -/* - * Not sure if we need it. Hold off for now. -static double integralTransfer( double propensity ) -{ - double t= floor( propensity ); - if ( rng_.uniform() < propensity - t ) - return t + 1; - return t; -} -*/ - -void GssaVoxelPools::xferIn( XferInfo& xf, - unsigned int voxelIndex, const GssaSystem* g ) +void GssaVoxelPools::xferIn( XferInfo& xf, unsigned int voxelIndex, const GssaSystem* g ) { unsigned int offset = voxelIndex * xf.xferPoolIdx.size(); - vector< double >::const_iterator i = xf.values.begin() + offset; - vector< double >::const_iterator j = xf.lastValues.begin() + offset; - vector< double >::iterator m = xf.subzero.begin() + offset; + auto i = xf.values.cbegin() + offset; + auto j = xf.lastValues.cbegin() + offset; + auto m = xf.subzero.begin() + offset; double* s = varS(); - bool hasChanged = false; - for ( vector< unsigned int >::const_iterator - k = xf.xferPoolIdx.begin(); k != xf.xferPoolIdx.end(); ++k ) + + for ( auto k = xf.xferPoolIdx.cbegin(); k != xf.xferPoolIdx.end(); ++k ) { double& x = s[*k]; - // cout << x << " i = " << *i << *j << " m = " << *m << endl; double dx = *i++ - *j++; - double base = floor( dx ); - if ( rng_.uniform() >= (dx - base) ) - x += base; - else - x += base + 1.0; + // x += approximateWithInteger_debug(__FUNCTION__, dx, rng_); + x += approximateWithInteger(dx, rng_); - // x += round( *i++ - *j ); if ( x < *m ) { *m -= x; @@ -413,23 +361,13 @@ void GssaVoxelPools::xferIn( XferInfo& xf, x -= *m; *m = 0; } - /* - double y = fabs( x - *j ); - // hasChanged |= ( fabs( x - *j ) < 0.1 ); // they are all integers. - hasChanged |= ( y > 0.1 ); // they are all integers. - */ - // j++; m++; } // If S has changed, then I should update rates of all affected reacs. // Go through stoich matrix to find affected reacs for each mol // Store in list, since some may be hit more than once in this func. // When done, go through and update all affected ones. - /* - if ( hasChanged ) { - refreshAtot( g ); - } - */ + // Does this fix the problem of negative concs? refreshAtot( g ); } diff --git a/moose-core/ksolve/GssaVoxelPools.h b/moose-core/ksolve/GssaVoxelPools.h index b0bc90e5c20487ae5e2ddfb7da0fa6893c6b520f..01ca327518eaea981e417fcb62fc78e71ba6405b 100644 --- a/moose-core/ksolve/GssaVoxelPools.h +++ b/moose-core/ksolve/GssaVoxelPools.h @@ -19,17 +19,17 @@ public: virtual ~GssaVoxelPools(); - - ////////////////////////////////////////////////////////////////// // Solver interface functions - ////////////////////////////////////////////////////////////////// void advance( const ProcInfo* p ); + void recalcTime( const GssaSystem* g, double currTime ); - void updateDependentMathExpn( - const GssaSystem* g, unsigned int rindex, double time ); - void updateDependentRates( - const vector< unsigned int >& deps, const Stoich* stoich ); + + void updateDependentMathExpn( const GssaSystem* g, unsigned int rindex, double time ); + + void updateDependentRates( const vector< unsigned int >& deps, const Stoich* stoich ); + unsigned int pickReac(); + void setNumReac( unsigned int n ); void advance( const ProcInfo* p, const GssaSystem* g ); @@ -94,8 +94,7 @@ private: /** * @brief RNG. */ - moose::RNG<double> rng_; - + moose::RNG rng_; }; #endif // _GSSA_VOXEL_POOLS_H diff --git a/moose-core/ksolve/KinSparseMatrix.cpp b/moose-core/ksolve/KinSparseMatrix.cpp index 0ff7676b840924c27b238222d903a6e73b55748d..8716f48e62874f1ee66b337697d32110381c0992 100644 --- a/moose-core/ksolve/KinSparseMatrix.cpp +++ b/moose-core/ksolve/KinSparseMatrix.cpp @@ -166,7 +166,7 @@ void makeVecUnique( vector< unsigned int >& v ) #ifdef DO_UNIT_TESTS -#include "header.h" +#include "../basecode/header.h" void testKinSparseMatrix() { diff --git a/moose-core/ksolve/Ksolve.cpp b/moose-core/ksolve/Ksolve.cpp index a072b4c0461110ef058dd7bbe60205df14bef1a2..e81b4d8f7a3fb8e9ec0537b9facf06204f047de7 100644 --- a/moose-core/ksolve/Ksolve.cpp +++ b/moose-core/ksolve/Ksolve.cpp @@ -140,36 +140,33 @@ const Cinfo* Ksolve::initCinfo() ); - /////////////////////////////////////////////////////// // DestFinfo definitions - /////////////////////////////////////////////////////// - static DestFinfo process( "process", - "Handles process call from Clock", - new ProcOpFunc< Ksolve >( &Ksolve::process ) - ); + "Handles process call from Clock", + new ProcOpFunc< Ksolve >( &Ksolve::process ) + ); static DestFinfo reinit( "reinit", - "Handles reinit call from Clock", - new ProcOpFunc< Ksolve >( &Ksolve::reinit ) - ); + "Handles reinit call from Clock", + new ProcOpFunc< Ksolve >( &Ksolve::reinit ) + ); static DestFinfo initProc( "initProc", - "Handles initProc call from Clock", - new ProcOpFunc< Ksolve >( &Ksolve::initProc ) - ); + "Handles initProc call from Clock", + new ProcOpFunc< Ksolve >( &Ksolve::initProc ) + ); static DestFinfo initReinit( "initReinit", - "Handles initReinit call from Clock", - new ProcOpFunc< Ksolve >( &Ksolve::initReinit ) - ); + "Handles initReinit call from Clock", + new ProcOpFunc< Ksolve >( &Ksolve::initReinit ) + ); static DestFinfo voxelVol( "voxelVol", - "Handles updates to all voxels. Comes from parent " - "ChemCompt object.", - new OpFunc1< Ksolve, vector< double > >( - &Ksolve::updateVoxelVol ) - ); + "Handles updates to all voxels. Comes from parent " + "ChemCompt object.", + new OpFunc1< Ksolve, vector< double > >( + &Ksolve::updateVoxelVol ) + ); /////////////////////////////////////////////////////// // Shared definitions @@ -180,11 +177,11 @@ const Cinfo* Ksolve::initCinfo() }; static SharedFinfo proc( "proc", - "Shared message for process and reinit. These are used for " - "all regular Ksolve calculations including interfacing with " - "the diffusion calculations by a Dsolve.", - procShared, sizeof( procShared ) / sizeof( const Finfo* ) - ); + "Shared message for process and reinit. These are used for " + "all regular Ksolve calculations including interfacing with " + "the diffusion calculations by a Dsolve.", + procShared, sizeof( procShared ) / sizeof( const Finfo* ) + ); static Finfo* initShared[] = { @@ -192,10 +189,10 @@ const Cinfo* Ksolve::initCinfo() }; static SharedFinfo init( "init", - "Shared message for initProc and initReinit. This is used" - " when the system has cross-compartment reactions. ", - initShared, sizeof( initShared ) / sizeof( const Finfo* ) - ); + "Shared message for initProc and initReinit. This is used" + " when the system has cross-compartment reactions. ", + initShared, sizeof( initShared ) / sizeof( const Finfo* ) + ); static Finfo* ksolveFinfos[] = { @@ -242,7 +239,7 @@ Ksolve::Ksolve() pools_( 1 ), startVoxel_( 0 ), dsolve_(), - dsolvePtr_( 0 ) + dsolvePtr_( nullptr ) { ; } @@ -419,20 +416,19 @@ void Ksolve::setDsolve( Id dsolve ) { if ( dsolve == Id () ) { - dsolvePtr_ = 0; + dsolvePtr_ = nullptr; dsolve_ = Id(); } else if ( dsolve.element()->cinfo()->isA( "Dsolve" ) ) { dsolve_ = dsolve; - dsolvePtr_ = reinterpret_cast< ZombiePoolInterface* >( - dsolve.eref().data() ); + dsolvePtr_ = reinterpret_cast<ZombiePoolInterface*>(dsolve.eref().data()); } else { - cout << "Warning: Ksolve::setDsolve: Object '" << dsolve.path() << - "' should be class Dsolve, is: " << - dsolve.element()->cinfo()->name() << endl; + cout << "Warning: Ksolve::setDsolve: Object '" << dsolve.path() + << "' should be class Dsolve, is: " + << dsolve.element()->cinfo()->name() << endl; } } @@ -508,8 +504,6 @@ double Ksolve::getEstimatedDt() const ////////////////////////////////////////////////////////////// void Ksolve::process( const Eref& e, ProcPtr p ) { - - if ( isBuilt_ == false ) return; diff --git a/moose-core/ksolve/Ksolve.h b/moose-core/ksolve/Ksolve.h index f4b9327ae9ba7e5e271065c88e543139234eada4..89b87cd76b79c1d15f672d6d94a403cc1d5377de 100644 --- a/moose-core/ksolve/Ksolve.h +++ b/moose-core/ksolve/Ksolve.h @@ -45,7 +45,6 @@ public: Id getDsolve() const; void setDsolve( Id dsolve ); /// Inherited from ZombiePoolInterface. - unsigned int getNumLocalVoxels() const; unsigned int getNumAllVoxels() const; /** @@ -79,30 +78,25 @@ public: void reinit( const Eref& e, ProcPtr p ); void initProc( const Eref& e, ProcPtr p ); void initReinit( const Eref& e, ProcPtr p ); + /** * Handles request to change volumes of voxels in this Ksolve, and * all cascading effects of this. At this point it won't handle * change in size of voxel array. */ void updateVoxelVol( vector< double > vols ); - ////////////////////////////////////////////////////////////////// - // Utility for SrcFinfo - ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// // Solver interface functions - ////////////////////////////////////////////////////////////////// unsigned int getPoolIndex( const Eref& e ) const; unsigned int getVoxelIndex( const Eref& e ) const; - ////////////////////////////////////////////////////////////////// // ZombiePoolInterface inherited functions - ////////////////////////////////////////////////////////////////// - void setN( const Eref& e, double v ); double getN( const Eref& e ) const; + void setNinit( const Eref& e, double v ); double getNinit( const Eref& e ) const; + void setDiffConst( const Eref& e, double v ); double getDiffConst( const Eref& e ) const; diff --git a/moose-core/ksolve/SteadyStateBoost.cpp b/moose-core/ksolve/SteadyStateBoost.cpp index 98b671541edf292518cc1d70a90b38d936df6920..6282bfb55eef818a905b9d0ba31feb16648314c2 100644 --- a/moose-core/ksolve/SteadyStateBoost.cpp +++ b/moose-core/ksolve/SteadyStateBoost.cpp @@ -22,10 +22,10 @@ */ -#include "header.h" -#include "global.h" -#include "SparseMatrix.h" -#include "KinSparseMatrix.h" +#include "../basecode/header.h" +#include "../basecode/global.h" +#include "../basecode/SparseMatrix.h" +#include "../ksolve/KinSparseMatrix.h" #include "RateTerm.h" #include "FuncTerm.h" #include "VoxelPoolsBase.h" diff --git a/moose-core/ksolve/SteadyStateGsl.cpp b/moose-core/ksolve/SteadyStateGsl.cpp index eaec6d07ed115ed92fb4ec8cb9a4329a404412e6..e01e1ffde6a6ca6c7c6ad856b7323c4bb18012b3 100644 --- a/moose-core/ksolve/SteadyStateGsl.cpp +++ b/moose-core/ksolve/SteadyStateGsl.cpp @@ -21,7 +21,7 @@ #include "../basecode/header.h" #include "../basecode/global.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "RateTerm.h" #include "FuncTerm.h" diff --git a/moose-core/ksolve/Stoich.cpp b/moose-core/ksolve/Stoich.cpp index 62959a2a31054298d017972fe535b2f510c44dd2..504f8ec10b3d94a45c10a21c874c13f2ec9ee947 100644 --- a/moose-core/ksolve/Stoich.cpp +++ b/moose-core/ksolve/Stoich.cpp @@ -260,8 +260,8 @@ Stoich::Stoich() ksolve_(), // Must be reassigned to build stoich system. dsolve_(), // Must be assigned if diffusion is planned. compartment_(), // Must be assigned if diffusion is planned. - kinterface_( 0 ), - dinterface_( 0 ), + kinterface_( nullptr ), + dinterface_( nullptr ), rates_( 0 ), // No RateTerms yet. // uniqueVols_( 1, 1.0 ), numVoxels_( 1 ), @@ -395,8 +395,7 @@ void Stoich::setElist( const Eref& e, const vector< ObjId >& elist ) // kinterface_->setNumPools( n ); kinterface_->setStoich( e.id() ); Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); - shell->doAddMsg( "Single", - compartment_, "voxelVolOut", ksolve_, "voxelVol" ); + shell->doAddMsg( "Single", compartment_, "voxelVolOut", ksolve_, "voxelVol" ); } if ( dinterface_ ) { @@ -421,20 +420,16 @@ string Stoich::getPath( const Eref& e ) const void Stoich::setKsolve( Id ksolve ) { ksolve_ = Id(); - kinterface_ = 0; - if ( ! ( - ksolve.element()->cinfo()->isA( "Ksolve" ) || - ksolve.element()->cinfo()->isA( "Gsolve" ) - ) - ) + kinterface_ = nullptr; + if ( ! ( ksolve.element()->cinfo()->isA( "Ksolve" ) || ksolve.element()->cinfo()->isA( "Gsolve" ))) { cout << "Error: Stoich::setKsolve: invalid class assigned," " should be either Ksolve or Gsolve\n"; return; } + ksolve_ = ksolve; - kinterface_ = reinterpret_cast< ZombiePoolInterface* >( - ksolve.eref().data() ); + kinterface_ = reinterpret_cast< ZombiePoolInterface* >(ksolve.eref().data()); if ( ksolve.element()->cinfo()->isA( "Gsolve" ) ) setOneWay( true ); @@ -452,18 +447,14 @@ void Stoich::setDsolve( Id dsolve ) { dsolve_ = Id(); dinterface_ = 0; - if ( ! ( - dsolve.element()->cinfo()->isA( "Dsolve" ) - ) - ) + if (not (dsolve.element()->cinfo()->isA("Dsolve") )) { cout << "Error: Stoich::setDsolve: invalid class assigned," " should be Dsolve\n"; return; } dsolve_ = dsolve; - dinterface_ = reinterpret_cast< ZombiePoolInterface* >( - dsolve.eref().data() ); + dinterface_ = reinterpret_cast<ZombiePoolInterface*>(dsolve.eref().data()); } Id Stoich::getDsolve() const @@ -473,12 +464,9 @@ Id Stoich::getDsolve() const void Stoich::setCompartment( Id compartment ) { - if ( ! ( - compartment.element()->cinfo()->isA( "ChemCompt" ) - ) - ) + if (! (compartment.element()->cinfo()->isA( "ChemCompt" ))) { - cout << "Error: Stoich::setCompartment: invalid class assigned," + cerr << "Error: Stoich::setCompartment: invalid class assigned," " should be ChemCompt or derived class\n"; return; } @@ -493,8 +481,7 @@ void Stoich::setCompartment( Id compartment ) double bigVol = vols.back(); assert( bigVol > 0.0 ); temp.push_back( vols[0] / bigVol ); - for ( vector< double >::iterator - i = vols.begin(); i != vols.end(); ++i ) + for ( auto i = vols.begin(); i != vols.end(); ++i ) { if ( !doubleEq( temp.back(), *i / bigVol ) ) temp.push_back( *i / bigVol ); @@ -535,8 +522,8 @@ vector< unsigned int > Stoich::getPoolIdMap() const unsigned int minId = 1000000; unsigned int maxId = 0; unsigned int maxIndex = 0; - map< Id, unsigned int >::const_iterator i; - for ( i = poolLookup_.begin(); i != poolLookup_.end(); ++i ) + + for (auto i = poolLookup_.cbegin(); i != poolLookup_.end(); ++i ) { unsigned int j = i->first.value(); if ( j < minId ) minId = j; @@ -544,7 +531,7 @@ vector< unsigned int > Stoich::getPoolIdMap() const if ( maxIndex < i->second ) maxIndex = i->second; } vector< unsigned int > ret( maxId - minId + 2, ~0U ); - for ( i = poolLookup_.begin(); i != poolLookup_.end(); ++i ) + for (auto i = poolLookup_.cbegin(); i != poolLookup_.end(); ++i ) { unsigned int j = i->first.value() - minId; ret[j] = i->second; @@ -1475,9 +1462,7 @@ unsigned int Stoich::convertIdToReacIndex( Id id ) const { map< Id, unsigned int >::const_iterator i = rateTermLookup_.find( id ); if ( i != rateTermLookup_.end() ) - { return i->second; - } return ~0U; } @@ -1678,8 +1663,7 @@ void Stoich::installMMenz( Id enzId, const vector< Id >& enzMols, return; vector< Id > subCompt; vector< Id > dummy; - for ( vector< Id >::const_iterator - i = subs.begin(); i != subs.end(); ++i ) + for( auto i = subs.cbegin(); i != subs.end(); ++i ) subCompt.push_back( getCompt( *i ).id ); subComptVec_.push_back( subCompt ); prdComptVec_.push_back( dummy ); @@ -2117,15 +2101,9 @@ const vector< Id >& Stoich::offSolverPoolMap( Id compt ) const // s is the array of pools, S_[meshIndex][0] void Stoich::updateFuncs( double* s, double t ) const { - for ( vector< FuncTerm* >::const_iterator i = funcs_.begin(); - i != funcs_.end(); ++i ) - { + for ( auto i = funcs_.cbegin(); i != funcs_.end(); ++i ) if ( *i ) - { (*i)->evalPool( s, t ); - // s holds arguments and also result location - } - } } /** diff --git a/moose-core/ksolve/Stoich.h b/moose-core/ksolve/Stoich.h index 93e63b9f79fa7a0b344bb3d85638773206db74d6..2b273613809098e2731941211de43da884d09956 100644 --- a/moose-core/ksolve/Stoich.h +++ b/moose-core/ksolve/Stoich.h @@ -48,680 +48,680 @@ class Stoich { - public: - Stoich(); - ~Stoich(); - - ////////////////////////////////////////////////////////////////// - // Field assignment stuff - ////////////////////////////////////////////////////////////////// - - void setOneWay( bool v ); - bool getOneWay() const; - - // Flag that defines permission for pool values to go negative. - void setAllowNegative( bool v ); - bool getAllowNegative() const; - - /// Returns number of local pools that are updated by solver - unsigned int getNumVarPools() const; - - /// Returns number of local buffered pools. - unsigned int getNumBufPools() const; - - /** - * Returns total number of pools. Includes the pools whose - * actual calculations happen on another solver, but are given a - * proxy here in order to handle cross-compartment reactions. - */ - unsigned int getNumAllPools() const; - - /** - * Returns number of proxy pools here for - * cross-compartment reactions - */ - unsigned int getNumProxyPools() const; - - /** - * Map to look up the index of the pool from its Id. - * poolIndex = poolIdMap[ Id::value() - poolOffset ] - * where the poolOffset is the smallest Id::value. - * poolOffset is passed back as the last entry of this vector. - * Any Ids that are not pools return EMPTY=~0. - */ - vector< unsigned int > getPoolIdMap() const; - - Id getPoolByIndex( unsigned int index ) const; - - /** - * Take the provided wildcard path to build the list of elements - * managed by this solver. - */ - void setPath( const Eref& e, string path ); - string getPath( const Eref& e ) const; - - /// assigns kinetic solver: Ksovle or GSSAsolve. - void setKsolve( Id v ); - Id getKsolve() const; - - /// assigns diffusion solver: Dsovle or a Gillespie voxel stepper - void setDsolve( Id v ); - Id getDsolve() const; - - /// assigns compartment occupied by Stoich. - void setCompartment( Id v ); - Id getCompartment() const; - - /** - * Utility function to return # of rates_ entries. This includes - * the cross-solver reactions. - */ - unsigned int getNumRates() const; - - /** - * Utility function to return # of core rates for reacs which are - * entirely located on current compartment, including all reactants - */ - unsigned int getNumCoreRates() const; - - /// Utility function to return a rates_ entry - const RateTerm* rates( unsigned int i ) const; - - /// Returns a reference to the entire rates_ vector. - const vector< RateTerm* >& getRateTerms() const; - - unsigned int getNumFuncs() const; - const FuncTerm* funcs( unsigned int i ) const; - /// Returns true if the specified pool is controlled by a func - bool isFuncTarget( unsigned int poolIndex ) const; - - vector< int > getMatrixEntry() const; - vector< unsigned int > getColIndex() const; - vector< unsigned int > getRowStart() const; - - vector< Id > getProxyPools( Id i ) const; - - /** - * getStatus(): Flag to track status of Stoich object. - * -1: No path yet assigned. - * 0: Success - * 1: Warning: Missing reactant in Reac or Enz - * 2: Warning: Missing substrate in MMenz - * 4: Warning: Compartment not defined - * 8: Warning: Neither Ksolve nor Dsolve defined - * 16: Warning: No objects found on path - */ - int getStatus() const; - ////////////////////////////////////////////////////////////////// - // Model traversal and building functions - ////////////////////////////////////////////////////////////////// - /** - * Internal function which sets up the model based on the provided - * elist of all elements managed by this solver. - */ - void setElist( const Eref& e, const vector< ObjId >& elist ); - - /** - * Scans through elist to find any reactions that connect to - * pools not located on solver. Removes these reactions from the - * elist and maintains Ids of the affected reactions, and their - * off-solver pools, in offSolverReacs_ and offSolverPools_. - */ - void locateOffSolverReacs( Id myCompt, vector< Id >& elist ); - - /** - * Builds the objMap vector, which maps all Ids to - * the internal indices for pools and reacs that are used in the - * solver. In addition to the elist, it also scans through the - * offSolverPools and offSolverReacs to build the map. - void allocateObjMap( const vector< Id >& elist ); - */ - - /// Using the computed array sizes, now allocate space for them. - void resizeArrays(); - /// Identifies and allocates objects in the Stoich. - void allocateModelObject( Id id ); - /// Calculate sizes of all arrays, and allocate them. - void allocateModel( const vector< Id >& elist ); - - /// Functions to build the maps between Ids and internal indices - void buildPoolLookup(); - void buildRateTermLookup(); - void buildFuncLookup(); - - /** - * This function is used when the stoich class is employed by a - * Gsolver for doing stochastic calculations. - * Here we fix the issue of having a single substrate at - * more than first order. As the first molecule of the substrate is - * consumed, the number is depleted by one and so its forward rate - * is reduced. And so on. This also protects against going negative - * in mol number or concentration. - */ - void convertRatesToStochasticForm(); - - /// Used to handle run-time size updates for spines. - void scaleBufsAndRates( unsigned int index, double volScale ); - - ////////////////////////////////////////////////////////////////// - // Zombification functions. - ////////////////////////////////////////////////////////////////// - - /** - * zombifyModel marches through the specified id list and - * converts all entries into zombies. The first arg e is the - * Eref of the Stoich itself. - */ - void zombifyModel( const Eref& e, const vector< Id >& elist ); - - /** - * Converts back to ExpEuler type basic kinetic Elements. - */ - void unZombifyModel(); - - /// unZombifies Pools. Helper for unZombifyModel. - void unZombifyPools(); - - void zombifyChemCompt( Id compt ); - - /** - * Utility function to find if incoming message assigns N or conc, - * and to appropriately zombify the function and set up its - * parameters including volume scaling. - */ - Id zombifyPoolFuncWithScaling( Id pool ); - - unsigned int convertIdToReacIndex( Id id ) const; - unsigned int convertIdToPoolIndex( Id id ) const; - unsigned int convertIdToFuncIndex( Id id ) const; - - /// Utility function to make a half reac and return the rate term. - ZeroOrder* makeHalfReaction( - double rate, const vector< Id >& reactants ); - - /* - * This takes the specified Reac and its substrate and product - * list, and installs them into the Stoich. It also builds up the - * vectors to store which compartment each substrate/product - * belongs to, needed for cross-reaction computations. - * This is the high-level interface function. - */ - void installReaction( Id reacId, - const vector< Id >& subs, const vector< Id >& prds ); - /* - * This takes the specified subs and prds belonging - * to the specified Reac, and builds them into the Stoich. - * It is a low-level function used internally. - */ - unsigned int innerInstallReaction( Id reacId, - const vector< Id >& subs, const vector< Id >& prds ); - - /** - * This takes the baseclass for an MMEnzyme and builds the - * MMenz into the Stoich. - */ - void installMMenz( Id enzId, const vector< Id >& enzMolId, - const vector< Id >& subs, const vector< Id >& prds ); - /** - * This is the inner function to do the installation. - */ - void installMMenz( MMEnzymeBase* meb, unsigned int rateIndex, - const vector< Id >& subs, const vector< Id >& prds ); - - /* - * This takes the specified Reac and its substrate and product - * list, and installs them into the Stoich. This is the high-level - * interface function. - */ - void installEnzyme( Id enzId, Id enzMolId, Id cplxId, - const vector< Id >& subs, const vector< Id >& prds ); - /** - * This takes the forward, backward and product formation half-reacs - * belonging to the specified Enzyme, and builds them into the - * Stoich. This is the low-level function. - */ - void installEnzyme( ZeroOrder* r1, ZeroOrder* r2, ZeroOrder* r3, - Id enzId, Id enzMolId, const vector< Id >& prds ); - - /// This is used when the enzyme lacks sub or prd. - void installDummyEnzyme( Id enzId, Id enzMolId); - - /** - * This installs a FuncTerm, which evaluates a function to specify - * the conc of the specific pool. The pool is a BufPool. - */ - void installAndUnschedFunc( Id func, Id pool, double volScale ); - - /** - * This installs a FuncRate, which evaluates a function to specify - * the rate of change of conc of the specific pool. - * The pool is a Pool. - */ - void installAndUnschedFuncRate( Id func, Id pool ); - - /** - * This installs a FuncReac, which evaluates a function to specify - * the rate (Kf) of the specified reaction. - */ - void installAndUnschedFuncReac( Id func, Id reac ); - - ////////////////////////////////////////////////////////////////// - - /** - * Returns SpeciesId of specified pool - */ - unsigned int getSpecies( unsigned int poolIndex ) const; - - /** - * Assigns SpeciesId of specified pool - */ - void setSpecies( unsigned int poolIndex, unsigned int s ); - - /** - * Sets the forward rate v (given in millimoloar concentration units) - * for the specified reaction throughout the compartment in which the - * reaction lives. Internally the stoich uses #/voxel units so this - * involves querying the volume subsystem about volumes for each - * voxel, and scaling accordingly. - */ - void setReacKf( const Eref& e, double v ) const; - - /** - * Sets the reverse rate v (given in millimoloar concentration units) - * for the specified reaction throughout the compartment in which the - * reaction lives. Internally the stoich uses #/voxel units so this - * involves querying the volume subsystem about volumes for each - * voxel, and scaling accordingly. - */ - void setReacKb( const Eref& e, double v ) const; - - /** - * Sets the Km for MMenz, using appropriate volume conversion to - * go from the argument (in millimolar) to #/voxel. - * This may do the assignment among many voxels containing the enz - * in case there are different volumes. - */ - void setMMenzKm( const Eref& e, double v ) const; - double getMMenzNumKm( const Eref& e ) const; - - /** - * Sets the kcat for MMenz. No conversions needed. - */ - void setMMenzKcat( const Eref& e, double v ) const; - double getMMenzKcat( const Eref& e ) const; - - /** - * Sets the rate v (given in millimoloar concentration units) - * for the forward enzyme reaction of binding substrate to enzyme. - * Does this throughout the compartment in which the - * enzyme lives. Internally the stoich uses #/voxel units so this - * involves querying the volume subsystem about volumes for each - * voxel, and scaling accordingly. - */ - void setEnzK1( const Eref& e, double v ) const; - double getEnzNumK1( const Eref& e ) const; - - /// Set rate k2 (1/sec) for enzyme - void setEnzK2( const Eref& e, double v ) const; - /// Get rate k2 (1/sec) for enzyme - double getEnzK2( const Eref& e ) const; - - /// Set rate k3 (1/sec) for enzyme - void setEnzK3( const Eref& e, double v ) const; - /// Get rate k3, aka kcat, for enzyme - double getEnzK3( const Eref& e ) const; - - /** - * Returns the internal rate in #/voxel, for R1, for the specified - * Eref. - */ - double getR1( const Eref& e ) const; - /** - * Returns internal rate R1 in #/voxel, for the rate term - * following the one directly referred to by the Eref e. Enzymes - * define multiple successive rate terms, so we look up the first, - * and then select one after it. - */ - double getR1offset1( const Eref& e ) const; - /** - * Returns internal rate R1 in #/voxel, for the rate term - * two after the one directly referred to by the Eref e. Enzymes - * define multiple successive rate terms, so we look up the first, - * and then select the second one after it. - */ - double getR1offset2( const Eref& e ) const; - - /** - * Returns the internal rate in #/voxel, for R2, for the specified - * reacIndex and voxel index. In some cases R2 is undefined, and it - * then returns 0. - */ - double getR2( const Eref& e ) const; - - /** - * Sets the arithmetic expression used in a FuncRate or FuncReac - */ - void setFunctionExpr( const Eref& e, string expr ); - - /** - * This function scans all reacs and enzymes and recalculates the - * internal rate terms depending on the reference terms stored in - * the original chemical object. - */ - void updateRatesAfterRemesh(); - - /// Utility function, prints out N_, used for debugging - void print() const; - - /// Another utility function, prints out all Kf, kf, Kb, kb. - void printRates() const; - ////////////////////////////////////////////////////////////////// - // Utility funcs for numeric calculations - ////////////////////////////////////////////////////////////////// - - /** - * Updates the yprime array, rate of change of each molecule - * The volIndex specifies which set of rates to use, since the - * rates are volume dependent. - * Moved to VoxelPools - void updateRates( const double* s, double* yprime, - unsigned int volIndex ) const; - */ - - /** - * Computes the velocity of each reaction, vel. - * The volIndex specifies which set of rates to use, since the - * rates are volume dependent. - */ - void updateReacVelocities( const double* s, vector< double >& vel, - unsigned int volIndex ) const; - - /// Updates the function values, within s. - void updateFuncs( double* s, double t ) const; - - /// Updates the rates for cross-compartment reactions. - /* - void updateJunctionRates( const double* s, - const vector< unsigned int >& reacTerms, double* yprime ); - */ - - /** - * Get the rate for a single reaction specified by r, as per all - * the mol numbers in s. - double getReacVelocity( unsigned int r, const double* s, - unsigned int volIndex ) const; - */ - - /// Returns the stoich matrix. Used by gsolve. - const KinSparseMatrix& getStoichiometryMatrix() const; - ////////////////////////////////////////////////////////////////// - // Access functions for cross-node reactions. - ////////////////////////////////////////////////////////////////// - const vector< Id >& getOffSolverPools() const; - - /** - * List all the compartments to which the current compt is coupled, - * by cross-compartment reactions. Self not included. - */ - vector< Id > getOffSolverCompts() const; - - /** - * Looks up the vector of pool Ids originating from the specified - * compartment, that are represented on this compartment as proxies. - */ - const vector< Id >& offSolverPoolMap( Id compt ) const; - - /** - * Returns the index of the matching volume, - * which is also the index into the RateTerm vector. - unsigned int indexOfMatchingVolume( double vol ) const; - */ - - ////////////////////////////////////////////////////////////////// - static const unsigned int PoolIsNotOnSolver; - static const Cinfo* initCinfo(); - private: - /** - * True if the stoich matrix is set up to handle only one-way - * reactions, as is needed in the case of the Gillespie algorithm. - */ - bool useOneWay_; - - /** - * True if pools are permitted to take negative concentrations. - * This may happen if solver is handling a general equation system - * that is not constrained by chemical rules. - * Defaults to False, so that we cannot have negative concs. - */ - bool allowNegative_; - - string path_; - - /// This contains the Id of the Kinetic solver. - Id ksolve_; - - /// This contains the Id of the Diffusion solver. Optional. - Id dsolve_; - - /// Contains Id of compartment holding reac system. Optional - Id compartment_; - - /// Pointer for ksolve - ZombiePoolInterface* kinterface_; - /// Pointer for dsolve - ZombiePoolInterface* dinterface_; - - /** - * Lookup from each molecule to its Species identifer - * This will eventually be tied into an ontology reference. - */ - vector< unsigned int > species_; - - /** - * The RateTerms handle the update operations for reaction rate v_. - * This is the master vector of RateTerms, and it is scaled to - * a volume such that the 'n' units and the conc units are - * identical. - * Duplicates of this vector are made in each voxel with a different - * volume. The duplicates have rates scaled as per volume. - * The RateTerms vector also includes reactions that have - * off-compartment products. These need special volume scaling - * involving all the interactiong compartments. - */ - vector< RateTerm* > rates_; - - /** - * This tracks the unique volumes handled by the reac system. - * Maps one-to-one with the vector of vector of RateTerms. - vector< double > uniqueVols_; - */ - - /// Number of voxels in reac system. - unsigned int numVoxels_; - - /// The FuncTerms handle mathematical ops on mol levels. - vector< FuncTerm* > funcs_; - - /// N_ is the stoichiometry matrix. All pools * all reac terms. - KinSparseMatrix N_; - - /** - * Maps Ids to objects in the S_, RateTerm, and FuncTerm vectors. - * There will be holes in this map, but look up is very fast. - * The calling Id must know what it wants to find: all it - * gets back is an integer. - * The alternative is to have multiple maps, but that is slower. - * Assume no arrays. Each Pool/reac etc must be a unique - * Element. Later we'll deal with diffusion. - */ - // vector< unsigned int > objMap_; - /** - * Minor efficiency: We will usually have a set of objects that are - * nearly contiguous in the map. May as well start with the first of - * them. - */ - // unsigned int objMapStart_; - // - /////////////////////////////////////////////////////////// - // Here we have the vectors of the different kinds of objects - // managed by the Stoich - /////////////////////////////////////////////////////////// - - /** - * Vector of variablePool Ids. - */ - vector< Id > varPoolVec_; - - /** - * Vector of bufPool Ids. - */ - vector< Id > bufPoolVec_; - - /** - * These are pools that were not in the original scope of the - * solver, but have to be brought in because they are reactants - * of one or more of the offSolverReacs. - */ - vector< Id > offSolverPoolVec_; - - /** - * Vector of reaction ids. - */ - vector< Id > reacVec_; - vector< Id > offSolverReacVec_; - - /** - * Map back from enz index to Id. Needed to unzombify - */ - vector< Id > enzVec_; - vector< Id > offSolverEnzVec_; - - /** - * Map back from enz index to Id. Needed to unzombify - */ - vector< Id > mmEnzVec_; - vector< Id > offSolverMMenzVec_; - - /** - * Vector of funcs controlling pool number, that is N. - */ - vector< Id > poolFuncVec_; - - /** - * vector tracks which pool is controlled by which func. - * Unused entries are flagged by ~0. - * funcTarget_[ poolIndex ] == funcIndex - */ - vector< unsigned int > funcTarget_; - - /** - * Vector of funcs controlling pool increment, that is dN/dt - * This is handled as a rateTerm. - */ - vector< Id > incrementFuncVec_; - - /** - * Vector of funcs controlling reac rate, that is numKf - * This is handled as a rateTerm. - */ - vector< Id > reacFuncVec_; - - /////////////////////////////////////////////////////////////// - // Here we have maps to look up objects from their ids. - /////////////////////////////////////////////////////////////// - map< Id, unsigned int > poolLookup_; - map< Id, unsigned int > rateTermLookup_; - map< Id, unsigned int > funcLookup_; - - /** - * Number of variable molecules that the solver deals with, - * that are local to the solver. - * - */ - // unsigned int numVarPools_; - - /** - * Number of variable molecules that the solver deals with, - * including the proxy molecules which belong in other compartments. - * - unsigned int totVarPools_; - */ - - /** - * Number of buffered molecules - */ - // unsigned int numBufPools_; - - /** - * Looks up the rate term from the Id for a reac, enzyme, or func. - map< Id, unsigned int > rateTermLookup_; - */ - - /** - * Number functions, currently only the ones controlling molecule - * numbers, like sumtotals. - unsigned int numFunctions_; - */ - - /** - * Number of reactions in the solver model. This includes - * conversion reactions A + B <---> C - * enzyme reactions E + S <---> E.S ---> E + P - * and MM enzyme reactions rate = E.S.kcat / ( Km + S ) - * The enzyme reactions count as two reaction steps. - unsigned int numReac_; - */ - - /** - * Flag to track status of Stoich object. - * -1: No path yet assigned. - * 0: Success - * 1: Warning: Missing reactant in Reac or Enz - * 2: Warning: Missing substrate in MMenz - * 4: Warning: Compartment not defined - * 8: Warning: Neither Ksolve nore Dsolve defined - */ - int status_; - - ////////////////////////////////////////////////////////////////// - // Off-solver stuff - ////////////////////////////////////////////////////////////////// - - /** - * Map of vectors of Ids of offSolver pools. - * Each map entry contains the vector of Ids of proxy pools - * coming from the specified compartment. - * In use, the junction will copy the pool indices over for - * data transfer. - */ - map< Id, vector< Id > > offSolverPoolMap_; - - /** - * Tracks the reactions that go off the current solver. - vector< Id > offSolverReacs_; - */ - - /** - * Which compartment(s) does the off solver reac connect to? - * Usually it is just one, in which case the second id is Id() - */ - vector< pair< Id, Id > > offSolverReacCompts_; - vector< pair< Id, Id > > offSolverEnzCompts_; - vector< pair< Id, Id > > offSolverMMenzCompts_; - - /** - * subComptVec_[rateTermIndex][substrate#]: Identifies compts - * for each substrate for each cross-compartment RateTerm in - * the rates_vector. - */ - vector< vector< Id > > subComptVec_; - - /** - * prdComptVec_[rateTermIndex][product#]: Identifies compts - * for each product for each cross-compartment RateTerm in - * the rates_vector. - */ - vector< vector< Id > > prdComptVec_; +public: + Stoich(); + ~Stoich(); + + ////////////////////////////////////////////////////////////////// + // Field assignment stuff + ////////////////////////////////////////////////////////////////// + + void setOneWay( bool v ); + bool getOneWay() const; + + // Flag that defines permission for pool values to go negative. + void setAllowNegative( bool v ); + bool getAllowNegative() const; + + /// Returns number of local pools that are updated by solver + unsigned int getNumVarPools() const; + + /// Returns number of local buffered pools. + unsigned int getNumBufPools() const; + + /** + * Returns total number of pools. Includes the pools whose + * actual calculations happen on another solver, but are given a + * proxy here in order to handle cross-compartment reactions. + */ + unsigned int getNumAllPools() const; + + /** + * Returns number of proxy pools here for + * cross-compartment reactions + */ + unsigned int getNumProxyPools() const; + + /** + * Map to look up the index of the pool from its Id. + * poolIndex = poolIdMap[ Id::value() - poolOffset ] + * where the poolOffset is the smallest Id::value. + * poolOffset is passed back as the last entry of this vector. + * Any Ids that are not pools return EMPTY=~0. + */ + vector< unsigned int > getPoolIdMap() const; + + Id getPoolByIndex( unsigned int index ) const; + + /** + * Take the provided wildcard path to build the list of elements + * managed by this solver. + */ + void setPath( const Eref& e, string path ); + string getPath( const Eref& e ) const; + + /// assigns kinetic solver: Ksovle or GSSAsolve. + void setKsolve( Id v ); + Id getKsolve() const; + + /// assigns diffusion solver: Dsovle or a Gillespie voxel stepper + void setDsolve( Id v ); + Id getDsolve() const; + + /// assigns compartment occupied by Stoich. + void setCompartment( Id v ); + Id getCompartment() const; + + /** + * Utility function to return # of rates_ entries. This includes + * the cross-solver reactions. + */ + unsigned int getNumRates() const; + + /** + * Utility function to return # of core rates for reacs which are + * entirely located on current compartment, including all reactants + */ + unsigned int getNumCoreRates() const; + + /// Utility function to return a rates_ entry + const RateTerm* rates( unsigned int i ) const; + + /// Returns a reference to the entire rates_ vector. + const vector< RateTerm* >& getRateTerms() const; + + unsigned int getNumFuncs() const; + const FuncTerm* funcs( unsigned int i ) const; + /// Returns true if the specified pool is controlled by a func + bool isFuncTarget( unsigned int poolIndex ) const; + + vector< int > getMatrixEntry() const; + vector< unsigned int > getColIndex() const; + vector< unsigned int > getRowStart() const; + + vector< Id > getProxyPools( Id i ) const; + + /** + * getStatus(): Flag to track status of Stoich object. + * -1: No path yet assigned. + * 0: Success + * 1: Warning: Missing reactant in Reac or Enz + * 2: Warning: Missing substrate in MMenz + * 4: Warning: Compartment not defined + * 8: Warning: Neither Ksolve nor Dsolve defined + * 16: Warning: No objects found on path + */ + int getStatus() const; + ////////////////////////////////////////////////////////////////// + // Model traversal and building functions + ////////////////////////////////////////////////////////////////// + /** + * Internal function which sets up the model based on the provided + * elist of all elements managed by this solver. + */ + void setElist( const Eref& e, const vector< ObjId >& elist ); + + /** + * Scans through elist to find any reactions that connect to + * pools not located on solver. Removes these reactions from the + * elist and maintains Ids of the affected reactions, and their + * off-solver pools, in offSolverReacs_ and offSolverPools_. + */ + void locateOffSolverReacs( Id myCompt, vector< Id >& elist ); + + /** + * Builds the objMap vector, which maps all Ids to + * the internal indices for pools and reacs that are used in the + * solver. In addition to the elist, it also scans through the + * offSolverPools and offSolverReacs to build the map. + void allocateObjMap( const vector< Id >& elist ); + */ + + /// Using the computed array sizes, now allocate space for them. + void resizeArrays(); + /// Identifies and allocates objects in the Stoich. + void allocateModelObject( Id id ); + /// Calculate sizes of all arrays, and allocate them. + void allocateModel( const vector< Id >& elist ); + + /// Functions to build the maps between Ids and internal indices + void buildPoolLookup(); + void buildRateTermLookup(); + void buildFuncLookup(); + + /** + * This function is used when the stoich class is employed by a + * Gsolver for doing stochastic calculations. + * Here we fix the issue of having a single substrate at + * more than first order. As the first molecule of the substrate is + * consumed, the number is depleted by one and so its forward rate + * is reduced. And so on. This also protects against going negative + * in mol number or concentration. + */ + void convertRatesToStochasticForm(); + + /// Used to handle run-time size updates for spines. + void scaleBufsAndRates( unsigned int index, double volScale ); + + ////////////////////////////////////////////////////////////////// + // Zombification functions. + ////////////////////////////////////////////////////////////////// + + /** + * zombifyModel marches through the specified id list and + * converts all entries into zombies. The first arg e is the + * Eref of the Stoich itself. + */ + void zombifyModel( const Eref& e, const vector< Id >& elist ); + + /** + * Converts back to ExpEuler type basic kinetic Elements. + */ + void unZombifyModel(); + + /// unZombifies Pools. Helper for unZombifyModel. + void unZombifyPools(); + + void zombifyChemCompt( Id compt ); + + /** + * Utility function to find if incoming message assigns N or conc, + * and to appropriately zombify the function and set up its + * parameters including volume scaling. + */ + Id zombifyPoolFuncWithScaling( Id pool ); + + unsigned int convertIdToReacIndex( Id id ) const; + unsigned int convertIdToPoolIndex( Id id ) const; + unsigned int convertIdToFuncIndex( Id id ) const; + + /// Utility function to make a half reac and return the rate term. + ZeroOrder* makeHalfReaction( + double rate, const vector< Id >& reactants ); + + /* + * This takes the specified Reac and its substrate and product + * list, and installs them into the Stoich. It also builds up the + * vectors to store which compartment each substrate/product + * belongs to, needed for cross-reaction computations. + * This is the high-level interface function. + */ + void installReaction( Id reacId, + const vector< Id >& subs, const vector< Id >& prds ); + /* + * This takes the specified subs and prds belonging + * to the specified Reac, and builds them into the Stoich. + * It is a low-level function used internally. + */ + unsigned int innerInstallReaction( Id reacId, + const vector< Id >& subs, const vector< Id >& prds ); + + /** + * This takes the baseclass for an MMEnzyme and builds the + * MMenz into the Stoich. + */ + void installMMenz( Id enzId, const vector< Id >& enzMolId, + const vector< Id >& subs, const vector< Id >& prds ); + /** + * This is the inner function to do the installation. + */ + void installMMenz( MMEnzymeBase* meb, unsigned int rateIndex, + const vector< Id >& subs, const vector< Id >& prds ); + + /* + * This takes the specified Reac and its substrate and product + * list, and installs them into the Stoich. This is the high-level + * interface function. + */ + void installEnzyme( Id enzId, Id enzMolId, Id cplxId, + const vector< Id >& subs, const vector< Id >& prds ); + /** + * This takes the forward, backward and product formation half-reacs + * belonging to the specified Enzyme, and builds them into the + * Stoich. This is the low-level function. + */ + void installEnzyme( ZeroOrder* r1, ZeroOrder* r2, ZeroOrder* r3, + Id enzId, Id enzMolId, const vector< Id >& prds ); + + /// This is used when the enzyme lacks sub or prd. + void installDummyEnzyme( Id enzId, Id enzMolId); + + /** + * This installs a FuncTerm, which evaluates a function to specify + * the conc of the specific pool. The pool is a BufPool. + */ + void installAndUnschedFunc( Id func, Id pool, double volScale ); + + /** + * This installs a FuncRate, which evaluates a function to specify + * the rate of change of conc of the specific pool. + * The pool is a Pool. + */ + void installAndUnschedFuncRate( Id func, Id pool ); + + /** + * This installs a FuncReac, which evaluates a function to specify + * the rate (Kf) of the specified reaction. + */ + void installAndUnschedFuncReac( Id func, Id reac ); + + ////////////////////////////////////////////////////////////////// + + /** + * Returns SpeciesId of specified pool + */ + unsigned int getSpecies( unsigned int poolIndex ) const; + + /** + * Assigns SpeciesId of specified pool + */ + void setSpecies( unsigned int poolIndex, unsigned int s ); + + /** + * Sets the forward rate v (given in millimoloar concentration units) + * for the specified reaction throughout the compartment in which the + * reaction lives. Internally the stoich uses #/voxel units so this + * involves querying the volume subsystem about volumes for each + * voxel, and scaling accordingly. + */ + void setReacKf( const Eref& e, double v ) const; + + /** + * Sets the reverse rate v (given in millimoloar concentration units) + * for the specified reaction throughout the compartment in which the + * reaction lives. Internally the stoich uses #/voxel units so this + * involves querying the volume subsystem about volumes for each + * voxel, and scaling accordingly. + */ + void setReacKb( const Eref& e, double v ) const; + + /** + * Sets the Km for MMenz, using appropriate volume conversion to + * go from the argument (in millimolar) to #/voxel. + * This may do the assignment among many voxels containing the enz + * in case there are different volumes. + */ + void setMMenzKm( const Eref& e, double v ) const; + double getMMenzNumKm( const Eref& e ) const; + + /** + * Sets the kcat for MMenz. No conversions needed. + */ + void setMMenzKcat( const Eref& e, double v ) const; + double getMMenzKcat( const Eref& e ) const; + + /** + * Sets the rate v (given in millimoloar concentration units) + * for the forward enzyme reaction of binding substrate to enzyme. + * Does this throughout the compartment in which the + * enzyme lives. Internally the stoich uses #/voxel units so this + * involves querying the volume subsystem about volumes for each + * voxel, and scaling accordingly. + */ + void setEnzK1( const Eref& e, double v ) const; + double getEnzNumK1( const Eref& e ) const; + + /// Set rate k2 (1/sec) for enzyme + void setEnzK2( const Eref& e, double v ) const; + /// Get rate k2 (1/sec) for enzyme + double getEnzK2( const Eref& e ) const; + + /// Set rate k3 (1/sec) for enzyme + void setEnzK3( const Eref& e, double v ) const; + /// Get rate k3, aka kcat, for enzyme + double getEnzK3( const Eref& e ) const; + + /** + * Returns the internal rate in #/voxel, for R1, for the specified + * Eref. + */ + double getR1( const Eref& e ) const; + /** + * Returns internal rate R1 in #/voxel, for the rate term + * following the one directly referred to by the Eref e. Enzymes + * define multiple successive rate terms, so we look up the first, + * and then select one after it. + */ + double getR1offset1( const Eref& e ) const; + /** + * Returns internal rate R1 in #/voxel, for the rate term + * two after the one directly referred to by the Eref e. Enzymes + * define multiple successive rate terms, so we look up the first, + * and then select the second one after it. + */ + double getR1offset2( const Eref& e ) const; + + /** + * Returns the internal rate in #/voxel, for R2, for the specified + * reacIndex and voxel index. In some cases R2 is undefined, and it + * then returns 0. + */ + double getR2( const Eref& e ) const; + + /** + * Sets the arithmetic expression used in a FuncRate or FuncReac + */ + void setFunctionExpr( const Eref& e, string expr ); + + /** + * This function scans all reacs and enzymes and recalculates the + * internal rate terms depending on the reference terms stored in + * the original chemical object. + */ + void updateRatesAfterRemesh(); + + /// Utility function, prints out N_, used for debugging + void print() const; + + /// Another utility function, prints out all Kf, kf, Kb, kb. + void printRates() const; + ////////////////////////////////////////////////////////////////// + // Utility funcs for numeric calculations + ////////////////////////////////////////////////////////////////// + + /** + * Updates the yprime array, rate of change of each molecule + * The volIndex specifies which set of rates to use, since the + * rates are volume dependent. + * Moved to VoxelPools + void updateRates( const double* s, double* yprime, + unsigned int volIndex ) const; + */ + + /** + * Computes the velocity of each reaction, vel. + * The volIndex specifies which set of rates to use, since the + * rates are volume dependent. + */ + void updateReacVelocities( const double* s, vector< double >& vel, + unsigned int volIndex ) const; + + /// Updates the function values, within s. + void updateFuncs( double* s, double t ) const; + + /// Updates the rates for cross-compartment reactions. + /* + void updateJunctionRates( const double* s, + const vector< unsigned int >& reacTerms, double* yprime ); + */ + + /** + * Get the rate for a single reaction specified by r, as per all + * the mol numbers in s. + double getReacVelocity( unsigned int r, const double* s, + unsigned int volIndex ) const; + */ + + /// Returns the stoich matrix. Used by gsolve. + const KinSparseMatrix& getStoichiometryMatrix() const; + ////////////////////////////////////////////////////////////////// + // Access functions for cross-node reactions. + ////////////////////////////////////////////////////////////////// + const vector< Id >& getOffSolverPools() const; + + /** + * List all the compartments to which the current compt is coupled, + * by cross-compartment reactions. Self not included. + */ + vector< Id > getOffSolverCompts() const; + + /** + * Looks up the vector of pool Ids originating from the specified + * compartment, that are represented on this compartment as proxies. + */ + const vector< Id >& offSolverPoolMap( Id compt ) const; + + /** + * Returns the index of the matching volume, + * which is also the index into the RateTerm vector. + unsigned int indexOfMatchingVolume( double vol ) const; + */ + + ////////////////////////////////////////////////////////////////// + static const unsigned int PoolIsNotOnSolver; + static const Cinfo* initCinfo(); +private: + /** + * True if the stoich matrix is set up to handle only one-way + * reactions, as is needed in the case of the Gillespie algorithm. + */ + bool useOneWay_; + + /** + * True if pools are permitted to take negative concentrations. + * This may happen if solver is handling a general equation system + * that is not constrained by chemical rules. + * Defaults to False, so that we cannot have negative concs. + */ + bool allowNegative_; + + string path_; + + /// This contains the Id of the Kinetic solver. + Id ksolve_; + + /// This contains the Id of the Diffusion solver. Optional. + Id dsolve_; + + /// Contains Id of compartment holding reac system. Optional + Id compartment_; + + /// Pointer for ksolve + ZombiePoolInterface* kinterface_; + /// Pointer for dsolve + ZombiePoolInterface* dinterface_; + + /** + * Lookup from each molecule to its Species identifer + * This will eventually be tied into an ontology reference. + */ + vector< unsigned int > species_; + + /** + * The RateTerms handle the update operations for reaction rate v_. + * This is the master vector of RateTerms, and it is scaled to + * a volume such that the 'n' units and the conc units are + * identical. + * Duplicates of this vector are made in each voxel with a different + * volume. The duplicates have rates scaled as per volume. + * The RateTerms vector also includes reactions that have + * off-compartment products. These need special volume scaling + * involving all the interactiong compartments. + */ + vector< RateTerm* > rates_; + + /** + * This tracks the unique volumes handled by the reac system. + * Maps one-to-one with the vector of vector of RateTerms. + vector< double > uniqueVols_; + */ + + /// Number of voxels in reac system. + unsigned int numVoxels_; + + /// The FuncTerms handle mathematical ops on mol levels. + vector< FuncTerm* > funcs_; + + /// N_ is the stoichiometry matrix. All pools * all reac terms. + KinSparseMatrix N_; + + /** + * Maps Ids to objects in the S_, RateTerm, and FuncTerm vectors. + * There will be holes in this map, but look up is very fast. + * The calling Id must know what it wants to find: all it + * gets back is an integer. + * The alternative is to have multiple maps, but that is slower. + * Assume no arrays. Each Pool/reac etc must be a unique + * Element. Later we'll deal with diffusion. + */ + // vector< unsigned int > objMap_; + /** + * Minor efficiency: We will usually have a set of objects that are + * nearly contiguous in the map. May as well start with the first of + * them. + */ + // unsigned int objMapStart_; + // + /////////////////////////////////////////////////////////// + // Here we have the vectors of the different kinds of objects + // managed by the Stoich + /////////////////////////////////////////////////////////// + + /** + * Vector of variablePool Ids. + */ + vector< Id > varPoolVec_; + + /** + * Vector of bufPool Ids. + */ + vector< Id > bufPoolVec_; + + /** + * These are pools that were not in the original scope of the + * solver, but have to be brought in because they are reactants + * of one or more of the offSolverReacs. + */ + vector< Id > offSolverPoolVec_; + + /** + * Vector of reaction ids. + */ + vector< Id > reacVec_; + vector< Id > offSolverReacVec_; + + /** + * Map back from enz index to Id. Needed to unzombify + */ + vector< Id > enzVec_; + vector< Id > offSolverEnzVec_; + + /** + * Map back from enz index to Id. Needed to unzombify + */ + vector< Id > mmEnzVec_; + vector< Id > offSolverMMenzVec_; + + /** + * Vector of funcs controlling pool number, that is N. + */ + vector< Id > poolFuncVec_; + + /** + * vector tracks which pool is controlled by which func. + * Unused entries are flagged by ~0. + * funcTarget_[ poolIndex ] == funcIndex + */ + vector< unsigned int > funcTarget_; + + /** + * Vector of funcs controlling pool increment, that is dN/dt + * This is handled as a rateTerm. + */ + vector< Id > incrementFuncVec_; + + /** + * Vector of funcs controlling reac rate, that is numKf + * This is handled as a rateTerm. + */ + vector< Id > reacFuncVec_; + + /////////////////////////////////////////////////////////////// + // Here we have maps to look up objects from their ids. + /////////////////////////////////////////////////////////////// + map< Id, unsigned int > poolLookup_; + map< Id, unsigned int > rateTermLookup_; + map< Id, unsigned int > funcLookup_; + + /** + * Number of variable molecules that the solver deals with, + * that are local to the solver. + * + */ + // unsigned int numVarPools_; + + /** + * Number of variable molecules that the solver deals with, + * including the proxy molecules which belong in other compartments. + * + unsigned int totVarPools_; + */ + + /** + * Number of buffered molecules + */ + // unsigned int numBufPools_; + + /** + * Looks up the rate term from the Id for a reac, enzyme, or func. + map< Id, unsigned int > rateTermLookup_; + */ + + /** + * Number functions, currently only the ones controlling molecule + * numbers, like sumtotals. + unsigned int numFunctions_; + */ + + /** + * Number of reactions in the solver model. This includes + * conversion reactions A + B <---> C + * enzyme reactions E + S <---> E.S ---> E + P + * and MM enzyme reactions rate = E.S.kcat / ( Km + S ) + * The enzyme reactions count as two reaction steps. + unsigned int numReac_; + */ + + /** + * Flag to track status of Stoich object. + * -1: No path yet assigned. + * 0: Success + * 1: Warning: Missing reactant in Reac or Enz + * 2: Warning: Missing substrate in MMenz + * 4: Warning: Compartment not defined + * 8: Warning: Neither Ksolve nore Dsolve defined + */ + int status_; + + ////////////////////////////////////////////////////////////////// + // Off-solver stuff + ////////////////////////////////////////////////////////////////// + + /** + * Map of vectors of Ids of offSolver pools. + * Each map entry contains the vector of Ids of proxy pools + * coming from the specified compartment. + * In use, the junction will copy the pool indices over for + * data transfer. + */ + map< Id, vector< Id > > offSolverPoolMap_; + + /** + * Tracks the reactions that go off the current solver. + vector< Id > offSolverReacs_; + */ + + /** + * Which compartment(s) does the off solver reac connect to? + * Usually it is just one, in which case the second id is Id() + */ + vector< pair< Id, Id > > offSolverReacCompts_; + vector< pair< Id, Id > > offSolverEnzCompts_; + vector< pair< Id, Id > > offSolverMMenzCompts_; + + /** + * subComptVec_[rateTermIndex][substrate#]: Identifies compts + * for each substrate for each cross-compartment RateTerm in + * the rates_vector. + */ + vector< vector< Id > > subComptVec_; + + /** + * prdComptVec_[rateTermIndex][product#]: Identifies compts + * for each product for each cross-compartment RateTerm in + * the rates_vector. + */ + vector< vector< Id > > prdComptVec_; }; #endif // _STOICH_H diff --git a/moose-core/ksolve/VoxelPools.cpp b/moose-core/ksolve/VoxelPools.cpp index dd797fd3f248ba09288b665ce083a25fbb80fe12..cf16e42375e814e19d7cba1445ceaf1d7b37d4b1 100644 --- a/moose-core/ksolve/VoxelPools.cpp +++ b/moose-core/ksolve/VoxelPools.cpp @@ -113,8 +113,6 @@ void VoxelPools::advance( const ProcInfo* p ) #elif USE_BOOST_ODE /*----------------------------------------------------------------------------- - NOTE: 04/21/2016 11:31:42 AM - We need to call updateFuncs here (unlike in GSL solver) because there is no way we can update const vector_type_& y in evalRatesUsingBoost function. In gsl implmentation one could do it, because const_cast can @@ -144,19 +142,21 @@ void VoxelPools::advance( const ProcInfo* p ) // https://www.boost.org/doc/libs/1_68_0/libs/numeric/odeint/doc/html/boost_numeric_odeint/odeint_in_detail/steppers.html#boost_numeric_odeint.odeint_in_detail.steppers.explicit_steppers // Describe system to be used in boost solver calls. - auto sys = [this](const vector_type_& dy, vector_type_& dydt, const double t) { - VoxelPools::evalRates(this, dy, dydt); }; + auto sys = [this](const vector_type_& dy, vector_type_& dydt, const double t) + { + VoxelPools::evalRates(this, dy, dydt); + }; // This is usually the default method. It works well in practice. Tested // with steady-state solver. Closest to GSL rk5 . if( method_ == "rk5" || method_ == "gsl" || method_ == "boost" ) - odeint::integrate_adaptive( - make_dense_output( epsAbs_, epsRel_, odeint::runge_kutta_dopri5<vector_type_>() ) - , sys , Svec() , p->currTime - p->dt , p->currTime , p->dt + odeint::integrate_adaptive( + make_dense_output( epsAbs_, epsRel_, odeint::runge_kutta_dopri5<vector_type_>() ) + , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt ); else if( method_ == "rk5a" || method_ == "adaptive" ) odeint::integrate_adaptive( odeint::make_controlled<rk_dopri_stepper_type_>( epsAbs_, epsRel_ ) - , sys , Svec() , p->currTime - p->dt , p->currTime, p->dt ); + , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt ); else if( method_ == "rk2" ) odeint::integrate_const( rk_midpoint_stepper_type_() , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); @@ -165,26 +165,26 @@ void VoxelPools::advance( const ProcInfo* p ) , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt ); else if ("rk54" == method_ ) odeint::integrate_const( rk_karp_stepper_type_() - , sys , Svec() , p->currTime - p->dt, p->currTime, p->dt); + , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); else if ("rkck" == method_ ) odeint::integrate_adaptive( odeint::make_controlled<rk_karp_stepper_type_>( epsAbs_, epsRel_ ) , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); else if( method_ == "rk8" ) odeint::integrate_const( rk_felhberg_stepper_type_() - , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); + , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); else if( method_ == "rk8a" ) odeint::integrate_adaptive( rk_felhberg_stepper_type_() - , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); + , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); else { cerr << "Ksolve: Unknow method " << method_ << ", using default!" << endl; odeint::integrate_const( - make_dense_output( epsAbs_, epsRel_, odeint::runge_kutta_dopri5<vector_type_>() ) - , sys , Svec() , p->currTime - p->dt , p->currTime , p->dt + make_dense_output( epsAbs_, epsRel_, odeint::runge_kutta_dopri5<vector_type_>() ) + , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt ); } - #endif + if ( !stoichPtr_->getAllowNegative() ) // clean out negatives { unsigned int nv = stoichPtr_->getNumVarPools(); @@ -205,12 +205,10 @@ void VoxelPools::setInitDt( double dt ) } #ifdef USE_GSL -// static func. This is the function that goes into the Gsl solver. -int VoxelPools::gslFunc( double t, const double* y, double *dydt, - void* params ) +// static func. This goes into the Gsl solver. +int VoxelPools::gslFunc(double t, const double* y, double *dydt, void* params) { VoxelPools* vp = reinterpret_cast< VoxelPools* >( params ); - // Stoich* s = reinterpret_cast< Stoich* >( params ); double* q = const_cast< double* >( y ); // Assign the func portion. vp->stoichPtr_->updateFuncs( q, t ); vp->updateRates( y, dydt ); @@ -235,7 +233,7 @@ void VoxelPools::evalRates( VoxelPools* vp, const vector_type_& y, vector_type_ /////////////////////////////////////////////////////////////////////// void VoxelPools::updateAllRateTerms( const vector< RateTerm* >& rates, - unsigned int numCoreRates ) + unsigned int numCoreRates ) { // Clear out old rates if any for ( unsigned int i = 0; i < rates_.size(); ++i ) @@ -249,8 +247,9 @@ void VoxelPools::updateAllRateTerms( const vector< RateTerm* >& rates, for ( unsigned int i = numCoreRates; i < rates.size(); ++i ) { rates_[i] = rates[i]->copyWithVolScaling( getVolume(), - getXreacScaleSubstrates(i - numCoreRates), - getXreacScaleProducts(i - numCoreRates ) ); + getXreacScaleSubstrates(i-numCoreRates), + getXreacScaleProducts(i-numCoreRates) + ); } } @@ -263,13 +262,14 @@ void VoxelPools::updateRateTerms( const vector< RateTerm* >& rates, return; delete( rates_[index] ); if ( index >= numCoreRates ) + { rates_[index] = rates[index]->copyWithVolScaling( getVolume(), getXreacScaleSubstrates(index - numCoreRates), getXreacScaleProducts(index - numCoreRates ) ); + } else - rates_[index] = rates[index]->copyWithVolScaling( - getVolume(), 1.0, 1.0 ); + rates_[index] = rates[index]->copyWithVolScaling(getVolume(), 1.0, 1.0); } void VoxelPools::updateRates( const double* s, double* yprime ) const @@ -335,8 +335,7 @@ void VoxelPools::print() const */ void VoxelPools::setVolumeAndDependencies( double vol ) { - VoxelPoolsBase::setVolumeAndDependencies( vol ); - updateAllRateTerms( stoichPtr_->getRateTerms(), - stoichPtr_->getNumCoreRates() ); + VoxelPoolsBase::setVolumeAndDependencies(vol); + updateAllRateTerms(stoichPtr_->getRateTerms(), stoichPtr_->getNumCoreRates()); } diff --git a/moose-core/ksolve/ZombieFunction.cpp b/moose-core/ksolve/ZombieFunction.cpp index 48a218990b6dffe3be174bb49c7e3a143389c70f..e7b5e9ac47df5011cc6c635ad5c81d750ca2f791 100644 --- a/moose-core/ksolve/ZombieFunction.cpp +++ b/moose-core/ksolve/ZombieFunction.cpp @@ -10,7 +10,9 @@ #include "../basecode/header.h" #include "../basecode/ElementValueFinfo.h" +#include "../builtins/MooseParser.h" #include "../builtins/Variable.h" +#include "../builtins/MooseParser.h" #include "../builtins/Function.h" #include "ZombieFunction.h" diff --git a/moose-core/ksolve/ZombiePoolInterface.cpp b/moose-core/ksolve/ZombiePoolInterface.cpp index 62a50f9f13058ba0378d572bcfdd612ec6c6032a..a4ebf8c4ca0a3b54e550b19fbc93f0754591767c 100644 --- a/moose-core/ksolve/ZombiePoolInterface.cpp +++ b/moose-core/ksolve/ZombiePoolInterface.cpp @@ -30,12 +30,12 @@ #include "../mesh/ChemCompt.h" ZombiePoolInterface::ZombiePoolInterface() - : stoich_(), compartment_(), - isBuilt_( false ) + : stoich_(), compartment_(), isBuilt_(false) {;} void ZombiePoolInterface::updateJunctions( double dt ) {;} + void ZombiePoolInterface::setPrev() {;} @@ -52,15 +52,13 @@ void ZombiePoolInterface::setCompartment( Id compt ) if ( compt.element()->cinfo()->isA( "ChemCompt" ) ) { compartment_ = compt; - vector< double > vols = - Field< vector < double > >::get( compt, "voxelVolume" ); - if ( vols.size() > 0 ) + vector<double> vols = Field<vector<double>>::get( compt, "voxelVolume" ); + + if (vols.size() > 0) { setNumAllVoxels( vols.size() ); for ( unsigned int i = 0; i < vols.size(); ++i ) - { pools(i)->setVolume( vols[i] ); - } } } } diff --git a/moose-core/mesh/ChemCompt.cpp b/moose-core/mesh/ChemCompt.cpp index b8961f1d9a8b968ced95b0565269a000f5209cdb..b1d32598d805a42d97fef21a32201e6e70e20c71 100644 --- a/moose-core/mesh/ChemCompt.cpp +++ b/moose-core/mesh/ChemCompt.cpp @@ -14,179 +14,182 @@ #include "MeshEntry.h" #include "ChemCompt.h" -SrcFinfo1< vector< double > >* ChemCompt::voxelVolOut() { - static SrcFinfo1< vector< double > > voxelVolOut( "voxelVolOut", - "Sends updated voxel volume out to Ksolve, Gsolve, and Dsolve." - "Used to request a recalculation of rates and of initial numbers." - ); - return &voxelVolOut; +SrcFinfo1< vector< double > >* ChemCompt::voxelVolOut() +{ + static SrcFinfo1< vector< double > > voxelVolOut( "voxelVolOut", + "Sends updated voxel volume out to Ksolve, Gsolve, and Dsolve." + "Used to request a recalculation of rates and of initial numbers." + ); + return &voxelVolOut; } const Cinfo* ChemCompt::initCinfo() { - ////////////////////////////////////////////////////////////// - // Field Definitions - ////////////////////////////////////////////////////////////// - static ElementValueFinfo< ChemCompt, double > volume( - "volume", - "Volume of entire chemical domain." - "Assigning this only works if the chemical compartment has" - "only a single voxel. Otherwise ignored." - "This function goes through all objects below this on the" - "tree, and rescales their molecule #s and rates as per the" - "volume change. This keeps concentration the same, and also" - "maintains rates as expressed in volume units.", - &ChemCompt::setEntireVolume, - &ChemCompt::getEntireVolume - ); - - static ReadOnlyValueFinfo< ChemCompt, vector< double > > - voxelVolume( - "voxelVolume", - "Vector of volumes of each of the voxels.", - &ChemCompt::getVoxelVolume - ); - - static ReadOnlyValueFinfo< ChemCompt, vector< double > > - voxelMidpoint( - "voxelMidpoint", - "Vector of midpoint coordinates of each of the voxels. The " - "size of this vector is 3N, where N is the number of voxels. " - "The first N entries are for x, next N for y, last N are z. ", - &ChemCompt::getVoxelMidpoint - ); - - static LookupElementValueFinfo< - ChemCompt, unsigned int, double > - oneVoxelVolume( - "oneVoxelVolume", - "Volume of specified voxel.", - &ChemCompt::setOneVoxelVolume, - &ChemCompt::getOneVoxelVolume - ); - - static ReadOnlyValueFinfo< ChemCompt, unsigned int > numDimensions( - "numDimensions", - "Number of spatial dimensions of this compartment. Usually 3 or 2", - &ChemCompt::getDimensions - ); - - static ReadOnlyLookupValueFinfo< ChemCompt, unsigned int, vector< double > > stencilRate( - "stencilRate", - "vector of diffusion rates in the stencil for specified voxel." - "The identity of the coupled voxels is given by the partner " - "field 'stencilIndex'." - "Returns an empty vector for non-voxelized compartments.", - &ChemCompt::getStencilRate - ); - - static ReadOnlyLookupValueFinfo< ChemCompt, unsigned int, vector< unsigned int > > stencilIndex( - "stencilIndex", - "vector of voxels diffusively coupled to the specified voxel." - "The diffusion rates into the coupled voxels is given by the " - "partner field 'stencilRate'." - "Returns an empty vector for non-voxelized compartments.", - &ChemCompt::getStencilIndex - ); - - static ValueFinfo< ChemCompt, bool > isMembraneBound( - "isMembraneBound", - "Flag, set to True for meshes where each voxel is membrane " - "bound. \n" - "NeuroMesh and SpineMesh are false. \n" - "CubeMesh, CylMesh, and EndoMesh can be either. If they are " - "membrane bound they can still interact via channels and " - "cross-compartment reactions. ", - &ChemCompt::setIsMembraneBound, - &ChemCompt::getIsMembraneBound - ); - - ////////////////////////////////////////////////////////////// - // MsgDest Definitions - ////////////////////////////////////////////////////////////// - - static DestFinfo buildDefaultMesh( "buildDefaultMesh", - "Tells ChemCompt derived class to build a default mesh with the" - "specified volume and number of meshEntries.", - new EpFunc2< ChemCompt, double, unsigned int >( - &ChemCompt::buildDefaultMesh ) - ); - - static DestFinfo setVolumeNotRates( "setVolumeNotRates", - "Changes volume but does not notify any child objects." - "Only works if the ChemCompt has just one voxel." - "This function will invalidate any concentration term in" - "the model. If you don't know why you would want to do this," - "then you shouldn't use this function.", - new OpFunc1< ChemCompt, double >( - &ChemCompt::setVolumeNotRates ) - ); - - static DestFinfo handleNodeInfo( "handleNodeInfo", - "Tells ChemCompt how many nodes and threads per node it is " - "allowed to use. Triggers a return meshSplitOut message.", - new EpFunc2< ChemCompt, unsigned int, unsigned int >( - &ChemCompt::handleNodeInfo ) - ); - - static DestFinfo resetStencil( "resetStencil", - "Resets the diffusion stencil to the core stencil that only " - "includes the within-mesh diffusion. This is needed prior to " - "building up the cross-mesh diffusion through junctions.", - new OpFunc0< ChemCompt >( - &ChemCompt::resetStencil ) - ); - - - ////////////////////////////////////////////////////////////// - // Field Elements - ////////////////////////////////////////////////////////////// - - static FieldElementFinfo< ChemCompt, MeshEntry > entryFinfo( - "mesh", - "Field Element for mesh entries", - MeshEntry::initCinfo(), - &ChemCompt::lookupEntry, - &ChemCompt::setNumEntries, - &ChemCompt::getNumEntries, - false - ); - - static Finfo* chemMeshFinfos[] = { - &volume, // Value - &voxelVolume, // ReadOnlyLookupValue - &voxelMidpoint, // ReadOnlyLookupValue - &oneVoxelVolume, // ReadOnlyLookupValue - &numDimensions, // ReadOnlyValue - &stencilRate, // ReadOnlyLookupValue - &stencilIndex, // ReadOnlyLookupValue - &isMembraneBound, // Value - voxelVolOut(), // SrcFinfo - &buildDefaultMesh, // DestFinfo - &setVolumeNotRates, // DestFinfo - &resetStencil, // DestFinfo - &entryFinfo, // FieldElementFinfo - }; - - static string doc[] = { - "Name", "ChemCompt", - "Author", "Upi Bhalla", - "Description", "Pure virtual base class for chemical compartments" - - }; - static Dinfo< short > dinfo; - static Cinfo chemMeshCinfo ( - "ChemCompt", - Neutral::initCinfo(), - chemMeshFinfos, - sizeof( chemMeshFinfos ) / sizeof ( Finfo* ), - &dinfo, - doc, - sizeof(doc)/sizeof( string ), - true // This is a base class, not be be created directly. - ); - - return &chemMeshCinfo; + ////////////////////////////////////////////////////////////// + // Field Definitions + ////////////////////////////////////////////////////////////// + static ElementValueFinfo< ChemCompt, double > volume( + "volume", + "Volume of entire chemical domain." + "Assigning this only works if the chemical compartment has" + "only a single voxel. Otherwise ignored." + "This function goes through all objects below this on the" + "tree, and rescales their molecule #s and rates as per the" + "volume change. This keeps concentration the same, and also" + "maintains rates as expressed in volume units.", + &ChemCompt::setEntireVolume, + &ChemCompt::getEntireVolume + ); + + static ReadOnlyValueFinfo< ChemCompt, vector< double > > + voxelVolume( + "voxelVolume", + "Vector of volumes of each of the voxels.", + &ChemCompt::getVoxelVolume + ); + + static ReadOnlyValueFinfo< ChemCompt, vector< double > > + voxelMidpoint( + "voxelMidpoint", + "Vector of midpoint coordinates of each of the voxels. The " + "size of this vector is 3N, where N is the number of voxels. " + "The first N entries are for x, next N for y, last N are z. ", + &ChemCompt::getVoxelMidpoint + ); + + static LookupElementValueFinfo< + ChemCompt, unsigned int, double > + oneVoxelVolume( + "oneVoxelVolume", + "Volume of specified voxel.", + &ChemCompt::setOneVoxelVolume, + &ChemCompt::getOneVoxelVolume + ); + + static ReadOnlyValueFinfo< ChemCompt, unsigned int > numDimensions( + "numDimensions", + "Number of spatial dimensions of this compartment. Usually 3 or 2", + &ChemCompt::getDimensions + ); + + static ReadOnlyLookupValueFinfo< ChemCompt, unsigned int, vector< double > > stencilRate( + "stencilRate", + "vector of diffusion rates in the stencil for specified voxel." + "The identity of the coupled voxels is given by the partner " + "field 'stencilIndex'." + "Returns an empty vector for non-voxelized compartments.", + &ChemCompt::getStencilRate + ); + + static ReadOnlyLookupValueFinfo< ChemCompt, unsigned int, vector< unsigned int > > stencilIndex( + "stencilIndex", + "vector of voxels diffusively coupled to the specified voxel." + "The diffusion rates into the coupled voxels is given by the " + "partner field 'stencilRate'." + "Returns an empty vector for non-voxelized compartments.", + &ChemCompt::getStencilIndex + ); + + static ValueFinfo< ChemCompt, bool > isMembraneBound( + "isMembraneBound", + "Flag, set to True for meshes where each voxel is membrane " + "bound. \n" + "NeuroMesh and SpineMesh are false. \n" + "CubeMesh, CylMesh, and EndoMesh can be either. If they are " + "membrane bound they can still interact via channels and " + "cross-compartment reactions. ", + &ChemCompt::setIsMembraneBound, + &ChemCompt::getIsMembraneBound + ); + + ////////////////////////////////////////////////////////////// + // MsgDest Definitions + ////////////////////////////////////////////////////////////// + + static DestFinfo buildDefaultMesh( "buildDefaultMesh", + "Tells ChemCompt derived class to build a default mesh with the" + "specified volume and number of meshEntries.", + new EpFunc2< ChemCompt, double, unsigned int >( + &ChemCompt::buildDefaultMesh ) + ); + + static DestFinfo setVolumeNotRates( "setVolumeNotRates", + "Changes volume but does not notify any child objects." + "Only works if the ChemCompt has just one voxel." + "This function will invalidate any concentration term in" + "the model. If you don't know why you would want to do this," + "then you shouldn't use this function.", + new OpFunc1< ChemCompt, double >( + &ChemCompt::setVolumeNotRates ) + ); + + static DestFinfo handleNodeInfo( "handleNodeInfo", + "Tells ChemCompt how many nodes and threads per node it is " + "allowed to use. Triggers a return meshSplitOut message.", + new EpFunc2< ChemCompt, unsigned int, unsigned int >( + &ChemCompt::handleNodeInfo ) + ); + + static DestFinfo resetStencil( "resetStencil", + "Resets the diffusion stencil to the core stencil that only " + "includes the within-mesh diffusion. This is needed prior to " + "building up the cross-mesh diffusion through junctions.", + new OpFunc0< ChemCompt >( + &ChemCompt::resetStencil ) + ); + + + ////////////////////////////////////////////////////////////// + // Field Elements + ////////////////////////////////////////////////////////////// + + static FieldElementFinfo< ChemCompt, MeshEntry > entryFinfo( + "mesh", + "Field Element for mesh entries", + MeshEntry::initCinfo(), + &ChemCompt::lookupEntry, + &ChemCompt::setNumEntries, + &ChemCompt::getNumEntries, + false + ); + + static Finfo* chemMeshFinfos[] = + { + &volume, // Value + &voxelVolume, // ReadOnlyLookupValue + &voxelMidpoint, // ReadOnlyLookupValue + &oneVoxelVolume, // ReadOnlyLookupValue + &numDimensions, // ReadOnlyValue + &stencilRate, // ReadOnlyLookupValue + &stencilIndex, // ReadOnlyLookupValue + &isMembraneBound, // Value + voxelVolOut(), // SrcFinfo + &buildDefaultMesh, // DestFinfo + &setVolumeNotRates, // DestFinfo + &resetStencil, // DestFinfo + &entryFinfo, // FieldElementFinfo + }; + + static string doc[] = + { + "Name", "ChemCompt", + "Author", "Upi Bhalla", + "Description", "Pure virtual base class for chemical compartments" + + }; + static Dinfo< short > dinfo; + static Cinfo chemMeshCinfo ( + "ChemCompt", + Neutral::initCinfo(), + chemMeshFinfos, + sizeof( chemMeshFinfos ) / sizeof ( Finfo* ), + &dinfo, + doc, + sizeof(doc)/sizeof( string ), + true // This is a base class, not be be created directly. + ); + + return &chemMeshCinfo; } ////////////////////////////////////////////////////////////// @@ -196,21 +199,21 @@ const Cinfo* ChemCompt::initCinfo() static const Cinfo* chemMeshCinfo = ChemCompt::initCinfo(); ChemCompt::ChemCompt() - : - entry_( this ), - isMembraneBound_( false ) + : + entry_( this ), + isMembraneBound_( false ) { - ; + ; } ChemCompt::~ChemCompt() { - /* - for ( unsigned int i = 0; i < stencil_.size(); ++i ) { - if ( stencil_[i] ) - delete stencil_[i]; - } - */ + /* + for ( unsigned int i = 0; i < stencil_.size(); ++i ) { + if ( stencil_[i] ) + delete stencil_[i]; + } + */ } ////////////////////////////////////////////////////////////// @@ -218,21 +221,21 @@ ChemCompt::~ChemCompt() ////////////////////////////////////////////////////////////// void ChemCompt::buildDefaultMesh( const Eref& e, - double volume, unsigned int numEntries ) + double volume, unsigned int numEntries ) { - this->innerBuildDefaultMesh( e, volume, numEntries ); + this->innerBuildDefaultMesh( e, volume, numEntries ); } void ChemCompt::handleNodeInfo( const Eref& e, - unsigned int numNodes, unsigned int numThreads ) + unsigned int numNodes, unsigned int numThreads ) { - // Pass it down to derived classes along with the SrcFinfo - innerHandleNodeInfo( e, numNodes, numThreads ); + // Pass it down to derived classes along with the SrcFinfo + innerHandleNodeInfo( e, numNodes, numThreads ); } void ChemCompt::resetStencil() { - this->innerResetStencil(); + this->innerResetStencil(); } ////////////////////////////////////////////////////////////// @@ -241,125 +244,141 @@ void ChemCompt::resetStencil() void ChemCompt::setEntireVolume( const Eref& e, double volume ) { - // If the reac system is not solved, then explicitly do scaling - vector< ObjId > tgtVec = - e.element()->getMsgTargets( e.dataIndex(), voxelVolOut() ); - if ( tgtVec.size() == 0 ) { - vector< double > childConcs; - getChildConcs( e, childConcs ); - if ( vSetVolumeNotRates( volume ) ) { - setChildConcs( e, childConcs, 0 ); - } - } else { - vSetVolumeNotRates( volume ); - voxelVolOut()->send( e, this->vGetVoxelVolume() ); - } + // If the reac system is not solved, then explicitly do scaling + vector< ObjId > tgtVec = + e.element()->getMsgTargets( e.dataIndex(), voxelVolOut() ); + if ( tgtVec.size() == 0 ) + { + vector< double > childConcs; + getChildConcs( e, childConcs ); + if ( vSetVolumeNotRates( volume ) ) + { + setChildConcs( e, childConcs, 0 ); + } + } + else + { + vSetVolumeNotRates( volume ); + voxelVolOut()->send( e, this->vGetVoxelVolume() ); + } } double ChemCompt::getEntireVolume( const Eref& e ) const { - return vGetEntireVolume(); + return vGetEntireVolume(); } -void ChemCompt::getChildConcs( const Eref& e, vector< double >& childConcs ) - const +void ChemCompt::getChildConcs( const Eref& e, vector< double >& childConcs ) const { - vector< Id > kids; - Neutral::children( e, kids ); - for ( vector < Id >::iterator i = kids.begin(); i != kids.end(); ++i ) - { - if ( i->element()->cinfo()->isA( "PoolBase" ) ) { - childConcs.push_back( Field< double >::get( *i, "conc" ) ); - childConcs.push_back( Field< double >::get( *i, "concInit" ) ); - } else if ( i->element()->cinfo()->isA( "ReacBase" ) ) { - childConcs.push_back( Field< double >::get( *i, "Kf" ) ); - childConcs.push_back( Field< double >::get( *i, "Kb" ) ); - } else if ( i->element()->cinfo()->isA( "EnzBase" ) ) { - childConcs.push_back( Field< double >::get( *i, "Km" ) ); - } else if ( i->element()->cinfo()->isA( "ChemCompt" ) ) { - // Do NOT traverse into child ChemCompts, they look after their - // own volumes. - continue; - } - getChildConcs( i->eref(), childConcs ); - } + vector< Id > kids; + Neutral::children( e, kids ); + for ( vector < Id >::iterator i = kids.begin(); i != kids.end(); ++i ) + { + if ( i->element()->cinfo()->isA( "PoolBase" ) ) + { + childConcs.push_back( Field< double >::get( *i, "conc" ) ); + childConcs.push_back( Field< double >::get( *i, "concInit" ) ); + } + else if ( i->element()->cinfo()->isA( "ReacBase" ) ) + { + childConcs.push_back( Field< double >::get( *i, "Kf" ) ); + childConcs.push_back( Field< double >::get( *i, "Kb" ) ); + } + else if ( i->element()->cinfo()->isA( "EnzBase" ) ) + { + childConcs.push_back( Field< double >::get( *i, "Km" ) ); + } + else if ( i->element()->cinfo()->isA( "ChemCompt" ) ) + { + // Do NOT traverse into child ChemCompts, they look after their + // own volumes. + continue; + } + getChildConcs( i->eref(), childConcs ); + } } unsigned int ChemCompt::setChildConcs( const Eref& e, - const vector< double >& conc, unsigned int start ) const + const vector< double >& conc, unsigned int start) const { - vector< Id > kids; - Neutral::children( e, kids ); - for ( vector < Id >::iterator i = kids.begin(); i != kids.end(); ++i ) - { - if ( i->element()->cinfo()->isA( "PoolBase" ) ) { - Field< double >::set( *i, "conc", conc[ start++ ] ); - Field< double >::set( *i, "concInit", conc[start++] ); - } else if ( i->element()->cinfo()->isA( "ReacBase" ) ) { - Field< double >::set( *i, "Kf", conc[ start++ ] ); - Field< double >::set( *i, "Kb", conc[ start++ ] ); - } else if ( i->element()->cinfo()->isA( "EnzBase" ) ) { - Field< double >::set( *i, "Km", conc[ start++ ] ); - } else if ( i->element()->cinfo()->isA( "ChemCompt" ) ) { - // Do NOT traverse into child ChemCompts, they look after their - // own volumes. - continue; - } - start = setChildConcs( i->eref(), conc, start ); - } - return start; + vector< Id > kids; + Neutral::children( e, kids ); + for ( vector < Id >::iterator i = kids.begin(); i != kids.end(); ++i ) + { + if ( i->element()->cinfo()->isA( "PoolBase" ) ) + { + Field< double >::set( *i, "conc", conc[ start++ ] ); + Field< double >::set( *i, "concInit", conc[start++] ); + } + else if ( i->element()->cinfo()->isA( "ReacBase" ) ) + { + Field< double >::set( *i, "Kf", conc[ start++ ] ); + Field< double >::set( *i, "Kb", conc[ start++ ] ); + } + else if ( i->element()->cinfo()->isA( "EnzBase" ) ) + { + Field< double >::set( *i, "Km", conc[ start++ ] ); + } + else if ( i->element()->cinfo()->isA( "ChemCompt" ) ) + { + // Do NOT traverse into child ChemCompts, they look after their + // own volumes. + continue; + } + start = setChildConcs( i->eref(), conc, start ); + } + return start; } vector< double > ChemCompt::getVoxelVolume() const { - return this->vGetVoxelVolume(); + return this->vGetVoxelVolume(); } vector< double > ChemCompt::getVoxelMidpoint() const { - return this->vGetVoxelMidpoint(); + return this->vGetVoxelMidpoint(); } double ChemCompt::getOneVoxelVolume( const Eref& e, unsigned int dataIndex ) const { - return this->getMeshEntryVolume( dataIndex ); + return this->getMeshEntryVolume( dataIndex ); } -void ChemCompt::setOneVoxelVolume( const Eref& e, unsigned int dataIndex, - double volume ) +void ChemCompt::setOneVoxelVolume( const Eref& e, unsigned int dataIndex, double volume ) { - this->setMeshEntryVolume( dataIndex, volume ); + this->setMeshEntryVolume( dataIndex, volume ); } // A virtual function, meant to be overridden. void ChemCompt::setMeshEntryVolume( unsigned int dataIndex, double volume ) { - cout << "Warning: ChemCompt::setMeshEntryVolume: Undefined except for PSD and spine mesh.\n"; + cout << "Warning: ChemCompt::setMeshEntryVolume: Undefined except for PSD and spine mesh.\n"; } unsigned int ChemCompt::getDimensions() const { - return this->innerGetDimensions(); + return this->innerGetDimensions(); } vector< double > ChemCompt::getStencilRate( unsigned int row ) const { - return this->innerGetStencilRate( row ); + return this->innerGetStencilRate( row ); } vector< unsigned int > ChemCompt::getStencilIndex( unsigned int row ) const { - return this->getNeighbors( row ); + return this->getNeighbors( row ); } bool ChemCompt::getIsMembraneBound() const { - return isMembraneBound_; + return isMembraneBound_; } void ChemCompt::setIsMembraneBound( bool v ) { - isMembraneBound_ = v; + isMembraneBound_ = v; } @@ -369,7 +388,7 @@ void ChemCompt::setIsMembraneBound( bool v ) void ChemCompt::setVolumeNotRates( double volume ) { - vSetVolumeNotRates( volume ); // Pass on to derived classes. + vSetVolumeNotRates( volume ); // Pass on to derived classes. } ////////////////////////////////////////////////////////////// @@ -378,18 +397,18 @@ void ChemCompt::setVolumeNotRates( double volume ) MeshEntry* ChemCompt::lookupEntry( unsigned int index ) { - return &entry_; + return &entry_; } void ChemCompt::setNumEntries( unsigned int num ) { - this->innerSetNumEntries( num ); - // cout << "Warning: ChemCompt::setNumEntries: No effect. Use subclass-specific functions\nto build or resize mesh.\n"; + this->innerSetNumEntries( num ); + // cout << "Warning: ChemCompt::setNumEntries: No effect. Use subclass-specific functions\nto build or resize mesh.\n"; } unsigned int ChemCompt::getNumEntries() const { - return this->innerGetNumEntries(); + return this->innerGetNumEntries(); } @@ -399,21 +418,22 @@ unsigned int ChemCompt::getNumEntries() const ////////////////////////////////////////////////////////////// void ChemCompt::buildJunction( ChemCompt* other, vector< VoxelJunction >& ret) { - matchMeshEntries( other, ret ); - extendStencil( other, ret ); + matchMeshEntries( other, ret ); + extendStencil( other, ret ); } void ChemCompt::flipRet( vector< VoxelJunction >& ret ) const { - vector< VoxelJunction >::iterator i; - for ( i = ret.begin(); i != ret.end(); ++i ) { - unsigned int temp = i->first; - i->first = i->second; - i->second = temp; - double vol = i->firstVol; - i->firstVol = i->secondVol; - i->secondVol = vol; - } + vector< VoxelJunction >::iterator i; + for ( i = ret.begin(); i != ret.end(); ++i ) + { + unsigned int temp = i->first; + i->first = i->second; + i->second = temp; + double vol = i->firstVol; + i->firstVol = i->secondVol; + i->secondVol = vol; + } } //////////////////////////////////////////////////////////////////////// @@ -421,5 +441,5 @@ void ChemCompt::flipRet( vector< VoxelJunction >& ret ) const double ChemCompt::distance( double x, double y, double z ) { - return sqrt( x * x + y * y + z * z ); + return sqrt(x*x + y*y + z*z); } diff --git a/moose-core/mesh/CubeMesh.cpp b/moose-core/mesh/CubeMesh.cpp index d50507437ff4d32d50aea6d83d4d48efeb67c3de..3d19d32be2abc7ccc3e5eb116b5c508ae007c919 100644 --- a/moose-core/mesh/CubeMesh.cpp +++ b/moose-core/mesh/CubeMesh.cpp @@ -30,223 +30,224 @@ typedef pair< unsigned int, unsigned int > PII; const Cinfo* CubeMesh::initCinfo() { - ////////////////////////////////////////////////////////////// - // Field Definitions - ////////////////////////////////////////////////////////////// - static ValueFinfo< CubeMesh, double > x0( - "x0", - "X coord of one end", - &CubeMesh::setX0, - &CubeMesh::getX0 - ); - static ValueFinfo< CubeMesh, double > y0( - "y0", - "Y coord of one end", - &CubeMesh::setY0, - &CubeMesh::getY0 - ); - static ValueFinfo< CubeMesh, double > z0( - "z0", - "Z coord of one end", - &CubeMesh::setZ0, - &CubeMesh::getZ0 - ); - static ValueFinfo< CubeMesh, double > x1( - "x1", - "X coord of other end", - &CubeMesh::setX1, - &CubeMesh::getX1 - ); - static ValueFinfo< CubeMesh, double > y1( - "y1", - "Y coord of other end", - &CubeMesh::setY1, - &CubeMesh::getY1 - ); - static ValueFinfo< CubeMesh, double > z1( - "z1", - "Z coord of other end", - &CubeMesh::setZ1, - &CubeMesh::getZ1 - ); - - static ValueFinfo< CubeMesh, double > dx( - "dx", - "X size for mesh", - &CubeMesh::setDx, - &CubeMesh::getDx - ); - static ValueFinfo< CubeMesh, double > dy( - "dy", - "Y size for mesh", - &CubeMesh::setDy, - &CubeMesh::getDy - ); - static ValueFinfo< CubeMesh, double > dz( - "dz", - "Z size for mesh", - &CubeMesh::setDz, - &CubeMesh::getDz - ); - - static ValueFinfo< CubeMesh, unsigned int > nx( - "nx", - "Number of subdivisions in mesh in X", - &CubeMesh::setNx, - &CubeMesh::getNx - ); - static ValueFinfo< CubeMesh, unsigned int > ny( - "ny", - "Number of subdivisions in mesh in Y", - &CubeMesh::setNy, - &CubeMesh::getNy - ); - static ValueFinfo< CubeMesh, unsigned int > nz( - "nz", - "Number of subdivisions in mesh in Z", - &CubeMesh::setNz, - &CubeMesh::getNz - ); - - static ValueFinfo< CubeMesh, bool > isToroid( - "isToroid", - "Flag. True when the mesh should be toroidal, that is," - "when going beyond the right face brings us around to the" - "left-most mesh entry, and so on. If we have nx, ny, nz" - "entries, this rule means that the coordinate (x, ny, z)" - "will map onto (x, 0, z). Similarly," - "(-1, y, z) -> (nx-1, y, z)" - "Default is false", - &CubeMesh::setIsToroid, - &CubeMesh::getIsToroid - ); - - static ValueFinfo< CubeMesh, bool > preserveNumEntries( - "preserveNumEntries", - "Flag. When it is true, the numbers nx, ny, nz remain" - "unchanged when x0, x1, y0, y1, z0, z1 are altered. Thus" - "dx, dy, dz would change instead. When it is false, then" - "dx, dy, dz remain the same and nx, ny, nz are altered." - "Default is true", - &CubeMesh::setPreserveNumEntries, - &CubeMesh::getPreserveNumEntries - ); - - static ValueFinfo< CubeMesh, bool > alwaysDiffuse( - "alwaysDiffuse", - "Flag. When it is true, the mesh matches up sequential " - "mesh entries for diffusion and chmestry. This is regardless " - "of spatial location, and is guaranteed to set up at least " - "the home reaction system" - "Default is false", - &CubeMesh::setAlwaysDiffuse, - &CubeMesh::getAlwaysDiffuse - ); - - static ElementValueFinfo< CubeMesh, vector< double > > coords( - "coords", - "Set all the coords of the cuboid at once. Order is:" - "x0 y0 z0 x1 y1 z1 dx dy dz" - "When this is done, it recalculates the numEntries since " - "dx, dy and dz are given explicitly." - "As a special hack, you can leave out dx, dy and dz and use " - "a vector of size 6. In this case the operation assumes that " - "nx, ny and nz are to be preserved and dx, dy and dz will " - "be recalculated. ", - &CubeMesh::setCoords, - &CubeMesh::getCoords - ); - - static ValueFinfo< CubeMesh, vector< unsigned int > > meshToSpace( - "meshToSpace", - "Array in which each mesh entry stores spatial (cubic) index", - &CubeMesh::setMeshToSpace, - &CubeMesh::getMeshToSpace - ); - - static ValueFinfo< CubeMesh, vector< unsigned int > > spaceToMesh( - "spaceToMesh", - "Array in which each space index (obtained by linearizing " - "the xyz coords) specifies which meshIndex is present." - "In many cases the index will store the EMPTY flag if there is" - "no mesh entry at that spatial location", - &CubeMesh::setSpaceToMesh, - &CubeMesh::getSpaceToMesh - ); - - static ValueFinfo< CubeMesh, vector< unsigned int > > surface( - "surface", - "Array specifying surface of arbitrary volume within the " - "CubeMesh. All entries must fall within the cuboid. " - "Each entry of the array is a spatial index obtained by " - "linearizing the ix, iy, iz coordinates within the cuboid. " - "So, each entry == ( iz * ny + iy ) * nx + ix" - "Note that the voxels listed on the surface are WITHIN the " - "volume of the CubeMesh object", - &CubeMesh::setSurface, - &CubeMesh::getSurface - ); - - ////////////////////////////////////////////////////////////// - // MsgDest Definitions - ////////////////////////////////////////////////////////////// - - static DestFinfo buildMesh( "buildMesh", - "Build cubical mesh for geom surface specified by Id, using" - "specified x y z coords as an inside point in mesh", - new OpFunc4< CubeMesh, Id, double, double, double >( - &CubeMesh::buildMesh ) - ); - - ////////////////////////////////////////////////////////////// - // Field Elements - ////////////////////////////////////////////////////////////// - - static Finfo* cubeMeshFinfos[] = { - &isToroid, // Value - &preserveNumEntries, // Value - &alwaysDiffuse, // Value - &x0, // Value - &y0, // Value - &z0, // Value - &x1, // Value - &y1, // Value - &z1, // Value - &dx, // Value - &dy, // Value - &dz, // Value - &nx, // Value - &ny, // Value - &nz, // Value - &coords, // Value - &meshToSpace, // Value - &spaceToMesh, // Value - &surface, // Value - }; - - static string doc[] = - { - "Name", "CubeMesh", - "Author", "Upi Bhalla", - "Description", "Chemical compartment with cuboid grid. " - "Defaults to a cube of size 10 microns, with mesh size " - "also 10 microns, so that there is just 1 cubic voxel. " - "These defaults are similar to that of a typical cell. " - "Can be configured to have different x,y,z dimensions and " - "also different dx,dy,dz voxel sizes. ", - }; - static Dinfo< CubeMesh > dinfo; - static Cinfo cubeMeshCinfo ( - "CubeMesh", - ChemCompt::initCinfo(), - cubeMeshFinfos, - sizeof( cubeMeshFinfos ) / sizeof ( Finfo* ), - &dinfo, - doc, + ////////////////////////////////////////////////////////////// + // Field Definitions + ////////////////////////////////////////////////////////////// + static ValueFinfo< CubeMesh, double > x0( + "x0", + "X coord of one end", + &CubeMesh::setX0, + &CubeMesh::getX0 + ); + static ValueFinfo< CubeMesh, double > y0( + "y0", + "Y coord of one end", + &CubeMesh::setY0, + &CubeMesh::getY0 + ); + static ValueFinfo< CubeMesh, double > z0( + "z0", + "Z coord of one end", + &CubeMesh::setZ0, + &CubeMesh::getZ0 + ); + static ValueFinfo< CubeMesh, double > x1( + "x1", + "X coord of other end", + &CubeMesh::setX1, + &CubeMesh::getX1 + ); + static ValueFinfo< CubeMesh, double > y1( + "y1", + "Y coord of other end", + &CubeMesh::setY1, + &CubeMesh::getY1 + ); + static ValueFinfo< CubeMesh, double > z1( + "z1", + "Z coord of other end", + &CubeMesh::setZ1, + &CubeMesh::getZ1 + ); + + static ValueFinfo< CubeMesh, double > dx( + "dx", + "X size for mesh", + &CubeMesh::setDx, + &CubeMesh::getDx + ); + static ValueFinfo< CubeMesh, double > dy( + "dy", + "Y size for mesh", + &CubeMesh::setDy, + &CubeMesh::getDy + ); + static ValueFinfo< CubeMesh, double > dz( + "dz", + "Z size for mesh", + &CubeMesh::setDz, + &CubeMesh::getDz + ); + + static ValueFinfo< CubeMesh, unsigned int > nx( + "nx", + "Number of subdivisions in mesh in X", + &CubeMesh::setNx, + &CubeMesh::getNx + ); + static ValueFinfo< CubeMesh, unsigned int > ny( + "ny", + "Number of subdivisions in mesh in Y", + &CubeMesh::setNy, + &CubeMesh::getNy + ); + static ValueFinfo< CubeMesh, unsigned int > nz( + "nz", + "Number of subdivisions in mesh in Z", + &CubeMesh::setNz, + &CubeMesh::getNz + ); + + static ValueFinfo< CubeMesh, bool > isToroid( + "isToroid", + "Flag. True when the mesh should be toroidal, that is," + "when going beyond the right face brings us around to the" + "left-most mesh entry, and so on. If we have nx, ny, nz" + "entries, this rule means that the coordinate (x, ny, z)" + "will map onto (x, 0, z). Similarly," + "(-1, y, z) -> (nx-1, y, z)" + "Default is false", + &CubeMesh::setIsToroid, + &CubeMesh::getIsToroid + ); + + static ValueFinfo< CubeMesh, bool > preserveNumEntries( + "preserveNumEntries", + "Flag. When it is true, the numbers nx, ny, nz remain" + "unchanged when x0, x1, y0, y1, z0, z1 are altered. Thus" + "dx, dy, dz would change instead. When it is false, then" + "dx, dy, dz remain the same and nx, ny, nz are altered." + "Default is true", + &CubeMesh::setPreserveNumEntries, + &CubeMesh::getPreserveNumEntries + ); + + static ValueFinfo< CubeMesh, bool > alwaysDiffuse( + "alwaysDiffuse", + "Flag. When it is true, the mesh matches up sequential " + "mesh entries for diffusion and chmestry. This is regardless " + "of spatial location, and is guaranteed to set up at least " + "the home reaction system" + "Default is false", + &CubeMesh::setAlwaysDiffuse, + &CubeMesh::getAlwaysDiffuse + ); + + static ElementValueFinfo< CubeMesh, vector< double > > coords( + "coords", + "Set all the coords of the cuboid at once. Order is:" + "x0 y0 z0 x1 y1 z1 dx dy dz" + "When this is done, it recalculates the numEntries since " + "dx, dy and dz are given explicitly." + "As a special hack, you can leave out dx, dy and dz and use " + "a vector of size 6. In this case the operation assumes that " + "nx, ny and nz are to be preserved and dx, dy and dz will " + "be recalculated. ", + &CubeMesh::setCoords, + &CubeMesh::getCoords + ); + + static ValueFinfo< CubeMesh, vector< unsigned int > > meshToSpace( + "meshToSpace", + "Array in which each mesh entry stores spatial (cubic) index", + &CubeMesh::setMeshToSpace, + &CubeMesh::getMeshToSpace + ); + + static ValueFinfo< CubeMesh, vector< unsigned int > > spaceToMesh( + "spaceToMesh", + "Array in which each space index (obtained by linearizing " + "the xyz coords) specifies which meshIndex is present." + "In many cases the index will store the EMPTY flag if there is" + "no mesh entry at that spatial location", + &CubeMesh::setSpaceToMesh, + &CubeMesh::getSpaceToMesh + ); + + static ValueFinfo< CubeMesh, vector< unsigned int > > surface( + "surface", + "Array specifying surface of arbitrary volume within the " + "CubeMesh. All entries must fall within the cuboid. " + "Each entry of the array is a spatial index obtained by " + "linearizing the ix, iy, iz coordinates within the cuboid. " + "So, each entry == ( iz * ny + iy ) * nx + ix" + "Note that the voxels listed on the surface are WITHIN the " + "volume of the CubeMesh object", + &CubeMesh::setSurface, + &CubeMesh::getSurface + ); + + ////////////////////////////////////////////////////////////// + // MsgDest Definitions + ////////////////////////////////////////////////////////////// + + static DestFinfo buildMesh( "buildMesh", + "Build cubical mesh for geom surface specified by Id, using" + "specified x y z coords as an inside point in mesh", + new OpFunc4< CubeMesh, Id, double, double, double >( + &CubeMesh::buildMesh ) + ); + + ////////////////////////////////////////////////////////////// + // Field Elements + ////////////////////////////////////////////////////////////// + + static Finfo* cubeMeshFinfos[] = + { + &isToroid, // Value + &preserveNumEntries, // Value + &alwaysDiffuse, // Value + &x0, // Value + &y0, // Value + &z0, // Value + &x1, // Value + &y1, // Value + &z1, // Value + &dx, // Value + &dy, // Value + &dz, // Value + &nx, // Value + &ny, // Value + &nz, // Value + &coords, // Value + &meshToSpace, // Value + &spaceToMesh, // Value + &surface, // Value + }; + + static string doc[] = + { + "Name", "CubeMesh", + "Author", "Upi Bhalla", + "Description", "Chemical compartment with cuboid grid. " + "Defaults to a cube of size 10 microns, with mesh size " + "also 10 microns, so that there is just 1 cubic voxel. " + "These defaults are similar to that of a typical cell. " + "Can be configured to have different x,y,z dimensions and " + "also different dx,dy,dz voxel sizes. ", + }; + static Dinfo< CubeMesh > dinfo; + static Cinfo cubeMeshCinfo ( + "CubeMesh", + ChemCompt::initCinfo(), + cubeMeshFinfos, + sizeof( cubeMeshFinfos ) / sizeof ( Finfo* ), + &dinfo, + doc, sizeof(doc)/sizeof(string) - ); + ); - return &cubeMeshCinfo; + return &cubeMeshCinfo; } ////////////////////////////////////////////////////////////// @@ -259,31 +260,31 @@ static const Cinfo* cubeMeshCinfo = CubeMesh::initCinfo(); // Class stuff. ////////////////////////////////////////////////////////////////// CubeMesh::CubeMesh() - : - isToroid_( 0 ), - preserveNumEntries_( 1 ), - alwaysDiffuse_( false ), - x0_( 0.0 ), - y0_( 0.0 ), - z0_( 0.0 ), - x1_( 10e-6 ), - y1_( 10e-6 ), - z1_( 10e-6 ), - dx_( 10e-6 ), - dy_( 10e-6 ), - dz_( 10e-6 ), - nx_( 1 ), - ny_( 1 ), - nz_( 1 ), - m2s_( 1, 0 ), - s2m_( 1, 0 ) -{ - updateCoords(); + : + isToroid_( 0 ), + preserveNumEntries_( 1 ), + alwaysDiffuse_( false ), + x0_( 0.0 ), + y0_( 0.0 ), + z0_( 0.0 ), + x1_( 10e-6 ), + y1_( 10e-6 ), + z1_( 10e-6 ), + dx_( 10e-6 ), + dy_( 10e-6 ), + dz_( 10e-6 ), + nx_( 1 ), + ny_( 1 ), + nz_( 1 ), + m2s_( 1, 0 ), + s2m_( 1, 0 ) +{ + updateCoords(); } CubeMesh::~CubeMesh() { - ; + ; } ////////////////////////////////////////////////////////////////// @@ -293,86 +294,92 @@ CubeMesh::~CubeMesh() // Swaps x0 and x1 if x0 > x1 void swapIfBackward( double& x0, double& x1 ) { - if ( x0 > x1 ) { - double temp = x0; - x0 = x1; - x1 = temp; - } + if ( x0 > x1 ) + { + double temp = x0; + x0 = x1; + x1 = temp; + } } void CubeMesh::fillTwoDimSurface() { - unsigned int size = nx_ * ny_ * nz_; - if ( nx_ == 1 ) { - for ( unsigned int j = 0; j < ny_; ++j ) - surface_.push_back( j ); - for ( unsigned int j = size - ny_; j < size; ++j ) - surface_.push_back( j ); - for ( unsigned int i = 1; i < nz_ - 1; ++i ) - surface_.push_back( i * ny_ ); - for ( unsigned int i = 1; i < nz_ - 1; ++i ) - surface_.push_back( ny_ - 1 + i * ny_ ); - } else if ( ny_ == 1 ) { - for ( unsigned int k = 0; k < nx_; ++k ) - surface_.push_back( k ); - for ( unsigned int k = size - nx_; k < size; ++k ) - surface_.push_back( k ); - for ( unsigned int i = 1; i < nz_ - 1; ++i ) - surface_.push_back( i * nx_ ); - for ( unsigned int i = 1; i < nz_ - 1; ++i ) - surface_.push_back( nx_ - 1 + i * nx_ ); - } else if ( nz_ == 1 ) { - for ( unsigned int k = 0; k < nx_; ++k ) - surface_.push_back( k ); - for ( unsigned int k = size - nx_; k < size; ++k ) - surface_.push_back( k ); - for ( unsigned int j = 1; j < ny_ - 1; ++j ) - surface_.push_back( j * nx_ ); - for ( unsigned int j = 1; j < ny_ - 1; ++j ) - surface_.push_back( j * nx_ + nx_ - 1 ); - } - // Ah, C++ STL. Look on my works, ye mighty, and despair. - sort( surface_.begin(), surface_.end() ); - surface_.erase( unique( surface_.begin(), surface_.end() ), - surface_.end() ); + unsigned int size = nx_ * ny_ * nz_; + if ( nx_ == 1 ) + { + for ( unsigned int j = 0; j < ny_; ++j ) + surface_.push_back( j ); + for ( unsigned int j = size - ny_; j < size; ++j ) + surface_.push_back( j ); + for ( unsigned int i = 1; i < nz_ - 1; ++i ) + surface_.push_back( i * ny_ ); + for ( unsigned int i = 1; i < nz_ - 1; ++i ) + surface_.push_back( ny_ - 1 + i * ny_ ); + } + else if ( ny_ == 1 ) + { + for ( unsigned int k = 0; k < nx_; ++k ) + surface_.push_back( k ); + for ( unsigned int k = size - nx_; k < size; ++k ) + surface_.push_back( k ); + for ( unsigned int i = 1; i < nz_ - 1; ++i ) + surface_.push_back( i * nx_ ); + for ( unsigned int i = 1; i < nz_ - 1; ++i ) + surface_.push_back( nx_ - 1 + i * nx_ ); + } + else if ( nz_ == 1 ) + { + for ( unsigned int k = 0; k < nx_; ++k ) + surface_.push_back( k ); + for ( unsigned int k = size - nx_; k < size; ++k ) + surface_.push_back( k ); + for ( unsigned int j = 1; j < ny_ - 1; ++j ) + surface_.push_back( j * nx_ ); + for ( unsigned int j = 1; j < ny_ - 1; ++j ) + surface_.push_back( j * nx_ + nx_ - 1 ); + } + // Ah, C++ STL. Look on my works, ye mighty, and despair. + sort( surface_.begin(), surface_.end() ); + surface_.erase( unique( surface_.begin(), surface_.end() ), + surface_.end() ); } void CubeMesh::fillThreeDimSurface() // Need to fix duplicate points. { - unsigned int size = nx_ * ny_ * nz_; - // z == 0 plane - for ( unsigned int j = 0; j < ny_; ++j ) - for ( unsigned int k = 0; k < nx_; ++k ) - surface_.push_back( j * nx_ + k ); - // z == nz_-1 plane - unsigned int offset = size - nx_ * ny_; - for ( unsigned int j = 0; j < ny_; ++j ) - for ( unsigned int k = 0; k < nx_; ++k ) - surface_.push_back( offset + j * nx_ + k ); - - // y == 0 plane - for ( unsigned int i = 0; i < nz_; ++i ) - for ( unsigned int k = 0; k < nx_; ++k ) - surface_.push_back( i * nx_ * ny_ + k ); - // y == ny_-1 plane - offset = nx_ * ( ny_ - 1 ); - for ( unsigned int i = 0; i < nz_; ++i ) - for ( unsigned int k = 0; k < nx_; ++k ) - surface_.push_back( offset + i * nx_ * ny_ + k ); - - // x == 0 plane - for ( unsigned int i = 0; i < nz_; ++i ) - for ( unsigned int j = 0; j < ny_; ++j ) - surface_.push_back( ( i * ny_ + j ) * nx_ ); - // x == nx_-1 plane - offset = nx_ - 1; - for ( unsigned int i = 0; i < nz_; ++i ) - for ( unsigned int j = 0; j < ny_; ++j ) - surface_.push_back( offset + ( i * ny_ + j ) * nx_ ); - - sort( surface_.begin(), surface_.end() ); - surface_.erase( unique( surface_.begin(), surface_.end() ), - surface_.end() ); + unsigned int size = nx_ * ny_ * nz_; + // z == 0 plane + for ( unsigned int j = 0; j < ny_; ++j ) + for ( unsigned int k = 0; k < nx_; ++k ) + surface_.push_back( j * nx_ + k ); + // z == nz_-1 plane + unsigned int offset = size - nx_ * ny_; + for ( unsigned int j = 0; j < ny_; ++j ) + for ( unsigned int k = 0; k < nx_; ++k ) + surface_.push_back( offset + j * nx_ + k ); + + // y == 0 plane + for ( unsigned int i = 0; i < nz_; ++i ) + for ( unsigned int k = 0; k < nx_; ++k ) + surface_.push_back( i * nx_ * ny_ + k ); + // y == ny_-1 plane + offset = nx_ * ( ny_ - 1 ); + for ( unsigned int i = 0; i < nz_; ++i ) + for ( unsigned int k = 0; k < nx_; ++k ) + surface_.push_back( offset + i * nx_ * ny_ + k ); + + // x == 0 plane + for ( unsigned int i = 0; i < nz_; ++i ) + for ( unsigned int j = 0; j < ny_; ++j ) + surface_.push_back( ( i * ny_ + j ) * nx_ ); + // x == nx_-1 plane + offset = nx_ - 1; + for ( unsigned int i = 0; i < nz_; ++i ) + for ( unsigned int j = 0; j < ny_; ++j ) + surface_.push_back( offset + ( i * ny_ + j ) * nx_ ); + + sort( surface_.begin(), surface_.end() ); + surface_.erase( unique( surface_.begin(), surface_.end() ), + surface_.end() ); } /** @@ -383,310 +390,317 @@ void CubeMesh::fillThreeDimSurface() // Need to fix duplicate points. */ void CubeMesh::updateCoords() { - swapIfBackward( x0_, x1_ ); - swapIfBackward( y0_, y1_ ); - swapIfBackward( z0_, z1_ ); - if ( preserveNumEntries_ ) { - dx_ = ( x1_ - x0_ ) / nx_; - dy_ = ( y1_ - y0_ ) / ny_; - dz_ = ( z1_ - z0_ ) / nz_; - } else { - nx_ = round( (x1_ - x0_) / dx_ ); - ny_ = round( (y1_ - y0_) / dy_ ); - nz_ = round( (z1_ - z0_) / dz_ ); - - if ( nx_ == 0 ) nx_ = 1; - if ( ny_ == 0 ) ny_ = 1; - if ( nz_ == 0 ) nz_ = 1; - } - - /// Temporarily fill out the whole cube for m2s and s2m. These - // will change for none-cube geometries. - unsigned int size = nx_ * ny_ * nz_; - m2s_.resize( size ); - s2m_.resize( size ); - for ( unsigned int i = 0; i < size; ++i ) { - m2s_[i] = s2m_[i] = i; - } - - // Fill out surface vector - surface_.resize( 0 ); - /* - if ( numDims() == 0 ) { - surface_.push_back( 0 ); - } else if ( numDims() == 1 ) { - surface_.push_back( 0 ); - if ( size > 1 ) - surface_.push_back( size - 1 ); - } else if ( numDims() == 2 ) { - fillTwoDimSurface(); - } else if ( numDims() == 3 ) { - fillThreeDimSurface(); - } - */ - fillThreeDimSurface(); - - // volume_ = ( x1_ - x0_ ) * ( y1_ - y0_ ) * ( z1_ - z0_ ); - assert( size >= 0 ); - - buildStencil(); + swapIfBackward( x0_, x1_ ); + swapIfBackward( y0_, y1_ ); + swapIfBackward( z0_, z1_ ); + if ( preserveNumEntries_ ) + { + dx_ = ( x1_ - x0_ ) / nx_; + dy_ = ( y1_ - y0_ ) / ny_; + dz_ = ( z1_ - z0_ ) / nz_; + } + else + { + nx_ = round( (x1_ - x0_) / dx_ ); + ny_ = round( (y1_ - y0_) / dy_ ); + nz_ = round( (z1_ - z0_) / dz_ ); + + if ( nx_ == 0 ) nx_ = 1; + if ( ny_ == 0 ) ny_ = 1; + if ( nz_ == 0 ) nz_ = 1; + } + + /// Temporarily fill out the whole cube for m2s and s2m. These + // will change for none-cube geometries. + unsigned int size = nx_ * ny_ * nz_; + m2s_.resize( size ); + s2m_.resize( size ); + for ( unsigned int i = 0; i < size; ++i ) + { + m2s_[i] = s2m_[i] = i; + } + + // Fill out surface vector + surface_.resize( 0 ); + /* + if ( numDims() == 0 ) { + surface_.push_back( 0 ); + } else if ( numDims() == 1 ) { + surface_.push_back( 0 ); + if ( size > 1 ) + surface_.push_back( size - 1 ); + } else if ( numDims() == 2 ) { + fillTwoDimSurface(); + } else if ( numDims() == 3 ) { + fillThreeDimSurface(); + } + */ + fillThreeDimSurface(); + + // volume_ = ( x1_ - x0_ ) * ( y1_ - y0_ ) * ( z1_ - z0_ ); + assert( size >= 0 ); + + buildStencil(); } void CubeMesh::setX0( double v ) { - x0_ = v; - updateCoords(); + x0_ = v; + updateCoords(); } double CubeMesh::getX0() const { - return x0_; + return x0_; } void CubeMesh::setY0( double v ) { - y0_ = v; - updateCoords(); + y0_ = v; + updateCoords(); } double CubeMesh::getY0() const { - return y0_; + return y0_; } void CubeMesh::setZ0( double v ) { - z0_ = v; - updateCoords(); + z0_ = v; + updateCoords(); } double CubeMesh::getZ0() const { - return z0_; + return z0_; } void CubeMesh::setX1( double v ) { - x1_ = v; - updateCoords(); + x1_ = v; + updateCoords(); } double CubeMesh::getX1() const { - return x1_; + return x1_; } void CubeMesh::setY1( double v ) { - y1_ = v; - updateCoords(); + y1_ = v; + updateCoords(); } double CubeMesh::getY1() const { - return y1_; + return y1_; } void CubeMesh::setZ1( double v ) { - z1_ = v; - updateCoords(); + z1_ = v; + updateCoords(); } double CubeMesh::getZ1() const { - return z1_; + return z1_; } void CubeMesh::setDx( double v ) { - dx_ = v; - updateCoords(); + dx_ = v; + updateCoords(); } double CubeMesh::getDx() const { - return dx_; + return dx_; } void CubeMesh::setDy( double v ) { - dy_ = v; - updateCoords(); + dy_ = v; + updateCoords(); } double CubeMesh::getDy() const { - return dy_; + return dy_; } void CubeMesh::setDz( double v ) { - dz_ = v; - updateCoords(); + dz_ = v; + updateCoords(); } double CubeMesh::getDz() const { - return dz_; + return dz_; } void CubeMesh::setNx( unsigned int v ) { - nx_ = v; - updateCoords(); + nx_ = v; + updateCoords(); } unsigned int CubeMesh::getNx() const { - return nx_; + return nx_; } void CubeMesh::setNy( unsigned int v ) { - ny_ = v; - updateCoords(); + ny_ = v; + updateCoords(); } unsigned int CubeMesh::getNy() const { - return ny_; + return ny_; } void CubeMesh::setNz( unsigned int v ) { - nz_ = v; - updateCoords(); + nz_ = v; + updateCoords(); } unsigned int CubeMesh::getNz() const { - return nz_; + return nz_; } void CubeMesh::setIsToroid( bool v ) { - isToroid_ = v; + isToroid_ = v; } bool CubeMesh::getIsToroid() const { - return isToroid_; + return isToroid_; } void CubeMesh::setPreserveNumEntries( bool v ) { - preserveNumEntries_ = v; + preserveNumEntries_ = v; } bool CubeMesh::getPreserveNumEntries() const { - return preserveNumEntries_; + return preserveNumEntries_; } void CubeMesh::setAlwaysDiffuse( bool v ) { - alwaysDiffuse_ = v; + alwaysDiffuse_ = v; } bool CubeMesh::getAlwaysDiffuse() const { - // alwaysDiffuse is normally false. - return alwaysDiffuse_; + // alwaysDiffuse is normally false. + return alwaysDiffuse_; } void CubeMesh::innerSetCoords( const vector< double >& v) { - if ( v.size() < 6 ) - return; + if ( v.size() < 6 ) + return; - x0_ = v[0]; - y0_ = v[1]; - z0_ = v[2]; + x0_ = v[0]; + y0_ = v[1]; + z0_ = v[2]; - x1_ = v[3]; - y1_ = v[4]; - z1_ = v[5]; + x1_ = v[3]; + y1_ = v[4]; + z1_ = v[5]; - bool temp = preserveNumEntries_; - if ( v.size() >= 9 ) { - dx_ = v[6]; - dy_ = v[7]; - dz_ = v[8]; - preserveNumEntries_ = 0; - } else { - preserveNumEntries_ = 1; - } - updateCoords(); - preserveNumEntries_ = temp; + bool temp = preserveNumEntries_; + if ( v.size() >= 9 ) + { + dx_ = v[6]; + dy_ = v[7]; + dz_ = v[8]; + preserveNumEntries_ = 0; + } + else + { + preserveNumEntries_ = 1; + } + updateCoords(); + preserveNumEntries_ = temp; } void CubeMesh::setCoords( const Eref& e, vector< double > v) { - // double oldVol = getMeshEntryVolume( 0 ); - innerSetCoords( v ); - ChemCompt::voxelVolOut()->send( e, vGetVoxelVolume() ); + // double oldVol = getMeshEntryVolume( 0 ); + innerSetCoords( v ); + ChemCompt::voxelVolOut()->send( e, vGetVoxelVolume() ); } vector< double > CubeMesh::getCoords( const Eref& e ) const { - vector< double > ret( 9 ); + vector< double > ret( 9 ); - ret[0] = x0_; - ret[1] = y0_; - ret[2] = z0_; + ret[0] = x0_; + ret[1] = y0_; + ret[2] = z0_; - ret[3] = x1_; - ret[4] = y1_; - ret[5] = z1_; + ret[3] = x1_; + ret[4] = y1_; + ret[5] = z1_; - ret[6] = dx_; - ret[7] = dy_; - ret[8] = dz_; + ret[6] = dx_; + ret[7] = dy_; + ret[8] = dz_; - return ret; + return ret; } void CubeMesh::setMeshToSpace( vector< unsigned int > v ) { - m2s_ = v; - deriveS2mFromM2s(); + m2s_ = v; + deriveS2mFromM2s(); } vector< unsigned int > CubeMesh::getMeshToSpace() const { - return m2s_; + return m2s_; } void CubeMesh::setSpaceToMesh( vector< unsigned int > v ) { - s2m_ = v; - deriveM2sFromS2m(); + s2m_ = v; + deriveM2sFromS2m(); } vector< unsigned int > CubeMesh::getSpaceToMesh() const { - return s2m_; + return s2m_; } void CubeMesh::setSurface( vector< unsigned int > v ) { - surface_ = v; + surface_ = v; } vector< unsigned int > CubeMesh::getSurface() const { - return surface_; + return surface_; } unsigned int CubeMesh::innerGetDimensions() const { - return 3; + return 3; } @@ -696,7 +710,7 @@ unsigned int CubeMesh::innerGetDimensions() const void CubeMesh::buildMesh( Id geom, double x, double y, double z ) { - ; + ; } /** @@ -705,62 +719,65 @@ void CubeMesh::buildMesh( Id geom, double x, double y, double z ) * the nearest cube */ void CubeMesh::innerBuildDefaultMesh( const Eref& e, - double volume, unsigned int numEntries ) -{ - double approxN = numEntries; - approxN = pow( approxN, 1.0 / 3.0 ); - unsigned int smaller = floor( approxN ); - unsigned int bigger = ceil( approxN ); - unsigned int numSide; - if ( smaller != bigger ) { - numSide = smaller; - } else { - unsigned int smallerVol = smaller * smaller * smaller; - unsigned int biggerVol = bigger * bigger * bigger; - if ( numEntries - smallerVol < biggerVol - numEntries ) - numSide = smaller; - else - numSide = bigger; - } - double side = pow( volume, 1.0 / 3.0 ); - vector< double > coords( 9, side ); - coords[0] = coords[1] = coords[2] = 0; - coords[6] = coords[7] = coords[8] = side / numSide; - nx_ = ny_ = nz_ = numSide; - setCoords( e, coords ); + double volume, unsigned int numEntries ) +{ + double approxN = numEntries; + approxN = pow( approxN, 1.0 / 3.0 ); + unsigned int smaller = floor( approxN ); + unsigned int bigger = ceil( approxN ); + unsigned int numSide; + if ( smaller != bigger ) + { + numSide = smaller; + } + else + { + unsigned int smallerVol = smaller * smaller * smaller; + unsigned int biggerVol = bigger * bigger * bigger; + if ( numEntries - smallerVol < biggerVol - numEntries ) + numSide = smaller; + else + numSide = bigger; + } + double side = pow( volume, 1.0 / 3.0 ); + vector< double > coords( 9, side ); + coords[0] = coords[1] = coords[2] = 0; + coords[6] = coords[7] = coords[8] = side / numSide; + nx_ = ny_ = nz_ = numSide; + setCoords( e, coords ); } /// More inherited virtual funcs: request comes in for mesh stats void CubeMesh::innerHandleRequestMeshStats( const Eref& e, - const SrcFinfo2< unsigned int, vector< double > >* meshStatsFinfo ) + const SrcFinfo2< unsigned int, vector< double > >* meshStatsFinfo ) { - vector< double > meshVolumes( 1, dx_ * dy_ * dz_ ); - meshStatsFinfo->send( e, nx_ * ny_ * nz_, meshVolumes); + vector< double > meshVolumes( 1, dx_ * dy_ * dz_ ); + meshStatsFinfo->send( e, nx_ * ny_ * nz_, meshVolumes); } /// Generate node decomposition of mesh, send it out along /// meshSplitFinfo msg void CubeMesh::innerHandleNodeInfo( - const Eref& e, - unsigned int numNodes, unsigned int numThreads ) -{ - /* - unsigned int numEntries = nx_ * ny_ * nz_ ; - vector< double > vols( numEntries, dx_ * dy_ * dz_ ); - vector< unsigned int > localEntries( numEntries ); - vector< vector< unsigned int > > outgoingEntries; - vector< vector< unsigned int > > incomingEntries; - double oldvol = getMeshEntryVolume( 0 ); - meshSplit()->send( e, - oldvol, - vols, localEntries, - outgoingEntries, incomingEntries ); - */ + const Eref& e, + unsigned int numNodes, unsigned int numThreads ) +{ + /* + unsigned int numEntries = nx_ * ny_ * nz_ ; + vector< double > vols( numEntries, dx_ * dy_ * dz_ ); + vector< unsigned int > localEntries( numEntries ); + vector< vector< unsigned int > > outgoingEntries; + vector< vector< unsigned int > > incomingEntries; + double oldvol = getMeshEntryVolume( 0 ); + meshSplit()->send( e, + oldvol, + vols, localEntries, + outgoingEntries, incomingEntries ); + */ } double CubeMesh::vGetEntireVolume() const { - return fabs( (x1_ - x0_) * (y1_ - y0_) * (z1_ - z0_) ); + return fabs( (x1_ - x0_) * (y1_ - y0_) * (z1_ - z0_) ); } @@ -771,116 +788,117 @@ double CubeMesh::vGetEntireVolume() const /// Virtual function to return MeshType of specified entry. unsigned int CubeMesh::getMeshType( unsigned int fid ) const { - return CUBOID; + return CUBOID; } /// Virtual function to return dimensions of specified entry. unsigned int CubeMesh::getMeshDimensions( unsigned int fid ) const { - return 3; + return 3; } /// Virtual function to return volume of mesh Entry. double CubeMesh::getMeshEntryVolume( unsigned int fid ) const { - return dx_ * dy_ * dz_; + return dx_ * dy_ * dz_; } /// Virtual function to return volume of mesh Entry, including // for diffusively coupled voxels from other solvers. double CubeMesh::extendedMeshEntryVolume( unsigned int fid ) const { - if ( fid >= m2s_.size() ) { - return MeshCompt::extendedMeshEntryVolume( fid - m2s_.size() ); - } - return dx_ * dy_ * dz_; + if ( fid >= m2s_.size() ) + { + return MeshCompt::extendedMeshEntryVolume( fid - m2s_.size() ); + } + return dx_ * dy_ * dz_; } /// Virtual function to return coords of mesh Entry. /// For Cuboid mesh, coords are x1y1z1 x2y2z2 vector< double > CubeMesh::getCoordinates( unsigned int fid ) const { - assert( fid < m2s_.size() ); - unsigned int spaceIndex = m2s_[fid]; + assert( fid < m2s_.size() ); + unsigned int spaceIndex = m2s_[fid]; - unsigned int ix = spaceIndex % nx_; - unsigned int iy = (spaceIndex / nx_) % ny_; - unsigned int iz = (spaceIndex / ( nx_ * ny_ )) % nz_; + unsigned int ix = spaceIndex % nx_; + unsigned int iy = (spaceIndex / nx_) % ny_; + unsigned int iz = (spaceIndex / ( nx_ * ny_ )) % nz_; - vector< double > ret( 6 ); - ret[0] = x0_ + ix * dx_; - ret[1] = y0_ + iy * dy_; - ret[2] = z0_ + iz * dz_; + vector< double > ret( 6 ); + ret[0] = x0_ + ix * dx_; + ret[1] = y0_ + iy * dy_; + ret[2] = z0_ + iz * dz_; - ret[3] = x0_ + ix * dx_ + dx_; - ret[4] = y0_ + iy * dy_ + dx_; - ret[5] = z0_ + iz * dz_ + dx_; + ret[3] = x0_ + ix * dx_ + dx_; + ret[4] = y0_ + iy * dy_ + dx_; + ret[5] = z0_ + iz * dz_ + dx_; - return ret; + return ret; } unsigned int CubeMesh::neighbor( unsigned int spaceIndex, - int dx, int dy, int dz ) const + int dx, int dy, int dz ) const { - int ix = spaceIndex % nx_; - int iy = (spaceIndex / nx_) % ny_; - int iz = (spaceIndex / ( nx_ * ny_ )) % nz_; + int ix = spaceIndex % nx_; + int iy = (spaceIndex / nx_) % ny_; + int iz = (spaceIndex / ( nx_ * ny_ )) % nz_; - ix += dx; - iy += dy; - iz += dz; + ix += dx; + iy += dy; + iz += dz; - if ( ix < 0 || ix >= static_cast< int >( nx_ ) ) - return EMPTY; - if ( iy < 0 || iy >= static_cast< int >( ny_ ) ) - return EMPTY; - if ( iz < 0 || iz >= static_cast< int >( nz_ ) ) - return EMPTY; + if ( ix < 0 || ix >= static_cast< int >( nx_ ) ) + return EMPTY; + if ( iy < 0 || iy >= static_cast< int >( ny_ ) ) + return EMPTY; + if ( iz < 0 || iz >= static_cast< int >( nz_ ) ) + return EMPTY; - unsigned int nIndex = ( ( iz * ny_ ) + iy ) * nx_ + ix; + unsigned int nIndex = ( ( iz * ny_ ) + iy ) * nx_ + ix; - return s2m_[nIndex]; + return s2m_[nIndex]; } /// Virtual function to return diffusion X-section area for each neighbor vector< double > CubeMesh::getDiffusionArea( unsigned int fid ) const { - assert( fid < m2s_.size() ); + assert( fid < m2s_.size() ); - vector< double > ret; - unsigned int spaceIndex = m2s_[fid]; + vector< double > ret; + unsigned int spaceIndex = m2s_[fid]; - unsigned int nIndex = neighbor( spaceIndex, 0, 0, 1 ); - if ( nIndex != EMPTY ) - ret.push_back( dx_ * dy_ ); + unsigned int nIndex = neighbor( spaceIndex, 0, 0, 1 ); + if ( nIndex != EMPTY ) + ret.push_back( dx_ * dy_ ); - nIndex = neighbor( spaceIndex, 0, 0, -1 ); - if ( nIndex != EMPTY ) - ret.push_back( dx_ * dy_ ); + nIndex = neighbor( spaceIndex, 0, 0, -1 ); + if ( nIndex != EMPTY ) + ret.push_back( dx_ * dy_ ); - nIndex = neighbor( spaceIndex, 0, 1, 0 ); - if ( nIndex != EMPTY ) - ret.push_back( dz_ * dx_ ); + nIndex = neighbor( spaceIndex, 0, 1, 0 ); + if ( nIndex != EMPTY ) + ret.push_back( dz_ * dx_ ); - nIndex = neighbor( spaceIndex, 0, -1, 0 ); - if ( nIndex != EMPTY ) - ret.push_back( dz_ * dx_ ); + nIndex = neighbor( spaceIndex, 0, -1, 0 ); + if ( nIndex != EMPTY ) + ret.push_back( dz_ * dx_ ); - nIndex = neighbor( spaceIndex, 1, 0, 0 ); - if ( nIndex != EMPTY ) - ret.push_back( dy_ * dz_ ); + nIndex = neighbor( spaceIndex, 1, 0, 0 ); + if ( nIndex != EMPTY ) + ret.push_back( dy_ * dz_ ); - nIndex = neighbor( spaceIndex, -1, 0, 0 ); - if ( nIndex != EMPTY ) - ret.push_back( dy_ * dz_ ); + nIndex = neighbor( spaceIndex, -1, 0, 0 ); + if ( nIndex != EMPTY ) + ret.push_back( dy_ * dz_ ); - return ret; + return ret; } /// Virtual function to return scale factor for diffusion. 1 here. vector< double > CubeMesh::getDiffusionScaling( unsigned int fid ) const { - return vector< double >( 6, 1.0 ); + return vector< double >( 6, 1.0 ); } ////////////////////////////////////////////////////////////////// @@ -890,7 +908,7 @@ vector< double > CubeMesh::getDiffusionScaling( unsigned int fid ) const */ unsigned int CubeMesh::innerGetNumEntries() const { - return m2s_.size(); + return m2s_.size(); } /** @@ -898,159 +916,170 @@ unsigned int CubeMesh::innerGetNumEntries() const */ void CubeMesh::innerSetNumEntries( unsigned int n ) { - cout << "Warning: CubeMesh::innerSetNumEntries is readonly.\n"; + cout << "Warning: CubeMesh::innerSetNumEntries is readonly.\n"; } // We assume this is linear diffusion for now. Fails for 2 or 3-D diffusion vector< unsigned int > CubeMesh::getParentVoxel() const { - unsigned int numEntries = innerGetNumEntries(); - vector< unsigned int > ret( numEntries ); - if ( numEntries > 0 ) - ret[0] = static_cast< unsigned int >( -1 ); - for (unsigned int i = 1; i < numEntries; ++i ) - ret[i] = i-1; + unsigned int numEntries = innerGetNumEntries(); + vector< unsigned int > ret( numEntries ); + if ( numEntries > 0 ) + ret[0] = static_cast< unsigned int >( -1 ); + for (unsigned int i = 1; i < numEntries; ++i ) + ret[i] = i-1; - return ret; + return ret; } const vector< double >& CubeMesh::vGetVoxelVolume() const { - static vector< double > vol; - vol.clear(); - vol.resize( nx_ * ny_ * nz_, dx_ * dy_ * dz_ ); - return vol; + static vector< double > vol; + vol.clear(); + vol.resize( nx_ * ny_ * nz_, dx_ * dy_ * dz_ ); + return vol; } const vector< double >& CubeMesh::vGetVoxelMidpoint() const { - static vector< double > midpoint; - midpoint.resize( m2s_.size() * 3 ); - for ( unsigned int i = 0; i < m2s_.size(); ++i ) // x coords. Lowest. - midpoint[i] = x0_ + ( 0.5 + (m2s_[i] % nx_ ) ) * dx_; - for ( unsigned int i = 0; i < m2s_.size(); ++i ) { // y coords. Middle. - unsigned int k = i + m2s_.size(); - midpoint[k] = y0_ + ( 0.5 + ( (m2s_[i] / nx_) % ny_ ) ) * dy_; - } - for ( unsigned int i = 0; i < m2s_.size(); ++i ) { // z coords. Top. - unsigned int k = i + m2s_.size() * 2; - midpoint[k] = z0_ + ( 0.5 + ( m2s_[i] / ( nx_ * ny_ ) ) ) * dz_; - } - return midpoint; + static vector< double > midpoint; + midpoint.resize( m2s_.size() * 3 ); + for ( unsigned int i = 0; i < m2s_.size(); ++i ) // x coords. Lowest. + midpoint[i] = x0_ + ( 0.5 + (m2s_[i] % nx_ ) ) * dx_; + for ( unsigned int i = 0; i < m2s_.size(); ++i ) // y coords. Middle. + { + unsigned int k = i + m2s_.size(); + midpoint[k] = y0_ + ( 0.5 + ( (m2s_[i] / nx_) % ny_ ) ) * dy_; + } + for ( unsigned int i = 0; i < m2s_.size(); ++i ) // z coords. Top. + { + unsigned int k = i + m2s_.size() * 2; + midpoint[k] = z0_ + ( 0.5 + ( m2s_[i] / ( nx_ * ny_ ) ) ) * dz_; + } + return midpoint; } const vector< double >& CubeMesh::getVoxelArea() const { - static vector< double > area; - if ( nx_ * ny_ == 1 ) - area.resize( nz_, dx_ * dy_ ); - else if ( nx_ * nz_ == 1 ) - area.resize( ny_, dx_ * dz_ ); - else if ( ny_ * nz_ == 1 ) - area.resize( nx_, dy_ * dz_ ); - else - area.resize( nx_, dy_ * dz_ ); // Just put in a number. - assert( area.size() == nx_ * ny_ * nz_ ); - return area; + static vector< double > area; + if ( nx_ * ny_ == 1 ) + area.resize( nz_, dx_ * dy_ ); + else if ( nx_ * nz_ == 1 ) + area.resize( ny_, dx_ * dz_ ); + else if ( ny_ * nz_ == 1 ) + area.resize( nx_, dy_ * dz_ ); + else + area.resize( nx_, dy_ * dz_ ); // Just put in a number. + assert( area.size() == nx_ * ny_ * nz_ ); + return area; } const vector< double >& CubeMesh::getVoxelLength() const { - static vector< double > length; - if ( dx_ > dy_ && dx_ > dz_ ) - length.assign( innerGetNumEntries(), dx_ ); - else if ( dy_ > dz_ ) - length.assign( innerGetNumEntries(), dy_ ); - else - length.assign( innerGetNumEntries(), dz_ ); - return length; + static vector< double > length; + if ( dx_ > dy_ && dx_ > dz_ ) + length.assign( innerGetNumEntries(), dx_ ); + else if ( dy_ > dz_ ) + length.assign( innerGetNumEntries(), dy_ ); + else + length.assign( innerGetNumEntries(), dz_ ); + return length; } bool CubeMesh::vSetVolumeNotRates( double vol ) { - // Leave x0,y0.z0 and nx,ny,nz the same. Do NOT update any rates. - double oldvol = vGetEntireVolume(); - double linscale = pow( vol / oldvol , 1.0 / 3.0 ); - dx_ *= linscale; - dy_ *= linscale; - dz_ *= linscale; - x1_ = x0_ + dx_; - y1_ = y0_ + dy_; - z1_ = z0_ + dz_; + // Leave x0,y0.z0 and nx,ny,nz the same. Do NOT update any rates. + double oldvol = vGetEntireVolume(); + double linscale = pow( vol / oldvol, 1.0 / 3.0 ); + dx_ *= linscale; + dy_ *= linscale; + dz_ *= linscale; + x1_ = x0_ + dx_; + y1_ = y0_ + dy_; + z1_ = z0_ + dz_; - return true; + return true; } ////////////////////////////////////////////////////////////////// bool CubeMesh::isInsideCuboid( double x, double y, double z ) const { - return ( x >= x0_ && x < x1_ && y >= y0_ && y < y1_ && - z >= z0_ && z < z1_ ); + return ( x >= x0_ && x < x1_ && y >= y0_ && y < y1_ && + z >= z0_ && z < z1_ ); } bool CubeMesh::isInsideSpheroid( double x, double y, double z ) const { - double cx = ( x0_ + x1_ ) / 2.0; - double cy = ( y0_ + y1_ ) / 2.0; - double cz = ( z0_ + z1_ ) / 2.0; + double cx = ( x0_ + x1_ ) / 2.0; + double cy = ( y0_ + y1_ ) / 2.0; + double cz = ( z0_ + z1_ ) / 2.0; - double rx = ( x - cx ) / fabs( x1_ - x0_ ) / 2.0; - double ry = ( y - cy ) / fabs( y1_ - y0_ ) / 2.0; - double rz = ( z - cz ) / fabs( z1_ - z0_ ) / 2.0; + double rx = ( x - cx ) / fabs( x1_ - x0_ ) / 2.0; + double ry = ( y - cy ) / fabs( y1_ - y0_ ) / 2.0; + double rz = ( z - cz ) / fabs( z1_ - z0_ ) / 2.0; - return ( ( rx * rx + ry * ry + rz * rz ) < 1.0 ); + return ( ( rx * rx + ry * ry + rz * rz ) < 1.0 ); } void CubeMesh::fillSpaceToMeshLookup() { - static const unsigned int flag = EMPTY; - unsigned int num = 0; - unsigned int q = 0; - m2s_.clear(); - s2m_.resize( nx_ * ny_ * nz_, flag ); - for( unsigned int k = 0; k < nz_; ++k ) { - double z = k * dz_ + z0_; - for( unsigned int j = 0; j < ny_; ++j ) { - double y = j * dy_ + y0_; - for( unsigned int i = 0; i < nx_; ++i ) { - double x = i * dx_ + x0_; - if ( isInsideCuboid( x, y, z ) ) { - s2m_[q] = num; - m2s_.push_back( q ); - ++num; - } else { - s2m_[q] = flag; - } - ++q; - } - } - } - assert( m2s_.size() == num ); + static const unsigned int flag = EMPTY; + unsigned int num = 0; + unsigned int q = 0; + m2s_.clear(); + s2m_.resize( nx_ * ny_ * nz_, flag ); + for( unsigned int k = 0; k < nz_; ++k ) + { + double z = k * dz_ + z0_; + for( unsigned int j = 0; j < ny_; ++j ) + { + double y = j * dy_ + y0_; + for( unsigned int i = 0; i < nx_; ++i ) + { + double x = i * dx_ + x0_; + if ( isInsideCuboid( x, y, z ) ) + { + s2m_[q] = num; + m2s_.push_back( q ); + ++num; + } + else + { + s2m_[q] = flag; + } + ++q; + } + } + } + assert( m2s_.size() == num ); } // Reads off s2m to build m2s. void CubeMesh::deriveM2sFromS2m() { - m2s_.clear(); - assert( s2m_.size() == nx_ * ny_ * nz_ ); - for ( unsigned int i = 0; i < s2m_.size(); ++i ) { - if ( s2m_[i] != EMPTY ) { - m2s_.push_back( i ); - assert( m2s_.size() == s2m_[i] + 1 ); - } - } - buildStencil(); + m2s_.clear(); + assert( s2m_.size() == nx_ * ny_ * nz_ ); + for ( unsigned int i = 0; i < s2m_.size(); ++i ) + { + if ( s2m_[i] != EMPTY ) + { + m2s_.push_back( i ); + assert( m2s_.size() == s2m_[i] + 1 ); + } + } + buildStencil(); } void CubeMesh::deriveS2mFromM2s() { - s2m_.clear(); - s2m_.resize( nx_ * ny_ * nz_, EMPTY ); - for ( unsigned int i = 0; i < m2s_.size(); ++i ) { - s2m_[ m2s_[i] ] = i; - } - buildStencil(); + s2m_.clear(); + s2m_.resize( nx_ * ny_ * nz_, EMPTY ); + for ( unsigned int i = 0; i < m2s_.size(); ++i ) + { + s2m_[ m2s_[i] ] = i; + } + buildStencil(); } // This is a general version of the function, just relies on the @@ -1059,222 +1088,235 @@ void CubeMesh::deriveS2mFromM2s() void CubeMesh::buildStencil() { - static const unsigned int flag = EMPTY; - - - // fillSpaceToMeshLookup(); - unsigned int num = m2s_.size(); - setStencilSize( num, num ); - for ( unsigned int i = 0; i < num; ++i ) { - unsigned int q = m2s_[i]; - unsigned int ix = q % nx_; - unsigned int iy = ( q / nx_ ) % ny_; - unsigned int iz = ( q / ( nx_ * ny_ ) ) % nz_; - vector< double > entry; - vector< unsigned int > colIndex; - vector< Ecol > e; - - if ( ix > 0 && s2m_[q-1] != flag ) { - e.push_back( Ecol( dy_ * dz_ / dx_, s2m_[q-1] ) ); - } - if ( ( ix < nx_ - 1 ) && s2m_[q+1] != flag ) { - e.push_back( Ecol( dy_ * dz_ / dx_, s2m_[q+1] ) ); - } - if ( iy > 0 && s2m_[ q-nx_ ] != flag ) { - assert( q >= nx_ ); - e.push_back( Ecol( dx_ * dz_ / dy_, s2m_[q-nx_] ) ); - } - if ( iy < ny_ - 1 && s2m_[ q+nx_ ] != flag ) { - assert( q+nx_ < s2m_.size() ); - e.push_back( Ecol( dx_ * dz_ / dy_, s2m_[q+nx_] ) ); - } - if ( iz > 0 && s2m_[ q - nx_*ny_ ] != flag ) { - assert( q >= nx_ * ny_ ); - e.push_back( Ecol( dx_ * dy_ / dz_, s2m_[q - nx_ * ny_] ) ); - } - if ( iz < nz_ - 1 && s2m_[ q + nx_*ny_ ] ) { - assert( q+nx_ < s2m_.size() ); - e.push_back( Ecol( dx_ * dy_ / dz_, s2m_[q + nx_ * ny_] ) ); - } - sort( e.begin(), e.end() ); - for ( vector< Ecol >::iterator j = e.begin(); j != e.end(); ++j ) { - entry.push_back( j->e_ ); - colIndex.push_back( j->col_ ); - } - addRow( i, entry, colIndex ); - } - innerResetStencil(); + static const unsigned int flag = EMPTY; + + + // fillSpaceToMeshLookup(); + unsigned int num = m2s_.size(); + setStencilSize( num, num ); + for ( unsigned int i = 0; i < num; ++i ) + { + unsigned int q = m2s_[i]; + unsigned int ix = q % nx_; + unsigned int iy = ( q / nx_ ) % ny_; + unsigned int iz = ( q / ( nx_ * ny_ ) ) % nz_; + vector< double > entry; + vector< unsigned int > colIndex; + vector< Ecol > e; + + if ( ix > 0 && s2m_[q-1] != flag ) + { + e.push_back( Ecol( dy_ * dz_ / dx_, s2m_[q-1] ) ); + } + if ( ( ix < nx_ - 1 ) && s2m_[q+1] != flag ) + { + e.push_back( Ecol( dy_ * dz_ / dx_, s2m_[q+1] ) ); + } + if ( iy > 0 && s2m_[ q-nx_ ] != flag ) + { + assert( q >= nx_ ); + e.push_back( Ecol( dx_ * dz_ / dy_, s2m_[q-nx_] ) ); + } + if ( iy < ny_ - 1 && s2m_[ q+nx_ ] != flag ) + { + assert( q+nx_ < s2m_.size() ); + e.push_back( Ecol( dx_ * dz_ / dy_, s2m_[q+nx_] ) ); + } + if ( iz > 0 && s2m_[ q - nx_*ny_ ] != flag ) + { + assert( q >= nx_ * ny_ ); + e.push_back( Ecol( dx_ * dy_ / dz_, s2m_[q - nx_ * ny_] ) ); + } + if ( iz < nz_ - 1 && s2m_[ q + nx_*ny_ ] ) + { + assert( q+nx_ < s2m_.size() ); + e.push_back( Ecol( dx_ * dy_ / dz_, s2m_[q + nx_ * ny_] ) ); + } + sort( e.begin(), e.end() ); + for ( vector< Ecol >::iterator j = e.begin(); j != e.end(); ++j ) + { + entry.push_back( j->e_ ); + colIndex.push_back( j->col_ ); + } + addRow( i, entry, colIndex ); + } + innerResetStencil(); } ////////////////////////////////////////////////////////////////// const vector< unsigned int >& CubeMesh::surface() const { - return surface_; + return surface_; } // For now: Just brute force through the surface list. // Surface list applies only if 2 or 3 D. -void CubeMesh::matchMeshEntries( const ChemCompt* other, - vector< VoxelJunction >& ret ) const -{ - const CubeMesh* cm = dynamic_cast< const CubeMesh* >( other ); - - if ( cm ) { - if ( alwaysDiffuse_ ) - matchAllEntries( cm, ret ); - else - matchCubeMeshEntries( cm, ret ); - /* - if ( compareMeshSpacing( cm ) == 0 ) { // Equal spacing. - matchSameSpacing( cm, ret ); - } else if ( compareMeshSpacing( cm ) == -1 ) { // self is finer - cout << "Warning:CubeMesh::matchMeshEntries: cannot yet handle unequal meshes\n"; - } else { // other is finer. - cout << "Warning:CubeMesh::matchMeshEntries: cannot yet handle unequal meshes\n"; - } - */ - return; - } - const EndoMesh* em = dynamic_cast< const EndoMesh* >( other ); - if ( em ) { +void CubeMesh::matchMeshEntries(const ChemCompt* other, vector< VoxelJunction >& ret) const +{ + const CubeMesh* cm = dynamic_cast< const CubeMesh* >( other ); + + if ( cm ) + { + if ( alwaysDiffuse_ ) + matchAllEntries( cm, ret ); + else + matchCubeMeshEntries( cm, ret ); + /* + if ( compareMeshSpacing( cm ) == 0 ) { // Equal spacing. + matchSameSpacing( cm, ret ); + } else if ( compareMeshSpacing( cm ) == -1 ) { // self is finer + cout << "Warning:CubeMesh::matchMeshEntries: cannot yet handle unequal meshes\n"; + } else { // other is finer. + cout << "Warning:CubeMesh::matchMeshEntries: cannot yet handle unequal meshes\n"; + } + */ + return; + } + const EndoMesh* em = dynamic_cast< const EndoMesh* >( other ); + if ( em ) + { em->matchMeshEntries( this, ret ); flipRet( ret ); - return; - } - cout << "Warning:CubeMesh::matchMeshEntries: cannot yet handle Neuro or Cyl meshes.\n"; + return; + } + cout << "Warning:CubeMesh::matchMeshEntries: cannot yet handle Neuro or Cyl meshes.\n"; } unsigned int CubeMesh::numDims() const { - return ( ( nx_ > 1 ) + ( ny_ > 1 ) + ( nz_ > 1 ) ); + return ( ( nx_ > 1 ) + ( ny_ > 1 ) + ( nz_ > 1 ) ); } void CubeMesh::indexToSpace( unsigned int index, - double& x, double& y, double& z ) const + double& x, double& y, double& z ) const { - assert ( index < nx_ * ny_ * nz_ ); + assert ( index < nx_ * ny_ * nz_ ); - // index = m2s_[index]; - unsigned int ix = index % nx_; - index /= nx_; - unsigned int iy = index % ny_; - index /= ny_; - unsigned int iz = index % nz_; + // index = m2s_[index]; + unsigned int ix = index % nx_; + index /= nx_; + unsigned int iy = index % ny_; + index /= ny_; + unsigned int iz = index % nz_; - x = x0_ + ix * dx_ + dx_ * 0.5; - y = y0_ + iy * dy_ + dy_ * 0.5; - z = z0_ + iz * dz_ + dz_ * 0.5; + x = x0_ + ix * dx_ + dx_ * 0.5; + y = y0_ + iy * dy_ + dy_ * 0.5; + z = z0_ + iz * dz_ + dz_ * 0.5; } unsigned int CubeMesh::spaceToIndex( double x, double y, double z ) const { - if ( x > x0_ && x < x1_ && y > y0_ && y < y1_ && z > z0_ && z < z1_ ) - { - unsigned int ix = ( x - x0_ ) / dx_; - unsigned int iy = ( y - y0_ ) / dy_; - unsigned int iz = ( z - z0_ ) / dz_; - unsigned int index = ( iz * ny_ + iy ) * nx_ + ix; - unsigned int innerIndex = s2m_[ index ]; - return innerIndex; - } - return EMPTY; + if ( x > x0_ && x < x1_ && y > y0_ && y < y1_ && z > z0_ && z < z1_ ) + { + unsigned int ix = ( x - x0_ ) / dx_; + unsigned int iy = ( y - y0_ ) / dy_; + unsigned int iz = ( z - z0_ ) / dz_; + unsigned int index = ( iz * ny_ + iy ) * nx_ + ix; + unsigned int innerIndex = s2m_[ index ]; + return innerIndex; + } + return EMPTY; } double CubeMesh::nearest( double x, double y, double z, - unsigned int& index ) const -{ - if ( x > x0_ && x < x1_ && y > y0_ && y < y1_ && z > z0_ && z < z1_ ) - { - unsigned int ix = ( x - x0_ ) / dx_; - unsigned int iy = ( y - y0_ ) / dy_; - unsigned int iz = ( z - z0_ ) / dz_; - index = ( iz * ny_ + iy ) * nx_ + ix; - unsigned int innerIndex = s2m_[ index ]; - if ( innerIndex != EMPTY ) { // Inside filled volume - index = innerIndex; - double tx = x0_ + ix * dx_ + dx_ * 0.5; - double ty = y0_ + iy * dy_ + dy_ * 0.5; - double tz = z0_ + iz * dz_ + dz_ * 0.5; - return distance( x - tx, y - ty, z - tz ); - } else { // Outside volume. Look over surface for nearest. - double rmin = 1e99; - for ( vector< unsigned int >::const_iterator - i = surface_.begin(); i != surface_.end(); ++i ) - { - double tx, ty, tz; - indexToSpace( *i, tx, ty, tz ); - double r = distance( tx - x, ty - y, tz - z ); - if ( rmin > r ) { - rmin = r; - index = *i; - } - } - return -rmin; // Negative distance indicates xyz is outside vol - } - } - // Should really figure out nearest corner anyway. - index = 0; - return -1.0; + unsigned int& index ) const +{ + if ( x > x0_ && x < x1_ && y > y0_ && y < y1_ && z > z0_ && z < z1_ ) + { + unsigned int ix = ( x - x0_ ) / dx_; + unsigned int iy = ( y - y0_ ) / dy_; + unsigned int iz = ( z - z0_ ) / dz_; + index = ( iz * ny_ + iy ) * nx_ + ix; + unsigned int innerIndex = s2m_[ index ]; + if ( innerIndex != EMPTY ) // Inside filled volume + { + index = innerIndex; + double tx = x0_ + ix * dx_ + dx_ * 0.5; + double ty = y0_ + iy * dy_ + dy_ * 0.5; + double tz = z0_ + iz * dz_ + dz_ * 0.5; + return distance( x - tx, y - ty, z - tz ); + } + else // Outside volume. Look over surface for nearest. + { + double rmin = 1e99; + for ( vector< unsigned int >::const_iterator + i = surface_.begin(); i != surface_.end(); ++i ) + { + double tx, ty, tz; + indexToSpace( *i, tx, ty, tz ); + double r = distance( tx - x, ty - y, tz - z ); + if ( rmin > r ) + { + rmin = r; + index = *i; + } + } + return -rmin; // Negative distance indicates xyz is outside vol + } + } + // Should really figure out nearest corner anyway. + index = 0; + return -1.0; } int CubeMesh::compareMeshSpacing( const CubeMesh* other ) const { - if ( doubleApprox( dx_, other->dx_ ) && - doubleApprox( dy_, other->dy_ ) && - doubleApprox( dz_, other->dz_ ) ) - return 0; // equal + if ( doubleApprox( dx_, other->dx_ ) && + doubleApprox( dy_, other->dy_ ) && + doubleApprox( dz_, other->dz_ ) ) + return 0; // equal - if ( dx_ >= other->dx_ && - dy_ >= other->dy_ && - dz_ >= other->dz_ ) - return 1; // bigger + if ( dx_ >= other->dx_ && + dy_ >= other->dy_ && + dz_ >= other->dz_ ) + return 1; // bigger - if ( dx_ <= other->dx_ && - dy_ <= other->dy_ && - dz_ <= other->dz_ ) - return -1; // smaller than other. + if ( dx_ <= other->dx_ && + dy_ <= other->dy_ && + dz_ <= other->dz_ ) + return -1; // smaller than other. - cout << "Warning: CubeMesh::compareMeshSpacing: inconsistent spacing\n"; - return 0; + cout << "Warning: CubeMesh::compareMeshSpacing: inconsistent spacing\n"; + return 0; } void CubeMesh::defineIntersection( const CubeMesh* other, - double& xmin, double &xmax, - double& ymin, double &ymax, - double& zmin, double &zmax ) - const -{ - const double meshSlop = 0.2; - xmin = ( x0_ > other->x0_ ) ? x0_ : other->x0_; - xmax = ( x1_ < other->x1_ ) ? x1_ : other->x1_; - ymin = ( y0_ > other->y0_ ) ? y0_ : other->y0_; - ymax = ( y1_ < other->y1_ ) ? y1_ : other->y1_; - zmin = ( z0_ > other->z0_ ) ? z0_ : other->z0_; - zmax = ( z1_ < other->z1_ ) ? z1_ : other->z1_; - // Align to coarser mesh - double temp = ( xmin - x0_) / dx_; - if ( temp - floor( temp ) > meshSlop ) - xmin = floor( temp ) * dx_; - temp = ( ymin - y0_) / dy_; - if ( temp - floor( temp ) > meshSlop ) - ymin = floor( temp ) * dy_; - temp = ( zmin - z0_) / dz_; - if ( temp - floor( temp ) > meshSlop ) - zmin = floor( temp ) * dz_; - - // Provide 1 voxel padding all around. - xmin -= dx_; - xmax += dx_; - ymin -= dy_; - ymax += dy_; - zmin -= dz_; - zmax += dz_; - swapIfBackward( xmin, xmax ); - swapIfBackward( ymin, ymax ); - swapIfBackward( zmin, zmax ); + double& xmin, double &xmax, + double& ymin, double &ymax, + double& zmin, double &zmax ) +const +{ + const double meshSlop = 0.2; + xmin = ( x0_ > other->x0_ ) ? x0_ : other->x0_; + xmax = ( x1_ < other->x1_ ) ? x1_ : other->x1_; + ymin = ( y0_ > other->y0_ ) ? y0_ : other->y0_; + ymax = ( y1_ < other->y1_ ) ? y1_ : other->y1_; + zmin = ( z0_ > other->z0_ ) ? z0_ : other->z0_; + zmax = ( z1_ < other->z1_ ) ? z1_ : other->z1_; + // Align to coarser mesh + double temp = ( xmin - x0_) / dx_; + if ( temp - floor( temp ) > meshSlop ) + xmin = floor( temp ) * dx_; + temp = ( ymin - y0_) / dy_; + if ( temp - floor( temp ) > meshSlop ) + ymin = floor( temp ) * dy_; + temp = ( zmin - z0_) / dz_; + if ( temp - floor( temp ) > meshSlop ) + zmin = floor( temp ) * dz_; + + // Provide 1 voxel padding all around. + xmin -= dx_; + xmax += dx_; + ymin -= dy_; + ymax += dy_; + zmin -= dz_; + zmax += dz_; + swapIfBackward( xmin, xmax ); + swapIfBackward( ymin, ymax ); + swapIfBackward( zmin, zmax ); } /** @@ -1293,44 +1335,44 @@ void CubeMesh::defineIntersection( const CubeMesh* other, */ void setAbut( PII& voxel, unsigned int meshIndex, unsigned int axis ) { - if ( voxel.second == CubeMesh::SURFACE ) // Don't touch surface voxels. - return; - if ( voxel.second == CubeMesh::EMPTY ) - voxel = PII( meshIndex, axis ); - else // 1 or more indices are already here. - voxel.second = CubeMesh::MULTI; + if ( voxel.second == CubeMesh::SURFACE ) // Don't touch surface voxels. + return; + if ( voxel.second == CubeMesh::EMPTY ) + voxel = PII( meshIndex, axis ); + else // 1 or more indices are already here. + voxel.second = CubeMesh::MULTI; } void setIntersectVoxel( - vector< PII >& intersect, - unsigned int ix, unsigned int iy, unsigned int iz, - unsigned int nx, unsigned int ny, unsigned int nz, - unsigned int meshIndex ) -{ - assert( ix < nx && iy < ny && iz < nz ); - unsigned int index = ( iz * ny + iy ) * nx + ix; - assert( index < intersect.size() ); - intersect[index] = PII( meshIndex, CubeMesh::SURFACE ); - if ( ix > 0 ) - setAbut( intersect[ (iz*ny + iy) * nx + ix-1 ], meshIndex, - CubeMesh::ABUTX ); - if ( ix + 1 < nx ) - setAbut( intersect[ (iz*ny + iy) * nx + ix+1 ], meshIndex, - CubeMesh::ABUTX ); - - if ( iy > 0 ) - setAbut( intersect[ ( iz*ny + iy-1 ) * nx + ix ], meshIndex, - CubeMesh::ABUTY); - if ( iy + 1 < ny ) - setAbut( intersect[ ( iz*ny + iy+1 ) * nx + ix ], meshIndex, - CubeMesh::ABUTY); - - if ( iz > 0 ) - setAbut( intersect[ ( (iz-1)*ny + iy ) * nx + ix ], meshIndex, - CubeMesh::ABUTZ); - if ( iz + 1 < nz ) - setAbut( intersect[ ( (iz+1)*ny + iy ) * nx + ix ], meshIndex, - CubeMesh::ABUTZ); + vector< PII >& intersect, + unsigned int ix, unsigned int iy, unsigned int iz, + unsigned int nx, unsigned int ny, unsigned int nz, + unsigned int meshIndex ) +{ + assert( ix < nx && iy < ny && iz < nz ); + unsigned int index = ( iz * ny + iy ) * nx + ix; + assert( index < intersect.size() ); + intersect[index] = PII( meshIndex, CubeMesh::SURFACE ); + if ( ix > 0 ) + setAbut( intersect[ (iz*ny + iy) * nx + ix-1 ], meshIndex, + CubeMesh::ABUTX ); + if ( ix + 1 < nx ) + setAbut( intersect[ (iz*ny + iy) * nx + ix+1 ], meshIndex, + CubeMesh::ABUTX ); + + if ( iy > 0 ) + setAbut( intersect[ ( iz*ny + iy-1 ) * nx + ix ], meshIndex, + CubeMesh::ABUTY); + if ( iy + 1 < ny ) + setAbut( intersect[ ( iz*ny + iy+1 ) * nx + ix ], meshIndex, + CubeMesh::ABUTY); + + if ( iz > 0 ) + setAbut( intersect[ ( (iz-1)*ny + iy ) * nx + ix ], meshIndex, + CubeMesh::ABUTZ); + if ( iz + 1 < nz ) + setAbut( intersect[ ( (iz+1)*ny + iy ) * nx + ix ], meshIndex, + CubeMesh::ABUTZ); } @@ -1346,224 +1388,249 @@ void setIntersectVoxel( * field of the VoxelJunction. 0 = x; 1 = y; 2 = z. */ void checkAbut( - const vector< PII >& intersect, - unsigned int ix, unsigned int iy, unsigned int iz, - unsigned int nx, unsigned int ny, unsigned int nz, - unsigned int meshIndex, - vector< VoxelJunction >& ret - ) -{ - unsigned int index = ( iz * ny + iy ) * nx + ix; - unsigned int localFlag = intersect[index].second; - - if ( localFlag == CubeMesh::EMPTY || localFlag == CubeMesh::SURFACE ) - return; // Nothing to put into the ret vector - if ( localFlag == CubeMesh::ABUTX ) { - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 0 )); - } else if ( localFlag == CubeMesh::ABUTY ) { - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 1 )); - } else if ( localFlag == CubeMesh::ABUTZ ) { - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 2 )); - } else if ( localFlag == CubeMesh::MULTI ) { // go through all 6 cases. - if ( ix > 0 ) { - index = ( iz * ny + iy ) * nx + ix - 1; - if ( intersect[index].second == CubeMesh::SURFACE ) - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 0 )); - } - if ( ix + 1 < nx ) { - index = ( iz * ny + iy ) * nx + ix + 1; - if ( intersect[index].second == CubeMesh::SURFACE ) - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 0 )); - } - if ( iy > 0 ) { - index = ( iz * ny + iy -1 ) * nx + ix; - if ( intersect[index].second == CubeMesh::SURFACE ) - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 1 )); - } - if ( iy + 1 < ny ) { - index = ( iz * ny + iy + 1 ) * nx + ix; - if ( intersect[index].second == CubeMesh::SURFACE ) - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 1 )); - } - if ( iz > 0 ) { - index = ( (iz-1) * ny + iy ) * nx + ix; - if ( intersect[index].second == CubeMesh::SURFACE ) - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 2 )); - } - if ( iz + 1 < nz ) { - index = ( (iz+1) * ny + iy ) * nx + ix; - if ( intersect[index].second == CubeMesh::SURFACE ) - ret.push_back( - VoxelJunction( intersect[index].first, meshIndex, 2 )); - } - } + const vector< PII >& intersect, + unsigned int ix, unsigned int iy, unsigned int iz, + unsigned int nx, unsigned int ny, unsigned int nz, + unsigned int meshIndex, + vector< VoxelJunction >& ret +) +{ + unsigned int index = ( iz * ny + iy ) * nx + ix; + unsigned int localFlag = intersect[index].second; + + if ( localFlag == CubeMesh::EMPTY || localFlag == CubeMesh::SURFACE ) + return; // Nothing to put into the ret vector + if ( localFlag == CubeMesh::ABUTX ) + { + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 0 )); + } + else if ( localFlag == CubeMesh::ABUTY ) + { + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 1 )); + } + else if ( localFlag == CubeMesh::ABUTZ ) + { + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 2 )); + } + else if ( localFlag == CubeMesh::MULTI ) // go through all 6 cases. + { + if ( ix > 0 ) + { + index = ( iz * ny + iy ) * nx + ix - 1; + if ( intersect[index].second == CubeMesh::SURFACE ) + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 0 )); + } + if ( ix + 1 < nx ) + { + index = ( iz * ny + iy ) * nx + ix + 1; + if ( intersect[index].second == CubeMesh::SURFACE ) + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 0 )); + } + if ( iy > 0 ) + { + index = ( iz * ny + iy -1 ) * nx + ix; + if ( intersect[index].second == CubeMesh::SURFACE ) + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 1 )); + } + if ( iy + 1 < ny ) + { + index = ( iz * ny + iy + 1 ) * nx + ix; + if ( intersect[index].second == CubeMesh::SURFACE ) + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 1 )); + } + if ( iz > 0 ) + { + index = ( (iz-1) * ny + iy ) * nx + ix; + if ( intersect[index].second == CubeMesh::SURFACE ) + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 2 )); + } + if ( iz + 1 < nz ) + { + index = ( (iz+1) * ny + iy ) * nx + ix; + if ( intersect[index].second == CubeMesh::SURFACE ) + ret.push_back( + VoxelJunction( intersect[index].first, meshIndex, 2 )); + } + } } void CubeMesh::assignVoxels( vector< PII >& intersect, - double xmin, double xmax, - double ymin, double ymax, - double zmin, double zmax - ) const -{ - unsigned int nx = 0.5 + ( xmax - xmin ) / dx_; - unsigned int ny = 0.5 + ( ymax - ymin ) / dy_; - unsigned int nz = 0.5 + ( zmax - zmin ) / dz_; - // offset terms for nx, ny, nz from coord system for coarser grid. - // Note that these can go negative if the intersect grid goes past - // the coarse grid. - int ox = round( ( xmin - x0_ ) / dx_ ); - int oy = round( ( ymin - y0_ ) / dy_ ); - int oz = round( ( zmin - z0_ ) / dz_ ); - - // Scan through mesh surface using coarser grid, assign cuboid voxels - for ( vector< unsigned int >::const_iterator i = surface_.begin(); - i != surface_.end(); ++i ) { - unsigned int index = *i; - double x, y, z; - indexToSpace( index, x, y, z ); - if ( x >= xmin && x <= xmax && y >= ymin && y <= ymax && - z >= zmin && z <= zmax ) { - int ix = index % nx_ - ox; - assert( ix >= 0 ); - unsigned int uix = ix; - index /= nx_; - int iy = index % ny_ - oy; - assert( iy >= 0 ); - unsigned int uiy = iy; - index /= ny_; - int iz = index % nz_ - oz; - assert( iz >= 0 ); - unsigned int uiz = iz; - unsigned int meshIndex = s2m_[ *i ]; - - setIntersectVoxel( intersect, uix, uiy, uiz, nx, ny, nz, - meshIndex ); - } - } + double xmin, double xmax, + double ymin, double ymax, + double zmin, double zmax + ) const +{ + unsigned int nx = 0.5 + ( xmax - xmin ) / dx_; + unsigned int ny = 0.5 + ( ymax - ymin ) / dy_; + unsigned int nz = 0.5 + ( zmax - zmin ) / dz_; + // offset terms for nx, ny, nz from coord system for coarser grid. + // Note that these can go negative if the intersect grid goes past + // the coarse grid. + int ox = round( ( xmin - x0_ ) / dx_ ); + int oy = round( ( ymin - y0_ ) / dy_ ); + int oz = round( ( zmin - z0_ ) / dz_ ); + + // Scan through mesh surface using coarser grid, assign cuboid voxels + for ( vector< unsigned int >::const_iterator i = surface_.begin(); + i != surface_.end(); ++i ) + { + unsigned int index = *i; + double x, y, z; + indexToSpace( index, x, y, z ); + if ( x >= xmin && x <= xmax && y >= ymin && y <= ymax && + z >= zmin && z <= zmax ) + { + int ix = index % nx_ - ox; + assert( ix >= 0 ); + unsigned int uix = ix; + index /= nx_; + int iy = index % ny_ - oy; + assert( iy >= 0 ); + unsigned int uiy = iy; + index /= ny_; + int iz = index % nz_ - oz; + assert( iz >= 0 ); + unsigned int uiz = iz; + unsigned int meshIndex = s2m_[ *i ]; + + setIntersectVoxel( intersect, uix, uiy, uiz, nx, ny, nz, + meshIndex ); + } + } } void CubeMesh::matchCubeMeshEntries( const CubeMesh* other, - vector< VoxelJunction >& ret ) const -{ - // Flip meshes if the current grid is finer. - // There are still problems here because a finer grid will end - // up with 2 levels deep defined as being abutting. - if ( compareMeshSpacing( other ) == -1 ) { - other->matchMeshEntries( this, ret ); - flipRet( ret ); - return; - } - ret.resize( 0 ); - // Define intersecting cuboid - double xmin, xmax, ymin, ymax, zmin, zmax; - defineIntersection( other, xmin, xmax, ymin, ymax, zmin, zmax ); - - // Allocate intersecting cuboid - unsigned int nx = 0.5 + ( xmax - xmin ) / dx_; - unsigned int ny = 0.5 + ( ymax - ymin ) / dy_; - unsigned int nz = 0.5 + ( zmax - zmin ) / dz_; - vector< PII > intersect( nx * ny * nz, PII( EMPTY, EMPTY ) ); - assignVoxels( intersect, xmin, xmax, ymin, ymax, zmin, zmax ); - - // Scan through finer mesh surface, check for occupied voxels. - for ( vector< unsigned int >::const_iterator i = - other->surface_.begin(); - i != other->surface_.end(); ++i ) { - double x, y, z; - other->indexToSpace( *i, x, y, z ); - if ( x >= xmin && x <= xmax && y >= ymin && y <= ymax && - z >= zmin && z <= zmax ) { - unsigned int ix = ( x - xmin ) / dx_; - unsigned int iy = ( y - ymin ) / dy_; - unsigned int iz = ( z - zmin ) / dz_; - unsigned int meshIndex = other->s2m_[ *i ]; - checkAbut( intersect, ix, iy, iz, nx, ny, nz, meshIndex, ret ); - } - } - - // Scan through the VoxelJunctions and populate their diffScale field - setDiffScale( other, ret ); - // Scan through the VoxelJunctions and populate their volume field - setJunctionVol( other, ret ); - sort( ret.begin(), ret.end() ); + vector< VoxelJunction >& ret ) const +{ + // Flip meshes if the current grid is finer. + // There are still problems here because a finer grid will end + // up with 2 levels deep defined as being abutting. + if ( compareMeshSpacing( other ) == -1 ) + { + other->matchMeshEntries( this, ret ); + flipRet( ret ); + return; + } + ret.resize( 0 ); + // Define intersecting cuboid + double xmin, xmax, ymin, ymax, zmin, zmax; + defineIntersection( other, xmin, xmax, ymin, ymax, zmin, zmax ); + + // Allocate intersecting cuboid + unsigned int nx = 0.5 + ( xmax - xmin ) / dx_; + unsigned int ny = 0.5 + ( ymax - ymin ) / dy_; + unsigned int nz = 0.5 + ( zmax - zmin ) / dz_; + vector< PII > intersect( nx * ny * nz, PII( EMPTY, EMPTY ) ); + assignVoxels( intersect, xmin, xmax, ymin, ymax, zmin, zmax ); + + // Scan through finer mesh surface, check for occupied voxels. + for ( vector< unsigned int >::const_iterator i = + other->surface_.begin(); + i != other->surface_.end(); ++i ) + { + double x, y, z; + other->indexToSpace( *i, x, y, z ); + if ( x >= xmin && x <= xmax && y >= ymin && y <= ymax && + z >= zmin && z <= zmax ) + { + unsigned int ix = ( x - xmin ) / dx_; + unsigned int iy = ( y - ymin ) / dy_; + unsigned int iz = ( z - zmin ) / dz_; + unsigned int meshIndex = other->s2m_[ *i ]; + checkAbut( intersect, ix, iy, iz, nx, ny, nz, meshIndex, ret ); + } + } + + // Scan through the VoxelJunctions and populate their diffScale field + setDiffScale( other, ret ); + // Scan through the VoxelJunctions and populate their volume field + setJunctionVol( other, ret ); + sort( ret.begin(), ret.end() ); } /** * Version that assumes all voxels are in contact and able to diffuse * with matching voxels on other mesh */ -void CubeMesh::matchAllEntries( const CubeMesh* other, - vector< VoxelJunction >& ret ) const +void CubeMesh::matchAllEntries(const CubeMesh* other, vector<VoxelJunction>& ret) const { - ret.clear(); - unsigned int min = m2s_.size(); - if ( min > other->m2s_.size() ) - min = other->m2s_.size(); - ret.resize( min ); - for ( unsigned int i = 0; i < min; ++i ) { - ret[i] = VoxelJunction( i, i ); - } + ret.clear(); + unsigned int min = m2s_.size(); + if ( min > other->m2s_.size() ) + min = other->m2s_.size(); + ret.resize( min ); + for ( unsigned int i = 0; i < min; ++i ) + { + ret[i] = VoxelJunction( i, i ); + } } void CubeMesh::matchCylMeshEntries( const ChemCompt* other, - vector< VoxelJunction >& ret ) const + vector< VoxelJunction >& ret ) const { - other->matchMeshEntries( this, ret ); - flipRet( ret ); + other->matchMeshEntries( this, ret ); + flipRet( ret ); } void CubeMesh::setDiffScale( const CubeMesh* other, - vector< VoxelJunction >& ret ) const -{ - - for ( vector< VoxelJunction >::iterator i = ret.begin(); - i != ret.end(); ++i ) - { - if ( doubleEq( i->diffScale, 0 ) ) { // Junction across x plane - double selfXA = dy_ * dz_; - double otherXA = other->dy_ * other->dz_; - if ( selfXA <= otherXA ) - i->diffScale = 2 * selfXA / ( dx_ + other->dx_ ); - else - i->diffScale = 2 * otherXA / ( dx_ + other->dx_ ); - } else if ( doubleEq( i->diffScale, 1 ) ) { // across y plane - double selfXA = dx_ * dz_; - double otherXA = other->dx_ * other->dz_; - if ( selfXA <= otherXA ) - i->diffScale = 2 * selfXA / ( dy_ + other->dy_ ); - else - i->diffScale = 2 * otherXA / ( dy_ + other->dy_ ); - } else if ( doubleEq( i->diffScale, 2 ) ) { // across z plane - double selfXA = dx_ * dy_; - double otherXA = other->dx_ * other->dy_; - if ( selfXA <= otherXA ) - i->diffScale = 2 * selfXA / ( dz_ + other->dz_ ); - else - i->diffScale = 2 * otherXA / ( dz_ + other->dz_ ); - } else { - assert( 0 ); - } - } + vector< VoxelJunction >& ret ) const +{ + + for ( vector< VoxelJunction >::iterator i = ret.begin(); + i != ret.end(); ++i ) + { + if ( doubleEq( i->diffScale, 0 ) ) // Junction across x plane + { + double selfXA = dy_ * dz_; + double otherXA = other->dy_ * other->dz_; + if ( selfXA <= otherXA ) + i->diffScale = 2 * selfXA / ( dx_ + other->dx_ ); + else + i->diffScale = 2 * otherXA / ( dx_ + other->dx_ ); + } + else if ( doubleEq( i->diffScale, 1 ) ) // across y plane + { + double selfXA = dx_ * dz_; + double otherXA = other->dx_ * other->dz_; + if ( selfXA <= otherXA ) + i->diffScale = 2 * selfXA / ( dy_ + other->dy_ ); + else + i->diffScale = 2 * otherXA / ( dy_ + other->dy_ ); + } + else if ( doubleEq( i->diffScale, 2 ) ) // across z plane + { + double selfXA = dx_ * dy_; + double otherXA = other->dx_ * other->dy_; + if ( selfXA <= otherXA ) + i->diffScale = 2 * selfXA / ( dz_ + other->dz_ ); + else + i->diffScale = 2 * otherXA / ( dz_ + other->dz_ ); + } + else + { + assert( 0 ); + } + } } void CubeMesh::setJunctionVol( const CubeMesh* other, - vector< VoxelJunction >& ret ) const + vector< VoxelJunction >& ret ) const { - double myVol = dx_ * dy_ * dz_; - double otherVol = other->dx_ * other->dy_ * other->dz_; - for ( vector< VoxelJunction >::iterator i = ret.begin(); - i != ret.end(); ++i ) - { - i->firstVol = myVol; - i->secondVol = otherVol; - } + double myVol = dx_ * dy_ * dz_; + double otherVol = other->dx_ * other->dy_ * other->dz_; + for ( vector< VoxelJunction >::iterator i = ret.begin(); + i != ret.end(); ++i ) + { + i->firstVol = myVol; + i->secondVol = otherVol; + } } diff --git a/moose-core/mesh/CylMesh.cpp b/moose-core/mesh/CylMesh.cpp index e0057529e42134e4eb5a445372f958caecfa9e84..3f467d949a2085be24c19f7a1d53b2bfb09996aa 100644 --- a/moose-core/mesh/CylMesh.cpp +++ b/moose-core/mesh/CylMesh.cpp @@ -13,78 +13,78 @@ #include "../utility/Vec.h" #include "Boundary.h" #include "MeshEntry.h" -// #include "Stencil.h" #include "ChemCompt.h" #include "MeshCompt.h" #include "CubeMesh.h" #include "CylBase.h" #include "NeuroNode.h" -// #include "NeuroStencil.h" #include "NeuroMesh.h" #include "CylMesh.h" #include "EndoMesh.h" #include "../utility/numutil.h" +#include "../utility/testing_macros.hpp" + const Cinfo* CylMesh::initCinfo() { - ////////////////////////////////////////////////////////////// - // Field Definitions - ////////////////////////////////////////////////////////////// - static ElementValueFinfo< CylMesh, double > x0( + ////////////////////////////////////////////////////////////// + // Field Definitions + ////////////////////////////////////////////////////////////// + static ElementValueFinfo< CylMesh, double > x0( "x0", "x coord of one end", &CylMesh::setX0, &CylMesh::getX0 - ); - static ElementValueFinfo< CylMesh, double > y0( + ); + static ElementValueFinfo< CylMesh, double > y0( "y0", "y coord of one end", &CylMesh::setY0, &CylMesh::getY0 - ); - static ElementValueFinfo< CylMesh, double > z0( + ); + static ElementValueFinfo< CylMesh, double > z0( "z0", "z coord of one end", &CylMesh::setZ0, &CylMesh::getZ0 - ); - static ElementValueFinfo< CylMesh, double > r0( + ); + static ElementValueFinfo< CylMesh, double > r0( "r0", "Radius of one end", &CylMesh::setR0, &CylMesh::getR0 - ); - static ElementValueFinfo< CylMesh, double > x1( + ); + static ElementValueFinfo< CylMesh, double > x1( "x1", "x coord of other end", &CylMesh::setX1, &CylMesh::getX1 - ); - static ElementValueFinfo< CylMesh, double > y1( + ); + static ElementValueFinfo< CylMesh, double > y1( "y1", "y coord of other end", &CylMesh::setY1, &CylMesh::getY1 - ); - static ElementValueFinfo< CylMesh, double > z1( + ); + static ElementValueFinfo< CylMesh, double > z1( "z1", "z coord of other end", &CylMesh::setZ1, &CylMesh::getZ1 - ); - static ElementValueFinfo< CylMesh, double > r1( + ); + static ElementValueFinfo< CylMesh, double > r1( "r1", "Radius of other end", &CylMesh::setR1, &CylMesh::getR1 - ); - static ElementValueFinfo< CylMesh, vector< double > > coords( + ); + static ElementValueFinfo< CylMesh, vector< double > > coords( "coords", "All the coords as a single vector: x0 y0 z0 x1 y1 z1 r0 r1 diffLength", &CylMesh::setCoords, &CylMesh::getCoords - ); + ); - static ElementValueFinfo< CylMesh, double > diffLength( + static ElementValueFinfo< CylMesh, double > diffLength( "diffLength", "Length constant to use for subdivisions" "The system will attempt to subdivide using compartments of" @@ -95,27 +95,27 @@ const Cinfo* CylMesh::initCinfo() "totLength/numEntries", &CylMesh::setDiffLength, &CylMesh::getDiffLength - ); + ); - static ReadOnlyValueFinfo< CylMesh, unsigned int > numDiffCompts( + static ReadOnlyValueFinfo< CylMesh, unsigned int > numDiffCompts( "numDiffCompts", "Number of diffusive compartments in model", &CylMesh::innerGetNumEntries - ); + ); - static ReadOnlyValueFinfo< CylMesh, double > totLength( + static ReadOnlyValueFinfo< CylMesh, double > totLength( "totLength", "Total length of cylinder", &CylMesh::getTotLength - ); + ); - ////////////////////////////////////////////////////////////// - // MsgDest Definitions - ////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////// + // MsgDest Definitions + ////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////// - // Field Elements - ////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////// + // Field Elements + ////////////////////////////////////////////////////////////// static Finfo* cylMeshFinfos[] = { &x0, // Value @@ -166,8 +166,7 @@ static const Cinfo* cylMeshCinfo = CylMesh::initCinfo(); ////////////////////////////////////////////////////////////////// // Class stuff. ////////////////////////////////////////////////////////////////// -CylMesh::CylMesh() - : +CylMesh::CylMesh() : numEntries_( 100 ), useCaps_( 0 ), isToroid_( false ), @@ -205,14 +204,14 @@ CylMesh::~CylMesh() void CylMesh::updateCoords( const Eref& e, const vector< double >& concs ) { double temp = sqrt( - ( x1_ - x0_ ) * ( x1_ - x0_ ) + - ( y1_ - y0_ ) * ( y1_ - y0_ ) + - ( z1_ - z0_ ) * ( z1_ - z0_ ) - ); + ( x1_ - x0_ ) * ( x1_ - x0_ ) + + ( y1_ - y0_ ) * ( y1_ - y0_ ) + + ( z1_ - z0_ ) * ( z1_ - z0_ ) + ); if ( doubleEq( temp, 0.0 ) ) { cout << "Error: CylMesh::updateCoords:\n" - "total length of compartment = 0 with these parameters\n"; + "total length of compartment = 0 with these parameters\n"; return; } totLen_ = temp; @@ -290,18 +289,19 @@ double CylMesh::getR0( const Eref& e ) const void CylMesh::setX1( const Eref& e, double v ) { - size_t numVoxels = (v - x0_) / diffLength_; - if( numVoxels > SM_MAX_COLUMNS ) + x1_ = v; + size_t numVoxels = (x1_ - x0_) / diffLength_; + if( numVoxels >= SM_MAX_COLUMNS) { - cout << "Warn: Compartment is too big. With diffusion-length of " << diffLength_ - << " total " << numVoxels << " would be generated which is larger than maximum " - << SM_MAX_COLUMNS << " allowed. Ignoring .." << endl; - return; + diffLength_ = (x1_-x0_)/(SM_MAX_COLUMNS-1); + MOOSE_WARN( "Too many voxels (" << numVoxels << ") would be created" + << " for current length " << (x1_ - x0_) << " and diffLength " + << diffLength_ << " (maximum " << SM_MAX_COLUMNS << " voxels allowed)." + << " Rescaling diffLength of compartment to " << diffLength_ << ". " + ); } - vector< double > childConcs; getChildConcs( e, childConcs ); - x1_ = v; updateCoords( e, childConcs ); } @@ -400,9 +400,18 @@ vector< double > CylMesh::getCoords( const Eref& e ) const void CylMesh::setDiffLength( const Eref& e, double v ) { + diffLength_ = v; + size_t numVoxels = (size_t) ((x1_-x0_)/diffLength_); + if( numVoxels >= SM_MAX_COLUMNS ) + { + x1_ = x0_ + diffLength_ * (SM_MAX_COLUMNS - 1); + MOOSE_WARN( "Too many voxels (" << numVoxels << ") would be created " + << "for diffLength of " << diffLength_ + << " (maximum " << SM_MAX_COLUMNS << " allowed). " + << " Changing compartment length to " << (x1_ - x0_) << "."); + } vector< double > childConcs; getChildConcs( e, childConcs ); - diffLength_ = v; updateCoords( e, childConcs ); } @@ -485,7 +494,7 @@ unsigned int CylMesh::getMeshDimensions( unsigned int fid ) const /// Virtual function to return volume of mesh Entry. double CylMesh::getMeshEntryVolume( unsigned int fid ) const { - double len0 = diffLength_ * 2 * r0_ / ( r0_ + r1_ ); + double len0 = diffLength_ * 2 * r0_ / ( r0_ + r1_ ); double ri = r0_ + (fid + 0.5) * rSlope_; double leni = len0 + ( fid + 0.5 ) * lenSlope_; @@ -498,15 +507,15 @@ double CylMesh::getMeshEntryVolume( unsigned int fid ) const vector< double > CylMesh::getCoordinates( unsigned int fid ) const { vector< double > ret(10, 0.0); - double len0 = diffLength_ * 2 * r0_ / ( r0_ + r1_ ); - // double len0 = diffLength_ * 2 * ( r0_ + rSlope_ / 0.5) / ( r0_ + r1_ ); + double len0 = diffLength_ * 2 * r0_ / ( r0_ + r1_ ); + // double len0 = diffLength_ * 2 * ( r0_ + rSlope_ / 0.5) / ( r0_ + r1_ ); double lenStart = len0 + lenSlope_ * 0.5; double axialStart = fid * lenStart + ( ( fid * (fid - 1 ) )/2 ) * lenSlope_; - // fid * totLen_/numEntries_ + (fid - frac ) * lenSlope_; + // fid * totLen_/numEntries_ + (fid - frac ) * lenSlope_; double axialEnd = (fid + 1) * lenStart + ( ( fid * (fid + 1 ) )/2 ) * lenSlope_; - // (fid + 1) * totLen_/numEntries_ + (fid - frac + 1.0) * lenSlope_; + // (fid + 1) * totLen_/numEntries_ + (fid - frac + 1.0) * lenSlope_; ret[0] = x0_ + (x1_ - x0_ ) * axialStart/totLen_; ret[1] = y0_ + (y1_ - y0_ ) * axialStart/totLen_; @@ -591,30 +600,30 @@ double CylMesh::extendedMeshEntryVolume( unsigned int fid ) const /// More inherited virtual funcs: request comes in for mesh stats void CylMesh::innerHandleRequestMeshStats( const Eref& e, const SrcFinfo2< unsigned int, vector< double > >* meshStatsFinfo - ) + ) { vector< double > ret( vGetEntireVolume() / numEntries_ ,1 ); meshStatsFinfo->send( e, 1, ret ); } void CylMesh::innerHandleNodeInfo( - const Eref& e, - unsigned int numNodes, unsigned int numThreads ) + const Eref& e, + unsigned int numNodes, unsigned int numThreads ) { - /* - unsigned int numEntries = numEntries_; - vector< double > vols( numEntries, volume_ / numEntries ); - vector< unsigned int > localEntries( numEntries ); - vector< vector< unsigned int > > outgoingEntries; - vector< vector< unsigned int > > incomingEntries; - */ /* - double oldvol = getMeshEntryVolume( 0 ); - meshSplit()->send( e, - oldvol, - vols, localEntries, - outgoingEntries, incomingEntries ); - */ + unsigned int numEntries = numEntries_; + vector< double > vols( numEntries, volume_ / numEntries ); + vector< unsigned int > localEntries( numEntries ); + vector< vector< unsigned int > > outgoingEntries; + vector< vector< unsigned int > > incomingEntries; + */ + /* + double oldvol = getMeshEntryVolume( 0 ); + meshSplit()->send( e, + oldvol, + vols, localEntries, + outgoingEntries, incomingEntries ); + */ } ////////////////////////////////////////////////////////////////// @@ -634,7 +643,7 @@ void CylMesh::innerSetNumEntries( unsigned int n ) static const unsigned int WayTooLarge = 1000000; if ( n == 0 || n > WayTooLarge ) { cout << "Warning: CylMesh::innerSetNumEntries( " << n << - " ): out of range\n"; + " ): out of range\n"; return; } assert( n > 0 ); @@ -648,7 +657,7 @@ void CylMesh::innerSetNumEntries( unsigned int n ) void CylMesh::innerBuildDefaultMesh( const Eref& e, - double volume, unsigned int numEntries ) + double volume, unsigned int numEntries ) { /// Single voxel cylinder with diameter = length. /// vol = volume = pi.r^2.len. @@ -749,21 +758,21 @@ bool CylMesh::vSetVolumeNotRates( double volume ) void CylMesh::transmitChange( const Eref& e ) { - /* - Id meshEntry( e.id().value() + 1 ); - assert( - meshEntry.eref().data() == reinterpret_cast< char* >( lookupEntry( 0 ) ) - ); - double oldvol = getMeshEntryVolume( 0 ); - unsigned int totalNumEntries = numEntries_; - unsigned int localNumEntries = totalNumEntries; - unsigned int startEntry = 0; - vector< unsigned int > localIndices( localNumEntries ); // empty - for ( unsigned int i = 0; i < localNumEntries; ++i ) - localIndices[i] = i; - vector< double > vols( localNumEntries, volume_ / numEntries_ ); - vector< vector< unsigned int > > outgoingEntries; // [node#][Entry#] - vector< vector< unsigned int > > incomingEntries; // [node#][Entry#] + /* + Id meshEntry( e.id().value() + 1 ); + assert( + meshEntry.eref().data() == reinterpret_cast< char* >( lookupEntry( 0 ) ) + ); + double oldvol = getMeshEntryVolume( 0 ); + unsigned int totalNumEntries = numEntries_; + unsigned int localNumEntries = totalNumEntries; + unsigned int startEntry = 0; + vector< unsigned int > localIndices( localNumEntries ); // empty + for ( unsigned int i = 0; i < localNumEntries; ++i ) + localIndices[i] = i; + vector< double > vols( localNumEntries, volume_ / numEntries_ ); + vector< vector< unsigned int > > outgoingEntries; // [node#][Entry#] + vector< vector< unsigned int > > incomingEntries; // [node#][Entry#] // This function updates the size of the FieldDataHandler for the // MeshEntries. @@ -771,21 +780,21 @@ void CylMesh::transmitChange( const Eref& e ) FieldDataHandlerBase* fdh = dynamic_cast< FieldDataHandlerBase* >( dh ); assert( fdh ); if ( totalNumEntries > fdh->getMaxFieldEntries() ) { - fdh->setMaxFieldEntries( localNumEntries ); + fdh->setMaxFieldEntries( localNumEntries ); } // This message tells the Stoich about the new mesh, and also about // how it communicates with other nodes. meshSplit()->fastSend( e, - oldvol, - vols, localIndices, - outgoingEntries, incomingEntries ); + oldvol, + vols, localIndices, + outgoingEntries, incomingEntries ); // This func goes down to the MeshEntry to tell all the pools and // Reacs to deal with the new mesh. They then update the stoich. lookupEntry( 0 )->triggerRemesh( meshEntry.eref(), - oldvol, startEntry, localIndices, vols ); - */ + oldvol, startEntry, localIndices, vols ); + */ } ////////////////////////////////////////////////////////////////// @@ -834,7 +843,7 @@ void CylMesh::buildStencil() ////////////////////////////////////////////////////////////////// void CylMesh::matchMeshEntries( const ChemCompt* other, - vector< VoxelJunction >& ret ) const + vector< VoxelJunction >& ret ) const { // This is seriously ugly, and what virtual funcs were meant to handle. // Dirty hack for now. @@ -861,14 +870,14 @@ void CylMesh::matchMeshEntries( const ChemCompt* other, return; } cout << "Warning:CylMesh::matchMeshEntries: " << - " unknown mesh type\n"; + " unknown mesh type\n"; } // Look for end-to-end diffusion, not sideways for now. // Very straightforward but tedious because of the different permutations. // Could readily add cylinder side to other end. void CylMesh::matchCylMeshEntries( const CylMesh* other, -vector< VoxelJunction >& ret ) const + vector< VoxelJunction >& ret ) const { const double EPSILON = 1e-3; ret.clear(); @@ -877,13 +886,13 @@ vector< VoxelJunction >& ret ) const // within the radius of the disk. The subsequent calculations are the // same though. double dr1 = // startOfSelf-to-startOfOther - distance(x0_ - other->x0_, y0_ - other->y0_, z0_ - other->z0_ ); + distance(x0_ - other->x0_, y0_ - other->y0_, z0_ - other->z0_ ); double dr2 = // endOfSelf-to-endOfOther - distance(x1_ - other->x1_, y1_ - other->y1_, z1_ - other->z1_ ); + distance(x1_ - other->x1_, y1_ - other->y1_, z1_ - other->z1_ ); double dr3 = // endOfSelf-to-startOfOther - distance(x1_ - other->x0_, y1_ - other->y0_, z1_ - other->z0_ ); + distance(x1_ - other->x0_, y1_ - other->y0_, z1_ - other->z0_ ); double dr4 = // startOfSelf-to-endOfOther - distance(x0_ - other->x1_, y0_ - other->y1_, z0_ - other->z1_ ); + distance(x0_ - other->x1_, y0_ - other->y1_, z0_ - other->z1_ ); if ( dr1 <= dr2 && dr1 <= dr3 && dr1 <= dr4 ) { if ( ( dr1/totLen_ < EPSILON && dr1/other->totLen_ < EPSILON ) ) { @@ -892,7 +901,7 @@ vector< VoxelJunction >& ret ) const xda = 2 * r0_ * r0_ * PI / ( diffLength_ + other->diffLength_ ); else xda = 2 * other->r0_ * other->r0_ * PI / - ( diffLength_ + other->diffLength_ ); + ( diffLength_ + other->diffLength_ ); ret.push_back( VoxelJunction( 0, 0, xda ) ); ret.back().first = 0; ret.back().second = 0; @@ -906,7 +915,7 @@ vector< VoxelJunction >& ret ) const xda = 2 * r1_ * r1_ * PI / ( diffLength_ + other->diffLength_ ); else xda = 2 * other->r1_ * other->r1_ * PI / - ( diffLength_ + other->diffLength_ ); + ( diffLength_ + other->diffLength_ ); ret.push_back( VoxelJunction( numEntries_ - 1, other->numEntries_ - 1, xda ) ); ret.back().first = numEntries_; @@ -921,7 +930,7 @@ vector< VoxelJunction >& ret ) const xda = 2 * r1_ * r1_ * PI / ( diffLength_ + other->diffLength_ ); else xda = 2 * other->r0_ * other->r0_ * PI / - ( diffLength_ + other->diffLength_ ); + ( diffLength_ + other->diffLength_ ); ret.push_back( VoxelJunction( numEntries_ - 1, 0, xda ) ); ret.back().first = numEntries_ - 1; ret.back().second = 0; @@ -935,7 +944,7 @@ vector< VoxelJunction >& ret ) const xda = 2 * r0_ * r0_ * PI / ( diffLength_ + other->diffLength_ ); else xda = 2 * other->r1_ * other->r1_ * PI / - ( diffLength_ + other->diffLength_ ); + ( diffLength_ + other->diffLength_ ); ret.push_back( VoxelJunction( 0, other->numEntries_ - 1, xda )); ret.back().first = 0; ret.back().second = other->numEntries_ - 1; @@ -962,10 +971,10 @@ double CylMesh::selectGridVolume( double h ) const } void fillPointsOnCircle( - const Vec& u, const Vec& v, const Vec& q, - double h, double r, vector< double >& area, - const CubeMesh* other - ) + const Vec& u, const Vec& v, const Vec& q, + double h, double r, vector< double >& area, + const CubeMesh* other + ) { // fine-tune the h spacing so it is integral around circle. // This will cause small errors in area estimate but they will @@ -990,7 +999,7 @@ void fillPointsOnCircle( } void CylMesh::matchCubeMeshEntries( const CubeMesh* other, -vector< VoxelJunction >& ret ) const + vector< VoxelJunction >& ret ) const { const double EPSILON = 1e-18; Vec a( x1_ - x0_, y1_ - y0_, z1_ - z0_ ); @@ -1014,8 +1023,8 @@ vector< VoxelJunction >& ret ) const // get radius of cylinder at this point. double r = r0_ + ( m * h + h / 2.0 ) * rSlope_; fillPointsOnCircle( u, v, Vec( q0, q1, q2 ), - h, r, area, other ); - } + h, r, area, other ); + } // Go through all cubeMesh entries and compute diffusion // cross-section. Assume this is through a membrane, so the // only factor relevant is area. Not the distance. @@ -1028,12 +1037,12 @@ vector< VoxelJunction >& ret ) const } void CylMesh::matchNeuroMeshEntries( const NeuroMesh* other, -vector< VoxelJunction >& ret ) const + vector< VoxelJunction >& ret ) const { } void CylMesh::indexToSpace( unsigned int index, - double& x, double& y, double& z ) const + double& x, double& y, double& z ) const { if ( index < numEntries_ ) { double k = ( index + 0.5 ) / static_cast< double >( numEntries_ ); @@ -1044,15 +1053,15 @@ void CylMesh::indexToSpace( unsigned int index, } static double dotprd ( double x0, double y0, double z0, - double x1, double y1, double z1 ) + double x1, double y1, double z1 ) { - return x0 * x1 + y0 * y1 + z0 * z1; + return x0 * x1 + y0 * y1 + z0 * z1; } // this is the function that does the actual calculation. double CylMesh::nearest( double x, double y, double z, - double& linePos, double& r ) const + double& linePos, double& r ) const { // Consider r0 = x0,y0,z0 and r1 = x1, y1, z1, and r = x,y,z. // Fraction along cylinder = k @@ -1066,8 +1075,8 @@ double CylMesh::nearest( double x, double y, double z, double dist = distance( x1_ - x0_, y1_ - y0_, z1_ - z0_ ); double k = dotprd( - x1_ - x0_, y1_ - y0_, z1_ - z0_, - x - x0_, y - y0_, z - z0_ ) / ( dist * dist ); + x1_ - x0_, y1_ - y0_, z1_ - z0_, + x - x0_, y - y0_, z - z0_ ) / ( dist * dist ); // x2, y2, z2 are the coords of the nearest point. double x2 = k * (x1_ - x0_) + x0_; @@ -1082,7 +1091,7 @@ double CylMesh::nearest( double x, double y, double z, // This function returns the index. double CylMesh::nearest( double x, double y, double z, - unsigned int& index ) const + unsigned int& index ) const { double k = 0.0; double r; @@ -1104,40 +1113,40 @@ double CylMesh::nearest( double x, double y, double z, /* -bool isOnSurface( double x, double y, double z, - double dx, double dy, double dz, - unsigned int &index, double& adx ) -{ - double len = distance( x1_ - x0_, y1_ - y0_, z1_ - z0_ ); - double k = dotprd( - x1_ - x0_, y1_ - y0_, z1_ - z0_, - x - x0_, y - y0_, z - z0_ ) / len; - - // x2, y2, z2 are the coords of the nearest point. - double x2 = k * (x1_ - x0_) + x0_; - double y2 = k * (y1_ - y0_) + y0_; - double z2 = k * (z1_ - z0_) + z0_; - - double ret = distance( x - x2, y - y2, z - z2 ); - - double cubeRange = sqrt(dx*dx + dy*dy + dz*dz); - - // Now we check if the distance is definitely too far off for the - // passed in point - if ( k < -dx/2 || k > len + dx/2 ) // past the end. - return false; - - double ri = k * rSlope_; // local cylinder radius. - - if ( ret > ri + cubeRange || ret < ri - cubeRange ) - return false; - - // OK, now we need to find the plane of intersection of the cylinder - // with the cuboid. To make it easier, assume it is flat. We already - // know the vector from the middle of the cuboid to the nearest - // cylinder point. Treat it as the normal to the intersection plane. - // We need: : is the plane inside the cube? - // What is the area of the plane till its intersection with the cube? + bool isOnSurface( double x, double y, double z, + double dx, double dy, double dz, + unsigned int &index, double& adx ) + { + double len = distance( x1_ - x0_, y1_ - y0_, z1_ - z0_ ); + double k = dotprd( + x1_ - x0_, y1_ - y0_, z1_ - z0_, + x - x0_, y - y0_, z - z0_ ) / len; + +// x2, y2, z2 are the coords of the nearest point. +double x2 = k * (x1_ - x0_) + x0_; +double y2 = k * (y1_ - y0_) + y0_; +double z2 = k * (z1_ - z0_) + z0_; + +double ret = distance( x - x2, y - y2, z - z2 ); + +double cubeRange = sqrt(dx*dx + dy*dy + dz*dz); + +// Now we check if the distance is definitely too far off for the +// passed in point +if ( k < -dx/2 || k > len + dx/2 ) // past the end. +return false; + +double ri = k * rSlope_; // local cylinder radius. + +if ( ret > ri + cubeRange || ret < ri - cubeRange ) +return false; + +// OK, now we need to find the plane of intersection of the cylinder +// with the cuboid. To make it easier, assume it is flat. We already +// know the vector from the middle of the cuboid to the nearest +// cylinder point. Treat it as the normal to the intersection plane. +// We need: : is the plane inside the cube? +// What is the area of the plane till its intersection with the cube? } diff --git a/moose-core/mesh/CylMesh.h b/moose-core/mesh/CylMesh.h index 7014e643eabc6674cd8f7aca44ee08b4f7f16a40..8d782679d559caf405c84f6d5d248042ed02746e 100644 --- a/moose-core/mesh/CylMesh.h +++ b/moose-core/mesh/CylMesh.h @@ -18,175 +18,177 @@ */ class CylMesh: public MeshCompt { - public: - CylMesh(); - ~CylMesh(); - ////////////////////////////////////////////////////////////////// - // Utility func - ////////////////////////////////////////////////////////////////// - /** - * Recomputes all local coordinate and meshing data following - * a change in any of the coord parameters - */ - - void updateCoords( const Eref& e, const vector< double >& childConcs ); - - ////////////////////////////////////////////////////////////////// - // Field assignment stuff - ////////////////////////////////////////////////////////////////// - - void setX0( const Eref& e, double v ); - double getX0( const Eref& e ) const; - void setY0( const Eref& e, double v ); - double getY0( const Eref& e ) const; - void setZ0( const Eref& e, double v ); - double getZ0( const Eref& e ) const; - void setR0( const Eref& e, double v ); - double getR0( const Eref& e ) const; - - void setX1( const Eref& e, double v ); - double getX1( const Eref& e ) const; - void setY1( const Eref& e, double v ); - double getY1( const Eref& e ) const; - void setZ1( const Eref& e, double v ); - double getZ1( const Eref& e ) const; - void setR1( const Eref& e, double v ); - double getR1( const Eref& e ) const; - - void innerSetCoords( const Eref& e, const vector< double >& v); - void setCoords( const Eref& e, vector< double > v ); - vector< double > getCoords( const Eref& e ) const; - - void setDiffLength( const Eref& e, double v ); - double getDiffLength( const Eref& e ) const; - - double getTotLength() const; - - unsigned int innerGetDimensions() const; - - ////////////////////////////////////////////////////////////////// - // FieldElement assignment stuff for MeshEntries - ////////////////////////////////////////////////////////////////// - - /// Virtual function to return MeshType of specified entry. - unsigned int getMeshType( unsigned int fid ) const; - /// Virtual function to return dimensions of specified entry. - unsigned int getMeshDimensions( unsigned int fid ) const; - /// Virtual function to return volume of mesh Entry. - double getMeshEntryVolume( unsigned int fid ) const; - /// Virtual function to return coords of mesh Entry. - vector< double > getCoordinates( unsigned int fid ) const; - /// Virtual function to return diffusion X-section area - vector< double > getDiffusionArea( unsigned int fid ) const; - /// Virtual function to return scale factor for diffusion. 1 here. - vector< double > getDiffusionScaling( unsigned int fid ) const; - /// Volume of mesh Entry including abutting diff-coupled voxels - double extendedMeshEntryVolume( unsigned int fid ) const; - - ////////////////////////////////////////////////////////////////// - - /** - * Inherited virtual func. Returns number of MeshEntry in array - */ - unsigned int innerGetNumEntries() const; - /// Inherited virtual func. - void innerSetNumEntries( unsigned int n ); - - /// Inherited virtual, do nothing for now. - vector< unsigned int > getParentVoxel() const; - const vector< double >& vGetVoxelVolume() const; - const vector< double >& vGetVoxelMidpoint() const; - const vector< double >& getVoxelArea() const; - const vector< double >& getVoxelLength() const; - - /// Inherited virtual. Returns entire volume of compartment. - double vGetEntireVolume() const; - - /// Inherited virtual. Resizes len and dia of each voxel. - bool vSetVolumeNotRates( double volume ); - ////////////////////////////////////////////////////////////////// - // Dest funcs - ////////////////////////////////////////////////////////////////// - - /// Virtual func to make a mesh with specified Volume and numEntries - void innerBuildDefaultMesh( const Eref& e, - double volume, unsigned int numEntries ); - - void innerHandleRequestMeshStats( - const Eref& e, - const SrcFinfo2< unsigned int, vector< double > >* - meshStatsFinfo - ); - - void innerHandleNodeInfo( - const Eref& e, - unsigned int numNodes, unsigned int numThreads ); - - void transmitChange( const Eref& e ); - - void buildStencil(); - - ////////////////////////////////////////////////////////////////// - // inherited virtual funcs for Boundary - ////////////////////////////////////////////////////////////////// - - void matchMeshEntries( const ChemCompt* other, - vector< VoxelJunction > & ret ) const; - - double nearest( double x, double y, double z, - unsigned int& index ) const; - - double nearest( double x, double y, double z, - double& linePos, double& r ) const; - - void indexToSpace( unsigned int index, - double& x, double& y, double& z ) const; - - ////////////////////////////////////////////////////////////////// - // Inner specific functions needed by matchMeshEntries. - ////////////////////////////////////////////////////////////////// - void matchCylMeshEntries( const CylMesh* other, - vector< VoxelJunction >& ret ) const; - void matchCubeMeshEntries( const CubeMesh* other, - vector< VoxelJunction >& ret ) const; - void matchNeuroMeshEntries( const NeuroMesh* other, - vector< VoxelJunction >& ret ) const; - - // Selects a grid volume for generating intersection with CubeMesh. - double selectGridVolume( double h ) const; - - ////////////////////////////////////////////////////////////////// - - static const Cinfo* initCinfo(); - - private: - unsigned int numEntries_; // Number of subdivisions to use - bool useCaps_; // Flag: Should the ends have hemispherical caps? - bool isToroid_; // Flag: Should the ends loop around mathemagically? - - double x0_; /// coords - double y0_; /// coords - double z0_; /// coords - - double x1_; /// coords - double y1_; /// coords - double z1_; /// coords - - double r0_; /// Radius at one end - double r1_; /// Radius at other end - - double diffLength_; /// Length constant for diffusion. Equal to dx. - - /** - * surfaceGranularity_ decides how finely to subdivide DiffLength - * or cubic mesh side, when computing surface area of intersections - * between them when diffusing. Defaults to 0.1 - */ - double surfaceGranularity_; - - double totLen_; /// Utility value: Total length of cylinder - double rSlope_; /// Utility value: dr/dx - double lenSlope_; /// Utility value: dlen/dx +public: + CylMesh(); + ~CylMesh(); + ////////////////////////////////////////////////////////////////// + // Utility func + ////////////////////////////////////////////////////////////////// + /** + * Recomputes all local coordinate and meshing data following + * a change in any of the coord parameters + */ + + void updateCoords( const Eref& e, const std::vector< double >& childConcs ); + + ////////////////////////////////////////////////////////////////// + // Field assignment stuff + ////////////////////////////////////////////////////////////////// + + void setX0( const Eref& e, double v ); + double getX0( const Eref& e ) const; + void setY0( const Eref& e, double v ); + double getY0( const Eref& e ) const; + void setZ0( const Eref& e, double v ); + double getZ0( const Eref& e ) const; + void setR0( const Eref& e, double v ); + double getR0( const Eref& e ) const; + + void setX1( const Eref& e, double v ); + double getX1( const Eref& e ) const; + void setY1( const Eref& e, double v ); + double getY1( const Eref& e ) const; + void setZ1( const Eref& e, double v ); + double getZ1( const Eref& e ) const; + void setR1( const Eref& e, double v ); + double getR1( const Eref& e ) const; + + void innerSetCoords( const Eref& e, const std::vector< double >& v); + void setCoords( const Eref& e, std::vector< double > v ); + std::vector< double > getCoords( const Eref& e ) const; + + void setDiffLength( const Eref& e, double v ); + double getDiffLength( const Eref& e ) const; + + double getTotLength() const; + + unsigned int innerGetDimensions() const; + + ////////////////////////////////////////////////////////////////// + // FieldElement assignment stuff for MeshEntries + ////////////////////////////////////////////////////////////////// + + /// Virtual function to return MeshType of specified entry. + unsigned int getMeshType( unsigned int fid ) const; + /// Virtual function to return dimensions of specified entry. + unsigned int getMeshDimensions( unsigned int fid ) const; + /// Virtual function to return volume of mesh Entry. + double getMeshEntryVolume( unsigned int fid ) const; + /// Virtual function to return coords of mesh Entry. + std::vector< double > getCoordinates( unsigned int fid ) const; + /// Virtual function to return diffusion X-section area + std::vector< double > getDiffusionArea( unsigned int fid ) const; + /// Virtual function to return scale factor for diffusion. 1 here. + std::vector< double > getDiffusionScaling( unsigned int fid ) const; + /// Volume of mesh Entry including abutting diff-coupled voxels + double extendedMeshEntryVolume( unsigned int fid ) const; + + ////////////////////////////////////////////////////////////////// + + /** + * Inherited virtual func. Returns number of MeshEntry in array + */ + unsigned int innerGetNumEntries() const; + /// Inherited virtual func. + void innerSetNumEntries( unsigned int n ); + + /// Inherited virtual, do nothing for now. + std::vector< unsigned int > getParentVoxel() const; + const std::vector< double >& vGetVoxelVolume() const; + const std::vector< double >& vGetVoxelMidpoint() const; + const std::vector< double >& getVoxelArea() const; + const std::vector< double >& getVoxelLength() const; + + /// Inherited virtual. Returns entire volume of compartment. + double vGetEntireVolume() const; + + /// Inherited virtual. Resizes len and dia of each voxel. + bool vSetVolumeNotRates( double volume ); + + ////////////////////////////////////////////////////////////////// + // Dest funcs + ////////////////////////////////////////////////////////////////// + + /// Virtual func to make a mesh with specified Volume and numEntries + void innerBuildDefaultMesh( const Eref& e, + double volume, unsigned int numEntries + ); + + void innerHandleRequestMeshStats( + const Eref& e, + const SrcFinfo2< unsigned int, std::vector< double > >* + meshStatsFinfo + ); + + void innerHandleNodeInfo( + const Eref& e, + unsigned int numNodes, unsigned int numThreads ); + + void transmitChange( const Eref& e ); + + void buildStencil(); + + ////////////////////////////////////////////////////////////////// + // inherited virtual funcs for Boundary + ////////////////////////////////////////////////////////////////// + + void matchMeshEntries( const ChemCompt* other, + std::vector< VoxelJunction > & ret ) const; + + double nearest( double x, double y, double z, + unsigned int& index ) const; + + double nearest( double x, double y, double z, + double& linePos, double& r ) const; + + void indexToSpace( unsigned int index, + double& x, double& y, double& z ) const; + + ////////////////////////////////////////////////////////////////// + // Inner specific functions needed by matchMeshEntries. + ////////////////////////////////////////////////////////////////// + void matchCylMeshEntries( const CylMesh* other, + std::vector< VoxelJunction >& ret ) const; + void matchCubeMeshEntries( const CubeMesh* other, + std::vector< VoxelJunction >& ret ) const; + void matchNeuroMeshEntries( const NeuroMesh* other, + std::vector< VoxelJunction >& ret ) const; + + // Selects a grid volume for generating intersection with CubeMesh. + double selectGridVolume( double h ) const; + + ////////////////////////////////////////////////////////////////// + + static const Cinfo* initCinfo(); + +private: + unsigned int numEntries_; // Number of subdivisions to use + bool useCaps_; // Flag: Should the ends have hemispherical caps? + bool isToroid_; // Flag: Should the ends loop around mathemagically? + + double x0_; /// coords + double y0_; /// coords + double z0_; /// coords + + double x1_; /// coords + double y1_; /// coords + double z1_; /// coords + + double r0_; /// Radius at one end + double r1_; /// Radius at other end + + double diffLength_; /// Length constant for diffusion. Equal to dx. + + /** + * surfaceGranularity_ decides how finely to subdivide DiffLength + * or cubic mesh side, when computing surface area of intersections + * between them when diffusing. Defaults to 0.1 + */ + double surfaceGranularity_; + + double totLen_; /// Utility value: Total length of cylinder + double rSlope_; /// Utility value: dr/dx + double lenSlope_; /// Utility value: dlen/dx }; #endif // _CYL_MESH_H diff --git a/moose-core/mesh/VoxelJunction.h b/moose-core/mesh/VoxelJunction.h index 4c92a3e95da34c3d58c572a8574cab06f691b855..0a938f850a88595b312b9249c292878d4c749339 100644 --- a/moose-core/mesh/VoxelJunction.h +++ b/moose-core/mesh/VoxelJunction.h @@ -17,31 +17,31 @@ */ class VoxelJunction { - public: - VoxelJunction( unsigned int f, unsigned int s, double d = 1.0 ) - : first( f ), second( s ), - firstVol( 0 ), secondVol( 0 ), - diffScale( d ) - {;} - VoxelJunction() - : first( ~0 ), second( ~0 ), firstVol( 0 ), secondVol( 0 ), - diffScale( 1.0 ) - {;} +public: + VoxelJunction( unsigned int f, unsigned int s, double d = 1.0 ) + : first( f ), second( s ), + firstVol( 0 ), secondVol( 0 ), + diffScale( d ) + {;} + VoxelJunction() + : first( ~0 ), second( ~0 ), firstVol( 0 ), secondVol( 0 ), + diffScale( 1.0 ) + {;} - // Used for sorting. - bool operator<( const VoxelJunction& other ) const - { - if ( first < other.first ) return 1; - if ( first > other.first ) return 0; - if ( second < other.second ) return 1; - return 0; - } + // Used for sorting. + bool operator<( const VoxelJunction& other ) const + { + if ( first < other.first ) return 1; + if ( first > other.first ) return 0; + if ( second < other.second ) return 1; + return 0; + } - unsigned int first; /// MeshIndex for first compartment - unsigned int second; /// MeshIndex for second compartment - double firstVol; - double secondVol; - double diffScale; /// smaller of the cross-section areas / diffLen + unsigned int first; /// MeshIndex for first compartment + unsigned int second; /// MeshIndex for second compartment + double firstVol; + double secondVol; + double diffScale; /// smaller of the cross-section areas / diffLen }; #endif // _VOXEL_JUNCTION_H diff --git a/moose-core/msg/Msg.cpp b/moose-core/msg/Msg.cpp index f260365224c18cfcb1a0f423f7ac3d64ba46adbe..96f7978fcf3a794a9028fc9b84b689ac3dd5df70 100644 --- a/moose-core/msg/Msg.cpp +++ b/moose-core/msg/Msg.cpp @@ -28,37 +28,38 @@ bool Msg::lastTrump_ = false; const Msg* Msg::lastMsg_ = 0; Msg::Msg( ObjId mid, Element* e1, Element* e2 ) - : mid_( mid), e1_( e1 ), e2_( e2 ) + : mid_( mid), e1_( e1 ), e2_( e2 ) { - e1->addMsg( mid_ ); - e2->addMsg( mid_ ); - lastMsg_ = this; + e1->addMsg( mid_ ); + e2->addMsg( mid_ ); + lastMsg_ = this; } Msg::~Msg() { - if ( !lastTrump_ ) { - e1_->dropMsg( mid_ ); - e2_->dropMsg( mid_ ); - } - - /* - if ( mid_ > 1 ) - garbageMsg_.push_back( mid_ ); - */ + if ( !lastTrump_ ) + { + e1_->dropMsg( mid_ ); + e2_->dropMsg( mid_ ); + } + + /* + if ( mid_ > 1 ) + garbageMsg_.push_back( mid_ ); + */ } // Static func void Msg::deleteMsg( ObjId mid ) { - const Msg* msg = getMsg( mid ); - delete( msg ); + const Msg* msg = getMsg( mid ); + delete( msg ); } // Static func const Msg* Msg::getMsg( ObjId m ) { - return reinterpret_cast< const Msg* >( m.data() ); + return reinterpret_cast< const Msg* >( m.data() ); } /** @@ -66,7 +67,7 @@ const Msg* Msg::getMsg( ObjId m ) */ Id Msg::getE1() const { - return e1_->id(); + return e1_->id(); } /** @@ -74,83 +75,99 @@ Id Msg::getE1() const */ Id Msg::getE2() const { - return e2_->id(); + return e2_->id(); } vector< string > Msg::getSrcFieldsOnE1() const { - vector< pair< BindIndex, FuncId > > ids; - vector< string > ret; - - e1_->getFieldsOfOutgoingMsg( mid_, ids ); - - for ( unsigned int i = 0; i < ids.size(); ++i ) { - string name = e1_->cinfo()->srcFinfoName( ids[i].first ); - if ( name == "" ) { - cout << "Error: Msg::getSrcFieldsOnE1: Failed to find field on msg " << - e1_->getName() << "-->" << e2_->getName() << endl; - } else { - ret.push_back( name ); - } - } - return ret; + vector< pair< BindIndex, FuncId > > ids; + vector< string > ret; + + e1_->getFieldsOfOutgoingMsg( mid_, ids ); + + for ( unsigned int i = 0; i < ids.size(); ++i ) + { + string name = e1_->cinfo()->srcFinfoName( ids[i].first ); + if ( name == "" ) + { + cout << "Error: Msg::getSrcFieldsOnE1: Failed to find field on msg " << + e1_->getName() << "-->" << e2_->getName() << endl; + } + else + { + ret.push_back( name ); + } + } + return ret; } vector< string > Msg::getDestFieldsOnE2() const { - vector< pair< BindIndex, FuncId > > ids; - vector< string > ret; - - e1_->getFieldsOfOutgoingMsg( mid_, ids ); - - for ( unsigned int i = 0; i < ids.size(); ++i ) { - string name = e2_->cinfo()->destFinfoName( ids[i].second ); - if ( name == "" ) { - cout << "Error: Msg::getDestFieldsOnE2: Failed to find field on msg " << - e1_->getName() << "-->" << e2_->getName() << endl; - } else { - ret.push_back( name ); - } - } - return ret; + vector< pair< BindIndex, FuncId > > ids; + vector< string > ret; + + e1_->getFieldsOfOutgoingMsg( mid_, ids ); + + for ( unsigned int i = 0; i < ids.size(); ++i ) + { + string name = e2_->cinfo()->destFinfoName( ids[i].second ); + if ( name == "" ) + { + cout << "Error: Msg::getDestFieldsOnE2: Failed to find field on msg " << + e1_->getName() << "-->" << e2_->getName() << endl; + } + else + { + ret.push_back( name ); + } + } + return ret; } vector< string > Msg::getSrcFieldsOnE2() const { - vector< pair< BindIndex, FuncId > > ids; - vector< string > ret; - - e2_->getFieldsOfOutgoingMsg( mid_, ids ); - - for ( unsigned int i = 0; i < ids.size(); ++i ) { - string name = e2_->cinfo()->srcFinfoName( ids[i].first ); - if ( name == "" ) { - cout << "Error: Msg::getSrcFieldsOnE2: Failed to find field on msg " << - e1_->getName() << "-->" << e2_->getName() << endl; - } else { - ret.push_back( name ); - } - } - return ret; + vector< pair< BindIndex, FuncId > > ids; + vector< string > ret; + + e2_->getFieldsOfOutgoingMsg( mid_, ids ); + + for ( unsigned int i = 0; i < ids.size(); ++i ) + { + string name = e2_->cinfo()->srcFinfoName( ids[i].first ); + if ( name == "" ) + { + cout << "Error: Msg::getSrcFieldsOnE2: Failed to find field on msg " << + e1_->getName() << "-->" << e2_->getName() << endl; + } + else + { + ret.push_back( name ); + } + } + return ret; } vector< string > Msg::getDestFieldsOnE1() const { - vector< pair< BindIndex, FuncId > > ids; - vector< string > ret; - - e2_->getFieldsOfOutgoingMsg( mid_, ids ); - - for ( unsigned int i = 0; i < ids.size(); ++i ) { - string name = e1_->cinfo()->destFinfoName( ids[i].second ); - if ( name == "" ) { - cout << "Error: Msg::getDestFieldsOnE1: Failed to find field on msg " << - e1_->getName() << "-->" << e2_->getName() << endl; - } else { - ret.push_back( name ); - } - } - return ret; + vector< pair< BindIndex, FuncId > > ids; + vector< string > ret; + + e2_->getFieldsOfOutgoingMsg( mid_, ids ); + + for ( unsigned int i = 0; i < ids.size(); ++i ) + { + string name = e1_->cinfo()->destFinfoName( ids[i].second ); + if ( name == "" ) + { + cout << "Error: Msg::getDestFieldsOnE1: Failed to find field on msg " << + e1_->getName() << "-->" << e2_->getName() << endl; + } + else + { + ret.push_back( name ); + } + } + return ret; } ObjId Msg::getAdjacent(ObjId obj) const @@ -164,70 +181,71 @@ ObjId Msg::getAdjacent(ObjId obj) const const Cinfo* Msg::initCinfo() { - /////////////////////////////////////////////////////////////////// - // Field definitions. - /////////////////////////////////////////////////////////////////// - static ReadOnlyValueFinfo< Msg, Id > e1( - "e1", - "Id of source Element.", - &Msg::getE1 - ); - static ReadOnlyValueFinfo< Msg, Id > e2( - "e2", - "Id of source Element.", - &Msg::getE2 - ); - - static ReadOnlyValueFinfo< Msg, vector< string > > srcFieldsOnE1( - "srcFieldsOnE1", - "Names of SrcFinfos for messages going from e1 to e2. There are" - "matching entries in the destFieldsOnE2 vector", - &Msg::getSrcFieldsOnE1 - ); - static ReadOnlyValueFinfo< Msg, vector< string > > destFieldsOnE2( - "destFieldsOnE2", - "Names of DestFinfos for messages going from e1 to e2. There are" - "matching entries in the srcFieldsOnE1 vector", - &Msg::getDestFieldsOnE2 - ); - static ReadOnlyValueFinfo< Msg, vector< string > > srcFieldsOnE2( - "srcFieldsOnE2", - "Names of SrcFinfos for messages going from e2 to e1. There are" - "matching entries in the destFieldsOnE1 vector", - &Msg::getSrcFieldsOnE2 - ); - static ReadOnlyValueFinfo< Msg, vector< string > > destFieldsOnE1( - "destFieldsOnE1", - "Names of destFinfos for messages going from e2 to e1. There are" - "matching entries in the srcFieldsOnE2 vector", - &Msg::getDestFieldsOnE1 - ); - - static ReadOnlyLookupValueFinfo< Msg, ObjId, ObjId > adjacent( - "adjacent", - "The element adjacent to the specified element", - &Msg::getAdjacent); - - static Finfo* msgFinfos[] = { - &e1, // readonly value - &e2, // readonly value - &srcFieldsOnE1, // readonly value - &destFieldsOnE2, // readonly value - &srcFieldsOnE2, // readonly value - &destFieldsOnE1, // readonly value - &adjacent, // readonly lookup value - }; - - static Cinfo msgCinfo ( - "Msg", // name - Neutral::initCinfo(), // base class - msgFinfos, - sizeof( msgFinfos ) / sizeof( Finfo* ), // num Fields - 0 - // new Dinfo< Msg >() - ); - - return &msgCinfo; + /////////////////////////////////////////////////////////////////// + // Field definitions. + /////////////////////////////////////////////////////////////////// + static ReadOnlyValueFinfo< Msg, Id > e1( + "e1", + "Id of source Element.", + &Msg::getE1 + ); + static ReadOnlyValueFinfo< Msg, Id > e2( + "e2", + "Id of source Element.", + &Msg::getE2 + ); + + static ReadOnlyValueFinfo< Msg, vector< string > > srcFieldsOnE1( + "srcFieldsOnE1", + "Names of SrcFinfos for messages going from e1 to e2. There are" + "matching entries in the destFieldsOnE2 vector", + &Msg::getSrcFieldsOnE1 + ); + static ReadOnlyValueFinfo< Msg, vector< string > > destFieldsOnE2( + "destFieldsOnE2", + "Names of DestFinfos for messages going from e1 to e2. There are" + "matching entries in the srcFieldsOnE1 vector", + &Msg::getDestFieldsOnE2 + ); + static ReadOnlyValueFinfo< Msg, vector< string > > srcFieldsOnE2( + "srcFieldsOnE2", + "Names of SrcFinfos for messages going from e2 to e1. There are" + "matching entries in the destFieldsOnE1 vector", + &Msg::getSrcFieldsOnE2 + ); + static ReadOnlyValueFinfo< Msg, vector< string > > destFieldsOnE1( + "destFieldsOnE1", + "Names of destFinfos for messages going from e2 to e1. There are" + "matching entries in the srcFieldsOnE2 vector", + &Msg::getDestFieldsOnE1 + ); + + static ReadOnlyLookupValueFinfo< Msg, ObjId, ObjId > adjacent( + "adjacent", + "The element adjacent to the specified element", + &Msg::getAdjacent); + + static Finfo* msgFinfos[] = + { + &e1, // readonly value + &e2, // readonly value + &srcFieldsOnE1, // readonly value + &destFieldsOnE2, // readonly value + &srcFieldsOnE2, // readonly value + &destFieldsOnE1, // readonly value + &adjacent, // readonly lookup value + }; + + static Cinfo msgCinfo ( + "Msg", // name + Neutral::initCinfo(), // base class + msgFinfos, + sizeof( msgFinfos ) / sizeof( Finfo* ), // num Fields + 0 + // new Dinfo< Msg >() + ); + + return &msgCinfo; } static const Cinfo* msgCinfo = Msg::initCinfo(); @@ -235,77 +253,82 @@ static const Cinfo* msgCinfo = Msg::initCinfo(); // Static func. Returns the index to use for msgIndex. unsigned int Msg::initMsgManagers() { - Dinfo< short > dummyDinfo; - - // This is to be the parent of all the msg managers. - msgManagerId_ = Id::nextId(); - new GlobalDataElement( - msgManagerId_, Neutral::initCinfo(), "Msgs", 1 ); - - SingleMsg::managerId_ = Id::nextId(); - new MsgElement( SingleMsg::managerId_, SingleMsg::initCinfo(), - "singleMsg", &SingleMsg::numMsg, &SingleMsg::lookupMsg ); - - OneToOneMsg::managerId_ = Id::nextId(); - new MsgElement( OneToOneMsg::managerId_, OneToOneMsg::initCinfo(), - "oneToOneMsg", &OneToOneMsg::numMsg, &OneToOneMsg::lookupMsg ); - - OneToAllMsg::managerId_ = Id::nextId(); - new MsgElement( OneToAllMsg::managerId_, OneToAllMsg::initCinfo(), - "oneToAllMsg", &OneToAllMsg::numMsg, &OneToAllMsg::lookupMsg ); - - DiagonalMsg::managerId_ = Id::nextId(); - new MsgElement( DiagonalMsg::managerId_, DiagonalMsg::initCinfo(), - "diagonalMsg", &DiagonalMsg::numMsg, &DiagonalMsg::lookupMsg ); - - SparseMsg::managerId_ = Id::nextId(); - new MsgElement( SparseMsg::managerId_, SparseMsg::initCinfo(), - "sparseMsg", &SparseMsg::numMsg, &SparseMsg::lookupMsg ); - - OneToOneDataIndexMsg::managerId_ = Id::nextId(); - new MsgElement( OneToOneDataIndexMsg::managerId_, - OneToOneDataIndexMsg::initCinfo(), - "oneToOneDataIndexMsg", - &OneToOneDataIndexMsg::numMsg, - &OneToOneDataIndexMsg::lookupMsg ); - - // Do the 'adopt' only after all the message managers exist - we need - // the OneToAll manager for the adoption messages themselves. - assert( OneToAllMsg::numMsg() == 0 ); - unsigned int n = 1; - Shell::adopt( Id(), msgManagerId_, n++ ); - Shell::adopt( msgManagerId_, SingleMsg::managerId_, n++ ); - Shell::adopt( msgManagerId_, OneToOneMsg::managerId_, n++ ); - Shell::adopt( msgManagerId_, OneToAllMsg::managerId_, n++ ); - Shell::adopt( msgManagerId_, DiagonalMsg::managerId_, n++ ); - Shell::adopt( msgManagerId_, SparseMsg::managerId_, n++ ); - - return n; + Dinfo< short > dummyDinfo; + + // This is to be the parent of all the msg managers. + msgManagerId_ = Id::nextId(); + new GlobalDataElement( + msgManagerId_, Neutral::initCinfo(), "Msgs", 1 ); + + SingleMsg::managerId_ = Id::nextId(); + new MsgElement( SingleMsg::managerId_, SingleMsg::initCinfo(), + "singleMsg", &SingleMsg::numMsg, &SingleMsg::lookupMsg ); + + OneToOneMsg::managerId_ = Id::nextId(); + new MsgElement( OneToOneMsg::managerId_, OneToOneMsg::initCinfo(), + "oneToOneMsg", &OneToOneMsg::numMsg, &OneToOneMsg::lookupMsg ); + + OneToAllMsg::managerId_ = Id::nextId(); + new MsgElement( OneToAllMsg::managerId_, OneToAllMsg::initCinfo(), + "oneToAllMsg", &OneToAllMsg::numMsg, &OneToAllMsg::lookupMsg ); + + DiagonalMsg::managerId_ = Id::nextId(); + new MsgElement( DiagonalMsg::managerId_, DiagonalMsg::initCinfo(), + "diagonalMsg", &DiagonalMsg::numMsg, &DiagonalMsg::lookupMsg ); + + SparseMsg::managerId_ = Id::nextId(); + new MsgElement( SparseMsg::managerId_, SparseMsg::initCinfo(), + "sparseMsg", &SparseMsg::numMsg, &SparseMsg::lookupMsg ); + + OneToOneDataIndexMsg::managerId_ = Id::nextId(); + new MsgElement( OneToOneDataIndexMsg::managerId_, + OneToOneDataIndexMsg::initCinfo(), + "oneToOneDataIndexMsg", + &OneToOneDataIndexMsg::numMsg, + &OneToOneDataIndexMsg::lookupMsg ); + + // Do the 'adopt' only after all the message managers exist - we need + // the OneToAll manager for the adoption messages themselves. + assert( OneToAllMsg::numMsg() == 0 ); + unsigned int n = 1; + Shell::adopt( Id(), msgManagerId_, n++ ); + Shell::adopt( msgManagerId_, SingleMsg::managerId_, n++ ); + Shell::adopt( msgManagerId_, OneToOneMsg::managerId_, n++ ); + Shell::adopt( msgManagerId_, OneToAllMsg::managerId_, n++ ); + Shell::adopt( msgManagerId_, DiagonalMsg::managerId_, n++ ); + Shell::adopt( msgManagerId_, SparseMsg::managerId_, n++ ); + + return n; } void Msg::clearAllMsgs() { - lastTrump_ = true; - for ( unsigned int i = 0; i < SingleMsg::numMsg(); ++i ) { - Msg* m = reinterpret_cast< Msg* >( SingleMsg::lookupMsg( i ) ); - if ( m ) delete m; - } - for ( unsigned int i = 0; i < OneToOneMsg::numMsg(); ++i ) { - Msg* m = reinterpret_cast< Msg* >( OneToOneMsg::lookupMsg( i ) ); - if ( m ) delete m; - } - for ( unsigned int i = 0; i < OneToAllMsg::numMsg(); ++i ) { - Msg* m = reinterpret_cast< Msg* >( OneToAllMsg::lookupMsg( i ) ); - if ( m ) delete m; - } - for ( unsigned int i = 0; i < DiagonalMsg::numMsg(); ++i ) { - Msg* m = reinterpret_cast< Msg* >( DiagonalMsg::lookupMsg( i ) ); - if ( m ) delete m; - } - for ( unsigned int i = 0; i < SparseMsg::numMsg(); ++i ) { - Msg* m = reinterpret_cast< Msg* >( SparseMsg::lookupMsg( i ) ); - if ( m ) delete m; - } + lastTrump_ = true; + for ( unsigned int i = 0; i < SingleMsg::numMsg(); ++i ) + { + Msg* m = reinterpret_cast< Msg* >( SingleMsg::lookupMsg( i ) ); + if ( m ) delete m; + } + for ( unsigned int i = 0; i < OneToOneMsg::numMsg(); ++i ) + { + Msg* m = reinterpret_cast< Msg* >( OneToOneMsg::lookupMsg( i ) ); + if ( m ) delete m; + } + for ( unsigned int i = 0; i < OneToAllMsg::numMsg(); ++i ) + { + Msg* m = reinterpret_cast< Msg* >( OneToAllMsg::lookupMsg( i ) ); + if ( m ) delete m; + } + for ( unsigned int i = 0; i < DiagonalMsg::numMsg(); ++i ) + { + Msg* m = reinterpret_cast< Msg* >( DiagonalMsg::lookupMsg( i ) ); + if ( m ) delete m; + } + for ( unsigned int i = 0; i < SparseMsg::numMsg(); ++i ) + { + Msg* m = reinterpret_cast< Msg* >( SparseMsg::lookupMsg( i ) ); + if ( m ) delete m; + } } /** @@ -314,10 +337,10 @@ void Msg::clearAllMsgs() */ const Msg* Msg::lastMsg() { - return lastMsg_; + return lastMsg_; } bool Msg::isLastTrump() { - return lastTrump_; + return lastTrump_; } diff --git a/moose-core/msg/SparseMsg.cpp b/moose-core/msg/SparseMsg.cpp index 0196ed30df92d83c61b7802f9615d1e557583778..a43d78c5897b9c0efa004643ac4d571471bde385 100644 --- a/moose-core/msg/SparseMsg.cpp +++ b/moose-core/msg/SparseMsg.cpp @@ -83,7 +83,7 @@ const Cinfo* SparseMsg::initCinfo() &SparseMsg::getProbability ); - static ValueFinfo< SparseMsg, unsigned long > seed( + static ValueFinfo< SparseMsg, int > seed( "seed", "Random number seed for generating probabilistic connectivity.", &SparseMsg::setSeed, @@ -95,95 +95,91 @@ const Cinfo* SparseMsg::initCinfo() //////////////////////////////////////////////////////////////////////// static DestFinfo setRandomConnectivity( "setRandomConnectivity", - "Assigns connectivity with specified probability and seed", - new OpFunc2< SparseMsg, double, long >( - &SparseMsg::setRandomConnectivity ) ); + "Assigns connectivity with specified probability and seed", + new OpFunc2< SparseMsg, double, long >( + &SparseMsg::setRandomConnectivity ) ); static DestFinfo setEntry( "setEntry", - "Assigns single row,column value", - new OpFunc3< SparseMsg, unsigned int, unsigned int, unsigned int >( - &SparseMsg::setEntry ) ); + "Assigns single row,column value", + new OpFunc3< SparseMsg, unsigned int, unsigned int, unsigned int >( + &SparseMsg::setEntry ) ); static DestFinfo unsetEntry( "unsetEntry", - "Clears single row,column entry", - new OpFunc2< SparseMsg, unsigned int, unsigned int >( - &SparseMsg::unsetEntry ) ); + "Clears single row,column entry", + new OpFunc2< SparseMsg, unsigned int, unsigned int >( + &SparseMsg::unsetEntry ) ); static DestFinfo clear( "clear", - "Clears out the entire matrix", - new OpFunc0< SparseMsg >( - &SparseMsg::clear ) ); + "Clears out the entire matrix", + new OpFunc0< SparseMsg >( + &SparseMsg::clear ) ); static DestFinfo transpose( "transpose", - "Transposes the sparse matrix", - new OpFunc0< SparseMsg >( - &SparseMsg::transpose ) ); + "Transposes the sparse matrix", + new OpFunc0< SparseMsg >( + &SparseMsg::transpose ) ); static DestFinfo pairFill( "pairFill", - "Fills entire matrix using pairs of (x,y) indices to indicate " - "presence of a connection. If the target is a FieldElement it" - "automagically assigns FieldIndices.", - new OpFunc2< SparseMsg, - vector< unsigned int >, vector< unsigned int> >( - &SparseMsg::pairFill ) ); + "Fills entire matrix using pairs of (x,y) indices to indicate " + "presence of a connection. If the target is a FieldElement it" + "automagically assigns FieldIndices.", + new OpFunc2< SparseMsg, + vector< unsigned int >, vector< unsigned int> >( + &SparseMsg::pairFill ) ); static DestFinfo tripletFill( "tripletFill", - "Fills entire matrix using triplets of (x,y,fieldIndex) to fully " - "specify every connection in the sparse matrix.", - new OpFunc3< SparseMsg, - vector< unsigned int >, vector< unsigned int>, - vector< unsigned int > >( - &SparseMsg::tripletFill ) ); + "Fills entire matrix using triplets of (x,y,fieldIndex) to fully " + "specify every connection in the sparse matrix.", + new OpFunc3< SparseMsg, + vector< unsigned int >, vector< unsigned int>, + vector< unsigned int > >( + &SparseMsg::tripletFill ) ); static DestFinfo tripletFill1( "tripletFill1", - "Single contiguous array to fill entire connection matrix using " - "triplets of (x,y, fieldindex) ordered as \n" - "(x0, x1,... xn-1, y0, y1,... yn-1, fi0, fi1,... fi_n-1)\n", - new OpFunc1< SparseMsg, vector< unsigned int > >( - &SparseMsg::tripletFill1 ) ); + "Single contiguous array to fill entire connection matrix using " + "triplets of (x,y, fieldindex) ordered as \n" + "(x0, x1,... xn-1, y0, y1,... yn-1, fi0, fi1,... fi_n-1)\n", + new OpFunc1< SparseMsg, vector< unsigned int > >( + &SparseMsg::tripletFill1 ) ); -//////////////////////////////////////////////////////////////////////// -// Assemble it all. -//////////////////////////////////////////////////////////////////////// + // Assemble it all. static Finfo* sparseMsgFinfos[] = { - &numRows, // readonly value - &numColumns, // readonly value - &numEntries, // readonly value - &connectionList, // value - &matrixEntry, // ReadOnlyValue - &columnIndex, // ReadOnlyValue - &rowStart, // ReadOnlyValue - &probability, // value - &seed, // value - &setRandomConnectivity, // dest - &setEntry, // dest - &unsetEntry, //dest - &clear, //dest - &transpose, //dest - &pairFill, //dest - &tripletFill, //dest - &tripletFill1, //dest + &numRows, // readonly value + &numColumns, // readonly value + &numEntries, // readonly value + &connectionList, // value + &matrixEntry, // ReadOnlyValue + &columnIndex, // ReadOnlyValue + &rowStart, // ReadOnlyValue + &probability, // value + &seed, // value + &setRandomConnectivity, // dest + &setEntry, // dest + &unsetEntry, // dest + &clear, // dest + &transpose, // dest + &pairFill, // dest + &tripletFill, // dest + &tripletFill1, // dest }; static Dinfo< short > dinfo; static Cinfo sparseMsgCinfo ( - "SparseMsg", // name - Msg::initCinfo(), // base class - sparseMsgFinfos, - sizeof( sparseMsgFinfos ) / sizeof( Finfo* ), // num Fields - &dinfo - ); + "SparseMsg", // name + Msg::initCinfo(), // base class + sparseMsgFinfos, + sizeof( sparseMsgFinfos ) / sizeof( Finfo* ), // num Fields + &dinfo + ); return &sparseMsgCinfo; } static const Cinfo* sparseMsgCinfo = SparseMsg::initCinfo(); -////////////////////////////////////////////////////////////////// -// Value Fields -////////////////////////////////////////////////////////////////// +// Value Fields void SparseMsg::setProbability ( double probability ) { p_ = probability; @@ -195,18 +191,15 @@ double SparseMsg::getProbability ( ) const return p_; } -void SparseMsg::setSeed ( unsigned long seed ) +void SparseMsg::setSeed (int seed) { - if( seed > 0 ) - seed_ = seed; - else - seed_ = rd_(); - - rng_.seed( seed_ ); - randomConnect( p_ ); + seed_ = seed; + if( seed_ >= 0) + rng_.setSeed((size_t)seed_); + randomConnect(p_); } -unsigned long SparseMsg::getSeed () const +int SparseMsg::getSeed () const { return seed_; } @@ -271,7 +264,7 @@ vector< unsigned int > SparseMsg::getEntryPairs() const void SparseMsg::setRandomConnectivity( double probability, long seed ) { p_ = probability; - rng_.seed( seed ); + rng_.setSeed( seed ); randomConnect( probability ); } @@ -387,11 +380,11 @@ void SparseMsg::tripletFill1( vector< unsigned int > v ) SparseMsg::SparseMsg( Element* e1, Element* e2, unsigned int msgIndex ) - : Msg( ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ), - e1, e2 ), + : Msg(ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ), e1, e2), numThreads_( 1 ), nrows_( 0 ), - p_( 0.0 ), seed_( 0 ) + p_( 0.0 ), + seed_(-1) { unsigned int nrows = 0; unsigned int ncolumns = 0; @@ -411,9 +404,10 @@ SparseMsg::SparseMsg( Element* e1, Element* e2, unsigned int msgIndex ) // cout << Shell::myNode() << ": SparseMsg constructor between " << e1->getName() << " and " << e2->getName() << endl; - // Init rng with random device. - if( seed_ == 0 ) - rng_.seed( rd_() ); + // Init rng with global seed if any. + seed_ = moose::getGlobalSeed(); + if(seed_ >= 0) + setSeed(seed_); } SparseMsg::~SparseMsg() @@ -485,7 +479,7 @@ unsigned int SparseMsg::randomConnect( double probability ) unsigned int synNum = 0; for ( unsigned int j = 0; j < nRows; ++j ) { - double r = dist_( rng_ ); // Want to ensure it is called each time round the loop. + double r = rng_.uniform(); // Want to ensure it is called each time round the loop. if ( r < probability ) { synIndex.push_back( synNum ); diff --git a/moose-core/msg/SparseMsg.h b/moose-core/msg/SparseMsg.h index 0061a9fe4f30d183667fa19b17e2992c40599fee..17bfe7c8245f6723990e13ae6a0291db2a0ee5f2 100644 --- a/moose-core/msg/SparseMsg.h +++ b/moose-core/msg/SparseMsg.h @@ -87,8 +87,8 @@ public: vector< unsigned int > getColIndex() const; vector< unsigned int > getRowStart() const; - unsigned long getSeed() const; - void setSeed( unsigned long value ); + int getSeed() const; + void setSeed( int value ); vector< unsigned int > getEntryPairs() const; void setEntryPairs( vector< unsigned int > entries ); @@ -149,10 +149,8 @@ private: static vector< SparseMsg* > msg_; // RNG. - unsigned long seed_; - moose::MOOSE_RANDOM_DEVICE rd_; - moose::MOOSE_RNG_DEFAULT_ENGINE rng_; - moose::MOOSE_UNIFORM_DISTRIBUTION<double> dist_; + int seed_; + moose::RNG rng_; }; #endif // _SPARSE_MSG_H diff --git a/moose-core/pymoose/moosemodule.cpp b/moose-core/pymoose/moosemodule.cpp index affdc78f65e3c2006ee607e00a13f9fa1d6168a4..96e37d66f9f9df55d42c6cea1c2f8352b6f26870 100644 --- a/moose-core/pymoose/moosemodule.cpp +++ b/moose-core/pymoose/moosemodule.cpp @@ -1555,7 +1555,7 @@ PyObject * moose_move(PyObject * dummy, PyObject * args) PyDoc_STRVAR(moose_delete_documentation, "delete(obj)->None\n" "\n" - "Delete the underlying moose object. This does not delete any of the\n" + "Delete the underlying moose object(s). This does not delete any of the\n" "Python objects referring to this vec but does invalidate them. Any\n" "attempt to access them will raise a ValueError.\n" "\n" @@ -1577,10 +1577,7 @@ PyObject * moose_delete(PyObject * dummy, PyObject * args) { return NULL; } - // if (!PyObject_IsInstance(obj, (PyObject*)&IdType)){ - // PyErr_SetString(PyExc_TypeError, "vec instance expected"); - // return NULL; - // } + ObjId oid_; if (PyObject_IsInstance(obj, (PyObject*)&IdType)) { @@ -1598,13 +1595,14 @@ PyObject * moose_delete(PyObject * dummy, PyObject * args) } else { - PyErr_SetString(PyExc_ValueError, "cannot delete moose shell."); - return NULL; + PyErr_WarnEx(PyExc_RuntimeWarning, "Cannot delete moose shell.", 1); + Py_RETURN_NONE;; } + if (oid_ == ObjId()) { - PyErr_SetString(PyExc_ValueError, "cannot delete moose shell."); - return NULL; + PyErr_WarnEx(PyExc_RuntimeWarning, "Cannot delete moose shell.", 1); + Py_RETURN_NONE; } if ( oid_.bad() ) { @@ -3252,14 +3250,14 @@ PyMODINIT_FUNC MODINIT(_moose) clock_t defclasses_end = clock(); - LOG( moose::info, "`Time to define moose classes:" + LOG( moose::debug, "`Time to define moose classes:" << (defclasses_end - defclasses_start) * 1.0 /CLOCKS_PER_SEC ); //PyGILState_Release(gstate); clock_t modinit_end = clock(); - LOG( moose::info, "`Time to initialize module:" + LOG( moose::debug, "`Time to initialize module:" << (modinit_end - modinit_start) * 1.0 /CLOCKS_PER_SEC ); diff --git a/moose-core/python/moose/genesis/writeKkit.py b/moose-core/python/moose/genesis/writeKkit.py index 009f229911812e95e84ddc660050070ec855a699..27eaf50dda9b956a7f3f05f61be28f94e7878cef 100644 --- a/moose-core/python/moose/genesis/writeKkit.py +++ b/moose-core/python/moose/genesis/writeKkit.py @@ -664,7 +664,7 @@ def getColorCheck(color,GENESIS_COLOR_SEQUENCE): index = color return index elif isinstance(color, tuple): - color =[int(x) for x in color[0:3]] + color = [int(x) for x in color[0:3]] index = nearestColorIndex(color, GENESIS_COLOR_SEQUENCE) return index elif isinstance(color, int): @@ -832,4 +832,4 @@ if __name__ == "__main__": if written: print(" file written to ",output) else: - print(" could be written to kkit format") \ No newline at end of file + print(" could be written to kkit format") diff --git a/moose-core/python/moose/moose_test.py b/moose-core/python/moose/moose_test.py index 362a590e1c731d5d6ed8a23c06ee3e2d3e428b50..78f2f921a397939368aae8e72e1b3437229ea3fb 100644 --- a/moose-core/python/moose/moose_test.py +++ b/moose-core/python/moose/moose_test.py @@ -4,7 +4,7 @@ Test MOOSE installation with moose-examples. """ -from __future__ import print_function +from __future__ import print_function, division __author__ = "Dilawar Singh" __copyright__ = "Copyright 2016, Dilawar Singh" @@ -102,8 +102,8 @@ def init_test_dir( ): os.chdir( test_dir_ ) def suitable_for_testing( script ): - with open( script ) as f: - txt = f.read( ) + with open(script, 'r', encoding='utf8') as f: + txt = f.read() if not re.search( r'main\(\s*\)', txt ): _logger.debug( 'Script %s does not contain main( )' % script ) return False, 'main( ) not found' diff --git a/moose-core/python/moose/utils.py b/moose-core/python/moose/utils.py index 17c262d81c1b6637512525585af2080ab4270fa6..a5aba9518e9fcdfb5c6f2e417d59d13f26123e53 100644 --- a/moose-core/python/moose/utils.py +++ b/moose-core/python/moose/utils.py @@ -521,7 +521,7 @@ def assignDefaultTicks(modelRoot='/model', dataRoot='/data', solver='hsolve'): def stepRun(simtime, steptime, verbose=True, logger=None): """Run the simulation in steps of `steptime` for `simtime`.""" - clock = moose.Clock('/clock') + clock = moose.element('/clock') if verbose: msg = 'Starting simulation for %g' % (simtime) if logger is None: diff --git a/moose-core/randnum/CMakeLists.txt b/moose-core/randnum/CMakeLists.txt index cc4de6b76f7791ed222525d41f499689770447dc..a926912a02e9e63b9d96f8562e2b07d32d025a5b 100644 --- a/moose-core/randnum/CMakeLists.txt +++ b/moose-core/randnum/CMakeLists.txt @@ -1,11 +1,10 @@ cmake_minimum_required(VERSION 2.8) -if( ${CMAKE_SOURCE_DIR} EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ) - add_definitions( -std=c++11 -g -Wall ) -endif() - add_executable( normal_dist - ${CMAKE_CURRENT_SOURCE_DIR}/test_normal_dist.cpp) + ${CMAKE_CURRENT_SOURCE_DIR}/test_normal_dist.cpp + ) + +add_library(randnum RNG.cpp) enable_testing() add_test( NAME test_normal_dist COMMAND $<TARGET_FILE:normal_dist> ) diff --git a/moose-core/randnum/RNG.cpp b/moose-core/randnum/RNG.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6fa4857907f0ee791db71496a7b74908a3157c93 --- /dev/null +++ b/moose-core/randnum/RNG.cpp @@ -0,0 +1,75 @@ +/*** + * Description: Random number generator. + * + * Created: 2019-05-26 + + * Author: Dilawar Singh <dilawars@ncbs.res.in> + * Organization: NCBS Bangalore + * License: MIT License + */ + +#include "RNG.h" + +namespace moose { + +RNG::RNG () /* constructor */ +{ + // Setup a random seed if possible. + setRandomSeed( ); +} + +RNG::~RNG () /* destructor */ +{ ; } + +void RNG::setRandomSeed( ) +{ + MOOSE_RANDOM_DEVICE rd_; + setSeed( rd_() ); +} + +double RNG::getSeed( void ) +{ + return seed_; +} + +/** + * @brief If seed if 0 then set seed to a random number else set seed to + * the given number. + * + * @param seed + */ +void RNG::setSeed( const unsigned long seed ) +{ + seed_ = seed; + if( seed == 0 ) + { + MOOSE_RANDOM_DEVICE rd_; + seed_ = rd_(); + } + rng_.seed( seed_ ); +} + +/** + * @brief Generate a uniformly distributed random number between a and b. + * + * @param a Lower limit (inclusive) + * @param b Upper limit (inclusive). + */ +double RNG::uniform( const double a, const double b) +{ + return ( b - a ) * dist_( rng_ ) + a; +} + +/** + * @brief Return a uniformly distributed random number between 0 and 1 + * (exclusive). + * + * @return randum number. + */ +double RNG::uniform( void ) +{ + return dist_( rng_ ); +} + +} + diff --git a/moose-core/randnum/RNG.h b/moose-core/randnum/RNG.h index 758e599ba4ea21f666607e2a0d54bfed1f635e30..711a769a28d4049301c92a12301a67cdab186a79 100644 --- a/moose-core/randnum/RNG.h +++ b/moose-core/randnum/RNG.h @@ -22,6 +22,7 @@ #include <limits> #include <iostream> #include <random> +#include <cassert> #include "Definitions.h" #include "Distributions.h" @@ -30,7 +31,6 @@ using namespace std; namespace moose { - /* * ===================================================================================== * Class: RNG @@ -38,76 +38,28 @@ namespace moose * ===================================================================================== */ -template < typename T > class RNG { public: - RNG () /* constructor */ - { - // Setup a random seed if possible. - setRandomSeed( ); - } - - ~RNG () /* destructor */ - { ; } + RNG (); + ~RNG(); - void setRandomSeed( ) - { - MOOSE_RANDOM_DEVICE rd_; - setSeed( rd_() ); - } + void setRandomSeed( ); /* ==================== ACCESSORS ======================================= */ - T getSeed( void ) - { - return seed_; - } - - /* ==================== MUTATORS ======================================= */ - /** - * @brief If seed if 0 then set seed to a random number else set seed to - * the given number. - * - * @param seed - */ - void setSeed( const unsigned long seed ) - { - seed_ = seed; - if( seed == 0 ) - { - MOOSE_RANDOM_DEVICE rd_; - seed_ = rd_(); - } - rng_.seed( seed_ ); - } - - /** - * @brief Generate a uniformly distributed random number between a and b. - * - * @param a Lower limit (inclusive) - * @param b Upper limit (inclusive). - */ - T uniform( const T a, const T b) - { - return ( b - a ) * dist_( rng_ ) + a; - } - - /** - * @brief Return a uniformly distributed random number between 0 and 1 - * (exclusive). - * - * @return randum number. - */ - T uniform( void ) - { - return dist_( rng_ ); - } + double getSeed( void ); + + void setSeed( const unsigned long seed ); + + double uniform( const double a, const double b); + + double uniform( void ); private: /* ==================== DATA MEMBERS ======================================= */ - T res_; - T seed_; + double res_; + size_t seed_; moose::MOOSE_RNG_DEFAULT_ENGINE rng_; moose::MOOSE_UNIFORM_DISTRIBUTION<double> dist_; diff --git a/moose-core/scheduling/Clock.cpp b/moose-core/scheduling/Clock.cpp index e407bb63883ae39be46dc6eb7a15d2fa81be2d0b..aa7feb29e2fed635d349dc2df835ad862a67b7ee 100644 --- a/moose-core/scheduling/Clock.cpp +++ b/moose-core/scheduling/Clock.cpp @@ -49,9 +49,8 @@ */ #include "../basecode/header.h" -#include "Clock.h" -#include "../utility/numutil.h" #include "../utility/print_function.hpp" +#include "Clock.h" #if PARALLELIZE_CLOCK_USING_CPP11_ASYNC #include <future> diff --git a/moose-core/signeur/testSigNeur.cpp b/moose-core/signeur/testSigNeur.cpp index 9ea85ed4e250cf736a0e2fd425383911385c4fdf..4e0a7f6f4b11211402439facbe9968e8efc9bfca 100644 --- a/moose-core/signeur/testSigNeur.cpp +++ b/moose-core/signeur/testSigNeur.cpp @@ -9,7 +9,7 @@ **********************************************************************/ #ifdef DO_UNIT_TESTS -#include "header.h" +#include "../basecode/header.h" #include "Adaptor.h" #include "../shell/Shell.h" #include "../shell/Wildcard.h" diff --git a/moose-core/synapse/SeqSynHandler.cpp b/moose-core/synapse/SeqSynHandler.cpp index 7a0056dd94bb5ee8b7b0e12d8abb625fdfad1e99..da94fc4299d1bbf2bc6142ef7208f0084b1275c5 100644 --- a/moose-core/synapse/SeqSynHandler.cpp +++ b/moose-core/synapse/SeqSynHandler.cpp @@ -15,7 +15,7 @@ #include "SynHandlerBase.h" #include "RollingMatrix.h" #include "SeqSynHandler.h" -#include "../external/muparser/include/muParser.h" +#include "../builtins/MooseParser.h" const Cinfo* SeqSynHandler::initCinfo() { diff --git a/moose-core/synapse/testSynapse.cpp b/moose-core/synapse/testSynapse.cpp index 427f08b1c7a541411e5f7085a2b72d85e1dedf4f..d7f32b300d877a9056d20e267d47c82bee5ae6fb 100644 --- a/moose-core/synapse/testSynapse.cpp +++ b/moose-core/synapse/testSynapse.cpp @@ -10,7 +10,7 @@ #ifdef DO_UNIT_TESTS #include <queue> -#include "header.h" +#include "../basecode/header.h" #include "Synapse.h" #include "SynEvent.h" #include "SynHandlerBase.h" diff --git a/moose-core/tests/alpha/ex7.6_func_controls_reac_rate.py b/moose-core/tests/alpha/ex7.6_func_controls_reac_rate.py new file mode 100644 index 0000000000000000000000000000000000000000..b8c8fb4c64b3f80d9014633108baba45a55eaf1d --- /dev/null +++ b/moose-core/tests/alpha/ex7.6_func_controls_reac_rate.py @@ -0,0 +1,67 @@ +######################################################################## +# This example illustrates how a function can be used to control a reaction +# rate. This kind of calculation is appropriate when we need to link +# different kinds of physical processses with chemical reactions, for +# example, membrane curvature with molecule accumulation. The use of +# functions to modify reaction rates should be avoided in purely chemical +# systems since they obscure the underlying chemistry, and do not map +# cleanly to stochastic calculations. +# +# In this example we simply have a molecule C that controls the forward +# rate of a reaction that converts A to B. C is a function of location +# on the cylinder, and is fixed. In more elaborate computations we could +# have a function of multiple molecules, some of which could be changing and +# others could be buffered. +# +# Copyright (C) Upinder S. Bhalla NCBS 2018 +# Released under the terms of the GNU Public License V3. +######################################################################## + +import numpy as np +import moose +import pylab +import rdesigneur as rd + + +def makeFuncRate(): + model = moose.Neutral( '/library' ) + model = moose.Neutral( '/library/chem' ) + compt = moose.CubeMesh( '/library/chem/compt' ) + compt.volume = 1e-15 + A = moose.Pool( '/library/chem/compt/A' ) + B = moose.Pool( '/library/chem/compt/B' ) + C = moose.Pool( '/library/chem/compt/C' ) + reac = moose.Reac( '/library/chem/compt/reac' ) + func = moose.Function( '/library/chem/compt/reac/func' ) + func.x.num = 1 + func.expr = "(x0/1e8)^2" + moose.connect( C, 'nOut', func.x[0], 'input' ) + moose.connect( func, 'valueOut', reac, 'setNumKf' ) + moose.connect( reac, 'sub', A, 'reac' ) + moose.connect( reac, 'prd', B, 'reac' ) + + A.concInit = 1 + B.concInit = 0 + C.concInit = 0 + reac.Kb = 1 + + +makeFuncRate() + +rdes = rd.rdesigneur( + turnOffElec = True, + #This subdivides the 50-micron cylinder into 2 micron voxels + diffusionLength = 2e-6, + cellProto = [['somaProto', 'soma', 5e-6, 50e-6]], + chemProto = [['chem', 'chem']], + chemDistrib = [['chem', 'soma', 'install', '1' ]], + plotList = [['soma', '1', 'dend/A', 'conc', 'A conc', 'wave'], + ['soma', '1', 'dend/C', 'conc', 'C conc', 'wave']], +) +rdes.buildModel() + +C = moose.element( '/model/chem/dend/C' ) +C.vec.concInit = [ 1+np.sin(x/5.0) for x in range( len(C.vec) ) ] +moose.reinit() +moose.start(10) +rdes.display() diff --git a/moose-core/tests/alpha/function.py b/moose-core/tests/alpha/function.py new file mode 100644 index 0000000000000000000000000000000000000000..1dc982bf35ccbc05152413dd221e54abd2bd02e9 --- /dev/null +++ b/moose-core/tests/alpha/function.py @@ -0,0 +1,160 @@ +# function.py --- + +import numpy as np +import sys +import moose + +simtime = 1.0 +plot_ = False +if plot_: + import matplotlib.pyplot as plt + +def example(): + """Function objects can be used to evaluate expressions with arbitrary + number of variables and constants. We can assign expression of the + form:: + + f(c0, c1, ..., cM, x0, x1, ..., xN, y0,..., yP ) + + where `c_i`'s are constants and `x_i`'s and `y_i`'s are variables. + + The constants must be defined before setting the expression and + variables are connected via messages. The constants can have any + name, but the variable names must be of the form x{i} or y{i} + where i is increasing integer starting from 0. + + The `x_i`'s are field elements and you have to set their number + first (function.x.num = N). Then you can connect any source field + sending out double to the 'input' destination field of the + `x[i]`. + + The `y_i`'s are useful when the required variable is a value field + and is not available as a source field. In that case you connect + the `requestOut` source field of the function element to the + `get{Field}` destination field on the target element. The `y_i`'s + are automatically added on connecting. Thus, if you call:: + + moose.connect(function, 'requestOut', a, 'getSomeField') + moose.connect(function, 'requestOut', b, 'getSomeField') + + then ``a.someField`` will be assigned to ``y0`` and + ``b.someField`` will be assigned to ``y1``. + + In this example we evaluate the expression: ``z = c0 * exp(c1 * + x0) * cos(y0)`` + + with x0 ranging from -1 to +1 and y0 ranging from -pi to + +pi. These values are stored in two stimulus tables called xtab + and ytab respectively, so that at each timestep the next values of + x0 and y0 are assigned to the function. + + Along with the value of the expression itself we also compute its + derivative with respect to y0 and its derivative with respect to + time (rate). The former uses a five-point stencil for the + numerical differentiation and has a glitch at y=0. The latter uses + backward difference divided by dt. + + Unlike Func class, the number of variables and constants are + unlimited in Function and you can set all the variables via + messages. + + """ + demo = moose.Neutral('/model') + function = moose.Function('/model/function') + function.c['c0'] = 1.0 + function.c['c1'] = 2.0 + function.x.num = 1 + function.expr = 'c0 * exp(c1*x0) * cos(y0) + sin(t)' + # mode 0 - evaluate function value, derivative and rate + # mode 1 - just evaluate function value, + # mode 2 - evaluate derivative, + # mode 3 - evaluate rate + function.mode = 0 + function.independent = 'y0' + nsteps = 10000 + xarr = np.linspace(0.0, 1.0, nsteps) + # Stimulus tables allow you to store sequences of numbers which + # are delivered via the 'output' message at each time step. This + # is a placeholder and in real scenario you will be using any + # sourceFinfo that sends out a double value. + input_x = moose.StimulusTable('/xtab') + input_x.vector = xarr + input_x.startTime = 0.0 + input_x.stepPosition = xarr[0] + input_x.stopTime = simtime + moose.connect(input_x, 'output', function.x[0], 'input') + + yarr = np.linspace(-np.pi, np.pi, nsteps) + input_y = moose.StimulusTable('/ytab') + input_y.vector = yarr + input_y.startTime = 0.0 + input_y.stepPosition = yarr[0] + input_y.stopTime = simtime + moose.connect(function, 'requestOut', input_y, 'getOutputValue') + + # data recording + result = moose.Table('/ztab') + moose.connect(result, 'requestOut', function, 'getValue') + derivative = moose.Table('/zprime') + moose.connect(derivative, 'requestOut', function, 'getDerivative') + rate = moose.Table('/dz_by_dt') + moose.connect(rate, 'requestOut', function, 'getRate') + x_rec = moose.Table('/xrec') + moose.connect(x_rec, 'requestOut', input_x, 'getOutputValue') + y_rec = moose.Table('/yrec') + moose.connect(y_rec, 'requestOut', input_y, 'getOutputValue') + + dt = simtime/nsteps + for ii in range(32): + moose.setClock(ii, dt) + moose.reinit() + moose.start(simtime) + + # Uncomment the following lines and the import matplotlib.pyplot as plt on top + # of this file to display the plot. + if plot_: + plt.plot(x_rec.vector, result.vector, 'r-', label='z = {}'.format(function.expr)) + plt.subplot(4,1,1) + z = function.c['c0'] * np.exp(function.c['c1'] * xarr) * np.cos(yarr) + np.sin(np.arange(len(xarr)) * dt) + zz = result.vector[1:] + err = z[1:] - zz[1:] + assert (np.abs(err) <= 0.05).all(), err + assert (np.mean(err) <= 0.001), np.mean(err) + + if plot_: + plt.plot(xarr, z, 'b--', label='numpy computed') + plt.xlabel('x') + plt.ylabel('z') + plt.legend() + + if plot_: + plt.subplot(4,1,2) + plt.plot(y_rec.vector, derivative.vector, 'r-', label='dz/dy0') + # derivatives computed by putting x values in the analytical formula + dzdy = function.c['c0'] * np.exp(function.c['c1'] * xarr) * (- np.sin(yarr)) + err = np.abs(dzdy - derivative.vector[1:]) + assert (err < 1e-2).all(), err + assert (np.mean(err) < 1e-3), np.mean(err) + + if plot_: + plt.plot(yarr, dzdy, 'b--', label='numpy computed') + plt.xlabel('y') + plt.ylabel('dz/dy') + plt.legend() + + if plot_: + plt.subplot(4,1,3) + # *** BEWARE *** The first two entries are spurious. Entry 0 is + # *** from reinit sending out the defaults. Entry 2 is because + # *** there is no lastValue for computing real forward difference. + plt.plot(np.arange(2, len(rate.vector), 1) * dt, rate.vector[2:], 'r-', label='dz/dt') + dzdt = np.diff(z)/dt + plt.plot(np.arange(0, len(dzdt), 1.0) * dt, dzdt, 'b--', label='numpy computed') + plt.xlabel('t') + plt.ylabel('dz/dt') + plt.legend() + plt.tight_layout() + plt.show() + +if __name__ == '__main__': + example() diff --git a/moose-core/tests/python/test_socket_streamer_multitab.py b/moose-core/tests/alpha/test_socket_streamer_multitab.py similarity index 100% rename from moose-core/tests/python/test_socket_streamer_multitab.py rename to moose-core/tests/alpha/test_socket_streamer_multitab.py diff --git a/moose-core/tests/python/test_socket_streamer_uds.py b/moose-core/tests/alpha/test_socket_streamer_uds.py similarity index 100% rename from moose-core/tests/python/test_socket_streamer_uds.py rename to moose-core/tests/alpha/test_socket_streamer_uds.py diff --git a/moose-core/tests/issues/issue_239.py b/moose-core/tests/issues/issue_239.py new file mode 100644 index 0000000000000000000000000000000000000000..be0576b3a04b045637079229d51ef319bf7fb577 --- /dev/null +++ b/moose-core/tests/issues/issue_239.py @@ -0,0 +1,41 @@ +import moose +print( 'Using moose from %s' % moose.__file__) + +modelRoot = moose.Neutral('/model') +compt = moose.CubeMesh('/model/kinetics') +p1 = moose.BufPool('/model/kinetics/Ca') +function = moose.Function('/model/kinetics/Ca/func') +#function out to pool +moose.connect( function, 'valueOut', p1 ,'setConc' ) +#input pools to be connected to fuction +S1 = moose.BufPool( '/model/kinetics/s1' ) +S2 = moose.BufPool( '/model/kinetics/s2' ) + +initiexpr = function.expr +#S1 connected to function +numVariables = function.numVars +expr = "" +expr = (function.expr+'+'+'x'+str(numVariables)) +expr = expr.lstrip("0 +") +expr = expr.replace(" ","") +function.expr = expr +s1msg = moose.connect( S1, 'nOut', function.x[numVariables], 'input' ) +#S2 connected to function +numVariables = function.numVars +expr = "" +expr = (function.expr+'+'+'x'+str(numVariables)) +expr = expr.lstrip("0 +") +expr = expr.replace(" ","") +function.expr = expr +s2msg = moose.connect( S2, 'nOut', function.x[numVariables], 'input' ) + +compts = moose.wildcardFind(modelRoot.path+'/##[ISA=ChemCompt]') +solver = 'gsl' +moose.mooseAddChemSolver('/model',solver) +moose.mooseDeleteChemSolver('/model') + +#moose.delete(s1msg) +#moose.delete(s2msg) +#deleting the function +#moose.delete(function) #deleting this will not cause seg fault +print(function.expr) #function's expr still has the expression which is causing the problem diff --git a/moose-core/tests/issues/issue_47.py b/moose-core/tests/issues/issue_47.py index d2d6d964d4a5fe8710efa78e4aaf471d1f61ae34..b1d682d6517edc1e26a8aca84c6611a6c42506aa 100644 --- a/moose-core/tests/issues/issue_47.py +++ b/moose-core/tests/issues/issue_47.py @@ -1,8 +1,14 @@ # -*- coding: utf-8 -*- # Issue 47 on moose-core import moose +import os +sdir = os.path.dirname( __file__ ) print( '[INFO] Using moose from %s' % moose.__file__ ) -# moose.loadModel('../data/acc94.g','/acc94','gsl') -moose.loadModel('../data/acc94.g','/acc94','gssa') -moose.reinit() -moose.run( 10 ) +print( '[WONTFIX] See https://github.com/BhallaLab/moose-core/issues/47') +if False: + moose.loadModel(os.path.join(sdir,'../data/acc94.g'),'/acc94','gsl') + #moose.loadModel(os.path.join(sdir,'../data/acc94.g'),'/acc94','gssa') + moose.reinit() + moose.start( 10 ) +else: + quit(0) diff --git a/moose-core/tests/issues/issue_93.py b/moose-core/tests/issues/issue_93.py index 3a043308b70628164b4820ab5c9f33b9b0eafd85..4c4722428005ca55fdb9a40a4daf77c3a03d8891 100644 --- a/moose-core/tests/issues/issue_93.py +++ b/moose-core/tests/issues/issue_93.py @@ -2,7 +2,7 @@ # Issue #93 on moose-core import numpy as np -import pylab as pl +import matplotlib.pyplot as plt import moose import os import sys @@ -13,7 +13,7 @@ d = os.path.split( os.path.abspath( __file__ ) )[0] def loadAndRun(solver=True): simtime = 500e-3 - model = moose.loadModel('../data/h10.CNG.swc', '/cell') + model = moose.loadModel(os.path.join(d, '../data/h10.CNG.swc'), '/cell') comp = moose.element('/cell/apical_e_177_0') soma = moose.element('/cell/soma') for i in range(10): @@ -40,20 +40,18 @@ def loadAndRun(solver=True): return vec def main( ): - print( '[INFO] See the detailed issue in %s/hsolve' % d ) - quit() eeVec = loadAndRun( False ) hsolveVec = loadAndRun( True ) clk = moose.Clock( '/clock' ) print( '[DEBUG] Total entries %s' % len( eeVec )) - t = pl.linspace(0, clk.currentTime, len( eeVec )) - pl.plot(t, eeVec, label = 'ee' ) - pl.plot( t, hsolveVec, label = 'hsolve' ) + t = np.linspace(0, clk.currentTime, len( eeVec )) + plt.plot(t, eeVec, label = 'ee' ) + plt.plot( t, hsolveVec, label = 'hsolve' ) outfile = '%s.png' % sys.argv[0] - pl.legend( ) - pl.savefig( outfile ) + plt.legend( ) + plt.savefig( outfile ) print( '[INFO] Wrote results to %s' % outfile ) - pl.show() + return 1 if __name__ == '__main__': main() diff --git a/moose-core/tests/python/test_Xreacs2.py b/moose-core/tests/python/test_Xreacs2.py index 2fb36cfb16f05a3e4669b6f201f30867330a25f1..c02a2cc3f32d1ac593cfe1b1661697b5d4be81b3 100644 --- a/moose-core/tests/python/test_Xreacs2.py +++ b/moose-core/tests/python/test_Xreacs2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import os -import sys import moose +print( "[INFO ] Using moose from %s" % moose.__file__ ) import numpy as np import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/test_expr_parser.py b/moose-core/tests/python/test_expr_parser.py new file mode 100644 index 0000000000000000000000000000000000000000..fabbc28e40cfb8ebfb51b61d3c171d085d0af20f --- /dev/null +++ b/moose-core/tests/python/test_expr_parser.py @@ -0,0 +1,346 @@ +# -*- coding: utf-8 -*- +"""test_muparser.py: + +odified from https://elifesciences.org/articles/25827 +Fig4.py +""" +import sys +import re +import numpy as np +import moose +import rdesigneur as rd +print( "[INFO ] Using moose from %s" % moose.__file__ ) + +def parseExpr( expr, params, hasCa ): + if hasCa: + expr = expr.replace( 'Ca', 'x0' ) + expr = expr.replace( 'A', 'x1' ) + expr = expr.replace( 'B', 'x2' ) + else: + expr = expr.replace( 'Ca', 'x0' ) # happens in the negFF model + expr = expr.replace( 'A', 'x0' ) # This is the usual case. + expr = expr.replace( 'B', 'x1' ) + + parts = re.split( 'k', expr ) + ret = parts[0] + for i in parts[1:]: + ret += str( params[ 'k' + i[:2] ] ) + ret += i[2:] + + if hasCa: + return 'x3*( ' + ret + ')' + else: + return 'x2*( ' + ret + ')' + +def makeChemProto( name, Aexpr, Bexpr, params ): + sw = params['stimWidth'] + diffLength = params['diffusionLength'] + dca = params['diffConstA'] * diffLength * diffLength + dcb = params['diffConstB'] * diffLength * diffLength + + # Objects + chem = moose.Neutral( '/library/' + name ) + compt = moose.CubeMesh( '/library/' + name + '/' + name ) + A = moose.Pool( compt.path + '/A' ) + B = moose.Pool( compt.path + '/B' ) + Z = moose.BufPool( compt.path + '/Z' ) + Ca = moose.BufPool( compt.path + '/Ca' ) + phase = moose.BufPool( compt.path + '/phase' ) + vel = moose.BufPool( compt.path + '/vel' ) + ampl = moose.BufPool( compt.path + '/ampl' ) + Adot = moose.Function( A.path + '/Adot' ) + Bdot = moose.Function( B.path + '/Bdot' ) + CaStim = moose.Function( Ca.path + '/CaStim' ) + A.diffConst = dca + B.diffConst = dcb + + # Equations + + Adot.expr = parseExpr( Aexpr, params, True ) + Bdot.expr = parseExpr( Bexpr, params, False ) + CaStim.expr = 'x2 * exp( -((x0 - t)^2)/(2* ' + str(sw*sw) + ') )' + + #print Adot.expr + #print Bdot.expr + #print CaStim.expr + + # Connections + Adot.x.num = 4 + moose.connect( Ca, 'nOut', Adot.x[0], 'input' ) + moose.connect( A, 'nOut', Adot.x[1], 'input' ) + moose.connect( B, 'nOut', Adot.x[2], 'input' ) + moose.connect( Z, 'nOut', Adot.x[3], 'input' ) + moose.connect( Adot, 'valueOut', A, 'increment' ) + + Bdot.x.num = 3 + if name[:5] == 'negFF': + moose.connect( Ca, 'nOut', Bdot.x[0], 'input' ) + print('Doing special msg') + else: + moose.connect( A, 'nOut', Bdot.x[0], 'input' ) + moose.connect( B, 'nOut', Bdot.x[1], 'input' ) + moose.connect( Z, 'nOut', Bdot.x[2], 'input' ) + moose.connect( Bdot, 'valueOut', B, 'increment' ) + + CaStim.x.num = 3 + moose.connect( phase, 'nOut', CaStim.x[0], 'input' ) + moose.connect( vel, 'nOut', CaStim.x[1], 'input' ) + moose.connect( ampl, 'nOut', CaStim.x[2], 'input' ) + moose.connect( CaStim, 'valueOut', Ca, 'setN' ) + + return compt + + +def makeBis( args = None ): + params = { + 'k0a':0.1, # Constant + 'k1a':-5.0, # Coeff for A + 'k2a':5.0, # Coeff for A^2 + 'k3a':-1.0, # Coeff for A^3 + 'k4a':10.0, # turnon of A by A and Ca + 'k5a':-5.0, # Turnoff of A by B + 'k1b':0.01, # turnon of B by A + 'k2b':-0.01, # Decay rate of B + 'diffusionLength':1.0e-6, # Diffusion characteristic length, used as voxel length too. + 'dendDiameter': 10e-6, # Diameter of section of dendrite in model + 'dendLength': 100e-6, # Length of section of dendrite in model + 'diffConstA':5.0, # Diffusion constant of A + 'diffConstB':2.0, # Diffusion constant of B + 'stimWidth' :1.0, # Stimulus width in seconds + 'stimAmplitude':1.0, # Stimulus amplitude, arb units. From FHN review + 'blankVoxelsAtEnd':10, # of voxels to leave blank at end of cylinder + 'preStimTime':10.0, # Time to run before turning on stimulus. + 'postStimTime':40.0, # Time to run after stimulus. ~3x decay time + 'settleTime':20.0, # Settling time of response, after stimulus. + # To include in analysis of total response over + # entire dendrite. + 'fnumber':1, # Number to append to fname + } + + for i in args: + params[i] = args[i] + + makeChemProto( 'bis', + 'k0a + k1a*A + k2a*A*A + k3a*A*A*A + k4a*Ca*A/(1+A+10*B) + k5a*A*B', + 'k1b*A*A + k2b*B', + params ) + return params + +def makeFHN( args = None ): + params = { + 'k_t':2.5, # Time-const. + 'k_a':0.7, # Coeff1 + 'k_b':0.8, # Coeff2 + 'kxa': 2.0, # Offset for V for FHN eqns. + 'kxb': 0.8, # Offset for W for FHN eqns. + 'diffusionLength':1.0e-6, # Diffusion characteristic length, used as voxel length too. + 'dendDiameter': 10e-6, # Diameter of section of dendrite in model + 'dendLength': 100e-6, # Length of section of dendrite in model + 'diffConstA':7.5, # Diffusion constant of A + 'diffConstB':5.0, # Diffusion constant of B + 'stimWidth' :1.0, # Stimulus width in seconds + 'stimAmplitude':0.4, # Stimulus amplitude, arb units. From FHN review + 'blankVoxelsAtEnd':10, # of voxels to leave blank at end of cylinder + 'preStimTime':10.0, # Time to run before turning on stimulus. + 'postStimTime':40.0, # Time to run after stimulus. ~3x decay time + 'settleTime':20.0, # Settling time of response, after stimulus. + # To include in analysis of total response over + # entire dendrite. + 'fnumber': 1, # Number to append to fname + } + + for i in args: + params[i] = args[i] + + makeChemProto( 'fhn', + '5.0*(A - kxa - (A-kxa)^3/3 - (B-kxb) + Ca)', + '(A-kxa + k_a - k_b*(B-kxb))/k_t', + params ) + # We do this to get the system to settle at the start. + B = moose.element( '/library/fhn/fhn/B' ) + B.nInit = 0.2 + return params + + +def makeNegFB( args = None ): + params = { + 'k1a':-0.1, # Coeff for decay of A, slow. + 'k2a':-0.2, # Coeff for turnoff of A by B, medium. + 'k3a':10.0, # turnon of A by Ca, fast. + 'k1b':0.2, # turnon of B by A, medium + 'k2b':-0.1, # Decay rate of B, slow + 'diffusionLength':1.0e-6, # Diffusion characteristic length, used as voxel length too. + 'dendDiameter': 10e-6, # Diameter of section of dendrite in model + 'dendLength': 100e-6, # Length of section of dendrite in model + 'diffConstA':0.5, # Diffusion constant of A + 'diffConstB':1.0, # Diffusion constant of B + 'stimWidth' :1.0, # Stimulus width in seconds + 'stimAmplitude':1.0, # Stimulus amplitude, arb units. From FHN review + 'blankVoxelsAtEnd':10, #of voxels to leave blank at end of cylinder + 'preStimTime':10.0, # Time to run before turning on stimulus. + 'postStimTime':40.0, # Time to run after stimulus. ~3x decay time + 'settleTime':20.0, # Settling time of response, after stimulus. + # To include in analysis of total response over + # entire dendrite. + 'fnumber':1, # Number to append to fname + } + + for i in args: + params[i] = args[i] + + makeChemProto( 'negFB', + 'k1a*A + k2a*A*B + k3a*Ca', + 'k1b*A + k2b*B', + params ) + return params + +# Was negFF2 in earlier versions of abstrModelEqns +def makeNegFF( args = None ): + params = { + 'k1a':-0.1, # Coeff for decay of A, slow. + 'k2a':-0.01, # Coeff for turnoff of A by B, medium. + 'k3a':10.0, # turnon of A by Ca, fast. + 'k4a':40.0, # amount of B inhibition of turnon of A by Ca. + 'k1b':2.0, # turnon of B by Ca, medium + 'k2b':-0.05, # Decay rate of B, slow + 'diffusionLength':1.0e-6, # Diffusion characteristic length, used as voxel length too. + 'dendDiameter': 10e-6, # Diameter of section of dendrite in model + 'dendLength': 100e-6, # Length of section of dendrite in model + 'diffConstA':0.02, # Diffusion constant of A + 'diffConstB':0.4, # Diffusion constant of B + 'stimWidth' :1.0, # Stimulus width in seconds + 'stimAmplitude':10.0, # Stimulus amplitude, arb units. From FHN review + 'blankVoxelsAtEnd':10, # of voxels to leave blank at end of cylinder + 'preStimTime':10.0, # Time to run before turning on stimulus. + 'postStimTime':40.0, # Time to run after stimulus. ~3x decay time + 'settleTime':20.0, # Settling time of response, after stimulus. + # To include in analysis of total response over + # entire dendrite. + 'fnumber':1, # Number to append to fname + } + + for i in args: + params[i] = args[i] + + makeChemProto( 'negFF', + 'k1a*A + k2a*A*B + k3a*Ca/(1+k4a*B*B)', + 'k1b*Ca + k2b*B', + params ) + + return params + + +def singleCompt( name, params ): + print('=============') + print('[INFO] Making compartment %s' % name) + mod = moose.copy( '/library/' + name + '/' + name, '/model' ) + A = moose.element( mod.path + '/A' ) + Z = moose.element( mod.path + '/Z' ) + Z.nInit = 1 + Ca = moose.element( mod.path + '/Ca' ) + CaStim = moose.element( Ca.path + '/CaStim' ) + + print( '\n\n[INFO] CaStim %s' % CaStim.path ) + runtime = params['preStimTime'] + params['postStimTime'] + steptime = 50 + CaStim.expr += '+x2*(t>100+'+str(runtime)+')*(t<100+'+str(runtime+steptime)+ ')' + print("[INFO] CaStim.expr = %s" % CaStim.expr) + tab = moose.Table2( '/model/' + name + '/Atab' ) + ampl = moose.element( mod.path + '/ampl' ) + phase = moose.element( mod.path + '/phase' ) + moose.connect( tab, 'requestOut', A, 'getN' ) + ampl.nInit = params['stimAmplitude'] * 1 + phase.nInit = params['preStimTime'] + + ksolve = moose.Ksolve( mod.path + '/ksolve' ) + stoich = moose.Stoich( mod.path + '/stoich' ) + stoich.compartment = mod + stoich.ksolve = ksolve + stoich.path = mod.path + '/##' + + print( 'REINIT AND START' ) + moose.reinit() + runtime += 100 + steptime*2 + moose.start( runtime ) + t = np.arange( 0, runtime + 1e-9, tab.dt ) + return name, t, tab.vector + + +def runPanelDEFG( name, dist, seqDt, numSpine, seq, stimAmpl ): + preStim = 10.0 + blanks = 20 + rdes = rd.rdesigneur( + useGssa = False, + turnOffElec = True, + chemPlotDt = 0.1, + diffusionLength = 1e-6, + cellProto = [['cell', 'soma']], + chemProto = [['dend', name]], + chemDistrib = [['dend', 'soma', 'install', '1' ]], + plotList = [['soma', '1', 'dend' + '/A', 'n', '# of A']], + ) + rdes.buildModel() + A = moose.vec( '/model/chem/dend/A' ) + Z = moose.vec( '/model/chem/dend/Z' ) + print(moose.element( '/model/chem/dend/A/Adot' ).expr) + print(moose.element( '/model/chem/dend/B/Bdot' ).expr) + print(moose.element( '/model/chem/dend/Ca/CaStim' ).expr) + phase = moose.vec( '/model/chem/dend/phase' ) + ampl = moose.vec( '/model/chem/dend/ampl' ) + vel = moose.vec( '/model/chem/dend/vel' ) + vel.nInit = 1e-6 * seqDt + ampl.nInit = stimAmpl + stride = int( dist ) / numSpine + phase.nInit = 10000 + Z.nInit = 0 + for j in range( numSpine ): + k = int( blanks + j * stride ) + Z[k].nInit = 1 + phase[k].nInit = preStim + seq[j] * seqDt + + moose.reinit() + runtime = 50 + snapshot = preStim + seqDt * (numSpine - 0.8) + print(snapshot) + moose.start( snapshot ) + avec = moose.vec( '/model/chem/dend/A' ).n + moose.start( runtime - snapshot ) + tvec = [] + for i in range( 5 ): + tab = moose.element( '/model/graphs/plot0[' + str( blanks + i * stride ) + ']' ) + dt = tab.dt + tvec.append( tab.vector ) + moose.delete( '/model' ) + return dt, tvec, avec + +def makePassiveSoma( name, length, diameter ): + elecid = moose.Neuron( '/library/' + name ) + dend = moose.Compartment( elecid.path + '/soma' ) + dend.diameter = diameter + dend.length = length + dend.x = length + return elecid + +def run(): + panelC = [] + panelCticks = [] + panelC.append( singleCompt( 'negFB', makeNegFB( [] ) ) ) + panelC.append( singleCompt( 'negFF', makeNegFF( [] ) ) ) + panelC.append( singleCompt( 'fhn', makeFHN( [] ) ) ) + panelC.append( singleCompt( 'bis', makeBis( [] ) ) ) + panelCticks.append( np.arange( 0, 15.00001, 5 ) ) + panelCticks.append( np.arange( 0, 1.50001, 0.5 ) ) + panelCticks.append( np.arange( 0, 5.00002, 1 ) ) + panelCticks.append( np.arange( 0, 5.00002, 1 ) ) + moose.delete( '/model' ) + for i in zip( panelC, panelCticks, list(range( len( panelC ))) ): + plotPos = i[2] + 5 + doty = i[1][-1] * 0.95 + print('doty', doty ) + print( '[INFO] Run is over') + +if __name__ == '__main__': + moose.Neutral( '/library' ) + moose.Neutral( '/model' ) + run() + print( 'All done' ) diff --git a/moose-core/tests/python/test_function.py b/moose-core/tests/python/test_function.py index 3ba99164289c2b5d23cba7419de448700c846567..79e9453424d3de6a46981f8b618d1c07647e26b8 100644 --- a/moose-core/tests/python/test_function.py +++ b/moose-core/tests/python/test_function.py @@ -1,69 +1,37 @@ # -*- coding: utf-8 -*- # test_function.py --- -# # Filename: test_function.py # Description: # Author: subha -# Maintainer: +# Maintainer: Dilawar Singh <diawars@ncbs.res.in> # Created: Sat Mar 28 19:34:20 2015 (-0400) # Version: -# Last-Updated: -# By: -# Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# -# Commentary: -# -# -# -# - -# Change log: -# -# -# -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 3, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, Fifth -# Floor, Boston, MA 02110-1301, USA. -# -# - -# Code: -"""Check variable ordering - bug #161""" from __future__ import print_function - import numpy as np import moose +print( "[INFO ] Using moose %s form %s" % (moose.version(), moose.__file__) ) + +def create_func( funcname, expr ): + f = moose.Function( funcname ) + f.expr = expr + t = moose.Table( funcname + 'tab' ) + moose.connect( t, 'requestOut', f, 'getValue' ) + moose.setClock( f.tick, 0.1) + moose.setClock( t.tick, 0.1) + return f, t def test_var_order(): """The y values are one step behind the x values because of scheduling sequences""" + moose.delete( '/' ) nsteps = 5 simtime = nsteps dt = 1.0 # fn0 = moose.Function('/fn0') - # fn0.x.num = 2 - # fn0.expr = 'x0 + x1' - # fn0.mode = 1 fn1 = moose.Function('/fn1') fn1.x.num = 2 - fn1.expr = 'y1 + y0 + x1 + x0' + fn1.expr = 'y1+y0+x1+x0' fn1.mode = 1 inputs = np.arange(0, nsteps+1, 1.0) x0 = moose.StimulusTable('/x0') @@ -90,6 +58,8 @@ def test_var_order(): y1.startTime = 0.0 y1.stopTime = simtime y1.stepPosition = 0.0 + # print( fn1, type(fn1) ) + # print( moose.showmsg(fn1.x) ) moose.connect(x0, 'output', fn1.x[0], 'input') moose.connect(x1, 'output', fn1.x[1], 'input') moose.connect(fn1, 'requestOut', y0, 'getOutputValue') @@ -100,12 +70,54 @@ def test_var_order(): moose.setClock(ii, dt) moose.reinit() moose.start(simtime) - for ii in range(len(z1.vector)): - print(ii, z1.vector[ii]) + expected = [0, 1.1, 2.211, 3.322, 4.433, 5.544] + assert np.allclose(z1.vector, expected), "Excepted %s, got %s" % (expected, z1.vector ) + print( 'Passed order vars' ) -if __name__ == '__main__': - test_var_order() +def test_t( ): + f, t = create_func( 'funct', 't/2.0') + moose.reinit() + moose.start(1) + y = t.vector + d = np.diff( y[1:] ) + assert np.mean(d) == d[0] + print( 'Passed t/2' ) +def test_trig( ): + f, t = create_func('func2', '(sin(t)^2+cos(t)^2)-1') + moose.reinit() + moose.start( 1 ) + y = t.vector + print(y) + assert np.isclose(np.mean(y), 0.0), np.mean(y) + assert np.isclose(np.std(y), 0.0), np.std(y) + print( 'Passed sin^2 x + cos^x=1' ) -# -# test_function.py ends here +def test_rand( ): + moose.seed( 10 ) + f, t = create_func( 'random', 'rnd()') + moose.reinit() + moose.start(1) + expected = [0.49458993, 0.44301495, 0.58332174, 0.70920801, 0.26360285, + 0.68381843, 0.33607158, 0.19812181, 0.87761494, 0.54088093, + 0.41366738] + assert np.isclose(t.vector, expected ).all(), t.vector + print( 'Passed test random' ) + +def test_fmod( ): + f, t = create_func( 'fmod', 'fmod(t, 2)' ) + moose.reinit() + moose.start( 20 ) + y = t.vector + assert (np.fmod(y, 2) == y).all() + assert(np.isclose(np.max(y), 1.9)), np.max(y) + assert(np.isclose(np.min(y), 0.0)), np.min(y) + print('Passed fmod(t,2)') + + +if __name__ == '__main__': + test_var_order() + test_t() + test_trig() + test_rand() + test_fmod() diff --git a/moose-core/tests/python/test_function_chemsys.py b/moose-core/tests/python/test_function_chemsys.py new file mode 100644 index 0000000000000000000000000000000000000000..fabbc28e40cfb8ebfb51b61d3c171d085d0af20f --- /dev/null +++ b/moose-core/tests/python/test_function_chemsys.py @@ -0,0 +1,346 @@ +# -*- coding: utf-8 -*- +"""test_muparser.py: + +odified from https://elifesciences.org/articles/25827 +Fig4.py +""" +import sys +import re +import numpy as np +import moose +import rdesigneur as rd +print( "[INFO ] Using moose from %s" % moose.__file__ ) + +def parseExpr( expr, params, hasCa ): + if hasCa: + expr = expr.replace( 'Ca', 'x0' ) + expr = expr.replace( 'A', 'x1' ) + expr = expr.replace( 'B', 'x2' ) + else: + expr = expr.replace( 'Ca', 'x0' ) # happens in the negFF model + expr = expr.replace( 'A', 'x0' ) # This is the usual case. + expr = expr.replace( 'B', 'x1' ) + + parts = re.split( 'k', expr ) + ret = parts[0] + for i in parts[1:]: + ret += str( params[ 'k' + i[:2] ] ) + ret += i[2:] + + if hasCa: + return 'x3*( ' + ret + ')' + else: + return 'x2*( ' + ret + ')' + +def makeChemProto( name, Aexpr, Bexpr, params ): + sw = params['stimWidth'] + diffLength = params['diffusionLength'] + dca = params['diffConstA'] * diffLength * diffLength + dcb = params['diffConstB'] * diffLength * diffLength + + # Objects + chem = moose.Neutral( '/library/' + name ) + compt = moose.CubeMesh( '/library/' + name + '/' + name ) + A = moose.Pool( compt.path + '/A' ) + B = moose.Pool( compt.path + '/B' ) + Z = moose.BufPool( compt.path + '/Z' ) + Ca = moose.BufPool( compt.path + '/Ca' ) + phase = moose.BufPool( compt.path + '/phase' ) + vel = moose.BufPool( compt.path + '/vel' ) + ampl = moose.BufPool( compt.path + '/ampl' ) + Adot = moose.Function( A.path + '/Adot' ) + Bdot = moose.Function( B.path + '/Bdot' ) + CaStim = moose.Function( Ca.path + '/CaStim' ) + A.diffConst = dca + B.diffConst = dcb + + # Equations + + Adot.expr = parseExpr( Aexpr, params, True ) + Bdot.expr = parseExpr( Bexpr, params, False ) + CaStim.expr = 'x2 * exp( -((x0 - t)^2)/(2* ' + str(sw*sw) + ') )' + + #print Adot.expr + #print Bdot.expr + #print CaStim.expr + + # Connections + Adot.x.num = 4 + moose.connect( Ca, 'nOut', Adot.x[0], 'input' ) + moose.connect( A, 'nOut', Adot.x[1], 'input' ) + moose.connect( B, 'nOut', Adot.x[2], 'input' ) + moose.connect( Z, 'nOut', Adot.x[3], 'input' ) + moose.connect( Adot, 'valueOut', A, 'increment' ) + + Bdot.x.num = 3 + if name[:5] == 'negFF': + moose.connect( Ca, 'nOut', Bdot.x[0], 'input' ) + print('Doing special msg') + else: + moose.connect( A, 'nOut', Bdot.x[0], 'input' ) + moose.connect( B, 'nOut', Bdot.x[1], 'input' ) + moose.connect( Z, 'nOut', Bdot.x[2], 'input' ) + moose.connect( Bdot, 'valueOut', B, 'increment' ) + + CaStim.x.num = 3 + moose.connect( phase, 'nOut', CaStim.x[0], 'input' ) + moose.connect( vel, 'nOut', CaStim.x[1], 'input' ) + moose.connect( ampl, 'nOut', CaStim.x[2], 'input' ) + moose.connect( CaStim, 'valueOut', Ca, 'setN' ) + + return compt + + +def makeBis( args = None ): + params = { + 'k0a':0.1, # Constant + 'k1a':-5.0, # Coeff for A + 'k2a':5.0, # Coeff for A^2 + 'k3a':-1.0, # Coeff for A^3 + 'k4a':10.0, # turnon of A by A and Ca + 'k5a':-5.0, # Turnoff of A by B + 'k1b':0.01, # turnon of B by A + 'k2b':-0.01, # Decay rate of B + 'diffusionLength':1.0e-6, # Diffusion characteristic length, used as voxel length too. + 'dendDiameter': 10e-6, # Diameter of section of dendrite in model + 'dendLength': 100e-6, # Length of section of dendrite in model + 'diffConstA':5.0, # Diffusion constant of A + 'diffConstB':2.0, # Diffusion constant of B + 'stimWidth' :1.0, # Stimulus width in seconds + 'stimAmplitude':1.0, # Stimulus amplitude, arb units. From FHN review + 'blankVoxelsAtEnd':10, # of voxels to leave blank at end of cylinder + 'preStimTime':10.0, # Time to run before turning on stimulus. + 'postStimTime':40.0, # Time to run after stimulus. ~3x decay time + 'settleTime':20.0, # Settling time of response, after stimulus. + # To include in analysis of total response over + # entire dendrite. + 'fnumber':1, # Number to append to fname + } + + for i in args: + params[i] = args[i] + + makeChemProto( 'bis', + 'k0a + k1a*A + k2a*A*A + k3a*A*A*A + k4a*Ca*A/(1+A+10*B) + k5a*A*B', + 'k1b*A*A + k2b*B', + params ) + return params + +def makeFHN( args = None ): + params = { + 'k_t':2.5, # Time-const. + 'k_a':0.7, # Coeff1 + 'k_b':0.8, # Coeff2 + 'kxa': 2.0, # Offset for V for FHN eqns. + 'kxb': 0.8, # Offset for W for FHN eqns. + 'diffusionLength':1.0e-6, # Diffusion characteristic length, used as voxel length too. + 'dendDiameter': 10e-6, # Diameter of section of dendrite in model + 'dendLength': 100e-6, # Length of section of dendrite in model + 'diffConstA':7.5, # Diffusion constant of A + 'diffConstB':5.0, # Diffusion constant of B + 'stimWidth' :1.0, # Stimulus width in seconds + 'stimAmplitude':0.4, # Stimulus amplitude, arb units. From FHN review + 'blankVoxelsAtEnd':10, # of voxels to leave blank at end of cylinder + 'preStimTime':10.0, # Time to run before turning on stimulus. + 'postStimTime':40.0, # Time to run after stimulus. ~3x decay time + 'settleTime':20.0, # Settling time of response, after stimulus. + # To include in analysis of total response over + # entire dendrite. + 'fnumber': 1, # Number to append to fname + } + + for i in args: + params[i] = args[i] + + makeChemProto( 'fhn', + '5.0*(A - kxa - (A-kxa)^3/3 - (B-kxb) + Ca)', + '(A-kxa + k_a - k_b*(B-kxb))/k_t', + params ) + # We do this to get the system to settle at the start. + B = moose.element( '/library/fhn/fhn/B' ) + B.nInit = 0.2 + return params + + +def makeNegFB( args = None ): + params = { + 'k1a':-0.1, # Coeff for decay of A, slow. + 'k2a':-0.2, # Coeff for turnoff of A by B, medium. + 'k3a':10.0, # turnon of A by Ca, fast. + 'k1b':0.2, # turnon of B by A, medium + 'k2b':-0.1, # Decay rate of B, slow + 'diffusionLength':1.0e-6, # Diffusion characteristic length, used as voxel length too. + 'dendDiameter': 10e-6, # Diameter of section of dendrite in model + 'dendLength': 100e-6, # Length of section of dendrite in model + 'diffConstA':0.5, # Diffusion constant of A + 'diffConstB':1.0, # Diffusion constant of B + 'stimWidth' :1.0, # Stimulus width in seconds + 'stimAmplitude':1.0, # Stimulus amplitude, arb units. From FHN review + 'blankVoxelsAtEnd':10, #of voxels to leave blank at end of cylinder + 'preStimTime':10.0, # Time to run before turning on stimulus. + 'postStimTime':40.0, # Time to run after stimulus. ~3x decay time + 'settleTime':20.0, # Settling time of response, after stimulus. + # To include in analysis of total response over + # entire dendrite. + 'fnumber':1, # Number to append to fname + } + + for i in args: + params[i] = args[i] + + makeChemProto( 'negFB', + 'k1a*A + k2a*A*B + k3a*Ca', + 'k1b*A + k2b*B', + params ) + return params + +# Was negFF2 in earlier versions of abstrModelEqns +def makeNegFF( args = None ): + params = { + 'k1a':-0.1, # Coeff for decay of A, slow. + 'k2a':-0.01, # Coeff for turnoff of A by B, medium. + 'k3a':10.0, # turnon of A by Ca, fast. + 'k4a':40.0, # amount of B inhibition of turnon of A by Ca. + 'k1b':2.0, # turnon of B by Ca, medium + 'k2b':-0.05, # Decay rate of B, slow + 'diffusionLength':1.0e-6, # Diffusion characteristic length, used as voxel length too. + 'dendDiameter': 10e-6, # Diameter of section of dendrite in model + 'dendLength': 100e-6, # Length of section of dendrite in model + 'diffConstA':0.02, # Diffusion constant of A + 'diffConstB':0.4, # Diffusion constant of B + 'stimWidth' :1.0, # Stimulus width in seconds + 'stimAmplitude':10.0, # Stimulus amplitude, arb units. From FHN review + 'blankVoxelsAtEnd':10, # of voxels to leave blank at end of cylinder + 'preStimTime':10.0, # Time to run before turning on stimulus. + 'postStimTime':40.0, # Time to run after stimulus. ~3x decay time + 'settleTime':20.0, # Settling time of response, after stimulus. + # To include in analysis of total response over + # entire dendrite. + 'fnumber':1, # Number to append to fname + } + + for i in args: + params[i] = args[i] + + makeChemProto( 'negFF', + 'k1a*A + k2a*A*B + k3a*Ca/(1+k4a*B*B)', + 'k1b*Ca + k2b*B', + params ) + + return params + + +def singleCompt( name, params ): + print('=============') + print('[INFO] Making compartment %s' % name) + mod = moose.copy( '/library/' + name + '/' + name, '/model' ) + A = moose.element( mod.path + '/A' ) + Z = moose.element( mod.path + '/Z' ) + Z.nInit = 1 + Ca = moose.element( mod.path + '/Ca' ) + CaStim = moose.element( Ca.path + '/CaStim' ) + + print( '\n\n[INFO] CaStim %s' % CaStim.path ) + runtime = params['preStimTime'] + params['postStimTime'] + steptime = 50 + CaStim.expr += '+x2*(t>100+'+str(runtime)+')*(t<100+'+str(runtime+steptime)+ ')' + print("[INFO] CaStim.expr = %s" % CaStim.expr) + tab = moose.Table2( '/model/' + name + '/Atab' ) + ampl = moose.element( mod.path + '/ampl' ) + phase = moose.element( mod.path + '/phase' ) + moose.connect( tab, 'requestOut', A, 'getN' ) + ampl.nInit = params['stimAmplitude'] * 1 + phase.nInit = params['preStimTime'] + + ksolve = moose.Ksolve( mod.path + '/ksolve' ) + stoich = moose.Stoich( mod.path + '/stoich' ) + stoich.compartment = mod + stoich.ksolve = ksolve + stoich.path = mod.path + '/##' + + print( 'REINIT AND START' ) + moose.reinit() + runtime += 100 + steptime*2 + moose.start( runtime ) + t = np.arange( 0, runtime + 1e-9, tab.dt ) + return name, t, tab.vector + + +def runPanelDEFG( name, dist, seqDt, numSpine, seq, stimAmpl ): + preStim = 10.0 + blanks = 20 + rdes = rd.rdesigneur( + useGssa = False, + turnOffElec = True, + chemPlotDt = 0.1, + diffusionLength = 1e-6, + cellProto = [['cell', 'soma']], + chemProto = [['dend', name]], + chemDistrib = [['dend', 'soma', 'install', '1' ]], + plotList = [['soma', '1', 'dend' + '/A', 'n', '# of A']], + ) + rdes.buildModel() + A = moose.vec( '/model/chem/dend/A' ) + Z = moose.vec( '/model/chem/dend/Z' ) + print(moose.element( '/model/chem/dend/A/Adot' ).expr) + print(moose.element( '/model/chem/dend/B/Bdot' ).expr) + print(moose.element( '/model/chem/dend/Ca/CaStim' ).expr) + phase = moose.vec( '/model/chem/dend/phase' ) + ampl = moose.vec( '/model/chem/dend/ampl' ) + vel = moose.vec( '/model/chem/dend/vel' ) + vel.nInit = 1e-6 * seqDt + ampl.nInit = stimAmpl + stride = int( dist ) / numSpine + phase.nInit = 10000 + Z.nInit = 0 + for j in range( numSpine ): + k = int( blanks + j * stride ) + Z[k].nInit = 1 + phase[k].nInit = preStim + seq[j] * seqDt + + moose.reinit() + runtime = 50 + snapshot = preStim + seqDt * (numSpine - 0.8) + print(snapshot) + moose.start( snapshot ) + avec = moose.vec( '/model/chem/dend/A' ).n + moose.start( runtime - snapshot ) + tvec = [] + for i in range( 5 ): + tab = moose.element( '/model/graphs/plot0[' + str( blanks + i * stride ) + ']' ) + dt = tab.dt + tvec.append( tab.vector ) + moose.delete( '/model' ) + return dt, tvec, avec + +def makePassiveSoma( name, length, diameter ): + elecid = moose.Neuron( '/library/' + name ) + dend = moose.Compartment( elecid.path + '/soma' ) + dend.diameter = diameter + dend.length = length + dend.x = length + return elecid + +def run(): + panelC = [] + panelCticks = [] + panelC.append( singleCompt( 'negFB', makeNegFB( [] ) ) ) + panelC.append( singleCompt( 'negFF', makeNegFF( [] ) ) ) + panelC.append( singleCompt( 'fhn', makeFHN( [] ) ) ) + panelC.append( singleCompt( 'bis', makeBis( [] ) ) ) + panelCticks.append( np.arange( 0, 15.00001, 5 ) ) + panelCticks.append( np.arange( 0, 1.50001, 0.5 ) ) + panelCticks.append( np.arange( 0, 5.00002, 1 ) ) + panelCticks.append( np.arange( 0, 5.00002, 1 ) ) + moose.delete( '/model' ) + for i in zip( panelC, panelCticks, list(range( len( panelC ))) ): + plotPos = i[2] + 5 + doty = i[1][-1] * 0.95 + print('doty', doty ) + print( '[INFO] Run is over') + +if __name__ == '__main__': + moose.Neutral( '/library' ) + moose.Neutral( '/model' ) + run() + print( 'All done' ) diff --git a/moose-core/tests/python/test_function_controls_reac_rate.py b/moose-core/tests/python/test_function_controls_reac_rate.py new file mode 100644 index 0000000000000000000000000000000000000000..0c885b3823b606b532a8479f0a671748a886544f --- /dev/null +++ b/moose-core/tests/python/test_function_controls_reac_rate.py @@ -0,0 +1,87 @@ +######################################################################## +# This example illustrates how a function can be used to control a reaction +# rate. This kind of calculation is appropriate when we need to link +# different kinds of physical processses with chemical reactions, for +# example, membrane curvature with molecule accumulation. The use of +# functions to modify reaction rates should be avoided in purely chemical +# systems since they obscure the underlying chemistry, and do not map +# cleanly to stochastic calculations. +# +# In this example we simply have a molecule C that controls the forward +# rate of a reaction that converts A to B. C is a function of location +# on the cylinder, and is fixed. In more elaborate computations we could +# have a function of multiple molecules, some of which could be changing and +# others could be buffered. +# +# Copyright (C) Upinder S. Bhalla NCBS 2018 +# Released under the terms of the GNU Public License V3. +######################################################################## + +import numpy as np +import moose +import pylab +import rdesigneur as rd + +plot_ = False + +def makeFuncRate(): + model = moose.Neutral( '/library' ) + model = moose.Neutral( '/library/chem' ) + compt = moose.CubeMesh( '/library/chem/compt' ) + compt.volume = 1e-15 + A = moose.Pool( '/library/chem/compt/A' ) + B = moose.Pool( '/library/chem/compt/B' ) + C = moose.Pool( '/library/chem/compt/C' ) + reac = moose.Reac( '/library/chem/compt/reac' ) + func = moose.Function( '/library/chem/compt/reac/func' ) + func.x.num = 1 + func.expr = "(x0/1e8)^2" + moose.connect( C, 'nOut', func.x[0], 'input' ) + moose.connect( func, 'valueOut', reac, 'setNumKf' ) + moose.connect( reac, 'sub', A, 'reac' ) + moose.connect( reac, 'prd', B, 'reac' ) + + A.concInit = 1 + B.concInit = 0 + C.concInit = 0 + reac.Kb = 1 + +def test(): + makeFuncRate() + + rdes = rd.rdesigneur( + turnOffElec = True, + #This subdivides the 50-micron cylinder into 2 micron voxels + diffusionLength = 2e-6, + cellProto = [['somaProto', 'soma', 5e-6, 50e-6]], + chemProto = [['chem', 'chem']], + chemDistrib = [['chem', 'soma', 'install', '1' ]], + plotList = [['soma', '1', 'dend/A', 'conc', 'A conc', 'wave'], + ['soma', '1', 'dend/C', 'conc', 'C conc', 'wave']], + ) + rdes.buildModel() + + C = moose.element( '/model/chem/dend/C' ) + C.vec.concInit = [ 1+np.sin(x/5.0) for x in range( len(C.vec) ) ] + moose.reinit() + moose.start(10) + if plot_: + rdes.display() + ts = moose.wildcardFind( '/##[TYPE=Table2]') + mat = [] + for t in ts: + if 'plot1' in t.path: + mat.append(t.vector) + mat = np.matrix(mat) + exMean, exStd = 1.1619681711817156, 0.6944155817587526 + assert np.isclose( np.mean(mat), exMean), mp.mean(mat) + assert np.isclose( np.std(mat), exStd), mp.std(mat) + assert( np.isclose(np.mean(mat, axis=0), exMean).all() ) + assert( np.isclose(np.std(mat, axis=0), exStd).all() ) + assert( np.isclose(0.0, np.std(mat, axis=1)).all()) + +def main(): + test() + +if __name__ == '__main__': + main() diff --git a/moose-core/tests/python/test_function_derivative.py b/moose-core/tests/python/test_function_derivative.py new file mode 100644 index 0000000000000000000000000000000000000000..c2e1dc81eda91250db52c82a3892c1c6c7ba3d5c --- /dev/null +++ b/moose-core/tests/python/test_function_derivative.py @@ -0,0 +1,160 @@ +# function.py --- + +import numpy as np +import sys +import moose + +simtime = 1.0 +plot_ = False +if plot_: + import matplotlib.pyplot as plt + +def example(): + """Function objects can be used to evaluate expressions with arbitrary + number of variables and constants. We can assign expression of the + form:: + + f(c0, c1, ..., cM, x0, x1, ..., xN, y0,..., yP ) + + where `c_i`'s are constants and `x_i`'s and `y_i`'s are variables. + + The constants must be defined before setting the expression and + variables are connected via messages. The constants can have any + name, but the variable names must be of the form x{i} or y{i} + where i is increasing integer starting from 0. + + The `x_i`'s are field elements and you have to set their number + first (function.x.num = N). Then you can connect any source field + sending out double to the 'input' destination field of the + `x[i]`. + + The `y_i`'s are useful when the required variable is a value field + and is not available as a source field. In that case you connect + the `requestOut` source field of the function element to the + `get{Field}` destination field on the target element. The `y_i`'s + are automatically added on connecting. Thus, if you call:: + + moose.connect(function, 'requestOut', a, 'getSomeField') + moose.connect(function, 'requestOut', b, 'getSomeField') + + then ``a.someField`` will be assigned to ``y0`` and + ``b.someField`` will be assigned to ``y1``. + + In this example we evaluate the expression: ``z = c0 * exp(c1 * + x0) * cos(y0)`` + + with x0 ranging from -1 to +1 and y0 ranging from -pi to + +pi. These values are stored in two stimulus tables called xtab + and ytab respectively, so that at each timestep the next values of + x0 and y0 are assigned to the function. + + Along with the value of the expression itself we also compute its + derivative with respect to y0 and its derivative with respect to + time (rate). The former uses a five-point stencil for the + numerical differentiation and has a glitch at y=0. The latter uses + backward difference divided by dt. + + Unlike Func class, the number of variables and constants are + unlimited in Function and you can set all the variables via + messages. + + """ + demo = moose.Neutral('/model') + function = moose.Function('/model/function') + function.c['c0'] = 1.0 + function.c['c1'] = 2.0 + function.x.num = 1 + function.expr = 'c0 * exp(c1*x0) * cos(y0) + sin(t)' + # mode 0 - evaluate function value, derivative and rate + # mode 1 - just evaluate function value, + # mode 2 - evaluate derivative, + # mode 3 - evaluate rate + function.mode = 0 + function.independent = 'y0' + nsteps = 1000 + xarr = np.linspace(0.0, 1.0, nsteps) + # Stimulus tables allow you to store sequences of numbers which + # are delivered via the 'output' message at each time step. This + # is a placeholder and in real scenario you will be using any + # sourceFinfo that sends out a double value. + input_x = moose.StimulusTable('/xtab') + input_x.vector = xarr + input_x.startTime = 0.0 + input_x.stepPosition = xarr[0] + input_x.stopTime = simtime + moose.connect(input_x, 'output', function.x[0], 'input') + + yarr = np.linspace(-np.pi, np.pi, nsteps) + input_y = moose.StimulusTable('/ytab') + input_y.vector = yarr + input_y.startTime = 0.0 + input_y.stepPosition = yarr[0] + input_y.stopTime = simtime + moose.connect(function, 'requestOut', input_y, 'getOutputValue') + + # data recording + result = moose.Table('/ztab') + moose.connect(result, 'requestOut', function, 'getValue') + derivative = moose.Table('/zprime') + moose.connect(derivative, 'requestOut', function, 'getDerivative') + rate = moose.Table('/dz_by_dt') + moose.connect(rate, 'requestOut', function, 'getRate') + x_rec = moose.Table('/xrec') + moose.connect(x_rec, 'requestOut', input_x, 'getOutputValue') + y_rec = moose.Table('/yrec') + moose.connect(y_rec, 'requestOut', input_y, 'getOutputValue') + + dt = simtime/nsteps + for ii in range(32): + moose.setClock(ii, dt) + moose.reinit() + moose.start(simtime) + + # Uncomment the following lines and the import matplotlib.pyplot as plt on top + # of this file to display the plot. + if plot_: + plt.plot(x_rec.vector, result.vector, 'r-', label='z = {}'.format(function.expr)) + plt.subplot(4,1,1) + z = function.c['c0'] * np.exp(function.c['c1'] * xarr) * np.cos(yarr) + np.sin(np.arange(len(xarr)) * dt) + zz = result.vector[1:] + err = z[1:] - zz[1:] + assert (np.abs(err) <= 0.05).all(), err[err > 0.05] + assert (np.mean(err) <= 0.001), np.mean(err) + + if plot_: + plt.plot(xarr, z, 'b--', label='numpy computed') + plt.xlabel('x') + plt.ylabel('z') + plt.legend() + + if plot_: + plt.subplot(4,1,2) + plt.plot(y_rec.vector, derivative.vector, 'r-', label='dz/dy0') + # derivatives computed by putting x values in the analytical formula + dzdy = function.c['c0'] * np.exp(function.c['c1'] * xarr) * (- np.sin(yarr)) + err = np.abs(dzdy - derivative.vector[1:]) + assert (err < 0.05).all(), (err[err>1e-2]) + assert (np.mean(err) < 1e-2), np.mean(err) + + if plot_: + plt.plot(yarr, dzdy, 'b--', label='numpy computed') + plt.xlabel('y') + plt.ylabel('dz/dy') + plt.legend() + + if plot_: + plt.subplot(4,1,3) + # *** BEWARE *** The first two entries are spurious. Entry 0 is + # *** from reinit sending out the defaults. Entry 2 is because + # *** there is no lastValue for computing real forward difference. + plt.plot(np.arange(2, len(rate.vector), 1) * dt, rate.vector[2:], 'r-', label='dz/dt') + dzdt = np.diff(z)/dt + plt.plot(np.arange(0, len(dzdt), 1.0) * dt, dzdt, 'b--', label='numpy computed') + plt.xlabel('t') + plt.ylabel('dz/dt') + plt.legend() + plt.tight_layout() + plt.show() + +if __name__ == '__main__': + example() diff --git a/moose-core/tests/python/test_gsolve_parallel.py b/moose-core/tests/python/test_gsolve_parallel.py index e7887ce853fa66ef033565d9f46272bedb1189fd..056762b47bd9885e6417741e87f96f36fb63fb97 100644 --- a/moose-core/tests/python/test_gsolve_parallel.py +++ b/moose-core/tests/python/test_gsolve_parallel.py @@ -2,8 +2,14 @@ import numpy as np import moose print( '[INFO] Using moose from %s' % moose.__file__ ) import time + +# Does not guarantee thread determinism in multithreaded Gsolve/Ksolve. moose.seed( 10 ) +def printCompt(compt): + print( 'x0=%s, x1=%s, diffLength=%s, numDiffCompt=%d' % (compt.x0, compt.x1, + compt.diffLength, compt.numDiffCompts)) + def main( nT ): """ This example implements a reaction-diffusion like system which is @@ -14,25 +20,22 @@ def main( nT ): uses a reaction plus a function object to control its rates. """ print( 'Using %d threads' % nT ) - dt = 0.1 - # define the geometry compt = moose.CylMesh( '/cylinder' ) compt.r0 = compt.r1 = 100e-9 - compt.x1 = 200e-9 + compt.x1 = 200e-09 compt.diffLength = 0.2e-9 - assert( compt.numDiffCompts == compt.x1/compt.diffLength ) + assert( compt.numDiffCompts == compt.x1/compt.diffLength) #define the molecule. Its geometry is defined by its parent volume, cylinder c = moose.Pool( '/cylinder/pool' ) c.diffConst = 1e-13 # define diffusion constant - # Here we set up a function calculation func = moose.Function( '/cylinder/pool/func' ) - func.expr = "(-x0 * (30e-9 - x0) * (100e-9 - x0))*0.0001" - func.x.num = 1 #specify number of input variables. + func.expr = "(-x0*(30e-9-x0)*(100e-9-x0))*0.0001" + # func.x.num = 1 #specify number of input variables. #Connect the molecules to the func moose.connect( c, 'nOut', func.x[0], 'input' ) @@ -45,6 +48,7 @@ def main( nT ): ksolve.numThreads = nT except Exception as e: print( 'OLD MOOSE. Does not support multithreading' ) + dsolve = moose.Dsolve( '/cylinder/dsolve' ) stoich = moose.Stoich( '/cylinder/stoich' ) stoich.compartment = compt @@ -62,16 +66,32 @@ def main( nT ): runtime = updateDt * 10 t1 = time.time() res = [] + clk = moose.element( '/clock' ) for t in range( 0, runtime-1, updateDt ): - moose.start( updateDt ) y = c.vec.n - res.append( (np.mean(y), np.std(y)) ) + s = np.sum(y) + v = (np.mean(y), np.max(y), np.min(y), s) + print(v) + res.append(v) + moose.start( updateDt ) + currTime = clk.currentTime - expected = [(9.0, 0.0), (6.0, 0.0), (5.0, 0.0), (3.0, 0.0), (2.0, 0.0), - (2.0, 0.0), (2.0, 0.0), (1.0, 0.0), (1.0, 0.0), (1.0, 0.0)] - print(("Time = ", time.time() - t1)) - print( res ) - assert res == expected + # One molecule here and there because thread launching has undeterministic + # characteristics. Even after setting moose.seed; we may not see same + # numbers on all platfroms. + expected = [ + (1000.0, 1000.0, 1000.0, 1000000.0) + , (9.908, 10.0, 8.0, 9908.0) + , (6.869, 7.0, 6.0, 6869.0) + , (5.354, 6.0, 5.0, 5354.0) + , (4.562, 5.0, 4.0, 4562.0) + , (3.483, 4.0, 3.0, 3483.0) + , (3.043, 4.0, 3.0, 3043.0) + , (2.261, 3.0, 2.0, 2261.0) + , (1.967, 2.0, 1.0, 1967.0) + , (1.997, 2.0, 1.0, 1997.0) ] + print("Time = ", time.time() - t1) + assert np.isclose(res, expected, atol=1, rtol=1).all(), "Got %s, expected %s" % (res, expected) if __name__ == '__main__': import sys diff --git a/moose-core/tests/python/test_moose_attribs.py b/moose-core/tests/python/test_moose_attribs.py index b10a2b30a4be8e81e56307da6cffcbaa6f793f07..3c8746b77341c835369cb1ea03950917af7d1ff6 100644 --- a/moose-core/tests/python/test_moose_attribs.py +++ b/moose-core/tests/python/test_moose_attribs.py @@ -18,7 +18,7 @@ attribs = ['AdExIF', 'AdThreshIF', 'Adaptor', 'Annotator', 'Arith', 'BufPool', 'Compartment', 'CompartmentBase', 'ConcChan', 'CplxEnzBase', 'CubeMesh', 'CylMesh', 'DestField', 'DiagonalMsg', 'DifBuffer', 'DifBufferBase', 'DifShell', 'DifShellBase', 'DiffAmp', 'Dsolve', 'ElementField', - 'EndoMesh', 'Enz', 'EnzBase', 'ExIF', 'Finfo', 'Func', 'Function', + 'EndoMesh', 'Enz', 'EnzBase', 'ExIF', 'Finfo', 'Function', 'GapJunction', 'GraupnerBrunel2012CaPlasticitySynHandler', 'Group', 'Gsolve', 'HHChannel', 'HHChannel2D', 'HHChannelBase', 'HHGate', 'HHGate2D', 'HSolve', 'INFINITE', 'IntFire', 'IntFireBase', 'Interpol', diff --git a/moose-core/tests/python/test_table_streaming_support.py b/moose-core/tests/python/test_table_streaming_support.py index 42b0b83b8e002ce04276708da97b9f3d3f682b77..73341865479d0aa3863e8e59de1cc7eba5d754bf 100644 --- a/moose-core/tests/python/test_table_streaming_support.py +++ b/moose-core/tests/python/test_table_streaming_support.py @@ -64,15 +64,10 @@ def test( ): print( ' MOOSE is done' ) # Now read the numpy and csv and check the results. - a = np.load( '_tables/compt/a/tabA.npy' ) + a = np.loadtxt( '_tables/compt/a/tabA.csv', skiprows=1 ) b = np.load( 'table2.npy' ) c = np.loadtxt( 'tablec.csv', skiprows=1 ) - print( a ) - print( b ) - print( c ) - print(a['time']) - print(b['time']) - assert len(a['time']) == len(a['/compt/a/tabA']) + assert (len(a) == len(b) == len(c)) def main( ): test( ) diff --git a/moose-core/utility/Annotator.cpp b/moose-core/utility/Annotator.cpp index f2df4aa1fa2dd436f4e5937e1321fa213a970101..e8b91b817bf0898c6ade81f118ac3b062acd320a 100644 --- a/moose-core/utility/Annotator.cpp +++ b/moose-core/utility/Annotator.cpp @@ -129,7 +129,7 @@ const Cinfo* Annotator::initCinfo() static const Cinfo* annotatorCinfo = Annotator::initCinfo(); Annotator::Annotator() - : x_( 0.0 ), y_( 0.0 ), z_( 0.0 ), width_( 0.0 ), height_( 0.0 ), + : x_( 0.0 ), y_( 0.0 ), z_( 0.0 ), height_(0.0), width_( 0.0 ), notes_( "" ), color_( "white" ), textColor_( "black" ), icon_( "sphere" ),solver_( "ee"),runtime_(100.0),dirpath_(""),modeltype_("") { diff --git a/moose-core/utility/numutil.cpp b/moose-core/utility/numutil.cpp index 240b125f8d888e1889566e5d50ed27c4625b2e01..10b0419560b45e6880b524a144dbd338def3fe6e 100644 --- a/moose-core/utility/numutil.cpp +++ b/moose-core/utility/numutil.cpp @@ -5,24 +5,10 @@ * E-mail: ray dot subhasis at gmail dot com * Created: 2007-11-02 11:46:40 ********************************************************************/ -/********************************************************************** - ** This program is part of 'MOOSE', the - ** Messaging Object Oriented Simulation Environment, - ** also known as GENESIS 3 base code. - ** copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS - ** It is made available under the terms of the - ** GNU Lesser General Public License version 2.1 - ** See the file COPYING.LIB for the full notice. - **********************************************************************/ -#ifndef _NUMUTIL_CPP -#define _NUMUTIL_CPP - -#ifdef ENABLE_CPP11 -#include <ctgmath> -#else /* ----- not ENABLE_CPP11 ----- */ #include <cmath> -#endif /* ----- not ENABLE_CPP11 ----- */ +#include "../randnum/RNG.h" +#include "numutil.h" bool almostEqual(float x, float y, float epsilon) { @@ -61,4 +47,27 @@ bool almostEqual(long double x, long double y, long double epsilon) } } -#endif +double approximateWithInteger_debug(const char* name, const double x, moose::RNG& rng) +{ + static size_t n = 0; + n += 1; + cerr << name << ' ' << ':' << x; + auto y = approximateWithInteger(x, rng); + cout << ' ' << y << ", "; + if( std::fmod(n, 4) == 0) + cerr << endl; + return y; +} + +double approximateWithInteger(const double x, moose::RNG& rng) +{ + assert(x >= 0.0); + double xf = std::floor(x); + double base = x - xf; + if( base == 0.0) + return x; + if( rng.uniform() < base) + return xf+1.0; + return xf; +} + diff --git a/moose-core/utility/numutil.h b/moose-core/utility/numutil.h index 01ed6e2abbe4c3669533dbed425c64b576235433..b20bba5f51d72d80f982226e23af3e7a68746e00 100644 --- a/moose-core/utility/numutil.h +++ b/moose-core/utility/numutil.h @@ -5,15 +5,6 @@ * E-mail: ray dot subhasis at gmail dot com * Created: 2007-11-02 11:47:21 ********************************************************************/ -/********************************************************************** - ** This program is part of 'MOOSE', the - ** Messaging Object Oriented Simulation Environment, - ** also known as GENESIS 3 base code. - ** copyright (C) 2003-2005 Upinder S. Bhalla. and NCBS - ** It is made available under the terms of the - ** GNU General Public License version 2 - ** See the file COPYING.LIB for the full notice. - **********************************************************************/ #ifndef _NUMUTIL_H #define _NUMUTIL_H @@ -21,14 +12,9 @@ #include <cmath> #include <cfloat> #include <limits> +#include "../randnum/RNG.h" -const int WORD_LENGTH = 32; // number of bits in a word - check for portability -const double LN2 = 0.69314718055994528622676; -const unsigned long LN2BYTES = 0xB1721814; -const double NATURAL_E = 2.718281828459045; - -//extern const double getMachineEpsilon(); -//extern const double EPSILON; +#include "../randnum/RNG.h" #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -85,10 +71,7 @@ bool almostEqual(float x, float y, float epsilon = FLT_EPSILON); bool almostEqual(double x, double y, double epsilon = DBL_EPSILON); bool almostEqual(long double x, long double y, long double epsilon = LDBL_EPSILON); -// round, isinf and isnan are not defined in VC++ or Borland C++ -#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(_MSC_VER) -#define isinf(param) !_finite(param) -#define isnan(param) _isnan(param) -#define round(param) floor(param+0.5) -#endif +double approximateWithInteger(const double x, moose::RNG& rng); +double approximateWithInteger_debug(const char* name, const double x, moose::RNG& rng); + #endif diff --git a/moose-core/utility/print_function.hpp b/moose-core/utility/print_function.hpp index 9d389a0669f17c43cf3606715bd0cf621beac3c3..e7ec0b908628ec6834170ccccf3fd078bd4bb7e9 100644 --- a/moose-core/utility/print_function.hpp +++ b/moose-core/utility/print_function.hpp @@ -32,6 +32,7 @@ #include <iomanip> #include <ctime> #include <algorithm> +#include <cstring> #define T_RESET "\033[0m" #define T_BLACK "\033[30m" /* Black */ @@ -62,12 +63,17 @@ using namespace std; #ifndef NDEBUG #define MOOSE_DEBUG( a ) { \ stringstream ss; ss << a; \ - cout << "DEBUG: " << __FILENAME__ << ":" << __LINE__ << "| " << ss.str(); \ + cout << "DEBUG: " << __FILENAME__ << ":" << __LINE__ << " " << ss.str() << std::endl; \ } #else #define MOOSE_DEBUG( a ) {} #endif +#define MOOSE_WARN( a ) { \ + stringstream ss; ss << a; \ + moose::showWarn( ss.str() ); \ + } + namespace moose { /** @@ -147,7 +153,7 @@ namespace moose { return ss.str(); } - // Not print it when built for release. + // Not print it when built for release. inline string debugPrint(string msg, string prefix = "DEBUG" , string color=T_RESET, unsigned debugLevel = 0 )