diff --git a/moose-core/.pre-commit-config.yaml b/moose-core/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5eccd7a7ee9cc0f150c876dff4905a98545b0306 --- /dev/null +++ b/moose-core/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +- repo: https://github.com/pre-commit/pre-commit-hooks + sha: v0.8.0 + hooks: + - id: check-added-large-files + - id: check-ast + - id: check-merge-conflict + - id: check-case-conflict + - id: check-docstring-first + - id: debug-statements + - id: fix-encoding-pragma + - id: trailing-whitespace diff --git a/moose-core/.travis.yml b/moose-core/.travis.yml index 6c3cd42eeb7af56690f9a640b197f9130b42b9d1..37f05c9b5ec0bf2bfc119cf87ce3ddb1ae682eaa 100644 --- a/moose-core/.travis.yml +++ b/moose-core/.travis.yml @@ -1,14 +1,12 @@ language: cpp dist: trusty -sudo: required -group: edge +sudo: required +group: edge -compiler: - - gcc - - clang os: - linux - osx + notifications: email: recipients: @@ -18,16 +16,9 @@ notifications: on_success: change on_failure: always -env: - - CTEST_MODEL=Nightly -cache: apt - -matrix: - allow_failure: - os: osx - -before_script : +before_script : - echo "OSX related" + - 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 @@ -37,3 +28,5 @@ script: - if type python3 > /dev/null; then python3 -m compileall -q . ; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_build_osx.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/travis_build_linux.sh; fi + - cd ./.travis && ./download_and_run_doqcs.sh && cd .. + - set +e diff --git a/moose-core/.travis/download_and_run_doqcs.sh b/moose-core/.travis/download_and_run_doqcs.sh new file mode 100755 index 0000000000000000000000000000000000000000..88c33c47078919322018061461c62c24f0ff41d1 --- /dev/null +++ b/moose-core/.travis/download_and_run_doqcs.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +set +e + +# Definitions of colors in bash +RESTORE='\033[0m' + +RED='\033[00;31m' +GREEN='\033[00;32m' +YELLOW='\033[00;33m' +BLUE='\033[00;34m' +PURPLE='\033[00;35m' +CYAN='\033[00;36m' +LIGHTGRAY='\033[00;37m' + +LRED='\033[01;31m' +LGREEN='\033[01;32m' +LYELLOW='\033[01;33m' +LBLUE='\033[01;34m' +LPURPLE='\033[01;35m' +LCYAN='\033[01;36m' +WHITE='\033[01;37m' + +function coloredPrint +{ + case $1 in + "WARN") + echo -e "[WARN] ${LRED} $2 ${RESTORE} $3" + ;; + "INFO") + echo -e "[INFO] ${LGREEN} $2 ${RESTORE} $3" + ;; + "ERROR") + echo -e "[ERROR] ${RED} $2 ${RESTORE} $3" + ;; + "DEBUG") + echo -e "[DEBUG] ${YELLOW} $2 ${RESTORE} $3" + ;; + "STEP") + echo -e "[STEP] ${BLUE} $2 ${RESTORE} $3" + ;; + "TODO") + echo -e "[TODO] ${CYAN} $2 ${RESTORE} $3" + ;; + *) + echo -e "[$1] $2 $3" + ;; + esac +} + +coloredPrint "INFO" "Downloading DOQCS database silently" +# Download all models. +wget -q -A"*.g" -r https://doqcs.ncbs.res.in/database/simfile/ +coloredPrint "INFO" "Done downloading" + +echo '' > __UNCLEAN__DOQCS__ +MODELS=`find . -type f -name "*.g"` +for _model in ${MODELS}; do + echo "====================================================================" + coloredPrint "INFO" "Running $_model for 1 sec" + T1=$(date +%s.%N) + OUT=$(python -c " +import moose +moose.loadModel( '${_model}', '/model', 'gsl' ) +moose.reinit( ) +moose.start( 1 ) +") + T2=$(date +%s.%N) + DT=$(echo "$T2-$T1" | bc) + OUTTRIMMED=`echo $OUT | xargs` + coloredPrint "INFO" "TOOK $DT seconds to run 1 sec." + if [[ ! -z $OUTTRIMMED ]]; then + coloredPrint "WARN" "$_model did not load/run cleanly" + echo "[] ${_model} \n" >> __UNCLEAN__DOQCS__ + echo "\`\`\`" >> __UNCLEAN__DOQCS__ + echo "$OUTTRIMMED" >> __UNCLEAN__DOQCS__ + echo "\n\`\`\`" >> __UNCLEAN__DOQCS__ + echo $OUTTRIMMED + else + coloredPrint "INFO" "$_model loaded just fine. We did NOT check output results" + fi +done + +coloredPrint "INFO" "Following scripts did not run cleanly" +cat __UNCLEAN__DOQCS__ diff --git a/moose-core/.travis/travis_build_linux.sh b/moose-core/.travis/travis_build_linux.sh index 49b7aa6ae5014ed1a53ad62c2edee002ba1a331c..29136cc98788adea6e82a46829409f7791fa5c95 100755 --- a/moose-core/.travis/travis_build_linux.sh +++ b/moose-core/.travis/travis_build_linux.sh @@ -2,11 +2,11 @@ #=============================================================================== # # FILE: travis_build_linux.sh -# -# USAGE: ./travis_build_linux.sh -# +# +# USAGE: ./travis_build_linux.sh +# # DESCRIPTION: Build on linux environment. -# +# # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- @@ -41,12 +41,13 @@ PYTHON3="/usr/bin/python3" mkdir -p _BOOST_BUILD && cd _BOOST_BUILD && \ cmake -DWITH_BOOST=ON -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" .. make && ctest --output-on-failure - cd .. + sudo make install # For testing doqcs database. + cd .. # This is only applicable on linux build. - echo "Python3 support. Removed python2-networkx and install python3" - if type $PYTHON3 > /dev/null; then - sudo apt-get remove -qq python-networkx + echo "Python3 support. Removed python2-networkx and install python3" + if type $PYTHON3 > /dev/null; then + sudo apt-get remove -qq python-networkx sudo apt-get install -qq python3-networkx mkdir -p _GSL_BUILD2 && cd _GSL_BUILD2 && \ cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON3" .. diff --git a/moose-core/.travis/travis_build_osx.sh b/moose-core/.travis/travis_build_osx.sh index 3235bcc157906e9fdffc465420608cf90db32cfe..36de91422a2fb7a795a4467f31a8462f65021354 100755 --- a/moose-core/.travis/travis_build_osx.sh +++ b/moose-core/.travis/travis_build_osx.sh @@ -1,12 +1,12 @@ -#!/bin/bash - +#!/bin/bash - #=============================================================================== # # FILE: travis_build_linux.sh -# -# USAGE: ./travis_build_linux.sh -# +# +# USAGE: ./travis_build_linux.sh +# # DESCRIPTION: Build on linux environment. -# +# # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- @@ -23,8 +23,9 @@ set -e ( mkdir -p _GSL_BUILD && cd _GSL_BUILD && cmake -DDEBUG=ON -DPYTHON_EXECUTABLE=`which python` .. make && ctest --output-on-failure + sudo make install cd .. # Now with boost. mkdir -p _BOOST_BUILD && cd _BOOST_BUILD && cmake -DWITH_BOOST=ON -DDEBUG=ON -DPYTHON_EXECUTABLE=`which python` .. make && ctest --output-on-failure - cd .. + cd .. ) diff --git a/moose-core/.travis/travis_prepare_linux.sh b/moose-core/.travis/travis_prepare_linux.sh index ce068f9bf2fc2497ef2ca738a468e1acffb46541..5f0a31608863151c8473f8f80348a29f3fac83ea 100755 --- a/moose-core/.travis/travis_prepare_linux.sh +++ b/moose-core/.travis/travis_prepare_linux.sh @@ -1,12 +1,12 @@ -#!/bin/bash - +#!/bin/bash - #=============================================================================== # # FILE: travis_prepare_linux.sh -# -# USAGE: ./travis_prepare_linux.sh -# +# +# USAGE: ./travis_prepare_linux.sh +# # DESCRIPTION: Prepare linux build environment on travis. -# +# # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- @@ -18,7 +18,7 @@ #=============================================================================== set -o nounset # Treat unset variables as an error -set +e # Let installation fail in some command +set +e # Let installation fail in some command apt-get install -qq libxml2-dev libbz2-dev apt-get install -qq libhdf5-serial-dev diff --git a/moose-core/.travis/travis_prepare_osx.sh b/moose-core/.travis/travis_prepare_osx.sh index 28b3b6668e17c480c8a0d88f5bb22d32ebccd152..8c67277ad623b7f9e83e21d63a21f369a9179110 100755 --- a/moose-core/.travis/travis_prepare_osx.sh +++ b/moose-core/.travis/travis_prepare_osx.sh @@ -1,12 +1,12 @@ -#!/bin/bash - +#!/bin/bash - #=============================================================================== # # FILE: travis_prepare_osx.sh -# -# USAGE: ./travis_prepare_osx.sh -# +# +# USAGE: ./travis_prepare_osx.sh +# # DESCRIPTION: Script to prepare OSX build on Travis CI. -# +# # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- @@ -19,6 +19,7 @@ set -o nounset # Treat unset variables as an error set +e +rvm get head brew update #brew outdated cmake || brew install cmake brew install gsl diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt index 13c902e1f7f5f919e527adcaf83c5e4988591dbb..fa8df75821cdab4b617f767819c312b4517d3b92 100644 --- a/moose-core/CMakeLists.txt +++ b/moose-core/CMakeLists.txt @@ -21,7 +21,7 @@ set(VERSION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/VERSION) find_program(GIT_EXEC "git") message( STATUS "Looking for git ${GIT_EXEC}" ) if( (NOT MOOSE_VERSION) AND GIT_EXEC) - execute_process( + execute_process( COMMAND ${GIT_EXEC} describe --tags --long WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE MOOSE_VERSION @@ -49,7 +49,7 @@ message( STATUS "MOOSE Version ${MOOSE_VERSION}" ) # (which would end up getting picked up by header search, instead of the correct # versions). if( CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE ) - message(FATAL_ERROR + message(FATAL_ERROR "======================================================================\n" "In-source builds are not allowed. Remove CMakeCache.txt and CMakeFiles\n" "directory and do something like this inside this directory \n" @@ -85,9 +85,6 @@ else() endif() ################################ CMAKE OPTIONS ################################## - -option(VERBOSITY "Set MOOSE verbosity level (deprecated)" 0) -## Unit testing and debug mode. option(DEBUG "Build with debug support" OFF) option(GPROF "Build for profiling using gprof" OFF) option(ENABLE_UNIT_TESTS "Enable unit tests (DEBUG should also be ON)" OFF) @@ -95,6 +92,8 @@ option(WITH_PYTHON "Build native python extension" ON) option(WITH_MPI "Enable Openmpi support" OFF) option(WITH_BOOST "Use boost library instead of GSL" OFF) option(WITH_GSL "Use gsl-library. Alternative is WITH_BOOST" ON) +option(PARALLELIZED_SOLVERS "Use parallel version of GSOLVE. (alpha)" OFF ) +option(PARALLELIZED_CLOCK "High level parallelization of moose::Clock (alpha)" OFF ) ################################# CMKAE MACROS ################################# @@ -125,6 +124,7 @@ if(GPROF AND DEBUG) set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg") endif() + ################################### TARGETS #################################### add_library(libmoose SHARED basecode/main.cpp) @@ -152,7 +152,7 @@ set(SYSTEM_SHARED_LIBS ${LibXML2_LIBRARIES}) if(WITH_GSL) find_package(GSL 1.16) if(NOT GSL_FOUND) - message(FATAL_ERROR + message(FATAL_ERROR "=====================================================================\n" " FATAL gsl(>1.16) not found.\n\n" " MOOSE requires Gnu Scientific Library (GSL) 1.16 or higher. \n" @@ -209,18 +209,18 @@ if(HDF5_FOUND) add_definitions( -DUSE_HDF5 ) if(HDF5_USE_STATIC_LIBRARIES) message(STATUS "Finding static HDF5 libraries in $ENV{HDF5_ROOT}") - find_library(HDF5_CXX_LIBRARIES NAMES libhdf5.a + find_library(HDF5_CXX_LIBRARIES NAMES libhdf5.a PATHS $ENV{HDF5_ROOT}/lib $ENV{HDF5_ROOT}/lib64 ) find_library(HDF5_HL_LIBRARIES NAMES libhdf5_hl.a - PATHS $ENV{HDF5_ROOT}/lib $ENV{HDF5_ROOT}/lib64 + PATHS $ENV{HDF5_ROOT}/lib $ENV{HDF5_ROOT}/lib64 ) set(HDF5_LIBRARIES ${HDF5_CXX_LIBRARIES} ${HDF5_HL_LIBRARIES}) endif() - + # Make sure, HDF5_HL_LIBRARIES are set. The COMPONENTS in find_package may - # or may not work. See BhallaLab/moose-core#163. + # or may not work. See BhallaLab/moose-core#163. if(NOT HDF5_HL_LIBRARIES) set(HDF5_HL_LIBRARIES ${HDF5_HL_LIBRARIES}) endif(NOT HDF5_HL_LIBRARIES) @@ -343,15 +343,15 @@ list(APPEND MOOSE_LIBRARIES randnum scheduling moose_mpi - biophysics - utility - kinetics + biophysics + utility + kinetics synapse intfire - hsolve + hsolve mesh signeur - diffusion + diffusion ksolve device basecode @@ -377,7 +377,7 @@ if(MACOSX) ${CMAKE_DL_LIBS} ) ELSE(MACOSX) - target_link_libraries(libmoose + target_link_libraries(libmoose "-Wl,--whole-archive" ${MOOSE_LIBRARIES} ${STATIC_LIBRARIES} @@ -416,11 +416,11 @@ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/moose # INSTALL python module. # This target is built by pymoose/CMakeLists.txt file. Using the --prefix option # always override debian default installation directory. It will be installed in -# site-packages instead of dist-packages. +# site-packages instead of dist-packages. # See https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/362570 # HACK: Get platform information from python and use it to fix the layout. -execute_process( - COMMAND ${PYTHON_EXECUTABLE} -mplatform OUTPUT_VARIABLE _platform_desc +execute_process( + COMMAND ${PYTHON_EXECUTABLE} -mplatform OUTPUT_VARIABLE _platform_desc ) message( STATUS "Platform ${_platform_desc}" ) @@ -430,11 +430,11 @@ if(WITH_PYTHON) list( APPEND EXTRA_ARGS "--install-layout=deb" ) endif( ) - install(CODE - "execute_process( - COMMAND ${PYTHON_EXECUTABLE} setup.py install ${EXTRA_ARGS} + install(CODE + "execute_process( + COMMAND ${PYTHON_EXECUTABLE} setup.py install ${EXTRA_ARGS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python - )" + )" ) endif(WITH_PYTHON) diff --git a/moose-core/INSTALL.md b/moose-core/INSTALL.md index db608dab82ff2889eecc4fe953aa593297fe52ec..6f2272b2c130c9e9b02516dffe83cb31a6cd17fc 100644 --- a/moose-core/INSTALL.md +++ b/moose-core/INSTALL.md @@ -12,7 +12,7 @@ https://software.opensuse.org/download.html?project=home:moose&package=moose MOOSE is available via [homebrew](http://brew.sh). - $ brew install homebrew/science/moose + $ brew install homebrew/science/moose # Building MOOSE from source @@ -28,13 +28,13 @@ Download the latest source code of moose from github. For moose-core: - gsl-1.16 or higher. -- libhdf5-dev (optional) -- python-dev -- python-numpy +- libhdf5-dev (optional) +- python-dev +- python-numpy On Ubuntu-12.04 or higher, these can be installed with: - - sudo apt-get install python-dev python-numpy libhdf5-dev cmake libgsl0-dev g++ + + sudo apt-get install python-dev python-numpy libhdf5-dev cmake libgsl0-dev g++ __NOTE__ : On Ubuntu 12.04, gsl version is 1.15. You should skip `libgsl0-dev` install gsl-1.16 or higher manually. @@ -43,10 +43,10 @@ SBML support is enabled by installing [python-libsbml](http://sbml.org/Software/ $ sudo pip install python-libsbml ## Use `cmake` to build moose: - - $ cd /path/to/moose-core + + $ cd /path/to/moose-core $ mkdir _build - $ cd _build + $ cd _build $ cmake .. $ make $ ctest --output-on-failure @@ -56,9 +56,9 @@ check if build process was successful. To install MOOSE into non-standard directory, pass additional argument `-DCMAKE_INSTALL_PREFIX=path/to/install/dir` to cmake. -### Python3 +### Python3 -You just need to one command in previous set of instructions to following +You just need to one command in previous set of instructions to following cmake -DPYTHON_EXECUTABLE=/opt/bin/python3 .. @@ -80,14 +80,14 @@ calling make: export CXXFLAGS= -I/opt/libsbml/include export LDFLAGS= -L/opt/libsbml/lib - + ### Release build: cd moose make BUILD=release ### Debug build: - + cd moose make BUILD=debug @@ -99,7 +99,7 @@ Python 3K, you need to pass the additional flag: PYTHON=3 like: - + make BUILD=release PYTHON=3 ## Installation: @@ -108,12 +108,12 @@ For system-wide installation you can run: sudo make install -## Post installation +## Post installation Now you can import moose in a Python script or interpreter with the statement: import moose - + If you have installed the GUI dependencies below for running the graphical user interface, then you can run the GUI by double-clicking on the desktop icon or via the main-menu. The squid axon tutorial/demo is also accessible via these @@ -128,7 +128,7 @@ variable. Suppose you have a ~/lib directory where you keep all your locally built libraries, do: cp -r {moose-source-directory}/python ~/lib/ - + and add this to your .bashrc file (if you use bash shell): export PYTHONPATH="$HOME/lib/python":"$PYTHONPATH" diff --git a/moose-core/MooseTests.cmake b/moose-core/MooseTests.cmake index 38aabc3d7808520ca530d4b32377a35d9d6ba0ae..820a1cccafbceb1a883e8e55600fdf26cf45e1f7 100644 --- a/moose-core/MooseTests.cmake +++ b/moose-core/MooseTests.cmake @@ -133,3 +133,13 @@ ADD_TEST( NAME pymoose-test-calcium-hsolve set_tests_properties(pymoose-test-calcium-hsolve PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/python" ) + +# # NOTE: These tests are not enabled yet. They take lot of time. Not all scripts +# # are fixed yet. +# # Test moose-examples with very short timeout. +# ADD_TEST( NAME pymoose-test-moose-examples +# COMMAND ${TEST_COMMAND} -c "import moose; moose.test( timeout = 10 );" +# ) +# set_tests_properties(pymoose-test-moose-examples +# PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/python" +# ) diff --git a/moose-core/README.md b/moose-core/README.md index 3c8c144804e5485969288f1dcf6b32c6ef7652fe..90d19144aadc5d514300fe7acb7805020739d400 100644 --- a/moose-core/README.md +++ b/moose-core/README.md @@ -1,6 +1,6 @@ -[](https://travis-ci.org/BhallaLab/moose-core) +[](https://travis-ci.org/BhallaLab/moose-core) -This is the core computational engine of [MOOSE simulator](https://github.com/BhallaLab/moose). This repository contains -C++ codebase and python interface. For more details about MOOSE simulator, see https://github.com/BhallaLab/moose/blob/master/README.md +This is the core computational engine of [MOOSE simulator](https://github.com/BhallaLab/moose). This repository contains +C++ codebase and python interface. For more details about MOOSE simulator, see https://github.com/BhallaLab/moose/blob/master/README.md This repository is sufficient for using MOOSE as a python module. If you just want to build moose python module, follow instructions given here at https://github.com/BhallaLab/moose-core/blob/master/INSTALL.md . diff --git a/moose-core/basecode/CMakeLists.txt b/moose-core/basecode/CMakeLists.txt index 0a4738fc4ac2d7ea4a49a5dbff83bf75f0cf71b6..7fb64829196bf87e075d5cee056eaed0e1ab758f 100644 --- a/moose-core/basecode/CMakeLists.txt +++ b/moose-core/basecode/CMakeLists.txt @@ -1,28 +1,28 @@ cmake_minimum_required(VERSION 2.6) include_directories(../msg) -add_library(basecode - consts.cpp - Element.cpp - DataElement.cpp - GlobalDataElement.cpp - LocalDataElement.cpp - Eref.cpp - Finfo.cpp - DestFinfo.cpp - Cinfo.cpp - SrcFinfo.cpp - ValueFinfo.cpp - SharedFinfo.cpp - FieldElementFinfo.cpp - FieldElement.cpp - Id.cpp - ObjId.cpp - global.cpp - SetGet.cpp - OpFuncBase.cpp - EpFunc.cpp - HopFunc.cpp - SparseMatrix.cpp - doubleEq.cpp - testAsync.cpp +add_library(basecode + consts.cpp + Element.cpp + DataElement.cpp + GlobalDataElement.cpp + LocalDataElement.cpp + Eref.cpp + Finfo.cpp + DestFinfo.cpp + Cinfo.cpp + SrcFinfo.cpp + ValueFinfo.cpp + SharedFinfo.cpp + FieldElementFinfo.cpp + FieldElement.cpp + Id.cpp + ObjId.cpp + global.cpp + SetGet.cpp + OpFuncBase.cpp + EpFunc.cpp + HopFunc.cpp + SparseMatrix.cpp + doubleEq.cpp + testAsync.cpp ) diff --git a/moose-core/basecode/Cinfo.cpp b/moose-core/basecode/Cinfo.cpp index 50a82f6aa481591087e9a99711e6d89f6799bc15..d373cf71ba5711c167566a504bf34c9d5ad75d20 100644 --- a/moose-core/basecode/Cinfo.cpp +++ b/moose-core/basecode/Cinfo.cpp @@ -87,7 +87,7 @@ void Cinfo::init( Finfo** finfoArray, unsigned int nFinfos ) finfoMap_ = baseCinfo_->finfoMap_; funcs_ = baseCinfo_->funcs_; postCreationFinfos_ = baseCinfo_->postCreationFinfos_; - } + } for ( unsigned int i = 0; i < nFinfos; i++ ) { registerFinfo( finfoArray[i] ); } @@ -153,7 +153,7 @@ void buildFinfoElement( Id parent, vector< Finfo* >& f, const string& name ) if ( f.size() > 0 ) { char* data = reinterpret_cast< char* >( &f[0] ); Id id = Id::nextId(); - Element* e = new GlobalDataElement( + Element* e = new GlobalDataElement( id, Finfo::initCinfo(), name, f.size() ); Finfo::initCinfo()->dinfo()->assignData( e->data( 0 ), f.size(), data, f.size()); Shell::adopt( parent, id, 0 ); @@ -167,11 +167,11 @@ void Cinfo::makeCinfoElements( Id parent ) vector< unsigned int > dims( 1, 0 ); vector< Id > cinfoElements; - for ( map< string, Cinfo* >::iterator i = cinfoMap().begin(); + for ( map< string, Cinfo* >::iterator i = cinfoMap().begin(); i != cinfoMap().end(); ++i ) { Id id = Id::nextId(); char* data = reinterpret_cast< char* >( i->second ); - Element* e = new GlobalDataElement( + Element* e = new GlobalDataElement( id, Cinfo::initCinfo(), i->first ); Cinfo::initCinfo()->dinfo()->assignData( e->data( 0 ), 1, data, 1 ); // Cinfo* temp = reinterpret_cast< Cinfo* >( e->data( 0 ) ); @@ -181,7 +181,7 @@ void Cinfo::makeCinfoElements( Id parent ) // cout << "Cinfo::makeCinfoElements: parent= " << parent << ", Id = " << id << ", name = " << i->first << endl; } vector< Id >::iterator j = cinfoElements.begin(); - for ( map< string, Cinfo* >::iterator i = cinfoMap().begin(); + for ( map< string, Cinfo* >::iterator i = cinfoMap().begin(); i != cinfoMap().end(); ++i ) { buildFinfoElement( *j, i->second->srcFinfos_, "srcFinfo" ); buildFinfoElement( *j, i->second->destFinfos_, "destFinfo" ); @@ -361,7 +361,7 @@ const Cinfo* Cinfo::initCinfo() sizeof( cinfoFinfos ) / sizeof ( Finfo* ), &dinfo, doc, - sizeof(doc)/sizeof(string) + sizeof(doc)/sizeof(string) ); return &cinfoCinfo; @@ -383,12 +383,12 @@ string Cinfo::getDocs() const } -static DestFinfo dummy( - "dummy", - "This Finfo is a dummy. If you are reading this you have used an invalid index", +static DestFinfo dummy( + "dummy", + "This Finfo is a dummy. If you are reading this you have used an invalid index", 0 ); -string Cinfo::getBaseClass() const +string Cinfo::getBaseClass() const { if ( baseCinfo_ ) return baseCinfo_->name(); @@ -398,9 +398,9 @@ string Cinfo::getBaseClass() const //////////////////////////////////////////////////////////////////// // Below we have a set of functions for getting various categories of -// Finfos. These also return the base class finfos. The baseclass finfos +// Finfos. These also return the base class finfos. The baseclass finfos // come first, then the new finfos. This is a bit messy because it changes -// the indices of the new finfos, but I shouldn't be looking them up +// the indices of the new finfos, but I shouldn't be looking them up // by index anyway. //////////////////////////////////////////////////////////////////// Finfo* Cinfo::getSrcFinfo( unsigned int i ) const @@ -422,7 +422,7 @@ unsigned int Cinfo::getNumSrcFinfo() const { if ( baseCinfo_ ) return srcFinfos_.size() + baseCinfo_->getNumSrcFinfo(); - else + else return srcFinfos_.size(); } @@ -445,7 +445,7 @@ unsigned int Cinfo::getNumDestFinfo() const { if ( baseCinfo_ ) return destFinfos_.size() + baseCinfo_->getNumDestFinfo(); - else + else return destFinfos_.size(); } @@ -468,7 +468,7 @@ unsigned int Cinfo::getNumValueFinfo() const { if ( baseCinfo_ ) return valueFinfos_.size() + baseCinfo_->getNumValueFinfo(); - else + else return valueFinfos_.size(); } @@ -492,7 +492,7 @@ unsigned int Cinfo::getNumLookupFinfo() const { if ( baseCinfo_ ) return lookupFinfos_.size() + baseCinfo_->getNumLookupFinfo(); - else + else return lookupFinfos_.size(); } @@ -515,7 +515,7 @@ unsigned int Cinfo::getNumSharedFinfo() const { if ( baseCinfo_ ) return sharedFinfos_.size() + baseCinfo_->getNumSharedFinfo(); - else + else return sharedFinfos_.size(); } @@ -538,7 +538,7 @@ unsigned int Cinfo::getNumFieldElementFinfo() const { if ( baseCinfo_ ) return fieldElementFinfos_.size() + baseCinfo_->getNumFieldElementFinfo(); - else + else return fieldElementFinfos_.size(); } @@ -552,7 +552,7 @@ void Cinfo::setNumFinfo( unsigned int val ) // Dummy function const string& Cinfo::srcFinfoName( BindIndex bid ) const { static const string err = ""; - for ( vector< Finfo* >::const_iterator i = srcFinfos_.begin(); + for ( vector< Finfo* >::const_iterator i = srcFinfos_.begin(); i != srcFinfos_.end(); ++i ) { const SrcFinfo* sf = dynamic_cast< const SrcFinfo* >( *i ); assert( sf ); @@ -569,7 +569,7 @@ const string& Cinfo::srcFinfoName( BindIndex bid ) const const string& Cinfo::destFinfoName( FuncId fid ) const { static const string err = ""; - for ( vector< Finfo* >::const_iterator i = destFinfos_.begin(); + for ( vector< Finfo* >::const_iterator i = destFinfos_.begin(); i != destFinfos_.end(); ++i ) { const DestFinfo* df = dynamic_cast< const DestFinfo* >( *i ); assert( df ); diff --git a/moose-core/basecode/Cinfo.h b/moose-core/basecode/Cinfo.h index 20bacdb5392bcc623aa317019431ab130c090886..020be60b2b6ba8fdbe3c937e4e40d6c64b3ad0b6 100644 --- a/moose-core/basecode/Cinfo.h +++ b/moose-core/basecode/Cinfo.h @@ -22,7 +22,7 @@ class Cinfo * The Cinfo intializer is used for static initialization * of all the MOOSE Cinfos. Each MOOSE class must set up * a function to build its Cinfo. This function must be - * called statically in the MOOSE class .cpp file. + * called statically in the MOOSE class .cpp file. * Note how it takes the base *Cinfo as an argument. This * lets us call the base Cinfo initializer when making * each Cinfo class, thus ensuring the correct static @@ -72,7 +72,7 @@ class Cinfo /** * Used in derived classes, to replace the original OpFunc with - * the new one. + * the new one. */ void overrideFunc( FuncId fid, const OpFunc* f ); @@ -122,7 +122,7 @@ class Cinfo const Cinfo* baseCinfo() const; /** - * Finds Finfo by name in the list for this class, + * Finds Finfo by name in the list for this class, * ignoring any element-specific fields. * Returns 0 on failure. */ @@ -164,7 +164,7 @@ class Cinfo ///////////////////////////////////////////////////////////////// // Functions here for the MOOSE Cinfo inspection class ///////////////////////////////////////////////////////////////// - + /** * Return the documentation string */ @@ -241,23 +241,23 @@ class Cinfo void setNumFinfo( unsigned int v ); /** - * Returns the name of the SrcFinfo having the specified + * Returns the name of the SrcFinfo having the specified * BindIndex, on this Cinfo. * Returns "" on failure. */ const string& srcFinfoName( BindIndex bid ) const; /** - * Returns the name of the DestFinfo having the specified + * Returns the name of the DestFinfo having the specified * FuncId, on this Cinfo. * Returns "" on failure. */ const string& destFinfoName( FuncId fid ) const; - + /** - * Utility function used at init to create the inspection + * Utility function used at init to create the inspection * Elements for each of the Cinfos. */ static void makeCinfoElements( Id parent ); @@ -284,7 +284,7 @@ class Cinfo BindIndex numBindIndex_; std::map< std::string, std::string > doc_; - + bool banCreation_; /** diff --git a/moose-core/basecode/Conv.h b/moose-core/basecode/Conv.h index 54f248e966e88ce8b5af1d1701329c510e57badf..1f14ad709e39387bdbbeeee166d10a9b08c638fc 100644 --- a/moose-core/basecode/Conv.h +++ b/moose-core/basecode/Conv.h @@ -13,7 +13,7 @@ /** * This set of templates defines converters. The conversions are from - * string to object, object to string, and + * string to object, object to string, and * binary buffer to object, object to binary buffer. * Many classes convert through a single template. Strings and other things * with additional data need special converters. @@ -162,7 +162,7 @@ template<> class Conv< string > /** * The template specialization of Conv< unsigned int > sets up alignment on - * word boundaries by storing the data as a double. + * word boundaries by storing the data as a double. */ template<> class Conv< double > { @@ -182,7 +182,7 @@ template<> class Conv< double > } static void val2buf( double val, double** buf ) { **buf = val; - (*buf)++; + (*buf)++; } static void str2val( double &val, const string& s ) { @@ -203,7 +203,7 @@ template<> class Conv< double > /** * The template specialization of Conv< unsigned int > sets up alignment on - * word boundaries by storing the data as a double. + * word boundaries by storing the data as a double. */ template<> class Conv< float > { @@ -223,7 +223,7 @@ template<> class Conv< float > } static void val2buf( float val, double** buf ) { **buf = val; - (*buf)++; + (*buf)++; } static void str2val( float& val, const string& s ) { @@ -244,7 +244,7 @@ template<> class Conv< float > /** * The template specialization of Conv< unsigned int > sets up alignment on - * word boundaries by storing the data as a double. + * word boundaries by storing the data as a double. */ template<> class Conv< unsigned int > { @@ -264,7 +264,7 @@ template<> class Conv< unsigned int > } static void val2buf( unsigned int val, double** buf ) { **buf = val; - (*buf)++; + (*buf)++; } static void str2val( unsigned int& val, const string& s ) { @@ -285,7 +285,7 @@ template<> class Conv< unsigned int > /** * The template specialization of Conv< int > sets up alignment on - * word boundaries by storing the data as a double. + * word boundaries by storing the data as a double. */ template<> class Conv< int > { @@ -305,7 +305,7 @@ template<> class Conv< int > } static void val2buf( int val, double** buf ) { **buf = val; - (*buf)++; + (*buf)++; } static void str2val( int& val, const string& s ) { @@ -342,7 +342,7 @@ template<> class Conv< unsigned short > } static void val2buf( unsigned short val, double** buf ) { **buf = (double)val; - (*buf)++; + (*buf)++; } static void str2val( unsigned short& val, const string& s ) { @@ -379,7 +379,7 @@ template<> class Conv< short > } static void val2buf( short val, double** buf ) { **buf = val; - (*buf)++; + (*buf)++; } static void str2val( short& val, const string& s ) { @@ -416,7 +416,7 @@ template<> class Conv< bool > } static void val2buf( bool val, double** buf ) { **buf = val; - (*buf)++; + (*buf)++; } static void str2val( bool& val, const string& s ) { @@ -441,7 +441,7 @@ template<> class Conv< bool > /** * The template specialization of Conv< Id > sets up alignment on - * word boundaries by storing the Id as a double. It also deals with + * word boundaries by storing the Id as a double. It also deals with * the string conversion issues. */ @@ -463,7 +463,7 @@ template<> class Conv< Id > } static void val2buf( Id id, double** buf ) { **buf = id.value(); - (*buf)++; + (*buf)++; } static void str2val( Id& val, const string& s ) { @@ -564,7 +564,7 @@ template< class T > class Conv< vector< vector< T > > > template< class T > class Conv< vector< T > > { public: - /** + /** * Size of returned array in doubles. */ static unsigned int size( const vector< T >& val ) diff --git a/moose-core/basecode/DataElement.cpp b/moose-core/basecode/DataElement.cpp index decf9f8aee23df51aa51c50401c35c273fb8ea49..f3d0ba37a7c28d77b8eacc7da4e13e1242d0dbf9 100644 --- a/moose-core/basecode/DataElement.cpp +++ b/moose-core/basecode/DataElement.cpp @@ -10,9 +10,9 @@ #include "header.h" #include "FuncOrder.h" -DataElement::DataElement( Id id, const Cinfo* c, const string& name, +DataElement::DataElement( Id id, const Cinfo* c, const string& name, unsigned int numData ) - : + : Element( id, c, name ) { data_ = c->dinfo()->allocData( numData ); @@ -32,14 +32,14 @@ DataElement::DataElement( Id id, const Cinfo* c, const string& name, * startEntry is the starting index. It is expected that the subset used * will be contiguous from this index. */ -DataElement::DataElement( Id id, const Element* orig, +DataElement::DataElement( Id id, const Element* orig, unsigned int n, unsigned int startEntry ) - : + : Element( id, orig->cinfo(), orig->getName() ) { numLocalData_ = n; size_ = cinfo()->dinfo()->sizeIncrement(); - data_ = cinfo()->dinfo()->copyData( orig->data( 0 ), orig->numData(), + data_ = cinfo()->dinfo()->copyData( orig->data( 0 ), orig->numData(), numLocalData_, startEntry ); // cinfo_->postCreationFunc( id, this ); } @@ -89,14 +89,14 @@ char* DataElement::data( unsigned int rawIndex, unsigned int fieldIndex ) const /** * virtual func, overridden. * Here we resize the local data. This function would be called by - * derived classes to do their own data management as per node + * derived classes to do their own data management as per node * decomposition. */ void DataElement::resize( unsigned int newNumLocalData ) { numLocalData_ = newNumLocalData; char* temp = data_; - data_ = cinfo()->dinfo()->copyData( + data_ = cinfo()->dinfo()->copyData( temp, numLocalData_, newNumLocalData, 0 ); cinfo()->dinfo()->destroyData( temp ); numLocalData_ = newNumLocalData; diff --git a/moose-core/basecode/DataElement.h b/moose-core/basecode/DataElement.h index 85b24adffc46582197889a77c9b96e6b5a5dbf54..1c6448877dfc544f56fa6c1738c5a23e6d9666ab 100644 --- a/moose-core/basecode/DataElement.h +++ b/moose-core/basecode/DataElement.h @@ -30,7 +30,7 @@ class DataElement: public Element * name is its name * numData is the number of data entries, defaults to a singleton. * The isGlobal flag specifies whether the created objects should - * be replicated on all nodes, or partitioned without replication. + * be replicated on all nodes, or partitioned without replication. */ DataElement( Id id, const Cinfo* c, const string& name, unsigned int numData = 1 ); @@ -39,7 +39,7 @@ class DataElement: public Element * This constructor copies over the original n times. It is * used for doing all copies, in Shell::innerCopyElements. */ - DataElement( Id id, const Element* orig, unsigned int n, + DataElement( Id id, const Element* orig, unsigned int n, unsigned int startEntry ); /** @@ -47,7 +47,7 @@ class DataElement: public Element */ ~DataElement(); - /** + /** * copyElement function is defined only in derived classes. */ @@ -66,7 +66,7 @@ class DataElement: public Element unsigned int numField( unsigned int rawIndex ) const; /** - * Inherited virtual: Returns number of field entries on + * Inherited virtual: Returns number of field entries on * current node, same as numLocalData(). */ unsigned int totNumLocalField() const; @@ -75,7 +75,7 @@ class DataElement: public Element /** * Inherited virtual - * True if this is a FieldElement having an array of fields + * True if this is a FieldElement having an array of fields * on each data entry. Clearly not true for the base Element. */ bool hasFields() const { @@ -89,7 +89,7 @@ class DataElement: public Element /** * Inherited virtual. * Looks up specified field data entry. On regular objects just - * returns the data entry specified by the rawIndex. + * returns the data entry specified by the rawIndex. * On FieldElements like synapses, does a second lookup on the * field index. * Note that the index is NOT a @@ -102,7 +102,7 @@ class DataElement: public Element * * Returns 0 if either index is out of range. */ - char* data( unsigned int rawIndex, + char* data( unsigned int rawIndex, unsigned int fieldIndex = 0 ) const; /** @@ -118,8 +118,8 @@ class DataElement: public Element * Changes the number of fields on the specified data entry. * Doesn't do anything for the regular Element. */ - void resizeField( - unsigned int rawIndex, unsigned int newNumField ) + void resizeField( + unsigned int rawIndex, unsigned int newNumField ) {;} ///////////////////////////////////////////////////////////////// @@ -142,7 +142,7 @@ class DataElement: public Element /** * This is the size of the data. Can get from cinfo()->dinfo(), - * but this is called so often than it makes a measurable + * but this is called so often than it makes a measurable * difference. */ unsigned int size_; diff --git a/moose-core/basecode/DestFinfo.cpp b/moose-core/basecode/DestFinfo.cpp index 30a4e943aad61afe31b452a7f8d968e191bcfa2c..b8a497e0dc294488166632ca9a432cbdd4a8561b 100644 --- a/moose-core/basecode/DestFinfo.cpp +++ b/moose-core/basecode/DestFinfo.cpp @@ -14,7 +14,7 @@ DestFinfo::~DestFinfo() { delete func_; } -DestFinfo::DestFinfo( const string& name, const string& doc, +DestFinfo::DestFinfo( const string& name, const string& doc, OpFunc* func ) : Finfo( name, doc ), func_( func ) { @@ -47,15 +47,15 @@ FuncId DestFinfo::getFid() const return fid_; } -bool DestFinfo::strSet( - const Eref& tgt, const string& field, const string& arg ) const +bool DestFinfo::strSet( + const Eref& tgt, const string& field, const string& arg ) const { assert( 0 ); return false; } -bool DestFinfo::strGet( - const Eref& tgt, const string& field, string& returnValue ) const +bool DestFinfo::strGet( + const Eref& tgt, const string& field, string& returnValue ) const { assert( 0 ); return false; diff --git a/moose-core/basecode/DestFinfo.h b/moose-core/basecode/DestFinfo.h index 5804ccc347837dcc352889e85bce27b75e136481..c013a6b25d8e59f109f79b99c30fcff8c20fd141 100644 --- a/moose-core/basecode/DestFinfo.h +++ b/moose-core/basecode/DestFinfo.h @@ -21,11 +21,11 @@ class DestFinfo: public Finfo ~DestFinfo(); DestFinfo( const string& name, const string& doc,OpFunc* func ); void registerFinfo( Cinfo* c ); - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const; - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const; - + const OpFunc* getOpFunc() const; FuncId getFid() const; diff --git a/moose-core/basecode/Dinfo.h b/moose-core/basecode/Dinfo.h index 647d77084771886063693089bc6d34de95cfd924..6e6b8f6f0b518f718c56b241cc0bfc2ad92e5644 100644 --- a/moose-core/basecode/Dinfo.h +++ b/moose-core/basecode/Dinfo.h @@ -26,7 +26,7 @@ class DinfoBase virtual unsigned int sizeIncrement() const = 0; /** - * Return a newly allocated copy of the original data, repeated + * Return a newly allocated copy of the original data, repeated * copyEntries times. Orig data untouched. * Analogous to copying a vector into a bigger one. Repeat the * original data as many times as possible. @@ -36,7 +36,7 @@ class DinfoBase /** * Assigns data contents from 'orig' over to 'copy'. Tiles the - * origEntries onto the copyEntries. So if there are fewer + * origEntries onto the copyEntries. So if there are fewer * origEntries, the orig data contents are repeated till the * copy is full. */ @@ -64,14 +64,14 @@ template< class D > class Dinfo: public DinfoBase : sizeIncrement_( sizeof( D ) ) {;} Dinfo( bool isOneZombie ) - : DinfoBase( isOneZombie ), + : DinfoBase( isOneZombie ), sizeIncrement_( isOneZombie ? 0 : sizeof( D ) ) {;} char* allocData( unsigned int numData ) const { if ( numData == 0 ) return 0; - else + else return reinterpret_cast< char* >( new( nothrow) D[ numData ] ); } @@ -127,7 +127,7 @@ template< class D > class Dinfo: public DinfoBase tgt[i +j] = origData[j]; } // memcpy( data + i * sizeof( D ), orig, sizeof( D ) * numCopies ); - // Memcpy is fast but it does not permit for C++ to do + // Memcpy is fast but it does not permit for C++ to do // various constructor and assignment operations that are // important if D has pointers in it. } diff --git a/moose-core/basecode/ElementValueFinfo.h b/moose-core/basecode/ElementValueFinfo.h index 065a6a890de6c2261023a9dd60c0bbee0624ba5b..834f84e0f8f1b5227dfd1c83445eeeae56ea1cf0 100644 --- a/moose-core/basecode/ElementValueFinfo.h +++ b/moose-core/basecode/ElementValueFinfo.h @@ -13,7 +13,7 @@ /** * This variant of ValueFinfo provides facilities to set and get - * values of fields that require information about the managing Element + * values of fields that require information about the managing Element */ template < class T, class F > class ElementValueFinfo: public ValueFinfoBase { @@ -23,7 +23,7 @@ template < class T, class F > class ElementValueFinfo: public ValueFinfoBase delete get_; } - ElementValueFinfo( const string& name, const string& doc, + ElementValueFinfo( const string& name, const string& doc, void ( T::*setFunc )( const Eref&, F ), F ( T::*getFunc )( const Eref& ) const ) : ValueFinfoBase( name, doc ) @@ -51,14 +51,14 @@ template < class T, class F > class ElementValueFinfo: public ValueFinfoBase c->registerFinfo( get_ ); } - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { return Field< F >::innerStrSet( tgt.objId(), field, arg ); } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { - return Field< F >::innerStrGet( + return Field< F >::innerStrGet( tgt.objId(), field, returnValue ); } @@ -76,7 +76,7 @@ template < class T, class F > class ReadOnlyElementValueFinfo: public ValueFinfo delete get_; } - ReadOnlyElementValueFinfo( const string& name, const string& doc, + ReadOnlyElementValueFinfo( const string& name, const string& doc, F ( T::*getFunc )( const Eref& e ) const ) : ValueFinfoBase( name, doc ) { @@ -94,14 +94,14 @@ template < class T, class F > class ReadOnlyElementValueFinfo: public ValueFinfo c->registerFinfo( get_ ); } - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { return 0; } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { - return Field< F >::innerStrGet( + return Field< F >::innerStrGet( tgt.objId(), field, returnValue ); } diff --git a/moose-core/basecode/EpFunc.h b/moose-core/basecode/EpFunc.h index 55a29799533a5bcc7b34dafb615b803b4bbe8d56..4dae3cd45aa0c0a0e96c6a662f0c541ab30fc5ba 100644 --- a/moose-core/basecode/EpFunc.h +++ b/moose-core/basecode/EpFunc.h @@ -11,7 +11,7 @@ #define _EPFUNC_H /** - * Utility function to return a pointer of the desired type from the + * Utility function to return a pointer of the desired type from the * Eref data. Mainly here because it lets us specialize for Neutrals, * below. */ @@ -22,7 +22,7 @@ template< class T > T* getEpFuncData( const Eref& e ) /** * This is a template specialization for GetEpFunc applied to Neutrals. - * This is necessary in order to access Element fields of objects that + * This is necessary in order to access Element fields of objects that * may not have been allocated (such as synapses), even though their Element * has been created and needs to be manipulated. * Apparently regular functions with same args will be preferred @@ -58,7 +58,7 @@ template< class T > class EpFunc0: public OpFunc0Base } private: - void ( T::*func_ )( const Eref& e ); + void ( T::*func_ )( const Eref& e ); }; template< class T, class A > class EpFunc1: public OpFunc1Base< A > @@ -73,10 +73,10 @@ template< class T, class A > class EpFunc1: public OpFunc1Base< A > } private: - void ( T::*func_ )( const Eref& e, A ); + void ( T::*func_ )( const Eref& e, A ); }; -template< class T, class A1, class A2 > class EpFunc2: +template< class T, class A1, class A2 > class EpFunc2: public OpFunc2Base< A1, A2 > { public: @@ -89,7 +89,7 @@ template< class T, class A1, class A2 > class EpFunc2: } private: - void ( T::*func_ )( const Eref& e, A1, A2 ); + void ( T::*func_ )( const Eref& e, A1, A2 ); }; template< class T, class A1, class A2, class A3 > class EpFunc3: @@ -101,12 +101,12 @@ template< class T, class A1, class A2, class A3 > class EpFunc3: {;} void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3 ) const { - ( reinterpret_cast< T* >( e.data() )->*func_ )( + ( reinterpret_cast< T* >( e.data() )->*func_ )( e, arg1, arg2, arg3 ); } private: - void ( T::*func_ )( const Eref& e, A1, A2, A3 ); + void ( T::*func_ )( const Eref& e, A1, A2, A3 ); }; template< class T, class A1, class A2, class A3, class A4 > class EpFunc4: @@ -118,15 +118,15 @@ template< class T, class A1, class A2, class A3, class A4 > class EpFunc4: {;} void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4 ) const { - ( reinterpret_cast< T* >( e.data() )->*func_ )( + ( reinterpret_cast< T* >( e.data() )->*func_ )( e, arg1, arg2, arg3, arg4 ); } private: - void ( T::*func_ )( const Eref& e, A1, A2, A3, A4 ); + void ( T::*func_ )( const Eref& e, A1, A2, A3, A4 ); }; -template< class T, class A1, class A2, class A3, class A4, class A5 > +template< class T, class A1, class A2, class A3, class A4, class A5 > class EpFunc5: public OpFunc5Base< A1, A2, A3, A4, A5 > { public: @@ -134,17 +134,17 @@ template< class T, class A1, class A2, class A3, class A4, class A5 > : func_( func ) {;} - void op( const Eref& e, + void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5 ) const { - ( reinterpret_cast< T* >( e.data() )->*func_ )( + ( reinterpret_cast< T* >( e.data() )->*func_ )( e, arg1, arg2, arg3, arg4, arg5 ); } private: - void ( T::*func_ )( const Eref& e, A1, A2, A3, A4, A5 ); + void ( T::*func_ )( const Eref& e, A1, A2, A3, A4, A5 ); }; -template< class T, - class A1, class A2, class A3, class A4, class A5, class A6 > +template< class T, + class A1, class A2, class A3, class A4, class A5, class A6 > class EpFunc6: public OpFunc6Base< A1, A2, A3, A4, A5, A6 > { public: @@ -152,15 +152,15 @@ template< class T, : func_( func ) {;} - void op( const Eref& e, + void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5, A6 arg6 ) const { - ( reinterpret_cast< T* >( e.data() )->*func_ )( + ( reinterpret_cast< T* >( e.data() )->*func_ )( e, arg1, arg2, arg3, arg4, arg5, arg6 ); } private: - void ( T::*func_ )( const Eref& e, A1, A2, A3, A4, A5, A6 ); + void ( T::*func_ )( const Eref& e, A1, A2, A3, A4, A5, A6 ); }; /** @@ -209,7 +209,7 @@ template< class T, class A > class GetEpFunc: public GetOpFuncBase< A > * FuncId of the function on the object that requested the * value. The EpFunc then sends back a message with the info. */ -template< class T, class L, class A > class GetEpFunc1: +template< class T, class L, class A > class GetEpFunc1: public LookupGetOpFuncBase< L, A > { public: @@ -218,7 +218,7 @@ template< class T, class L, class A > class GetEpFunc1: {;} - void op( const Eref& e, L index, ObjId recipient, FuncId fid ) + void op( const Eref& e, L index, ObjId recipient, FuncId fid ) const { const OpFunc *f = recipient.element()->cinfo()->getOpFunc( fid); const OpFunc1Base< A >* recvOpFunc = @@ -228,7 +228,7 @@ template< class T, class L, class A > class GetEpFunc1: } A returnOp( const Eref& e, const L& index ) const { - return ( reinterpret_cast< T* >( e.data() )->*func_)( + return ( reinterpret_cast< T* >( e.data() )->*func_)( e, index ); } diff --git a/moose-core/basecode/FieldElement.h b/moose-core/basecode/FieldElement.h index 7cfd8d425b4b25efeddfd37e19331ae8a4aa6e01..02a137ed75ecd29d8fa1c650e3cd5741bd5c4184 100644 --- a/moose-core/basecode/FieldElement.h +++ b/moose-core/basecode/FieldElement.h @@ -11,7 +11,7 @@ /** * Specialization of Element class, used to look up array fields within - * objects when those fields each need to have independent Element + * objects when those fields each need to have independent Element * capabilies such as messaging and subfield lookup. * Made automatically by Elements which have such fields. */ @@ -24,10 +24,10 @@ class FieldElement: public Element ~FieldElement(); - /** + /** * Virtual copier. Makes a copy of self. */ - Element* copyElement( Id newParent, Id newId, unsigned int n, + Element* copyElement( Id newParent, Id newId, unsigned int n, bool toGlobal ) const; ///////////////////////////////////////////////////////////////// @@ -77,8 +77,8 @@ class FieldElement: public Element * virtual. * Looks up specified field field entry. First it finds the * appropriate data entry from the rawIndex. Then it looks up - * the field using the lookupField. - * Returns the data entry specified by the rawIndex, fieldIndex. + * the field using the lookupField. + * Returns the data entry specified by the rawIndex, fieldIndex. * * Note that the index is NOT a * DataIndex: it is instead the raw index of the data on the current @@ -90,7 +90,7 @@ class FieldElement: public Element * * Returns 0 if either index is out of range. */ - char* data( unsigned int rawIndex, + char* data( unsigned int rawIndex, unsigned int fieldIndex = 0 ) const; /** @@ -104,11 +104,11 @@ class FieldElement: public Element * virtual. * Changes the number of fields on the specified data entry. */ - void resizeField( + void resizeField( unsigned int rawIndex, unsigned int newNumField ); /** - * Virtual: after replacing Cinfo of parent, we need to + * Virtual: after replacing Cinfo of parent, we need to * replace Cinfo and fef here. The zCinfo is the new Cinfo for this * FieldElement. */ diff --git a/moose-core/basecode/FieldElementFinfo.cpp b/moose-core/basecode/FieldElementFinfo.cpp index 0301252cc4c764b9a887a660ec3eec6795a642d0..0ada63b663a9aac410e45e19a8d980e7b4c875cd 100644 --- a/moose-core/basecode/FieldElementFinfo.cpp +++ b/moose-core/basecode/FieldElementFinfo.cpp @@ -11,7 +11,7 @@ #include "../shell/Shell.h" #include "../msg/OneToOneDataIndexMsg.h" -void FieldElementFinfoBase::postCreationFunc( +void FieldElementFinfoBase::postCreationFunc( Id parent, Element* parentElm ) const { static const Finfo* pf = Neutral::initCinfo()->findFinfo( "parentMsg" ); diff --git a/moose-core/basecode/FuncOrder.h b/moose-core/basecode/FuncOrder.h index cea47dee2a5d93a580eb428aebb4c432b56c0202..088b2f1fcd1dbcf676483cf924590362cf317728 100644 --- a/moose-core/basecode/FuncOrder.h +++ b/moose-core/basecode/FuncOrder.h @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ /** - * Utility function for sorting by function pointer. + * Utility function for sorting by function pointer. * Used in Element::msgDigest */ diff --git a/moose-core/basecode/GlobalDataElement.cpp b/moose-core/basecode/GlobalDataElement.cpp index 47d025f8a4ff02178f398f7361636edde2fc1134..abbae3cf9bf82e56a224d13a8d11ccd5ce1d2426 100644 --- a/moose-core/basecode/GlobalDataElement.cpp +++ b/moose-core/basecode/GlobalDataElement.cpp @@ -11,9 +11,9 @@ #include "FuncOrder.h" #include "../shell/Shell.h" -GlobalDataElement::GlobalDataElement( Id id, const Cinfo* c, +GlobalDataElement::GlobalDataElement( Id id, const Cinfo* c, const string& name, unsigned int numData ) - : + : DataElement( id, c, name, numData ) {;} @@ -25,9 +25,9 @@ GlobalDataElement::GlobalDataElement( Id id, const Cinfo* c, * retain info from the originals. * Note that n is the number of individual dataEntries that are made. */ -GlobalDataElement::GlobalDataElement( Id id, const Element* orig, +GlobalDataElement::GlobalDataElement( Id id, const Element* orig, unsigned int n ) - : + : DataElement( id, orig, n, 0 ) {;} @@ -35,12 +35,12 @@ GlobalDataElement::GlobalDataElement( Id id, const Element* orig, GlobalDataElement::~GlobalDataElement() {;} -Element* GlobalDataElement::copyElement( +Element* GlobalDataElement::copyElement( Id newParent, Id newId, unsigned int n, bool toGlobal ) const { if ( toGlobal ) return new GlobalDataElement( newId, this, n ); - else + else return new LocalDataElement( newId, this, n ); } diff --git a/moose-core/basecode/GlobalDataElement.h b/moose-core/basecode/GlobalDataElement.h index 3771b971361adbc8bb45c60ab2e315d95fd71288..02e560b9199e26a804b72f468b6aafd7d92d5658 100644 --- a/moose-core/basecode/GlobalDataElement.h +++ b/moose-core/basecode/GlobalDataElement.h @@ -30,7 +30,7 @@ class GlobalDataElement: public DataElement * name is its name * numData is the number of data entries, defaults to a singleton. * The isGlobal flag specifies whether the created objects should - * be replicated on all nodes, or partitioned without replication. + * be replicated on all nodes, or partitioned without replication. */ GlobalDataElement( Id id, const Cinfo* c, const string& name, unsigned int numData = 1 ); @@ -46,10 +46,10 @@ class GlobalDataElement: public DataElement */ ~GlobalDataElement(); - /** + /** * Virtual copier. Makes a copy of self. */ - Element* copyElement( Id newParent, Id newId, unsigned int n, + Element* copyElement( Id newParent, Id newId, unsigned int n, bool toGlobal ) const; ///////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ class GlobalDataElement: public DataElement /// Inherited virtual. Returns node location of specified object unsigned int getNode( unsigned int dataIndex ) const; - /// Inherited virtual. Returns start dataIndex on specified node + /// Inherited virtual. Returns start dataIndex on specified node unsigned int startDataIndex( unsigned int node ) const { return 0; diff --git a/moose-core/basecode/HopFunc.cpp b/moose-core/basecode/HopFunc.cpp index 669d2348b1ed9dee0bf10a764263205a584f1273..6d0e6799c33930c40f395f8f2c3ebf08afafb577 100644 --- a/moose-core/basecode/HopFunc.cpp +++ b/moose-core/basecode/HopFunc.cpp @@ -12,7 +12,7 @@ #include "../shell/Shell.h" static double testBuf[4096]; -static double* addToTestBuf( const Eref& e, unsigned int i, +static double* addToTestBuf( const Eref& e, unsigned int i, unsigned int size ) { TgtInfo* tgt = reinterpret_cast< TgtInfo* >( &testBuf[0] ); @@ -35,7 +35,7 @@ double* addToBuf( const Eref& er, HopIndex hopIndex, unsigned int size ) } else if ( hopIndex.hopType() == MooseSetHop || hopIndex.hopType() == MooseSetVecHop ) { p->clearPendingSetGet(); // Cannot touch set buffer if pending. - return p->addToSetBuf( er, hopIndex.bindIndex(), + return p->addToSetBuf( er, hopIndex.bindIndex(), size, hopIndex.hopType() ); } else if ( hopIndex.hopType() == MooseTestHop ) { return addToTestBuf( er, hopIndex.bindIndex(), size ); @@ -50,7 +50,7 @@ void dispatchBuffers( const Eref& e, HopIndex hopIndex ) static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() ); if ( Shell::numNodes() == 1 ) return; - if ( hopIndex.hopType() == MooseSetHop || + if ( hopIndex.hopType() == MooseSetHop || hopIndex.hopType() == MooseGetHop ) { p->dispatchSetBuf( e ); } @@ -67,8 +67,8 @@ double* remoteGet( const Eref& e, unsigned int bindIndex ) return p->remoteGet( e, bindIndex ); } -void remoteGetVec( const Eref& e, unsigned int bindIndex, - vector< vector< double > >& getRecvBuf, +void remoteGetVec( const Eref& e, unsigned int bindIndex, + vector< vector< double > >& getRecvBuf, vector< unsigned int >& numOnNode ) { static ObjId oi( 3 ); @@ -76,8 +76,8 @@ void remoteGetVec( const Eref& e, unsigned int bindIndex, p->remoteGetVec( e, bindIndex, getRecvBuf, numOnNode ); } -void remoteFieldGetVec( const Eref& e, unsigned int bindIndex, - vector< double >& getRecvBuf ) +void remoteFieldGetVec( const Eref& e, unsigned int bindIndex, + vector< double >& getRecvBuf ) { static ObjId oi( 3 ); static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() ); diff --git a/moose-core/basecode/HopFunc.h b/moose-core/basecode/HopFunc.h index 0cc7ef31c3ffa51c3e01da849e2bd43fe362cecb..99f47efe90dec12de1b32367fcc70ffbd2bba1f2 100644 --- a/moose-core/basecode/HopFunc.h +++ b/moose-core/basecode/HopFunc.h @@ -10,15 +10,15 @@ #ifndef _HOP_FUNC_H #define _HOP_FUNC_H -double* addToBuf( +double* addToBuf( const Eref& e, HopIndex hopIndex, unsigned int size ); void dispatchBuffers( const Eref& e, HopIndex hopIndex ); double* remoteGet( const Eref& e , unsigned int bindIndex ); -void remoteGetVec( const Eref& e, unsigned int bindIndex, - vector< vector< double > >& getRecvBuf, +void remoteGetVec( const Eref& e, unsigned int bindIndex, + vector< vector< double > >& getRecvBuf, vector< unsigned int >& numOnNode ); -void remoteFieldGetVec( const Eref& e, unsigned int bindIndex, - vector< double >& getRecvBuf ); +void remoteFieldGetVec( const Eref& e, unsigned int bindIndex, + vector< double >& getRecvBuf ); unsigned int mooseNumNodes(); unsigned int mooseMyNode(); @@ -56,7 +56,7 @@ template < class A > class HopFunc1: public OpFunc1Base< A > } /// Executes the local vector assignment. Returns current arg index - unsigned int localOpVec( Element* elm, + unsigned int localOpVec( Element* elm, const vector< A >& arg, const OpFunc1Base< A >* op, unsigned int k ) const @@ -75,7 +75,7 @@ template < class A > class HopFunc1: public OpFunc1Base< A > } /// Executes the local vector assignment. Returns number of entries - unsigned int localFieldOpVec( const Eref& er, + unsigned int localFieldOpVec( const Eref& er, const vector< A >& arg, const OpFunc1Base< A >* op ) const @@ -83,7 +83,7 @@ template < class A > class HopFunc1: public OpFunc1Base< A > assert( er.getNode() == mooseMyNode() ); unsigned int di = er.dataIndex(); Element* elm = er.element(); - unsigned int numField = + unsigned int numField = elm->numField( di - er.element()->localDataStart() ); for ( unsigned int q = 0; q < numField; ++q ) { Eref temp( elm, di, q ); @@ -93,7 +93,7 @@ template < class A > class HopFunc1: public OpFunc1Base< A > } /// Dispatches remote vector assignment. start and end are arg index - unsigned int remoteOpVec( const Eref& er, + unsigned int remoteOpVec( const Eref& er, const vector< A >& arg, const OpFunc1Base< A >* op, unsigned int start, unsigned int end ) const @@ -101,7 +101,7 @@ template < class A > class HopFunc1: public OpFunc1Base< A > unsigned int k = start; unsigned int nn = end - start; if ( mooseNumNodes() > 1 && nn > 0 ) { - // nn includes dataIndices. FieldIndices are handled by + // nn includes dataIndices. FieldIndices are handled by // other functions. vector< A > temp( nn ); // Have to do the insertion entry by entry because the @@ -111,10 +111,10 @@ template < class A > class HopFunc1: public OpFunc1Base< A > temp[j] = arg[x]; k++; } - double* buf = addToBuf( er, hopIndex_, + double* buf = addToBuf( er, hopIndex_, Conv< vector< A > >::size( temp ) ); Conv< vector< A > >::val2buf( temp, &buf ); - dispatchBuffers( er, hopIndex_ ); + dispatchBuffers( er, hopIndex_ ); // HopIndex says that it is a SetVec call. } return k; @@ -157,7 +157,7 @@ template < class A > class HopFunc1: public OpFunc1Base< A > const OpFunc1Base< A >* op ) const { Element* elm = er.element(); - if ( elm->hasFields() ) { + if ( elm->hasFields() ) { if ( er.getNode() == mooseMyNode() ) { // True for globals as well as regular objects on current node localFieldOpVec( er, arg, op ); @@ -176,10 +176,10 @@ template < class A > class HopFunc1: public OpFunc1Base< A > }; /** - * Deferred specification of function from OpFunc1Base, so it is after + * Deferred specification of function from OpFunc1Base, so it is after * the declaration of the HopFunc class to which it refers. */ -template< class A > +template< class A > const OpFunc* OpFunc1Base< A >::makeHopFunc( HopIndex hopIndex ) const { return new HopFunc1< A >( hopIndex ); @@ -196,7 +196,7 @@ template < class A1, class A2 > class HopFunc2: public OpFunc2Base< A1, A2 > {;} void op( const Eref& e, A1 arg1, A2 arg2 ) const { - double* buf = addToBuf( e, hopIndex_, + double* buf = addToBuf( e, hopIndex_, Conv< A1 >::size( arg1 ) + Conv< A2 >::size( arg2 ) ); /* Conv< A1 >::val2buf( arg1, buf ); @@ -204,14 +204,14 @@ template < class A1, class A2 > class HopFunc2: public OpFunc2Base< A1, A2 > or buf = Conv< A1 >.val2buf( arg1, buf ); Conv< A2 >::val2buf( arg2, buf ); - or + or */ Conv< A1 >::val2buf( arg1, &buf ); Conv< A2 >::val2buf( arg2, &buf ); dispatchBuffers( e, hopIndex_ ); } - void opVec( const Eref& e, + void opVec( const Eref& e, const vector< A1 >& arg1, const vector< A1 >& arg2, const OpFunc2Base< A1, A2 >* op ) const @@ -251,12 +251,12 @@ template < class A1, class A2 > class HopFunc2: public OpFunc2Base< A1, A2 > temp2[j] = arg2[y]; k++; } - double* buf = addToBuf( e, hopIndex_, + double* buf = addToBuf( e, hopIndex_, Conv< vector< A1 > >::size( temp1 ) + Conv< vector< A2 > >::size( temp2 ) ); Conv< vector< A1 > >::val2buf( temp1, &buf ); Conv< vector< A2 > >::val2buf( temp2, &buf ); - dispatchBuffers( Eref( elm, dataIndex ), hopIndex_ ); + dispatchBuffers( Eref( elm, dataIndex ), hopIndex_ ); // HopIndex says that it is a SetVec call. } } @@ -265,15 +265,15 @@ template < class A1, class A2 > class HopFunc2: public OpFunc2Base< A1, A2 > HopIndex hopIndex_; }; -template< class A1, class A2 > -const OpFunc* OpFunc2Base< A1, A2 >::makeHopFunc( - HopIndex hopIndex) const +template< class A1, class A2 > +const OpFunc* OpFunc2Base< A1, A2 >::makeHopFunc( + HopIndex hopIndex) const { return new HopFunc2< A1, A2 >( hopIndex ); } // Function to hop across nodes, with three arguments. -template < class A1, class A2, class A3 > class HopFunc3: +template < class A1, class A2, class A3 > class HopFunc3: public OpFunc3Base< A1, A2, A3 > { public: @@ -283,7 +283,7 @@ template < class A1, class A2, class A3 > class HopFunc3: void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3 ) const { - double* buf = addToBuf( e, hopIndex_, + double* buf = addToBuf( e, hopIndex_, Conv< A1 >::size( arg1 ) + Conv< A2 >::size( arg2 ) + Conv< A3 >::size( arg3 ) ); Conv< A1 >::val2buf( arg1, &buf ); @@ -295,15 +295,15 @@ template < class A1, class A2, class A3 > class HopFunc3: HopIndex hopIndex_; }; -template< class A1, class A2, class A3 > -const OpFunc* OpFunc3Base< A1, A2, A3 >::makeHopFunc( - HopIndex hopIndex) const +template< class A1, class A2, class A3 > +const OpFunc* OpFunc3Base< A1, A2, A3 >::makeHopFunc( + HopIndex hopIndex) const { return new HopFunc3< A1, A2, A3 >( hopIndex ); } // Function to hop across nodes, with three arguments. -template < class A1, class A2, class A3, class A4 > class HopFunc4: +template < class A1, class A2, class A3, class A4 > class HopFunc4: public OpFunc4Base< A1, A2, A3, A4 > { public: @@ -313,7 +313,7 @@ template < class A1, class A2, class A3, class A4 > class HopFunc4: void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4 ) const { - double* buf = addToBuf( e, hopIndex_, + double* buf = addToBuf( e, hopIndex_, Conv< A1 >::size( arg1 ) + Conv< A2 >::size( arg2 ) + Conv< A3 >::size( arg3 ) + Conv< A4 >::size( arg4 ) ); Conv< A1 >::val2buf( arg1, &buf ); @@ -326,9 +326,9 @@ template < class A1, class A2, class A3, class A4 > class HopFunc4: HopIndex hopIndex_; }; -template< class A1, class A2, class A3, class A4 > -const OpFunc* OpFunc4Base< A1, A2, A3, A4 >::makeHopFunc( - HopIndex hopIndex) const +template< class A1, class A2, class A3, class A4 > +const OpFunc* OpFunc4Base< A1, A2, A3, A4 >::makeHopFunc( + HopIndex hopIndex) const { return new HopFunc4< A1, A2, A3, A4 >( hopIndex ); } @@ -342,10 +342,10 @@ template < class A1, class A2, class A3, class A4, class A5 > : hopIndex_( hopIndex ) {;} - void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, + void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5 ) const { - double* buf = addToBuf( e, hopIndex_, + double* buf = addToBuf( e, hopIndex_, Conv< A1 >::size( arg1 ) + Conv< A2 >::size( arg2 ) + Conv< A3 >::size( arg3 ) + Conv< A4 >::size( arg4 ) + Conv< A5 >::size( arg5 ) ); @@ -360,9 +360,9 @@ template < class A1, class A2, class A3, class A4, class A5 > HopIndex hopIndex_; }; -template< class A1, class A2, class A3, class A4, class A5 > -const OpFunc* OpFunc5Base< A1, A2, A3, A4, A5 >::makeHopFunc( - HopIndex hopIndex) const +template< class A1, class A2, class A3, class A4, class A5 > +const OpFunc* OpFunc5Base< A1, A2, A3, A4, A5 >::makeHopFunc( + HopIndex hopIndex) const { return new HopFunc5< A1, A2, A3, A4, A5 >( hopIndex ); } @@ -376,10 +376,10 @@ template < class A1, class A2, class A3, class A4, class A5, class A6 > : hopIndex_( hopIndex ) {;} - void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, + void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5, A6 arg6 ) const { - double* buf = addToBuf( e, hopIndex_, + double* buf = addToBuf( e, hopIndex_, Conv< A1 >::size( arg1 ) + Conv< A2 >::size( arg2 ) + Conv< A3 >::size( arg3 ) + Conv< A4 >::size( arg4 ) + Conv< A5 >::size( arg5 ) + Conv< A6 >::size( arg6 ) ); @@ -395,9 +395,9 @@ template < class A1, class A2, class A3, class A4, class A5, class A6 > HopIndex hopIndex_; }; -template< class A1, class A2, class A3, class A4, class A5, class A6 > -const OpFunc* OpFunc6Base< A1, A2, A3, A4, A5, A6 >::makeHopFunc( - HopIndex hopIndex) const +template< class A1, class A2, class A3, class A4, class A5, class A6 > +const OpFunc* OpFunc6Base< A1, A2, A3, A4, A5, A6 >::makeHopFunc( + HopIndex hopIndex) const { return new HopFunc6< A1, A2, A3, A4, A5, A6 >( hopIndex ); } @@ -417,12 +417,12 @@ template < class A > class GetHopFunc: public OpFunc1Base< A* > *ret = Conv< A >::buf2val( &buf ); } - void getLocalFieldVec( const Eref& er, vector< A >& ret, + void getLocalFieldVec( const Eref& er, vector< A >& ret, const GetOpFuncBase< A >* op ) const { unsigned int p = er.dataIndex(); Element* elm = er.element(); - unsigned int numField = elm->numField( + unsigned int numField = elm->numField( p - elm->localDataStart() ); for ( unsigned int q = 0; q < numField; ++q ) { Eref temp( elm, p, q ); @@ -430,7 +430,7 @@ template < class A > class GetHopFunc: public OpFunc1Base< A* > } } - void getRemoteFieldVec( const Eref& e, vector< A >& ret, + void getRemoteFieldVec( const Eref& e, vector< A >& ret, const GetOpFuncBase< A >* op ) const { vector< double > buf; @@ -443,7 +443,7 @@ template < class A > class GetHopFunc: public OpFunc1Base< A* > } } - void getLocalVec( Element *elm, vector< A >& ret, + void getLocalVec( Element *elm, vector< A >& ret, const GetOpFuncBase< A >* op ) const { unsigned int start = elm->localDataStart(); @@ -454,7 +454,7 @@ template < class A > class GetHopFunc: public OpFunc1Base< A* > } } - void getMultiNodeVec( const Eref& e, vector< A >& ret, + void getMultiNodeVec( const Eref& e, vector< A >& ret, const GetOpFuncBase< A >* op ) const { Element* elm = e.element(); @@ -481,7 +481,7 @@ template < class A > class GetHopFunc: public OpFunc1Base< A* > } } - void opGetVec( const Eref& e, vector< A >& ret, + void opGetVec( const Eref& e, vector< A >& ret, const GetOpFuncBase< A >* op ) const { Element* elm = e.element(); @@ -506,10 +506,10 @@ template < class A > class GetHopFunc: public OpFunc1Base< A* > }; /** - * Deferred specification of function from OpFunc1Base, so it is after + * Deferred specification of function from OpFunc1Base, so it is after * the declaration of the HopFunc class to which it refers. */ -template< class A > +template< class A > const OpFunc* GetOpFuncBase< A >::makeHopFunc( HopIndex hopIndex ) const { return new GetHopFunc< A >( hopIndex ); diff --git a/moose-core/basecode/LocalDataElement.cpp b/moose-core/basecode/LocalDataElement.cpp index 8de0bb2812d943342edbabe55970f35b98559f7e..cc2a548b62aa4344e10d8e479142fd9dc0bcddc6 100644 --- a/moose-core/basecode/LocalDataElement.cpp +++ b/moose-core/basecode/LocalDataElement.cpp @@ -11,9 +11,9 @@ #include "FuncOrder.h" #include "../shell/Shell.h" -LocalDataElement::LocalDataElement( Id id, const Cinfo* c, +LocalDataElement::LocalDataElement( Id id, const Cinfo* c, const string& name, unsigned int numData ) - : + : DataElement( id, c, name, setDataSize( numData ) ) {;} @@ -25,10 +25,10 @@ LocalDataElement::LocalDataElement( Id id, const Cinfo* c, * retain info from the originals. * n is the number of new entries made. */ -LocalDataElement::LocalDataElement( Id id, const Element* orig, +LocalDataElement::LocalDataElement( Id id, const Element* orig, unsigned int n ) - : - DataElement( id, orig, setDataSize( n ), + : + DataElement( id, orig, setDataSize( n ), ( 1 + (n - 1 ) / Shell::numNodes() ) * Shell::myNode() ) {;} @@ -38,7 +38,7 @@ LocalDataElement::~LocalDataElement() // This is somewhat problematic to do as a low-level function. Will need // to look up all other nodes to get their conent -Element* LocalDataElement::copyElement( Id newParent, Id newId, +Element* LocalDataElement::copyElement( Id newParent, Id newId, unsigned int n, bool toGlobal ) const { if ( toGlobal ) { @@ -81,7 +81,7 @@ unsigned int LocalDataElement::getNode( unsigned int dataId ) const { return dataId / numPerNode_; } -/// Inherited virtual. Returns start DataId on specified node +/// Inherited virtual. Returns start DataId on specified node unsigned int LocalDataElement::startDataIndex( unsigned int node ) const { if ( numPerNode_ * node < numData_ ) @@ -115,7 +115,7 @@ unsigned int LocalDataElement::setDataSize( unsigned int numData ) // virtual func, overridden. void LocalDataElement::resize( unsigned int newNumData ) { - DataElement::resize( setDataSize( newNumData ) ); + DataElement::resize( setDataSize( newNumData ) ); } unsigned int LocalDataElement::getNumOnNode( unsigned int node ) const diff --git a/moose-core/basecode/LocalDataElement.h b/moose-core/basecode/LocalDataElement.h index 3f9ea4c4d9ab4a49e63876bc48013f4e3b3a7b33..d52609458014d0de467bd16d2cc806794525faf2 100644 --- a/moose-core/basecode/LocalDataElement.h +++ b/moose-core/basecode/LocalDataElement.h @@ -43,10 +43,10 @@ class LocalDataElement: public DataElement */ ~LocalDataElement(); - /** + /** * Virtual copier. Makes a copy of self. */ - Element* copyElement( Id newParent, Id newId, unsigned int n, + Element* copyElement( Id newParent, Id newId, unsigned int n, bool toGlobal ) const; ///////////////////////////////////////////////////////////////// @@ -62,9 +62,9 @@ class LocalDataElement: public DataElement /// Inherited virtual. Returns node location of specified object unsigned int getNode( unsigned int dataId ) const; - /// Inherited virtual. Returns start DataIndex on specified node + /// Inherited virtual. Returns start DataIndex on specified node unsigned int startDataIndex( unsigned int node ) const; - + /// Converts dataId to index on current node. unsigned int rawIndex( unsigned int dataId ) const; @@ -102,7 +102,7 @@ class LocalDataElement: public DataElement private: /** * This is the total number of data entries on this Element, in - * the entire simulation. Note that these + * the entire simulation. Note that these * entries do not have to be on this node, some may be farmed out * to other nodes. */ diff --git a/moose-core/basecode/LookupElementValueFinfo.h b/moose-core/basecode/LookupElementValueFinfo.h index 83805bc4f4d977e6269982dfd6f056c11f9aad0c..e94f74169fc0fa34f525eec6591a88acc036bc70 100644 --- a/moose-core/basecode/LookupElementValueFinfo.h +++ b/moose-core/basecode/LookupElementValueFinfo.h @@ -24,7 +24,7 @@ template < class T, class L, class F > class LookupElementValueFinfo: public Loo delete get_; } - LookupElementValueFinfo( const string& name, const string& doc, + LookupElementValueFinfo( const string& name, const string& doc, void ( T::*setFunc )( const Eref&, L, F ), F ( T::*getFunc )( const Eref&, L ) const ) : LookupValueFinfoBase( name, doc ) @@ -51,19 +51,19 @@ template < class T, class L, class F > class LookupElementValueFinfo: public Loo c->registerFinfo( get_ ); } - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { string fieldPart = field.substr( 0, field.find( "[" ) ); string indexPart = field.substr( field.find( "[" ) + 1, field.find( "]" ) ); - return LookupField< L, F >::innerStrSet( + return LookupField< L, F >::innerStrSet( tgt.objId(), fieldPart, indexPart, arg ); } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { string fieldPart = field.substr( 0, field.find( "[" ) ); string indexPart = field.substr( field.find( "[" ) + 1, field.find( "]" ) ); - return LookupField< L, F >::innerStrGet( + return LookupField< L, F >::innerStrGet( tgt.objId(), fieldPart, indexPart, returnValue ); } @@ -76,7 +76,7 @@ template < class T, class L, class F > class LookupElementValueFinfo: public Loo DestFinfo* get_; }; -template < class T, class L, class F > +template < class T, class L, class F > class ReadOnlyLookupElementValueFinfo: public LookupValueFinfoBase { public: @@ -84,8 +84,8 @@ template < class T, class L, class F > delete get_; } - ReadOnlyLookupElementValueFinfo( - const string& name, const string& doc, + ReadOnlyLookupElementValueFinfo( + const string& name, const string& doc, F ( T::*getFunc )( const Eref& e, L ) const ) : LookupValueFinfoBase( name, doc ) { @@ -103,16 +103,16 @@ template < class T, class L, class F > c->registerFinfo( get_ ); } - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { return 0; } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { string fieldPart = field.substr( 0, field.find( "[" ) ); string indexPart = field.substr( field.find( "[" ) + 1, field.find( "]" ) ); - return LookupField< L, F >::innerStrGet( + return LookupField< L, F >::innerStrGet( tgt.objId(), fieldPart, indexPart, returnValue ); } diff --git a/moose-core/basecode/LookupValueFinfo.h b/moose-core/basecode/LookupValueFinfo.h index 429dbdb4d242b885fcc2151d74d2afc3a85a1d8d..12b2403e0414d0c05f72b6998ef5e0c1731b773e 100644 --- a/moose-core/basecode/LookupValueFinfo.h +++ b/moose-core/basecode/LookupValueFinfo.h @@ -39,7 +39,7 @@ template < class T, class L, class F > class LookupValueFinfo: public LookupValu delete get_; } - LookupValueFinfo( const string& name, const string& doc, + LookupValueFinfo( const string& name, const string& doc, void ( T::*setFunc )( L, F ), F ( T::*getFunc )( L ) const ) : LookupValueFinfoBase( name, doc ) @@ -66,19 +66,19 @@ template < class T, class L, class F > class LookupValueFinfo: public LookupValu c->registerFinfo( get_ ); } - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { string fieldPart = field.substr( 0, field.find( "[" ) ); string indexPart = field.substr( field.find( "[" ) + 1, field.find( "]" ) ); - return LookupField< L, F >::innerStrSet( + return LookupField< L, F >::innerStrSet( tgt.objId(), fieldPart, indexPart, arg ); } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { string fieldPart = field.substr( 0, field.find( "[" ) ); string indexPart = field.substr( field.find( "[" ) + 1, field.find( "]" ) ); - return LookupField< L, F >::innerStrGet( tgt.objId(), + return LookupField< L, F >::innerStrGet( tgt.objId(), fieldPart, indexPart, returnValue ); } @@ -98,7 +98,7 @@ template < class T, class L, class F > class ReadOnlyLookupValueFinfo: public Lo delete get_; } - ReadOnlyLookupValueFinfo( const string& name, const string& doc, + ReadOnlyLookupValueFinfo( const string& name, const string& doc, F ( T::*getFunc )( L ) const ) : LookupValueFinfoBase( name, doc ) { @@ -116,16 +116,16 @@ template < class T, class L, class F > class ReadOnlyLookupValueFinfo: public Lo c->registerFinfo( get_ ); } - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { return 0; } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { string fieldPart = field.substr( 0, field.find( "[" ) ); string indexPart = field.substr( field.find( "[" ) + 1, field.find( "]" ) ); - return LookupField< L, F >::innerStrGet( tgt.objId(), + return LookupField< L, F >::innerStrGet( tgt.objId(), fieldPart, indexPart, returnValue ); } diff --git a/moose-core/basecode/MsgElement.h b/moose-core/basecode/MsgElement.h index 1d71e27ed35c4b4fd976f22715a5c7338d92cec0..30885d645d50301290f75cd5f9dff79f4e2badd2 100644 --- a/moose-core/basecode/MsgElement.h +++ b/moose-core/basecode/MsgElement.h @@ -29,13 +29,13 @@ class MsgElement: public Element * name is its name */ MsgElement( Id id, const Cinfo* c, const string& name, - unsigned int( *numMsg )(), + unsigned int( *numMsg )(), char* ( *lookupMsg )( unsigned int ) ) - : + : Element( id, c, name ), numMsg_( numMsg ), lookupMsg_( lookupMsg ) - {;} + {;} /** * Virtual Destructor. Nothing to do here. @@ -43,12 +43,12 @@ class MsgElement: public Element ~MsgElement() {;} - /** + /** * Virtual copier. Doesn't do anything. The copy * happens at the lower level, involving the Msg classes * and the MsgElement just manages them. */ - Element* copyElement( Id newParent, Id newId, unsigned int n, + Element* copyElement( Id newParent, Id newId, unsigned int n, bool toGlobal ) const { return 0; @@ -107,7 +107,7 @@ class MsgElement: public Element /** * Inherited virtual - * True if this is a FieldElement having an array of fields + * True if this is a FieldElement having an array of fields * on each data entry. Clearly not true for the MsgElement. */ bool hasFields() const { @@ -129,7 +129,7 @@ class MsgElement: public Element /** * Inherited virtual. * Looks up specified field data entry. On regular objects just - * returns the data entry specified by the rawIndex. + * returns the data entry specified by the rawIndex. * On FieldElements like synapses, does a second lookup on the * field index. * Note that the index is NOT a @@ -142,7 +142,7 @@ class MsgElement: public Element * * Returns 0 if either index is out of range. */ - char* data( unsigned int rawIndex, + char* data( unsigned int rawIndex, unsigned int fieldIndex = 0 ) const { return lookupMsg_( rawIndex ); @@ -166,7 +166,7 @@ class MsgElement: public Element ///////////////////////////////////////////////////////////////// /** - * Virtual func. The parent does the data swap part, so here it is + * Virtual func. The parent does the data swap part, so here it is * just the Cinfo we replace. */ void zombieSwap( const Cinfo* newCinfo ) { diff --git a/moose-core/basecode/MsgFuncBinding.h b/moose-core/basecode/MsgFuncBinding.h index 631d6d1b460a8946012577a63ad87055660f8cf3..03e96b9fabcf641af10994b7f3ee5f4ac9836d1f 100644 --- a/moose-core/basecode/MsgFuncBinding.h +++ b/moose-core/basecode/MsgFuncBinding.h @@ -27,6 +27,6 @@ class MsgFuncBinding ObjId mid; FuncId fid; - + private: }; diff --git a/moose-core/basecode/ObjId.cpp b/moose-core/basecode/ObjId.cpp index 4f67980d6b4398d92fa9bc90a69e906e65bf29be..9e846603ff806d71c520b3b1c79e2464533659ca 100644 --- a/moose-core/basecode/ObjId.cpp +++ b/moose-core/basecode/ObjId.cpp @@ -11,23 +11,23 @@ #include "header.h" #include "../shell/Shell.h" ////////////////////////////////////////////////////////////// -// ObjId I/O +// ObjId I/O ////////////////////////////////////////////////////////////// // Doesn't know how to deal with off-node bad fields. bool ObjId::bad() const { Element* elm = id.element(); - return ( elm == 0 || - dataIndex == BADINDEX || + return ( elm == 0 || + dataIndex == BADINDEX || fieldIndex == BADINDEX || dataIndex >= elm->numData() - /* - * We have a bit of a problem here. The FieldElement can exist - * with zero fields, and is invalid for field lookups but valid - * for the element level lookups. I should rather not create the + /* + * We have a bit of a problem here. The FieldElement can exist + * with zero fields, and is invalid for field lookups but valid + * for the element level lookups. I should rather not create the * FieldElements this way. - || ( + || ( elm->getNode( dataIndex ) == Shell::myNode() && fieldIndex >= elm->numField( dataIndex - elm->localDataStart() ) ) @@ -70,20 +70,20 @@ Eref ObjId::eref() const bool ObjId::operator==( const ObjId& other ) const { - return ( id == other.id && dataIndex == other.dataIndex && + return ( id == other.id && dataIndex == other.dataIndex && fieldIndex == other.fieldIndex ); } bool ObjId::operator!=( const ObjId& other ) const { - return ( id != other.id || dataIndex != other.dataIndex || + return ( id != other.id || dataIndex != other.dataIndex || fieldIndex != other.fieldIndex ); } bool ObjId::operator<( const ObjId& other ) const { - return ( id < other.id || - (id == other.id && ( + return ( id < other.id || + (id == other.id && ( dataIndex < other.dataIndex || ( dataIndex == other.dataIndex && fieldIndex < other.fieldIndex ) @@ -104,15 +104,15 @@ bool ObjId::isGlobal() const bool ObjId::isOffNode() const { - return ( Shell::numNodes() > 1 && - ( id.element()->isGlobal() || + return ( Shell::numNodes() > 1 && + ( id.element()->isGlobal() || id.element()->getNode( dataIndex ) != Shell::myNode() ) ); } char* ObjId::data() const { - return id.element()->data( id.element()->rawIndex( dataIndex ), + return id.element()->data( id.element()->rawIndex( dataIndex ), fieldIndex ); } diff --git a/moose-core/basecode/ObjId.h b/moose-core/basecode/ObjId.h index 3d42d8407fabb7b33a70194452e48a87dd6e4da0..9f279f453fe2619698501642075dae85aa90a938 100644 --- a/moose-core/basecode/ObjId.h +++ b/moose-core/basecode/ObjId.h @@ -95,12 +95,12 @@ class ObjId /** * Here are the data values. */ - Id id; + Id id; unsigned int dataIndex; unsigned int fieldIndex; /** - * True if the return value is bad: either returning a failure, + * True if the return value is bad: either returning a failure, * or the DataIndex or FieldIndex is out of range. However, this * is a node-local funtion so it can't report the FieldIndex status * in all cases. diff --git a/moose-core/basecode/OpFunc.h b/moose-core/basecode/OpFunc.h index 3a55fbcab6f7c6765a33570653427d265dd72c33..27f7138377a869c31279f701ab147ae2998333fc 100644 --- a/moose-core/basecode/OpFunc.h +++ b/moose-core/basecode/OpFunc.h @@ -21,7 +21,7 @@ template< class T > class OpFunc0: public OpFunc0Base (reinterpret_cast< T* >( e.data() )->*func_)(); } private: - void ( T::*func_ )( ); + void ( T::*func_ )( ); }; template< class T, class A > class OpFunc1: public OpFunc1Base<A> @@ -34,10 +34,10 @@ template< class T, class A > class OpFunc1: public OpFunc1Base<A> (reinterpret_cast< T* >( e.data() )->*func_)( arg ); } private: - void ( T::*func_ )( A ); + void ( T::*func_ )( A ); }; -template< class T, class A1, class A2 > class OpFunc2: +template< class T, class A1, class A2 > class OpFunc2: public OpFunc2Base< A1, A2 > { public: @@ -50,10 +50,10 @@ template< class T, class A1, class A2 > class OpFunc2: } private: - void ( T::*func_ )( A1, A2 ); + void ( T::*func_ )( A1, A2 ); }; -template< class T, class A1, class A2, class A3 > class OpFunc3: +template< class T, class A1, class A2, class A3 > class OpFunc3: public OpFunc3Base< A1, A2, A3 > { public: @@ -64,10 +64,10 @@ template< class T, class A1, class A2, class A3 > class OpFunc3: (reinterpret_cast< T* >( e.data() )->*func_)( arg1, arg2, arg3); } private: - void ( T::*func_ )( A1, A2, A3 ); + void ( T::*func_ )( A1, A2, A3 ); }; -template< class T, class A1, class A2, class A3, class A4 > class OpFunc4: +template< class T, class A1, class A2, class A3, class A4 > class OpFunc4: public OpFunc4Base< A1, A2, A3, A4 > { public: @@ -76,15 +76,15 @@ template< class T, class A1, class A2, class A3, class A4 > class OpFunc4: {;} void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4 ) const { - (reinterpret_cast< T* >( e.data() )->*func_)( + (reinterpret_cast< T* >( e.data() )->*func_)( arg1, arg2, arg3, arg4 ); } private: - void ( T::*func_ )( A1, A2, A3, A4 ); + void ( T::*func_ )( A1, A2, A3, A4 ); }; -template< class T, class A1, class A2, class A3, class A4, class A5 > +template< class T, class A1, class A2, class A3, class A4, class A5 > class OpFunc5: public OpFunc5Base< A1, A2, A3, A4, A5 > { public: @@ -92,19 +92,19 @@ template< class T, class A1, class A2, class A3, class A4, class A5 > : func_( func ) {;} - void op( const Eref& e, + void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5 ) const { - (reinterpret_cast< T* >( e.data() )->*func_)( + (reinterpret_cast< T* >( e.data() )->*func_)( arg1, arg2, arg3, arg4, arg5 ); } private: - void ( T::*func_ )( A1, A2, A3, A4, A5 ); + void ( T::*func_ )( A1, A2, A3, A4, A5 ); }; -template< class T, - class A1, class A2, class A3, class A4, class A5, class A6 > +template< class T, + class A1, class A2, class A3, class A4, class A5, class A6 > class OpFunc6: public OpFunc6Base< A1, A2, A3, A4, A5, A6 > { public: @@ -112,14 +112,14 @@ template< class T, : func_( func ) {;} - void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, + void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5, A6 arg6 ) const { - (reinterpret_cast< T* >( e.data() )->*func_)( + (reinterpret_cast< T* >( e.data() )->*func_)( arg1, arg2, arg3, arg4, arg5, arg6 ); } private: - void ( T::*func_ )( A1, A2, A3, A4, A5, A6 ); + void ( T::*func_ )( A1, A2, A3, A4, A5, A6 ); }; @@ -154,14 +154,14 @@ template< class T, class A > class GetOpFunc: public GetOpFuncBase< A > * This specialized OpFunc is for looking up a single field value * using a single argument. * It generates an opFunc that takes two arguments: - * 1. FuncId of the function on the object that requested the value. + * 1. FuncId of the function on the object that requested the value. * 2. Index or other identifier to do the look up. * The OpFunc then sends back a message with the info. * Here T is the class that owns the function. * A is the return type * L is the lookup index. */ -template< class T, class L, class A > class GetOpFunc1: +template< class T, class L, class A > class GetOpFunc1: public LookupGetOpFuncBase< L, A > { public: @@ -180,7 +180,7 @@ template< class T, class L, class A > class GetOpFunc1: * Finally, the data is copied back-and-forth about 3 times. * Wasteful, but the 'get' function is not to be heavily used. */ - void op( const Eref& e, L index, ObjId recipient, FuncId fid ) + void op( const Eref& e, L index, ObjId recipient, FuncId fid ) const { const OpFunc *f = recipient.element()->cinfo()->getOpFunc( fid); const OpFunc1Base< A >* recvOpFunc = diff --git a/moose-core/basecode/OpFuncBase.cpp b/moose-core/basecode/OpFuncBase.cpp index 4a96a61202a03c01140d1ee61f1bade71fb1fe57..0f228b71d7d04cc46ba0f903591ba7ee9f2f1c7d 100644 --- a/moose-core/basecode/OpFuncBase.cpp +++ b/moose-core/basecode/OpFuncBase.cpp @@ -48,7 +48,7 @@ const OpFunc* OpFunc::lookop( unsigned int opIndex ) // Static function unsigned int OpFunc::rebuildOpIndex() { - for( vector< OpFunc* >::iterator + for( vector< OpFunc* >::iterator i = ops().begin(); i != ops().end(); ++i ) { (*i)->opIndex_ = ~0U; } @@ -63,8 +63,8 @@ bool OpFunc::setIndex( unsigned int i ) // Should only be called by Cinfo. return true; } /* - cout << " OpFunc " << rttiType() << - " already setup. (old,new) index = (" << + cout << " OpFunc " << rttiType() << + " already setup. (old,new) index = (" << opIndex_ << ", " << i << " )\n"; */ return false; diff --git a/moose-core/basecode/OpFuncBase.h b/moose-core/basecode/OpFuncBase.h index b75c579edc422107b59cadeec05f65da019baff4..8fac10643a977f619387e4013d2643dafe2bdb59 100644 --- a/moose-core/basecode/OpFuncBase.h +++ b/moose-core/basecode/OpFuncBase.h @@ -23,7 +23,7 @@ extern const unsigned char MooseTestHop; class HopIndex { public: - HopIndex( unsigned short bindIndex, + HopIndex( unsigned short bindIndex, unsigned char hopType = MooseSendHop) : bindIndex_( bindIndex ), hopType_( hopType ) @@ -115,7 +115,7 @@ template< class A > class OpFunc1Base: public OpFunc Element* elm = e.element(); if ( elm->hasFields() ) { // Assignment is to field array. unsigned int di = e.dataIndex(); - unsigned int nf = elm->numField( di - + unsigned int nf = elm->numField( di - elm->localDataStart() ); for ( unsigned int i = 0; i < nf; ++i) { Eref er( elm, di, i ); @@ -149,14 +149,14 @@ template< class A1, class A2 > class OpFunc2Base: public OpFunc return dynamic_cast< const SrcFinfo2< A1, A2 >* >( s ); } - virtual void op( const Eref& e, A1 arg1, A2 arg2 ) + virtual void op( const Eref& e, A1 arg1, A2 arg2 ) const = 0; const OpFunc* makeHopFunc( HopIndex hopIndex) const; void opBuffer( const Eref& e, double* buf ) const { const A1& arg1 = Conv< A1 >::buf2val( &buf ); - op( e, + op( e, arg1, Conv< A2 >::buf2val( &buf ) ); } @@ -172,25 +172,25 @@ template< class A1, class A2 > class OpFunc2Base: public OpFunc unsigned int nf = elm->numField( i - start ); for ( unsigned int j = 0; j < nf; ++j) { Eref er( elm, i, j ); - op( er, temp1[ k % temp1.size() ], + op( er, temp1[ k % temp1.size() ], temp2[ k % temp2.size() ] ); ++k; } } } - virtual void opVec( const Eref& e, + virtual void opVec( const Eref& e, const vector< A1 >& arg1, const vector< A2 >& arg2, const OpFunc2Base< A1, A2 >* op ) const { ; } // overridden in HopFuncs. string rttiType() const { - return Conv< A1 >::rttiType() + "," + Conv< A2 >::rttiType(); + return Conv< A1 >::rttiType() + "," + Conv< A2 >::rttiType(); } }; -template< class A1, class A2, class A3 > class OpFunc3Base: +template< class A1, class A2, class A3 > class OpFunc3Base: public OpFunc { public: @@ -198,7 +198,7 @@ template< class A1, class A2, class A3 > class OpFunc3Base: return dynamic_cast< const SrcFinfo3< A1, A2, A3 >* >( s ); } - virtual void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3 ) + virtual void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3 ) const = 0; const OpFunc* makeHopFunc( HopIndex hopIndex) const; @@ -206,7 +206,7 @@ template< class A1, class A2, class A3 > class OpFunc3Base: void opBuffer( const Eref& e, double* buf ) const { const A1& arg1 = Conv< A1 >::buf2val( &buf ); const A2& arg2 = Conv< A2 >::buf2val( &buf ); - op( e, + op( e, arg1, arg2, Conv< A3 >::buf2val( &buf ) ); } @@ -216,7 +216,7 @@ template< class A1, class A2, class A3 > class OpFunc3Base: } }; -template< class A1, class A2, class A3, class A4 > +template< class A1, class A2, class A3, class A4 > class OpFunc4Base: public OpFunc { public: @@ -224,7 +224,7 @@ template< class A1, class A2, class A3, class A4 > return dynamic_cast< const SrcFinfo4< A1, A2, A3, A4 >* >( s ); } - virtual void op( const Eref& e, + virtual void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4 ) const = 0; const OpFunc* makeHopFunc( HopIndex hopIndex) const; @@ -243,7 +243,7 @@ template< class A1, class A2, class A3, class A4 > } }; -template< class A1, class A2, class A3, class A4, class A5 > +template< class A1, class A2, class A3, class A4, class A5 > class OpFunc5Base: public OpFunc { public: @@ -251,7 +251,7 @@ template< class A1, class A2, class A3, class A4, class A5 > return dynamic_cast< const SrcFinfo5< A1, A2, A3, A4, A5 >* >( s ); } - virtual void op( const Eref& e, + virtual void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5 ) const = 0; const OpFunc* makeHopFunc( HopIndex hopIndex) const; @@ -272,7 +272,7 @@ template< class A1, class A2, class A3, class A4, class A5 > } }; -template< class A1, class A2, class A3, class A4, class A5, class A6 > +template< class A1, class A2, class A3, class A4, class A5, class A6 > class OpFunc6Base: public OpFunc { public: @@ -280,7 +280,7 @@ template< class A1, class A2, class A3, class A4, class A5, class A6 > return dynamic_cast< const SrcFinfo6< A1, A2, A3, A4, A5, A6 >* >( s ); } - virtual void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, + virtual void op( const Eref& e, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5, A6 arg6 ) const = 0; const OpFunc* makeHopFunc( HopIndex hopIndex) const; @@ -291,7 +291,7 @@ template< class A1, class A2, class A3, class A4, class A5, class A6 > const A3& arg3 = Conv< A3 >::buf2val( &buf ); const A4& arg4 = Conv< A4 >::buf2val( &buf ); const A5& arg5 = Conv< A5 >::buf2val( &buf ); - op( e, + op( e, arg1, arg2, arg3, arg4, arg5, Conv< A6 >::buf2val( &buf ) ); } @@ -303,11 +303,11 @@ template< class A1, class A2, class A3, class A4, class A5, class A6 > }; /** - * This is the base class for all GetOpFuncs. + * This is the base class for all GetOpFuncs. */ template< class A > class GetOpFuncBase: public OpFunc1Base< vector< A >* > { - public: + public: /* bool checkFinfo( const Finfo* s ) const { return ( dynamic_cast< const SrcFinfo1< A >* >( s ) @@ -339,13 +339,13 @@ template< class A > class GetOpFuncBase: public OpFunc1Base< vector< A >* > /* template< class A > class GetOpFuncBase: public OpFunc { - public: + public: bool checkFinfo( const Finfo* s ) const { return ( dynamic_cast< const SrcFinfo1< A >* >( s ) || dynamic_cast< const SrcFinfo1< FuncId >* >( s ) ); } - virtual void op( const Eref& e, ObjId recipient, FuncId fid ) + virtual void op( const Eref& e, ObjId recipient, FuncId fid ) const = 0; virtual A returnOp( const Eref& e ) const = 0; @@ -357,22 +357,22 @@ template< class A > class GetOpFuncBase: public OpFunc */ /** - * This is the base class for all LookupGetOpFuncs. + * This is the base class for all LookupGetOpFuncs. */ template< class L, class A > class LookupGetOpFuncBase: public OpFunc { - public: + public: bool checkFinfo( const Finfo* s ) const { return ( dynamic_cast< const SrcFinfo1< A >* >( s ) || dynamic_cast< const SrcFinfo2< FuncId, L >* >( s ) ); } - virtual void op( const Eref& e, L index, + virtual void op( const Eref& e, L index, ObjId recipient, FuncId fid ) const = 0; virtual A returnOp( const Eref& e, const L& index ) const = 0; - const OpFunc* makeHopFunc( HopIndex hopIndex) const + const OpFunc* makeHopFunc( HopIndex hopIndex) const { // Perhaps later we can put in something for x-node gets. return 0; diff --git a/moose-core/basecode/PrepackedBuffer.cpp b/moose-core/basecode/PrepackedBuffer.cpp index 60673928ae0cf84ad51e797d5f89583a8f11cc2d..8d81f44d7c568feb3befc38e668ff11178fc85d9 100644 --- a/moose-core/basecode/PrepackedBuffer.cpp +++ b/moose-core/basecode/PrepackedBuffer.cpp @@ -10,7 +10,7 @@ #include <cstring> #include "PrepackedBuffer.h" -PrepackedBuffer::PrepackedBuffer( +PrepackedBuffer::PrepackedBuffer( const char* data, unsigned int dataSize, unsigned int numEntries ) : dataSize_( dataSize ), numEntries_( numEntries ) { @@ -18,13 +18,13 @@ PrepackedBuffer::PrepackedBuffer( individualDataSize_ = dataSize_; else individualDataSize_ = dataSize_ / numEntries_; - + data_ = new char[ dataSize ]; memcpy( data_, data, dataSize ); } PrepackedBuffer::PrepackedBuffer( const PrepackedBuffer& other ) - : dataSize_( other.dataSize_ ), + : dataSize_( other.dataSize_ ), numEntries_( other.numEntries_ ) { if ( numEntries_ == 0 ) @@ -37,7 +37,7 @@ PrepackedBuffer::PrepackedBuffer( const PrepackedBuffer& other ) PrepackedBuffer::PrepackedBuffer( const char* buf ) : dataSize_( *reinterpret_cast< const unsigned int * >( buf ) ), - numEntries_( *reinterpret_cast< const unsigned int * >( + numEntries_( *reinterpret_cast< const unsigned int * >( buf + sizeof( unsigned int ) ) ) { if ( numEntries_ == 0 ) diff --git a/moose-core/basecode/PrepackedBuffer.h b/moose-core/basecode/PrepackedBuffer.h index e2d3aedcf7f6ac1ded4d7a1b384459e015baf6a5..a84f477ab2e62733aa8314d7b9c8adddf4048372 100644 --- a/moose-core/basecode/PrepackedBuffer.h +++ b/moose-core/basecode/PrepackedBuffer.h @@ -16,21 +16,21 @@ class PrepackedBuffer { public: /** - * Constructor. + * Constructor. * Here data is a pointer to the entire data block. * dataSize is the size of the entire data block to be transferred, * dataSize = individualDataSize * numEntries. * numEntries is the # of array entries. For non-arrays it defaults * to 0. */ - PrepackedBuffer( const char* data, unsigned int dataSize, + PrepackedBuffer( const char* data, unsigned int dataSize, unsigned int numEntries = 0 ); PrepackedBuffer( const PrepackedBuffer& other ); /** * Constructor - * Here the char buffer is a serialized version of the + * Here the char buffer is a serialized version of the * Prepacked buffer */ PrepackedBuffer( const char* buf ); diff --git a/moose-core/basecode/ProcInfo.h b/moose-core/basecode/ProcInfo.h index 346216ce112355b5cbd76798dae9ff5a44ece44b..4a08e5ea75437f6415d3ef630e5f1c7c02c06f6e 100644 --- a/moose-core/basecode/ProcInfo.h +++ b/moose-core/basecode/ProcInfo.h @@ -12,7 +12,7 @@ class ProcInfo { public: - ProcInfo() + ProcInfo() : dt( 1.0 ), currTime( 0.0 ) {;} double dt; diff --git a/moose-core/basecode/ProcOpFunc.h b/moose-core/basecode/ProcOpFunc.h index 9a8bf828c8dedc8735bd2eca7957701ce29ac2fe..a08619dde1a6439822de356f7e100458e3e2c620 100644 --- a/moose-core/basecode/ProcOpFunc.h +++ b/moose-core/basecode/ProcOpFunc.h @@ -67,7 +67,7 @@ template< class T > class ProcOpFunc: public ProcOpFuncBase } private: - void ( T::*func_ )( const Eref& e, ProcPtr ); + void ( T::*func_ )( const Eref& e, ProcPtr ); }; */ template< class T > class ProcOpFunc: public EpFunc1< T, ProcPtr > diff --git a/moose-core/basecode/SetGet.cpp b/moose-core/basecode/SetGet.cpp index 3212b6a2bb2adf5e885dcc2b295b47210108074d..aa50ec6c702c0f2d40544fddc9bd9e1c55a5ef65 100644 --- a/moose-core/basecode/SetGet.cpp +++ b/moose-core/basecode/SetGet.cpp @@ -12,12 +12,12 @@ #include "../shell/Shell.h" #include "../shell/Neutral.h" -const OpFunc* SetGet::checkSet( +const OpFunc* SetGet::checkSet( const string& field, ObjId& tgt, FuncId& fid ) { // string field = "set_" + destField; const Finfo* f = tgt.element()->cinfo()->findFinfo( field ); - if ( !f ) { // Could be a child element? Note that field name will + if ( !f ) { // Could be a child element? Note that field name will // change from set_<name> to just <name> string f2 = field.substr( 3 ); Id child = Neutral::child( tgt.eref(), f2 ); @@ -48,7 +48,7 @@ const OpFunc* SetGet::checkSet( const DestFinfo* df = dynamic_cast< const DestFinfo* >( f ); if ( !df ) return 0; - + fid = df->getFid(); const OpFunc* func = df->getOpFunc(); assert( func ); diff --git a/moose-core/basecode/SetGet.h b/moose-core/basecode/SetGet.h index b2008f809e9998ccb4e961b5bdfb76af8f7d5fa3..fc855b2071b4c123c631be6fcc9786e051b6b5dd 100644 --- a/moose-core/basecode/SetGet.h +++ b/moose-core/basecode/SetGet.h @@ -15,14 +15,14 @@ template< class T, class A > class GetOpFunc; /** * Similar to Field< A >::fastGet(), except that an existing Msg is not needed. - * + * * Instant-return call for a single value. Bypasses all the queueing stuff. * It is hardcoded so type safety will have to be coded in too: * the dynamic_cast will catch it only at runtime. - * + * * Perhaps analogous localSet(), localLookupGet(), localGetVec(), etc. should * also be added. - * + * * Also, will be nice to change this to Field< A >::localGet() to make things * more uniform. */ @@ -33,17 +33,17 @@ A localGet( const Eref& er, string field ) fullFieldName[3] = std::toupper( fullFieldName[3] ); const Finfo* finfo = er.element()->cinfo()->findFinfo( fullFieldName ); assert( finfo ); - + const DestFinfo* dest = dynamic_cast< const DestFinfo* >( finfo ); assert( dest ); - + const OpFunc* op = dest->getOpFunc(); assert( op ); - + const GetOpFunc< T, A >* gop = dynamic_cast< const GetOpFunc< T, A >* >( op ); assert( gop ); - + return gop->reduceOp( er ); } @@ -61,13 +61,13 @@ class SetGet * source type, to look up and pass back the fid, and to return * the number of targetEntries. * Tgt is passed in as the destination ObjId. May be changed inside, - * if the function determines that it should be directed to a + * if the function determines that it should be directed to a * child Element acting as a Value. * Checks arg # and types for a 'set' call. Can be zero to 3 args. - * Returns # of tgts if good. This is 0 if bad. + * Returns # of tgts if good. This is 0 if bad. * Passes back found fid. */ - static const OpFunc* checkSet( + static const OpFunc* checkSet( const string& field, ObjId& tgt, FuncId& fid ); ////////////////////////////////////////////////////////////////////// @@ -84,8 +84,8 @@ class SetGet static bool strSet( const ObjId& dest, const string& field, const string& val ); /// Sends out request for data, and awaits its return. - static const vector< double* >* dispatchGet( - const ObjId& tgt, FuncId tgtFid, + static const vector< double* >* dispatchGet( + const ObjId& tgt, FuncId tgtFid, const double* arg, unsigned int size ); virtual bool checkOpClass( const OpFunc* op ) const = 0; @@ -105,13 +105,13 @@ class SetGet0: public SetGet FuncId fid; ObjId tgt( dest ); // checkSet may change the tgt. const OpFunc* func = checkSet( field, tgt, fid ); - const OpFunc0Base* op = + const OpFunc0Base* op = dynamic_cast< const OpFunc0Base* >( func ); if ( op ) { if ( tgt.isOffNode() ) { - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetHop ) ); - const OpFunc0Base* hop = + const OpFunc0Base* hop = dynamic_cast< const OpFunc0Base* >( op2 ); assert( hop ); hop->op( tgt.eref() ); @@ -130,7 +130,7 @@ class SetGet0: public SetGet /** * Blocking call using string conversion */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& val ) { return set( dest, field ); @@ -155,13 +155,13 @@ template< class A > class SetGet1: public SetGet FuncId fid; ObjId tgt( dest ); const OpFunc* func = checkSet( field, tgt, fid ); - const OpFunc1Base< A >* op = + const OpFunc1Base< A >* op = dynamic_cast< const OpFunc1Base< A >* >( func ); if ( op ) { if ( tgt.isOffNode() ) { - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetHop ) ); - const OpFunc1Base< A >* hop = + const OpFunc1Base< A >* hop = dynamic_cast< const OpFunc1Base< A >* >( op2 ); hop->op( tgt.eref(), arg ); delete op2; @@ -185,7 +185,7 @@ template< class A > class SetGet1: public SetGet * buffer: if the number of targets exceeds the vector size, it * rolls over. */ - static bool setVec( ObjId destId, const string& field, + static bool setVec( ObjId destId, const string& field, const vector< A >& arg ) { if ( arg.size() == 0 ) return 0; @@ -196,9 +196,9 @@ template< class A > class SetGet1: public SetGet const OpFunc* func = checkSet( field, tgt, fid ); const OpFunc1Base< A >* op = dynamic_cast< const OpFunc1Base< A >* >( func ); if ( op ) { - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetVecHop ) ); - const OpFunc1Base< A >* hop = + const OpFunc1Base< A >* hop = dynamic_cast< const OpFunc1Base< A >* >( op2 ); hop->opVec( tgt.eref(), arg, op ); delete op2; @@ -210,7 +210,7 @@ template< class A > class SetGet1: public SetGet /** * Sets all target array values to the single value */ - static bool setRepeat( ObjId destId, const string& field, + static bool setRepeat( ObjId destId, const string& field, const A& arg ) { vector< A >temp ( 1, arg ); @@ -220,7 +220,7 @@ template< class A > class SetGet1: public SetGet /** * Blocking call using string conversion */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& val ) { A arg; @@ -249,7 +249,7 @@ template< class A > class Field: public SetGet1< A > return SetGet1< A >::set( dest, temp, arg ); } - static bool setVec( ObjId destId, const string& field, + static bool setVec( ObjId destId, const string& field, const vector< A >& arg ) { string temp = "set" + field; @@ -257,7 +257,7 @@ template< class A > class Field: public SetGet1< A > return SetGet1< A >::setVec( destId, temp, arg ); } - static bool setRepeat( ObjId destId, const string& field, + static bool setRepeat( ObjId destId, const string& field, A arg ) { string temp = "set" + field; @@ -268,7 +268,7 @@ template< class A > class Field: public SetGet1< A > /** * Blocking call using string conversion */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& arg ) { A val; @@ -282,31 +282,31 @@ template< class A > class Field: public SetGet1< A > // Returns a field value. static A get( const ObjId& dest, const string& field) - { + { ObjId tgt( dest ); FuncId fid; string fullFieldName = "get" + field; fullFieldName[3] = std::toupper( fullFieldName[3] ); const OpFunc* func = SetGet::checkSet( fullFieldName, tgt, fid ); - const GetOpFuncBase< A >* gof = + const GetOpFuncBase< A >* gof = dynamic_cast< const GetOpFuncBase< A >* >( func ); if ( gof ) { if ( tgt.isDataHere() ) { return gof->returnOp( tgt.eref() ); } else { - const OpFunc* op2 = gof->makeHopFunc( + const OpFunc* op2 = gof->makeHopFunc( HopIndex( gof->opIndex(), MooseGetHop ) ); - const OpFunc1Base< A* >* hop = + const OpFunc1Base< A* >* hop = dynamic_cast< const OpFunc1Base< A* >* >( op2 ); assert( hop ); // Blocking function. - A ret; + A ret; hop->op( tgt.eref(), &ret ); delete op2; return ret; } } - cout << "Warning: Field::Get conversion error for " << + cout << "Warning: Field::Get conversion error for " << dest.id.path() << "." << field << endl; return A(); } @@ -323,12 +323,12 @@ template< class A > class Field: public SetGet1< A > string fullFieldName = "get" + field; fullFieldName[3] = std::toupper( fullFieldName[3] ); const OpFunc* func = SetGet::checkSet( fullFieldName, tgt, fid ); - const GetOpFuncBase< A >* gof = + const GetOpFuncBase< A >* gof = dynamic_cast< const GetOpFuncBase< A >* >( func ); if ( gof ) { - const OpFunc* op2 = gof->makeHopFunc( + const OpFunc* op2 = gof->makeHopFunc( HopIndex( gof->opIndex(), MooseGetVecHop ) ); - const GetHopFunc< A >* hop = + const GetHopFunc< A >* hop = dynamic_cast< const GetHopFunc< A >* >( op2 ); hop->opGetVec( tgt.eref(), vec, gof ); delete op2; @@ -342,7 +342,7 @@ template< class A > class Field: public SetGet1< A > * Blocking call for finding a value and returning in a * string. */ - static bool innerStrGet( const ObjId& dest, const string& field, + static bool innerStrGet( const ObjId& dest, const string& field, string& str ) { Conv< A >::val2str( str, get( dest, field ) ); @@ -362,19 +362,19 @@ template< class A1, class A2 > class SetGet2: public SetGet /** * Blocking, typed 'Set' call */ - static bool set( const ObjId& dest, const string& field, + static bool set( const ObjId& dest, const string& field, A1 arg1, A2 arg2 ) { FuncId fid; ObjId tgt( dest ); const OpFunc* func = checkSet( field, tgt, fid ); - const OpFunc2Base< A1, A2 >* op = + const OpFunc2Base< A1, A2 >* op = dynamic_cast< const OpFunc2Base< A1, A2 >* >( func ); if ( op ) { if ( tgt.isOffNode() ) { - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetHop ) ); - const OpFunc2Base< A1, A2 >* hop = + const OpFunc2Base< A1, A2 >* hop = dynamic_cast< const OpFunc2Base< A1, A2 >* >( op2 ); hop->op( tgt.eref(), arg1, arg2 ); delete op2; @@ -393,7 +393,7 @@ template< class A1, class A2 > class SetGet2: public SetGet * Assign a vector of targets, using matching vectors of arguments * arg1 and arg2. Specifically, index i on the target receives * arguments arg1[i], arg2[i]. - * Note that there is no requirement for the size of the + * Note that there is no requirement for the size of the * argument vectors to be equal to the size of the target array * of objects. If there are fewer arguments then the index cycles * back, so as to tile the target array with as many arguments as @@ -401,28 +401,28 @@ template< class A1, class A2 > class SetGet2: public SetGet * * Not yet implemented correct handling for FieldElements. */ - static bool setVec( Id destId, const string& field, + static bool setVec( Id destId, const string& field, const vector< A1 >& arg1, const vector< A2 >& arg2 ) { ObjId tgt( destId, 0 ); FuncId fid; const OpFunc* func = checkSet( field, tgt, fid ); - const OpFunc2Base< A1, A2 >* op = + const OpFunc2Base< A1, A2 >* op = dynamic_cast< const OpFunc2Base< A1, A2 >* >( func ); if ( op ) { /* - unsigned int size = tgt.element()->numData(); + unsigned int size = tgt.element()->numData(); // total # of entries on element and maybe to include fields for ( unsigned int i = 0; i < size; ++i ) { Eref er( tgt.element(), i ); - op->op( er, arg1[ i % arg1.size() ], + op->op( er, arg1[ i % arg1.size() ], arg2[ i % arg2.size() ] ); } return true; */ - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetVecHop ) ); - const OpFunc2Base< A1, A2 >* hop = + const OpFunc2Base< A1, A2 >* hop = dynamic_cast< const OpFunc2Base< A1, A2 >* >( op2 ); hop->opVec( tgt.eref(), arg1, arg2, op ); delete op2; @@ -434,7 +434,7 @@ template< class A1, class A2 > class SetGet2: public SetGet /** * Blocking call using string conversion. */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& val ) { A1 arg1; @@ -452,7 +452,7 @@ template< class A1, class A2 > class SetGet2: public SetGet * The first argument in the 'Set' is the index, the second the value. * The first and only argument in the 'get' is the index. * Here A is the type of the value, and L the lookup index. - * + * */ template< class L, class A > class LookupField: public SetGet2< L, A > { @@ -464,7 +464,7 @@ template< class L, class A > class LookupField: public SetGet2< L, A > /** * Blocking, typed 'Set' call. Identical to SetGet2::set. */ - static bool set( const ObjId& dest, const string& field, + static bool set( const ObjId& dest, const string& field, L index, A arg ) { string temp = "set" + field; @@ -472,11 +472,11 @@ template< class L, class A > class LookupField: public SetGet2< L, A > return SetGet2< L, A >::set( dest, temp, index, arg ); } - /** + /** * This setVec assigns goes through each object entry in the * destId, and assigns the corresponding index and argument to it. */ - static bool setVec( Id destId, const string& field, + static bool setVec( Id destId, const string& field, const vector< L >& index, const vector< A >& arg ) { string temp = "set" + field; @@ -490,7 +490,7 @@ template< class L, class A > class LookupField: public SetGet2< L, A > * index and assigns the corresponding argument. * This is a brute-force assignment. */ - static bool setVec( ObjId dest, const string& field, + static bool setVec( ObjId dest, const string& field, const vector< L >& index, const vector< A >& arg ) { string temp = "set" + field; @@ -501,7 +501,7 @@ template< class L, class A > class LookupField: public SetGet2< L, A > /** * Faking setRepeat too. Just plugs into setVec. */ - static bool setRepeat( Id destId, const string& field, + static bool setRepeat( Id destId, const string& field, const vector< L >& index, A arg ) { vector< A > avec( index.size(), arg ); @@ -511,7 +511,7 @@ template< class L, class A > class LookupField: public SetGet2< L, A > /** * Blocking call using string conversion */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& indexStr, const string& val ) { L index; @@ -536,16 +536,16 @@ template< class L, class A > class LookupField: public SetGet2< L, A > string fullFieldName = "get" + field; fullFieldName[3] = std::toupper( fullFieldName[3] ); const OpFunc* func = SetGet::checkSet( fullFieldName, tgt, fid); - const LookupGetOpFuncBase< L, A >* gof = + const LookupGetOpFuncBase< L, A >* gof = dynamic_cast< const LookupGetOpFuncBase< L, A >* >( func ); if ( gof ) { if ( tgt.isDataHere() ) { return gof->returnOp( tgt.eref(), index ); } else { /* - const OpFunc* op2 = gof->makeHopFunc( + const OpFunc* op2 = gof->makeHopFunc( HopIndex( gof->opIndex(), MooseGetHop ), index ); - const OpFunc1Base< A* >* hop = + const OpFunc1Base< A* >* hop = dynamic_cast< const OpFunc1Base< A* >* >( op2 ); */ cout << "Warning: LookupField::get: cannot cross nodes yet\n"; @@ -559,7 +559,7 @@ template< class L, class A > class LookupField: public SetGet2< L, A > */ } } - cout << "LookupField::get: Warning: Field::Get conversion error for " << + cout << "LookupField::get: Warning: Field::Get conversion error for " << dest.id.path() << "." << field << endl; return A(); } @@ -570,7 +570,7 @@ template< class L, class A > class LookupField: public SetGet2< L, A > * and passes in the same lookup index to each one. The results * are put together in the vector vec. */ - static void getVec( Id dest, const string& field, + static void getVec( Id dest, const string& field, vector< L >& index, vector< A >& vec ) { vec.resize( 0 ); @@ -579,7 +579,7 @@ template< class L, class A > class LookupField: public SetGet2< L, A > string fullFieldName = "get" + field; fullFieldName[3] = std::toupper( fullFieldName[3] ); const OpFunc* func = SetGet::checkSet( fullFieldName, tgt, fid ); - const LookupGetOpFuncBase< L, A >* gof = + const LookupGetOpFuncBase< L, A >* gof = dynamic_cast< const LookupGetOpFuncBase< L, A >* >( func ); if ( gof ) { Element* elm = dest.element(); @@ -599,7 +599,7 @@ template< class L, class A > class LookupField: public SetGet2< L, A > * Blocking virtual call for finding a value and returning in a * string. */ - static bool innerStrGet( const ObjId& dest, const string& field, + static bool innerStrGet( const ObjId& dest, const string& field, const string& indexStr, string& str ) { L index; @@ -623,20 +623,20 @@ template< class A1, class A2, class A3 > class SetGet3: public SetGet /** * Blocking, typed 'Set' call */ - static bool set( const ObjId& dest, const string& field, + static bool set( const ObjId& dest, const string& field, A1 arg1, A2 arg2, A3 arg3 ) { FuncId fid; ObjId tgt( dest ); const OpFunc* func = checkSet( field, tgt, fid ); - const OpFunc3Base< A1, A2, A3 >* op = + const OpFunc3Base< A1, A2, A3 >* op = dynamic_cast< const OpFunc3Base< A1, A2, A3 >* >( func); if ( op ) { if ( tgt.isOffNode() ) { - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetHop ) ); - const OpFunc3Base< A1, A2, A3 >* hop = - dynamic_cast< const OpFunc3Base< A1, A2, A3 >* >( + const OpFunc3Base< A1, A2, A3 >* hop = + dynamic_cast< const OpFunc3Base< A1, A2, A3 >* >( op2 ); hop->op( tgt.eref(), arg1, arg2, arg3 ); delete op2; @@ -656,7 +656,7 @@ template< class A1, class A2, class A3 > class SetGet3: public SetGet * As yet we don't have 2 arg conversion from a single string. * So this is a dummy */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& val ) { A1 arg1; @@ -684,19 +684,19 @@ template< class A1, class A2, class A3, class A4 > class SetGet4: public SetGet /** * Blocking, typed 'Set' call */ - static bool set( const ObjId& dest, const string& field, + static bool set( const ObjId& dest, const string& field, A1 arg1, A2 arg2, A3 arg3, A4 arg4 ) { FuncId fid; ObjId tgt( dest ); const OpFunc* func = checkSet( field, tgt, fid ); - const OpFunc4Base< A1, A2, A3, A4 >* op = + const OpFunc4Base< A1, A2, A3, A4 >* op = dynamic_cast< const OpFunc4Base< A1, A2, A3, A4 >* >( func); if ( op ) { if ( tgt.isOffNode() ) { - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetHop ) ); - const OpFunc4Base< A1, A2, A3, A4 >* hop = + const OpFunc4Base< A1, A2, A3, A4 >* hop = dynamic_cast< const OpFunc4Base< A1, A2, A3, A4 >* >( op2 ); hop->op( tgt.eref(), arg1, arg2, arg3, arg4 ); delete op2; @@ -716,7 +716,7 @@ template< class A1, class A2, class A3, class A4 > class SetGet4: public SetGet * As yet we don't have 2 arg conversion from a single string. * So this is a dummy */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& val ) { A1 arg1; @@ -746,19 +746,19 @@ template< class A1, class A2, class A3, class A4, class A5 > class SetGet5: SetGet5() {;} - static bool set( const ObjId& dest, const string& field, + static bool set( const ObjId& dest, const string& field, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5 ) { FuncId fid; ObjId tgt( dest ); const OpFunc* func = checkSet( field, tgt, fid ); - const OpFunc5Base< A1, A2, A3, A4, A5 >* op = + const OpFunc5Base< A1, A2, A3, A4, A5 >* op = dynamic_cast< const OpFunc5Base< A1, A2, A3, A4, A5 >* >( func); if ( op ) { if ( tgt.isOffNode() ) { - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetHop ) ); - const OpFunc5Base< A1, A2, A3, A4, A5 >* hop = + const OpFunc5Base< A1, A2, A3, A4, A5 >* hop = dynamic_cast< const OpFunc5Base< A1, A2, A3, A4, A5 >* >( op2 ); hop->op( tgt.eref(), arg1, arg2, arg3, arg4, arg5 ); delete op2; @@ -778,7 +778,7 @@ template< class A1, class A2, class A3, class A4, class A5 > class SetGet5: * As yet we don't have 2 arg conversion from a single string. * So this is a dummy */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& val ) { A1 arg1; @@ -815,19 +815,19 @@ template< class A1, class A2, class A3, class A4, class A5, class A6 > class Set /** * Blocking, typed 'Set' call */ - static bool set( const ObjId& dest, const string& field, + static bool set( const ObjId& dest, const string& field, A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5, A6 arg6 ) { FuncId fid; ObjId tgt( dest ); const OpFunc* func = checkSet( field, tgt, fid ); - const OpFunc6Base< A1, A2, A3, A4, A5, A6 >* op = + const OpFunc6Base< A1, A2, A3, A4, A5, A6 >* op = dynamic_cast< const OpFunc6Base< A1, A2, A3, A4, A5, A6 >* >( func); if ( op ) { if ( tgt.isOffNode() ) { - const OpFunc* op2 = op->makeHopFunc( + const OpFunc* op2 = op->makeHopFunc( HopIndex( op->opIndex(), MooseSetHop ) ); - const OpFunc6Base< A1, A2, A3, A4, A5, A6 >* hop = + const OpFunc6Base< A1, A2, A3, A4, A5, A6 >* hop = dynamic_cast< const OpFunc6Base< A1, A2, A3, A4, A5, A6 >* >( op2 ); hop->op( tgt.eref(), arg1, arg2, arg3, arg4, arg5, arg6 ); delete op2; @@ -845,7 +845,7 @@ template< class A1, class A2, class A3, class A4, class A5, class A6 > class Set /** * Blocking call using string conversion. */ - static bool innerStrSet( const ObjId& dest, const string& field, + static bool innerStrSet( const ObjId& dest, const string& field, const string& val ) { A1 arg1; diff --git a/moose-core/basecode/SharedFinfo.cpp b/moose-core/basecode/SharedFinfo.cpp index b17252d64b234f60b14d876a1d421bcc81bf15ef..cc54602d04373f552d0660779fa2223cebb28406 100644 --- a/moose-core/basecode/SharedFinfo.cpp +++ b/moose-core/basecode/SharedFinfo.cpp @@ -9,14 +9,14 @@ #include "header.h" /** - * This set of classes define Message Sources. Their main job is to supply + * This set of classes define Message Sources. Their main job is to supply * a type-safe send operation, and to provide typechecking for it. */ SharedFinfo::SharedFinfo( const string& name, const string& doc, Finfo** entries, unsigned int numEntries ) : Finfo( name, doc ) -{ +{ for ( unsigned int i = 0; i < numEntries; ++i ) { Finfo* foo = entries[i]; @@ -31,21 +31,21 @@ SharedFinfo::SharedFinfo( const string& name, const string& doc, void SharedFinfo::registerFinfo( Cinfo* c ) { - for( vector< SrcFinfo* >::iterator i = + for( vector< SrcFinfo* >::iterator i = src_.begin(); i != src_.end(); ++i) c->registerFinfo( *i ); - for( vector< Finfo* >::iterator i = + for( vector< Finfo* >::iterator i = dest_.begin(); i != dest_.end(); ++i) c->registerFinfo( *i ); } -bool SharedFinfo::strSet( +bool SharedFinfo::strSet( const Eref& tgt, const string& field, const string& arg ) const { return 0; } -bool SharedFinfo::strGet( +bool SharedFinfo::strGet( const Eref& tgt, const string& field, string& returnValue ) const { return 0; @@ -54,7 +54,7 @@ bool SharedFinfo::strGet( /** * It is possible that we have DestFinfos in this SharedFinfo, that have * not been registered. So we need to scan through. - * Note that the register operation overwrites values if they already + * Note that the register operation overwrites values if they already * exist. Best not to have conflicts!. */ /* @@ -75,7 +75,7 @@ bool SharedFinfo::checkTarget( const Finfo* target ) const { const SharedFinfo* tgt = dynamic_cast< const SharedFinfo* >( target ); if ( tgt ) { - if ( src_.size() != tgt->dest_.size() && + if ( src_.size() != tgt->dest_.size() && dest_.size() != tgt->src_.size() ) return 0; for ( unsigned int i = 0; i < src_.size(); ++i ) { @@ -92,7 +92,7 @@ bool SharedFinfo::checkTarget( const Finfo* target ) const return 0; } -bool SharedFinfo::addMsg( const Finfo* target, ObjId mid, +bool SharedFinfo::addMsg( const Finfo* target, ObjId mid, Element* srcElm ) const { if ( !checkTarget( target ) ) @@ -109,7 +109,7 @@ bool SharedFinfo::addMsg( const Finfo* target, ObjId mid, Element* destElm = m->e2(); if ( srcElm == destElm && srcElm->id() != Id() ) { if ( dest_.size() > 0 ) { - cout << "Error: SharedFinfo::addMsg: MessageId " << mid << + cout << "Error: SharedFinfo::addMsg: MessageId " << mid << endl << "Source Element == DestElement == " << srcElm->getName() << endl << "Recommend that you individually set up messages for" << @@ -129,7 +129,7 @@ bool SharedFinfo::addMsg( const Finfo* target, ObjId mid, } } - + for ( unsigned int i = 0; i < tgt->src_.size(); ++i ) { if ( !tgt->src_[i]->addMsg( dest_[i], mid, destElm ) ) { // Should never happen. The checkTarget should preclude this. @@ -158,7 +158,7 @@ const vector< Finfo* >& SharedFinfo::dest() const vector< string > SharedFinfo::innerSrc() const { vector< string > ret; - for ( vector< SrcFinfo* >::const_iterator i = src_.begin(); + for ( vector< SrcFinfo* >::const_iterator i = src_.begin(); i != src_.end(); ++i ) ret.push_back( (*i)->name() ); return ret; @@ -167,7 +167,7 @@ vector< string > SharedFinfo::innerSrc() const vector< string > SharedFinfo::innerDest() const { vector< string > ret; - for ( vector< Finfo* >::const_iterator i = dest_.begin(); + for ( vector< Finfo* >::const_iterator i = dest_.begin(); i != dest_.end(); ++i ) ret.push_back( (*i)->name() ); return ret; diff --git a/moose-core/basecode/SharedFinfo.h b/moose-core/basecode/SharedFinfo.h index ca425dcbb92c6a30e81271d4f2b1f50a3983dc6f..1938b61c7ff8f7d01b73f05ad48d6e984abfbaf4 100644 --- a/moose-core/basecode/SharedFinfo.h +++ b/moose-core/basecode/SharedFinfo.h @@ -12,22 +12,22 @@ /** * This is a SharedFinfo, which wraps an arbitrary set of regular * Src and Dest Messages. Its main job is to do typechecking for setting - * up multiple data streams to go across the same Msg. + * up multiple data streams to go across the same Msg. */ class SharedFinfo: public Finfo { public: - SharedFinfo( const string& name, const string& doc, + SharedFinfo( const string& name, const string& doc, Finfo** entries, unsigned int numEntries ); ~SharedFinfo() {;} void registerFinfo( Cinfo* c ); - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const; - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const; /** @@ -49,8 +49,8 @@ class SharedFinfo: public Finfo /////////////////////////////////////////////////////////////////// // Override the default virtual function for the set/get destfinfos /////////////////////////////////////////////////////////////////// - vector< string > innerSrc() const; - vector< string > innerDest() const; + vector< string > innerSrc() const; + vector< string > innerDest() const; /// This always returns void. We need to check the subsidiary Finfos string rttiType() const; diff --git a/moose-core/basecode/SparseMatrix.h b/moose-core/basecode/SparseMatrix.h index 88d2681c65fd06f8a5f5479d348606f247038905..606f53ebebc6fd547adfc9aa8d0f5c8bd8ce41ae 100644 --- a/moose-core/basecode/SparseMatrix.h +++ b/moose-core/basecode/SparseMatrix.h @@ -377,7 +377,7 @@ public: for ( i = N_.begin() + rs; i != end; ++i ) f( *i ); } -#endif +#endif /** * Adds a row to the sparse matrix, must go strictly in row order. @@ -569,7 +569,7 @@ public: void tripletFill( const vector< unsigned int >& row, const vector< unsigned int >& col, - const vector< T >& z ) + const vector< T >& z, bool retainSize = false ) { unsigned int len = row.size(); if ( len > col.size() ) len = col.size(); @@ -578,16 +578,20 @@ public: for ( unsigned int i = 0; i < len; ++i ) trip[i]= Triplet< T >(z[i], row[i], col[i] ); sort( trip.begin(), trip.end(), Triplet< T >::cmp ); - unsigned int nr = trip.back().b_ + 1; - unsigned int nc = 0; - for ( typename vector< Triplet< T > >::iterator i = - trip.begin(); i != trip.end(); ++i ) - { - if ( nc < i->c_ ) - nc = i->c_; - } - nc++; - setSize( nr, nc ); + unsigned int nr = nrows_; + unsigned int nc = ncolumns_; + if ( !retainSize ) { + nr = trip.back().b_ + 1; + nc = 0; + for ( typename vector< Triplet< T > >::iterator i = + trip.begin(); i != trip.end(); ++i ) + { + if ( nc < i->c_ ) + nc = i->c_; + } + nc++; + } + setSize( nr, nc ); vector< unsigned int > colIndex( nc ); vector< T > entry( nc ); diff --git a/moose-core/basecode/SrcFinfo.cpp b/moose-core/basecode/SrcFinfo.cpp index 2e7cc45901907289f14d72f70ed9ad8830026b7a..468c35067eb3959c8a9e0913e74f5bb54e762196 100644 --- a/moose-core/basecode/SrcFinfo.cpp +++ b/moose-core/basecode/SrcFinfo.cpp @@ -9,7 +9,7 @@ #include "header.h" /** - * This set of classes define Message Sources. Their main job is to supply + * This set of classes define Message Sources. Their main job is to supply * a type-safe send operation, and to provide typechecking for it. */ @@ -25,7 +25,7 @@ void SrcFinfo::registerFinfo( Cinfo* c ) } -BindIndex SrcFinfo::getBindIndex() const +BindIndex SrcFinfo::getBindIndex() const { // Treat this assertion as a warning that the SrcFinfo is being used // without initialization. @@ -71,7 +71,7 @@ void SrcFinfo0::send( const Eref& e ) const { const vector< MsgDigest >& md = e.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc0Base* f = + const OpFunc0Base* f = dynamic_cast< const OpFunc0Base* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator diff --git a/moose-core/basecode/SrcFinfo.h b/moose-core/basecode/SrcFinfo.h index ab2c7d7cb8d2b44acc3c2f2f60206ddb1d3e1eff..0a3b6d71c2ec3fea13e3c1773b173603e6266f7e 100644 --- a/moose-core/basecode/SrcFinfo.h +++ b/moose-core/basecode/SrcFinfo.h @@ -17,14 +17,14 @@ #endif /* ----- CYMOOSE ----- */ /** - * This set of classes define Message Sources. Their main job is to supply + * This set of classes define Message Sources. Their main job is to supply * a type-safe send operation, and to provide typechecking for it. */ class SrcFinfo: public Finfo { public: - SrcFinfo( const string& name, const string& doc ); + SrcFinfo( const string& name, const string& doc ); ~SrcFinfo() {;} @@ -32,12 +32,12 @@ class SrcFinfo: public Finfo /////////////////////////////////////////////////////////////// - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { return 0; // always fails } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { return 0; // always fails } @@ -59,7 +59,7 @@ class SrcFinfo: public Finfo * Sends contents of buffer on to msg targets * Buffer has a header with the TgtInfo. */ - virtual void sendBuffer( const Eref& e, double* buf ) + virtual void sendBuffer( const Eref& e, double* buf ) const = 0; static const BindIndex BadBindIndex; @@ -79,7 +79,7 @@ class SrcFinfo0: public SrcFinfo SrcFinfo0( const string& name, const string& doc ); ~SrcFinfo0() {;} - + void send( const Eref& e ) const; void sendBuffer( const Eref& e, double* buf ) const; @@ -103,12 +103,12 @@ template < class T > class SrcFinfo1: public SrcFinfo : SrcFinfo( name, doc ) { ; } - void send( const Eref& er, T arg ) const + void send( const Eref& er, T arg ) const { const vector< MsgDigest >& md = er.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc1Base< T >* f = + const OpFunc1Base< T >* f = dynamic_cast< const OpFunc1Base< T >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -121,22 +121,22 @@ template < class T > class SrcFinfo1: public SrcFinfo f->op( Eref( e, k ), arg ); } else { f->op( *j, arg ); - // Need to send stuff offnode too here. The + // Need to send stuff offnode too here. The // target in this case is just the src Element. // Its ObjId gets stuffed into the send buf. // On the other node it will execute - // its own send command with the passed in args. + // its own send command with the passed in args. } } } } - void sendTo( const Eref& er, Id tgt, T arg ) const + void sendTo( const Eref& er, Id tgt, T arg ) const { const vector< MsgDigest >& md = er.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc1Base< T >* f = + const OpFunc1Base< T >* f = dynamic_cast< const OpFunc1Base< T >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -151,11 +151,11 @@ template < class T > class SrcFinfo1: public SrcFinfo f->op( Eref( e, k ), arg ); } else { f->op( *j, arg ); - // Need to send stuff offnode too here. The + // Need to send stuff offnode too here. The // target in this case is just the src Element. // Its ObjId gets stuffed into the send buf. // On the other node it will execute - // its own send command with the passed in args. + // its own send command with the passed in args. } } } @@ -166,7 +166,7 @@ template < class T > class SrcFinfo1: public SrcFinfo * Rolls over if the # of targets exceeds vector size. * Fails totally if the targets are off-node. */ - void sendVec( const Eref& er, const vector< T >& arg ) const + void sendVec( const Eref& er, const vector< T >& arg ) const { if ( arg.size() == 0 ) return; @@ -174,7 +174,7 @@ template < class T > class SrcFinfo1: public SrcFinfo unsigned int argPos = 0; for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc1Base< T >* f = + const OpFunc1Base< T >* f = dynamic_cast< const OpFunc1Base< T >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -192,11 +192,11 @@ template < class T > class SrcFinfo1: public SrcFinfo f->op( *j, arg[ argPos++ ] ); if ( argPos >= arg.size() ) argPos = 0; - // Need to send stuff offnode too here. The + // Need to send stuff offnode too here. The // target in this case is just the src Element. // Its ObjId gets stuffed into the send buf. // On the other node it will execute - // its own send command with the passed in args. + // its own send command with the passed in args. } } } @@ -221,7 +221,7 @@ template < class T1, class T2 > class SrcFinfo2: public SrcFinfo public: ~SrcFinfo2() {;} - SrcFinfo2( const string& name, const string& doc ) + SrcFinfo2( const string& name, const string& doc ) : SrcFinfo( name, doc ) { ; } @@ -230,7 +230,7 @@ template < class T1, class T2 > class SrcFinfo2: public SrcFinfo const vector< MsgDigest >& md = e.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc2Base< T1, T2 >* f = + const OpFunc2Base< T1, T2 >* f = dynamic_cast< const OpFunc2Base< T1, T2 >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -248,13 +248,13 @@ template < class T1, class T2 > class SrcFinfo2: public SrcFinfo } } - void sendTo( const Eref& e, Id tgt, + void sendTo( const Eref& e, Id tgt, const T1& arg1, const T2& arg2 ) const { const vector< MsgDigest >& md = e.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc2Base< T1, T2 >* f = + const OpFunc2Base< T1, T2 >* f = dynamic_cast< const OpFunc2Base< T1, T2 >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -298,18 +298,18 @@ template < class T1, class T2, class T3 > class SrcFinfo3: public SrcFinfo public: ~SrcFinfo3() {;} - SrcFinfo3( const string& name, const string& doc ) + SrcFinfo3( const string& name, const string& doc ) : SrcFinfo( name, doc ) { ; } - void send( const Eref& e, + void send( const Eref& e, const T1& arg1, const T2& arg2, const T3& arg3 ) const { const vector< MsgDigest >& md = e.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc3Base< T1, T2, T3 >* f = - dynamic_cast< const OpFunc3Base< T1, T2, T3 >* >( + const OpFunc3Base< T1, T2, T3 >* f = + dynamic_cast< const OpFunc3Base< T1, T2, T3 >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -348,20 +348,20 @@ template < class T1, class T2, class T3, class T4 > class SrcFinfo4: public SrcF public: ~SrcFinfo4() {;} - SrcFinfo4( const string& name, const string& doc ) + SrcFinfo4( const string& name, const string& doc ) : SrcFinfo( name, doc ) { ; } // Will need to specialize for strings etc. void send( const Eref& e, - const T1& arg1, const T2& arg2, + const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4 ) const { const vector< MsgDigest >& md = e.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc4Base< T1, T2, T3, T4 >* f = - dynamic_cast< const OpFunc4Base< T1, T2, T3, T4 >* >( + const OpFunc4Base< T1, T2, T3, T4 >* f = + dynamic_cast< const OpFunc4Base< T1, T2, T3, T4 >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -395,14 +395,14 @@ template < class T1, class T2, class T3, class T4 > class SrcFinfo4: public SrcF private: }; -template< class A1, class A2, class A3, class A4, class A5 > +template< class A1, class A2, class A3, class A4, class A5 > class OpFunc5Base; template < class T1, class T2, class T3, class T4, class T5 > class SrcFinfo5: public SrcFinfo { public: ~SrcFinfo5() {;} - SrcFinfo5( const string& name, const string& doc ) + SrcFinfo5( const string& name, const string& doc ) : SrcFinfo( name, doc ) { ; } @@ -414,8 +414,8 @@ template < class T1, class T2, class T3, class T4, class T5 > class SrcFinfo5: p const vector< MsgDigest >& md = e.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc5Base< T1, T2, T3, T4, T5 >* f = - dynamic_cast< + const OpFunc5Base< T1, T2, T3, T4, T5 >* f = + dynamic_cast< const OpFunc5Base< T1, T2, T3, T4, T5 >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -425,7 +425,7 @@ template < class T1, class T2, class T3, class T4, class T5 > class SrcFinfo5: p unsigned int start = e->localDataStart(); unsigned int end = start + e->numData(); for ( unsigned int k = start; k < end; ++k ) - f->op( Eref( e, k ), + f->op( Eref( e, k ), arg1, arg2, arg3, arg4, arg5 ); } else { f->op( *j, arg1, arg2, arg3, arg4, arg5 ); @@ -453,14 +453,14 @@ template < class T1, class T2, class T3, class T4, class T5 > class SrcFinfo5: p }; -template< class A1, class A2, class A3, class A4, class A5, class A6 > +template< class A1, class A2, class A3, class A4, class A5, class A6 > class OpFunc6Base; template < class T1, class T2, class T3, class T4, class T5, class T6 > class SrcFinfo6: public SrcFinfo { public: ~SrcFinfo6() {;} - SrcFinfo6( const string& name, const string& doc ) + SrcFinfo6( const string& name, const string& doc ) : SrcFinfo( name, doc ) { ; } @@ -471,9 +471,9 @@ template < class T1, class T2, class T3, class T4, class T5, class T6 > class Sr const vector< MsgDigest >& md = e.msgDigest( getBindIndex() ); for ( vector< MsgDigest >::const_iterator i = md.begin(); i != md.end(); ++i ) { - const OpFunc6Base< T1, T2, T3, T4, T5, T6 >* f = - dynamic_cast< - const OpFunc6Base< T1, T2, T3, T4, T5, T6 >* >( + const OpFunc6Base< T1, T2, T3, T4, T5, T6 >* f = + dynamic_cast< + const OpFunc6Base< T1, T2, T3, T4, T5, T6 >* >( i->func ); assert( f ); for ( vector< Eref >::const_iterator @@ -483,7 +483,7 @@ template < class T1, class T2, class T3, class T4, class T5, class T6 > class Sr unsigned int start = e->localDataStart(); unsigned int end = start + e->numData(); for ( unsigned int k = start; k < end; ++k ) - f->op( Eref( e, k ), + f->op( Eref( e, k ), arg1, arg2, arg3, arg4, arg5, arg6 ); } else { f->op( *j, arg1, arg2, arg3, arg4, arg5, arg6 ); diff --git a/moose-core/basecode/ValueFinfo.h b/moose-core/basecode/ValueFinfo.h index 6698fc4e4c38a27d80ce8df7f5d18d55e537fe1e..59792fd160e2402b0ff8d8fcb8e5dd50d7745691 100644 --- a/moose-core/basecode/ValueFinfo.h +++ b/moose-core/basecode/ValueFinfo.h @@ -10,7 +10,7 @@ #define _VALUE_FINFO_H /** - * This is the base class for all ValueFinfo classes. Used for doing + * This is the base class for all ValueFinfo classes. Used for doing * inspection using dynamic casts. */ class ValueFinfoBase: public Finfo @@ -41,7 +41,7 @@ template < class T, class F > class ValueFinfo: public ValueFinfoBase delete get_; } - ValueFinfo( const string& name, const string& doc, + ValueFinfo( const string& name, const string& doc, void ( T::*setFunc )( F ), F ( T::*getFunc )() const ) : ValueFinfoBase( name, doc ) @@ -68,12 +68,12 @@ template < class T, class F > class ValueFinfo: public ValueFinfoBase c->registerFinfo( get_ ); } - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { return Field< F >::innerStrSet( tgt.objId(), field, arg ); } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { return Field< F >::innerStrGet( tgt.objId(), field, returnValue ); } @@ -91,7 +91,7 @@ template < class T, class F > class ReadOnlyValueFinfo: public ValueFinfoBase delete get_; } - ReadOnlyValueFinfo( const string& name, const string& doc, + ReadOnlyValueFinfo( const string& name, const string& doc, F ( T::*getFunc )() const ) : ValueFinfoBase( name, doc ) { @@ -109,14 +109,14 @@ template < class T, class F > class ReadOnlyValueFinfo: public ValueFinfoBase c->registerFinfo( get_ ); } - bool strSet( const Eref& tgt, const string& field, + bool strSet( const Eref& tgt, const string& field, const string& arg ) const { return 0; } - bool strGet( const Eref& tgt, const string& field, + bool strGet( const Eref& tgt, const string& field, string& returnValue ) const { - return Field< F >::innerStrGet( + return Field< F >::innerStrGet( tgt.objId(), field, returnValue ); } diff --git a/moose-core/basecode/consts.cpp b/moose-core/basecode/consts.cpp index f0b93d081aa40f70426a3f83bdf7c1e4e21c7a38..30e1b50e30f7406d9f1e4d37be8764b6cde3067d 100644 --- a/moose-core/basecode/consts.cpp +++ b/moose-core/basecode/consts.cpp @@ -12,7 +12,7 @@ const double PI = 3.141592653589793; // There is experimental error in the last sig fig here. -const double NA = 6.0221415e23; +const double NA = 6.0221415e23; const double FaradayConst = 96485.3415; // s A / mol diff --git a/moose-core/basecode/global.cpp b/moose-core/basecode/global.cpp index ec5a523e78e911755e12565e854af321b5172ada..09ebeaa300be9dc29178ca89533ba62c242d773c 100644 --- a/moose-core/basecode/global.cpp +++ b/moose-core/basecode/global.cpp @@ -10,7 +10,7 @@ * Revision: 0.1 * Compiler: gcc/g++ * - * Author: Dilawar Singh + * Author: Dilawar Singh * Organization: Bhalla's lab, NCBS Bangalore * * ============================================================================== @@ -85,7 +85,7 @@ namespace moose { /** * @brief Set the global seed or all rngs. * - * @param x + * @param x */ void mtseed( unsigned int x ) { @@ -115,7 +115,7 @@ namespace moose { } /** - * @brief Create directories recursively needed to open the given file p. + * @brief Create directories recursively needed to open the given file p. * * @param path When successfully created, returns created path, else * convert path to a filename by replacing '/' by '_'. @@ -135,7 +135,7 @@ namespace moose { return true; #ifdef USE_BOOST - try + try { boost::filesystem::path pdirs( p ); boost::filesystem::create_directories( pdirs ); @@ -152,14 +152,15 @@ namespace moose { #else /* ----- not USE_BOOST ----- */ string command( "mkdir -p "); command += p; - system( command.c_str() ); + int ret = system( command.c_str() ); + cout << "+ Return code " << ret << endl; struct stat info; if( stat( p.c_str(), &info ) != 0 ) { LOG( moose::warning, "cannot access " << p ); return false; } - else if( info.st_mode & S_IFDIR ) + else if( info.st_mode & S_IFDIR ) { LOG( moose::info, "Created directory " << p ); return true; @@ -210,7 +211,7 @@ namespace moose { return createMOOSEPath( path ); } - /* Return formatted string + /* Return formatted string * Precision is upto 17 decimal points. */ string toString( double x ) @@ -219,4 +220,5 @@ namespace moose { sprintf(buffer, "%.17g", x ); return string( buffer ); } + } diff --git a/moose-core/basecode/global.h b/moose-core/basecode/global.h index 9b06b2820245f1ef4d8fd0639be1b3e6f42a5a13..1cfef1647f3f29f6788287dd895327987babf316 100644 --- a/moose-core/basecode/global.h +++ b/moose-core/basecode/global.h @@ -46,7 +46,7 @@ extern unsigned int totalTests; #define TEST_BEGIN cout << endl << "Test(" << totalTests << "): " << SIMPLE_CURRENT_FUNCTION; #define TEST_END totalTests++; \ - cout << std::right << setw(20) << "test of " << SIMPLE_CURRENT_FUNCTION << " finished."; + cout << std::right << setw(20) << "test of " << SIMPLE_CURRENT_FUNCTION << " finished."; /*----------------------------------------------------------------------------- * Global functions in namespace moose @@ -82,7 +82,7 @@ namespace moose string fixPath(string path); /** - * @brief Checks if given path is correct. + * @brief Checks if given path is correct. * If not, return false and error-code as well. * * @param path Path name. @@ -91,13 +91,13 @@ namespace moose */ int checkPath( const string& path ); - /** @brief Append pathB to pathA and return the result. + /** @brief Append pathB to pathA and return the result. * * If pathA does not have [indexs] at the end, append "[0]" to pathA and * then add pathB to it. This version does not care if the result has '[0]' * at its end. * - * @param pathA First path. + * @param pathA First path. * @param pathB Second path. * * @return A string representing moose-path. @@ -147,7 +147,7 @@ namespace moose * which can be created in current directory without any need to create * parent directory. * - * @param path string + * @param path string * * @return filename without directory separator. */ @@ -179,9 +179,10 @@ namespace moose * * @param path Removed '[0]' from path and return. * - * @return + * @return */ string moosePathToUserPath( string path ); + } #endif /* ----- #ifndef __MOOSE_GLOBAL_INC_ ----- */ diff --git a/moose-core/basecode/header.h b/moose-core/basecode/header.h index 20f3cc1eb2454cae4430f3dce6fd2efc182c095f..629560048afea7b908aedbe70e5c3c2737dbfb87 100644 --- a/moose-core/basecode/header.h +++ b/moose-core/basecode/header.h @@ -40,7 +40,7 @@ using namespace std; */ typedef unsigned int FuncId; -/** +/** * Looks up data entries. */ typedef unsigned int DataId; diff --git a/moose-core/basecode/main.cpp b/moose-core/basecode/main.cpp index dae67a9858922dd8901351c4c04e2c80ab68348f..d6b2822623007c0be89094ddf507b56e8d113e8b 100644 --- a/moose-core/basecode/main.cpp +++ b/moose-core/basecode/main.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include "header.h" - + #ifndef WIN32 #include <sys/time.h> #else diff --git a/moose-core/basecode/testAsync.cpp b/moose-core/basecode/testAsync.cpp index e96557f80ddec7d82895d3cace6bbda0de1a7b95..b615611b9f62ab724b91141796a7669086d85965 100644 --- a/moose-core/basecode/testAsync.cpp +++ b/moose-core/basecode/testAsync.cpp @@ -91,7 +91,7 @@ void testSendMsg() assert( ver[55].size() == 1 ); assert( ver[55][0].element() == e2.element() ); assert( ver[55][0].dataIndex() == 55 ); - + SrcFinfo1<double> s( "test", "" ); s.setBindIndex( 0 ); e1.element()->addMsgAndFunc( m->mid(), fid, s.getBindIndex() ); @@ -142,7 +142,7 @@ void testCreateMsg() const Finfo* f2 = ac->findFinfo( "arg1" ); assert( f2 ); bool ret = f1->addMsg( f2, m->mid(), e1.element() ); - + assert( ret ); // e1.element()->digestMessages(); @@ -174,7 +174,7 @@ void testSetGet() Element* ret = new GlobalDataElement( i2, ac, "test2", size ); assert( ret ); ProcInfo p; - + for ( unsigned int i = 0; i < size; ++i ) { ObjId oid( i2, i ); double x = i * 3.14; @@ -213,7 +213,7 @@ void testStrSet() bool ok = SetGet::strSet( ObjId( i2, 0 ), "name", "NewImprovedTest" ); assert( ok ); assert( ret->getName() == "NewImprovedTest" ); - + for ( unsigned int i = 0; i < size; ++i ) { double x = sqrt((double) i ); // Eref dest( e2.element(), i ); @@ -227,7 +227,7 @@ void testStrSet() for ( unsigned int i = 0; i < size; ++i ) { double temp = sqrt((double) i ); - double val = reinterpret_cast< Arith* >( + double val = reinterpret_cast< Arith* >( Eref( i2.element(), i ).data() )->getOutput(); assert( fabs( val - temp ) < 1e-5 ); // DoubleEq won't work here because string is truncated. @@ -256,7 +256,7 @@ void testGet() ret->setName( "HupTwoThree" ); val = Field< string >::get( oid, "name" ); assert( val == "HupTwoThree" ); - + for ( unsigned int i = 0; i < size; ++i ) { double temp = i * 3; reinterpret_cast< Arith* >(oid.element()->data( i ))->setOutput( temp ); @@ -296,7 +296,7 @@ void testStrGet() ok = SetGet::strGet( oid, "name", val ); assert( ok ); assert( val == "HupTwoThree" ); - + for ( unsigned int i = 0; i < size; ++i ) { double temp = i * 3; reinterpret_cast< Arith* >( ObjId( i2, i ).data() )->setOutput( temp ); @@ -336,7 +336,7 @@ void testSetGetDouble() double temp = i; bool ret = Field< double >::set( oid, "Vm", temp ); assert( ret ); - assert( + assert( doubleEq ( reinterpret_cast< IntFire* >(oid.data())->getVm() , temp ) ); } @@ -384,7 +384,7 @@ void testSetGetSynapse() for ( unsigned int i = 0; i < size; ++i ) { assert( syns.element()->numField( i ) == i ); - SimpleSynHandler* s = + SimpleSynHandler* s = reinterpret_cast< SimpleSynHandler* >( temp->data( i ) ); assert( s->getNumSynapses() == i ); for ( unsigned int j = 0; j < i; ++j ) { @@ -415,7 +415,7 @@ void testSetGetVec() vector< unsigned int > numSyn( size, 0 ); for ( unsigned int i = 0; i < size; ++i ) numSyn[i] = i; - + Eref e2( i2.element(), 0 ); // Here we test setting a 1-D vector bool ret = Field< unsigned int >::setVec( i2, "numSynapse", numSyn ); @@ -497,7 +497,7 @@ void printSparseMatrix( const SparseMatrix< unsigned int >& m) { unsigned int nRows = m.nRows(); unsigned int nCols = m.nColumns(); - + for ( unsigned int i = 0; i < nRows; ++i ) { cout << "[ "; for ( unsigned int j = 0; j < nCols; ++j ) { @@ -529,7 +529,7 @@ void testSparseMatrix() static unsigned int postN[] = { 1, 3, 4, 5, 6, 2, 7 }; static unsigned int preColIndex[] = { 0, 4, 0, 1, 2, 3, 4 }; static unsigned int postColIndex[] = { 0, 1, 1, 1, 2, 0, 2 }; - + static unsigned int dropN[] = { 1, 6, 2, 7 }; static unsigned int dropColIndex[] = { 0, 1, 0, 1 }; @@ -624,7 +624,7 @@ void testSparseMatrix2() for ( unsigned int j = 0; j < 10; ++j ) if ( m[i][j] != 0 ) n.set( i, j, m[i][j] ); - + n.transpose(); for ( unsigned int i = 0; i < 10; ++i ) for ( unsigned int j = 0; j < 10; ++j ) @@ -638,7 +638,7 @@ void testSparseMatrix2() // Drop columns 2 and 7. /////////////////////////////////////////////////////////////// static unsigned int init[] = {0, 1, 3, 4, 5, 6, 8, 9}; - vector< unsigned int > keepCols( + vector< unsigned int > keepCols( init, init + sizeof( init ) / sizeof( unsigned int ) ); n.reorderColumns( keepCols ); for ( unsigned int i = 0; i < 10; ++i ) { @@ -778,7 +778,7 @@ void printGrid( Element* e, const string& field, double min, double max ) unsigned int xside = e->numData() / yside; if ( e->numData() % yside > 0 ) xside++; - + for ( unsigned int i = 0; i < e->numData(); ++i ) { if ( ( i % xside ) == 0 ) cout << endl; @@ -856,7 +856,7 @@ void testSparseMsg() vector< double > delay( size * fieldSize, 0.0 ); for ( unsigned int i = 0; i < size; ++i ) { ObjId id( sshid, i ); - unsigned int numSyn = + unsigned int numSyn = Field< unsigned int >::get( id, "numSynapse" ); unsigned int k = i * fieldSize; for ( unsigned int j = 0; j < numSyn; ++j ) { @@ -903,7 +903,7 @@ void test2ArgSetVec() } SetGet2< double, double >::setVec( i2, "arg1x2", arg1, arg2 ); - + for ( unsigned int i = 0; i < size; ++i ) { ObjId oid( i2, i ); double x = i * 100 * ( 100 - i ); @@ -960,11 +960,11 @@ void testSetRepeat() vector< unsigned int > numSyn( size, 0 ); for ( unsigned int i = 0; i < size; ++i ) numSyn[i] = i; - + // Here we test setting a 1-D vector bool ret = Field< unsigned int >::setVec( cell, "numSynapse", numSyn); assert( ret ); - + Id synapse( cell.value() + 1 ); // Here we test setting a 2-D array with different dims on each axis. for ( unsigned int i = 0; i < size; ++i ) { @@ -1037,7 +1037,7 @@ class Test sizeof( testFinfos ) / sizeof( Finfo* ), &dinfo ); - + return &testCinfo; } @@ -1055,9 +1055,9 @@ void testSharedMsg() static SrcFinfo2< int, int > s2( "s2", "" ); static DestFinfo d0( "d0", "", new OpFunc0< Test >( & Test::handleS0 ) ); - static DestFinfo d1( "d1", "", + static DestFinfo d1( "d1", "", new EpFunc1< Test, string >( &Test::handleS1 ) ); - static DestFinfo d2( "d2", "", + static DestFinfo d2( "d2", "", new EpFunc2< Test, int, int >( &Test::handleS2 ) ); Test::sharedVec[0] = &s0; @@ -1066,7 +1066,7 @@ void testSharedMsg() Test::sharedVec[3] = &d1; Test::sharedVec[4] = &s2; Test::sharedVec[5] = &d2; - + Id t1 = Id::nextId(); Id t2 = Id::nextId(); // bool ret = Test::initCinfo()->create( t1, "test1", 1 ); @@ -1090,7 +1090,7 @@ void testSharedMsg() // Set up message. The actual routine is in Shell.cpp, but here we // do it independently. - + const Finfo* shareFinfo = Test::initCinfo()->findFinfo( "shared" ); assert( shareFinfo != 0 ); Msg* m = new OneToOneMsg( t1.eref(), t2.eref(), 0 ); @@ -1115,15 +1115,15 @@ void testSharedMsg() s2.send( t2.eref(), 500, 600 ); /* - cout << "data1: s=" << tdata1->s_ << - ", i1=" << tdata1->i1_ << ", i2=" << tdata1->i2_ << + cout << "data1: s=" << tdata1->s_ << + ", i1=" << tdata1->i1_ << ", i2=" << tdata1->i2_ << ", numAcks=" << tdata1->numAcks_ << endl; - cout << "data2: s=" << tdata2->s_ << + cout << "data2: s=" << tdata2->s_ << ", i1=" << tdata2->i1_ << ", i2=" << tdata2->i2_ << ", numAcks=" << tdata2->numAcks_ << endl; */ // Check results - + assert( tdata1->s_ == " goodbye tdata1" ); assert( tdata2->s_ == " hello TDATA2" ); assert( tdata1->i1_ == 5001 ); @@ -1132,7 +1132,7 @@ void testSharedMsg() assert( tdata2->i2_ == 2006 ); assert( tdata1->numAcks_ == 2 ); assert( tdata2->numAcks_ == 2 ); - + t1.destroy(); t2.destroy(); @@ -1144,7 +1144,7 @@ void testConvVector() vector< unsigned int > intVec; for ( unsigned int i = 0; i < 5; ++i ) intVec.push_back( i * i ); - + double buf[500]; double* tempBuf = buf; @@ -1179,9 +1179,9 @@ void testConvVector() assert( sz == 1 + 2 + ( strVec[2].length() + 8) /8 + ( strVec[3].length() + 8 )/8 ); assert( buf[0] == 4 ); assert( strcmp( reinterpret_cast< char* >( buf + 1 ), "one" ) == 0 ); - + tempBuf = buf; - const vector< string >& tgtStr = + const vector< string >& tgtStr = Conv< vector< string > >::buf2val( &tempBuf ); assert( tgtStr.size() == 4 ); for ( unsigned int i = 0; i < 4; ++i ) @@ -1207,7 +1207,7 @@ void testConvVectorOfVectors() vec[4].insert( vec[4].end(), row4, row4 + 4 ); vec[5].insert( vec[5].end(), row5, row5 + 5 ); - double expected[] = { + double expected[] = { 6, // Number of sub-vectors 0, // No entries on first sub-vec 1, 1, @@ -1227,10 +1227,10 @@ void testConvVectorOfVectors() assert( buf == 22 + origBuf ); for ( unsigned int i = 0; i < 22; ++i ) assert( doubleEq( origBuf[i], expected[i] ) ); - + double* buf2 = origBuf; const vector< vector< short > >& rc = conv.buf2val( &buf2 ); - + assert( rc.size() == 6 ); for ( unsigned int i = 0; i < 6; ++i ) { assert( rc[i].size() == i ); @@ -1270,7 +1270,7 @@ void testMsgField() assert ( sm == m ); assert( sm->getI1() == 5 ); assert( sm->getI2() == 3 ); - + SrcFinfo1<double> s( "test", "" ); s.setBindIndex( 0 ); e1.element()->addMsgAndFunc( m->mid(), fid, s.getBindIndex() ); @@ -1381,7 +1381,7 @@ void testSetGetExtField() double temp2 = temp * temp; double ret = Field< double >::get( a, "x" ); assert( doubleEq( temp, ret ) ); - + ret = Field< double >::get( b, "y" ); assert( doubleEq( temp2, ret ) ); @@ -1446,7 +1446,7 @@ void testLookupSetGet() ret = LookupField< unsigned int, double >::get( obj, "anyValue", 3 ); assert( doubleEq( ret, 54 ) ); - + cout << "." << flush; i2.destroy(); } @@ -1497,7 +1497,7 @@ void testFinfoFields() assert( procFinfo.dest()[1] == "reinit" ); // cout << "proc " << procFinfo.type() << endl; assert( procFinfo.type() == "void" ); - + assert( processFinfo.getName() == "process" ); assert( processFinfo.docs() == "Handles process call" ); assert( processFinfo.src().size() == 0 ); @@ -1600,10 +1600,10 @@ void testCinfoElements() assert( intFireCinfoId != Id() ); assert( Field< string >::get( intFireCinfoId, "name" ) == "IntFire" ); - assert( Field< string >::get( intFireCinfoId, "baseClass" ) == + assert( Field< string >::get( intFireCinfoId, "baseClass" ) == "Neutral" ); Id intFireValueFinfoId( "/classes/IntFire/valueFinfo" ); - unsigned int n = Field< unsigned int >::get( + unsigned int n = Field< unsigned int >::get( intFireValueFinfoId, "numData" ); assert( n == 4 ); Id intFireSrcFinfoId( "/classes/IntFire/srcFinfo" ); @@ -1614,7 +1614,7 @@ void testCinfoElements() assert( intFireDestFinfoId != Id() ); n = Field< unsigned int >::get( intFireDestFinfoId, "numData" ); assert( n == 11 ); - + ObjId temp( intFireSrcFinfoId, 0 ); string foo = Field< string >::get( temp, "fieldName" ); assert( foo == "spikeOut" ); @@ -1644,9 +1644,9 @@ void testMsgSrcDestFields() static SrcFinfo2< int, int > s2( "s2", "" ); static DestFinfo d0( "d0", "", new OpFunc0< Test >( & Test::handleS0 ) ); - static DestFinfo d1( "d1", "", + static DestFinfo d1( "d1", "", new EpFunc1< Test, string >( &Test::handleS1 ) ); - static DestFinfo d2( "d2", "", + static DestFinfo d2( "d2", "", new EpFunc2< Test, int, int >( &Test::handleS2 ) ); Test::sharedVec[0] = &s0; @@ -1656,7 +1656,7 @@ void testMsgSrcDestFields() Test::sharedVec[4] = &s2; Test::sharedVec[5] = &d2; */ - + Id t1 = Id::nextId(); Id t2 = Id::nextId(); // bool ret = Test::initCinfo()->create( t1, "test1", 1 ); @@ -1741,7 +1741,7 @@ void testMsgSrcDestFields() ////////////////////////////////////////////////////////////// vector< ObjId > tgt; vector< string > func; - unsigned int numTgt = e1->getMsgTargetAndFunctions( 0, + unsigned int numTgt = e1->getMsgTargetAndFunctions( 0, dynamic_cast< SrcFinfo* >(Test::sharedVec[0] ), tgt, func ); assert( numTgt == tgt.size() ); @@ -1750,7 +1750,7 @@ void testMsgSrcDestFields() assert( func[0] == "d0" ); // Note that the srcFinfo #2 is in sharedVec[4] - numTgt = e2->getMsgTargetAndFunctions( 0, + numTgt = e2->getMsgTargetAndFunctions( 0, dynamic_cast< SrcFinfo* >(Test::sharedVec[4] ), tgt, func ); assert( numTgt == tgt.size() ); @@ -1763,9 +1763,9 @@ void testMsgSrcDestFields() ////////////////////////////////////////////////////////////// vector< ObjId > source; vector< string > sender; - FuncId fid = + FuncId fid = static_cast< const DestFinfo* >( Test::sharedVec[5] )->getFid(); - unsigned int numSrc = t2.element()->getMsgSourceAndSender( + unsigned int numSrc = t2.element()->getMsgSourceAndSender( fid, source, sender ); assert( numSrc == 1 ); assert( source.size() == 1 ); @@ -1793,7 +1793,7 @@ void testHopFunc() const TgtInfo* tgt = reinterpret_cast< const TgtInfo* >( buf ); assert( tgt->bindIndex() == 1234 ); assert( tgt->dataSize() == 2 ); - const char* c = reinterpret_cast< const char* >( + const char* c = reinterpret_cast< const char* >( buf + TgtInfo::headerSize ); assert( strcmp( c, "two" ) == 0 ); assert( doubleEq( buf[TgtInfo::headerSize + 1], 2468.0 ) ); diff --git a/moose-core/benchmarks/CMakeLists.txt b/moose-core/benchmarks/CMakeLists.txt index 66b1e659e150ccaf3681ab195b403760b71fc3b8..84b460a3018c31168e432707e34f5dd85036d9af 100644 --- a/moose-core/benchmarks/CMakeLists.txt +++ b/moose-core/benchmarks/CMakeLists.txt @@ -1,14 +1,14 @@ include_directories(../msg) include_directories(../basecode) -add_library(benchmarks +add_library(benchmarks benchmarks.cpp kineticMarks.cpp ) if(ENABLE_BENCHMARKS) # This target run benchmarks. Not a part of moose distribution - add_executable( - randnum_benchmark + add_executable( + randnum_benchmark ${CMAKE_CURRENT_SOURCE_DIR}/benchmark_random_numbers.cpp ) target_link_libraries(randnum_benchmark randnum ) diff --git a/moose-core/biophysics/CMakeLists.txt b/moose-core/biophysics/CMakeLists.txt index c36def8e3799492b1dd42eeed476f476515719a8..91444adae65cb960c3dd9dbf6330c2e498376d44 100644 --- a/moose-core/biophysics/CMakeLists.txt +++ b/moose-core/biophysics/CMakeLists.txt @@ -6,47 +6,47 @@ if(WITH_GSL) endif(WITH_GSL) set(BIOPHYSICS_SRCS - IntFire.cpp - SpikeGen.cpp + IntFire.cpp + SpikeGen.cpp RandSpike.cpp - CompartmentDataHolder.cpp - CompartmentBase.cpp - Compartment.cpp - SymCompartment.cpp + CompartmentDataHolder.cpp + CompartmentBase.cpp + Compartment.cpp + SymCompartment.cpp GapJunction.cpp - ChanBase.cpp + ChanBase.cpp ChanCommon.cpp - HHChannel.cpp + HHChannel.cpp HHChannelBase.cpp HHChannel2D.cpp - HHGate.cpp - HHGate2D.cpp - HHChannel2D.cpp + HHGate.cpp + HHGate2D.cpp + HHChannel2D.cpp CaConcBase.cpp - CaConc.cpp - MgBlock.cpp + CaConc.cpp + MgBlock.cpp Nernst.cpp - Neuron.cpp - ReadCell.cpp + Neuron.cpp + ReadCell.cpp SwcSegment.cpp ReadSwc.cpp - SynChan.cpp + SynChan.cpp NMDAChan.cpp - testBiophysics.cpp + testBiophysics.cpp IzhikevichNrn.cpp DifShellBase.cpp DifShell.cpp DifBufferBase.cpp DifBuffer.cpp MMPump.cpp - Leakage.cpp - VectorTable.cpp - MarkovRateTable.cpp - MarkovChannel.cpp - MatrixOps.cpp - MarkovSolverBase.cpp - MarkovSolver.cpp - VClamp.cpp + Leakage.cpp + VectorTable.cpp + MarkovRateTable.cpp + MarkovChannel.cpp + MatrixOps.cpp + MarkovSolverBase.cpp + MarkovSolver.cpp + VClamp.cpp Spine.cpp ) diff --git a/moose-core/biophysics/CaConc.h b/moose-core/biophysics/CaConc.h index 4fba37acbea69f8d8a7119d295689a1d0420ba40..5aadb1d62cdc1bdb51a0c3f6b75e304107dbc89a 100644 --- a/moose-core/biophysics/CaConc.h +++ b/moose-core/biophysics/CaConc.h @@ -30,7 +30,7 @@ * compartment. Otherwise, it scales as a true shell, with the * volume of a shell having thickness thick. A negative value of * the "density" parameter may be used to indicate that it should - * be taken as an absolute value of B, without scaling. + * be taken as an absolute value of B, without scaling. */ class CaConc: public CaConcBase diff --git a/moose-core/biophysics/CaConcBase.h b/moose-core/biophysics/CaConcBase.h index ee237da17ca1c48b02dc497b8ef6d32ff0bb04b8..c215e84e52b05a7805fb7ffd0ac693942f92fae5 100644 --- a/moose-core/biophysics/CaConcBase.h +++ b/moose-core/biophysics/CaConcBase.h @@ -30,7 +30,7 @@ * compartment. Otherwise, it scales as a true shell, with the * volume of a shell having thickness thick. A negative value of * the "density" parameter may be used to indicate that it should - * be taken as an absolute value of B, without scaling. + * be taken as an absolute value of B, without scaling. * * This is a base class to provide the interface functions. */ @@ -99,7 +99,7 @@ class CaConcBase /////////////////////////////////////////////////////////////// // Utility function in case length, dia or thickness is updated void updateDimensions( const Eref& e ); - + /// Used to set up the solver. Dummy for regular classes. virtual void vSetSolver( const Eref& e, Id hsolve ); @@ -111,7 +111,7 @@ class CaConcBase /* * This Finfo is used to send out Ca concentration to channels. - * + * * It is exposed here so that HSolve can also use it to send out * Ca concentration to the recipients. */ diff --git a/moose-core/biophysics/ChanCommon.cpp b/moose-core/biophysics/ChanCommon.cpp index bd85a6cffe761251ee051f3b5f9d3970991c81a6..9a015e4fc90f38cd64b9b9dc5e42840f68c31c3b 100644 --- a/moose-core/biophysics/ChanCommon.cpp +++ b/moose-core/biophysics/ChanCommon.cpp @@ -17,7 +17,7 @@ ChanCommon::ChanCommon() : Vm_( 0.0 ), - Gbar_( 0.0 ), modulation_( 1.0 ), + Gbar_( 0.0 ), modulation_( 1.0 ), Ek_( 0.0 ), Gk_( 0.0 ), Ik_( 0.0 ) { diff --git a/moose-core/biophysics/ChanCommon.h b/moose-core/biophysics/ChanCommon.h index e92573fb0b899ed835694a56909dfde6c9c5ffcd..007c2f3785197cbb942224a1a475213c8dc0b536 100644 --- a/moose-core/biophysics/ChanCommon.h +++ b/moose-core/biophysics/ChanCommon.h @@ -13,8 +13,8 @@ #define _ChanCommon_h /** - * The ChanCommon.g handles the data fields for all ion channel classes - * in MOOSE, when they are using regular ee calculations rather than + * The ChanCommon.g handles the data fields for all ion channel classes + * in MOOSE, when they are using regular ee calculations rather than * being zombified by the solver. */ @@ -37,7 +37,7 @@ class ChanCommon: public virtual ChanBase double vGetEk( const Eref& e ) const; void vSetGk( const Eref& e, double Gk ); double vGetGk( const Eref& e ) const; - /// Ik is read-only for MOOSE, but we provide the set + /// Ik is read-only for MOOSE, but we provide the set /// func for derived classes to update it. void vSetIk( const Eref& e, double Ic ); double vGetIk( const Eref& e ) const; diff --git a/moose-core/biophysics/Compartment.h b/moose-core/biophysics/Compartment.h index dcae6c0fb29148754c5dad20b0ee8a359dd1b519..b5c3de0455466edc5f8367841294937bb024b788 100644 --- a/moose-core/biophysics/Compartment.h +++ b/moose-core/biophysics/Compartment.h @@ -58,8 +58,8 @@ class Compartment: public CompartmentBase * The initProc function is for a second phase of 'process' * operations. It sends the axial and raxial messages * to other compartments. It has to be executed out of phase - * with the main process so that all compartments are - * equivalent and there is no calling order dependence in + * with the main process so that all compartments are + * equivalent and there is no calling order dependence in * the results. */ void vInitProc( const Eref& e, ProcPtr p ); diff --git a/moose-core/biophysics/CompartmentBase.h b/moose-core/biophysics/CompartmentBase.h index 9e10786bf6fd5370a3bd3c802c0ea9d722f84d4f..a494a2c1b41313e7e2125efe2ac9cff79f4dd9e6 100644 --- a/moose-core/biophysics/CompartmentBase.h +++ b/moose-core/biophysics/CompartmentBase.h @@ -21,7 +21,7 @@ class SrcFinfo1; /** * The CompartmentBase class sets up the interface for all the - * derived Compartment classes, used in + * derived Compartment classes, used in * branched nerve calculations. Handles electronic structure and * also channels. */ @@ -82,8 +82,8 @@ class CompartmentBase * The initProc function is for a second phase of 'process' * operations. It sends the axial and raxial messages * to other compartments. It has to be executed out of phase - * with the main process so that all compartments are - * equivalent and there is no calling order dependence in + * with the main process so that all compartments are + * equivalent and there is no calling order dependence in * the results. */ void initProc( const Eref& e, ProcPtr p ); @@ -137,7 +137,7 @@ class CompartmentBase void displace( double dx, double dy, double dz ); /// Scales electrical values along with setting length, dia - void setGeomAndElec( const Eref& e, + void setGeomAndElec( const Eref& e, double length, double dia ); ///////////////////////////////////////////////////////////// // Here we define the virtual functions for each of the above @@ -176,8 +176,8 @@ class CompartmentBase * The initProc function is for a second phase of 'process' * operations. It sends the axial and raxial messages * to other compartments. It has to be executed out of phase - * with the main process so that all compartments are - * equivalent and there is no calling order dependence in + * with the main process so that all compartments are + * equivalent and there is no calling order dependence in * the results. */ virtual void vInitProc( const Eref& e, ProcPtr p ) = 0; @@ -224,9 +224,9 @@ class CompartmentBase ///////////////////////////////////////////////////////////// // Required for solver setup ///////////////////////////////////////////////////////////// - + virtual void vSetSolver( const Eref& e, Id hsolve ); - + ///////////////////////////////////////////////////////////// /** * A utility function to check for assignment to fields that @@ -246,7 +246,7 @@ class CompartmentBase /** * This Finfo is used to send out Vm to channels, spikegens, etc - * + * * It is exposed here so that HSolve can also use it to send out * the Vm to the recipients. */ diff --git a/moose-core/biophysics/CompartmentDataHolder.cpp b/moose-core/biophysics/CompartmentDataHolder.cpp index 29a6e395b5b05fbf75131df52d5a1fbd6b553b2c..88940dc45edd89e8e849434b7aef787bb38b9c00 100644 --- a/moose-core/biophysics/CompartmentDataHolder.cpp +++ b/moose-core/biophysics/CompartmentDataHolder.cpp @@ -21,7 +21,7 @@ CompartmentDataHolder::CompartmentDataHolder() Em_( -0.06 ), initVm_( -0.06 ), inject_( 0.0 ), - + diameter_( 1.0e-6 ), length_( 100.0e-6 ), x0_( 0.0 ), diff --git a/moose-core/biophysics/CompartmentDataHolder.h b/moose-core/biophysics/CompartmentDataHolder.h index ce6134edde5e9a63e39fe1c1993edcc350194974..f0d61249c59dbb0d30f02325668be19a24519ec7 100644 --- a/moose-core/biophysics/CompartmentDataHolder.h +++ b/moose-core/biophysics/CompartmentDataHolder.h @@ -16,7 +16,7 @@ namespace moose { -class CompartmentDataHolder +class CompartmentDataHolder { public: CompartmentDataHolder(); @@ -29,7 +29,7 @@ class CompartmentDataHolder double Em_; double initVm_; double inject_; - + double diameter_; double length_; double x0_; diff --git a/moose-core/biophysics/DifBuffer.cpp b/moose-core/biophysics/DifBuffer.cpp index 65efe337cdaf66b24062bc2371250aa34c172ced..7e34e8a57c10748cb49a82a5b80da79bd6cabd21 100644 --- a/moose-core/biophysics/DifBuffer.cpp +++ b/moose-core/biophysics/DifBuffer.cpp @@ -1,4 +1,4 @@ -// DifBuffer.cpp --- +// DifBuffer.cpp --- // // Filename: DifBuffer.cpp // Description: @@ -367,12 +367,12 @@ double DifBuffer::integrate( double state, double dt, double A, double B ) void DifBuffer::calculateVolumeArea(const Eref& e) { double rOut = diameter_/2.; - + double rIn = rOut - thickness_; if (rIn <0) rIn = 0.; - + switch ( shapeMode_ ) { /* @@ -388,9 +388,9 @@ double rOut = diameter_/2.; outerArea_ = 2*M_PI * rOut * length_; innerArea_ = 2*M_PI * rIn * length_; } - + break; - + /* * Cylindrical Slice */ @@ -399,7 +399,7 @@ double rOut = diameter_/2.; outerArea_ = M_PI * diameter_ * diameter_ / 4.0; innerArea_ = outerArea_; break; - + /* * User defined */ @@ -407,7 +407,7 @@ double rOut = diameter_/2.; // Nothing to be done here. Volume and inner-, outer areas specified by // user. break; - + default: assert( 0 ); } diff --git a/moose-core/biophysics/DifBuffer.h b/moose-core/biophysics/DifBuffer.h index 94d47fe2be251caa21dfa23dc05368070b6dbe1d..bfd28f36d28f2ac3363b332893377da283897505 100644 --- a/moose-core/biophysics/DifBuffer.h +++ b/moose-core/biophysics/DifBuffer.h @@ -13,12 +13,12 @@ class DifBuffer: public DifBufferBase{ public: DifBuffer(); - + void vBuffer(const Eref& e,double C); void vReinit( const Eref & e, ProcPtr p ); void vProcess(const Eref & e, ProcPtr p ); void vFluxFromOut(const Eref& e,double outerC, double outerThickness ); - void vFluxFromIn( const Eref& e,double innerC, double innerThickness ); + void vFluxFromIn( const Eref& e,double innerC, double innerThickness ); //Field access functions double vGetActivation(const Eref& e) const; @@ -38,7 +38,7 @@ class DifBuffer: public DifBufferBase{ double vGetKb(const Eref& e) const; // backward rate constant in 1/sec void vSetKb(const Eref& e,double value); - + double vGetD(const Eref& e) const; // diffusion constant of buffer molecules, m^2/sec void vSetD(const Eref& e,double value); void vSetShapeMode(const Eref& e, unsigned int shapeMode ); @@ -52,10 +52,10 @@ class DifBuffer: public DifBufferBase{ void vSetThickness(const Eref& e, double thickness ); double vGetThickness(const Eref& e) const; - + void vSetVolume(const Eref& e, double volume ); double vGetVolume(const Eref& e) const; - + void vSetOuterArea(const Eref& e, double outerArea ); double vGetOuterArea(const Eref& e) const; @@ -66,10 +66,10 @@ class DifBuffer: public DifBufferBase{ static const Cinfo * initCinfo(); private: - - + + double integrate(double state, double dt, double A, double B ); - + double activation_; //ion concentration from incoming CONCEN message double Af_; double Bf_; diff --git a/moose-core/biophysics/DifBufferBase.h b/moose-core/biophysics/DifBufferBase.h index 00618d8c5349863cebd15dae2a803739c80a8aed..831986fcc62fbd952df1fc9a527d7453b3aef3cc 100644 --- a/moose-core/biophysics/DifBufferBase.h +++ b/moose-core/biophysics/DifBufferBase.h @@ -15,7 +15,7 @@ class DifBufferBase { public: DifBufferBase(); - + void buffer(const Eref& e,double C); void reinit( const Eref & e, ProcPtr p ); void process(const Eref & e, ProcPtr p ); @@ -33,10 +33,10 @@ public: double getBFree(const Eref& e) const; void setBFree(const Eref& e,double value); - + double getBBound(const Eref& e) const; void setBBound(const Eref& e,double value); - + double getBTot(const Eref& e) const; // total buffer concentration in mM (free + bound) void setBTot(const Eref& e,double value); @@ -45,12 +45,12 @@ public: double getKb(const Eref& e) const; // backward rate constant in 1/sec void setKb(const Eref& e,double value); - + double getD(const Eref& e) const; // diffusion constant of buffer molecules, m^2/sec void setD(const Eref& e,double value); - - unsigned int getShapeMode(const Eref& e) const; + + unsigned int getShapeMode(const Eref& e) const; void setShapeMode(const Eref& e,unsigned int value); // variables SHELL=0, SLICE=SLAB=1, USERDEF=3. double getLength(const Eref& e) const; // shell length @@ -58,29 +58,29 @@ public: double getDiameter(const Eref& e) const; // shell diameter void setDiameter(const Eref& e,double value); - + double getThickness(const Eref& e) const; // shell thickness void setThickness(const Eref& e,double value); - + void setOuterArea( const Eref& e,double outerArea ); double getOuterArea(const Eref& e) const; // area of upper (outer) shell surface - + void setInnerArea( const Eref& e,double innerArea ); double getInnerArea(const Eref& e) const; // area of lower (inner) shell surface double getVolume(const Eref& e) const; // shell volume void setVolume(const Eref& e,double volume); // - + virtual double vGetActivation(const Eref& e) const = 0; virtual void vSetActivation(const Eref& e,double value) = 0; virtual double vGetBFree(const Eref& e) const = 0; virtual void vSetBFree(const Eref& e,double value) = 0; - + virtual double vGetBBound(const Eref& e) const = 0; virtual void vSetBBound(const Eref& e,double value) = 0; - + virtual double vGetBTot(const Eref& e) const = 0; // total buffer concentration in mM (free + bound) virtual void vSetBTot(const Eref& e,double value) = 0; @@ -90,7 +90,7 @@ public: virtual double vGetKb(const Eref& e) const = 0; // backward rate constant in 1/sec virtual void vSetKb(const Eref& e,double value) = 0; - + virtual double vGetD(const Eref& e) const = 0; // diffusion constant of buffer molecules, m^2/sec virtual void vSetD(const Eref& e,double value) = 0; @@ -114,16 +114,16 @@ public: virtual void vSetInnerArea(const Eref& e, double innerArea ) = 0; virtual double vGetInnerArea(const Eref& e) const = 0; - + static SrcFinfo4< double, double, double, double >* reactionOut(); static SrcFinfo2< double, double >* innerDifSourceOut(); static SrcFinfo2< double, double >* outerDifSourceOut(); static const Cinfo * initCinfo(); - + private: - - - + + + }; diff --git a/moose-core/biophysics/DifShell.cpp b/moose-core/biophysics/DifShell.cpp index 88f4d5a5180ced25733fb3b342f7465d1b41bfa6..c094d8c40b28057d62b9891495ee00e948991635 100644 --- a/moose-core/biophysics/DifShell.cpp +++ b/moose-core/biophysics/DifShell.cpp @@ -18,8 +18,8 @@ const double DifShell::F = 96485.3415; /* C / mol like in genesis */ const Cinfo* DifShell::initCinfo() { - - + + static string doc[] = { "Name", "DifShell", @@ -83,7 +83,7 @@ void DifShell::vSetC( const Eref& e, double C) cerr << "Error: DifShell: C cannot be negative!\n"; return; } - + C_ = C; prevC_ = C_; } @@ -98,7 +98,7 @@ void DifShell::vSetCeq( const Eref& e, double Ceq ) cerr << "Error: DifShell: Ceq cannot be negative!\n"; return; } - + Ceq_ = Ceq; prevC_ = Ceq; C_ = Ceq; @@ -115,7 +115,7 @@ void DifShell::vSetD(const Eref& e, double D ) cerr << "Error: DifShell: D cannot be negative!\n"; return; } - + D_ = D; } @@ -130,11 +130,11 @@ void DifShell::vSetValence(const Eref& e, double valence ) cerr << "Error: DifShell: valence cannot be negative!\n"; return; } - + valence_ = valence; } -double DifShell::vGetValence(const Eref& e ) const +double DifShell::vGetValence(const Eref& e ) const { return valence_; } @@ -171,7 +171,7 @@ void DifShell::vSetLength(const Eref& e, double length ) cerr << "Error: DifShell: length cannot be negative!\n"; return; } - + length_ = length; calculateVolumeArea(e); } @@ -187,7 +187,7 @@ void DifShell::vSetDiameter(const Eref& e, double diameter ) cerr << "Error: DifShell: diameter cannot be negative!\n"; return; } - + diameter_ = diameter; calculateVolumeArea(e); } @@ -203,7 +203,7 @@ void DifShell::vSetThickness( const Eref& e, double thickness ) cerr << "Error: DifShell: thickness cannot be negative!\n"; return; } - + thickness_ = thickness; calculateVolumeArea(e); } @@ -217,12 +217,12 @@ void DifShell::vSetVolume(const Eref& e, double volume ) { if ( shapeMode_ != 3 ) cerr << "Warning: DifShell: Trying to set volume, when shapeMode is not USER-DEFINED\n"; - + if ( volume < 0.0 ) { cerr << "Error: DifShell: volume cannot be negative!\n"; return; } - + volume_ = volume; } @@ -235,12 +235,12 @@ void DifShell::vSetOuterArea(const Eref& e, double outerArea ) { if (shapeMode_ != 3 ) cerr << "Warning: DifShell: Trying to set outerArea, when shapeMode is not USER-DEFINED\n"; - + if ( outerArea < 0.0 ) { cerr << "Error: DifShell: outerArea cannot be negative!\n"; return; } - + outerArea_ = outerArea; } @@ -253,12 +253,12 @@ void DifShell::vSetInnerArea(const Eref& e, double innerArea ) { if ( shapeMode_ != 3 ) cerr << "Warning: DifShell: Trying to set innerArea, when shapeMode is not USER-DEFINED\n"; - + if ( innerArea < 0.0 ) { cerr << "Error: DifShell: innerArea cannot be negative!\n"; return; } - + innerArea_ = innerArea; } @@ -285,12 +285,12 @@ double DifShell::integrate( double state, double dt, double A, double B ) void DifShell::calculateVolumeArea(const Eref& e) { double rOut = diameter_/2.; - + double rIn = rOut - thickness_; if (rIn <0) rIn = 0.; - + switch ( shapeMode_ ) { /* @@ -306,9 +306,9 @@ double rOut = diameter_/2.; outerArea_ = 2*M_PI * rOut * length_; innerArea_ = 2*M_PI * rIn * length_; } - + break; - + /* * Cylindrical Slice */ @@ -317,7 +317,7 @@ double rOut = diameter_/2.; outerArea_ = M_PI * diameter_ * diameter_ / 4.0; innerArea_ = outerArea_; break; - + /* * User defined */ @@ -325,12 +325,12 @@ double rOut = diameter_/2.; // Nothing to be done here. Volume and inner-, outer areas specified by // user. break; - + default: assert( 0 ); } } - + void DifShell::vReinit( const Eref& e, ProcPtr p ) { dCbyDt_ = leak_; @@ -342,7 +342,7 @@ void DifShell::vReinit( const Eref& e, ProcPtr p ) concentrationOut()->send( e, C_ ); innerDifSourceOut()->send( e, prevC_, thickness_ ); outerDifSourceOut()->send( e, prevC_, thickness_ ); - + } void DifShell::vProcess( const Eref & e, ProcPtr p ) @@ -351,17 +351,17 @@ void DifShell::vProcess( const Eref & e, ProcPtr p ) * Send ion concentration and thickness to adjacent DifShells. They will * then compute their incoming fluxes. */ - - + + C_ = integrate(C_,p->dt,dCbyDt_,Cmultiplier_); - + /** * Send ion concentration to ion buffers. They will send back information on * the reaction (forward / backward rates ; free / bound buffer concentration) * immediately, which this DifShell will use to find amount of ion captured * or released in the current time-step. */ - + dCbyDt_ = leak_; Cmultiplier_ = 0; @@ -371,7 +371,7 @@ void DifShell::vProcess( const Eref & e, ProcPtr p ) outerDifSourceOut()->send( e, prevC_, thickness_ ); concentrationOut()->send( e, C_ ); - + } void DifShell::vBuffer(const Eref& e, double kf, @@ -391,7 +391,7 @@ void DifShell::vFluxFromOut(const Eref& e, double outerC, double outerThickness * We could pre-compute ( D / Volume ), but let us leave the optimizations * for the solver. */ - + dCbyDt_ += diff * outerC; Cmultiplier_ += diff ; @@ -402,7 +402,7 @@ void DifShell::vFluxFromIn(const Eref& e, double innerC, double innerThickness ) //influx from inner shell //double dx = ( innerThickness + thickness_ ) / 2.0; double diff = 2.* D_/volume_ * innerArea_ / (innerThickness + thickness_); - + dCbyDt_ += diff * innerC ; Cmultiplier_ += diff ; } @@ -493,7 +493,7 @@ void DifShell::vHillPump(const Eref& e, double vMax, double Kd, unsigned int hil default: ch = pow( C_, static_cast< double >( hill ) ); }; - + dCbyDt_ += -( vMax / volume_ ) * ( ch / ( ch + Kd ) ); } diff --git a/moose-core/biophysics/DifShell.h b/moose-core/biophysics/DifShell.h index 177ae9b8ba7dca2cd0bf343b5ab07f0307aacd58..d2f59cd494e33c18374d1ba15fa20b610390d5a7 100644 --- a/moose-core/biophysics/DifShell.h +++ b/moose-core/biophysics/DifShell.h @@ -33,14 +33,14 @@ class DifShell: public DifShellBase{ void vEqTauPump(const Eref& e, double kP ); void vMMPump(const Eref& e, double vMax, double Kd ); void vHillPump(const Eref& e, double vMax, double Kd, unsigned int hill ); - + ///////////////////////////////////////////////////////////// // Field access functions ///////////////////////////////////////////////////////////// - + void vSetC(const Eref& e,double C); double vGetC( const Eref& e) const; - + void vSetCeq(const Eref& e,double Ceq ); double vGetCeq(const Eref& e) const; @@ -75,14 +75,14 @@ class DifShell: public DifShellBase{ double vGetInnerArea(const Eref& e) const; void calculateVolumeArea(const Eref& e); - + static const Cinfo * initCinfo(); - - + + private: double integrate( double state, double dt, double A, double B ); - + double dCbyDt_; double Cmultiplier_; double C_; @@ -102,7 +102,7 @@ class DifShell: public DifShellBase{ static const double EPSILON; /// Faraday's constant (Coulomb / Mole) static const double F; - + }; #endif // _DIFSHELL_H diff --git a/moose-core/biophysics/DifShellBase.cpp b/moose-core/biophysics/DifShellBase.cpp index 8577a767c4d9dbbd6fef4ba549e30a7c4159e530..d6b6ed208f03b6157fc126a25bc7c883d6c47f7c 100644 --- a/moose-core/biophysics/DifShellBase.cpp +++ b/moose-core/biophysics/DifShellBase.cpp @@ -33,48 +33,48 @@ SrcFinfo2< double, double >* DifShellBase::outerDifSourceOut(){ const Cinfo* DifShellBase::initCinfo() { - + static DestFinfo process( "process", "Handles process call", new ProcOpFunc< DifShellBase>(&DifShellBase::process ) ); static DestFinfo reinit( "reinit", "Reinit happens only in stage 0", new ProcOpFunc< DifShellBase>( &DifShellBase::reinit )); - + static Finfo* processShared[] = { &process, &reinit }; static SharedFinfo proc( - "proc", + "proc", "Shared message to receive Process message from scheduler", processShared, sizeof( processShared ) / sizeof( Finfo* )); - - + + static DestFinfo reaction( "reaction", "Here the DifShell receives reaction rates (forward and backward), and concentrations for the " "free-buffer and bound-buffer molecules.", new EpFunc4< DifShellBase, double, double, double, double >( &DifShellBase::buffer )); - + static Finfo* bufferShared[] = { DifShellBase::concentrationOut(), &reaction }; - + static SharedFinfo buffer( "buffer", "This is a shared message from a DifShell to a Buffer (FixBuffer or DifBuffer). " , bufferShared, sizeof( bufferShared ) / sizeof( Finfo* )); ///// - - - - + + + + static DestFinfo fluxFromOut( "fluxFromOut", "Destination message", new EpFunc2< DifShellBase, double, double > ( &DifShellBase::fluxFromOut )); - + static Finfo* innerDifShared[] = { &fluxFromOut, DifShellBase::innerDifSourceOut(), }; @@ -87,7 +87,7 @@ const Cinfo* DifShellBase::initCinfo() static DestFinfo fluxFromIn( "fluxFromIn", "", new EpFunc2< DifShellBase, double, double> ( &DifShellBase::fluxFromIn ) ); - + static Finfo* outerDifShared[] = { &fluxFromIn, DifShellBase::outerDifSourceOut(), }; @@ -96,8 +96,8 @@ const Cinfo* DifShellBase::initCinfo() "Using this message, an outer shell sends to, and receives from its inner shell." , outerDifShared, sizeof( outerDifShared ) / sizeof( Finfo* )); - - static ElementValueFinfo< DifShellBase, double> C( "C", + + static ElementValueFinfo< DifShellBase, double> C( "C", "Concentration C",// is computed by the DifShell", &DifShellBase::setC, &DifShellBase::getC); @@ -136,7 +136,7 @@ const Cinfo* DifShellBase::initCinfo() &DifShellBase::getInnerArea ); static DestFinfo mmPump( "mmPump", "Here DifShell receives pump outflux", - new EpFunc2< DifShellBase, double, double >( &DifShellBase::mmPump ) ); + new EpFunc2< DifShellBase, double, double >( &DifShellBase::mmPump ) ); static DestFinfo influx( "influx", "", new EpFunc1< DifShellBase, double > (&DifShellBase::influx )); static DestFinfo outflux( "outflux", "", @@ -264,7 +264,7 @@ void DifShellBase::setValence(const Eref& e, double valence ) vSetValence(e,valence); } -double DifShellBase::getValence(const Eref& e ) const +double DifShellBase::getValence(const Eref& e ) const { return vGetValence(e); } diff --git a/moose-core/biophysics/DifShellBase.h b/moose-core/biophysics/DifShellBase.h index 57b208105bdf0fb5dcdb2e6ce4d7e0d8dc0d146c..1f61a9056d3ac5d1870ca3a03622f18791c755f0 100644 --- a/moose-core/biophysics/DifShellBase.h +++ b/moose-core/biophysics/DifShellBase.h @@ -53,7 +53,7 @@ class DifShellBase ///////////////////////////////////////////////////////////// // Field access functions ///////////////////////////////////////////////////////////// - + void setC(const Eref& e,double C); double getC( const Eref& e) const; @@ -92,7 +92,7 @@ class DifShellBase virtual void vSetC(const Eref& e,double C) = 0; virtual double vGetC( const Eref& e) const = 0; - + virtual void vSetCeq(const Eref& e,double Ceq ) = 0; virtual double vGetCeq(const Eref& e) const = 0; @@ -104,7 +104,7 @@ class DifShellBase virtual void vSetLeak(const Eref& e, double leak ) = 0; virtual double vGetLeak(const Eref& e) const = 0; - + virtual void vSetShapeMode(const Eref& e, unsigned int shapeMode ) = 0; virtual unsigned int vGetShapeMode(const Eref& e) const = 0; @@ -126,13 +126,13 @@ class DifShellBase virtual void vSetInnerArea(const Eref& e, double innerArea ) = 0; virtual double vGetInnerArea(const Eref& e) const = 0; - - + + static SrcFinfo1< double >* concentrationOut(); static SrcFinfo2< double, double >* innerDifSourceOut(); static SrcFinfo2< double, double >* outerDifSourceOut(); static const Cinfo * initCinfo(); - + private: diff --git a/moose-core/biophysics/GapJunction.cpp b/moose-core/biophysics/GapJunction.cpp index 06be4bdfbef700f69edb28f9d13842845f5eb149..d7d8876808e91df5d5445b157ffe040354e99478 100644 --- a/moose-core/biophysics/GapJunction.cpp +++ b/moose-core/biophysics/GapJunction.cpp @@ -1,47 +1,47 @@ -// GapJunction.cpp --- -// +// GapJunction.cpp --- +// // Filename: GapJunction.cpp // Description: Implements Gap junction // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Tue Jul 2 11:40:13 2013 (+0530) -// Version: +// Version: // Last-Updated: Tue Jul 2 14:26:01 2013 (+0530) // By: subha // Update #: 77 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// 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: @@ -72,20 +72,20 @@ const Cinfo* GapJunction::initCinfo() "Conductance of the gap junction", &GapJunction::setGk, &GapJunction::getGk); - + /////////////////////////////////////////////////////////////////// // Shared messages /////////////////////////////////////////////////////////////////// static DestFinfo process( - "process", + "process", "Handles 'process' call", new ProcOpFunc< GapJunction >( &GapJunction::process ) ); - + static DestFinfo reinit( - "reinit", + "reinit", "Handles 'reinit' call", new ProcOpFunc< GapJunction >( &GapJunction::reinit ) ); - + static Finfo* processShared[] = { &process, &reinit }; @@ -101,12 +101,12 @@ const Cinfo* GapJunction::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 Vm1( "Vm1", "Handles Vm message from compartment", new OpFunc1 < GapJunction, double >( &GapJunction::setVm1 )); - + static Finfo * channel1Shared[] = { channel1Out(), &Vm1, }; @@ -117,7 +117,7 @@ const Cinfo* GapJunction::initCinfo() "terminal 2 to the compartment at terminal 1. The first entry is source\n" "sending out Gk and Vm2, the second entry is destination for Vm1.", channel1Shared, sizeof(channel1Shared)/sizeof(Finfo*)); - + static DestFinfo Vm2( "Vm2", "Handles Vm message from another compartment", @@ -133,7 +133,7 @@ const Cinfo* GapJunction::initCinfo() "terminal 1 to the compartment at terminal 2. The first entry is source\n" "sending out Gk and Vm1, the second entry is destination for Vm2.", channel2Shared, sizeof(channel2Shared)/sizeof(Finfo*)); - + static Finfo * gapJunctionFinfos[] = { &channel1, @@ -211,5 +211,5 @@ void GapJunction::reinit( const Eref&, ProcPtr p ) -// +// // GapJunction.cpp ends here diff --git a/moose-core/biophysics/GapJunction.h b/moose-core/biophysics/GapJunction.h index 23dfdf8df1b040e779e22bd1465ac00384547090..1f950e7f5cf8f846ceecf38b10b49c5bcf5e7aef 100644 --- a/moose-core/biophysics/GapJunction.h +++ b/moose-core/biophysics/GapJunction.h @@ -1,47 +1,47 @@ -// GapJunction.h --- -// +// GapJunction.h --- +// // Filename: GapJunction.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Tue Jul 2 11:22:05 2013 (+0530) -// Version: +// Version: // Last-Updated: Tue Jul 2 12:39:14 2013 (+0530) // By: subha // Update #: 27 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// +// Commentary: +// // Implementation of simple gap junction -// -// +// +// // 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: @@ -54,7 +54,7 @@ class GapJunction { // Sometimes one may want to set g=0, i.e. R=inf - e.g. in Traub model void setGk(double g); double getGk() const; - + // Dest function definitions. /** * The process function does the object updating and sends out @@ -77,5 +77,5 @@ class GapJunction { double Vm2_; double Gk_; }; -// +// // GapJunction.h ends here diff --git a/moose-core/biophysics/HHChannel.cpp b/moose-core/biophysics/HHChannel.cpp index e4643db2070bd26c05688b12cbeafcddab49f216..87453e97dfaef588e066c3d3fdb2ab9e769c7e00 100644 --- a/moose-core/biophysics/HHChannel.cpp +++ b/moose-core/biophysics/HHChannel.cpp @@ -32,9 +32,9 @@ const Cinfo* HHChannel::initCinfo() "like the old tabchannel from GENESIS, but also presents " "a similar interface as hhchan from GENESIS. ", }; - + static Dinfo< HHChannel > dinfo; - + static Cinfo HHChannelCinfo( "HHChannel", HHChannelBase::initCinfo(), @@ -72,13 +72,13 @@ HHChannel::HHChannel() HHChannel::~HHChannel() { - // if ( xGate_ && reinterpret_cast< char* >( this ) == + // if ( xGate_ && reinterpret_cast< char* >( this ) == // ObjId( xGate_->originalChannelId(), 0 ).data() ) // delete xGate_; - // if ( yGate_ && reinterpret_cast< char* >( this ) == + // if ( yGate_ && reinterpret_cast< char* >( this ) == // ObjId( yGate_->originalChannelId(), 0 ).data() ) // delete yGate_; - // if ( zGate_ && reinterpret_cast< char* >( this ) == + // if ( zGate_ && reinterpret_cast< char* >( this ) == // ObjId( zGate_->originalChannelId(), 0 ).data() ) // delete zGate_; } @@ -95,7 +95,7 @@ bool HHChannel::setGatePower( const Eref& e, double power, // destroyGate( e, gateType ); } *assignee = power; - + return true; } @@ -140,7 +140,7 @@ void HHChannel::vSetZpower( const Eref& e, double power ) * an existing one. * \todo: May need to convert to handling arrays and Erefs. */ -// Assuming that the elements are simple elements. Use Eref for +// Assuming that the elements are simple elements. Use Eref for // general case bool HHChannel::checkOriginal( Id chanId ) const @@ -156,7 +156,7 @@ bool HHChannel::checkOriginal( Id chanId ) const return isOriginal; } -void HHChannel::innerCreateGate( const string& gateName, +void HHChannel::innerCreateGate( const string& gateName, HHGate** gatePtr, Id chanId, Id gateId ) { //Shell* shell = reinterpret_cast< Shell* >( ObjId( Id(), 0 ).data() ); @@ -168,7 +168,7 @@ void HHChannel::innerCreateGate( const string& gateName, *gatePtr = new HHGate( chanId, gateId ); } -void HHChannel::vCreateGate( const Eref& e, +void HHChannel::vCreateGate( const Eref& e, string gateType ) { if ( !checkOriginal( e.id() ) ) { @@ -187,7 +187,7 @@ void HHChannel::vCreateGate( const Eref& e, gateType << "'. Ignored\n"; } -void HHChannel::innerDestroyGate( const string& gateName, +void HHChannel::innerDestroyGate( const string& gateName, HHGate** gatePtr, Id chanId ) { if ( *gatePtr == 0 ) { @@ -206,7 +206,7 @@ void HHChannel::destroyGate( const Eref& e, cout << "Warning: HHChannel::destroyGate: Not allowed from copied channel:\n" << e.id().path() << "\n"; return; } - + if ( gateType == "X" ) innerDestroyGate( "xGate", &xGate_, e.id() ); else if ( gateType == "Y" ) @@ -235,7 +235,7 @@ int HHChannel::vGetInstant( const Eref& e ) const void HHChannel::vSetX( const Eref& e, double X ) { X_ = X; - xInited_ = true; + xInited_ = true; } double HHChannel::vGetX( const Eref& e ) const { @@ -245,7 +245,7 @@ double HHChannel::vGetX( const Eref& e ) const void HHChannel::vSetY( const Eref& e, double Y ) { Y_ = Y; - yInited_ = true; + yInited_ = true; } double HHChannel::vGetY( const Eref& e ) const { @@ -255,7 +255,7 @@ double HHChannel::vGetY( const Eref& e ) const void HHChannel::vSetZ( const Eref& e, double Z ) { Z_ = Z; - zInited_ = true; + zInited_ = true; } double HHChannel::vGetZ( const Eref& e ) const { @@ -293,7 +293,7 @@ void HHChannel::vProcess( const Eref& e, ProcPtr info ) xGate_->lookupBoth( Vm_, &A, &B ); if ( instant_ & INSTANT_X ) X_ = A/B; - else + else X_ = integrate( X_, info->dt, A, B ); g_ *= takeXpower_( X_, Xpower_ ); } @@ -302,7 +302,7 @@ void HHChannel::vProcess( const Eref& e, ProcPtr info ) yGate_->lookupBoth( Vm_, &A, &B ); if ( instant_ & INSTANT_Y ) Y_ = A/B; - else + else Y_ = integrate( Y_, info->dt, A, B ); g_ *= takeYpower_( Y_, Ypower_ ); @@ -315,7 +315,7 @@ void HHChannel::vProcess( const Eref& e, ProcPtr info ) zGate_->lookupBoth( Vm_, &A, &B ); if ( instant_ & INSTANT_Z ) Z_ = A/B; - else + else Z_ = integrate( Z_, info->dt, A, B ); g_ *= takeZpower_( Z_, Zpower_ ); @@ -328,7 +328,7 @@ void HHChannel::vProcess( const Eref& e, ProcPtr info ) // Send out the relevant channel messages. ChanCommon::sendProcessMsgs( e, info ); - + g_ = 0.0; } @@ -393,7 +393,7 @@ void HHChannel::vReinit( const Eref& er, ProcPtr info ) // Send out the relevant channel messages. // Same for reinit as for process. ChanCommon::sendReinitMsgs( er, info ); - + g_ = 0.0; } diff --git a/moose-core/biophysics/HHChannel.h b/moose-core/biophysics/HHChannel.h index 2df4cf20bdcca505355ba1c75910ed04e726869e..abda2d115d0c1abc5d1c2793200f256abcd2126e 100644 --- a/moose-core/biophysics/HHChannel.h +++ b/moose-core/biophysics/HHChannel.h @@ -13,8 +13,8 @@ /** * The HHChannel class sets up a Hodkin-Huxley type ion channel. - * The form used here is quite general and can handle up to 3 - * gates, named X, Y and Z. The Z gate can be a function of + * The form used here is quite general and can handle up to 3 + * gates, named X, Y and Z. The Z gate can be a function of * concentration as well as voltage. The gates are normally computed * using the form * @@ -24,7 +24,7 @@ * * where the rates for the transition are alpha and beta, and both * are functions of V. - * The state variables for each gate (X_, Y_, and Z_) are + * The state variables for each gate (X_, Y_, and Z_) are * the fraction in the open state. * * Gates can also be computed instantaneously, giving the instantaneous @@ -32,13 +32,13 @@ * process. * The actual functions alpha and beta are provided by an auxiliary * class, the HHGate. The idea is that all copies of a channel share the - * same gate, thus saving a great deal of space. It also makes it + * same gate, thus saving a great deal of space. It also makes it * possible to cleanly change the parameters of all the channels of * a give class, all at once. Should one want to mutate a subset * of channels, they just need to set up separate gates. * * HHGates are implemented as a special category of FieldElement, so that - * they can be accessed as readonly pointers available to the HHChannel. + * they can be accessed as readonly pointers available to the HHChannel. * The FieldElement containing the HHGate appears as a child Element of * the HHChannel. The HHChannel Element can be an array; the associated * HHGate is a singleton. So there has to be a local copy of the HHGate @@ -86,12 +86,12 @@ class HHChannel: public HHChannelBase, public ChanCommon * processFunc handles the update and calculations every * clock tick. It first sends the request for evaluation of * the gate variables to the respective gate objects and - * recieves their response immediately through a return + * recieves their response immediately through a return * message. This is done so that many channel instances can * share the same gate lookup tables, but do so cleanly. * Such messages should never go to a remote node. * Then the function does its own little calculations to - * send back to the parent compartment through regular + * send back to the parent compartment through regular * messages. */ void vProcess( const Eref& e, ProcPtr p ); @@ -99,8 +99,8 @@ class HHChannel: public HHChannelBase, public ChanCommon /** * Reinitializes the values for the channel. This involves * computing the steady-state value for the channel gates - * using the provided Vm from the parent compartment. It - * involves a similar cycle through the gates and then + * using the provided Vm from the parent compartment. It + * involves a similar cycle through the gates and then * updates to the parent compartment as for the processFunc. */ void vReinit( const Eref& e, ProcPtr p ); @@ -147,7 +147,7 @@ class HHChannel: public HHChannelBase, public ChanCommon void vCreateGate( const Eref& e, string gateType ); /** * Utility function for destroying gate. Works only on original - * HHChannel. Somewhat dangerous, should never be used after a + * HHChannel. Somewhat dangerous, should never be used after a * copy has been made as the pointer of the gate will be in use * elsewhere. */ @@ -199,10 +199,10 @@ class HHChannel: public HHChannelBase, public ChanCommon */ HHGate* xGate_; - /// HHGate data structure for the yGate. + /// HHGate data structure for the yGate. HHGate* yGate_; - /// HHGate data structure for the yGate. + /// HHGate data structure for the yGate. HHGate* zGate_; Id myId_; diff --git a/moose-core/biophysics/HHChannel2D.cpp b/moose-core/biophysics/HHChannel2D.cpp index cd43e2f7dbd7061a978844470ce22389b09d7941..f937f692219291400320762f610058ab65dc73b1 100644 --- a/moose-core/biophysics/HHChannel2D.cpp +++ b/moose-core/biophysics/HHChannel2D.cpp @@ -66,7 +66,7 @@ const Cinfo* HHChannel2D::initCinfo() &HHChannel2D::setInstant, &HHChannel2D::getInstant ); - static ValueFinfo< HHChannel2D, double > X( "X", + static ValueFinfo< HHChannel2D, double > X( "X", "State variable for X gate", &HHChannel2D::setX, &HHChannel2D::getX @@ -101,7 +101,7 @@ const Cinfo* HHChannel2D::initCinfo() ); /////////////////////////////////////////////////////// // FieldElementFinfo definition for HHGates. Note that these are made -// with the deferCreate flag off, so that the HHGates are created +// with the deferCreate flag off, so that the HHGates are created // right away even if they are empty. // I assume that we only have a single HHGate entry for each one. /////////////////////////////////////////////////////// @@ -233,7 +233,7 @@ int HHChannel2D::getInstant() const void HHChannel2D::setX( double X ) { X_ = X; - xInited_ = true; + xInited_ = true; } double HHChannel2D::getX() const { @@ -243,7 +243,7 @@ double HHChannel2D::getX() const void HHChannel2D::setY( double Y ) { Y_ = Y; - yInited_ = true; + yInited_ = true; } double HHChannel2D::getY() const { @@ -253,7 +253,7 @@ double HHChannel2D::getY() const void HHChannel2D::setZ( double Z ) { Z_ = Z; - zInited_ = true; + zInited_ = true; } double HHChannel2D::getZ() const { @@ -273,7 +273,7 @@ void HHChannel2D::setXindex( string Xindex ) Xindex_ = Xindex; Xdep0_ = dependency( Xindex, 0 ); Xdep1_ = dependency( Xindex, 1 ); - + assert( Xdep0_ >= 0 ); } @@ -286,11 +286,11 @@ void HHChannel2D::setYindex( string Yindex ) { if ( Yindex == Yindex_ ) return; - + Yindex_ = Yindex; Ydep0_ = dependency( Yindex, 0 ); Ydep1_ = dependency( Yindex, 1 ); - + assert( Ydep0_ >= 0 ); } @@ -307,7 +307,7 @@ void HHChannel2D::setZindex( string Zindex ) Zindex_ = Zindex; Zdep0_ = dependency( Zindex, 0 ); Zdep1_ = dependency( Zindex, 1 ); - + assert( Zdep0_ >= 0 ); } @@ -330,7 +330,7 @@ HHGate2D* HHChannel2D::getZgate( unsigned int i ) return zGate_; } -void HHChannel2D::setNumGates( unsigned int num ) +void HHChannel2D::setNumGates( unsigned int num ) { ; } unsigned int HHChannel2D::getNumXgates() const @@ -364,27 +364,27 @@ int HHChannel2D::dependency( string index, unsigned int dim ) static vector< map< string, int > > dep; if ( dep.empty() ) { dep.resize( 2 ); - + dep[ 0 ][ "VOLT_INDEX" ] = 0; dep[ 0 ][ "C1_INDEX" ] = 1; dep[ 0 ][ "C2_INDEX" ] = 2; - + dep[ 0 ][ "VOLT_C1_INDEX" ] = 0; dep[ 0 ][ "VOLT_C2_INDEX" ] = 0; dep[ 0 ][ "C1_C2_INDEX" ] = 1; - + dep[ 1 ][ "VOLT_INDEX" ] = -1; dep[ 1 ][ "C1_INDEX" ] = -1; dep[ 1 ][ "C2_INDEX" ] = -1; - + dep[ 1 ][ "VOLT_C1_INDEX" ] = 1; dep[ 1 ][ "VOLT_C2_INDEX" ] = 2; dep[ 1 ][ "C1_C2_INDEX" ] = 2; } - + if ( dep[ dim ].find( index ) == dep[ dim ].end() ) return -1; - + if ( dep[ dim ][ index ] == 0 ) return 0; if ( dep[ dim ][ index ] == 1 ) @@ -435,7 +435,7 @@ void HHChannel2D::vProcess( const Eref& e, ProcPtr info ) xGate_->lookupBoth( depValue( Xdep0_ ), depValue( Xdep1_ ), &A, &B ); if ( instant_ & INSTANT_X ) X_ = A/B; - else + else X_ = integrate( X_, info->dt, A, B ); g_ *= takeXpower_( X_, Xpower_ ); } @@ -444,7 +444,7 @@ void HHChannel2D::vProcess( const Eref& e, ProcPtr info ) yGate_->lookupBoth( depValue( Ydep0_ ), depValue( Ydep1_ ), &A, &B ); if ( instant_ & INSTANT_Y ) Y_ = A/B; - else + else Y_ = integrate( Y_, info->dt, A, B ); g_ *= takeYpower_( Y_, Ypower_ ); @@ -454,7 +454,7 @@ void HHChannel2D::vProcess( const Eref& e, ProcPtr info ) zGate_->lookupBoth( depValue( Zdep0_ ), depValue( Zdep1_ ), &A, &B ); if ( instant_ & INSTANT_Z ) Z_ = A/B; - else + else Z_ = integrate( Z_, info->dt, A, B ); g_ *= takeZpower_( Z_, Zpower_ ); @@ -536,7 +536,7 @@ bool HHChannel2D::setGatePower( const Eref& e, double power, double *assignee, const string& gateType ) { if ( power < 0 ) { - cout << "Error: HHChannel2D::set" << gateType << + cout << "Error: HHChannel2D::set" << gateType << "power: Cannot use negative power: " << power << endl; return 0; } @@ -549,7 +549,7 @@ bool HHChannel2D::setGatePower( const Eref& e, double power, } else if ( doubleEq( power, 0.0 ) ) { destroyGate( e, gateType ); } - + *assignee = power; return 1; } @@ -593,7 +593,7 @@ void HHChannel2D::setZpower( const Eref& e, double Zpower ) * an existing one. * \todo: May need to convert to handling arrays and Erefs. */ -// Assuming that the elements are simple elements. Use Eref for +// Assuming that the elements are simple elements. Use Eref for // general case bool HHChannel2D::checkOriginal( Id chanId ) const @@ -609,7 +609,7 @@ bool HHChannel2D::checkOriginal( Id chanId ) const return isOriginal; } -void HHChannel2D::innerCreateGate( const string& gateName, +void HHChannel2D::innerCreateGate( const string& gateName, HHGate2D** gatePtr, Id chanId, Id gateId ) { //Shell* shell = reinterpret_cast< Shell* >( ObjId( Id(), 0 ).data() ); @@ -621,7 +621,7 @@ void HHChannel2D::innerCreateGate( const string& gateName, *gatePtr = new HHGate2D( chanId, gateId ); } -void HHChannel2D::createGate( const Eref& e, +void HHChannel2D::createGate( const Eref& e, string gateType ) { if ( !checkOriginal( e.id() ) ) { @@ -640,7 +640,7 @@ void HHChannel2D::createGate( const Eref& e, gateType << "'. Ignored\n"; } -void HHChannel2D::innerDestroyGate( const string& gateName, +void HHChannel2D::innerDestroyGate( const string& gateName, HHGate2D** gatePtr, Id chanId ) { if ( *gatePtr == 0 ) { @@ -659,7 +659,7 @@ void HHChannel2D::destroyGate( const Eref& e, cout << "Warning: HHChannel2D::destroyGate: Not allowed from copied channel:\n" << e.id().path() << "\n"; return; } - + if ( gateType == "X" ) innerDestroyGate( "xGate", &xGate_, e.id() ); else if ( gateType == "Y" ) @@ -704,4 +704,4 @@ void testHHChannel2D2D() { ; } -#endif +#endif diff --git a/moose-core/biophysics/HHChannel2D.h b/moose-core/biophysics/HHChannel2D.h index 781f2144ee08911033ee6997462551a6b78f7845..d674ca7c3abaf5a1f229b5646a7673fdb0448f9a 100644 --- a/moose-core/biophysics/HHChannel2D.h +++ b/moose-core/biophysics/HHChannel2D.h @@ -83,12 +83,12 @@ class HHChannel2D: public ChanCommon * processFunc handles the update and calculations every * clock tick. It first sends the request for evaluation of * the gate variables to the respective gate objects and - * recieves their response immediately through a return + * recieves their response immediately through a return * message. This is done so that many channel instances can * share the same gate lookup tables, but do so cleanly. * Such messages should never go to a remote node. * Then the function does its own little calculations to - * send back to the parent compartment through regular + * send back to the parent compartment through regular * messages. */ void vProcess( const Eref& e, ProcPtr p ); @@ -96,8 +96,8 @@ class HHChannel2D: public ChanCommon /** * Reinitializes the values for the channel. This involves * computing the steady-state value for the channel gates - * using the provided Vm from the parent compartment. It - * involves a similar cycle through the gates and then + * using the provided Vm from the parent compartment. It + * involves a similar cycle through the gates and then * updates to the parent compartment as for the processFunc. */ void vReinit( const Eref& e, ProcPtr p ); @@ -133,7 +133,7 @@ class HHChannel2D: public ChanCommon /** * Utility function for destroying gate. Works only on original - * HHChannel. Somewhat dangerous, should never be used after a + * HHChannel. Somewhat dangerous, should never be used after a * copy has been made as the pointer of the gate will be in use * elsewhere. */ @@ -154,7 +154,7 @@ class HHChannel2D: public ChanCommon static PFDD selectPower( double power); static const Cinfo* initCinfo(); - + private: int dependency( string index, unsigned int dim ); double depValue( int dependency ); @@ -165,7 +165,7 @@ class HHChannel2D: public ChanCommon double Zpower_; /// Exponent for Z gate /// bitmapped flag for X, Y, Z, to do equil calculation for gate - int instant_; + int instant_; double X_; /// State variable for X gate double Y_; /// State variable for Y gate double Z_; /// State variable for Z gate @@ -173,13 +173,13 @@ class HHChannel2D: public ChanCommon /** * true when the matching state variable has been initialized */ - bool xInited_, yInited_, zInited_; + bool xInited_, yInited_, zInited_; double g_; /// Internal variable used to calculate conductance - + double conc1_; double conc2_; - + string Xindex_; string Yindex_; string Zindex_; diff --git a/moose-core/biophysics/HHChannelBase.h b/moose-core/biophysics/HHChannelBase.h index 2aa8c668f7c0f1cb66cb51c660513095be915d64..8d6a7531825fe4f2d8ad23bbe522cc31eb30203c 100644 --- a/moose-core/biophysics/HHChannelBase.h +++ b/moose-core/biophysics/HHChannelBase.h @@ -182,7 +182,7 @@ class HHChannelBase: public virtual ChanBase /// Exponent for Z gate double Zpower_; /// Flag for use of conc for input to Z gate calculations. - bool useConcentration_; + bool useConcentration_; /// Value used to scale channel conductance up or down double modulation_; diff --git a/moose-core/biophysics/HHGate.cpp b/moose-core/biophysics/HHGate.cpp index db9042d251ad1a53fea3100d0b7efc22f7d617fb..64140728b17fc9a439e2182c858c12afaa9f30b1 100644 --- a/moose-core/biophysics/HHGate.cpp +++ b/moose-core/biophysics/HHGate.cpp @@ -59,7 +59,7 @@ const Cinfo* HHGate::initCinfo() &HHGate::getTau ); - static ElementValueFinfo< HHGate, vector< double > > mInfinity( + static ElementValueFinfo< HHGate, vector< double > > mInfinity( "mInfinity", "Parameters for voltage-dependent rates, mInfinity:" "Set up mInfinity curve using 5 parameters, as follows:" @@ -87,28 +87,28 @@ const Cinfo* HHGate::initCinfo() &HHGate::getDivs ); - static ElementValueFinfo< HHGate, vector< double > > tableA( + static ElementValueFinfo< HHGate, vector< double > > tableA( "tableA", "Table of A entries", &HHGate::setTableA, &HHGate::getTableA ); - static ElementValueFinfo< HHGate, vector< double > > tableB( + static ElementValueFinfo< HHGate, vector< double > > tableB( "tableB", "Table of alpha + beta entries", &HHGate::setTableB, &HHGate::getTableB ); - static ElementValueFinfo< HHGate, bool > useInterpolation( + static ElementValueFinfo< HHGate, bool > useInterpolation( "useInterpolation", "Flag: use linear interpolation if true, else direct lookup", &HHGate::setUseInterpolation, &HHGate::getUseInterpolation ); - static ElementValueFinfo< HHGate, vector< double > > alphaParms( + static ElementValueFinfo< HHGate, vector< double > > alphaParms( "alphaParms", "Set up both gates using 13 parameters, as follows:" "setupAlpha AA AB AC AD AF BA BB BC BD BF xdivs xmin xmax" @@ -151,14 +151,14 @@ const Cinfo* HHGate::initCinfo() "y(x) = (A + B * x) / (C + exp((x + D) / F))", new EpFunc1< HHGate, vector< double > >( &HHGate::setupTau ) ); - static DestFinfo tweakAlpha( "tweakAlpha", + static DestFinfo tweakAlpha( "tweakAlpha", "Dummy function for backward compatibility. It used to convert" "the tables from alpha, beta values to alpha, alpha+beta" "because the internal calculations used these forms. Not" "needed now, deprecated.", new OpFunc0< HHGate >( &HHGate::tweakAlpha ) ); - static DestFinfo tweakTau( "tweakTau", + static DestFinfo tweakTau( "tweakTau", "Dummy function for backward compatibility. It used to convert" "the tables from tau, minf values to alpha, alpha+beta" "because the internal calculations used these forms. Not" @@ -205,7 +205,7 @@ const Cinfo* HHGate::initCinfo() "This takes the voltage and state variable from the channel, " "computes the new value of the state variable and a scaling, " "depending on gate power, for the conductance.", - }; + }; static Dinfo< HHGate > dinfo; static Cinfo HHGateCinfo( @@ -225,7 +225,7 @@ static const Cinfo* hhGateCinfo = HHGate::initCinfo(); // Core class functions /////////////////////////////////////////////////// HHGate::HHGate() - : xmin_(0), xmax_(1), invDx_(1), + : xmin_(0), xmax_(1), invDx_(1), originalChanId_(0), originalGateId_(0), lookupByInterpolation_(0), @@ -233,10 +233,10 @@ HHGate::HHGate() {;} HHGate::HHGate( Id originalChanId, Id originalGateId ) - : + : A_( 1, 0.0 ), B_( 1, 0.0 ), - xmin_(0), xmax_(1), invDx_(1), + xmin_(0), xmax_(1), invDx_(1), originalChanId_( originalChanId ), originalGateId_( originalGateId ), lookupByInterpolation_(0), @@ -250,9 +250,9 @@ HHGate::HHGate( Id originalChanId, Id originalGateId ) double HHGate::lookupTable( const vector< double >& tab, double v ) const { if ( v <= xmin_ ) return tab[0]; - if ( v >= xmax_ ) return tab.back(); + if ( v >= xmax_ ) return tab.back(); if ( lookupByInterpolation_ ) { - unsigned int index = + unsigned int index = static_cast< unsigned int >( ( v - xmin_ ) * invDx_ ); assert( tab.size() > index ); double frac = ( v - xmin_ - index / invDx_ ) * invDx_; @@ -295,7 +295,7 @@ void HHGate::lookupBoth( double v, double* A, double* B ) const } } -vector< double > HHGate::getAlpha( const Eref& e) const +vector< double > HHGate::getAlpha( const Eref& e) const { return alpha_; } @@ -315,7 +315,7 @@ void HHGate::setAlpha( const Eref& e, vector< double > val ) } } -vector< double > HHGate::getBeta( const Eref& e) const +vector< double > HHGate::getBeta( const Eref& e) const { return beta_; } @@ -335,7 +335,7 @@ void HHGate::setBeta( const Eref& e, vector< double > val ) } } -vector< double > HHGate::getTau( const Eref& e) const +vector< double > HHGate::getTau( const Eref& e) const { return tau_; } @@ -355,7 +355,7 @@ void HHGate::setTau( const Eref& e, vector< double > val ) } } -vector< double > HHGate::getMinfinity( const Eref& e) const +vector< double > HHGate::getMinfinity( const Eref& e) const { return mInfinity_; } @@ -375,7 +375,7 @@ void HHGate::setMinfinity( const Eref& e, vector< double > val ) } } -double HHGate::getMin( const Eref& e) const +double HHGate::getMin( const Eref& e) const { return xmin_; } @@ -396,7 +396,7 @@ void HHGate::setMin( const Eref& e, double val ) } } -double HHGate::getMax( const Eref& e) const +double HHGate::getMax( const Eref& e) const { return xmax_; } @@ -418,7 +418,7 @@ void HHGate::setMax( const Eref& e, double val ) } } -unsigned int HHGate::getDivs( const Eref& e) const +unsigned int HHGate::getDivs( const Eref& e) const { return A_.size() - 1; } @@ -440,7 +440,7 @@ void HHGate::setDivs( const Eref& e, unsigned int val ) } } -vector< double > HHGate::getTableA( const Eref& e) const +vector< double > HHGate::getTableA( const Eref& e) const { return A_; } @@ -460,7 +460,7 @@ void HHGate::setTableA( const Eref& e, vector< double > v ) } } -vector< double > HHGate::getTableB( const Eref& e) const +vector< double > HHGate::getTableB( const Eref& e) const { return B_; } @@ -477,7 +477,7 @@ void HHGate::setTableB( const Eref& e, vector< double > v ) } } -bool HHGate::getUseInterpolation( const Eref& e) const +bool HHGate::getUseInterpolation( const Eref& e) const { return lookupByInterpolation_; } @@ -488,7 +488,7 @@ void HHGate::setUseInterpolation( const Eref& e, bool val ) lookupByInterpolation_ = val; } -void HHGate::setupAlpha( const Eref& e, +void HHGate::setupAlpha( const Eref& e, vector< double > parms ) { if ( checkOriginal( e.id(), "setupAlpha" ) ) { @@ -568,7 +568,7 @@ void HHGate::setupTables( const vector< double >& parms, bool doTau ) double x = xmin_; double prevAentry = 0.0; double prevBentry = 0.0; - double temp; + double temp; double temp2 = 0.0; unsigned int i; @@ -644,7 +644,7 @@ void HHGate::setupTables( const vector< double >& parms, bool doTau ) /** * Tweaks the A and B entries in the tables from the original - * alpha/beta or minf/tau values. See code in + * alpha/beta or minf/tau values. See code in * GENESIS/src/olf/new_interp.c, function tweak_tab_values */ void HHGate::tweakTables( bool doTau ) @@ -671,14 +671,14 @@ void HHGate::tweakTables( bool doTau ) } } -void HHGate::setupGate( const Eref& e, +void HHGate::setupGate( const Eref& e, vector< double > parms ) { // The nine arguments are : // A B C D F size min max isbeta // If size == 0 then we check that the gate has already been allocated. - // If isbeta is true then we also have to do the conversion to - // HHGate form of alpha, alpha+beta, assuming that the alpha gate + // If isbeta is true then we also have to do the conversion to + // HHGate form of alpha, alpha+beta, assuming that the alpha gate // has already been setup. This uses tweakTables. // We may need to resize the tables if they don't match here. if ( !checkOriginal( e.id(), "setupGate" ) ) @@ -752,8 +752,8 @@ void HHGate::setupGate( const Eref& e, * newXdivs is one less than the size of the table; it is the number of * subdivisions that the table represents. */ -void HHGate::tabFill( vector< double >& table, - unsigned int newXdivs, double newXmin, double newXmax ) +void HHGate::tabFill( vector< double >& table, + unsigned int newXdivs, double newXmin, double newXmax ) { if ( newXdivs < 3 ) { cout << "Error: tabFill: # divs must be >= 3. Not filling table.\n"; @@ -769,7 +769,7 @@ void HHGate::tabFill( vector< double >& table, for( unsigned int i = 0; i <= newXdivs; ++i ) { table[i] = lookupTable( table, newXmin + i * newDx ); } - + lookupByInterpolation_ = origLookupMode; } diff --git a/moose-core/biophysics/HHGate.h b/moose-core/biophysics/HHGate.h index 412e167e249cc9b732038dcfd703f2c55fb33ea8..a5c79eb5dfcc68e65ef591c80df5b6fd91d97995 100644 --- a/moose-core/biophysics/HHGate.h +++ b/moose-core/biophysics/HHGate.h @@ -11,21 +11,21 @@ /** * This class handles a single gate on an HHChannel. It is equivalent to the - * m and h terms on the Hodgkin-Huxley Na channel, or the n term on the - * K channel. It stores the - * voltage-dependence (sometimes concentration-dependence) of the + * m and h terms on the Hodgkin-Huxley Na channel, or the n term on the + * K channel. It stores the + * voltage-dependence (sometimes concentration-dependence) of the * gating variables for opening the channel. It does so in a tabular form - * which can be directly filled using experimental data points. + * which can be directly filled using experimental data points. * It also provides a set of - * utility functions for defining the gate in functional forms, and + * utility functions for defining the gate in functional forms, and * accessing those original functional forms. * The HHGate is - * accessed as a FieldElement, which means that it is available as a + * accessed as a FieldElement, which means that it is available as a * pointer on the HHChannel. HHGates are typically shared. This means that * when you make a copy or a vector of an HHChannel, there is only a single * HHGate created, and its pointer is used by all the copies. * The lookup functions are thread-safe. - * Field assignment to the HHGate should be possible only from the + * Field assignment to the HHGate should be possible only from the * original HHChannel, but all the others do have read permission. */ class HHGate @@ -41,7 +41,7 @@ class HHGate /** * This constructor is the one meant to be used. It takes the * originalId of the parent HHChannel as a required argument, - * so that any subsequent 'write' functions can be checked to + * so that any subsequent 'write' functions can be checked to * see if they are legal. Also tracks its own Id. */ HHGate( Id originalChanId, Id originalGateId ); @@ -74,7 +74,7 @@ class HHGate vector< double > getBeta( const Eref& e) const; void setTau( const Eref& e, vector< double > val ); vector< double > getTau( const Eref& e) const; - void setMinfinity( const Eref& e, + void setMinfinity( const Eref& e, vector< double > val ); vector< double > getMinfinity( const Eref& e) const; @@ -146,12 +146,12 @@ class HHGate * Returns the Id of the original Channel. */ Id originalChannelId() const; - + /** * Returns the Id of the original Gate. */ Id originalGateId() const; - + /** * tabFill does interpolation and range resizing for * a table representing a lookup function. @@ -160,17 +160,17 @@ class HHGate * Does NOT alter the existing xmin and xmax, but it does resize * the table. */ - void tabFill( vector< double >& table, + void tabFill( vector< double >& table, unsigned int newXdivs, double newXmin, double newXmax ); /** - * Update the Tau and Minfinity parameters because the alpha or + * Update the Tau and Minfinity parameters because the alpha or * beta tables have changed. */ void updateTauMinf(); /** - * Update the alpha and beta parameters because the tau or + * Update the alpha and beta parameters because the tau or * minfinity tables have changed. */ void updateAlphaBeta(); @@ -180,7 +180,7 @@ class HHGate * and rebuild the tables. */ void updateTables(); - + static const Cinfo* initCinfo(); private: /// 5 parameters for alpha @@ -224,7 +224,7 @@ class HHGate Id originalGateId_; /** - * Flag: Use linear interpolation for lookup if true, use direct + * Flag: Use linear interpolation for lookup if true, use direct * table lookup if false. */ bool lookupByInterpolation_; diff --git a/moose-core/biophysics/HHGate2D.cpp b/moose-core/biophysics/HHGate2D.cpp index 66f7cd68df568b6d2d3e78279b4cb226175207f4..e0628095fc5902ef11eb9cbc01b8cad5337ec441 100644 --- a/moose-core/biophysics/HHGate2D.cpp +++ b/moose-core/biophysics/HHGate2D.cpp @@ -33,14 +33,14 @@ const Cinfo* HHGate2D::initCinfo() "lookupB: Look up B gate value from two doubles in a vector.", &HHGate2D::lookupB ); - static ElementValueFinfo< HHGate2D, vector< vector< double > > > tableA( + static ElementValueFinfo< HHGate2D, vector< vector< double > > > tableA( "tableA", "Table of A entries", &HHGate2D::setTableA, &HHGate2D::getTableA ); - static ElementValueFinfo< HHGate2D, vector< vector< double > > > tableB( + static ElementValueFinfo< HHGate2D, vector< vector< double > > > tableB( "tableB", "Table of B entries", &HHGate2D::setTableB, @@ -62,7 +62,7 @@ const Cinfo* HHGate2D::initCinfo() "Divisions for lookup. Zero means to use linear interpolation", &HHGate2D::setXdivsA, &HHGate2D::getXdivsA); - + static ElementValueFinfo< HHGate2D, double > yminA( "yminA", "Minimum range for lookup", &HHGate2D::setYminA, @@ -95,7 +95,7 @@ const Cinfo* HHGate2D::initCinfo() &HHGate2D::setXdivsB, &HHGate2D::getXdivsB ); - + static ElementValueFinfo< HHGate2D, double > yminB( "yminB", "Minimum range for lookup", &HHGate2D::setYminB, @@ -167,7 +167,7 @@ HHGate2D::HHGate2D() {;} HHGate2D::HHGate2D( Id originalChanId, Id originalGateId ) - : + : originalChanId_( originalChanId ), originalGateId_( originalGateId ) {;} @@ -181,12 +181,12 @@ double HHGate2D::lookupA( vector< double > v ) const cerr << "Error: HHGate2D::getAValue: 2 real numbers needed to lookup 2D table.\n"; return 0.0; } - + if ( v.size() > 2 ) { cerr << "Error: HHGate2D::getAValue: Only 2 real numbers needed to lookup 2D table. " "Using only first 2.\n"; } - + return A_.innerLookup( v[ 0 ], v[ 1 ] ); } @@ -196,12 +196,12 @@ double HHGate2D::lookupB( vector< double > v ) const cerr << "Error: HHGate2D::getAValue: 2 real numbers needed to lookup 2D table.\n"; return 0.0; } - + if ( v.size() > 2 ) { cerr << "Error: HHGate2D::getAValue: Only 2 real numbers needed to lookup 2D table. " "Using only first 2.\n"; } - + return B_.innerLookup( v[ 0 ], v[ 1 ] ); } @@ -395,16 +395,16 @@ void HHGate2D::createInterpols( const Conn* c, IdGenerator idGen ) { HHGate2D* h = static_cast< HHGate2D *>( c->data() ); Eref e = c->target(); - + const Cinfo* ic = initInterpol2DCinfo(); - + // Here we must set the noDelFlag to 1 because these data // parts belong to the parent HHGate2D structure. - Element* A = ic->create( + Element* A = ic->create( idGen.next(), "A", static_cast< void* >( &h->A_ ), 1 ); e.add( "childSrc", A, "child" ); - Element* B = ic->create( + Element* B = ic->create( idGen.next(), "B", static_cast< void* >( &h->B_), 1 ); e.add( "childSrc", B, "child" ); } diff --git a/moose-core/biophysics/HHGate2D.h b/moose-core/biophysics/HHGate2D.h index f87e75d04276d8f156c5736798b1d513a876f568..b1e115655eebd3dbbb9d473840d1bba9b4d62e04 100644 --- a/moose-core/biophysics/HHGate2D.h +++ b/moose-core/biophysics/HHGate2D.h @@ -14,12 +14,12 @@ class HHGate2D public: HHGate2D(); HHGate2D( Id originalChanId, Id originalGateId ); - + double lookupA( vector< double > v ) const; double lookupB( vector< double > v ) const; - + // void gateFunc( const Conn* c, double v1, double v2 ); - + /** * Single call to get both A and B values in a single * lookup @@ -90,7 +90,7 @@ class HHGate2D void setYmaxB(const Eref& e, double value); unsigned int getYdivsB(const Eref& e) const; void setYdivsB(const Eref& e, unsigned int value); - + static const Cinfo* initCinfo(); private: Interpol2D A_; diff --git a/moose-core/biophysics/IntFire.h b/moose-core/biophysics/IntFire.h index 02ae99f9d41d0de4fec4533b714541182bb8b0e2..f0ba9641e37d272345a5affbca4a33349a182e92 100644 --- a/moose-core/biophysics/IntFire.h +++ b/moose-core/biophysics/IntFire.h @@ -15,7 +15,7 @@ class IntFire { friend void testStandaloneIntFire(); friend void testSynapse(); - public: + public: IntFire(); IntFire( double thresh, double tau ); @@ -24,11 +24,11 @@ class IntFire * Inserts an event into the pendingEvents queue for spikes. */ void innerAddSpike( unsigned int synIndex, double time ); - + //////////////////////////////////////////////////////////////// // Field assignment stuff. //////////////////////////////////////////////////////////////// - + void setVm( double v ); double getVm() const; void setTau( double v ); diff --git a/moose-core/biophysics/IzhikevichNrn.cpp b/moose-core/biophysics/IzhikevichNrn.cpp index 86cdf3aea7fd0f38468a77e66f52783097734ddf..0a8ac0ed885af0f659982d0f42437278dbf0c8a0 100644 --- a/moose-core/biophysics/IzhikevichNrn.cpp +++ b/moose-core/biophysics/IzhikevichNrn.cpp @@ -1,30 +1,30 @@ -// IzhikevichNrn.cpp --- -// +// IzhikevichNrn.cpp --- +// // Filename: IzhikevichNrn.cpp -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Fri Jul 8 10:00:33 2011 (+0530) -// Version: +// Version: // Last-Updated: Mon Nov 5 16:58:20 2012 (+0530) // By: subha // Update #: 110 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// +// +// +// // Change log: -// -// -// +// +// +// // Code: @@ -41,7 +41,7 @@ static SrcFinfo1< double >* spikeOut() static SrcFinfo1< double >* VmOut() { - static SrcFinfo1< double > VmOut("VmOut", + static SrcFinfo1< double > VmOut("VmOut", "Sends out Vm"); return &VmOut; } @@ -67,7 +67,7 @@ const Cinfo* IzhikevichNrn::initCinfo() "proc", "Shared message to receive Process message from scheduler", processShared, sizeof( processShared ) / sizeof( Finfo* ) ); - + /////////////////////////////////////////////////////// // Field definitions /////////////////////////////////////////////////////// @@ -129,7 +129,7 @@ const Cinfo* IzhikevichNrn::initCinfo() "Initial value of u.", &IzhikevichNrn::setInitU, &IzhikevichNrn::getInitU); - + static ValueFinfo<IzhikevichNrn, double> alpha( "alpha", "Coefficient of v^2 in Izhikevich equation. Defaults to 0.04 in " @@ -161,14 +161,14 @@ const Cinfo* IzhikevichNrn::initCinfo() " variable u is special in this case.", &IzhikevichNrn::setAccommodating, &IzhikevichNrn::getAccommodating); - + static ValueFinfo<IzhikevichNrn, double> u0( "u0", "This is used for accommodating neurons where recovery variables u is" " computed as: u += tau*a*(b*(Vm-u0))", &IzhikevichNrn::setU0, &IzhikevichNrn::getU0); - + /////////////////////////////// // MsgDest definition /////////////////////////////// @@ -176,27 +176,27 @@ const Cinfo* IzhikevichNrn::initCinfo() "injectMsg", "Injection current into the neuron.", new OpFunc1<IzhikevichNrn, double>( &IzhikevichNrn::setInject)); - + static DestFinfo cDest( "cDest", "Destination message to modify parameter c at runtime.", new OpFunc1<IzhikevichNrn, double>(&IzhikevichNrn::setC)); - + static DestFinfo dDest( "dDest", - "Destination message to modify parameter d at runtime.", + "Destination message to modify parameter d at runtime.", new OpFunc1<IzhikevichNrn, double>(&IzhikevichNrn::setD)); - + static DestFinfo aDest( "aDest", "Destination message modify parameter a at runtime.", new OpFunc1<IzhikevichNrn, double>(&IzhikevichNrn::setA)); - + static DestFinfo bDest( "bDest", - "Destination message to modify parameter b at runtime", + "Destination message to modify parameter b at runtime", new OpFunc1<IzhikevichNrn, double>(&IzhikevichNrn::setB)); - + static DestFinfo handleChannel("handleChannel", "Handles conductance and reversal potential arguments from Channel", @@ -213,7 +213,7 @@ const Cinfo* IzhikevichNrn::initCinfo() "the channel. It expects Gk and Ek from the channel " "as args. The second entry is a MsgSrc sending Vm ", channelShared, sizeof( channelShared ) / sizeof( Finfo* ) - ); + ); static Finfo* IzhikevichNrnFinfos[] = { &proc, &Vmax, @@ -240,9 +240,9 @@ const Cinfo* IzhikevichNrn::initCinfo() &aDest, VmOut(), spikeOut(), - &channel, + &channel, }; - + static string doc[] = { "Name", "IzhikevichNrn", "Author", "Subhasis Ray", @@ -276,7 +276,7 @@ IzhikevichNrn::IzhikevichNrn(): gamma_(140.0), // 140 physiological unit RmByTau_(1e6), // Assuming Izhikevich was using nA as unit of // current, 1e6 Ohm will be the scaling term for SI - a_(20.0), + a_(20.0), b_(200.0), c_(-0.065), // -65 mV d_(2.0), // assuming u is in mV/ms @@ -284,7 +284,7 @@ IzhikevichNrn::IzhikevichNrn(): u_(-13.0), Vmax_(0.03), // 30 mV initVm_(-0.065),// -65 mV - initU_(-13.0), + initU_(-13.0), sum_inject_(0.0), Im_(0.0), savedVm_(-0.065), @@ -318,7 +318,7 @@ double IzhikevichNrn::getB() const { return b_; } -void IzhikevichNrn::setC( double value) +void IzhikevichNrn::setC( double value) { c_ = value; } @@ -326,9 +326,9 @@ void IzhikevichNrn::setC( double value) double IzhikevichNrn::getC() const { return c_; -} +} -void IzhikevichNrn::setD( double value) +void IzhikevichNrn::setD( double value) { d_ = value; } @@ -346,22 +346,22 @@ void IzhikevichNrn::setRmByTau( double value) double IzhikevichNrn::getRmByTau() const { return RmByTau_; -} -void IzhikevichNrn::setVm( double value) +} +void IzhikevichNrn::setVm( double value) { Vm_ = value; } double IzhikevichNrn::getU() const { return u_; -} +} double IzhikevichNrn::getVm() const { return savedVm_; -} +} -void IzhikevichNrn::setVmax( double value) +void IzhikevichNrn::setVmax( double value) { Vmax_ = value; } @@ -371,7 +371,7 @@ double IzhikevichNrn::getVmax() const return Vmax_; } -void IzhikevichNrn::setAlpha( double value) +void IzhikevichNrn::setAlpha( double value) { alpha_ = value; } @@ -389,9 +389,9 @@ void IzhikevichNrn::setBeta( double value) double IzhikevichNrn::getBeta() const { return beta_; -} +} -void IzhikevichNrn::setGamma( double value) +void IzhikevichNrn::setGamma( double value) { gamma_ = value; } @@ -399,7 +399,7 @@ void IzhikevichNrn::setGamma( double value) double IzhikevichNrn::getGamma() const { return gamma_; -} +} void IzhikevichNrn::setInject( double value) { @@ -409,14 +409,14 @@ void IzhikevichNrn::setInject( double value) double IzhikevichNrn::getInject() const { return inject_; -} +} double IzhikevichNrn::getIm() const { return Im_; -} +} -void IzhikevichNrn::setInitVm( double value) +void IzhikevichNrn::setInitVm( double value) { initVm_ = value; } @@ -426,7 +426,7 @@ double IzhikevichNrn::getInitVm() const return initVm_; } -void IzhikevichNrn::setInitU( double value) +void IzhikevichNrn::setInitU( double value) { initU_ = value; } @@ -436,7 +436,7 @@ double IzhikevichNrn::getInitU() const return initU_; } -void IzhikevichNrn::setAccommodating( bool value) +void IzhikevichNrn::setAccommodating( bool value) { accommodating_ = value; } @@ -446,7 +446,7 @@ bool IzhikevichNrn::getAccommodating() const return accommodating_; } -void IzhikevichNrn::setU0( double value) +void IzhikevichNrn::setU0( double value) { u0_ = value; } @@ -483,7 +483,7 @@ void IzhikevichNrn::process(const Eref& eref, ProcPtr proc) } else { savedVm_ = Vm_; VmOut()->send(eref, Vm_); - } + } } void IzhikevichNrn::reinit(const Eref& eref, ProcPtr proc) @@ -493,8 +493,8 @@ void IzhikevichNrn::reinit(const Eref& eref, ProcPtr proc) u_ = initU_; Im_ = 0.0; savedVm_ = Vm_; - VmOut()->send(eref, Vm_); + VmOut()->send(eref, Vm_); } -// +// // IzhikevichNrn.cpp ends here diff --git a/moose-core/biophysics/IzhikevichNrn.h b/moose-core/biophysics/IzhikevichNrn.h index b818ec2460dac5ee8d604c1c5a8a486d171df94c..1e27ec503d5329b5b0328f7abb998187e82748b3 100644 --- a/moose-core/biophysics/IzhikevichNrn.h +++ b/moose-core/biophysics/IzhikevichNrn.h @@ -1,30 +1,30 @@ -// IzhikevichNrn.h --- -// +// IzhikevichNrn.h --- +// // Filename: IzhikevichNrn.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Fri Jul 8 09:55:21 2011 (+0530) -// Version: +// Version: // Last-Updated: Fri Jul 8 15:37:02 2011 (+0530) // By: Subhasis Ray // Update #: 13 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// // Implementation of Izhikevich Neuron model. -// -// +// +// // Change log: -// -// -// +// +// +// // Code: @@ -39,7 +39,7 @@ class IzhikevichNrn ~IzhikevichNrn(); void setA( double value ); double getA() const; - + void setB( double value ); double getB() const; @@ -92,7 +92,7 @@ class IzhikevichNrn static const Cinfo * initCinfo(); - + private: double alpha_; double beta_; @@ -117,5 +117,5 @@ class IzhikevichNrn #endif -// +// // IzhikevichNrn.h ends here diff --git a/moose-core/biophysics/Leakage.cpp b/moose-core/biophysics/Leakage.cpp index a3d196ba6c6f73af62bb7769b38a33ccf5702048..ae78b6ee2e43de1a4ef83d8f1052c9bd9ad27fe5 100644 --- a/moose-core/biophysics/Leakage.cpp +++ b/moose-core/biophysics/Leakage.cpp @@ -1,47 +1,47 @@ -// Leakage.cpp --- -// +// Leakage.cpp --- +// // Filename: Leakage.cpp -// Description: +// Description: // Author: subhasis ray -// Maintainer: +// Maintainer: // Created: Mon Aug 3 02:32:29 2009 (+0530) -// Version: +// Version: // Last-Updated: Mon Aug 10 11:15:39 2009 (+0530) // By: subhasis ray // Update #: 71 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// // Commentary: Reimplementation of leakage class of GENESIS -// -// -// -// +// +// +// +// // 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: @@ -59,7 +59,7 @@ const Cinfo* Leakage::initCinfo() }; static Dinfo< Leakage > dinfo; - + static Cinfo LeakageCinfo( "Leakage", ChanBase::initCinfo(), @@ -106,5 +106,5 @@ void Leakage::vSetGbar( const Eref& e, double gbar ) ChanCommon::vSetGbar( e, gbar ); } -// +// // Leakage.cpp ends here diff --git a/moose-core/biophysics/Leakage.h b/moose-core/biophysics/Leakage.h index 82f5a990fdb08978fb172b67bbe8e33bd800bff5..959b5327a1e566b4337f2a0164d6196670b45fa7 100644 --- a/moose-core/biophysics/Leakage.h +++ b/moose-core/biophysics/Leakage.h @@ -1,48 +1,48 @@ -// Leakage.h --- +// Leakage.h --- -// +// // Filename: Leakage.h -// Description: +// Description: // Author: subhasis ray -// Maintainer: +// Maintainer: // Created: Mon Aug 3 02:22:58 2009 (+0530) -// Version: +// Version: // Last-Updated: Mon Aug 3 03:07:21 2009 (+0530) // By: subhasis ray // Update #: 18 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// // Commentary: Reimplementation of leakage class in GENESIS -// -// -// -// +// +// +// +// // Change log: -// +// // 2014-05-23: Subha - ported to async13 branch -// -// +// +// // 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: @@ -65,5 +65,5 @@ class Leakage: public ChanCommon -// +// // Leakage.h ends here diff --git a/moose-core/biophysics/MMPump.cpp b/moose-core/biophysics/MMPump.cpp index f9ed90ef61899052687647517323cfe0a1e51115..e6c0dd768a1e8098c0fb05a97c41ae56480054af 100644 --- a/moose-core/biophysics/MMPump.cpp +++ b/moose-core/biophysics/MMPump.cpp @@ -19,34 +19,34 @@ const Cinfo * MMPump::initCinfo() static DestFinfo reinit( "reinit", "Reinit happens only in stage 0", new ProcOpFunc< MMPump>( &MMPump::reinit )); - + static Finfo* processShared[] = { &process, &reinit }; static SharedFinfo proc( - "proc", + "proc", "Shared message to receive Process message from scheduler", processShared, sizeof( processShared ) / sizeof( Finfo* )); - + //////////////////////////// // Field defs //////////////////////////// - - + + static ElementValueFinfo<MMPump, double> Vmax("Vmax", "maximum pump velocity, scaled by mebrane" "surface area. i.e., max ion flux in moles/sec", &MMPump::setVmax, &MMPump::getVmax); - + static ElementValueFinfo<MMPump, double> Kd("Kd", "half-maximal activating concentration in mM", &MMPump::setKd, &MMPump::getKd); - + //// // DestFinfo //// @@ -54,14 +54,14 @@ const Cinfo * MMPump::initCinfo() ////////////////////////////////////////////////////////////////// // Field definitions ////////////////////////////////////////////////////////////////// - - + + &Vmax, &Kd, ////////////////////////////////////////////////////////////////// // SharedFinfo definitions ///////////////////////////////////////////////////////////////// - + &proc, PumpOut(), ////////////////////////////////////////////////////////////////// @@ -132,7 +132,7 @@ if ( value < 0.0 ) { void MMPump::process(const Eref& e, ProcPtr p) { - PumpOut()->send(e,Vmax_,Kd_); + PumpOut()->send(e,Vmax_,Kd_); } void MMPump::reinit(const Eref& e, ProcPtr p) diff --git a/moose-core/biophysics/MMPump.h b/moose-core/biophysics/MMPump.h index 911fb1d4b118cb49e4b1b1a3ab5d3fe06ada55c7..bc4fdf8cbb74b6656720b737e48722af1eb43148 100644 --- a/moose-core/biophysics/MMPump.h +++ b/moose-core/biophysics/MMPump.h @@ -20,23 +20,23 @@ public: double getVmax(const Eref& e) const; //Vmax of the pump void setVmax(const Eref& e,double value); - + int getVal(const Eref& e) const; //Valence void setVal(const Eref& e,int value); - + double getKd(const Eref& e) const; // Pump's Kd void setKd(const Eref& e,double value); - - + + static SrcFinfo2< double,double >* PumpOut(); //Pump parameters; static const Cinfo * initCinfo(); private: - + double Vmax_; - double Kd_; + double Kd_; }; diff --git a/moose-core/biophysics/MarkovChannel.cpp b/moose-core/biophysics/MarkovChannel.cpp index 47991d19e19d0a81632bc77000c5be7579e6b52d..ab601ca8df7ea245d9118d1b4fb0854e35eff306 100644 --- a/moose-core/biophysics/MarkovChannel.cpp +++ b/moose-core/biophysics/MarkovChannel.cpp @@ -36,14 +36,14 @@ const Cinfo* MarkovChannel::initCinfo() &MarkovChannel::getVm ); - static ValueFinfo< MarkovChannel, unsigned int > numstates( "numStates", + static ValueFinfo< MarkovChannel, unsigned int > numstates( "numStates", "The number of states that the channel can occupy.", &MarkovChannel::setNumStates, - &MarkovChannel::getNumStates + &MarkovChannel::getNumStates ); - static ValueFinfo< MarkovChannel, unsigned int > numopenstates( "numOpenStates", + static ValueFinfo< MarkovChannel, unsigned int > numopenstates( "numOpenStates", "The number of states which are open/conducting.", &MarkovChannel::setNumOpenStates, &MarkovChannel::getNumOpenStates @@ -54,7 +54,7 @@ const Cinfo* MarkovChannel::initCinfo() &MarkovChannel::setStateLabels, &MarkovChannel::getStateLabels ); - + static ReadOnlyValueFinfo< MarkovChannel, vector< double > > state( "state", "This is a row vector that contains the probabilities of finding the channel in each state.", &MarkovChannel::getState @@ -72,8 +72,8 @@ const Cinfo* MarkovChannel::initCinfo() &MarkovChannel::getGbars ); - //MsgDest functions - static DestFinfo handleligandconc( "handleLigandConc", + //MsgDest functions + static DestFinfo handleligandconc( "handleLigandConc", "Deals with incoming messages containing information of ligand concentration", new OpFunc1< MarkovChannel, double >(&MarkovChannel::handleLigandConc) ); @@ -82,11 +82,11 @@ const Cinfo* MarkovChannel::initCinfo() new OpFunc1< MarkovChannel, vector< double > >(&MarkovChannel::handleState) ); /////////////////////////////////////////// - static Finfo* MarkovChannelFinfos[] = + static Finfo* MarkovChannelFinfos[] = { &ligandconc, &vm, - &numstates, + &numstates, &numopenstates, &state, &initialstate, @@ -96,17 +96,17 @@ const Cinfo* MarkovChannel::initCinfo() &handlestate, }; - static string doc[] = + static string doc[] = { "Name", "MarkovChannel", "Author", "Vishaka Datta S, 2011, NCBS", - "Description", "MarkovChannel : Multistate ion channel class." + "Description", "MarkovChannel : Multistate ion channel class." "It deals with ion channels which can be found in one of multiple states, " "some of which are conducting. This implementation assumes the occurence " "of first order kinetics to calculate the probabilities of the channel " "being found in all states. Further, the rates of transition between these " "states can be constant, voltage-dependent or ligand dependent (only one " - "ligand species). The current flow obtained from the channel is calculated " + "ligand species). The current flow obtained from the channel is calculated " "in a deterministic method by solving the system of differential equations " "obtained from the assumptions above." }; @@ -129,11 +129,11 @@ static const Cinfo* markovChannelCinfo = MarkovChannel::initCinfo(); MarkovChannel::MarkovChannel() : g_(0), - ligandConc_(0), + ligandConc_(0), numStates_(0), numOpenStates_(0) { ; } - + MarkovChannel::MarkovChannel(unsigned int numStates, unsigned int numOpenStates) : g_(0), ligandConc_(0), numStates_(numStates), numOpenStates_(numOpenStates) { @@ -144,7 +144,7 @@ MarkovChannel::MarkovChannel(unsigned int numStates, unsigned int numOpenStates) } MarkovChannel::~MarkovChannel( ) -{ +{ ; } @@ -153,7 +153,7 @@ double MarkovChannel::getVm( ) const return Vm_; } -void MarkovChannel::setVm( double Vm ) +void MarkovChannel::setVm( double Vm ) { Vm_ = Vm; } @@ -163,7 +163,7 @@ double MarkovChannel::getLigandConc( ) const return ligandConc_; } -void MarkovChannel::setLigandConc( double ligandConc ) +void MarkovChannel::setLigandConc( double ligandConc ) { ligandConc_ = ligandConc; } @@ -173,8 +173,8 @@ unsigned int MarkovChannel::getNumStates( ) const return numStates_; } -void MarkovChannel::setNumStates( unsigned int numStates ) -{ +void MarkovChannel::setNumStates( unsigned int numStates ) +{ numStates_ = numStates; } @@ -200,15 +200,15 @@ void MarkovChannel::setStateLabels( vector< string > stateLabels ) vector< double > MarkovChannel::getState ( ) const { - return state_; + return state_; } -vector< double > MarkovChannel::getInitialState() const +vector< double > MarkovChannel::getInitialState() const { return initialState_; } -void MarkovChannel::setInitialState( vector< double > initialState ) +void MarkovChannel::setInitialState( vector< double > initialState ) { initialState_ = initialState; state_ = initialState; @@ -228,40 +228,40 @@ void MarkovChannel::setGbars( vector< double > Gbars ) //MsgDest functions //////////////////////////// -void MarkovChannel::vProcess( const Eref& e, const ProcPtr p ) +void MarkovChannel::vProcess( const Eref& e, const ProcPtr p ) { g_ = 0.0; - + //Cannot use the Gbar_ variable of the ChanBase class. The conductance //Gk_ calculated here is the "expected conductance" of the channel due to its - //stochastic nature. + //stochastic nature. for( unsigned int i = 0; i < numOpenStates_; ++i ) - g_ += Gbars_[i] * state_[i]; + g_ += Gbars_[i] * state_[i]; setGk( e, g_ ); updateIk(); - sendProcessMsgs( e, p ); + sendProcessMsgs( e, p ); } void MarkovChannel::vReinit( const Eref& e, const ProcPtr p ) { g_ = 0.0; - if ( initialState_.empty() ) + if ( initialState_.empty() ) { cerr << "MarkovChannel::reinit : Initial state has not been set.!\n"; return; } state_ = initialState_; - sendReinitMsgs( e, p ); + sendReinitMsgs( e, p ); } void MarkovChannel::handleLigandConc( double ligandConc ) { - ligandConc_ = ligandConc; + ligandConc_ = ligandConc; } void MarkovChannel::handleState( vector< double > state ) diff --git a/moose-core/biophysics/MarkovChannel.h b/moose-core/biophysics/MarkovChannel.h index 21f2cce93a27b363fb83dcc442754ddcc9412a2b..c3b9493895f18616dfe4467415295da5ec6dfb9c 100644 --- a/moose-core/biophysics/MarkovChannel.h +++ b/moose-core/biophysics/MarkovChannel.h @@ -1,11 +1,11 @@ #ifndef _MARKOVCHANNEL_H #define _MARKOVCHANNEL_H -//This class deals with ion channels which can be found in one of multiple -//states, some of which are conducting. This implementation assumes the +//This class deals with ion channels which can be found in one of multiple +//states, some of which are conducting. This implementation assumes the //occurence of first order kinetics to calculate the probabilities of the -//channel of being found in all states. Further, the rates of transition -//between these states can be constant, voltage-dependent, ligand dependent +//channel of being found in all states. Further, the rates of transition +//between these states can be constant, voltage-dependent, ligand dependent //(only one ligand species) or both. The current flow obtained from the channel //is calculated in a deterministic method by solving the system of //differential equations obtained from the assumptions above. @@ -16,20 +16,20 @@ class MarkovChannel : public ChanCommon { public: //Default constructor. Use is not recommended as most of the class members - //cannot be initialized. + //cannot be initialized. MarkovChannel(); //Constructor to be used when number of states and number of open states are //known. Use of this constructor is recommended as all the other members of - //the class can be initialized with the information provided. + //the class can be initialized with the information provided. static const Cinfo* initCinfo(); MarkovChannel( unsigned int, unsigned int); ~MarkovChannel( ); - double getVm( ) const; + double getVm( ) const; void setVm( double ); - + double getLigandConc( ) const; void setLigandConc( double ); @@ -63,14 +63,14 @@ class MarkovChannel : public ChanCommon ////////////////////// //MsgDest functions ///////////////////// - + void vProcess( const Eref&, const ProcPtr); void vReinit( const Eref&, const ProcPtr); void handleLigandConc( double ); void handleState( vector< double > ); private: - double g_; //Expected conductance of the channel. + double g_; //Expected conductance of the channel. double ligandConc_; //Ligand concentration. unsigned int numStates_; //Total number of states. unsigned int numOpenStates_; //Number of open (conducting) states. diff --git a/moose-core/biophysics/MarkovGslSolver.cpp b/moose-core/biophysics/MarkovGslSolver.cpp index 0c3bb9ff138f52dd8b57eba3d026aea47199c3da..0260215a7ee77b484a2a390297afe709c27619d6 100644 --- a/moose-core/biophysics/MarkovGslSolver.cpp +++ b/moose-core/biophysics/MarkovGslSolver.cpp @@ -24,35 +24,35 @@ const Cinfo* MarkovGslSolver::initCinfo() /////////////////////////////////////////////////////// // Field definitions /////////////////////////////////////////////////////// - static ReadOnlyValueFinfo< MarkovGslSolver, bool > isInitialized( - "isInitialized", + static ReadOnlyValueFinfo< MarkovGslSolver, bool > isInitialized( + "isInitialized", "True if the message has come in to set solver parameters.", &MarkovGslSolver::getIsInitialized ); - static ValueFinfo< MarkovGslSolver, string > method( "method", + static ValueFinfo< MarkovGslSolver, string > method( "method", "Numerical method to use.", &MarkovGslSolver::setMethod, - &MarkovGslSolver::getMethod + &MarkovGslSolver::getMethod ); - static ValueFinfo< MarkovGslSolver, double > relativeAccuracy( - "relativeAccuracy", + static ValueFinfo< MarkovGslSolver, double > relativeAccuracy( + "relativeAccuracy", "Accuracy criterion", &MarkovGslSolver::setRelativeAccuracy, &MarkovGslSolver::getRelativeAccuracy ); - static ValueFinfo< MarkovGslSolver, double > absoluteAccuracy( - "absoluteAccuracy", + static ValueFinfo< MarkovGslSolver, double > absoluteAccuracy( + "absoluteAccuracy", "Another accuracy criterion", &MarkovGslSolver::setAbsoluteAccuracy, &MarkovGslSolver::getAbsoluteAccuracy ); - static ValueFinfo< MarkovGslSolver, double > internalDt( - "internalDt", + static ValueFinfo< MarkovGslSolver, double > internalDt( + "internalDt", "internal timestep to use.", &MarkovGslSolver::setInternalDt, &MarkovGslSolver::getInternalDt ); - + /////////////////////////////////////////////////////// // DestFinfo definitions /////////////////////////////////////////////////////// @@ -92,16 +92,16 @@ const Cinfo* MarkovGslSolver::initCinfo() &absoluteAccuracy, // ValueFinfo &internalDt, // ValueFinfo &init, // DestFinfo - &handleQ, // DestFinfo + &handleQ, // DestFinfo &proc, // SharedFinfo stateOut(), // SrcFinfo }; - - static string doc[] = + + static string doc[] = { "Name", "MarkovGslSolver", "Author", "Vishaka Datta S, 2011, NCBS", - "Description", "Solver for Markov Channel." + "Description", "Solver for Markov Channel." }; static Dinfo< MarkovGslSolver > dinfo; @@ -147,7 +147,7 @@ MarkovGslSolver::~MarkovGslSolver() gsl_odeiv_control_free( gslControl_ ); if ( gslStep_ ) gsl_odeiv_step_free( gslStep_ ); - + if ( stateGsl_ ) delete[] stateGsl_; } @@ -263,7 +263,7 @@ void MarkovGslSolver::init( vector< double > initialState ) Q_.resize( nVars_ ); for ( unsigned int i = 0; i < nVars_; ++i ) - Q_[i].resize( nVars_, 0.0 ); + Q_[i].resize( nVars_, 0.0 ); isInitialized_ = 1; @@ -283,11 +283,11 @@ void MarkovGslSolver::init( vector< double > initialState ) if ( !gslControl_ ) gslControl_ = gsl_odeiv_control_y_new( absAccuracy_, relAccuracy_ ); - else + else gsl_odeiv_control_init(gslControl_,absAccuracy_, relAccuracy_, 1, 0); assert(gslControl_!= 0); - + gslSys_.function = &MarkovGslSolver::evalSystem; gslSys_.jacobian = 0; gslSys_.dimension = nVars_; @@ -307,8 +307,8 @@ void MarkovGslSolver::process( const Eref& e, ProcPtr info ) stateGsl_[i] = state_[i]; while ( t < nextt ) { - int status = gsl_odeiv_evolve_apply ( - gslEvolve_, gslControl_, gslStep_, &gslSys_, + int status = gsl_odeiv_evolve_apply ( + gslEvolve_, gslControl_, gslStep_, &gslSys_, &t, nextt, &internalStepSize_, stateGsl_); @@ -340,7 +340,7 @@ void MarkovGslSolver::reinit( const Eref& e, ProcPtr info ) "Initial state has not been set. Solver has not been initialized." "Call init() before running.\n"; } - + stateOut()->send( e, state_ ); } diff --git a/moose-core/biophysics/MarkovGslSolver.h b/moose-core/biophysics/MarkovGslSolver.h index 8d2f76af43270acf2b59d56f1f689423ed0bbbff..a1ae31f125d1ed9dfea98df7d633361af357ecd4 100644 --- a/moose-core/biophysics/MarkovGslSolver.h +++ b/moose-core/biophysics/MarkovGslSolver.h @@ -16,10 +16,10 @@ // // The GslIntegrator class in ksolve deals with a system whose coefficients stay // constant. In the case of a Markov channel, the coefficients of the system -// vary with time. +// vary with time. // // This makes it necessary for the system to keep track of changes in the system -// matrix, which is implemented by the message handler. +// matrix, which is implemented by the message handler. /////////////////////////////////////////////////// class MarkovGslSolver @@ -75,4 +75,4 @@ class MarkovGslSolver static int evalSystem( double, const double*, double*, void* ); }; -#endif +#endif diff --git a/moose-core/biophysics/MarkovRateTable.cpp b/moose-core/biophysics/MarkovRateTable.cpp index 6f992c26834af6737a6b2fa6ea6b434e57d06797..12dbe32fcdc36d041485180ee5e2ff9bd37d0891 100644 --- a/moose-core/biophysics/MarkovRateTable.cpp +++ b/moose-core/biophysics/MarkovRateTable.cpp @@ -13,11 +13,11 @@ #include "MarkovRateTable.h" //Message source that sends out instantaneous rate information at each time step -//to the solver object. +//to the solver object. static SrcFinfo1< vector< vector< double > > >* instRatesOut() { static SrcFinfo1< vector< vector< double > > > instRatesOut( - "instratesOut", + "instratesOut", "Sends out instantaneous rate information of varying transition rates" "at each time step."); @@ -29,20 +29,20 @@ const Cinfo* MarkovRateTable::initCinfo() ///////////////////// //SharedFinfos ///////////////////// - static DestFinfo handleVm("handleVm", + static DestFinfo handleVm("handleVm", "Handles incoming message containing voltage information.", new OpFunc1< MarkovRateTable, double >(&MarkovRateTable::handleVm) ); - static Finfo* channelShared[] = + static Finfo* channelShared[] = { &handleVm }; static SharedFinfo channel("channel", "This message couples the rate table to the compartment. The rate table" - " needs updates on voltage in order to compute the rate table.", - channelShared, sizeof( channelShared ) / sizeof( Finfo* ) + " needs updates on voltage in order to compute the rate table.", + channelShared, sizeof( channelShared ) / sizeof( Finfo* ) ); ///////////////////// @@ -50,9 +50,9 @@ const Cinfo* MarkovRateTable::initCinfo() //////////////////// static DestFinfo process( "process", "Handles process call", - new ProcOpFunc< MarkovRateTable >( &MarkovRateTable::process ) ); + new ProcOpFunc< MarkovRateTable >( &MarkovRateTable::process ) ); - static DestFinfo reinit( "reinit", + static DestFinfo reinit( "reinit", "Handles reinit call", new ProcOpFunc< MarkovRateTable >( &MarkovRateTable::reinit ) ); @@ -61,7 +61,7 @@ const Cinfo* MarkovRateTable::initCinfo() &process, &reinit }; - static SharedFinfo proc( "proc", + static SharedFinfo proc( "proc", "This is a shared message to receive Process message from the" "scheduler. The first entry is a MsgDest for the Process " "operation. It has a single argument, ProcInfo, which " @@ -92,15 +92,15 @@ const Cinfo* MarkovRateTable::initCinfo() ( &MarkovRateTable::setInt2dChildTable ) ); - static DestFinfo setconst("setconst", + static DestFinfo setconst("setconst", "Setting a constant value for the (i,j)'th rate. Internally, this is" " stored as a 1-D rate with a lookup table containing 1 entry.", new OpFunc3< MarkovRateTable, unsigned int, unsigned int, double > - ( &MarkovRateTable::setConstantRate ) + ( &MarkovRateTable::setConstantRate ) ); /////////////////////////// - //Field information. + //Field information. ////////////////////////// static ValueFinfo< MarkovRateTable, double > ligandconc( "ligandConc", "Ligand concentration.", @@ -115,16 +115,16 @@ const Cinfo* MarkovRateTable::initCinfo() ); static ReadOnlyValueFinfo< MarkovRateTable, vector< vector< double > > > - Q( "Q", + Q( "Q", "Instantaneous rate matrix.", &MarkovRateTable::getQ ); //Really no point in allowing access to Vm_ and ligandConc_ when it is //available from the MarkovChannel class. - + static ReadOnlyValueFinfo< MarkovRateTable, unsigned int > - size( "size", + size( "size", "Dimension of the families of lookup tables. Is always equal to the number of states in the model.", &MarkovRateTable::getSize ); @@ -175,13 +175,13 @@ MarkovRateTable::MarkovRateTable() : MarkovRateTable::~MarkovRateTable() { - for ( unsigned int i = 0; i < size_; ++i ) + for ( unsigned int i = 0; i < size_; ++i ) { for ( unsigned int j = 0; j < size_; ++j ) { - if ( isRate1d( i, j ) || isRateConstant( i, j ) ) + if ( isRate1d( i, j ) || isRateConstant( i, j ) ) delete vtTables_[i][j]; - if ( isRate2d( i, j ) ) + if ( isRate2d( i, j ) ) delete int2dTables_[i][j]; } } @@ -191,7 +191,7 @@ VectorTable* MarkovRateTable::getVtChildTable( unsigned int i, unsigned int j ) { if ( isRate1d( i, j ) || isRateConstant( i, j ) ) return vtTables_[i][j]; - else + else { cerr << "MarkovRateTable::getVtChildTable : Error : No one parameter rate " "table set for (" << i+1 << "," << j+1 << "). Returing NULL.\n"; @@ -200,18 +200,18 @@ VectorTable* MarkovRateTable::getVtChildTable( unsigned int i, unsigned int j ) } void MarkovRateTable::innerSetVtChildTable( unsigned int i, unsigned int j, - VectorTable vecTable, - unsigned int ligandFlag ) + VectorTable vecTable, + unsigned int ligandFlag ) { if ( areIndicesOutOfBounds( i, j ) ) { cerr << "MarkovRateTable::innerSetVtChildTable : Error : Table requested" "is out of bounds!.\n"; - return; + return; } //Checking to see if this rate has already been set with a 2-parameter rate. - if ( isRate2d( i, j ) || isRateConstant( i, j ) || isRate1d( i, j ) ) + if ( isRate2d( i, j ) || isRateConstant( i, j ) || isRate1d( i, j ) ) { cerr << "MarkovRateTable::innerSetVtChildTable : Error : " "Rate (" << i+1 << "," << j+1 << ")has already been set.\n"; @@ -225,7 +225,7 @@ void MarkovRateTable::innerSetVtChildTable( unsigned int i, unsigned int j, return; } - //If table hasnt been allocated any memory, do so. + //If table hasnt been allocated any memory, do so. if ( vtTables_[i][j] == 0 ) vtTables_[i][j] = new VectorTable(); @@ -237,7 +237,7 @@ Interpol2D* MarkovRateTable::getInt2dChildTable( unsigned int i, unsigned int j { if ( isRate2d( i, j ) ) return int2dTables_[i][j]; - else + else { cerr << "MarkovRateTable::getInt2dChildTable : Error : No two parameter" " rate table set for (" << i+1 << "," << j+1 << "). Returning NULL.\n"; @@ -247,16 +247,16 @@ Interpol2D* MarkovRateTable::getInt2dChildTable( unsigned int i, unsigned int j void MarkovRateTable::innerSetInt2dChildTable( unsigned int i, unsigned int j, Interpol2D int2dTable ) { - if ( areIndicesOutOfBounds( i, j ) ) + if ( areIndicesOutOfBounds( i, j ) ) { cerr << "MarkovRateTable::innerSetInt2dChildTable : Error : Table requested" " is out of bounds\n"; return; } - - if ( isRate1d( i, j ) || isRate2d( i, j ) || isRateConstant( i, j ) ) + + if ( isRate1d( i, j ) || isRate2d( i, j ) || isRateConstant( i, j ) ) { - cerr << "MarkovRateTable::innerSetInt2dChildTable : Error : Rate (" << + cerr << "MarkovRateTable::innerSetInt2dChildTable : Error : Rate (" << i+1 << "," << j+1 << ") has already been set!\n"; return; } @@ -279,9 +279,9 @@ void MarkovRateTable::innerSetInt2dChildTable( unsigned int i, unsigned int j, I double MarkovRateTable::lookup1dValue( unsigned int i, unsigned int j, double x ) { - if ( areIndicesOutOfBounds( i, j ) ) + if ( areIndicesOutOfBounds( i, j ) ) { - cerr << "MarkovRateTable::lookup1dValue : Lookup requested on non-existent" + cerr << "MarkovRateTable::lookup1dValue : Lookup requested on non-existent" "table at (" << i + 1 << "," << j + 1 << "). Returning 0.\n"; return 0; } @@ -299,7 +299,7 @@ double MarkovRateTable::lookup1dValue( unsigned int i, unsigned int j, double x double MarkovRateTable::lookup1dIndex( unsigned int i, unsigned int j, unsigned int xIndex ) { - if ( areIndicesOutOfBounds( i, j ) ) + if ( areIndicesOutOfBounds( i, j ) ) { cerr << "MarkovRateTable::lookup1dIndex : Lookup requested on non-" "existent table at (" << i << "," << j << "). Returning 0.\n"; @@ -316,10 +316,10 @@ double MarkovRateTable::lookup1dIndex( unsigned int i, unsigned int j, return vtTables_[i][j]->lookupByIndex( xIndex ); } -double MarkovRateTable::lookup2dValue( unsigned int i, unsigned int j, +double MarkovRateTable::lookup2dValue( unsigned int i, unsigned int j, double x, double y ) { - if ( areIndicesOutOfBounds( i, j ) ) + if ( areIndicesOutOfBounds( i, j ) ) { cerr << "MarkovRateTable::lookup2dValue : Lookup requested on non-existent" " table at (" << i + 1<< "," << j+1 << "). Returning 0.\n"; @@ -328,7 +328,7 @@ double MarkovRateTable::lookup2dValue( unsigned int i, unsigned int j, if ( !isRate2d( i, j ) ) { - cerr << "MarkovRateTable::lookup2dValue : No 2D rate set at (" << i+1 << "," + cerr << "MarkovRateTable::lookup2dValue : No 2D rate set at (" << i+1 << "," << j+1 << "). Returning 0.\n"; return 0; } @@ -336,10 +336,10 @@ double MarkovRateTable::lookup2dValue( unsigned int i, unsigned int j, return int2dTables_[i][j]->innerLookup( x, y ); } -double MarkovRateTable::lookup2dIndex( unsigned int i, unsigned int j, +double MarkovRateTable::lookup2dIndex( unsigned int i, unsigned int j, unsigned int xIndex, unsigned int yIndex ) { - if ( areIndicesOutOfBounds( i, j ) ) + if ( areIndicesOutOfBounds( i, j ) ) { cerr << "MarkovRateTable::lookup2dIndex : Lookup requested on non-existent" " table at (" << i+1 << "," << j+1 << "). Returning 0.\n"; @@ -375,7 +375,7 @@ double MarkovRateTable::getVm( ) const return Vm_; } -void MarkovRateTable::setVm( double Vm ) +void MarkovRateTable::setVm( double Vm ) { Vm_ = Vm; } @@ -385,7 +385,7 @@ double MarkovRateTable::getLigandConc( ) const return ligandConc_; } -void MarkovRateTable::setLigandConc( double ligandConc ) +void MarkovRateTable::setLigandConc( double ligandConc ) { ligandConc_ = ligandConc; } @@ -416,7 +416,7 @@ bool MarkovRateTable::isRate1d( unsigned int i, unsigned int j ) const bool MarkovRateTable::isRateLigandDep( unsigned int i, unsigned int j ) const { - return ( isRate1d( i, j ) && useLigandConc_[i][j] > 0 ); + return ( isRate1d( i, j ) && useLigandConc_[i][j] > 0 ); } bool MarkovRateTable::isRate2d( unsigned int i, unsigned int j ) const @@ -431,7 +431,7 @@ bool MarkovRateTable::areIndicesOutOfBounds( unsigned int i, unsigned int j ) co bool MarkovRateTable::areAllRatesConstant() { - return listOf1dRates_.empty() && listOf2dRates_.empty() && + return listOf1dRates_.empty() && listOf2dRates_.empty() && !listOfConstantRates_.empty(); } @@ -491,7 +491,7 @@ void MarkovRateTable::updateRates() { j = ( listOf1dRates_[k] % 10 ) - 1; i = ( ( listOf1dRates_[k] / 10 ) % 10 ) - 1; - + temp = Q_[i][j]; if ( isRateLigandDep( i, j ) ) @@ -511,7 +511,7 @@ void MarkovRateTable::updateRates() { j = ( listOf2dRates_[k] % 10 ) - 1; i = ( ( listOf2dRates_[k] / 10 ) % 10 ) - 1; - + temp = Q_[i][j]; Q_[i][j] = lookup2dValue( i, j, Vm_, ligandConc_ ); @@ -522,7 +522,7 @@ void MarkovRateTable::updateRates() } } -void MarkovRateTable::initConstantRates() +void MarkovRateTable::initConstantRates() { unsigned int n = listOfConstantRates_.size(), i, j; for ( unsigned int k = 0; k < n; ++k ) @@ -534,11 +534,11 @@ void MarkovRateTable::initConstantRates() //Doesn't really matter which value is looked up as there is only one //entry in the table. - Q_[i][j] = lookup1dValue( i, j, 0.0 ); + Q_[i][j] = lookup1dValue( i, j, 0.0 ); Q_[i][i] -= Q_[i][j]; } -} +} vector< unsigned int > MarkovRateTable::getListOf1dRates() { @@ -580,7 +580,7 @@ istream& operator>>( istream& in, MarkovRateTable& rateTable ) { for ( unsigned int j = 0; j < rateTable.size_; ++j ) { - if ( rateTable.isRate2d( i, j ) ) + if ( rateTable.isRate2d( i, j ) ) in >> *rateTable.int2dTables_[i][j]; } } @@ -607,7 +607,7 @@ bool MarkovRateTable::isInitialized() const //////////////////////////////////////////////// void MarkovRateTable::process( const Eref& e, ProcPtr info ) { - if ( !areAllRatesConstant() ) + if ( !areAllRatesConstant() ) updateRates(); instRatesOut()->send( e, Q_ ); @@ -616,7 +616,7 @@ void MarkovRateTable::process( const Eref& e, ProcPtr info ) void MarkovRateTable::reinit( const Eref& e, ProcPtr info ) { if ( isInitialized() ) - initConstantRates(); + initConstantRates(); else cerr << "MarkovRateTable::reinit : MarkovRateTable class has not been" " initialized!."; @@ -651,11 +651,11 @@ void MarkovRateTable::handleLigandConc( double ligandConc ) ligandConc_ = ligandConc; } -void MarkovRateTable::setVtChildTable( unsigned int i, unsigned int j, +void MarkovRateTable::setVtChildTable( unsigned int i, unsigned int j, Id vecTabId, unsigned int ligandFlag ) { VectorTable* vecTable = reinterpret_cast< VectorTable* > - ( vecTabId.eref().data() ); + ( vecTabId.eref().data() ); innerSetVtChildTable( i - 1, j - 1, *vecTable, ligandFlag ); @@ -663,12 +663,12 @@ void MarkovRateTable::setVtChildTable( unsigned int i, unsigned int j, if ( ligandFlag > 0 ) listOfLigandRates_.push_back( i * 10 + j ); - else + else listOfVoltageRates_.push_back( i * 10 + j ); } void MarkovRateTable::setInt2dChildTable( unsigned int i, unsigned int j, - Id int2dTabId ) + Id int2dTabId ) { Interpol2D* int2dTable = reinterpret_cast< Interpol2D* > ( int2dTabId.eref().data() ); @@ -695,7 +695,7 @@ void MarkovRateTable::setConstantRate( unsigned int i, unsigned int j, double ra vecTable.setTable( rateWrap ); - innerSetVtChildTable( i - 1, j - 1, vecTable, 0 ); + innerSetVtChildTable( i - 1, j - 1, vecTable, 0 ); listOfConstantRates_.push_back( i * 10 + j ); } diff --git a/moose-core/biophysics/MarkovRateTable.h b/moose-core/biophysics/MarkovRateTable.h index d9c88b08e60fd2997e62a579975c589ae134dcc5..e8368c9c6c84f7690427284d74b141f4afd2cdd7 100644 --- a/moose-core/biophysics/MarkovRateTable.h +++ b/moose-core/biophysics/MarkovRateTable.h @@ -16,7 +16,7 @@ // //Presents a unified interface to deal with transition rates that are dependent //on one or two parameters, or are constant. -//Ther Interpol2D class is used for carrying out 2-D rate lookups. The one +//Ther Interpol2D class is used for carrying out 2-D rate lookups. The one //parameter lookup functions are based on the lookup tables used in the HHGate //class. // @@ -25,39 +25,39 @@ //constructors, destructors, etc., using a union is not possible (but would've //been more efficient). // -//For a given rate entry (i,j) either one of these pointers may be set, but not +//For a given rate entry (i,j) either one of these pointers may be set, but not //both. If both pointers are null, the rate is assumed to be zero i.e. there -//is no transition from state i to state j. +//is no transition from state i to state j. // -//In case a rate is constant, it is stored in a VectorTable class whose lookup -//table is of size 1. +//In case a rate is constant, it is stored in a VectorTable class whose lookup +//table is of size 1. // ///////////////////////////////////////////////////// -template <class T> +template <class T> vector< vector< T > > resize( vector< vector< T > >table, unsigned int n, T init ) { - table.resize( n ); + table.resize( n ); - for ( unsigned int i = 0; i < n; ++i ) - table[i].resize( n, init ); + for ( unsigned int i = 0; i < n; ++i ) + table[i].resize( n, init ); return table; } class MarkovRateTable { - public : - MarkovRateTable(); + public : + MarkovRateTable(); ~MarkovRateTable(); //One parameter rate table set and get functions. - VectorTable* getVtChildTable( unsigned int, unsigned int ) const; + VectorTable* getVtChildTable( unsigned int, unsigned int ) const; void innerSetVtChildTable( unsigned int, unsigned int, VectorTable, unsigned int ); //Two parameter rate table set and get functions. Interpol2D* getInt2dChildTable( unsigned int, unsigned int ) const; void innerSetInt2dChildTable( unsigned int, unsigned int, Interpol2D ); - + //Lookup functions. double lookup1dValue( unsigned int, unsigned int, double ); double lookup1dIndex( unsigned int, unsigned int, unsigned int ); @@ -65,7 +65,7 @@ class MarkovRateTable { double lookup2dIndex( unsigned int, unsigned int, unsigned int, unsigned int ); //Rate update and initialization functions. - void updateRates(); + void updateRates(); void initConstantRates(); vector< unsigned int > getListOf1dRates(); @@ -74,26 +74,26 @@ class MarkovRateTable { vector< unsigned int > getListOfVoltageRates(); vector< unsigned int > getListOfConstantRates(); - //Overloading the >> operator. This is done so that VectorTable and + //Overloading the >> operator. This is done so that VectorTable and //Interpol2D classes can be used to declare OpFuncs. - friend istream& operator>>( istream&, MarkovRateTable& ); + friend istream& operator>>( istream&, MarkovRateTable& ); ///////////////////////// //*ValueFinfo related functions. //////////////////////// - vector< vector< double > > getQ() const; + vector< vector< double > > getQ() const; unsigned int getSize() const; - double getVm( ) const; + double getVm( ) const; void setVm( double ); - + double getLigandConc( ) const; void setLigandConc( double ); ////////////////// //Helper functions ///////////////// - + //Returns true if the (i,j)'th rate is zero i.e. no transitions between states //i and j. When this is the case, both the (i,j)'th pointers in vtTables_ // and int2dTables_ are not set i.e. both are zero. @@ -103,11 +103,11 @@ class MarkovRateTable { //vtTables_[i][j] pointer points to a 1D lookup table of size 1. bool isRateConstant( unsigned int, unsigned int ) const ; - //Returns true if the (i,j)'th rate is varies with only one parameter. - bool isRate1d( unsigned int, unsigned int ) const ; + //Returns true if the (i,j)'th rate is varies with only one parameter. + bool isRate1d( unsigned int, unsigned int ) const ; //Returns true if the (i,j)'th rate is dependent on ligand concentration and - //not membrane voltage, and is set with a 1D lookup table. + //not membrane voltage, and is set with a 1D lookup table. bool isRateLigandDep( unsigned int, unsigned int) const; //Returns true if the (i,j)'th rate varies with two parameters. @@ -122,9 +122,9 @@ class MarkovRateTable { ////// //Returns true if all the rates in the transition matrix are constant. - bool areAllRatesConstant(); + bool areAllRatesConstant(); - //Returns true if at least one of the rates are 1D i.e. vary with only + //Returns true if at least one of the rates are 1D i.e. vary with only //one parameter. bool areAnyRates1d(); bool areAllRates1d(); @@ -147,62 +147,62 @@ class MarkovRateTable { ///////////////////// //MsgDest functions. ///////////////////// - void process( const Eref&, ProcPtr ); - void reinit( const Eref&, ProcPtr ); + void process( const Eref&, ProcPtr ); + void reinit( const Eref&, ProcPtr ); //Initialization of object. void init( unsigned int ); //Handling incoming messages containing voltage and concentration information. - void handleVm( double ); + void handleVm( double ); void handleLigandConc( double ); //Setting rate tables for 1-D and 2-D rate transitions. void setVtChildTable( unsigned int, unsigned int, Id, unsigned int ); void setInt2dChildTable( unsigned int, unsigned int, Id ); - //Setting a constant rate. - void setConstantRate( unsigned int, unsigned int, double ); + //Setting a constant rate. + void setConstantRate( unsigned int, unsigned int, double ); - private : - //Family of 1D lookup table pointers. Each entry is a pointer to a 1-D - //lookup table (VectorTable type) that contains the values of the rates of + private : + //Family of 1D lookup table pointers. Each entry is a pointer to a 1-D + //lookup table (VectorTable type) that contains the values of the rates of //transition at a given voltage or ligand concentration. - vector< vector< VectorTable* > > vtTables_; - + vector< vector< VectorTable* > > vtTables_; + //Family of 2D lookup table pointers. Each entry is a pointer to a 2-D //lookup table of type Interpol2D. These lookup tables deal with rates that - //vary with voltage and ligand concentration. - vector< vector< Interpol2D* > > int2dTables_; - + //vary with voltage and ligand concentration. + vector< vector< Interpol2D* > > int2dTables_; + //In the case of 1-D lookup tables, this matrix determines which rates are //ligand dependent. When the (i,j)'th value is "true", the ligand - //concentration is used instead of voltage for rate lookups. - vector< vector< unsigned int > > useLigandConc_; + //concentration is used instead of voltage for rate lookups. + vector< vector< unsigned int > > useLigandConc_; //Maintains a list of the indices of 1D,2D,constant rates, voltage and - //ligand dependent rates. Makes updating rates a whole lot easier and - //more elegant than blindly scanning through the entire rate matrix + //ligand dependent rates. Makes updating rates a whole lot easier and + //more elegant than blindly scanning through the entire rate matrix //each time. vector< unsigned int > listOf1dRates_; vector< unsigned int > listOf2dRates_; vector< unsigned int > listOfConstantRates_; vector< unsigned int > listOfLigandRates_; vector< unsigned int > listOfVoltageRates_; - - //The instantaneous rate matrix. + + //The instantaneous rate matrix. vector< vector< double > > Q_; - //Membrane voltage and ligand concentration. Needed for rate lookups. + //Membrane voltage and ligand concentration. Needed for rate lookups. //Admittedly, this is a bit of a deviation from the usual scheme where - //channels are the only destinations for Vm and conc. + //channels are the only destinations for Vm and conc. double Vm_; double ligandConc_; - //Time step of simulation. The rates are specified in sec^(-1). All the rates + //Time step of simulation. The rates are specified in sec^(-1). All the rates //have to be proportionally scaled for an arbitrary time step. - //Is not a MOOSE field, and does not need an explicit setup call either. - //It is set during the call to reinit. + //Is not a MOOSE field, and does not need an explicit setup call either. + //It is set during the call to reinit. unsigned int size_; diff --git a/moose-core/biophysics/MarkovSolver.cpp b/moose-core/biophysics/MarkovSolver.cpp index 06db62146cf5035c8ed33437ca6e97d23fae6b11..1ab4adc1b6646109457d759b30b10d283aa895df 100644 --- a/moose-core/biophysics/MarkovSolver.cpp +++ b/moose-core/biophysics/MarkovSolver.cpp @@ -23,12 +23,12 @@ const Cinfo* MarkovSolver::initCinfo() ////////////////////// //DestFinfos ////////////////////// - + static DestFinfo process( "process", "Handles process call", - new ProcOpFunc< MarkovSolver >( &MarkovSolver::process ) ); + new ProcOpFunc< MarkovSolver >( &MarkovSolver::process ) ); - static DestFinfo reinit( "reinit", + static DestFinfo reinit( "reinit", "Handles reinit call", new ProcOpFunc< MarkovSolver >( &MarkovSolver::reinit ) ); @@ -37,7 +37,7 @@ const Cinfo* MarkovSolver::initCinfo() &process, &reinit }; - static SharedFinfo proc( "proc", + static SharedFinfo proc( "proc", "This is a shared message to receive Process message from the" "scheduler. The first entry is a MsgDest for the Process " "operation. It has a single argument, ProcInfo, which " @@ -48,14 +48,14 @@ const Cinfo* MarkovSolver::initCinfo() ); - static Finfo* markovSolverFinfos[] = + static Finfo* markovSolverFinfos[] = { &proc, //SharedFinfo }; static Dinfo < MarkovSolver > dinfo; static Cinfo markovSolverCinfo( - "MarkovSolver", + "MarkovSolver", MarkovSolverBase::initCinfo(), markovSolverFinfos, sizeof( markovSolverFinfos ) / sizeof( Finfo* ), @@ -77,7 +77,7 @@ MarkovSolver::~MarkovSolver() ; } -Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, +Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, unsigned int degreeIndex ) { Matrix *expQ; @@ -85,7 +85,7 @@ Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, vector< unsigned int >* swaps = new vector< unsigned int >; unsigned int n = Q1->size(); unsigned int degree = mCandidates[degreeIndex]; - double *padeCoeffs; + double *padeCoeffs; //Vector of Matrix pointers. Each entry is an even power of Q. @@ -124,9 +124,9 @@ Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, //Note that the formula for the 13th degree approximant used here //is different from the one used for smaller degrees. //////// - switch( degree ) + switch( degree ) { - case 3 : + case 3 : case 5 : case 7 : case 9 : @@ -143,9 +143,9 @@ Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, //Computation of U. for ( int i = degree; i > 1; i -= 2 ) - matMatAdd( U, QevenPowers[i/2], 1.0, padeCoeffs[i], FIRST ); + matMatAdd( U, QevenPowers[i/2], 1.0, padeCoeffs[i], FIRST ); - //Adding b0 * I . + //Adding b0 * I . matEyeAdd( U, padeCoeffs[1], 0 ); matMatMul( Q1, U, SECOND ); @@ -174,7 +174,7 @@ Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, //Long and rather messy expression for U and V. //Refer paper mentioned in header for more details. //Storing the result in temporaries is a better idea as it gives us - //control on how many temporaries are being created and also to + //control on how many temporaries are being created and also to //help in memory deallocation. //Computation of U. @@ -184,10 +184,10 @@ Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, matMatMul( Q6, temp, SECOND ); - matMatAdd( temp, Q6, 1.0, b13[7], FIRST ); - matMatAdd( temp, Q4, 1.0, b13[5], FIRST ); - matMatAdd( temp, Q2, 1.0, b13[3], FIRST ); - matEyeAdd( temp, b13[1], DUMMY ); + matMatAdd( temp, Q6, 1.0, b13[7], FIRST ); + matMatAdd( temp, Q4, 1.0, b13[5], FIRST ); + matMatAdd( temp, Q2, 1.0, b13[3], FIRST ); + matEyeAdd( temp, b13[1], DUMMY ); U = matMatMul( Q1, temp ); delete temp; @@ -196,10 +196,10 @@ Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, matMatAdd( temp, Q4, 1.0, b13[10], FIRST ); matMatAdd( temp, Q2, 1.0, b13[8], FIRST ); matMatMul( Q6, temp, SECOND ); - matMatAdd( temp, Q6, 1.0, b13[6], FIRST ); - matMatAdd( temp, Q4, 1.0, b13[4], FIRST ); - matMatAdd( temp, Q2, 1.0, b13[2], FIRST ); - V = matEyeAdd( temp, b13[0] ); + matMatAdd( temp, Q6, 1.0, b13[6], FIRST ); + matMatAdd( temp, Q4, 1.0, b13[4], FIRST ); + matMatAdd( temp, Q2, 1.0, b13[2], FIRST ); + V = matEyeAdd( temp, b13[0] ); delete temp; delete Q2; @@ -214,7 +214,7 @@ Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, invVminusU = matAlloc( n ); matInv( VminusU, swaps, invVminusU ); expQ = matMatMul( invVminusU, VplusU ); - + //Memory cleanup. delete U; @@ -229,7 +229,7 @@ Matrix* MarkovSolver::computePadeApproximant( Matrix* Q1, Matrix* MarkovSolver::computeMatrixExponential() { - double mu, norm; + double mu, norm; unsigned int n = Q_->size(); Matrix *expQ, *Q1; @@ -237,12 +237,12 @@ Matrix* MarkovSolver::computeMatrixExponential() //Q1 <- Q - mu*I //This reduces the norm of the matrix. The idea is that a lower - //order approximant will suffice if the norm is smaller. + //order approximant will suffice if the norm is smaller. Q1 = matEyeAdd( Q_, -mu ); - //We cycle through the first four candidate values of m. The moment the norm + //We cycle through the first four candidate values of m. The moment the norm //satisfies the theta_M bound, we choose that m and compute the Pade' - //approximant to the exponential. We can then directly return the exponential. + //approximant to the exponential. We can then directly return the exponential. norm = matColNorm( Q1 ); for ( unsigned int i = 0; i < 4; ++i ) { @@ -260,13 +260,13 @@ Matrix* MarkovSolver::computeMatrixExponential() double sf = ceil( log( norm / thetaM[4] ) / log( (double)2 ) ); unsigned int s = 0; - if ( sf > 0 ) + if ( sf > 0 ) { s = static_cast< unsigned int >( sf ); matScalShift( Q1, 1.0/(2 << (s - 1)), 0, DUMMY ); } expQ = computePadeApproximant( Q1, 4 ); - + //Upto this point, the matrix stored in expQ is r13, the 13th degree //Pade approximant corresponding to A/2^s, not A. //Now we repeatedly square r13 's' times to get the exponential @@ -308,7 +308,7 @@ void assignMat( Matrix* A, double testMat[3][3] ) //we test out all degrees of the Pade approximant. void testMarkovSolver() { - MarkovSolver solver; + MarkovSolver solver; Matrix *expQ; @@ -381,8 +381,8 @@ void testMarkovSolver() for ( unsigned int i = 0; i < 5; ++i ) { assignMat( solver.Q_, testMats[i] ); - expQ = solver.computeMatrixExponential(); - assert( doubleEq( matColNorm( expQ ), correctColumnNorms[i] ) ); + expQ = solver.computeMatrixExponential(); + assert( doubleEq( matColNorm( expQ ), correctColumnNorms[i] ) ); //Comparing termwise just to be doubly sure. for( unsigned int j = 0; j < 3; ++j ) @@ -411,18 +411,18 @@ void testMarkovSolver() Id solver2dId = Id::nextId(); Id solver1dId = Id::nextId(); - ObjId eRateTable2d = Element( rateTable2dId, rateTableCinfo, + ObjId eRateTable2d = Element( rateTable2dId, rateTableCinfo, "rateTable2d", single, 1, true ); - Element *eRateTable1d = new Element( rateTable1dId, rateTableCinfo, + Element *eRateTable1d = new Element( rateTable1dId, rateTableCinfo, "rateTable1d", single, 1, true ); Element *eInt2d = new Element( int2dId, interpol2dCinfo, "int2d", single, 1 ); - Element *eVecTable = new Element( vecTableId, vectorTableCinfo, "vecTable", + Element *eVecTable = new Element( vecTableId, vectorTableCinfo, "vecTable", single, 1, true ); - Element *eSolver2d = new Element( solver2dId, markovSolverCinfo, - "solver2d", single, 1, true ); - Element *eSolver1d = new Element( solver1dId, markovSolverCinfo, - "solver1d", single, 1, true ); - + Element *eSolver2d = new Element( solver2dId, markovSolverCinfo, + "solver2d", single, 1, true ); + Element *eSolver1d = new Element( solver1dId, markovSolverCinfo, + "solver1d", single, 1, true ); + Eref rateTable2dEref( eRateTable2d, 0 ); Eref rateTable1dEref( eRateTable1d, 0 ); Eref int2dEref( eInt2d, 0 ); @@ -454,7 +454,7 @@ void testMarkovSolver() vecTable->setMax( 0.10 ); vecTable->setDiv( 200 ); - v = vecTable->getMin(); + v = vecTable->getMin(); for ( unsigned int i = 0; i < 201; ++i ) { table1d.push_back( 1e3 * exp( 9 * v - 0.45 ) ); @@ -496,7 +496,7 @@ void testMarkovSolver() markovSolver2d->init( rateTable2dId, 0.1 ); markovSolver1d->init( rateTable1dId, 0.1 ); - + markovSolver2d->setVm( 0.0533 ); markovSolver2d->setLigandConc( 3.41e-6 ); diff --git a/moose-core/biophysics/MarkovSolver.h b/moose-core/biophysics/MarkovSolver.h index 34f8204b03cb106bbc87c1cd4e62c24784874c20..3f008218860de8a58ceb0410f979274f2f774ffb 100644 --- a/moose-core/biophysics/MarkovSolver.h +++ b/moose-core/biophysics/MarkovSolver.h @@ -13,12 +13,12 @@ //Class : MarkovSolver //Author : Vishaka Datta S, 2011, NCBS //Description : Candidate algorithm for solving the system of equations -//associated with the Markov model of multistate ion channels. +//associated with the Markov model of multistate ion channels. // //This implementation computes the matrix exponential using the scaling and -//squaring approach described in +//squaring approach described in //"The Scaling and Squaring Method for the Matrix Exponential Revisited", by -//Nicholas J Higham, 2005, Society for Industrial and Applied Mathematics, +//Nicholas J Higham, 2005, Society for Industrial and Applied Mathematics, //26(4), pp. 1179-1193. // ///////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ /////////////////////////////// class MarkovSolver : public MarkovSolverBase { - public : + public : MarkovSolver(); ~MarkovSolver(); @@ -37,7 +37,7 @@ class MarkovSolver : public MarkovSolverBase { //Scaling-and-squaring related function. Matrix* computePadeApproximant( Matrix*, unsigned int ); - + static const Cinfo* initCinfo(); /////////////////////////// //MsgDest functions. @@ -56,19 +56,19 @@ class MarkovSolver : public MarkovSolverBase { }; //End of class definition. -//Matrix exponential related constants. +//Matrix exponential related constants. //Coefficients of Pade approximants for degrees 3,5,7,9,13. -static double b13[14] = - {64764752532480000.0, 32382376266240000.0, 7771770303897600.0, +static double b13[14] = + {64764752532480000.0, 32382376266240000.0, 7771770303897600.0, 1187353796428800.0, 129060195264000.0, 10559470521600.0, 670442572800.0, 33522128640.0, 1323241920.0, 40840800.0, 960960.0, 16380.0, 182.0, 1.0}; -static double b9[10] = - {17643225600.0, 8821612800.0, 2075673600.0, 302702400.0, +static double b9[10] = + {17643225600.0, 8821612800.0, 2075673600.0, 302702400.0, 30270240.0, 2162160.0, 110880.0, 3960.0, 90.0, 1 }; -static double b7[8] = +static double b7[8] = {17297280, 8648640, 1995840, 277200, 25200, 1512, 56, 1}; static double b5[6] = {30240, 15120, 3360, 420, 30, 1}; diff --git a/moose-core/biophysics/MarkovSolverBase.cpp b/moose-core/biophysics/MarkovSolverBase.cpp index 0e12a24ce4d918cd2418db8712456019b117695f..bcf5ccf46b24676a4da06ce6a837382c2142a12e 100644 --- a/moose-core/biophysics/MarkovSolverBase.cpp +++ b/moose-core/biophysics/MarkovSolverBase.cpp @@ -30,12 +30,12 @@ const Cinfo* MarkovSolverBase::initCinfo() ///////////////////// //SharedFinfos ///////////////////// - static DestFinfo handleVm("handleVm", + static DestFinfo handleVm("handleVm", "Handles incoming message containing voltage information.", new OpFunc1< MarkovSolverBase, double >(&MarkovSolverBase::handleVm) ); - static Finfo* channelShared[] = + static Finfo* channelShared[] = { &handleVm }; @@ -44,18 +44,18 @@ const Cinfo* MarkovSolverBase::initCinfo() "This message couples the MarkovSolverBase to the Compartment. The " "compartment needs Vm in order to look up the correct matrix " "exponential for computing the state.", - channelShared, sizeof( channelShared ) / sizeof( Finfo* ) + channelShared, sizeof( channelShared ) / sizeof( Finfo* ) ); ////////////////////// //DestFinfos ////////////////////// - + static DestFinfo process( "process", "Handles process call", - new ProcOpFunc< MarkovSolverBase >( &MarkovSolverBase::process ) ); + new ProcOpFunc< MarkovSolverBase >( &MarkovSolverBase::process ) ); - static DestFinfo reinit( "reinit", + static DestFinfo reinit( "reinit", "Handles reinit call", new ProcOpFunc< MarkovSolverBase >( &MarkovSolverBase::reinit ) ); @@ -64,7 +64,7 @@ const Cinfo* MarkovSolverBase::initCinfo() &process, &reinit }; - static SharedFinfo proc( "proc", + static SharedFinfo proc( "proc", "This is a shared message to receive Process message from the" "scheduler. The first entry is a MsgDest for the Process " "operation. It has a single argument, ProcInfo, which " @@ -76,19 +76,19 @@ const Cinfo* MarkovSolverBase::initCinfo() static DestFinfo ligandConc("ligandConc", "Handles incoming message containing ligand concentration.", - new OpFunc1< MarkovSolverBase, double >(&MarkovSolverBase::handleLigandConc) + new OpFunc1< MarkovSolverBase, double >(&MarkovSolverBase::handleLigandConc) ); static DestFinfo init("init", "Setups the table of matrix exponentials associated with the" " solver object.", - new OpFunc2< MarkovSolverBase, Id, double >(&MarkovSolverBase::init) + new OpFunc2< MarkovSolverBase, Id, double >(&MarkovSolverBase::init) ); ////////////////////// //*ValueFinfos ///////////////////// - + static ReadOnlyValueFinfo< MarkovSolverBase, Matrix > Q("Q", "Instantaneous rate matrix.", &MarkovSolverBase::getQ @@ -96,13 +96,13 @@ const Cinfo* MarkovSolverBase::initCinfo() static ReadOnlyValueFinfo< MarkovSolverBase, Vector > state("state", "Current state of the channel.", - &MarkovSolverBase::getState + &MarkovSolverBase::getState ); static ValueFinfo< MarkovSolverBase, Vector > initialstate("initialState", "Initial state of the channel.", &MarkovSolverBase::setInitialState, - &MarkovSolverBase::getInitialState + &MarkovSolverBase::getInitialState ); static ValueFinfo< MarkovSolverBase, double > xmin( "xmin", @@ -144,9 +144,9 @@ const Cinfo* MarkovSolverBase::initCinfo() &MarkovSolverBase::getInvDy ); - static Finfo* markovSolverFinfos[] = + static Finfo* markovSolverFinfos[] = { - &channel, //SharedFinfo + &channel, //SharedFinfo &proc, //SharedFinfo stateOut(), //SrcFinfo &ligandConc, //DestFinfo @@ -164,15 +164,15 @@ const Cinfo* MarkovSolverBase::initCinfo() &invdy //ReadOnlyValueFinfo }; - static string doc[] = + static string doc[] = { "Name", "MarkovSolverBase", "Author", "Vishaka Datta S, 2011, NCBS", - "Description", "Solver for Markov Channel." + "Description", "Solver for Markov Channel." }; static Dinfo< MarkovSolverBase > dinfo; static Cinfo markovSolverBaseCinfo( - "MarkovSolverBase", + "MarkovSolverBase", Neutral::initCinfo(), markovSolverFinfos, sizeof( markovSolverFinfos ) / sizeof( Finfo* ), @@ -186,8 +186,8 @@ const Cinfo* MarkovSolverBase::initCinfo() static const Cinfo* markovSolverBaseCinfo = MarkovSolverBase::initCinfo(); -MarkovSolverBase::MarkovSolverBase() : Q_(0), expMats1d_(0), expMat_(0), - expMats2d_(0), xMin_(DBL_MAX), xMax_(DBL_MIN), xDivs_(0u), +MarkovSolverBase::MarkovSolverBase() : Q_(0), expMats1d_(0), expMat_(0), + expMats2d_(0), xMin_(DBL_MAX), xMax_(DBL_MIN), xDivs_(0u), yMin_(DBL_MAX), yMax_(DBL_MIN), yDivs_(0u), size_(0u), Vm_(0), ligandConc_(0), dt_(0) { @@ -210,7 +210,7 @@ MarkovSolverBase::~MarkovSolverBase() if ( !expMats2d_.empty() ) { - unsigned int n = expMats2d_.size(); + unsigned int n = expMats2d_.size(); for( unsigned int i = 0; i < n; ++i ) { for ( unsigned int j = 0; j < expMats2d_[i].size(); ++j ) @@ -256,9 +256,9 @@ double MarkovSolverBase::getXmin() const return xMin_; } -void MarkovSolverBase::setXmax( double xMax ) +void MarkovSolverBase::setXmax( double xMax ) { - xMax_ = xMax; + xMax_ = xMax; } double MarkovSolverBase::getXmax() const @@ -311,17 +311,17 @@ unsigned int MarkovSolverBase::getYdivs( ) const double MarkovSolverBase::getInvDy() const { - return invDy_; + return invDy_; } -Vector* MarkovSolverBase::bilinearInterpolate( ) const +Vector* MarkovSolverBase::bilinearInterpolate( ) const { bool isEndOfX = false; bool isEndOfY = false; - unsigned int xIndex = + unsigned int xIndex = static_cast< unsigned int >( ( Vm_ - xMin_ ) * invDx_ ); - unsigned int yIndex = + unsigned int yIndex = static_cast< unsigned int >( ( ligandConc_ - yMin_ ) * invDy_ ); double xv = (Vm_ - xMin_) * invDx_; double yv = (ligandConc_ - yMin_) * invDy_; @@ -333,7 +333,7 @@ Vector* MarkovSolverBase::bilinearInterpolate( ) const ( xIndex == xDivs_ ) ? isEndOfX = true : isEndOfX = false; ( yIndex == yDivs_ ) ? isEndOfY = true : isEndOfY = false; - vector< vector< Matrix* > >::const_iterator iExpQ0 = + vector< vector< Matrix* > >::const_iterator iExpQ0 = expMats2d_.begin() + xIndex; vector< Matrix* >::const_iterator iExpQ00 = iExpQ0->begin() + yIndex; vector< Matrix* >::const_iterator iExpQ10; @@ -358,7 +358,7 @@ Vector* MarkovSolverBase::bilinearInterpolate( ) const #endif state00 = vecMatMul( &state_, expQ00 ); - if ( isEndOfX ) + if ( isEndOfX ) { if ( isEndOfY ) return state00; @@ -366,7 +366,7 @@ Vector* MarkovSolverBase::bilinearInterpolate( ) const { expQ01 = *(iExpQ00 + 1); state01 = vecMatMul( &state_, expQ01 ); - result = vecVecScalAdd( state00, state01, + result = vecVecScalAdd( state00, state01, (1 - yF), yF ); } } @@ -378,7 +378,7 @@ Vector* MarkovSolverBase::bilinearInterpolate( ) const if ( isEndOfY ) { - result = vecVecScalAdd( state00, state10, ( 1 - xF ), xF ); + result = vecVecScalAdd( state00, state10, ( 1 - xF ), xF ); } else { @@ -390,10 +390,10 @@ Vector* MarkovSolverBase::bilinearInterpolate( ) const Vector *temp1, *temp2; - temp1 = vecVecScalAdd( state00, state10, + temp1 = vecVecScalAdd( state00, state10, ( 1 - xF - yF + xFyF ), ( xF - xFyF ) - ); + ); temp2 = vecVecScalAdd( state01, state11, ( yF - xFyF ), xFyF ); @@ -405,12 +405,12 @@ Vector* MarkovSolverBase::bilinearInterpolate( ) const } if ( state00 ) - delete state00; + delete state00; if ( state01 ) delete state01; if ( state10 ) delete state10; - if ( state11 ) + if ( state11 ) delete state11; return result; @@ -426,7 +426,7 @@ Vector* MarkovSolverBase::linearInterpolate() const x = ligandConc_; if ( x < xMin_ ) - return vecMatMul( &state_, expMats1d_[0] ); + return vecMatMul( &state_, expMats1d_[0] ); else if ( x > xMax_ ) return vecMatMul( &state_, expMats1d_.back() ); @@ -435,7 +435,7 @@ Vector* MarkovSolverBase::linearInterpolate() const double xv = ( x - xMin_ ) * invDx_; double xF = xv - xIndex; - vector< Matrix* >::const_iterator iExpQ = + vector< Matrix* >::const_iterator iExpQ = expMats1d_.begin() + xIndex; Vector *state0, *state1, *result; @@ -443,7 +443,7 @@ Vector* MarkovSolverBase::linearInterpolate() const state0 = vecMatMul( &state_, *iExpQ ); state1 = vecMatMul( &state_, *( iExpQ + 1 ) ); - result = vecVecScalAdd( state0, state1, 1 - xF, xF ); + result = vecVecScalAdd( state0, state1, 1 - xF, xF ); delete state0; delete state1; @@ -453,9 +453,9 @@ Vector* MarkovSolverBase::linearInterpolate() const //Computes the updated state of the system. Is called from the process function. //This performs state space interpolation to calculate the state of the -//channel. +//channel. //When a value of Vm_ and ligandConc_ is provided, we find the 4 matrix -//exponentials that are closest to these values, and then calculate the +//exponentials that are closest to these values, and then calculate the //states at each of these 4 points. We then interpolate between these //states to calculate the final one. //In case all rates are 1D, then, the above-mentioned interpolation is @@ -466,10 +466,10 @@ void MarkovSolverBase::computeState( ) bool useBilinear = false; // useLinear = false; - if ( rateTable_->areAnyRates2d() || - ( rateTable_->areAllRates1d() && - rateTable_->areAnyRatesVoltageDep() && - rateTable_->areAnyRatesLigandDep() + if ( rateTable_->areAnyRates2d() || + ( rateTable_->areAllRates1d() && + rateTable_->areAnyRatesVoltageDep() && + rateTable_->areAnyRatesLigandDep() ) ) { useBilinear = true; @@ -483,7 +483,7 @@ void MarkovSolverBase::computeState( ) */ //Heavily borrows from the Interpol2D::interpolate function. - if ( useBilinear ) + if ( useBilinear ) newState = bilinearInterpolate(); else newState = linearInterpolate(); @@ -493,13 +493,13 @@ void MarkovSolverBase::computeState( ) delete newState; } -void MarkovSolverBase::innerFillupTable( +void MarkovSolverBase::innerFillupTable( vector< unsigned int > rateIndices, - string rateType, - unsigned int xIndex, + string rateType, + unsigned int xIndex, unsigned int yIndex ) { - unsigned int n = rateIndices.size(), i, j; + unsigned int n = rateIndices.size(), i, j; for ( unsigned int k = 0; k < n; ++k ) { @@ -507,7 +507,7 @@ void MarkovSolverBase::innerFillupTable( j = ( rateIndices[k] % 10 ) - 1; (*Q_)[i][i] += (*Q_)[i][j]; - + if ( rateType.compare("2D") == 0 ) (*Q_)[i][j] = rateTable_->lookup2dIndex( i, j, xIndex, yIndex ); else if ( rateType.compare("1D") == 0 ) @@ -520,27 +520,27 @@ void MarkovSolverBase::innerFillupTable( (*Q_)[i][i] -= (*Q_)[i][j]; } } - + void MarkovSolverBase::fillupTable() { - double dx = (xMax_ - xMin_) / xDivs_; - double dy = (yMax_ - yMin_) / yDivs_; + double dx = (xMax_ - xMin_) / xDivs_; + double dy = (yMax_ - yMin_) / yDivs_; vector< unsigned int > listOf1dRates = rateTable_->getListOf1dRates(); vector< unsigned int > listOf2dRates = rateTable_->getListOf2dRates(); - vector< unsigned int > listOfConstantRates = + vector< unsigned int > listOfConstantRates = rateTable_->getListOfConstantRates(); //Set constant rates in the Q matrix, if any. - innerFillupTable( listOfConstantRates, "constant", - 0.0, 0.0 ); + innerFillupTable( listOfConstantRates, "constant", + 0.0, 0.0 ); //xIndex loops through all voltages, yIndex loops through all //ligand concentrations. - if ( rateTable_->areAnyRates2d() || - ( rateTable_->areAllRates1d() && - rateTable_->areAnyRatesVoltageDep() && - rateTable_->areAnyRatesLigandDep() + if ( rateTable_->areAnyRates2d() || + ( rateTable_->areAllRates1d() && + rateTable_->areAnyRatesVoltageDep() && + rateTable_->areAnyRatesLigandDep() ) ) { double voltage = xMin_, ligandConc = yMin_; @@ -548,15 +548,15 @@ void MarkovSolverBase::fillupTable() for ( unsigned int xIndex = 0; xIndex < xDivs_ + 1; ++xIndex ) { ligandConc = yMin_; - for( unsigned int yIndex = 0; yIndex < yDivs_ + 1; ++yIndex ) + for( unsigned int yIndex = 0; yIndex < yDivs_ + 1; ++yIndex ) { - innerFillupTable( listOf2dRates, "2D", xIndex, yIndex ); + innerFillupTable( listOf2dRates, "2D", xIndex, yIndex ); //This is a very klutzy way of updating 1D rates as the same //lookup is done multiple times. But this all occurs at setup, //and lookups arent that slow either. This way is also easier //to maintain. - innerFillupTable( listOf1dRates, "1D", xIndex, yIndex ); + innerFillupTable( listOf1dRates, "1D", xIndex, yIndex ); expMats2d_[xIndex][yIndex] = computeMatrixExponential(); ligandConc += dy; @@ -567,7 +567,7 @@ void MarkovSolverBase::fillupTable() else if ( rateTable_->areAllRatesLigandDep() ) { double x = xMin_; - vector< unsigned int > listOfLigandRates = + vector< unsigned int > listOfLigandRates = rateTable_->getListOfLigandRates(); for ( unsigned int xIndex = 0; xIndex < xDivs_ + 1; ++xIndex ) @@ -580,7 +580,7 @@ void MarkovSolverBase::fillupTable() else if ( rateTable_->areAllRatesVoltageDep() ) { double x = xMin_; - vector< unsigned int > listOfVoltageRates = + vector< unsigned int > listOfVoltageRates = rateTable_->getListOfVoltageRates(); for ( unsigned int xIndex = 0; xIndex < xDivs_ + 1; ++xIndex ) @@ -590,14 +590,14 @@ void MarkovSolverBase::fillupTable() x += dx; } } - else if ( rateTable_->areAllRatesConstant() ) + else if ( rateTable_->areAllRatesConstant() ) { expMat_ = computeMatrixExponential(); return; } } -Matrix* MarkovSolverBase::computeMatrixExponential() +Matrix* MarkovSolverBase::computeMatrixExponential() { return 0; } @@ -614,14 +614,14 @@ void MarkovSolverBase::reinit( const Eref& e, ProcPtr p ) "set.\n"; return; } - state_ = initialState_; + state_ = initialState_; stateOut()->send( e, state_ ); } void MarkovSolverBase::process( const Eref& e, ProcPtr p ) { - computeState(); + computeState(); stateOut()->send( e, state_ ); } @@ -646,11 +646,11 @@ void MarkovSolverBase::init( Id rateTableId, double dt ) size_ = rateTable->getSize(); rateTable_ = rateTable; setLookupParams( ); - - if ( rateTable->areAnyRates2d() || - ( rateTable->areAllRates1d() && - rateTable->areAnyRatesVoltageDep() && - rateTable->areAnyRatesLigandDep() + + if ( rateTable->areAnyRates2d() || + ( rateTable->areAllRates1d() && + rateTable->areAnyRatesVoltageDep() && + rateTable->areAnyRatesLigandDep() ) ) { expMats2d_.resize( xDivs_ + 1 ); @@ -668,22 +668,22 @@ void MarkovSolverBase::init( Id rateTableId, double dt ) } //Initializing Q. - Q_ = matAlloc( size_ ); + Q_ = matAlloc( size_ ); //The state at t = t0 + dt is exp( dt * Q ) * [state at t = t0]. //Hence, we need to scale the terms of Q by dt. dt_ = dt; //Fills up the newly setup tables with exponentials. - fillupTable( ); + fillupTable( ); } //////////////// //This function sets the limits of the final lookup table of matrix -//exponentials. -//xMin_, xMax, yMin_, yMax_, xDivs_, yDivs_ are chosen such that -//the longest inverval covering all the limits of the rate lookup -//tables is chosen. +//exponentials. +//xMin_, xMax, yMin_, yMax_, xDivs_, yDivs_ are chosen such that +//the longest inverval covering all the limits of the rate lookup +//tables is chosen. //i.e. xMin_ = min( xMin of all 1D and 2D lookup tables ), // xMax_ = max( xMax of all 1D and 2D lookup tables ), // yMin_ = min( yMin of all 2D lookup tables ), @@ -698,7 +698,7 @@ void MarkovSolverBase::setLookupParams( ) { if ( rateTable_->areAnyRates1d() ) { - vector< unsigned int > listOfLigandRates + vector< unsigned int > listOfLigandRates = rateTable_->getListOfLigandRates(); vector< unsigned int > listOfVoltageRates = rateTable_->getListOfVoltageRates(); @@ -726,7 +726,7 @@ void MarkovSolverBase::setLookupParams( ) yDivs = divs; } - if ( ( rateTable_->areAllRatesLigandDep() && + if ( ( rateTable_->areAllRatesLigandDep() && rateTable_->areAllRates1d() ) ) { xMin_ = yMin; @@ -813,7 +813,7 @@ void MarkovSolverBase::setLigandConc( double ligandConc ) ligandConc_ = ligandConc; } -void setupInterpol2D( Interpol2D* table, unsigned int xDivs, double xMin, +void setupInterpol2D( Interpol2D* table, unsigned int xDivs, double xMin, double xMax, unsigned int yDivs, double yMin, double yMax ) { table->setXdivs( xDivs ); @@ -825,7 +825,7 @@ void setupInterpol2D( Interpol2D* table, unsigned int xDivs, double xMin, } void setupVectorTable( VectorTable* table, unsigned int xDivs, double xMin, - double xMax ) + double xMax ) { table->setDiv( xDivs ); table->setMin( xMin ); @@ -870,7 +870,7 @@ void testMarkovSolverBase() { rateTableIds.push_back( Id::nextId() ); str = string("ratetable") + static_cast< char >( 65 + i ); - rateTableElements.push_back( new Element( rateTableIds[i], rateTableCinfo, + rateTableElements.push_back( new Element( rateTableIds[i], rateTableCinfo, str, single, 1 ) ); rateTableErefs.push_back( new Eref( rateTableElements[i], 0 ) ); rateTables.push_back( reinterpret_cast< MarkovRateTable* >( @@ -882,7 +882,7 @@ void testMarkovSolverBase() str, single, 1 ) ); solverBaseErefs.push_back( new Eref( solverBaseElements[i], 0 ) ); solverBases.push_back( reinterpret_cast< MarkovSolverBase* >( - solverBaseErefs[i]->data() ) ); + solverBaseErefs[i]->data() ) ); } Element *eInt2d = new Element( int2dId, interpol2dCinfo, "int2d", single, 1 ); @@ -918,14 +918,14 @@ void testMarkovSolverBase() rateTables[0]->setInt2dChildTable( 2, 3, int2dId ); solverBases[0]->init( rateTableIds[0], 0.1 ); - + assert( solverBases[0]->getXdivs() == 201 ); - assert( doubleEq( solverBases[0]->getXmin(), -0.05 ) ); + assert( doubleEq( solverBases[0]->getXmin(), -0.05 ) ); assert( doubleEq( solverBases[0]->getXmax(), 0.19 ) ); assert( solverBases[0]->getYdivs() == 151 ); - + //1D and 2D rates. - rateTables[1]->init( 5 ); + rateTables[1]->init( 5 ); /////// //Case 2 : @@ -948,7 +948,7 @@ void testMarkovSolverBase() solverBases[1]->init( rateTableIds[1], 0.1 ); - assert( solverBases[1]->getXdivs() == 275 ); + assert( solverBases[1]->getXdivs() == 275 ); assert( solverBases[1]->getYdivs() == 375 ); assert( doubleEq( solverBases[1]->getXmin(), -0.17 ) ); assert( doubleEq( solverBases[1]->getXmax(), 0.75 ) ); @@ -961,11 +961,11 @@ void testMarkovSolverBase() /////// rateTables[2]->init( 5 ); - + setupVectorTable( vecTable, 155, 7e-9, 50e-9 ); rateTables[2]->setVtChildTable( 1, 2, vecTableId, 1 ); - setupVectorTable( vecTable, 190, 4e-9, 35e-9 ); + setupVectorTable( vecTable, 190, 4e-9, 35e-9 ); rateTables[2]->setVtChildTable( 3, 5, vecTableId, 1 ); setupVectorTable( vecTable, 120, 7e-9, 90e-9 ); @@ -986,7 +986,7 @@ void testMarkovSolverBase() /////// //Case 4 : Only voltage dependent rates. - //Rates (3,6), (5, 6), (1, 4). + //Rates (3,6), (5, 6), (1, 4). ////// rateTables[3]->init( 7 ); diff --git a/moose-core/biophysics/MarkovSolverBase.h b/moose-core/biophysics/MarkovSolverBase.h index 711ca3c1126f85e001aca2babe1044619240cd2f..b5f77548871edbae354f69b903b822b0a9462de4 100644 --- a/moose-core/biophysics/MarkovSolverBase.h +++ b/moose-core/biophysics/MarkovSolverBase.h @@ -17,26 +17,26 @@ // //After the setup of the MarkovRateTable class, where the user has entered //the lookup tables for the various transition rates, we have enough -//information to compute all the exponential matrices that correspond to the -//solution of the kinetic equation at each time step. +//information to compute all the exponential matrices that correspond to the +//solution of the kinetic equation at each time step. // //Before the channel simulation is run, the setup of the MarkovSolver requires -//that a table of matrix exponentials be computed and stored. In general, +//that a table of matrix exponentials be computed and stored. In general, //this would require a 2D lookup table where each exponential is index by -//([L],V) where [L] = ligand concentration and V = membrane voltage. +//([L],V) where [L] = ligand concentration and V = membrane voltage. //In the case all rates are either ligand or voltage dependent, not both, a 1D -//lookup table of exponentials suffices. +//lookup table of exponentials suffices. // -//The above computations are achieved by going through the lookup tables -//of the MarkovRateTable class. In a general case, the number of divisions +//The above computations are achieved by going through the lookup tables +//of the MarkovRateTable class. In a general case, the number of divisions //i.e. step sizes in each lookup table will be different. We choose the smallest //such step size, and assume that rates with bigger step sizes stay constant //over this time interval. By iterating over the whole range, we setup the -//exponential table. +//exponential table. // //The MarkovSolverBase class handles all the bookkeeping for the table of matrix -//exponentials. It also handles all the above-mentioned interactions with the -//remaining MOOSE classes. +//exponentials. It also handles all the above-mentioned interactions with the +//remaining MOOSE classes. // //Any MarkovSolver class that derives from this one only need implement //a ComputeMatrixExponential() function, which handles the actual computation @@ -49,7 +49,7 @@ /////////////////////////////// class MarkovSolverBase { - public : + public : MarkovSolverBase(); virtual ~MarkovSolverBase(); @@ -79,26 +79,26 @@ class MarkovSolverBase { void setYdivs( unsigned int ); unsigned int getYdivs() const; double getInvDy() const; - + ///////////////////////// //Lookup table related stuff. //////////////////////// - + //Fills up lookup table of matrix exponentials. - void innerFillupTable( vector< unsigned int >, string, + void innerFillupTable( vector< unsigned int >, string, unsigned int, unsigned int ); void fillupTable(); //This returns the pointer to the exponential of the Q matrix. virtual Matrix* computeMatrixExponential(); - + //State space interpolation routines. Vector* bilinearInterpolate() const; Vector* linearInterpolate() const; //Computes the updated state of the system. Is called from the process //function. - void computeState(); + void computeState(); /////////////////////////// //MsgDest functions. @@ -106,18 +106,18 @@ class MarkovSolverBase { void reinit( const Eref&, ProcPtr ); void process( const Eref&, ProcPtr ); - //Handles information about Vm from the compartment. - void handleVm( double ); + //Handles information about Vm from the compartment. + void handleVm( double ); //Handles concentration information. void handleLigandConc( double ); //Takes the Id of a MarkovRateTable object to initialize the table of matrix - //exponentials. + //exponentials. void init( Id, double ); static const Cinfo* initCinfo(); - + ///////////////// //Unit test //////////////// @@ -125,7 +125,7 @@ class MarkovSolverBase { friend void testMarkovSolverBase(); #endif - protected : + protected : //The instantaneous rate matrix. Matrix *Q_; @@ -140,7 +140,7 @@ class MarkovSolverBase { ////////////// //Helper functions. ///////////// - + //Sets the values of xMin, xMax, xDivs, yMin, yMax, yDivs. void setLookupParams(); @@ -148,12 +148,12 @@ class MarkovSolverBase { //Lookup table related stuff. ///////////// /* - * Exponentials of all rate matrices that are generated over the + * Exponentials of all rate matrices that are generated over the * duration of the simulation. The idea is that when copies of the channel - * are made, they will all refer this table to get the appropriate - * exponential matrix. + * are made, they will all refer this table to get the appropriate + * exponential matrix. * - * The exponential matrices are computed over a range of voltage levels + * The exponential matrices are computed over a range of voltage levels * and/or ligand concentrations and stored in the appropriate lookup table. * * Depending on whether @@ -162,8 +162,8 @@ class MarkovSolverBase { * 3) Some rates are 2D i.e. vary with two parameters, * we store the table of exponentials in the appropriate pointers below. * - * If a system contains both 2D and 1D rates, then, only the 2D pointer - * is used. + * If a system contains both 2D and 1D rates, then, only the 2D pointer + * is used. */ //Used for storing exponentials when at least one of the rates are 1D and //none are 2D. @@ -186,7 +186,7 @@ class MarkovSolverBase { //////////// //Miscallenous stuff /////////// - + //Pointer to the MarkovRateTable object. Necessary to glean information //about the properties of all the transition rates. MarkovRateTable* rateTable_; @@ -197,7 +197,7 @@ class MarkovSolverBase { //Initial state of the system. Vector initialState_; - //Stands for a lot of things. The dimension of the Q matrix, the number of + //Stands for a lot of things. The dimension of the Q matrix, the number of //states in the rate table, etc which all happen to be the same. unsigned int size_; diff --git a/moose-core/biophysics/MatrixOps.cpp b/moose-core/biophysics/MatrixOps.cpp index d1ef5d83007032f62172f145c302399bdb2fbd05..a983ef748304b857df89b969236257e5258d8c89 100644 --- a/moose-core/biophysics/MatrixOps.cpp +++ b/moose-core/biophysics/MatrixOps.cpp @@ -10,10 +10,10 @@ #include <math.h> #include "doubleEq.h" #include <iostream> -#include "MatrixOps.h" +#include "MatrixOps.h" -using std::cerr; -using std::endl; +using std::cerr; +using std::endl; using std::cout; void matPrint( Matrix* A ) @@ -99,7 +99,7 @@ void matPermMul( Matrix* A, vector< unsigned int >* swaps ) j = (index / 10 ) % 10; //Swapping the columns. - for( unsigned int l = 0; l < n; ++l ) + for( unsigned int l = 0; l < n; ++l ) { temp = (*A)[l][i]; (*A)[l][i] = (*A)[l][j]; @@ -108,7 +108,7 @@ void matPermMul( Matrix* A, vector< unsigned int >* swaps ) } } -Matrix* matMatAdd( const Matrix* A, const Matrix* B, double alpha, double beta ) +Matrix* matMatAdd( const Matrix* A, const Matrix* B, double alpha, double beta ) { unsigned int n = A->size(); Matrix *C = matAlloc( n ); @@ -122,8 +122,8 @@ Matrix* matMatAdd( const Matrix* A, const Matrix* B, double alpha, double beta ) return C; } -void matMatAdd( Matrix* A, Matrix* B, double alpha, double beta, - unsigned int resIndex ) +void matMatAdd( Matrix* A, Matrix* B, double alpha, double beta, + unsigned int resIndex ) { Matrix *C; unsigned int n = A->size(); @@ -165,7 +165,7 @@ void matEyeAdd( Matrix* A, double k, unsigned int dummy ) { unsigned int n = A->size(); dummy = 0; - + for( unsigned int i = 0; i < n; ++i ) (*A)[i][i] += k; } @@ -244,7 +244,7 @@ Vector* matVecMul( Matrix* A, Vector* v ) return w; } -Vector* vecVecScalAdd( const Vector* v1, const Vector* v2, +Vector* vecVecScalAdd( const Vector* v1, const Vector* v2, double alpha, double beta ) { unsigned int n = v1->size(); @@ -256,7 +256,7 @@ Vector* vecVecScalAdd( const Vector* v1, const Vector* v2, return w; } -void vecVecScalAdd( Vector* v1, Vector* v2, double alpha, double beta, +void vecVecScalAdd( Vector* v1, Vector* v2, double alpha, double beta, unsigned int dummy ) { unsigned int n = v1->size(); @@ -274,7 +274,7 @@ double matTrace( Matrix* A ) for ( unsigned int i = 0; i < n; ++i ) trace += (*A)[i][i]; - return trace; + return trace; } double matColNorm( Matrix* A ) @@ -286,8 +286,8 @@ double matColNorm( Matrix* A ) { colSum = 0; for( unsigned int j = 0; j < n; ++j ) - colSum += fabs( (*A)[j][i] ); - + colSum += fabs( (*A)[j][i] ); + if ( colSum > norm ) norm = colSum; } @@ -313,8 +313,8 @@ double doPartialPivot( Matrix* A, unsigned int row, unsigned int col, vector< unsigned int >* swaps ) { unsigned int n = A->size(), pivotRow = row; - double pivot = (*A)[row][col]; - + double pivot = (*A)[row][col]; + for( unsigned i = row; i < n; ++i ) { if( fabs( (*A)[i][col] ) > pivot ) @@ -327,17 +327,17 @@ double doPartialPivot( Matrix* A, unsigned int row, unsigned int col, //If pivot is non-zero, do the row swap. if ( !doubleEq(pivot,0.0) && pivotRow != row ) { - Matrix::iterator pivotRowItr = (A->begin() + pivotRow); - Matrix::iterator currRowItr = (A->begin() + row); + Matrix::iterator pivotRowItr = (A->begin() + pivotRow); + Matrix::iterator currRowItr = (A->begin() + row); swap( *pivotRowItr, *currRowItr ); //The row numbers interchanged are stored as a 2-digit number and pushed - //into this vector. This information is later used in creating the + //into this vector. This information is later used in creating the //permutation matrices. - swaps->push_back( 10 * pivotRow + row ); + swaps->push_back( 10 * pivotRow + row ); return pivot; } - else if ( !doubleEq(pivot, 0.0) && pivotRow == row ) + else if ( !doubleEq(pivot, 0.0) && pivotRow == row ) return (*A)[row][col]; //Choice of pivot is unchanged. else return 0; //Matrix is singular! @@ -345,17 +345,17 @@ double doPartialPivot( Matrix* A, unsigned int row, unsigned int col, void matInv( Matrix* A, vector< unsigned int >* swaps, Matrix* invA ) { - Matrix *L, *invL; + Matrix *L, *invL; unsigned int n = A->size(), i, j, diagPos; double pivot, rowMultiplier1, rowMultiplier2; - L = matAlloc( n ); + L = matAlloc( n ); invL = matAlloc( n ); *invA = *A; //The upper triangular portion is stored and inverted in invA - //Creating a copy of the input matrix, as well as initializing the + //Creating a copy of the input matrix, as well as initializing the //lower triangular matrix L. for (i = 0; i < n; ++i) (*L)[i][i] = 1; @@ -377,13 +377,13 @@ void matInv( Matrix* A, vector< unsigned int >* swaps, Matrix* invA ) (*invA)[i][j] = 0; for( unsigned int k = j + 1; k < n; ++k ) - (*invA)[i][k] = ( (*invA)[i][k] * rowMultiplier1 - + (*invA)[i][k] = ( (*invA)[i][k] * rowMultiplier1 - (*invA)[diagPos][k] *rowMultiplier2 ) / rowMultiplier1; (*L)[i][j] = rowMultiplier2 / rowMultiplier1; - if ( i != n - 1 ) + if ( i != n - 1 ) ++i; else { @@ -395,23 +395,23 @@ void matInv( Matrix* A, vector< unsigned int >* swaps, Matrix* invA ) { cerr << "Warning : Singularity detected. Proceeding with computation" "anyway.\n"; - (*invA)[diagPos][diagPos] = EPSILON; + (*invA)[diagPos][diagPos] = EPSILON; } - i = diagPos + 1; + i = diagPos + 1; } } //End of computation of L and U (which is stored in invA). //////////////////////////// - + //////////////////////////// - //Obtaining the inverse of invA and L, which is obtained by solving the + //Obtaining the inverse of invA and L, which is obtained by solving the //simple systems Ux = I and Lx= I. /////////////////////////// double sum = 0; - //We serially solve for the equations Ux = e_n, Ux=e_{n-1} ..., Ux = e1. + //We serially solve for the equations Ux = e_n, Ux=e_{n-1} ..., Ux = e1. //where, e_k is the k'th elementary basis vector. for( int k = n - 1; k >= 0; --k ) { @@ -426,7 +426,7 @@ void matInv( Matrix* A, vector< unsigned int >* swaps, Matrix* invA ) } if ( l == k ) - (*invA)[l][k] = (1 - sum)/(*invA)[l][l]; + (*invA)[l][k] = (1 - sum)/(*invA)[l][l]; else (*invA)[l][k] = -sum/(*invA)[l][l]; } @@ -443,7 +443,7 @@ void matInv( Matrix* A, vector< unsigned int >* swaps, Matrix* invA ) for( unsigned int k = 0; k <= n - 1; ++k ) { - for( unsigned int l = k + 2; l <= n - 1; ++l ) + for( unsigned int l = k + 2; l <= n - 1; ++l ) { invTemp = 0; for ( unsigned int m = k + 1; m <= n - 1; ++m ) @@ -456,15 +456,15 @@ void matInv( Matrix* A, vector< unsigned int >* swaps, Matrix* invA ) //End of computation of invL and invU. Note that they have been computed in //place, which means the original copies of L and U are now gone. ///////////////////////////// - + ///////////////////////////// - //Constructing the inverse of the permutation matrix P. + //Constructing the inverse of the permutation matrix P. //P is calculated only if there was any pivoting carried out. - //At this stage, L^(-1) has already been calculated. - //P^(-1) = P^T. - //Since we have computed PA = LU, - //the final inverse is given by U^(-1)*L^(-1)*P^(-1). - //If P was not calculated i.e. there were no exchanges, then the + //At this stage, L^(-1) has already been calculated. + //P^(-1) = P^T. + //Since we have computed PA = LU, + //the final inverse is given by U^(-1)*L^(-1)*P^(-1). + //If P was not calculated i.e. there were no exchanges, then the //inverse is just U^(-1) * L^(-1). //////////////////////// triMatMul( invA, invL ); @@ -493,4 +493,4 @@ Vector* vecAlloc( unsigned int n ) vec->resize( n ); return vec; -} +} diff --git a/moose-core/biophysics/MatrixOps.h b/moose-core/biophysics/MatrixOps.h index 8e24d3b449ea38576a14282e8ba27c50ecbd33fa..9e5e4af621680a20dac9908b5f6ff46c34864a72 100644 --- a/moose-core/biophysics/MatrixOps.h +++ b/moose-core/biophysics/MatrixOps.h @@ -13,7 +13,7 @@ //Few functions for performing simple matrix operations. //Note that all matrices here are square, which is the type encountered in //solving the differential equations associated with first-order kinetics of -//the Markov channel model. +//the Markov channel model. // //Author : Vishaka Datta S, 2011, NCBS //////////////////////////// @@ -22,7 +22,7 @@ using std::vector; typedef vector< vector< double > > Matrix; typedef vector< double > Vector; -//Idea taken from the implementation of the DGETRF method in LAPACK. When +//Idea taken from the implementation of the DGETRF method in LAPACK. When //the pivot is zero, we divide by a small number instead of simply throwing up //an error and not returning a result. #define EPSILON 1e-15 @@ -37,9 +37,9 @@ void matPrint( Matrix* ); void vecPrint( Vector* ); -//Computes product of two square matrices. +//Computes product of two square matrices. //Version 1 : Returns the result in a new matrix. -Matrix* matMatMul( Matrix*, Matrix* ); +Matrix* matMatMul( Matrix*, Matrix* ); //Version 2 : Returns the result in either of the matrices passed in. //The third parameter determines which matrix to destroy in order to return @@ -102,13 +102,13 @@ double matTrace( Matrix* ); double matColNorm( Matrix* ); //Plain old matrix transpose i.e. done out-of-place. -Matrix* matTrans( Matrix* ); +Matrix* matTrans( Matrix* ); //Matrix inverse implemented using LU-decomposition (Doolittle algorithm) -//Returns NULL if matrix is singular. +//Returns NULL if matrix is singular. void matInv( Matrix*, vector< unsigned int >*, Matrix* ); -//Carry out partial pivoting. +//Carry out partial pivoting. double doPartialPivot( Matrix*, unsigned int, unsigned int, vector< unsigned int >*); ///////// diff --git a/moose-core/biophysics/MgBlock.h b/moose-core/biophysics/MgBlock.h index cbfc61828d3aa5cf2de39cdd13e43d4995b2879e..9a717b66fcdc7bbc490f2d09aa724f54facee76d 100644 --- a/moose-core/biophysics/MgBlock.h +++ b/moose-core/biophysics/MgBlock.h @@ -38,12 +38,12 @@ class MgBlock: public ChanCommon * processFunc handles the update and calculations every * clock tick. It first sends the request for evaluation of * the gate variables to the respective gate objects and - * recieves their response immediately through a return + * recieves their response immediately through a return * message. This is done so that many channel instances can * share the same gate lookup tables, but do so cleanly. * Such messages should never go to a remote node. * Then the function does its own little calculations to - * send back to the parent compartment through regular + * send back to the parent compartment through regular * messages. */ void vProcess( const Eref& e, ProcPtr p ); @@ -51,8 +51,8 @@ class MgBlock: public ChanCommon /** * Reinitializes the values for the channel. This involves * computing the steady-state value for the channel gates - * using the provided Vm from the parent compartment. It - * involves a similar cycle through the gates and then + * using the provided Vm from the parent compartment. It + * involves a similar cycle through the gates and then * updates to the parent compartment as for the processFunc. */ void vReinit( const Eref& e, ProcPtr p ); @@ -62,7 +62,7 @@ class MgBlock: public ChanCommon */ // void channelFunc( double Vm ); void origChannel( const Eref& e, double Gk, double Ek ); - + static const Cinfo* initCinfo(); private: /// charge diff --git a/moose-core/biophysics/NMDAChan.cpp b/moose-core/biophysics/NMDAChan.cpp index 375052fc809e2aea298846b081ce336c686c4728..7699ab16b99646c41b77b2adec55a41c764cb169 100644 --- a/moose-core/biophysics/NMDAChan.cpp +++ b/moose-core/biophysics/NMDAChan.cpp @@ -35,12 +35,12 @@ const Cinfo* NMDAChan::initCinfo() /////////////////////////////////////////////////////// // Field definitions /////////////////////////////////////////////////////// - static ValueFinfo< NMDAChan, double > KMg_A( "KMg_A", + static ValueFinfo< NMDAChan, double > KMg_A( "KMg_A", "1/eta", &NMDAChan::setKMg_A, &NMDAChan::getKMg_A ); - static ValueFinfo< NMDAChan, double > KMg_B( "KMg_B", + static ValueFinfo< NMDAChan, double > KMg_B( "KMg_B", "1/gamma", &NMDAChan::setKMg_B, &NMDAChan::getKMg_B @@ -50,17 +50,17 @@ const Cinfo* NMDAChan::initCinfo() &NMDAChan::setCMg, &NMDAChan::getCMg ); - static ValueFinfo< NMDAChan, double > temperature( "temperature", + static ValueFinfo< NMDAChan, double > temperature( "temperature", "Temperature in degrees Kelvin.", &NMDAChan::setTemperature, &NMDAChan::getTemperature ); - static ValueFinfo< NMDAChan, double > extCa( "extCa", + static ValueFinfo< NMDAChan, double > extCa( "extCa", "External concentration of Calcium in millimolar", &NMDAChan::setExtCa, &NMDAChan::getExtCa ); - static ValueFinfo< NMDAChan, double > intCa( "intCa", + static ValueFinfo< NMDAChan, double > intCa( "intCa", "Internal concentration of Calcium in millimolar." "This is the final value used by the internal calculations, " "and may also be updated by the assignIntCa message after " @@ -68,7 +68,7 @@ const Cinfo* NMDAChan::initCinfo() &NMDAChan::setIntCa, &NMDAChan::getIntCa ); - static ValueFinfo< NMDAChan, double > intCaScale( "intCaScale", + static ValueFinfo< NMDAChan, double > intCaScale( "intCaScale", "Scale factor for internal concentration of Calcium in mM, " "applied to values coming in through the assignIntCa message. " "Required because in many models the units of calcium may " @@ -76,7 +76,7 @@ const Cinfo* NMDAChan::initCinfo() &NMDAChan::setIntCaScale, &NMDAChan::getIntCaScale ); - static ValueFinfo< NMDAChan, double > intCaOffset( "intCaOffset", + static ValueFinfo< NMDAChan, double > intCaOffset( "intCaOffset", "Offsetfor internal concentration of Calcium in mM, " "applied _after_ the scaling to mM is done. " "Applied to values coming in through the assignIntCa message. " @@ -85,7 +85,7 @@ const Cinfo* NMDAChan::initCinfo() &NMDAChan::setIntCaOffset, &NMDAChan::getIntCaOffset ); - static ValueFinfo< NMDAChan, double > condFraction( "condFraction", + static ValueFinfo< NMDAChan, double > condFraction( "condFraction", "Fraction of total channel conductance that is due to the " "passage of Ca ions. This is related to the ratio of " "permeabilities of different ions, and is typically in " @@ -96,12 +96,12 @@ const Cinfo* NMDAChan::initCinfo() &NMDAChan::setCondFraction, &NMDAChan::getCondFraction ); - static ReadOnlyValueFinfo< NMDAChan, double > ICa( "ICa", + static ReadOnlyValueFinfo< NMDAChan, double > ICa( "ICa", "Current carried by Ca ions", &NMDAChan::getICa ); - static ElementValueFinfo< ChanBase, double > permeability( - "permeability", + static ElementValueFinfo< ChanBase, double > permeability( + "permeability", "Permeability. Alias for Gbar. Note that the mapping is not" " really correct. Permeability is in units of m/s whereas " "Gbar is 1/ohm. Some nasty scaling is involved in the " @@ -111,7 +111,7 @@ const Cinfo* NMDAChan::initCinfo() &ChanBase::getGbar ); ///////////////////////////////////////////////////////////////////// - static DestFinfo assignIntCa( "assignIntCa", + static DestFinfo assignIntCa( "assignIntCa", "Assign the internal concentration of Ca. The final value " "is computed as: " " intCa = assignIntCa * intCaScale + intCaOffset ", @@ -166,7 +166,7 @@ static const Cinfo* NMDAChanCinfo = NMDAChan::initCinfo(); // Constructor /////////////////////////////////////////////////// NMDAChan::NMDAChan() - : + : KMg_A_( 1.0 ), // These are NOT the same as the A, B state KMg_B_( 1.0 ), //. variables used for Exp Euler integration. CMg_( 1.0 ), /// Extracellular Conc of Mg in mM @@ -312,7 +312,7 @@ void NMDAChan::assignIntCa( double v ) * Note the implicit mapping between permeability and conductance. * From the GENESIS source code: * A thought about the units, by EDS 6/95 (based on Hille 92): - * Units: + * Units: * p in M/s * EF/RT and z are dimensionless * F in C/mol @@ -329,7 +329,7 @@ void NMDAChan::assignIntCa( double v ) void NMDAChan::vProcess( const Eref& e, ProcPtr info ) { - // First do the regular channel current calculations for the + // First do the regular channel current calculations for the // summed ions, in which the NMDAR behaves like a regular channel // modulo the Mg block. double Gk = SynChan::calcGk(); @@ -337,16 +337,16 @@ void NMDAChan::vProcess( const Eref& e, ProcPtr info ) Gk *= KMg / (KMg + CMg_); ChanBase::setGk( e, Gk ); ChanCommon::updateIk(); - + //////////////////////////////////////////////////////////////////// // Here we do the calculations for the Ca portion of the current. // Total current is still done using a regular reversal potl for chan. - // Here we use Gk = Permeability * Z * FaradayConst * area / dV. + // Here we use Gk = Permeability * Z * FaradayConst * area / dV. // Note that Cin and Cout are in moles/m^3, and FaradayConst is in // Coulombs/mole. // // The GHK flux equation for an ion S (Hille 2001): - // \Phi_{S} = P_{S}z_{S}^2\frac{V_{m}F^{2}}{RT}\frac{[\mbox{S}]_{i} - [\mbox{S}]_{o}\exp(-z_{S}V_{m}F/RT)}{1 - \exp(-z_{S}V_{m}F/RT)} + // \Phi_{S} = P_{S}z_{S}^2\frac{V_{m}F^{2}}{RT}\frac{[\mbox{S}]_{i} - [\mbox{S}]_{o}\exp(-z_{S}V_{m}F/RT)}{1 - \exp(-z_{S}V_{m}F/RT)} // where // \PhiS is the current across the membrane carried by ion S, measured in amperes per square meter (A·m−2) // PS is the permeability of the membrane for ion S measured in m·s−1 @@ -370,7 +370,7 @@ void NMDAChan::vProcess( const Eref& e, ProcPtr info ) // We want ICa in Amps. We use perm times area which is m^3/s // Flux ( mol/sec) = Perm (m/s ) * area (m^2) * (Cout - Cin) (mol/m^3) // - // But we also have + // But we also have // // Flux (mol/sec) = Gk ( Coul/(sec*V) ) * dV (V) / (zF (Coul/Mol)) // @@ -390,7 +390,7 @@ void NMDAChan::vProcess( const Eref& e, ProcPtr info ) // ------------------------------ // (cout-cin) * (1-e2exponent) // - // Note how the calculation for Perm in terms of Gk has to use + // Note how the calculation for Perm in terms of Gk has to use // different terms for dV and conc, than the GHK portion. // // A further factor comes in because we want to relate the Gk for @@ -422,7 +422,7 @@ void NMDAChan::vProcess( const Eref& e, ProcPtr info ) // // Gchan = 23GCa + 25GCa + GCa // So GCa = Gchan / 49. So condFraction ~0.02 in the vicinity of 0.0mV. - // + // // Rather than build in this calculation, I'll just provide the user // with a scaling field to use and set it to the default of 0.02 // @@ -434,10 +434,10 @@ void NMDAChan::vProcess( const Eref& e, ProcPtr info ) double exponent = const_ * Vm_; double e2e = exp( -exponent ); if ( fabs( exponent) < 0.00001 ) { // Exponent too near zero, use Taylor - ICa_ = Gk * dV * exponent * ( Cin_ - Cout_ * e2e ) / + ICa_ = Gk * dV * exponent * ( Cin_ - Cout_ * e2e ) / ( ( Cin_ - Cout_ ) * (1 - 0.5 * exponent ) ); } else { - ICa_ = Gk * dV * exponent * ( Cin_ - Cout_ * e2e ) / + ICa_ = Gk * dV * exponent * ( Cin_ - Cout_ * e2e ) / ( ( Cin_ - Cout_ ) * (1 - e2e ) ); } ICa_ *= condFraction_; // Scale Ca current by fraction carried by Ca. diff --git a/moose-core/biophysics/NMDAChan.h b/moose-core/biophysics/NMDAChan.h index c97b849bd864df57d5965708ccdc1cd916b8cc0b..1097f25ecbe0175b57137811aab2eb3b39443fb8 100644 --- a/moose-core/biophysics/NMDAChan.h +++ b/moose-core/biophysics/NMDAChan.h @@ -63,7 +63,7 @@ class NMDAChan: public SynChan void assignIntCa( double v ); /////////////////////////////////////////////////// static const Cinfo* initCinfo(); - private: + private: /// 1/eta double KMg_A_; /// 1/gamma @@ -85,11 +85,11 @@ class NMDAChan: public SynChan // not a const but depends on temperature // const_ = F*valency/RT static const double valency_; // Always +2. - + /////////////////////////////////////////////////// // Utility function /////////////////////////////////////////////////// - + }; diff --git a/moose-core/biophysics/Nernst.cpp b/moose-core/biophysics/Nernst.cpp index eafc78ed75b253561622c7fbe4415b550d0a7ffb..3ffb36ae05ad13ac3d7459cef8d6dbbc76bd4b81 100644 --- a/moose-core/biophysics/Nernst.cpp +++ b/moose-core/biophysics/Nernst.cpp @@ -17,7 +17,7 @@ const double Nernst::ZERO_CELSIUS = 273.15; // MsgSrc definitions /////////////////////////////////////////////////////// static SrcFinfo1< double > *Eout() { - static SrcFinfo1< double > Eout( "Eout", + static SrcFinfo1< double > Eout( "Eout", "Computed reversal potential" ); return &Eout; @@ -25,7 +25,7 @@ static SrcFinfo1< double > *Eout() { const Cinfo* Nernst::initCinfo() { - static ReadOnlyValueFinfo< Nernst, double > E( "E", + static ReadOnlyValueFinfo< Nernst, double > E( "E", "Computed reversal potential", &Nernst::getE ); @@ -64,11 +64,11 @@ const Cinfo* Nernst::initCinfo() // These differ from field assignments because they trigger an // outgoing msg with the updated E. /////////////////////////////////////////////////////// - static DestFinfo ci( "ci", + static DestFinfo ci( "ci", "Set internal conc of ion, and immediately send out the updated E", new EpFunc1< Nernst, double >( &Nernst::handleCin ) ); - static DestFinfo co( "co", + static DestFinfo co( "co", "Set external conc of ion, and immediately send out the updated E", new EpFunc1< Nernst, double >( &Nernst::handleCout ) ); @@ -97,7 +97,7 @@ const Cinfo* Nernst::initCinfo() "Cin and Cout, the inside and outside concentrations. " "Immediately sends out the potential to all targets.", }; - + static Dinfo< Nernst > dinfo; static const Cinfo NernstCinfo( "Nernst", @@ -228,4 +228,4 @@ void testNernst() cout << "." << flush; } -#endif +#endif diff --git a/moose-core/biophysics/Nernst.h b/moose-core/biophysics/Nernst.h index 9c3de022859a398d05664bb9e3890ddd82c80d12..978cd8284154daf10a6ef6f02a7ea2923ea06b44 100644 --- a/moose-core/biophysics/Nernst.h +++ b/moose-core/biophysics/Nernst.h @@ -54,7 +54,7 @@ class Nernst double Cin_; double Cout_; double scale_; - double factor_; + double factor_; static const double R_OVER_F; static const double ZERO_CELSIUS; }; diff --git a/moose-core/biophysics/Neuron.cpp b/moose-core/biophysics/Neuron.cpp index cf30533641f7a385d5f10351cf1c3fd419853809..4ca30e107cdb0b6b090453c41e29aa9c43bff606 100644 --- a/moose-core/biophysics/Neuron.cpp +++ b/moose-core/biophysics/Neuron.cpp @@ -153,7 +153,7 @@ const Cinfo* Neuron::initCinfo() &Neuron::getSourceFile ); - static ValueFinfo< Neuron, double > compartmentLengthInLambdas( + static ValueFinfo< Neuron, double > compartmentLengthInLambdas( "compartmentLengthInLambdas", "Units: meters (SI). \n" "Electrotonic length to use for the largest compartment in the " @@ -176,8 +176,8 @@ const Cinfo* Neuron::initCinfo() &Neuron::getCompartmentLengthInLambdas ); - static ElementValueFinfo< Neuron, vector< string > > - channelDistribution( + static ElementValueFinfo< Neuron, vector< string > > + channelDistribution( "channelDistribution", "Specification for distribution of channels, CaConcens and " "any other model components that are defined as prototypes and " @@ -241,8 +241,8 @@ const Cinfo* Neuron::initCinfo() &Neuron::getChannelDistribution ); - static ElementValueFinfo< Neuron, vector< string > > - passiveDistribution( + static ElementValueFinfo< Neuron, vector< string > > + passiveDistribution( "passiveDistribution", "Specification for distribution of passive properties of cell.\n" "Arguments: . path field expr [field expr]...\n" @@ -324,20 +324,20 @@ const Cinfo* Neuron::initCinfo() &Neuron::getSpineDistribution ); - - static ReadOnlyValueFinfo< Neuron, unsigned int > numCompartments( + + static ReadOnlyValueFinfo< Neuron, unsigned int > numCompartments( "numCompartments", "Number of electrical compartments in model. ", &Neuron::getNumCompartments ); - - static ReadOnlyValueFinfo< Neuron, unsigned int > numSpines( + + static ReadOnlyValueFinfo< Neuron, unsigned int > numSpines( "numSpines", "Number of dendritic spines in model. ", &Neuron::getNumSpines ); - static ReadOnlyValueFinfo< Neuron, unsigned int > numBranches( + static ReadOnlyValueFinfo< Neuron, unsigned int > numBranches( "numBranches", "Number of branches in dendrites. ", &Neuron::getNumBranches @@ -350,19 +350,19 @@ const Cinfo* Neuron::initCinfo() &Neuron::getPathDistFromSoma ); - static ReadOnlyValueFinfo< Neuron, vector< double > > geomDistFromSoma( + static ReadOnlyValueFinfo< Neuron, vector< double > > geomDistFromSoma( "geometricalDistanceFromSoma", "geometrical distance of each segment from soma.", &Neuron::getGeomDistFromSoma ); - static ReadOnlyValueFinfo< Neuron, vector< double > > elecDistFromSoma( + static ReadOnlyValueFinfo< Neuron, vector< double > > elecDistFromSoma( "electrotonicDistanceFromSoma", "geometrical distance of each segment from soma, as measured along " "the dendrite.", &Neuron::getElecDistFromSoma ); - static ReadOnlyValueFinfo< Neuron, vector< ObjId > > compartments( + 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 " @@ -370,16 +370,16 @@ const Cinfo* Neuron::initCinfo() &Neuron::getCompartments ); - static ReadOnlyLookupElementValueFinfo< Neuron, string, vector< ObjId > > - compartmentsFromExpression( + 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 ); - static ReadOnlyLookupElementValueFinfo< Neuron, string, vector< double > > - valuesFromExpression( + 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." @@ -389,8 +389,8 @@ const Cinfo* Neuron::initCinfo() &Neuron::getExprVal ); - static ReadOnlyLookupElementValueFinfo< Neuron, string, vector< ObjId > > - spinesFromExpression( + 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 " @@ -402,7 +402,7 @@ const Cinfo* Neuron::initCinfo() ); static ReadOnlyLookupElementValueFinfo< Neuron, ObjId,vector< ObjId > > - spinesOnCompartment( + spinesOnCompartment( "spinesOnCompartment", "Vector of ObjIds of spines shafts/heads sitting on the specified " "electrical compartment. If each spine has a shaft and a head," @@ -412,8 +412,8 @@ const Cinfo* Neuron::initCinfo() &Neuron::getSpinesOnCompartment ); - static ReadOnlyLookupElementValueFinfo< Neuron, ObjId, ObjId > - parentCompartmentOfSpine( + 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.", @@ -469,10 +469,10 @@ const Cinfo* Neuron::initCinfo() &Neuron::getNumSpines, false ); - + ///////////////////////////////////////////////////////////////////// - static Finfo* neuronFinfos[] = - { + static Finfo* neuronFinfos[] = + { &RM, // ValueFinfo &RA, // ValueFinfo &CM, // ValueFinfo @@ -529,7 +529,7 @@ static const Cinfo* neuronCinfo = Neuron::initCinfo(); //////////////////////////////////////////////////////////////////////// Neuron::Neuron() - : + : RM_( 1.0 ), RA_( 1.0 ), CM_( 0.01 ), @@ -544,7 +544,7 @@ Neuron::Neuron() spineEntry_( this ) {;} -// When copying Neuron, we next have to rerun buildSegmentTree() and +// When copying Neuron, we next have to rerun buildSegmentTree() and // setSpineAndPsdMesh Neuron::Neuron( const Neuron& other ) : @@ -993,7 +993,7 @@ vector< double > Neuron::getExprVal( const Eref& e, string line ) const return val; } -vector< ObjId > Neuron::getSpinesFromExpression( +vector< ObjId > Neuron::getSpinesFromExpression( const Eref& e, string line ) const { unsigned long pos = line.find_first_of( " \t" ); @@ -1004,7 +1004,7 @@ vector< ObjId > Neuron::getSpinesFromExpression( vector< ObjId > temp = getExprElist( e, "# " + expr ); // indexed by segIndex, includes all compts in all spines. /* - vector< vector< Id > > allSpinesPerCompt( segId_.size() ); + vector< vector< Id > > allSpinesPerCompt( segId_.size() ); for ( unsigned int i = 0; i < spines_.size(); ++i ) { assert( allSpinesPerCompt.size() > spineParentSegIndex_[i] ); vector< Id >& s = allSpinesPerCompt[ spineParentSegIndex_[i] ]; @@ -1016,7 +1016,7 @@ vector< ObjId > Neuron::getSpinesFromExpression( return ret; for ( vector< ObjId >::iterator i = temp.begin(); i != temp.end(); ++i ) { - map< Id, unsigned int >::const_iterator si = + map< Id, unsigned int >::const_iterator si = segIndex_.find( i->id ); assert( si != segIndex_.end() ); assert( si->second < segId_.size() ); @@ -1031,11 +1031,11 @@ vector< ObjId > Neuron::getSpinesFromExpression( return ret; } -vector< ObjId > Neuron::getSpinesOnCompartment( +vector< ObjId > Neuron::getSpinesOnCompartment( const Eref& e, ObjId compt ) const { vector< ObjId > ret; - map< Id, unsigned int >::const_iterator pos = + map< Id, unsigned int >::const_iterator pos = segIndex_.find( compt.id ); if ( pos != segIndex_.end() ) { assert( pos->second < allSpinesPerCompt_.size() ); @@ -1046,7 +1046,7 @@ vector< ObjId > Neuron::getSpinesOnCompartment( return ret; } -ObjId Neuron::getParentCompartmentOfSpine( +ObjId Neuron::getParentCompartmentOfSpine( const Eref& e, ObjId compt ) const { for ( unsigned int comptIndex = 0; comptIndex < allSpinesPerCompt_.size(); ++comptIndex ) { @@ -1058,9 +1058,9 @@ ObjId Neuron::getParentCompartmentOfSpine( return ObjId(); } -void Neuron::buildElist( const Eref& e, - const vector< string >& line, - vector< ObjId >& elist, +void Neuron::buildElist( const Eref& e, + const vector< string >& line, + vector< ObjId >& elist, vector< double >& val ) { Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); @@ -1723,7 +1723,7 @@ string findArg( const vector<string>& line, const string& field ) /// Add entries into the pos vector for a given compartment i. static void addPos( unsigned int segIndex, unsigned int eIndex, - double spacing, double minSpacing, + double spacing, double minSpacing, double dendLength, vector< unsigned int >& seglistIndex, vector< unsigned int >& elistIndex, @@ -1745,27 +1745,27 @@ static void addPos( unsigned int segIndex, unsigned int eIndex, } /* * This version tries to put in Pos using simple increments from the - * start of each compt. Multiple issues including inability to put + * start of each compt. Multiple issues including inability to put * spines in small compartments, even if many of them. * static void addPos( unsigned int segIndex, unsigned int eIndex, - double spacing, double spacingDistrib, + double spacing, double spacingDistrib, double dendLength, vector< unsigned int >& seglistIndex, vector< unsigned int >& elistIndex, vector< double >& pos ) { if ( spacingDistrib > 0.0 ) { - double position = spacing * 0.5 + + double position = spacing * 0.5 + ( moose::mtrand() - 0.5 ) * spacingDistrib; while ( position < dendLength ) { seglistIndex.push_back( segIndex ); elistIndex.push_back( eIndex ); pos.push_back( position ); position += spacing + ( moose::mtrand() - 0.5 ) * spacingDistrib; - } + } } else { - for ( double position = spacing * 0.5; + for ( double position = spacing * 0.5; position < dendLength; position += spacing ) { seglistIndex.push_back( segIndex ); elistIndex.push_back( eIndex ); @@ -1775,7 +1775,7 @@ static void addPos( unsigned int segIndex, unsigned int eIndex, } */ -void Neuron::makeSpacingDistrib( const vector< ObjId >& elist, +void Neuron::makeSpacingDistrib( const vector< ObjId >& elist, const vector< double >& val, vector< unsigned int >& seglistIndex, vector< unsigned int >& elistIndex, @@ -1795,17 +1795,17 @@ void Neuron::makeSpacingDistrib( const vector< ObjId >& elist, double spacing = val[ j + nuParser::EXPR ]; double spacingDistrib = parser.eval( val.begin() + j ); if ( spacingDistrib > spacing || spacingDistrib < 0 ) { - cout << "Warning: Neuron::makeSpacingDistrib: " << + cout << "Warning: Neuron::makeSpacingDistrib: " << "0 < " << spacingDistrib << " < " << spacing << " fails on " << elist[i].path() << ". Using 0.\n"; spacingDistrib = 0.0; } - map< Id, unsigned int>::const_iterator + map< Id, unsigned int>::const_iterator lookupDend = segIndex_.find( elist[i] ); if ( lookupDend != segIndex_.end() ) { double dendLength = segs_[lookupDend->second].length(); - addPos( lookupDend->second, i, - spacing, spacingDistrib, dendLength, + addPos( lookupDend->second, i, + spacing, spacingDistrib, dendLength, seglistIndex, elistIndex, pos ); } } @@ -1817,8 +1817,8 @@ void Neuron::makeSpacingDistrib( const vector< ObjId >& elist, } } -static void makeAngleDistrib ( const vector< ObjId >& elist, - const vector< double >& val, +static void makeAngleDistrib ( const vector< ObjId >& elist, + const vector< double >& val, vector< unsigned int >& elistIndex, vector< double >& theta, const vector< string >& line ) @@ -1856,8 +1856,8 @@ static void makeAngleDistrib ( const vector< ObjId >& elist, } } -static void makeSizeDistrib ( const vector< ObjId >& elist, - const vector< double >& val, +static void makeSizeDistrib ( const vector< ObjId >& elist, + const vector< double >& val, vector< unsigned int >& elistIndex, vector< double >& size, const vector< string >& line ) @@ -1893,7 +1893,7 @@ static void makeSizeDistrib ( const vector< ObjId >& elist, } } -void Neuron::installSpines( const vector< ObjId >& elist, +void Neuron::installSpines( const vector< ObjId >& elist, const vector< double >& val, const vector< string >& line ) { Id spineProto( "/library/spine" ); @@ -1902,16 +1902,16 @@ void Neuron::installSpines( const vector< ObjId >& elist, cout << "Warning: Neuron::installSpines: Unable to find prototype spine: /library/spine\n"; return; } - // Look up elist index from pos index, since there may be many + // Look up elist index from pos index, since there may be many // spines on each segment. - vector< unsigned int > elistIndex; + vector< unsigned int > elistIndex; vector< double > pos; // spacing of the new spines along compt. vector< double > theta; // Angle of spines vector< double > size; // Size scaling of spines pos.reserve( elist.size() ); elistIndex.reserve( elist.size() ); - makeSpacingDistrib( elist, val, + makeSpacingDistrib( elist, val, spineParentSegIndex_, elistIndex, pos, line); makeAngleDistrib( elist, val, elistIndex, theta, line ); makeSizeDistrib( elist, val, elistIndex, size, line ); @@ -1919,8 +1919,8 @@ void Neuron::installSpines( const vector< ObjId >& elist, unsigned int i = spineParentSegIndex_[k]; Vec x, y, z; coordSystem( soma_, segId_[i], x, y, z ); - spines_.push_back( - addSpine( segId_[i], spineProto, pos[k], theta[k], + spines_.push_back( + addSpine( segId_[i], spineProto, pos[k], theta[k], x, y, z, size[k], k ) ); } diff --git a/moose-core/biophysics/Neuron.h b/moose-core/biophysics/Neuron.h index 14854834c8bc23b6dc27a9672f96019dd0cc9530..3cef4dab7edf5a39bfee37e17b41e678c0d1fa82 100644 --- a/moose-core/biophysics/Neuron.h +++ b/moose-core/biophysics/Neuron.h @@ -44,11 +44,11 @@ class Neuron vector< ObjId > getCompartments() const; vector< ObjId > getExprElist( const Eref& e, string line ) const; vector< double > getExprVal( const Eref& e, string line ) const; - vector< ObjId > getSpinesFromExpression( + vector< ObjId > getSpinesFromExpression( const Eref& e, string line ) const; - vector< ObjId > getSpinesOnCompartment( + vector< ObjId > getSpinesOnCompartment( const Eref& e, ObjId compt ) const; - ObjId getParentCompartmentOfSpine( const Eref& e, ObjId compt ) + ObjId getParentCompartmentOfSpine( const Eref& e, ObjId compt ) const; void setChannelDistribution( const Eref& e, vector< string > v ); vector< string > getChannelDistribution( const Eref& e ) const; @@ -67,10 +67,10 @@ class Neuron void updateSegmentLengths(); void installSpines( const vector< ObjId >& elist, const vector< double >& val, const vector< string >& line ); - void makeSpacingDistrib( + void makeSpacingDistrib( const vector< ObjId >& elist, const vector< double >& val, - vector< unsigned int >& seglistIndex, - vector< unsigned int >& elistIndex, + vector< unsigned int >& seglistIndex, + vector< unsigned int >& elistIndex, vector< double >& pos, const vector< string >& line ) const; void parseMechSpec( const Eref& e ); @@ -93,11 +93,11 @@ class Neuron unsigned int getNumSpines() const; const vector< Id >& spineIds( unsigned int index ) const; - void scaleBufAndRates( unsigned int spineNum, + void scaleBufAndRates( unsigned int spineNum, double lenScale, double diaScale ) const; - void scaleShaftDiffusion( unsigned int spineNum, + void scaleShaftDiffusion( unsigned int spineNum, double len, double dia) const; - void scaleHeadDiffusion( unsigned int spineNum, + void scaleHeadDiffusion( unsigned int spineNum, double len, double dia) const; /** @@ -122,30 +122,30 @@ class Neuron vector< string > spineDistribution_; /// Map to look up Seg index from Id of associated compt. - map< Id, unsigned int > segIndex_; + map< Id, unsigned int > segIndex_; /// Look up seg index of parent compartment, from index of spine. - vector< unsigned int > spineParentSegIndex_; + vector< unsigned int > spineParentSegIndex_; vector< vector< Id > > spines_; /// Id of each compt in each spine. /// Ids of all spines on each compt, looked up by segIndex of compt. vector< vector< Id > > allSpinesPerCompt_; /// Id of stoich associated with each spine. Typically all the same. - vector< Id > spineStoich_; + vector< Id > spineStoich_; /// Id of stoich associated with each PSD. Typically all the same. - vector< Id > psdStoich_; + vector< Id > psdStoich_; /// looks up spine/psd mesh index from FieldIndex of selected spine. vector< unsigned int > spineToMeshOrdering_; Id headDsolve_; /// Id of the Dsolve for the head compt. Id psdDsolve_; /// Id of the Dsolve for the PSD compt. - // looks up spine/psd Dsolve::DiffJunction::VoxelJunction index + // looks up spine/psd Dsolve::DiffJunction::VoxelJunction index //from FieldIndex of selected spine. // Turns out this is the same as spineToMeshOrdering. //vector< unsigned int > spineToVoxelJunctionOrdering_; /// Holder for spine operations. Contains pointer to current Neuron. - Spine spineEntry_; + Spine spineEntry_; vector< Id > segId_; /// Id of compartment in each Seg entry, below. vector< SwcSegment > segs_; @@ -155,4 +155,4 @@ class Neuron // -#endif // +#endif // diff --git a/moose-core/biophysics/ReadCell.cpp b/moose-core/biophysics/ReadCell.cpp index 6d87a8e781f7fb5a704482335e48decc1e102500..2a35b98c4a7a1dd091d024abe3118a9215d8fd9c 100644 --- a/moose-core/biophysics/ReadCell.cpp +++ b/moose-core/biophysics/ReadCell.cpp @@ -27,7 +27,7 @@ ReadCell::ReadCell() RA_( 1.0 ), EREST_ACT_( -0.065 ), ELEAK_( -0.065 ), - + #if 0 // Unused privates. Causes error when -Werror is enabled. Uncomment them // appropriately when needed. @@ -41,27 +41,27 @@ ReadCell::ReadCell() erestFlag_( 0 ), eleakFlag_( 0 ), - + cell_( Id() ), currCell_( Id() ), - + lastCompt_( Id() ), protoCompt_( Id() ), - + numCompartments_( 0 ), numChannels_( 0 ), numOthers_( 0 ), - + numProtoCompts_( 0 ), numProtoChans_( 0 ), numProtoOthers_( 0 ), - + graftFlag_( 0 ), polarFlag_( 0 ), relativeCoordsFlag_( 0 ), doubleEndpointFlag_( 0 ), symmetricFlag_( 0 ), - + shell_( reinterpret_cast< Shell* >( Id().eref().data() ) ) { /* @@ -79,7 +79,7 @@ ReadCell::ReadCell() else ELEAK_ = EREST_ACT_; */ - + string libPath = "/library"; Id libId( libPath ); @@ -91,12 +91,12 @@ ReadCell::ReadCell() vector< Id > chanList = Field< vector< Id > >::get( ObjId( libId ), "children" ); - + vector< Id >::iterator i; for ( i = chanList.begin(); i != chanList.end(); ++i ) { Id id = (*i); string name = id.element()->getName(); - + chanProtos_[ name ] = id; } } @@ -111,13 +111,13 @@ Id ReadCell::read( Id parent ) { fileName_ = fileName; - + ifstream fin( fileName.c_str() ); if ( !fin ) { cerr << "ReadCell::read -- could not open file " << fileName << ".\n"; return Id(); } - + /* // Search for file in list of paths. PathUtility pathUtil( Property::getProperty( Property::SIMPATH ) ); @@ -133,17 +133,17 @@ Id ReadCell::read( return Id(); } */ - + unsigned int size = 1; if ( parent.element()->cinfo()->isA( "Neuron" ) ) { cell_ = parent; currCell_ = cell_; } else { - cell_ = shell_->doCreate( "Neuron", parent, + cell_ = shell_->doCreate( "Neuron", parent, cellName, size, MooseGlobal ); currCell_ = cell_; } - + if ( innerRead( fin ) ) { return cell_; } else { @@ -156,29 +156,29 @@ bool ReadCell::innerRead( ifstream& fin ) { string line; lineNum_ = 0; - + ParseStage parseMode = DATA; string::size_type pos; - + while ( getline( fin, line ) ) { line = moose::trim( line ); lineNum_++; - + if ( line.length() == 0 ) continue; - + pos = line.find_first_not_of( "\t " ); if ( pos == string::npos ) continue; else line = line.substr( pos ); - + if ( line.substr( 0, 2 ) == "//" ) continue; - - if ( ( pos = line.find( "//" ) ) != string::npos ) + + if ( ( pos = line.find( "//" ) ) != string::npos ) line = line.substr( 0, pos ); - + if ( line.substr( 0, 2 ) == "/*" ) { parseMode = COMMENT; } else if ( line.find( "*/" ) != string::npos ) { @@ -187,7 +187,7 @@ bool ReadCell::innerRead( ifstream& fin ) } else if ( line[ 0 ] == '*' ) { parseMode = SCRIPT; } - + if ( parseMode == COMMENT ) { pos = line.find( "*/" ); if ( pos != string::npos ) { @@ -196,7 +196,7 @@ bool ReadCell::innerRead( ifstream& fin ) line = line.substr( pos + 2 ); } } - + if ( parseMode == DATA ) { // For now not keeping it strict. Ignoring return status, and // continuing even if there was error in processing this line. @@ -208,13 +208,13 @@ bool ReadCell::innerRead( ifstream& fin ) parseMode = DATA; } } - + cout << "ReadCell: " << - numCompartments_ << " compartments, " << - numChannels_ << " channels, " << + numCompartments_ << " compartments, " << + numChannels_ << " channels, " << numOthers_ << " others\n"; - + return 1; } @@ -222,8 +222,8 @@ bool ReadCell::readScript( const string& line ) { vector< string > argv; string delimiters( "\t " ); - moose::tokenize( line, delimiters, argv ); - + moose::tokenize( line, delimiters, argv ); + if ( argv[ 0 ] == "*cartesian" ) { polarFlag_ = 0; } else if ( argv[ 0 ] == "*polar" ) { @@ -243,7 +243,7 @@ bool ReadCell::readScript( const string& line ) "Line: " << lineNum_ << "\n"; return 0; } - + if ( argv[ 1 ] == "RM" ) RM_ = atof( argv[ 2 ].c_str() ); if ( argv[ 1 ] == "RA" ) @@ -279,7 +279,7 @@ bool ReadCell::readScript( const string& line ) "Line: " << lineNum_ << "\n"; return 0; } - + Id protoId( argv[ 1 ] ); if ( protoId.path() != argv[ 1 ] ) { cerr << "Error: ReadCell: Bad path: " << argv[ 1 ] << " " << @@ -287,7 +287,7 @@ bool ReadCell::readScript( const string& line ) "Line: " << lineNum_ << "\n"; return 0; } - + protoCompt_ = protoId; countProtos(); } else if ( argv[ 0 ] == "*double_endpoint" ) { @@ -302,7 +302,7 @@ bool ReadCell::readScript( const string& line ) "File: " << fileName_ << "Line: " << lineNum_ << "\n"; } - + return 1; } @@ -310,28 +310,28 @@ bool ReadCell::readData( const string& line ) { vector< string > argv; string delimiters( "\t " ); - moose::tokenize( line, delimiters, argv ); - + moose::tokenize( line, delimiters, argv ); + if ( argv.size() < 6 ) { cerr << "Error: ReadCell: Too few arguments in line: " << argv.size() << ", should be > 6.\n"; cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; return 0; } - + double x0 = 0.0; double y0 = 0.0; double z0 = 0.0; double x, y, z; double d; int argOffset = 0; - + string name = argv[ 0 ]; string parent = argv[ 1 ]; - + if ( doubleEndpointFlag_ ) { argOffset = 3; - + x0 = 1.0e-6 * atof( argv[ 2 ].c_str() ); y0 = atof( argv[ 3 ].c_str() ); z0 = atof( argv[ 4 ].c_str() ); @@ -347,7 +347,7 @@ bool ReadCell::readData( const string& line ) z0 *= 1.0e-6; } } - + x = 1.0e-6 * atof( argv[ argOffset + 2 ].c_str() ); y = atof( argv[ argOffset + 3 ].c_str() ); z = atof( argv[ argOffset + 4 ].c_str() ); @@ -362,20 +362,20 @@ bool ReadCell::readData( const string& line ) y *= 1.0e-6; z *= 1.0e-6; } - + d = 1.0e-6 * atof( argv[ argOffset + 5 ].c_str() ); - + double length; Id compt = buildCompartment( name, parent, x0, y0, z0, x, y, z, d, length, argv ); - + if ( compt == Id() ) return 0; - + return buildChannels( compt, argv, d, length ); } -Id ReadCell::buildCompartment( +Id ReadCell::buildCompartment( const string& name, const string& parent, double x0, double y0, double z0, @@ -388,10 +388,10 @@ Id ReadCell::buildCompartment( SymCompartment::initCinfo()->findFinfo( "distalOut" ); /* * This section determines the parent compartment, to connect up with axial - * messages. Here 'parent' refers to the biophysical relationship within + * messages. Here 'parent' refers to the biophysical relationship within * the neuron's tree, and not to the path hierarchy in the MOOSE element * tree. - * + * * If the parent is specified as 'none', then the compartment is the root * of the cell's tree, and will not be connected axially to any compartments * except for its children, if any. @@ -413,7 +413,7 @@ Id ReadCell::buildCompartment( } parentId = parentObjId; } - + //~ Id childId; //~ bool ret = lookupGet< Id, string >( //~ currCell_, "lookupChild", childId, name ); @@ -426,7 +426,7 @@ Id ReadCell::buildCompartment( //~ cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; //~ return 0; //~ } - //~ unsigned int index = + //~ unsigned int index = //~ atoi( name.substr( pos + 1, name.length() - pos ).c_str() ); //~ if ( childId.index() == index ) { //~ cerr << "Error: ReadCell: duplicate child on parent compt '" << @@ -441,7 +441,7 @@ Id ReadCell::buildCompartment( //~ return 0; //~ } //~ } - + unsigned int size = 1; Id compt; if ( graftFlag_ && ( parent == "none" || parent == "nil" ) ) { @@ -460,7 +460,7 @@ Id ReadCell::buildCompartment( numChannels_ += numProtoChans_; numOthers_ += numProtoOthers_; } else { - string comptType = ( symmetricFlag_ ) ? + string comptType = ( symmetricFlag_ ) ? "SymCompartment" : "Compartment"; compt = shell_->doCreate( comptType, currCell_, name, size, MooseGlobal ); @@ -469,21 +469,21 @@ Id ReadCell::buildCompartment( } } lastCompt_ = compt; - + if ( parentId != Id()){ double px, py, pz; double dx, dy, dz; - + px = Field< double >::get( parentId, "x" ); py = Field< double >::get( parentId, "y" ); pz = Field< double >::get( parentId, "z" ); - + if ( !doubleEndpointFlag_ ) { x0 = px; y0 = py; z0 = pz; } - + if ( relativeCoordsFlag_ == 1 ) { x += px; y += py; @@ -497,7 +497,7 @@ Id ReadCell::buildCompartment( dx = x - x0; dy = y - y0; dz = z - z0; - + length = sqrt( dx * dx + dy * dy + dz * dz ); if ( symmetricFlag_ ) { // Now find all sibling compartments on the same parent. @@ -507,26 +507,26 @@ Id ReadCell::buildCompartment( // Later put in the soma as a sphere, with its special msgs. shell_->doAddMsg( "Single", parentId, "distal", compt, "proximal" ); - for ( vector< Id >::iterator i = sibs.begin(); + for ( vector< Id >::iterator i = sibs.begin(); i != sibs.end(); ++i ) { shell_->doAddMsg( "Single", compt, "sibling", *i, "sibling" ); } } else { - shell_->doAddMsg( "Single", + shell_->doAddMsg( "Single", parentId, "axial", compt, "raxial" ); } } else { - length = sqrt( x * x + y * y + z * z ); + length = sqrt( x * x + y * y + z * z ); // or it could be a sphere. } - + double Cm, Rm, Ra; - + Cm = CM_ * calcSurf( length, d ); Rm = RM_ / calcSurf( length, d ); - + if ( length > 0 ) { Ra = RA_ * length * 4.0 / ( d * d * M_PI ); } else { @@ -536,7 +536,7 @@ Id ReadCell::buildCompartment( // Set each of these to the other only if the only one set was other double eleak = ( erestFlag_ && !eleakFlag_ ) ? EREST_ACT_ : ELEAK_; double erest = ( !erestFlag_ && eleakFlag_ ) ? ELEAK_ : EREST_ACT_; - + Field< double >::set( compt, "x0", x0 ); Field< double >::set( compt, "y0", y0 ); Field< double >::set( compt, "z0", z0 ); @@ -551,7 +551,7 @@ Id ReadCell::buildCompartment( Field< double >::set( compt, "initVm", erest ); Field< double >::set( compt, "Em", eleak ); Field< double >::set( compt, "Vm", erest ); - + return compt; } @@ -568,18 +568,18 @@ Id ReadCell::startGraftCell( const string& cellPath ) cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; return Id(); } - + ObjId parentObjId; string cellName; string::size_type pos_1 = cellPath.find_first_of( "/" ); string::size_type pos_2 = cellPath.find_last_of( "/" ); - + if ( pos_1 != 0 ) { cerr << "Error: ReadCell: *start_cell should be given absolute path.\n"; cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; return Id(); } - + if ( pos_2 == 0 ) { parentObjId = ObjId("/"); cellName = cellPath.substr( 1 ); @@ -592,10 +592,10 @@ Id ReadCell::startGraftCell( const string& cellPath ) cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; return Id(); } - + cellName = cellPath.substr( pos_2 + 1 ); } - + unsigned int size = 1; return shell_->doCreate( "Compartment", parentObjId, cellName, size, MooseGlobal ); } @@ -607,7 +607,7 @@ Id ReadCell::findChannel( const string& name ) //~ if ( i->name() == name ) //~ return *i; //~ return Id(); - + map< string, Id >::iterator pos = chanProtos_.find( name ); if ( pos != chanProtos_.end() ) return pos->second; @@ -622,7 +622,7 @@ double calcSurf( double len, double dia ) area = dia * dia * M_PI; else area = len * dia * M_PI; - + return area; } @@ -635,7 +635,7 @@ bool ReadCell::buildChannels( bool isArgOK; int argStart; vector< Id > goodChannels; - + if ( doubleEndpointFlag_ ) { isArgOK = ( argv.size() % 2 ) == 1; argStart = 9; @@ -643,18 +643,18 @@ bool ReadCell::buildChannels( isArgOK = ( argv.size() % 2 ) == 0; argStart = 6; } - + if ( !isArgOK ) { cerr << "Error: ReadCell: Bad number of arguments in channel list\n"; cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; return 0; } - + for ( unsigned int j = argStart; j < argv.size(); j++ ) { - // Here we explicitly set compt fields by scaling from the + // Here we explicitly set compt fields by scaling from the // specific value applied here. string chan = argv[ j ]; - + double value = atof( argv[ ++j ].c_str() ); if ( chan == "RA" ) { double temp; @@ -674,7 +674,7 @@ bool ReadCell::buildChannels( } else if ( chan == "Cm" ) { Field< double >::set( compt, "Cm", value ); } else if ( chan == "kinModel" ) { - // Need 3 args here: + // Need 3 args here: // lambda, name of proto, method // We already have lambda from value. Note it is in microns if ( j + 2 < argv.size() ) { @@ -687,11 +687,11 @@ bool ReadCell::buildChannels( break; } } else if ( chan == "m2c" ) { - // Need 5 args here: + // Need 5 args here: // scale factor, mol, moloffset, chan, chanoffset // We already have scale factor from value. if ( j + 4 < argv.size() ) { - //~ addM2C( compt, value, argv.begin() + j + 1 ); + //~ addM2C( compt, value, argv.begin() + j + 1 ); j += 4; } else { cerr << "Error: ReadCell: m2c adaptor needs 5 args\n"; @@ -699,10 +699,10 @@ bool ReadCell::buildChannels( break; } } else if ( chan == "c2m" ) { - // Need another 5 args here: + // Need another 5 args here: // scale factor, chan, chanoffset, mol, moloffset if ( j + 4 < argv.size() ) { - //~ addC2M( compt, value, argv.begin() + j + 1 ); + //~ addC2M( compt, value, argv.begin() + j + 1 ); j += 4; } else { cerr << "Error: ReadCell: c2m adaptor needs 5 args\n"; @@ -717,7 +717,7 @@ bool ReadCell::buildChannels( cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; continue; } - + Id copy = addChannel( compt, chanId, value, diameter, length ); if ( copy != Id() ) { goodChannels.push_back( copy ); @@ -728,14 +728,14 @@ bool ReadCell::buildChannels( } } } - + for ( unsigned int i = 0; i < goodChannels.size(); i++ ) addChannelMessage( goodChannels[ i ] ); - + return 1; } -Id ReadCell::addChannel( +Id ReadCell::addChannel( Id compt, Id proto, double value, @@ -754,12 +754,12 @@ Id ReadCell::addChannel( assert( copy.element()->getName() == proto.element()->getName() ); ///////////////////////////// assert( copy != Id() ); - + if ( addCanonicalChannel( compt, copy, value, dia, length ) ) return copy; if ( addSpikeGen( compt, copy, value, dia, length ) ) return copy; if ( addCaConc( compt, copy, value, dia, length ) ) return copy; if ( addNernst( compt, copy, value ) ) return copy; - + return Id(); } @@ -767,13 +767,13 @@ Id ReadCell::addChannel( * Adds a typical channel to a compartment: * - Connects up the 'channel' message between chan and compt. * - Sets the Gbar field on the channel. - * + * * Typical channels currently are: HHChannel, HHChannel2D and SynChan. All of * these have the same "channel" interface, and have a "Gbar" field. */ bool ReadCell::addCanonicalChannel( Id compt, - Id chan, + Id chan, double value, double dia, double length ) @@ -793,27 +793,27 @@ bool ReadCell::addCanonicalChannel( "channel" ); if ( mid.bad() ) - cout << "failed to connect message from compt " << compt << + cout << "failed to connect message from compt " << compt << " to channel " << chan << endl; - + if ( value > 0 ) { value *= calcSurf( length, dia ); } else { value = -value; } - + if ( !graftFlag_ ) ++numChannels_; - + return Field< double >::set( chan, "Gbar", value ); } - + return 0; } -bool ReadCell::addSpikeGen( +bool ReadCell::addSpikeGen( Id compt, - Id chan, + Id chan, double value, double dia, double length ) @@ -827,13 +827,13 @@ bool ReadCell::addSpikeGen( chan, "Vm" ); - + if ( !graftFlag_ ) ++numOthers_; - + return Field< double >::set( chan, "threshold", value ); } - + return 0; } @@ -843,9 +843,9 @@ bool ReadCell::addSpikeGen( * fields created on channels and other objects. Here the 'addChannelMessage()' * function handles these 'addmsg' fields. */ -bool ReadCell::addCaConc( +bool ReadCell::addCaConc( Id compt, - Id chan, + Id chan, double value, double dia, double length ) @@ -853,7 +853,7 @@ bool ReadCell::addCaConc( double thickness = Field< double >::get( chan, "thick" ); if ( thickness > dia / 2.0 ) thickness = 0.0; - + string className = chan.element()->cinfo()->name(); if ( className == "CaConc" ) { if ( value > 0.0 ) { @@ -870,7 +870,7 @@ bool ReadCell::addCaConc( vol = M_PI * ( dia * dia * dia - inner_dia * inner_dia * inner_dia - ) / 6.0; + ) / 6.0; } else { vol = M_PI * dia * dia * dia / 6.0; } @@ -880,17 +880,17 @@ bool ReadCell::addCaConc( } else { value = - value; } - + if ( !graftFlag_ ) ++numOthers_; - + return Field< double >::set( chan, "B", value ); } - + return 0; } -bool ReadCell::addNernst( +bool ReadCell::addNernst( Id compt, Id chan, double value ) @@ -901,81 +901,81 @@ bool ReadCell::addNernst( } /* -void ReadCell::addKinModel( Element* compt, double lambda, +void ReadCell::addKinModel( Element* compt, double lambda, string name, string method ) { // cout << "addKinModel on " << compt->name() << // " name= " << name << ", lambda = " << lambda << // ", using " << method << endl; - + Element* kinElm = findChannel( name ); if ( kinElm == 0 ) { cerr << "Error:ReadCell: KinProto '" << name << "' not found\n"; cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; return; } - - Element* kph = Neutral::create( "KinPlaceHolder", "kinModel", + + Element* kph = Neutral::create( "KinPlaceHolder", "kinModel", compt->id(), Id::childId( compt->id() ) ); - set< Id, double, string >( kph, "setup", + set< Id, double, string >( kph, "setup", kinElm->id(), lambda, method ); } -void ReadCell::addM2C( Element* compt, double scale, +void ReadCell::addM2C( Element* compt, double scale, vector< string >::iterator args ) { - // cout << "addM2C on " << compt->name() << - // " scale= " << scale << - // " mol= " << *args << ", moloff= " << *(args+1) << + // cout << "addM2C on " << compt->name() << + // " scale= " << scale << + // " mol= " << *args << ", moloff= " << *(args+1) << // " chan= " << *(args + 2) << ", chanoff= " << *(args+3) << endl; - + string molName = *args++; double molOffset = atof( ( *args++ ).c_str() ); string chanName = *args++; double chanOffset = atof( ( *args ).c_str() ); string adaptorName = molName + "_2_" + chanName; - + Element* chan = findChannel( chanName ); if ( chan == 0 ) { - cerr << "Error:ReadCell: addM2C ': channel" << chanName << + cerr << "Error:ReadCell: addM2C ': channel" << chanName << "' not found\n"; cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; return; } - + Element* adaptor = Neutral::create( "Adaptor", adaptorName, compt->id(), Id::childId( compt->id() ) ); - + Eref( adaptor ).add( "outputSrc", Eref( chan ), "Gbar" ); set< string, double, double, double >( adaptor, "setup", molName, scale, molOffset, chanOffset ); } -void ReadCell::addC2M( Element* compt, double scale, +void ReadCell::addC2M( Element* compt, double scale, vector< string >::iterator args ) { - // cout << "addC2M on " << compt->name() << - // " scale= " << scale << - // " chan= " << *args << ", chanoff= " << *(args+1) << + // cout << "addC2M on " << compt->name() << + // " scale= " << scale << + // " chan= " << *args << ", chanoff= " << *(args+1) << // " mol= " << *(args + 2) << ", moloff= " << *(args+3) << endl; - + string chanName = *args++; double chanOffset = atof( ( *args++ ).c_str() ); string molName = *args++; double molOffset = atof( ( *args++ ).c_str() ); string adaptorName = "Ca_2_" + molName; - + Element* chan = findChannel( chanName ); if ( chan == 0 ) { - cerr << "Error:ReadCell: addC2M ': channel" << chanName << + cerr << "Error:ReadCell: addC2M ': channel" << chanName << "' not found\n"; cerr << "File: " << fileName_ << " Line: " << lineNum_ << endl; return; } - + Element* adaptor = Neutral::create( "Adaptor", adaptorName, compt->id(), Id::childId( compt->id() ) ); - + Eref( adaptor ).add( "inputRequest", Eref( chan ), "Ca" ); set< string, double, double, double >( adaptor, "setup", molName, scale, chanOffset, molOffset ); @@ -1008,20 +1008,20 @@ void ReadCell::addChannelMessage( Id chan ) ObjId src = shell->doFind( token[0] ); ObjId dest = shell->doFind( token[2] ); - // I would like to assert, or warn here, but there are legitimate - // cases where not all possible messages are actually available + // I would like to assert, or warn here, but there are legitimate + // cases where not all possible messages are actually available // to set up. So I just bail. if ( src.bad() || dest.bad()) { #ifndef NDEBUG /* - cout << "ReadCell::addChannelMessage( " << chan.path() << - "): " << name << " " << s << + cout << "ReadCell::addChannelMessage( " << chan.path() << + "): " << name << " " << s << ": Bad src " << src << " or dest " << dest << endl; */ #endif - continue; + continue; } - ObjId mid = + ObjId mid = shell->doAddMsg( "single", src, token[1], dest, token[3] ); assert( !mid.bad()); } @@ -1035,16 +1035,16 @@ void ReadCell::countProtos( ) { //~ if ( protoCompt_ == 0 ) //~ return; - //~ + //~ //~ numProtoCompts_ = 1; // protoCompt_ itself //~ numProtoChans_ = 0; //~ numProtoOthers_ = 0; -//~ +//~ //~ vector< vector< Id > > cstack; //~ cstack.push_back( Neutral::getChildList( protoCompt_ ) ); //~ while ( !cstack.empty() ) { //~ vector< Id >& child = cstack.back(); - //~ + //~ //~ if ( child.empty() ) { //~ cstack.pop_back(); //~ if ( !cstack.empty() ) @@ -1052,7 +1052,7 @@ void ReadCell::countProtos( ) //~ } else { //~ const Id& curr = child.back(); //~ const Cinfo* currCinfo = curr()->cinfo(); - //~ + //~ //~ if ( currCinfo->isA( comptCinfo ) ) //~ ++numProtoCompts_; //~ else if ( currCinfo->isA( chanCinfo ) || @@ -1062,7 +1062,7 @@ void ReadCell::countProtos( ) //~ currCinfo->isA( caconcCinfo ) || //~ currCinfo->isA( nernstCinfo ) ) //~ ++numProtoOthers_; - //~ + //~ //~ cstack.push_back( Neutral::getChildList( curr() ) ); //~ } //~ } diff --git a/moose-core/biophysics/ReadCell.h b/moose-core/biophysics/ReadCell.h index eb0705a78809e1f7eeac9b44a3cf19f90b73f639..746060cf8e2ddeb238c8480b0687ea941d310c67 100644 --- a/moose-core/biophysics/ReadCell.h +++ b/moose-core/biophysics/ReadCell.h @@ -12,8 +12,8 @@ enum ParseStage { COMMENT, DATA, SCRIPT }; /** * The ReadCell class implements the old GENESIS cellreader - * functionality. - * + * functionality. + * * ReadCell is partially implemented but works for most common uses and * will evolve to some further point. * @@ -26,18 +26,18 @@ class ReadCell public: // ReadCell( const vector< double >& globalParms ); ReadCell(); - + Id read( - const string& filename, + const string& filename, const string& cellname, Id parent ); - + static void addChannelMessage( Id chan ); private: bool innerRead( ifstream& fin ); bool readData( const string& line ); bool readScript( const string& line ); - Id buildCompartment( + Id buildCompartment( const string& name, const string& parent, double x0, double y0, double z0, @@ -54,25 +54,25 @@ class ReadCell Id findChannel( const string& name ); Id addChannel( Id compt, - Id chan, + Id chan, double value, double dia, double length ); bool addCanonicalChannel( Id compt, - Id chan, + Id chan, double value, double dia, double length ); bool addSpikeGen( Id compt, - Id chan, + Id chan, double value, double dia, double length ); bool addCaConc( Id compt, - Id chan, + Id chan, double value, double dia, double length ); @@ -88,20 +88,20 @@ class ReadCell string method ); void addM2C( Id compt, - double value, + double value, vector< string >::iterator args ); void addC2M( Id compt, - double value, + double value, vector< string >::iterator args ); */ - + void countProtos(); - + // For error messages string fileName_; unsigned int lineNum_; - + double RM_; double CM_; double RA_; @@ -118,21 +118,21 @@ class ReadCell bool erestFlag_; bool eleakFlag_; - + Id cell_; Id currCell_; Id lastCompt_; Id protoCompt_; - + unsigned int numCompartments_; unsigned int numChannels_; unsigned int numOthers_; - + unsigned int numProtoCompts_; unsigned int numProtoChans_; unsigned int numProtoOthers_; - - /** + + /** * Flag indicating if we are building the main cell, or just a freely * hanging branch which will be grafted on later. */ @@ -141,9 +141,9 @@ class ReadCell bool relativeCoordsFlag_; bool doubleEndpointFlag_; bool symmetricFlag_; - + map< string, Id > chanProtos_; - + Shell* shell_; }; #endif diff --git a/moose-core/biophysics/ReadSwc.cpp b/moose-core/biophysics/ReadSwc.cpp index 9894e0472bf64628f75971fc76ae95f6d2c3ddf6..fe03adb14ee71fa13a8a3468a83e41c34c48bf57 100644 --- a/moose-core/biophysics/ReadSwc.cpp +++ b/moose-core/biophysics/ReadSwc.cpp @@ -19,7 +19,7 @@ // Minimum allowed radius of segment, in microns // Believe it or not, some otherwise reasonable files do have smaller radii -static const double MinRadius = 0.04; +static const double MinRadius = 0.04; ReadSwc::ReadSwc( const string& fname ) { @@ -32,7 +32,7 @@ ReadSwc::ReadSwc( const string& fname ) string temp; int badSegs = 0; while( getline( fin, temp ) ) { - if ( temp.length() == 0 ) + if ( temp.length() == 0 ) continue; string::size_type pos = temp.find_first_not_of( "\t " ); if ( pos == string::npos ) @@ -52,10 +52,10 @@ ReadSwc::ReadSwc( const string& fname ) cleanZeroLength(); parseBranches(); } - cout << "ReadSwc: " << fname << " : NumSegs = " << segs_.size() << + cout << "ReadSwc: " << fname << " : NumSegs = " << segs_.size() << ", bad = " << badSegs << - ", Validated = " << valid << - ", numBranches = " << branches_.size() << + ", Validated = " << valid << + ", numBranches = " << branches_.size() << endl; diagnostics(); } @@ -83,10 +83,10 @@ bool ReadSwc::validate() const } bool valid = ( numStart == 1 && numOrphans == 0 && badRadius == 0 ); if ( !valid ) { - cout << "ReadSwc::validate() failed: \nNumSegs = " << - segs_.size() << + cout << "ReadSwc::validate() failed: \nNumSegs = " << + segs_.size() << ", numStart = " << numStart << - ", orphans = " << numOrphans << + ", orphans = " << numOrphans << ", badIndex = " << badIndex << ", badRadius = " << badRadius << ", numBranches = " << branches_.size() << @@ -135,7 +135,7 @@ void ReadSwc::cleanZeroLength() } } -void ReadSwc::traverseBranch( const SwcSegment& s, +void ReadSwc::traverseBranch( const SwcSegment& s, double& len, double& L, vector< int >& cable ) const { const SwcSegment* prev = &s; @@ -208,7 +208,7 @@ void ReadSwc::diagnostics() const */ } -static Id makeCompt( Id parent, +static Id makeCompt( Id parent, const SwcSegment& seg, const SwcSegment& pa, double RM, double RA, double CM, unsigned int i, unsigned int j ) @@ -253,7 +253,7 @@ static Id makeCompt( Id parent, return compt; } -bool ReadSwc::build( Id parent, +bool ReadSwc::build( Id parent, double lambda, double RM, double RA, double CM ) { Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); @@ -271,7 +271,7 @@ bool ReadSwc::build( Id parent, compt = makeCompt( parent, seg, pa, RM, RA, CM, i, j ); assert( compt != Id() ); assert( compts[ paIndex -1 ] != Id() ); - shell->doAddMsg( "Single", + shell->doAddMsg( "Single", compts[paIndex-1], "axial", compt, "raxial" ); } assert( compt != Id() ); diff --git a/moose-core/biophysics/ReadSwc.h b/moose-core/biophysics/ReadSwc.h index 218295556334d8b50fb68672907f55aaf174220c..286c9e0a9ec910ccbaa834814805f41b43293757 100644 --- a/moose-core/biophysics/ReadSwc.h +++ b/moose-core/biophysics/ReadSwc.h @@ -29,7 +29,7 @@ class ReadSwc void parseBranches(); void traverseBranch( const SwcSegment& s, double &len, double& L, vector< int >& cable ) const; - bool build( Id parent, + bool build( Id parent, double lambda, double RM, double RA, double CM ); void diagnostics() const; @@ -37,12 +37,12 @@ class ReadSwc vector< SwcSegment > segs_; /** - * branches holds the NeuroMorpho index of the end segment of + * branches holds the NeuroMorpho index of the end segment of * each branch. Note that NeuroMorph index starts from 1. * To traverse the branch, go to the end segment, and traverse * through all parents till you get to a fork. */ - vector< SwcBranch > branches_; + vector< SwcBranch > branches_; }; #endif // READSWC_H diff --git a/moose-core/biophysics/SpikeGen.cpp b/moose-core/biophysics/SpikeGen.cpp index bf8c0b93b4586366086d3934b04fc9bbd8168d2d..dad122603bbd30c03465106519b4db1c0125742f 100644 --- a/moose-core/biophysics/SpikeGen.cpp +++ b/moose-core/biophysics/SpikeGen.cpp @@ -14,7 +14,7 @@ // MsgSrc definitions /////////////////////////////////////////////////////// static SrcFinfo1< double > *spikeOut() { - static SrcFinfo1< double > spikeOut( "spikeOut", + static SrcFinfo1< double > spikeOut( "spikeOut", "Sends out a trigger for an event."); return &spikeOut; } @@ -24,10 +24,10 @@ const Cinfo* SpikeGen::initCinfo() /////////////////////////////////////////////////////// // Shared message definitions /////////////////////////////////////////////////////// - static DestFinfo process( "process", + static DestFinfo process( "process", "Handles process call", new ProcOpFunc< SpikeGen >( &SpikeGen::process ) ); - static DestFinfo reinit( "reinit", + static DestFinfo reinit( "reinit", "Handles reinit call", new ProcOpFunc< SpikeGen >( &SpikeGen::reinit ) ); @@ -36,10 +36,10 @@ const Cinfo* SpikeGen::initCinfo() &process, &reinit }; - static SharedFinfo proc( "proc", + static SharedFinfo proc( "proc", "Shared message to receive Process message from scheduler", processShared, sizeof( processShared ) / sizeof( Finfo* ) ); - + ////////////////////////////////////////////////////////////////// // Dest Finfos. ////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ const Cinfo* SpikeGen::initCinfo() ////////////////////////////////////////////////////////////////// // Value Finfos. ////////////////////////////////////////////////////////////////// - + static ValueFinfo< SpikeGen, double > threshold( "threshold", "Spiking threshold, must cross it going up", &SpikeGen::setThreshold, @@ -82,7 +82,7 @@ const Cinfo* SpikeGen::initCinfo() &SpikeGen::getEdgeTriggered ); - static Finfo* spikeGenFinfos[] = + static Finfo* spikeGenFinfos[] = { spikeOut(), // SrcFinfo &proc, // Shared @@ -111,7 +111,7 @@ const Cinfo* SpikeGen::initCinfo() spikeGenFinfos, sizeof( spikeGenFinfos ) / sizeof( Finfo* ), &dinfo, doc, - sizeof(doc)/sizeof(string) + sizeof(doc)/sizeof(string) ); return &spikeGenCinfo; @@ -197,7 +197,7 @@ void SpikeGen::process( const Eref& e, ProcPtr p ) if ( !( edgeTriggered_ && fired_ ) ) { spikeOut()->send( e, t ); lastEvent_ = t; - fired_ = true; + fired_ = true; } } } else { diff --git a/moose-core/biophysics/SpikeRingBuffer.cpp b/moose-core/biophysics/SpikeRingBuffer.cpp index f4d1e9c3b5adbd5ff21e544fe674095fd13e79d2..36170262f88d6c86fc9699b09b50ec5196457062 100644 --- a/moose-core/biophysics/SpikeRingBuffer.cpp +++ b/moose-core/biophysics/SpikeRingBuffer.cpp @@ -18,9 +18,9 @@ using namespace std; const unsigned int SpikeRingBuffer::MAXBIN = 128; SpikeRingBuffer::SpikeRingBuffer() - : dt_( 1e-4 ), + : dt_( 1e-4 ), currTime_( 0 ), - currentBin_( 0 ), + currentBin_( 0 ), weightSum_( 20, 0.0 ) {;} @@ -32,13 +32,13 @@ void SpikeRingBuffer::reinit( double dt, double bufferTime ) unsigned int newsize = bufferTime / dt; if ( newsize > MAXBIN ) { cout << "Warning: SpikeRingBuffer::reinit: buffer size too big: " << - newsize << " = " << bufferTime << " / " << + newsize << " = " << bufferTime << " / " << dt << ", using " << MAXBIN << endl; newsize = MAXBIN; } if ( newsize == 0 ) { cout << "Warning: SpikeRingBuffer::reinit: buffer size too small: " << - newsize << " = " << bufferTime << " / " << + newsize << " = " << bufferTime << " / " << dt << ", using " << 10 << endl; newsize = 10; } @@ -58,7 +58,7 @@ void SpikeRingBuffer::addSpike( double t, double w ) bin = 0; } else if ( bin >= MAXBIN ) { cout << "Warning: SpikeRingBuffer: bin number exceeds limit: "<< - "spikeTime = " << t << ", currtime= " << currTime_ << + "spikeTime = " << t << ", currtime= " << currTime_ << ", dt = " << dt_ << ", bin = " << bin << " >= " << MAXBIN << ", terminating\n"; assert( 0 ); } else { @@ -75,7 +75,7 @@ double SpikeRingBuffer::pop( double currTime ) currTime_ = currTime; if ( currentBin_ == weightSum_.size() ) currentBin_ = 0; - double ret = weightSum_[ currentBin_ ]; + double ret = weightSum_[ currentBin_ ]; weightSum_[ currentBin_++ ] = 0.0; return ret; } diff --git a/moose-core/biophysics/SpikeRingBuffer.h b/moose-core/biophysics/SpikeRingBuffer.h index a45611ffe1456392904ccf376ee5251ffabe6032..cd349b34298e4a9df287e4584ae4baa7465b1e76 100644 --- a/moose-core/biophysics/SpikeRingBuffer.h +++ b/moose-core/biophysics/SpikeRingBuffer.h @@ -13,7 +13,7 @@ * This ring buffer handles incoming spikes. It spans an interval equal to * the longest arrival delay. When a spike event is notified it puts it into * the slot defined by the arrival time. It just adds the weight onto the - * existing value in this slot, assuming a linear summation of the + * existing value in this slot, assuming a linear summation of the * weights of coincident inputs. */ class SpikeRingBuffer diff --git a/moose-core/biophysics/Spine.cpp b/moose-core/biophysics/Spine.cpp index 11fabb58251628c6e452f933898755c9cde0f293..6909b54555d332e3bf3b72aa47a401871428af71 100644 --- a/moose-core/biophysics/Spine.cpp +++ b/moose-core/biophysics/Spine.cpp @@ -128,7 +128,7 @@ const Cinfo* Spine::initCinfo() &totalLength, // Value }; - static string doc[] = + static string doc[] = { "Name", "Spine", "Author", "Upi Bhalla", @@ -176,7 +176,7 @@ Spine::Spine( const Neuron* parent ) double Spine::getShaftLength( const Eref& e ) const { const vector< Id >& sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 0 && + if ( sl.size() > 0 && sl[0].element()->cinfo()->isA( "CompartmentBase" ) ) return Field< double >::get( sl[0], "length" ); return 0.0; @@ -189,14 +189,14 @@ void Spine::setShaftLength( const Eref& e, double len ) else if ( len > maximumSize_ ) len = maximumSize_; vector< Id > sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 1 && - sl[0].element()->cinfo()->isA( "CompartmentBase" ) ) - { + if ( sl.size() > 1 && + sl[0].element()->cinfo()->isA( "CompartmentBase" ) ) + { double origDia = Field< double >::get( sl[0], "diameter" ); double dx = Field< double >::get( sl[0], "x" ); double dy = Field< double >::get( sl[0], "y" ); double dz = Field< double >::get( sl[0], "z" ); - SetGet2< double, double >::set( + SetGet2< double, double >::set( sl[0], "setGeomAndElec", len, origDia ); dx = Field< double >::get( sl[0], "x" ) - dx; @@ -207,7 +207,7 @@ void Spine::setShaftLength( const Eref& e, double len ) dx, dy, dz ); // Here we've set the electrical and geometrical stuff. Now to // do the diffusion. Chem doesn't come into the picture for the - // spine shaft. + // spine shaft. // Assume the scaleDiffusion function propagates changes into the // VoxelJunctions used by the Dsolve. parent_->scaleShaftDiffusion( e.fieldIndex(), len, origDia ); @@ -217,7 +217,7 @@ void Spine::setShaftLength( const Eref& e, double len ) double Spine::getShaftDiameter( const Eref& e ) const { vector< Id > sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 0 && + if ( sl.size() > 0 && sl[0].element()->cinfo()->isA( "CompartmentBase" ) ) return Field< double >::get( sl[0], "diameter" ); return 0.0; @@ -231,11 +231,11 @@ void Spine::setShaftDiameter( const Eref& e, double dia ) dia = maximumSize_; vector< Id > sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 1 && + if ( sl.size() > 1 && sl[0].element()->cinfo()->isA( "CompartmentBase") ) { double origLen = Field< double >::get( sl[0], "length" ); - SetGet2< double, double >::set( + SetGet2< double, double >::set( sl[0], "setGeomAndElec", origLen, dia ); // Dia is changing, leave the coords alone. parent_->scaleShaftDiffusion( e.fieldIndex(), origLen, dia ); @@ -245,7 +245,7 @@ void Spine::setShaftDiameter( const Eref& e, double dia ) double Spine::getHeadLength( const Eref& e ) const { vector< Id > sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 1 && + if ( sl.size() > 1 && sl[1].element()->cinfo()->isA( "CompartmentBase" ) ) return Field< double >::get( sl[1], "length" ); return 0.0; @@ -259,12 +259,12 @@ void Spine::setHeadLength( const Eref& e, double len ) len = maximumSize_; vector< Id > sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 1 && - sl[1].element()->cinfo()->isA( "CompartmentBase") ) + if ( sl.size() > 1 && + sl[1].element()->cinfo()->isA( "CompartmentBase") ) { double origDia = Field< double >::get( sl[1], "diameter" ); double origLen = Field< double >::get( sl[1], "length" ); - SetGet2< double, double >::set( + SetGet2< double, double >::set( sl[1], "setGeomAndElec", len, origDia ); // Here we've set the electrical and geometrical stuff. Now to // do the diffusion. @@ -280,7 +280,7 @@ void Spine::setHeadLength( const Eref& e, double len ) double Spine::getHeadDiameter( const Eref& e ) const { vector< Id > sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 1 && + if ( sl.size() > 1 && sl[1].element()->cinfo()->isA( "CompartmentBase" ) ) return Field< double >::get( sl[1], "diameter" ); return 0.0; @@ -293,15 +293,15 @@ void Spine::setHeadDiameter( const Eref& e, double dia ) else if ( dia > maximumSize_ ) dia = maximumSize_; vector< Id > sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 1 && + if ( sl.size() > 1 && sl[0].element()->cinfo()->isA( "CompartmentBase") ) { double origLen = Field< double >::get( sl[1], "length" ); double origDia = Field< double >::get( sl[1], "diameter" ); - SetGet2< double, double >::set( + SetGet2< double, double >::set( sl[1], "setGeomAndElec", origLen, dia ); parent_->scaleHeadDiffusion( e.fieldIndex(), origLen, dia ); - parent_->scaleBufAndRates( e.fieldIndex(), + parent_->scaleBufAndRates( e.fieldIndex(), 1.0, dia/origDia ); } } @@ -340,7 +340,7 @@ void Spine::setHeadVolume( const Eref& e, double volume ) volume = pow( maximumSize_, 3.0 ) * PI / 4.0; vector< Id > sl = parent_->spineIds( e.fieldIndex() ); - if ( sl.size() > 1 && + if ( sl.size() > 1 && sl[0].element()->cinfo()->isA( "CompartmentBase") ) { double origLen = Field< double >::get( sl[1], "length" ); @@ -348,7 +348,7 @@ void Spine::setHeadVolume( const Eref& e, double volume ) double oldVolume = origLen * origDia * origDia * PI / 4.0; double ratio = pow( volume / oldVolume, 1.0/3.0 ); - SetGet2< double, double >::set( + SetGet2< double, double >::set( sl[1], "setGeomAndElec", origLen * ratio, origDia * ratio ); parent_->scaleHeadDiffusion( e.fieldIndex(), origLen * ratio, origDia * ratio ); parent_->scaleBufAndRates( e.fieldIndex(), ratio, ratio ); @@ -361,7 +361,7 @@ double Spine::getTotalLength( const Eref& e ) const } void Spine::setTotalLength( const Eref& e, double len ) -{ +{ double shaftLen = getShaftLength( e ); double headLen = getHeadLength( e ); double totLen = shaftLen + headLen; @@ -384,7 +384,7 @@ double Spine::getAngle( const Eref& e ) const } void Spine::setAngle( const Eref& e, double theta ) -{ +{ ; } @@ -394,7 +394,7 @@ double Spine::getInclination( const Eref& e ) const } void Spine::setInclination( const Eref& e, double theta ) -{ +{ ; } diff --git a/moose-core/biophysics/Spine.h b/moose-core/biophysics/Spine.h index 896dcb9b3d07b14b2027b261eaa86de75f6bc3b3..62c4b5812c37da62dc6581001095954954febae8 100644 --- a/moose-core/biophysics/Spine.h +++ b/moose-core/biophysics/Spine.h @@ -23,7 +23,7 @@ class Neuron; */ class Spine { - public: + public: Spine(); Spine( const Neuron* parent ); ////////////////////////////////////////////////////////////////// @@ -50,11 +50,11 @@ class Spine double getTotalLength( const Eref& e ) const; // rotate around dend, but still at right angles to it. - void setAngle( const Eref& e, double theta ); + void setAngle( const Eref& e, double theta ); double getAngle( const Eref& e ) const; // Incline to dend, radians. Default is normal to dend and is 0. - void setInclination( const Eref& e, double phi ); + void setInclination( const Eref& e, double phi ); double getInclination( const Eref& e ) const; void setMinimumSize( const Eref& e, double len ); @@ -63,7 +63,7 @@ class Spine double getMaximumSize( const Eref& e ) const; // Assign to specific vector. Length of vector does size scaling. - //void setVectorDirection( const Eref& e, vector< double > dir ); + //void setVectorDirection( const Eref& e, vector< double > dir ); //vector< double > getVectorDirection( const Eref& e ) const; ////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ class Spine const Neuron* parent_; /** * Used as a sanity check for assigning dimensions, to avoid - * unreasonable physiological values. + * unreasonable physiological values. * Defaults to 20 nanometers, which is somewhat smaller than the * 30 nm size estimated for synaptic vesicles. */ diff --git a/moose-core/biophysics/SwcSegment.cpp b/moose-core/biophysics/SwcSegment.cpp index 03b1bfee18bd48bbb98665e518089d000e1491bd..3cbbbf09ea48bd6d1761da52010d5b68c6f29770 100644 --- a/moose-core/biophysics/SwcSegment.cpp +++ b/moose-core/biophysics/SwcSegment.cpp @@ -32,8 +32,8 @@ const short SwcSegment::AXON_END = 11; const short SwcSegment::APICAL_FORK = 12; const short SwcSegment::APICAL_END = 13; -const string SwcSegment::typeName[] = { - "undef", "soma", "axon", "dend", "apical", "dend_f", "dend_e", +const string SwcSegment::typeName[] = { + "undef", "soma", "axon", "dend", "apical", "dend_f", "dend_e", "custom", "bad", "undef", "axon_f", "axon_e", "apical_f", "apical_e" }; @@ -66,10 +66,10 @@ SwcSegment::SwcSegment( const string& line ) } } -SwcSegment::SwcSegment( int i, short type, - double x, double y, double z, +SwcSegment::SwcSegment( int i, short type, + double x, double y, double z, double r, int parent ) - : + : myIndex_( i ), type_( type ), v_( x, y, z ), @@ -93,17 +93,17 @@ void SwcSegment::figureOutType() if ( kids_.size() > 1 ) type_ = FORK; // Dend fork point else if ( kids_.size() == 0 ) - type_ = END; // end point + type_ = END; // end point } else if ( type_ == APICAL ) { if ( kids_.size() > 1 ) type_ = APICAL_FORK; // apical Dend fork point else if ( kids_.size() == 0 ) - type_ = APICAL_END; // apical end point + type_ = APICAL_END; // apical end point } else if ( type_ == AXON ) { if ( kids_.size() > 1 ) type_ = AXON_FORK; // apical Dend fork point else if ( kids_.size() == 0 ) - type_ = AXON_END; // apical end point + type_ = AXON_END; // apical end point } } @@ -131,7 +131,7 @@ SwcBranch::SwcBranch( int i, const SwcSegment& start, double len, double L, void SwcBranch::printDiagnostics() const { cout << myIndex() << ": " << segs_[0] << " -> " << segs_.back() << - " = " << segs_.size() << - " : pa = " << parent() << " , length=( " << + " = " << segs_.size() << + " : pa = " << parent() << " , length=( " << geomLength << ", " << electroLength << " )\n"; } diff --git a/moose-core/biophysics/SwcSegment.h b/moose-core/biophysics/SwcSegment.h index 41e7196e4c9e1e785294d3418ccf967e17ee6fa4..4400aec9d8fe5f6951a07b2e9b82c583c065022c 100644 --- a/moose-core/biophysics/SwcSegment.h +++ b/moose-core/biophysics/SwcSegment.h @@ -11,8 +11,8 @@ /** * This defines a single segment in an SWC file used in NeuroMorpho - * Note that this is not going to work well for dendritic spines which - * come off in the middle of a parent compartment, and which have to be + * Note that this is not going to work well for dendritic spines which + * come off in the middle of a parent compartment, and which have to be * started from the surface rather than the axis of the dendrite. */ class SwcSegment @@ -21,15 +21,15 @@ class SwcSegment SwcSegment() : myIndex_( 0 ), type_( 0 ), radius_( 0.0 ), length_( 0.0 ), L_( 0.0 ), - parent_( ~0U ), + parent_( ~0U ), geometricalDistanceFromSoma_( 0.0 ), electrotonicDistanceFromSoma_( 0.0 ) {;} SwcSegment( const string& line ); - SwcSegment( int i, short type, - double x, double y, double z, + SwcSegment( int i, short type, + double x, double y, double z, double r, int parent ); bool OK() const { @@ -109,11 +109,11 @@ class SwcSegment double getPathDistFromSoma() const { return pathDistanceFromSoma_; } - + double getGeomDistFromSoma() const { return geometricalDistanceFromSoma_; } - + double getElecDistFromSoma() const { return electrotonicDistanceFromSoma_; } @@ -150,7 +150,7 @@ class SwcSegment * 6 = end point * 7 = custom */ - short type_; + short type_; Vec v_; /// coordinates of end of segment double radius_; /// Radius of segment double length_; /// Length of segment @@ -158,13 +158,13 @@ class SwcSegment unsigned int parent_; /// Index of parent. Is ~0 for soma. /// dist from soma: not direct, but threaded along dend - double pathDistanceFromSoma_; + double pathDistanceFromSoma_; /// geometrical distance from soma. - double geometricalDistanceFromSoma_; + double geometricalDistanceFromSoma_; /// electrotonic dist from soma, summed along dend. - double electrotonicDistanceFromSoma_; + double electrotonicDistanceFromSoma_; vector< int > kids_; // Indices of all children of segment. }; @@ -199,7 +199,7 @@ class SwcBranch: public SwcSegment * entry is the one _after_ the fork point. The last entry is * either a fork or an end point. */ - vector< int > segs_; + vector< int > segs_; }; #endif // SWC_SEGMENT_H diff --git a/moose-core/biophysics/SymCompartment.cpp b/moose-core/biophysics/SymCompartment.cpp index d7584ee448211ed6e7ad57afcb9c118d2d9cdf56..11d2a07f25794060985b85780b6298a0fd72ed20 100644 --- a/moose-core/biophysics/SymCompartment.cpp +++ b/moose-core/biophysics/SymCompartment.cpp @@ -14,16 +14,16 @@ #include "SymCompartment.h" static SrcFinfo2< double, double > *distalOut() { - static SrcFinfo2< double, double > distalOut( "distalOut", + static SrcFinfo2< double, double > distalOut( "distalOut", "Sends out Ra and Vm on each timestep, on the distal end" " of a compartment. This end should be pointed away from the" - " soma. Mathematically the same as proximalOut, but gives" + " soma. Mathematically the same as proximalOut, but gives" " an orientation to the dendrite and helps traversal."); return &distalOut; } static SrcFinfo2< double, double > *proximalOut() { - static SrcFinfo2< double, double > proximalOut( "proximalOut", + static SrcFinfo2< double, double > proximalOut( "proximalOut", "Sends out Ra and Vm on each timestep, on the proximal" " end of a compartment. That is, this end should be " " pointed toward the soma. Mathematically the same as raxialOut" @@ -33,7 +33,7 @@ static SrcFinfo2< double, double > *proximalOut() { } static SrcFinfo2< double, double > *cylinderOut() { - static SrcFinfo2< double, double > cylinderOut( "cylinderOut", + static SrcFinfo2< double, double > cylinderOut( "cylinderOut", " Sends out Ra and Vm to compartments (typically spines) on the" " curved surface of a cylinder. Ra is set to nearly zero," " since we assume that the resistance from axis to surface is" @@ -53,13 +53,13 @@ const Cinfo* SymCompartment::initCinfo() ///////////////////////////////////////////////////////////////////// // Dest Finfos ///////////////////////////////////////////////////////////////////// - + static DestFinfo raxialSphere( "raxialSphere", "Expects Ra and Vm from other compartment. This is a special case when" " other compartments are evenly distributed on a spherical compartment.", new OpFunc2< SymCompartment, double, double >( &SymCompartment::raxialSphere) - ); + ); static DestFinfo raxialCylinder( "raxialCylinder", "Expects Ra and Vm from other compartment. This is a special case when" " other compartments are evenly distributed on the curved surface" @@ -67,15 +67,15 @@ const Cinfo* SymCompartment::initCinfo() " cylinder does not add any further resistance.", new OpFunc2< SymCompartment, double, double >( &SymCompartment::raxialCylinder) - ); - static DestFinfo raxialSym( "raxialSym", + ); + static DestFinfo raxialSym( "raxialSym", "Expects Ra and Vm from other compartment.", - new OpFunc2< SymCompartment, double, double >( + new OpFunc2< SymCompartment, double, double >( &SymCompartment::raxialSym ) ); - static DestFinfo sumRaxial( "sumRaxial", + static DestFinfo sumRaxial( "sumRaxial", "Expects Ra from other compartment.", - new OpFunc1< SymCompartment, double >( + new OpFunc1< SymCompartment, double >( &SymCompartment::sumRaxial ) ); ///////////////////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ const Cinfo* SymCompartment::initCinfo() static Finfo* distalShared[] = { - &raxialSym, &sumRaxial,// &handleSumRaxialRequest, + &raxialSym, &sumRaxial,// &handleSumRaxialRequest, distalOut(), sumRaxialOut(), //requestSumAxial() }; @@ -103,7 +103,7 @@ const Cinfo* SymCompartment::initCinfo() proximalShared, sizeof( proximalShared ) / sizeof( Finfo* ) ); - static SharedFinfo distal( "distal", + static SharedFinfo distal( "distal", "This is a shared message between symmetric compartments.\n" "It goes from the distal end of the current compartment to the \n" "proximal end of one further from the soma. \n" @@ -115,7 +115,7 @@ const Cinfo* SymCompartment::initCinfo() distalShared, sizeof( distalShared ) / sizeof( Finfo* ) ); - static SharedFinfo sibling( "sibling", + static SharedFinfo sibling( "sibling", "This is a shared message between symmetric compartments.\n" "Conceptually, this goes from the proximal end of the current \n" "compartment to the proximal end of a sibling compartment \n" @@ -132,7 +132,7 @@ const Cinfo* SymCompartment::initCinfo() &raxialSphere, distalOut(), }; - + static SharedFinfo sphere( "sphere", "This is a shared message between a spherical compartment \n" "(typically soma) and a number of evenly spaced cylindrical \n" @@ -177,7 +177,7 @@ const Cinfo* SymCompartment::initCinfo() ); ////////////////////////////////////////////////////////////////// - static Finfo* symCompartmentFinfos[] = + static Finfo* symCompartmentFinfos[] = { ////////////////////////////////////////////////////////////////// @@ -191,7 +191,7 @@ const Cinfo* SymCompartment::initCinfo() &sphere, &cylinder, &proximalOnly - + /////////////////////////////////////////////////////// // MsgSrc definitions /////////////////////////////////////////////////////// @@ -202,7 +202,7 @@ const Cinfo* SymCompartment::initCinfo() }; // static SchedInfo schedInfo[] = { { process, 0, 0 }, { init, 0, 1 } }; - + static string doc[] = { "Name", "SymCompartment", @@ -212,7 +212,7 @@ const Cinfo* SymCompartment::initCinfo() "the node. The equivalent circuit of the passive compartment becomes:\n" "(NOTE: you must use a fixed-width font like Courier for correct rendition of the diagrams below)::\n" " \n" - " Ra/2 B Ra/2 \n" + " Ra/2 B Ra/2 \n" " A-/\\/\\/\\_____/\\/\\/\\-- C \n" " | \n" " ____|____ \n" @@ -227,12 +227,12 @@ const Cinfo* SymCompartment::initCinfo() " |_________| \n" " | \n" " __|__ \n" - " ///// \n" + " ///// \n" " \n" " \n\n" "In case of branching, the B-C part of the parent's axial resistance\n" "forms a Y with the A-B part of the children::\n\n" - " B' \n" + " B' \n" " | \n" " / \n" " \\ \n" @@ -240,7 +240,7 @@ const Cinfo* SymCompartment::initCinfo() " \\ \n" " / \n" " |A' \n" - " B | \n" + " B | \n" " A-----/\\/\\/\\-----/\\/\\/\\------|C \n" " | \n" " |A\" \n" @@ -344,7 +344,7 @@ void SymCompartment::raxialSym( double Ra, double Vm) B_ += 1.0 / Ra; Im_ += ( Vm - Vm_ ) / Ra; */ - + double R = Ra * coeff_; // cout << "raxialSym:R=" << R << endl; A_ += Vm / R; diff --git a/moose-core/biophysics/SymCompartment.h b/moose-core/biophysics/SymCompartment.h index 8fd5f878a4409f77b4e4a027b814425d0e1f0552..dc32b3cde55f3faeb2b214dd7e0073c54847a9b9 100644 --- a/moose-core/biophysics/SymCompartment.h +++ b/moose-core/biophysics/SymCompartment.h @@ -15,10 +15,10 @@ * The SymCompartment class sets up a symmetric compartment for * branched nerve calculations. Handles electronic structure and * also channels. This version splits the Ra between either end of the - * compartment and is hence slightly cleaner than the asymmetric + * compartment and is hence slightly cleaner than the asymmetric * compartment. * The default EE method is not a particularly efficient way of doing - * the calculations, so we should use a solver for any substantial + * the calculations, so we should use a solver for any substantial * calculations. */ class SymCompartment: public moose::Compartment @@ -41,7 +41,7 @@ class SymCompartment: public moose::Compartment void vInitProc( const Eref& e, ProcPtr p ); void vInitReinit( const Eref& e, ProcPtr p ); private: - // used for storing multiplicative coefficient computed from + // used for storing multiplicative coefficient computed from // adjacent nodes in star-mesh transformation double coeff_; double RaSum_; diff --git a/moose-core/biophysics/SynChan.cpp b/moose-core/biophysics/SynChan.cpp index fc49a64d9b02b87b55ba2fc51ec67dd1da259151..4fd207c5d00c02ca8be72d4bdd369cf1175653eb 100644 --- a/moose-core/biophysics/SynChan.cpp +++ b/moose-core/biophysics/SynChan.cpp @@ -22,11 +22,11 @@ const Cinfo* SynChan::initCinfo() /////////////////////////////////////////////////////// // Shared message definitions /////////////////////////////////////////////////////// - + /////////////////////////////////////////////////////// // Field definitions /////////////////////////////////////////////////////// - static ValueFinfo< SynChan, double > tau1( "tau1", + static ValueFinfo< SynChan, double > tau1( "tau1", "Decay time constant for the synaptic conductance, tau1 >= tau2.", &SynChan::setTau1, &SynChan::getTau1 @@ -36,8 +36,8 @@ const Cinfo* SynChan::initCinfo() &SynChan::setTau2, &SynChan::getTau2 ); - static ValueFinfo< SynChan, bool > normalizeWeights( - "normalizeWeights", + static ValueFinfo< SynChan, bool > normalizeWeights( + "normalizeWeights", "Flag. If true, the overall conductance is normalized by the " "number of individual synapses in this SynChan object.", &SynChan::setNormalizeWeights, @@ -47,7 +47,7 @@ const Cinfo* SynChan::initCinfo() /////////////////////////////////////////////////////// // MsgDest definitions /////////////////////////////////////////////////////// - static DestFinfo activation( "activation", + static DestFinfo activation( "activation", "Sometimes we want to continuously activate the channel", new OpFunc1< SynChan, double >( &SynChan::activation ) ); @@ -83,7 +83,7 @@ const Cinfo* SynChan::initCinfo() SynChanFinfos, sizeof( SynChanFinfos )/sizeof(Finfo *), &dinfo, - doc, + doc, sizeof( doc )/sizeof( string ) ); @@ -93,7 +93,7 @@ const Cinfo* SynChan::initCinfo() static const Cinfo* synChanCinfo = SynChan::initCinfo(); SynChan::SynChan() - : + : tau1_( 1.0e-3 ), tau2_( 1.0e-3 ), normalizeWeights_( 0 ), xconst1_(0.0), @@ -177,10 +177,10 @@ void SynChan::normalizeGbar() if ( doubleEq( tau1_, tau2_ ) ) { norm_ = ChanCommon::getGbar() * SynE() / tau1_; } else { - double tpeak = tau1_ * tau2_ * log( tau1_ / tau2_ ) / + double tpeak = tau1_ * tau2_ * log( tau1_ / tau2_ ) / ( tau1_ - tau2_ ); - norm_ = ChanCommon::getGbar() * ( tau1_ - tau2_ ) / - ( tau1_ * tau2_ * ( + norm_ = ChanCommon::getGbar() * ( tau1_ - tau2_ ) / + ( tau1_ * tau2_ * ( exp( -tpeak / tau1_ ) - exp( -tpeak / tau2_ ) )); } diff --git a/moose-core/biophysics/SynChan.h b/moose-core/biophysics/SynChan.h index 12324a2a9d21a31fc5ebf397cf30974f45b3a314..0c45f6687aee6719608d2151a1c4a10df96b3f63 100644 --- a/moose-core/biophysics/SynChan.h +++ b/moose-core/biophysics/SynChan.h @@ -65,12 +65,12 @@ class SynChan: public ChanCommon static const Cinfo* initCinfo(); protected: // Used by NMDAChan - + /////////////////////////////////////////////////// // Utility function /////////////////////////////////////////////////// // virtual unsigned int updateNumSynapse( Eref e ); - + double tau1_; double tau2_; int normalizeWeights_; @@ -80,8 +80,8 @@ class SynChan: public ChanCommon double yconst2_; double norm_; double activation_; - double X_; - double Y_; + double X_; + double Y_; double dt_; /// Tracks the timestep assigned at reinit. }; diff --git a/moose-core/biophysics/VClamp.cpp b/moose-core/biophysics/VClamp.cpp index c5056af356f24d6d1aa4b95ab8ead0b8a9530dac..9ed2be8632130943b4c1d91a366ea6ed77e2dfe4 100644 --- a/moose-core/biophysics/VClamp.cpp +++ b/moose-core/biophysics/VClamp.cpp @@ -1,47 +1,47 @@ -// VClamp.cpp --- -// +// VClamp.cpp --- +// // Filename: VClamp.cpp -// Description: -// Author: -// Maintainer: +// Description: +// Author: +// Maintainer: // Created: Fri Feb 1 19:30:45 2013 (+0530) -// Version: +// Version: // Last-Updated: Tue Jun 11 17:33:16 2013 (+0530) // By: subha // Update #: 297 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// // Implementation of Voltage Clamp -// -// +// +// // 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 // Lesser 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: @@ -102,7 +102,7 @@ const Cinfo * VClamp::initCinfo() " action is negligibly small.", &VClamp::setTi, &VClamp::getTi); - + static ValueFinfo< VClamp, double> td("td", "Derivative time of the PID controller. This defaults to 0," "i.e. derivative action is unused.", @@ -117,7 +117,7 @@ const Cinfo * VClamp::initCinfo() static ValueFinfo< VClamp, double> gain("gain", "Proportional gain of the PID controller.", &VClamp::setGain, - &VClamp::getGain); + &VClamp::getGain); static ReadOnlyValueFinfo< VClamp, double> current("current", "The amount of current injected by the clamp into the membrane.", &VClamp::getCurrent); @@ -130,7 +130,7 @@ const Cinfo * VClamp::initCinfo() "The `VmOut` message of the Compartment object should be connected" " here.", new OpFunc1<VClamp, double>( &VClamp::setVin)); - + static DestFinfo commandIn("commandIn", " The command voltage source should be connected to this.", new OpFunc1<VClamp, double>( &VClamp::setCommand)); @@ -176,7 +176,7 @@ const Cinfo * VClamp::initCinfo() " derivative time of PID, td = 0\n" "\n", }; - + static Dinfo< VClamp > dinfo; static Cinfo vclampCinfo( "VClamp", @@ -187,7 +187,7 @@ const Cinfo * VClamp::initCinfo() doc, sizeof(doc)/sizeof(string)); - return &vclampCinfo; + return &vclampCinfo; } static const Cinfo * vclampCinfo = VClamp::initCinfo(); @@ -292,7 +292,7 @@ void VClamp::process(const Eref& e, ProcPtr p) assert(tau_ > 0); double dCmd = cmdIn_ - oldCmdIn_; command_ = cmdIn_ + dCmd * ( 1 - tauByDt_) + (command_ - cmdIn_ + dCmd * tauByDt_) * expt_; - oldCmdIn_ = cmdIn_; + oldCmdIn_ = cmdIn_; e_ = command_ - vIn_; if (mode_ == 0){ current_ += Kp_ * ((1 + dtByTi_ + tdByDt_) * e_ - ( 1 + 2 * tdByDt_) * e1_ + tdByDt_ * e2_); @@ -302,7 +302,7 @@ void VClamp::process(const Eref& e, ProcPtr p) current_ += Kp_ * ((1 + dtByTi_) * e_ - e1_ + tdByDt_ * ( vIn_ - 2 * v1_ + e2_)); e2_ = v1_; v1_ = vIn_; - e1_ = e_; + e1_ = e_; } else if (mode_ == PROPORTIONAL_ON_PV){ // Here the proportional as well as the derivative error term is replaced by process variable current_ += Kp_ * (vIn_ - v1_ + dtByTi_ * e_ + tdByDt_ * ( vIn_ - 2 * v1_ + e2_)); e2_ = v1_; @@ -344,5 +344,5 @@ void VClamp::reinit(const Eref& e, ProcPtr p) } } -// +// // VClamp.cpp ends here diff --git a/moose-core/biophysics/VClamp.h b/moose-core/biophysics/VClamp.h index 681e1c71a8b809edb707a76d1b238806d07386e5..09c1e5e183e46ca07c101dfff6da058f596da741 100644 --- a/moose-core/biophysics/VClamp.h +++ b/moose-core/biophysics/VClamp.h @@ -1,41 +1,41 @@ -/* VClamp.h --- - * +/* VClamp.h --- + * * Filename: VClamp.h - * Description: - * Author: - * Maintainer: + * Description: + * Author: + * Maintainer: * Created: Fri Feb 1 19:22:19 2013 (+0530) - * Version: + * Version: * Last-Updated: Wed Feb 6 17:20:48 2013 (+0530) * By: subha * Update #: 55 - * URL: - * Keywords: - * Compatibility: - * + * URL: + * Keywords: + * Compatibility: + * */ -/* Commentary: - * +/* Commentary: + * * Class for implementing voltage clamp - * + * */ /* 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 @@ -72,12 +72,12 @@ namespace moose double getGain() const; void process(const Eref& e, ProcPtr p); void reinit(const Eref& e, ProcPtr p); - + static const Cinfo* initCinfo(); // finfo used to send out injection current to compartment static SrcFinfo1< double >* currentOut(); - + protected: double vIn_; // membrane potential read from the compartment double command_; // command potential @@ -99,7 +99,7 @@ namespace moose double cmdIn_; // older value of command potential double oldCmdIn_; double expt_; - + }; } diff --git a/moose-core/biophysics/VectorTable.cpp b/moose-core/biophysics/VectorTable.cpp index 5ae43f9cd0d6cb2a2cbd84c532b37095b5eb5baa..ef66a92637ff4a35df102765f24d10cf55928569 100644 --- a/moose-core/biophysics/VectorTable.cpp +++ b/moose-core/biophysics/VectorTable.cpp @@ -21,13 +21,13 @@ const Cinfo* VectorTable::initCinfo() static ValueFinfo< VectorTable, unsigned int > xdivs("xdivs", "Number of divisions.", &VectorTable::setDiv, - &VectorTable::getDiv + &VectorTable::getDiv ); static ValueFinfo< VectorTable, double > xmin("xmin", "Minimum value in table.", &VectorTable::setMin, - &VectorTable::getMin + &VectorTable::getMin ); static ValueFinfo< VectorTable, double > xmax("xmax", @@ -47,21 +47,21 @@ const Cinfo* VectorTable::initCinfo() &VectorTable::getTable ); - static ReadOnlyLookupValueFinfo< VectorTable, double, double > + static ReadOnlyLookupValueFinfo< VectorTable, double, double > lookupvalue( "lookupvalue", "Lookup function that performs interpolation to return a value.", &VectorTable::lookupByValue ); - static ReadOnlyLookupValueFinfo< VectorTable, unsigned int, double > + static ReadOnlyLookupValueFinfo< VectorTable, unsigned int, double > lookupindex( "lookupindex", "Lookup function that returns value by index.", &VectorTable::lookupByIndex ); - static Finfo* vectorTableFinfos[] = + static Finfo* vectorTableFinfos[] = { &xdivs, &xmin, @@ -99,8 +99,8 @@ const Cinfo* VectorTable::initCinfo() static const Cinfo* vectorTableCinfo = VectorTable::initCinfo(); -VectorTable::VectorTable() : xDivs_(INIT_XDIV), xMin_(INIT_XMIN), xMax_(INIT_XMAX), - invDx_(-1), table_(0) +VectorTable::VectorTable() : xDivs_(INIT_XDIV), xMin_(INIT_XMIN), xMax_(INIT_XMAX), + invDx_(-1), table_(0) { ; } //Implementation identical to that of HHGate::lookupTable. @@ -109,7 +109,7 @@ double VectorTable::lookupByValue( double x ) const if ( table_.size() == 1 ) return table_[0]; - if ( x < xMin_ || doubleEq( x, xMin_ ) ) + if ( x < xMin_ || doubleEq( x, xMin_ ) ) return table_[0]; if ( x > xMax_ || doubleEq( x, xMax_ ) ) return table_.back(); @@ -128,7 +128,7 @@ double VectorTable::lookupByIndex( unsigned int index ) const * index is unsigned int, can't be less than zero. */ #if 0 - //Applying similar wrapping as is done in lookupByValue. + //Applying similar wrapping as is done in lookupByValue. if ( index < 0 ) index = 0; #endif @@ -149,7 +149,7 @@ vector< double > VectorTable::getTable() const return table_; } -//Function to set up the lookup table. +//Function to set up the lookup table. //All parameters except xMin_ and xMax_ can be set based on the table that is //passed in. void VectorTable::setTable( vector< double > table ) @@ -170,7 +170,7 @@ void VectorTable::setTable( vector< double > table ) table_ = table; xDivs_ = table.size() - 1; - //This is in case the lookup table has only one entry, in which case, + //This is in case the lookup table has only one entry, in which case, //the transition rate being considered is assumed to be constant. if ( table.size() > 1 ) invDx_ = xDivs_ / ( xMax_ - xMin_ ); @@ -227,27 +227,27 @@ istream& operator>>( istream& in, VectorTable& vecTable ) for ( unsigned int i = 0; i < vecTable.table_.size(); ++i ) in >> vecTable.table_[i]; - + return in; } #ifdef DO_UNIT_TESTS void testVectorTable() { - VectorTable unInitedTable; + VectorTable unInitedTable; vector< double > data; - + double arr[11] = {0.0, 0.23, 0.41, 0.46, 0.42, 0.52, 0.49, 0.43, 0.38, 0.43, 0.44}; data.reserve( 11 ); //Filling up user table. - for ( int i = 0; i < 11; i++ ) + for ( int i = 0; i < 11; i++ ) data.push_back( arr[i] ); unInitedTable.setMin( -0.5 ); unInitedTable.setMax( 0.5 ); - unInitedTable.setTable( data ); + unInitedTable.setTable( data ); assert( doubleEq(unInitedTable.getInvDx(), 10 ) ); diff --git a/moose-core/biophysics/VectorTable.h b/moose-core/biophysics/VectorTable.h index 8e54f1dd96bb7c90b403dd24aad9bc07436ce718..9be811657c2c33090bbe4aced3c42d249281e743 100644 --- a/moose-core/biophysics/VectorTable.h +++ b/moose-core/biophysics/VectorTable.h @@ -16,23 +16,23 @@ //functions for getting and setting up the table, along with a lookup function. //This class is to be used while supplying lookup tables to the MarkovChannel //class, in cases where the transition rate varies with either membrane voltage -//or ligand concentration. +//or ligand concentration. -class VectorTable +class VectorTable { - public : + public : VectorTable(); double lookupByValue( double ) const; double lookupByIndex( unsigned int ) const; - //All members except table_ are read-only. Avoids the hassle of recomputing the table when one of the terms are changed. + //All members except table_ are read-only. Avoids the hassle of recomputing the table when one of the terms are changed. vector< double > getTable() const; - //Setting up the lookup table. + //Setting up the lookup table. void setTable( vector< double > ); - unsigned int getDiv() const; + unsigned int getDiv() const; void setDiv( unsigned int ); double getMin() const; void setMin( double ); @@ -44,9 +44,9 @@ class VectorTable static const Cinfo* initCinfo(); - friend istream& operator>>( istream&, VectorTable& ); + friend istream& operator>>( istream&, VectorTable& ); - private : + private : unsigned int xDivs_; double xMin_; double xMax_; diff --git a/moose-core/builtins/Arith.cpp b/moose-core/builtins/Arith.cpp index 1c8bf8751d0410ac6aeb0817c06c7989a39805d0..ae5166bfe2400e0321a614c57804be120bc4b420 100644 --- a/moose-core/builtins/Arith.cpp +++ b/moose-core/builtins/Arith.cpp @@ -12,8 +12,8 @@ #include "Arith.h" static SrcFinfo1< double > *output() { - static SrcFinfo1< double > output( - "output", + static SrcFinfo1< double > output( + "output", "Sends out the computed value" ); return &output; @@ -114,7 +114,7 @@ const Cinfo* Arith::initCinfo() static const Cinfo* arithCinfo = Arith::initCinfo(); Arith::Arith() - : function_( "sum" ), + : function_( "sum" ), output_( 0.0 ), arg1_( 0.0 ), arg2_( 0.0 ), arg3_( 0.0 ) { @@ -128,7 +128,7 @@ void Arith::process( const Eref& e, ProcPtr p ) // cout << "process: " << e.element()->getName() << ", " << e.objId() << arg3_ << ", " << &arg3_ << endl; if ( doReport ) { cout << - e.element()->getName() << ", " << e.objId() << " " << + e.element()->getName() << ", " << e.objId() << " " << arg3_ << " " << &arg3_ << endl; } output()->send( e, output_ ); diff --git a/moose-core/builtins/Arith.h b/moose-core/builtins/Arith.h index 23b57c7cefa2bb03dd543211dd73e5ea3954ce59..1252fd9d1b559edda31cb4e90814a651def93417 100644 --- a/moose-core/builtins/Arith.h +++ b/moose-core/builtins/Arith.h @@ -14,7 +14,7 @@ class Arith friend void testCopyMsgOps(); friend void testTicks(); - public: + public: Arith(); void process( const Eref& e, ProcPtr p ); void reinit( const Eref& e, ProcPtr p ); @@ -23,11 +23,11 @@ class Arith * Inserts an event into the pendingEvents queue for spikes. */ void addSpike( unsigned int synIndex, const double time ); - + //////////////////////////////////////////////////////////////// // Field assignment stuff. //////////////////////////////////////////////////////////////// - + void setFunction( string v ); string getFunction() const; void setOutput( double v ); @@ -39,7 +39,7 @@ class Arith //////////////////////////////////////////////////////////////// // Dest Func //////////////////////////////////////////////////////////////// - + void arg1( double v ); void arg2( double v ); void arg3( double v ); diff --git a/moose-core/builtins/Func.h b/moose-core/builtins/Func.h index c4b810bb9b8d7d27eec594def753564e2ba573f1..9c2ee784f574c88d410e06a3db7352c473b1b35e 100644 --- a/moose-core/builtins/Func.h +++ b/moose-core/builtins/Func.h @@ -1,41 +1,41 @@ -/* Func.h --- - * +/* Func.h --- + * * Filename: Func.h - * Description: A simple function parser and evaluator class for MOOSE. + * Description: A simple function parser and evaluator class for MOOSE. * Author: Subhasis Ray - * Maintainer: + * Maintainer: * Created: Sat May 25 16:14:13 2013 (+0530) - * Version: + * Version: * Last-Updated: Sat Jun 1 19:04:31 2013 (+0530) * By: subha * Update #: 117 - * URL: - * Keywords: - * Compatibility: - * + * URL: + * Keywords: + * Compatibility: + * */ -/* Commentary: - * - * - * +/* 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 @@ -64,14 +64,14 @@ class Func ~Func(); void setExpr(string expr); string getExpr() const; - - + + // get a list of variable identifiers. // this is created by the parser vector<string> getVars() const; void setVarValues(vector< string > vars, vector < double > vals); - + // get/set the value of variable `name` void setVar(string name, double value); double getVar(string name) const; diff --git a/moose-core/builtins/Function.cpp b/moose-core/builtins/Function.cpp index 5f88eb465609d2dc57b2f4a4c06d66f97a5520cc..54224b27fc2a8c0bc3b04fb961cf3a02703f013d 100644 --- a/moose-core/builtins/Function.cpp +++ b/moose-core/builtins/Function.cpp @@ -1,47 +1,47 @@ -// Function.cpp --- -// +// 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: +// Version: // Last-Updated: Tue Jun 11 16:49:01 2013 (+0530) // By: subha // Update #: 619 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// 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: @@ -91,7 +91,7 @@ static SrcFinfo1< vector < double > *> *requestOut() const Cinfo * Function::initCinfo() { //////////////////////////////////////////////////////////// - // Value fields + // Value fields //////////////////////////////////////////////////////////// static ReadOnlyValueFinfo< Function, double > value( "value", @@ -192,7 +192,7 @@ const Cinfo * Function::initCinfo() "Number of variables used by Function.", &Function::setNumVar, &Function::getNumVar); - + static FieldElementFinfo< Function, Variable > inputs( "x", "Input variables to the function. These can be passed via messages.", @@ -207,7 +207,7 @@ const Cinfo * Function::initCinfo() " specifying the function expression.", &Function::setConst, &Function::getConst); - + static ReadOnlyValueFinfo< Function, vector < double > > y( "y", "Variable values received from target fields by requestOut", @@ -233,7 +233,7 @@ const Cinfo * Function::initCinfo() { &process, &reinit }; - + static SharedFinfo proc( "proc", "This is a shared message to receive Process messages " "from the scheduler objects." @@ -268,7 +268,7 @@ const Cinfo * Function::initCinfo() rateOut(), derivativeOut(), }; - + static string doc[] = { "Name", "Function", @@ -299,7 +299,7 @@ const Cinfo * Function::initCinfo() " 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", Neutral::initCinfo(), @@ -309,13 +309,13 @@ const Cinfo * Function::initCinfo() doc, sizeof(doc)/sizeof(string)); return &functionCinfo; - + } static const Cinfo * functionCinfo = Function::initCinfo(); Function::Function(): _t(0.0), _valid(false), _numVar(0), _lastValue(0.0), - _value(0.0), _rate(0.0), _mode(1), + _value(0.0), _rate(0.0), _mode(1), _useTrigger( false ), _stoich(0) { _parser.SetVarFactory(_functionAddVar, this); @@ -339,7 +339,7 @@ void Function::extendMuParser( void ) // 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); - // Add support + // Add support _parser.DefineVar( _T("t"), &this->_t ); _parser.DefineOprt( _T("%"), &Function::muCallbackFMod, 7, mu::EOprtAssociativity::oaRIGHT, 0); } @@ -440,7 +440,7 @@ void Function::_clearBuffer() void Function::_showError(mu::Parser::exception_type &e) const { - cout << "Error occurred in parser.\n" + cout << "Error occurred in parser.\n" << "Message: " << e.GetMsg() << "\n" << "Formula: " << e.GetExpr() << "\n" << "Token: " << e.GetToken() << "\n" @@ -484,7 +484,7 @@ double * _functionAddVar(const char *name, void *data) } function->_numVar = function->_varbuf.size(); } - ret = &(function->_varbuf[index]->value); + ret = &(function->_varbuf[index]->value); } else if (strname[0] == 'y'){ int index = atoi(strname.substr(1).c_str()); if ((unsigned)index >= function->_pullbuf.size()){ @@ -495,7 +495,7 @@ double * _functionAddVar(const char *name, void *data) } } } - ret = function->_pullbuf[index]; + ret = function->_pullbuf[index]; } else if (strname == "t"){ ret = &function->_t; } else { @@ -605,7 +605,7 @@ double Function::getValue() const { double value = 0.0; if (!_valid){ - cout << "Error: Function::getValue() - invalid state" << endl; + cout << "Error: Function::getValue() - invalid state" << endl; return value; } try{ @@ -619,7 +619,7 @@ double Function::getValue() const double Function::getRate() const { if (!_valid){ - cout << "Error: Function::getValue() - invalid state" << endl; + cout << "Error: Function::getValue() - invalid state" << endl; } return _rate; } @@ -645,9 +645,9 @@ vector< double > Function::getY() const double Function::getDerivative() const { - double value = 0.0; + double value = 0.0; if (!_valid){ - cout << "Error: Function::getDerivative() - invalid state" << endl; + cout << "Error: Function::getDerivative() - invalid state" << endl; return value; } mu::varmap_type variables = _parser.GetVar(); @@ -680,7 +680,7 @@ unsigned int Function::getNumVar() const void Function::setVar(unsigned int index, double value) { cout << "varbuf[" << index << "]->setValue(" << value << ")\n"; - if (index < _varbuf.size()){ + if (index < _varbuf.size()){ _varbuf[index]->setValue(value); } else { cerr << "Function: index " << index << " out of bounds." << endl; @@ -726,7 +726,7 @@ void Function::process(const Eref &e, ProcPtr p) for (unsigned int ii = 0; (ii < databuf.size()) && (ii < _pullbuf.size()); ++ii){ - *_pullbuf[ii] = databuf[ii]; + *_pullbuf[ii] = databuf[ii]; } _t = p->currTime; _value = getValue(); @@ -803,5 +803,5 @@ mu::value_type Function::muCallbackFMod( mu::value_type a, mu::value_type b) } #endif -// +// // Function.cpp ends here diff --git a/moose-core/builtins/Function.h b/moose-core/builtins/Function.h index 2a19bfdf6539990552442ca96c89b5ac72490a6c..ed6c4517b65f230ebf73f43544f1d6e681d0da97 100644 --- a/moose-core/builtins/Function.h +++ b/moose-core/builtins/Function.h @@ -1,47 +1,47 @@ -// Function.h --- -// +// Function.h --- +// // Filename: Function.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Fri May 30 19:34:13 2014 (+0530) -// Version: -// Last-Updated: -// By: +// Version: +// Last-Updated: +// By: // Update #: 0 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// +// 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: @@ -67,14 +67,14 @@ class Function virtual void innerSetExpr( const Eref& e, string expr); 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; void setVarValues(vector< string > vars, vector < double > vals); - + // get/set the value of variable `name` void setVar(unsigned int index, double value); Variable * getVar(unsigned int ii); @@ -159,5 +159,5 @@ protected: #endif -// -//// Function.h ends here_parser.DefineVar( _T("t"), +// +//// Function.h ends here_parser.DefineVar( _T("t"), diff --git a/moose-core/builtins/Group.cpp b/moose-core/builtins/Group.cpp index 51a8da00ab434ef23247c03313d0dd73bb7d44c4..2a0db02ffe9e24a89e3e4da7d1ddbb0b3a2f1fd9 100644 --- a/moose-core/builtins/Group.cpp +++ b/moose-core/builtins/Group.cpp @@ -15,8 +15,8 @@ // MsgSrc Definitions ////////////////////////////////////////////////////////////// static SrcFinfo0 *group() { - static SrcFinfo0 group( - "group", + static SrcFinfo0 group( + "group", "Handle for grouping Elements" ); return &group; diff --git a/moose-core/builtins/Group.h b/moose-core/builtins/Group.h index 7447562526cefbc57321e428ccb2c5861a7b164d..1a6e4539b9fd3cd8262f5b62659d6f842642bc1c 100644 --- a/moose-core/builtins/Group.h +++ b/moose-core/builtins/Group.h @@ -11,7 +11,7 @@ class Group { - public: + public: Group(); static const Cinfo* initCinfo(); private: diff --git a/moose-core/builtins/HDF5DataWriter.cpp b/moose-core/builtins/HDF5DataWriter.cpp index 27873adea757a5d64be9dc36b1f69aa7cbb3d982..72e43af9ed9b9bc5037db4ec78a3c671585b4539 100644 --- a/moose-core/builtins/HDF5DataWriter.cpp +++ b/moose-core/builtins/HDF5DataWriter.cpp @@ -1,7 +1,7 @@ -// HDF5DataWriter.cpp --- -// +// HDF5DataWriter.cpp --- +// // Filename: HDF5DataWriter.cpp -// Description: +// Description: // Author: Subhasis Ray // Maintainer: Dilawar Singh // Created: Sat Feb 25 16:03:59 2012 (+0530) @@ -43,7 +43,7 @@ const Cinfo * HDF5DataWriter::initCinfo() static Finfo * processShared[] = { &process, &reinit }; - + static SharedFinfo proc( "proc", "Shared message to receive process and reinit", @@ -62,7 +62,7 @@ const Cinfo * HDF5DataWriter::initCinfo() &proc, }; - + static string doc[] = { "Name", "HDF5DataWriter", @@ -137,19 +137,19 @@ void HDF5DataWriter::flush() "Filehandle invalid. Cannot write data." << endl; return; } - + for (unsigned int ii = 0; ii < datasets_.size(); ++ii){ herr_t status = appendToDataset(datasets_[ii], data_[ii]); data_[ii].clear(); if (status < 0){ cerr << "Warning: appending data for object " << src_[ii] - << " returned status " << status << endl; - } + << " returned status " << status << endl; + } } HDF5WriterBase::flush(); H5Fflush(filehandle_, H5F_SCOPE_LOCAL); } - + /** Write data to datasets in HDF5 file. Clear all data in the table objects associated with this object. */ @@ -158,7 +158,7 @@ void HDF5DataWriter::process(const Eref & e, ProcPtr p) if (filehandle_ < 0){ return; } - + vector <double> dataBuf; requestOut()->send(e, &dataBuf); for (unsigned int ii = 0; ii < dataBuf.size(); ++ii){ @@ -172,7 +172,7 @@ void HDF5DataWriter::process(const Eref & e, ProcPtr p) data_[ii].clear(); if (status < 0){ cerr << "Warning: appending data for object " << src_[ii] - << " returned status " << status << endl; + << " returned status " << status << endl; } } } @@ -255,7 +255,7 @@ hid_t HDF5DataWriter::getDataset(string path) // If that fails, try to create a group id = H5Gcreate2(prev_id, pathTokens[ii].c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - } + } if ((exists < 0) || (id < 0)){ // Failed to open/create a group, print the // offending path (for debugging; the error is @@ -265,7 +265,7 @@ hid_t HDF5DataWriter::getDataset(string path) cerr << "/" << pathTokens[jj]; } cerr << endl; - prev_id = -1; + prev_id = -1; } if (prev_id >= 0 && prev_id != filehandle_){ // Successfully opened/created new group, close the old group @@ -298,7 +298,7 @@ unsigned int HDF5DataWriter::getFlushLimit() const { return flushLimit_; } - + #endif // USE_HDF5 -// +// // HDF5DataWriter.cpp ends here diff --git a/moose-core/builtins/HDF5DataWriter.h b/moose-core/builtins/HDF5DataWriter.h index 8cad9910a4df1bd9122fcfc23823115a20e0e4c2..46d0a83f01e1539c1085255efe45ce1f5ac497af 100644 --- a/moose-core/builtins/HDF5DataWriter.h +++ b/moose-core/builtins/HDF5DataWriter.h @@ -1,31 +1,31 @@ -// HDF5DataWriter.h --- -// +// HDF5DataWriter.h --- +// // Filename: HDF5DataWriter.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Sat Feb 25 15:47:23 2012 (+0530) -// Version: +// Version: // Last-Updated: Sun Dec 20 23:17:22 2015 (-0500) // By: subha // Update #: 45 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// +// Commentary: +// // Specialization of HDF5WriterBase to collect and save data from // moose model. The data is appended to an existing dataset at each // process step. An explicit writing is also allowed via the flush // command. As soon as the data from a table is written to file, the // table is cleared. -// +// // Change log: -// +// // 2012-02-25 15:50:03 (+0530) Subha - started coding this class // // Thu Jul 31 16:56:47 IST 2014 Subha - updating to use new API on @@ -66,5 +66,5 @@ class HDF5DataWriter: public HDF5WriterBase #endif // _HDF5DATAWRITER_H #endif // USE_HDF5 -// +// // HDF5DataWriter.h ends here diff --git a/moose-core/builtins/HDF5WriterBase.cpp b/moose-core/builtins/HDF5WriterBase.cpp index 4cc1570f6cd953d6bfc7edf1dd1239e9f7e59bd1..80c47cbe0dcdb371170ed11a4b9db4b1412c3f46 100644 --- a/moose-core/builtins/HDF5WriterBase.cpp +++ b/moose-core/builtins/HDF5WriterBase.cpp @@ -1,30 +1,30 @@ -// HDF5WriterBase.cpp --- -// +// HDF5WriterBase.cpp --- +// // Filename: HDF5WriterBase.cpp -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Sat Feb 25 14:42:03 2012 (+0530) -// Version: +// Version: // Last-Updated: Sun Dec 20 23:20:44 2015 (-0500) // By: subha // Update #: 298 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// +// +// +// // Change log: -// -// -// +// +// +// // Code: @@ -65,7 +65,7 @@ hid_t require_attribute(hid_t file_id, string path, node_path = path.substr(0, attr_start); attr_start += 1; } - attr_name = path.substr(attr_start); + attr_name = path.substr(attr_start); if (H5Aexists_by_name(file_id, node_path.c_str(), attr_name.c_str(), H5P_DEFAULT)){ return H5Aopen_by_name(file_id, node_path.c_str(), attr_name.c_str(), @@ -74,7 +74,7 @@ hid_t require_attribute(hid_t file_id, string path, return H5Acreate_by_name(file_id, node_path.c_str(), attr_name.c_str(), data_type, data_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - } + } } /** @@ -131,7 +131,7 @@ hid_t HDF5WriterBase::createDoubleDataset(hid_t parent_id, std::string name, hsi status = H5Pset_szip(chunk_params, sz_opt_mask, HDF5WriterBase::CHUNK_SIZE); } - hid_t dataspace = H5Screate_simple(1, dims, maxdims); + hid_t dataspace = H5Screate_simple(1, dims, maxdims); hid_t dataset_id = H5Dcreate2(parent_id, name.c_str(), H5T_NATIVE_DOUBLE, dataspace, H5P_DEFAULT, chunk_params, H5P_DEFAULT); @@ -165,13 +165,13 @@ hid_t HDF5WriterBase::createStringDataset(hid_t parent_id, string name, hsize_t status = H5Pset_szip(chunk_params, sz_opt_mask, HDF5WriterBase::CHUNK_SIZE); } - hid_t dataspace = H5Screate_simple(1, dims, maxdims); + hid_t dataspace = H5Screate_simple(1, dims, maxdims); hid_t dataset_id = H5Dcreate2(parent_id, name.c_str(), ftype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Sclose(dataspace); H5Tclose(ftype); - H5Pclose(chunk_params); + H5Pclose(chunk_params); return dataset_id; } @@ -217,7 +217,7 @@ hid_t HDF5WriterBase::createDataset2D(hid_t parent, string name, unsigned int ro { if (parent < 0){ return 0; - } + } herr_t status; // we need chunking here to allow extensibility hsize_t chunkdims[] = {rows, chunkSize_}; @@ -258,7 +258,7 @@ herr_t writeScalarAttributesFromMap(hid_t file_id, map < string, A > path_value_ return status; } } - return 0; + return 0; } /** @@ -278,7 +278,7 @@ herr_t writeVectorAttributesFromMap(hid_t file_id, map < string, vector < A > > return status; } } - return 0; + return 0; } //////////////////////////////////////////////////////////////////// @@ -287,7 +287,7 @@ herr_t writeVectorAttributesFromMap(hid_t file_id, map < string, vector < A > > template <> herr_t writeScalarAttr(hid_t file_id, string path, string value) { - hid_t data_id = H5Screate(H5S_SCALAR); + hid_t data_id = H5Screate(H5S_SCALAR); hid_t dtype = H5Tcopy(H5T_C_S1); H5Tset_size(dtype, value.length()+1); const char * data = value.c_str(); @@ -300,10 +300,10 @@ herr_t writeScalarAttr(hid_t file_id, string path, string value) template <> herr_t writeScalarAttr(hid_t file_id, string path, double value) { - hid_t data_id = H5Screate(H5S_SCALAR); + hid_t data_id = H5Screate(H5S_SCALAR); hid_t dtype = H5T_NATIVE_DOUBLE; hid_t attr_id = require_attribute(file_id, path, dtype, data_id); - herr_t status = H5Awrite(attr_id, dtype, (void*)(&value)); + herr_t status = H5Awrite(attr_id, dtype, (void*)(&value)); H5Aclose(attr_id); return status; } @@ -311,7 +311,7 @@ herr_t writeScalarAttr(hid_t file_id, string path, double value) template <> herr_t writeScalarAttr(hid_t file_id, string path, long value) { - hid_t data_id = H5Screate(H5S_SCALAR); + hid_t data_id = H5Screate(H5S_SCALAR); hid_t dtype = H5T_NATIVE_LONG; hid_t attr_id = require_attribute(file_id, path, dtype, data_id); herr_t status = H5Awrite(attr_id, dtype, (void*)(&value)); @@ -322,7 +322,7 @@ herr_t writeScalarAttr(hid_t file_id, string path, long value) template <> herr_t writeScalarAttr(hid_t file_id, string path, int value) { - hid_t data_id = H5Screate(H5S_SCALAR); + hid_t data_id = H5Screate(H5S_SCALAR); hid_t dtype = H5T_NATIVE_INT; hid_t attr_id = require_attribute(file_id, path, dtype, data_id); herr_t status = H5Awrite(attr_id, dtype, (void*)(&value)); @@ -340,7 +340,7 @@ herr_t writeVectorAttr(hid_t file_id, string path, vector < string > value) hsize_t dims[] = {value.size()}; hid_t space = H5Screate_simple(1, dims, NULL); hid_t dtype = H5Tcopy(H5T_C_S1); - H5Tset_size(dtype, H5T_VARIABLE); + H5Tset_size(dtype, H5T_VARIABLE); const char ** data = (const char **)calloc(value.size(), sizeof(const char*)); for (unsigned int ii = 0; ii < value.size(); ++ii){ @@ -357,7 +357,7 @@ template <> herr_t writeVectorAttr(hid_t file_id, string path, vector < double > value) { hsize_t dims[] = {value.size()}; - hid_t data_id = H5Screate_simple(1, dims, NULL); + hid_t data_id = H5Screate_simple(1, dims, NULL); hid_t dtype = H5T_NATIVE_DOUBLE; H5Tset_size(dtype, value.size()); void * data = &value[0]; @@ -371,7 +371,7 @@ template <> herr_t writeVectorAttr(hid_t file_id, string path, vector < long > value) { hsize_t dims[] = {value.size()}; - hid_t data_id = H5Screate_simple(1, dims, NULL); + hid_t data_id = H5Screate_simple(1, dims, NULL); hid_t dtype = H5T_NATIVE_LONG; H5Tset_size(dtype, value.size()); void * data = &value[0]; @@ -394,7 +394,7 @@ const Cinfo* HDF5WriterBase::initCinfo() "Name of the file associated with this HDF5 writer object.", &HDF5WriterBase::setFilename, &HDF5WriterBase::getFilename); - + static ReadOnlyValueFinfo < HDF5WriterBase, bool > isOpen( "isOpen", "True if this object has an open file handle.", @@ -419,7 +419,7 @@ const Cinfo* HDF5WriterBase::initCinfo() "Compression type for array data. zlib and szip are supported. Defaults to zlib.", &HDF5WriterBase::setCompressor, &HDF5WriterBase::getCompressor); - + static ValueFinfo< HDF5WriterBase, unsigned int> compression( "compression", "Compression level for array data. Defaults to 6.", @@ -432,34 +432,34 @@ const Cinfo* HDF5WriterBase::initCinfo() " (string).", &HDF5WriterBase::setStringAttr, &HDF5WriterBase::getStringAttr); - + static LookupValueFinfo< HDF5WriterBase, string, double > dattr( "doubleAttr", "Double precision floating point attributes. The key is attribute name," " value is attribute value (double).", &HDF5WriterBase::setDoubleAttr, &HDF5WriterBase::getDoubleAttr); - + static LookupValueFinfo< HDF5WriterBase, string, long > lattr( "longAttr", "Long integer attributes. The key is attribute name, value is attribute" " value (long).", &HDF5WriterBase::setLongAttr, &HDF5WriterBase::getLongAttr); - + static LookupValueFinfo< HDF5WriterBase, string, vector < string > > svecattr( "stringVecAttr", "String vector attributes. The key is attribute name, value is attribute value (string).", &HDF5WriterBase::setStringVecAttr, &HDF5WriterBase::getStringVecAttr); - + static LookupValueFinfo< HDF5WriterBase, string, vector < double > > dvecattr( "doubleVecAttr", "Double vector attributes. The key is attribute name, value is" " attribute value (vector of double).", &HDF5WriterBase::setDoubleVecAttr, &HDF5WriterBase::getDoubleVecAttr); - + static LookupValueFinfo< HDF5WriterBase, string, vector < long > > lvecattr( "longVecAttr", "Long integer vector attributes. The key is attribute name, value is" @@ -475,7 +475,7 @@ const Cinfo* HDF5WriterBase::initCinfo() "close", "Close the underlying file. This is a safety measure so that file is not in an invalid state even if a crash happens at exit.", new OpFunc0< HDF5WriterBase > ( & HDF5WriterBase::close )); - + static Finfo * finfos[] = { &fileName, @@ -511,7 +511,7 @@ const Cinfo* HDF5WriterBase::initCinfo() sizeof(finfos)/sizeof(Finfo*), &dinfo, doc, sizeof(doc)/sizeof(string)); - return &hdf5Cinfo; + return &hdf5Cinfo; } const hssize_t HDF5WriterBase::CHUNK_SIZE = 1024; // default chunk size @@ -538,7 +538,7 @@ void HDF5WriterBase::setFilename(string filename) if (filename_ == filename){ return; } - + // // If file is open, close it before changing filename // if (filehandle_ >= 0){ // status = H5Fclose(filehandle_); @@ -574,7 +574,7 @@ herr_t HDF5WriterBase::openFile() } } hid_t fapl_id = H5Pcreate(H5P_FILE_ACCESS); - // Ensure that all open objects are closed before the file is closed + // Ensure that all open objects are closed before the file is closed H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG); ifstream infile(filename_.c_str()); bool fexists = infile.good(); @@ -640,7 +640,7 @@ unsigned int HDF5WriterBase::getCompression() const return compression_; } - + // Subclasses should reimplement this for flushing data content to // file. void HDF5WriterBase::flush() @@ -658,7 +658,7 @@ void HDF5WriterBase::flushAttributes() { if (filehandle_ < 0){ return; - } + } // Write all scalar attributes writeScalarAttributesFromMap< string >(filehandle_, sattr_); writeScalarAttributesFromMap< double >(filehandle_, dattr_); @@ -780,5 +780,5 @@ vector < long > HDF5WriterBase::getLongVecAttr(string name) const #endif // USE_HDF5 -// +// // HDF5WriterBase.cpp ends here diff --git a/moose-core/builtins/HDF5WriterBase.h b/moose-core/builtins/HDF5WriterBase.h index ef1e3b16937b2ca1c9a95b5bc4cedfa3c3b28816..a7cbd59d788b49b8a41dd36bee647b017b0a2a90 100644 --- a/moose-core/builtins/HDF5WriterBase.h +++ b/moose-core/builtins/HDF5WriterBase.h @@ -1,30 +1,30 @@ -// HDF5WriterBase.h --- -// +// HDF5WriterBase.h --- +// // Filename: HDF5WriterBase.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Sat Feb 25 14:39:19 2012 (+0530) -// Version: +// Version: // Last-Updated: Tue Aug 25 23:11:28 2015 (-0400) // By: subha // Update #: 57 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// // HDF5WriterBase provides a common interface for writing data/model to file. -// -// +// +// // Change log: -// +// // 2012-02-25 14:39:36 (+0530) subha - started initial implementation -// +// // Code: @@ -60,32 +60,32 @@ class HDF5WriterBase void setLongAttr(string name, long value); string getStringAttr(string name) const; double getDoubleAttr(string name) const; - long getLongAttr(string name) const; + long getLongAttr(string name) const; void setStringVecAttr(string name, vector < string > value); void setDoubleVecAttr(string name, vector < double > value); void setLongVecAttr(string name, vector < long > value); vector < string > getStringVecAttr(string name) const; vector < double > getDoubleVecAttr(string name) const; - vector < long > getLongVecAttr(string name) const; + vector < long > getLongVecAttr(string name) const; virtual void flushAttributes(); virtual void flush(); virtual void close(); - + static const Cinfo* initCinfo(); - + protected: friend void testCreateStringDataset(); - + herr_t openFile(); // C++ sucks - does not allow template specialization inside class hid_t createDoubleDataset(hid_t parent, std::string name, hsize_t size=0, hsize_t maxsize=H5S_UNLIMITED); hid_t createStringDataset(hid_t parent, std::string name, hsize_t size=0, hsize_t maxsize=H5S_UNLIMITED); - + herr_t appendToDataset(hid_t dataset, const vector<double>& data); hid_t createDataset2D(hid_t parent, string name, unsigned int rows); - + /// map from element path to nodes in hdf5file. Multiple MOOSE /// tables can be written to the single file corresponding to a /// HDF5Writer. Each one will be represented by a specific data @@ -135,5 +135,5 @@ template <typename A> herr_t writeVectorAttr(hid_t file_id, string path, -// +// // HDF5WriterBase.h ends here diff --git a/moose-core/builtins/InputVariable.cpp b/moose-core/builtins/InputVariable.cpp index 50796cd863857a5dcc82119873cd06dbe90f8690..b1d47d63a0f6111e32c28f337af93146b5435656 100644 --- a/moose-core/builtins/InputVariable.cpp +++ b/moose-core/builtins/InputVariable.cpp @@ -1,47 +1,47 @@ -// InputVariable.cpp --- -// +// InputVariable.cpp --- +// // Filename: InputVariable.cpp -// Description: +// Description: // Author: subha -// Maintainer: +// Maintainer: // Created: Fri Jun 26 07:21:56 2015 (-0400) -// Version: +// Version: // Last-Updated: Thu Jul 23 08:54:24 2015 (-0400) // By: subha // Update #: 2 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// 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: @@ -76,7 +76,7 @@ const Cinfo * InputVariable::initCinfo() doc, sizeof(doc)/sizeof(string), true); - return &inputVariableCinfo; + return &inputVariableCinfo; } static const Cinfo *InputVariableCinfo = InputVariable::initCinfo(); @@ -104,5 +104,5 @@ void InputVariable::epSetValue( const Eref& eref, double value) } #endif -// +// // InputVariable.cpp ends here diff --git a/moose-core/builtins/InputVariable.h b/moose-core/builtins/InputVariable.h index 163151da1a5f3672c054b534e068a1a508ce64fd..552973e2755e7d7b9b04999794ec353d40371b6b 100644 --- a/moose-core/builtins/InputVariable.h +++ b/moose-core/builtins/InputVariable.h @@ -1,41 +1,41 @@ -/* InputVariable.h --- - * +/* InputVariable.h --- + * * Filename: InputVariable.h - * Description: + * Description: * Author: subha - * Maintainer: + * Maintainer: * Created: Fri Jun 26 06:36:11 2015 (-0400) - * Version: + * Version: * Last-Updated: Thu Jul 23 08:54:57 2015 (-0400) * By: subha * Update #: 1 - * URL: - * Keywords: - * Compatibility: - * + * URL: + * Keywords: + * Compatibility: + * */ -/* Commentary: - * - * - * +/* 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 diff --git a/moose-core/builtins/Interpol.cpp b/moose-core/builtins/Interpol.cpp index 7f9bec1d6d848b729dfaa9149bc62cd2d0fa2e94..ee84e447bbf942f0f8756dabf3074111fa1de26d 100644 --- a/moose-core/builtins/Interpol.cpp +++ b/moose-core/builtins/Interpol.cpp @@ -1,49 +1,49 @@ -// Interpol.cpp --- -// +// Interpol.cpp --- +// // Filename: Interpol.cpp -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Wed Jun 25 15:25:24 2014 (+0530) -// Version: -// Last-Updated: -// By: +// Version: +// Last-Updated: +// By: // Update #: 0 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// 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. -// -// +// +// -// +// #include "header.h" #include "../utility/numutil.h" @@ -159,7 +159,7 @@ void Interpol::setXmin(double value) if (almostEqual(value, xmax_)){ cerr << "Error: Interpol::setXmin: Xmin ~= Xmax : Assignment failed\n"; return; - } + } xmin_ = value; } @@ -173,7 +173,7 @@ void Interpol::setXmax(double value) if (almostEqual(value, xmin_)){ cerr << "Error: Interpol::setXmax: Xmin ~= Xmax : Assignment failed\n"; return; - } + } xmax_ = value; } @@ -203,7 +203,7 @@ void Interpol::reinit( const Eref& e, ProcPtr p ) } ////////////////////////////////////////////////////////////// -// Used to handle direct messages into the interpol, or +// Used to handle direct messages into the interpol, or // returned plot data from queried objects. ////////////////////////////////////////////////////////////// void Interpol::handleInput( double v ) @@ -211,5 +211,5 @@ void Interpol::handleInput( double v ) x_ = v; } -// +// // Interpol.cpp ends here diff --git a/moose-core/builtins/Interpol.h b/moose-core/builtins/Interpol.h index 52ba8ea92b906bab8b5a0ee6539273d05175d09c..51c98c8d9ae1da5863e7de7ffdd6686666401b5b 100644 --- a/moose-core/builtins/Interpol.h +++ b/moose-core/builtins/Interpol.h @@ -1,47 +1,47 @@ -// Interpol.h --- -// +// Interpol.h --- +// // Filename: Interpol.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Wed Jun 25 15:13:52 2014 (+0530) -// Version: -// Last-Updated: -// By: +// Version: +// Last-Updated: +// By: // Update #: 0 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// -// -// -// +// 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: @@ -58,7 +58,7 @@ class Interpol: public TableBase public: Interpol(); Interpol(double xmin, double xmax); - + //////////////////////////////////////////////////////////// // Here are the interface functions for the MOOSE class //////////////////////////////////////////////////////////// @@ -73,14 +73,14 @@ class Interpol: public TableBase void handleInput(double x); void process( const Eref& e, ProcPtr p ); void reinit( const Eref& e, ProcPtr p ); - - + + static const Cinfo* initCinfo(); static const unsigned int MAX_DIVS; protected: double x_; double xmin_; - double xmax_; + double xmax_; double y_; }; @@ -88,5 +88,5 @@ class Interpol: public TableBase #endif // _INTERPOL_H -// +// // Interpol.h ends here diff --git a/moose-core/builtins/Interpol2D.cpp b/moose-core/builtins/Interpol2D.cpp index b2e82e2b8c5d7301e0d6ad5de2fbbeb154dfb77c..de5b6a6d7e84ab701ab9a32fe0e3a531ef09de54 100644 --- a/moose-core/builtins/Interpol2D.cpp +++ b/moose-core/builtins/Interpol2D.cpp @@ -28,7 +28,7 @@ const Cinfo* Interpol2D::initCinfo() // Shared message definitions /////////////////////////////////////////////////////// - static DestFinfo lookup( "lookup", + static DestFinfo lookup( "lookup", "Looks up table value based on indices v1 and v2, and sends" "value back using the 'lookupOut' message", new EpFunc2< Interpol2D, double, double >( &Interpol2D::lookupReturn ) @@ -44,7 +44,7 @@ const Cinfo* Interpol2D::initCinfo() "Sends back a double with the looked-up z value.", lookupReturnShared, sizeof( lookupReturnShared ) / sizeof( Finfo * ) ); - + /////////////////////////////////////////////////////// // Field definitions /////////////////////////////////////////////////////// @@ -88,12 +88,12 @@ const Cinfo* Interpol2D::initCinfo() &Interpol2D::setDy, &Interpol2D::getDy ); - static LookupValueFinfo< Interpol2D, vector< unsigned int >, double > + static LookupValueFinfo< Interpol2D, vector< unsigned int >, double > table( "table", "Lookup an entry on the table", &Interpol2D::setTableValue, &Interpol2D::getTableValue - ); + ); static ValueFinfo< Interpol2D, vector< vector< double > > > tableVector2D( "tableVector2D", "Get the entire table.", @@ -139,7 +139,7 @@ const Cinfo* Interpol2D::initCinfo() "Returns 'z' value based on given 'x' and 'y' values. " "Can either use interpolation or roundoff to the nearest index.", }; - + static Dinfo< Interpol2D > dinfo; static Cinfo interpol2DCinfo( "Interpol2D", @@ -183,7 +183,7 @@ Interpol2D::Interpol2D( invDx_ = xdivs / ( xmax_ - xmin_); else invDx_ = 1.0; - + if ( !doubleEq( ymax_, ymin ) ) invDy_ = ydivs / ( ymax_ - ymin_); else @@ -267,7 +267,7 @@ unsigned int Interpol2D::getXdivs( ) const { void Interpol2D::setDx( double value ) { if ( !doubleEq( value, 0.0 ) ) { - unsigned int xdivs = static_cast< unsigned int >( + unsigned int xdivs = static_cast< unsigned int >( 0.5 + fabs( xmax_ - xmin_ ) / value ); if ( xdivs < 1 || xdivs > MAX_DIVS ) { cerr << @@ -335,7 +335,7 @@ unsigned int Interpol2D::getYdivs( ) const { */ void Interpol2D::setDy( double value ) { if ( !doubleEq( value, 0.0 ) ) { - unsigned int ydivs = static_cast< unsigned int >( + unsigned int ydivs = static_cast< unsigned int >( 0.5 + fabs( ymax_ - ymin_ ) / value ); if ( ydivs < 1 || ydivs > MAX_DIVS ) { cerr << @@ -343,7 +343,7 @@ void Interpol2D::setDy( double value ) { ydivs + 1 << " entries in table.\n"; return; } - + setYdivs( ydivs ); invDy_ = ydivs / ( ymax_ - ymin_ ); } @@ -356,7 +356,7 @@ double Interpol2D::getDy() const { return ( ymax_ - ymin_ ) / ydivs(); } -double Interpol2D::getSy() const +double Interpol2D::getSy() const { return sy_; } @@ -386,7 +386,7 @@ void Interpol2D::setTableValue( vector< unsigned int > index, double value ) assert( index.size() == 2 ); unsigned int i0 = index[ 0 ]; unsigned int i1 = index[ 1 ]; - + if ( i0 < table_.size() && i1 < table_[ 0 ].size() ) table_[ i0 ][ i1 ] = value; else @@ -397,14 +397,14 @@ void Interpol2D::setTableValue( vector< unsigned int > index, double value ) //Modified by Vishaka Datta S, 2011, NCBS. //When a single index is out of bounds, the last element along that //respective dimension is returned. -//Modification was needed for the MarkovSolver base class. +//Modification was needed for the MarkovSolver base class. /////////////// double Interpol2D::getTableValue( vector< unsigned int > index ) const { assert( index.size() == 2 ); unsigned int i0 = index[ 0 ]; unsigned int i1 = index[ 1 ]; - + //Above-said modifications. if ( i0 >= table_.size() ) i0 = table_.size() - 1; @@ -417,7 +417,7 @@ double Interpol2D::getTableValue( vector< unsigned int > index ) const // This sets the whole thing up: values, xdivs, dx and so on. Only xmin // and xmax are unknown to the input vector. -void Interpol2D::setTableVector( vector< vector< double > > value ) +void Interpol2D::setTableVector( vector< vector< double > > value ) { table_ = value; invDx_ = xdivs() / ( xmax_ - xmin_ ); @@ -464,7 +464,7 @@ double Interpol2D::getInterpolatedValue(vector <double> xy) const } return interpolate(x, y); } - + //////////////////////////////////////////////////////////////////// // Here we set up Interpol2D Destination functions //////////////////////////////////////////////////////////////////// @@ -489,13 +489,13 @@ void Interpol2D::lookupReturn( const Eref& e, double v1, double v2 ) double Interpol2D::indexWithoutCheck( double x, double y ) const { assert( table_.size() > 1 ); - + unsigned long xInteger = static_cast< unsigned long >( ( x - xmin_ ) * invDx_ ); assert( xInteger < table_.size() ); - + unsigned long yInteger = static_cast< unsigned long >( ( y - ymin_ ) * invDy_ ); assert( yInteger < table_[ 0 ].size() ); - + return table_[ xInteger ][ yInteger ]; } @@ -503,7 +503,7 @@ double Interpol2D::indexWithoutCheck( double x, double y ) const * Performs bi-linear interpolation. * * Modified by Vishaka Datta S, 2011, NCBS. - * Interpolation now performs bounds checking. + * Interpolation now performs bounds checking. */ double Interpol2D::interpolate( double x, double y ) const { @@ -511,7 +511,7 @@ double Interpol2D::interpolate( double x, double y ) const bool isEndOfY = false; double z00=0.0, z01=0.0, z10=0.0, z11=0.0; assert( table_.size() > 1 ); - + double xv = ( x - xmin_ ) * invDx_; unsigned long xInteger = static_cast< unsigned long >(xv); if (xInteger >= table_.size()){ @@ -520,7 +520,7 @@ double Interpol2D::interpolate( double x, double y ) const if (xInteger == table_.size() - 1){ isEndOfX = true; } - + assert(xInteger >= 0); double xFraction = xv - xInteger; double yv = ( y - ymin_ ) * invDy_; @@ -539,7 +539,7 @@ double Interpol2D::interpolate( double x, double y ) const // vector< vector< double > >::const_iterator iz0 = table_.begin() + xInteger; // vector< double >::const_iterator iz00 = iz0->begin() + yInteger; // vector< double >::const_iterator iz10; - + /* The following is the same as: double z00 = table_[ xInteger ][ yInteger ]; double z01 = table_[ xInteger ][ yInteger + 1 ]; @@ -547,7 +547,7 @@ double Interpol2D::interpolate( double x, double y ) const double z11 = table_[ xInteger + 1 ][ yInteger + 1 ]; */ z00 = table_[xInteger][yInteger]; - if (!isEndOfX){ + if (!isEndOfX){ z10 = table_[xInteger+1][yInteger]; if (!isEndOfY){ z11 = table_[xInteger+1][yInteger+1]; @@ -575,7 +575,7 @@ double Interpol2D::innerLookup( double x, double y ) const { if ( table_.size() == 0 ) return 0.0; - + if ( x < xmin_ ) { x = xmin_; } @@ -605,10 +605,10 @@ bool Interpol2D::operator<( const Interpol2D& other ) const { if ( table_.size() < other.table_.size() ) return 1; - + if ( table_.size() > other.table_.size() ) return 0; - + for ( size_t i = 0; i < table_.size(); i++ ) { for ( size_t j = 0; j < table_[ i ].size(); j++ ) { if ( table_[ i ][ j ] < other.table_[ i ][ j ] ) @@ -617,7 +617,7 @@ bool Interpol2D::operator<( const Interpol2D& other ) const return 0; } } - + return 0; } @@ -627,7 +627,7 @@ bool Interpol2D::operator<( const Interpol2D& other ) const //class to pull off its pointer typecasting kung fu. istream& operator>>( istream& in, Interpol2D& int2dTable ) { - in >> int2dTable.xmin_; + in >> int2dTable.xmin_; in >> int2dTable.xmax_; in >> int2dTable.invDx_; in >> int2dTable.ymin_; @@ -646,11 +646,11 @@ istream& operator>>( istream& in, Interpol2D& int2dTable ) // This sets the whole thing up: values, xdivs, dx and so on. Only xmin // and xmax are unknown to the input vector. void Interpol2D::appendTableVector( - const vector< vector< double > >& value ) + const vector< vector< double > >& value ) { if ( value.empty() ) return; - + unsigned int ysize = value[ 0 ].size(); vector< vector< double > >::const_iterator i; for ( i = value.begin() + 1; i != value.end(); i++ ) @@ -658,21 +658,21 @@ void Interpol2D::appendTableVector( ysize = ~0u; break; } - + if ( ysize == ~0u ) { cerr << "Error: Interpol2D::localAppendTableVector: All rows should have a " "uniform width. Not changing anything.\n"; return; } - + if ( ! table_.empty() && ysize != table_[ 0 ].size() ) { cerr << "Error: Interpol2D: localAppendTableVector: Table widths must match. " "Not changing anything.\n"; return; } - + table_.insert( table_.end(), value.begin(), value.end() ); invDx_ = xdivs() / ( xmax_ - xmin_ ); } @@ -684,7 +684,7 @@ void Interpol2D::print( const string& fname, bool appendFlag ) const fout.open( fname.c_str(), std::ios::app ); else fout.open( fname.c_str(), std::ios::trunc ); - + vector< vector< double > >::const_iterator i; vector< double >::const_iterator j; for ( i = table_.begin(); i != table_.end(); i++ ) { @@ -692,7 +692,7 @@ void Interpol2D::print( const string& fname, bool appendFlag ) const fout << *j << "\t"; fout << "\n"; } - + fout.close(); } @@ -705,7 +705,7 @@ void Interpol2D::load( const string& fname, unsigned int skiplines ) fname << "'. " << "'xdivs' and 'ydivs' need not be specified. If you have set these fields, " "then they will be overridden while loading.\n"; - + vector< double >::iterator i; std::ifstream fin( fname.c_str() ); string line; @@ -721,19 +721,19 @@ void Interpol2D::load( const string& fname, unsigned int skiplines ) } if ( !fin.good() ) return; - + table_.clear( ); unsigned int lastWidth = ~0u; double y; while( fin.good() ) { table_.resize( table_.size() + 1 ); - + getline( fin, line ); line = moose::trim(line); istringstream sstream( line ); while( sstream >> y ) table_.back().push_back( y ); - + /* * In case the last line of a file is blank. */ @@ -741,7 +741,7 @@ void Interpol2D::load( const string& fname, unsigned int skiplines ) table_.pop_back(); break; } - + if ( lastWidth != ~0u && table_.back().size() != lastWidth ) { @@ -752,14 +752,14 @@ void Interpol2D::load( const string& fname, unsigned int skiplines ) table_.clear(); return; } - + lastWidth = table_.back().size(); } - + invDx_ = xdivs() / ( xmax_ - xmin_ ); invDy_ = ydivs() / ( ymax_ - ymin_ ); } else { - cerr << "Error: Interpol2D::innerLoad: Failed to open file " << + cerr << "Error: Interpol2D::innerLoad: Failed to open file " << fname << endl; } } @@ -800,7 +800,7 @@ void testInterpol2D() set< double >( i2, "xmin", 0 ); set< double >( i2, "xmax", 10000.0 ); - // Here we use i2 as a dummy dest for the + // Here we use i2 as a dummy dest for the // lookup operation, which takes place on i1. ASSERT( diff --git a/moose-core/builtins/Interpol2D.h b/moose-core/builtins/Interpol2D.h index 33f52edf84f12ba38b36da2e97a5343658281638..535bbe2f497aa28521d3b5989f09c2a9bfad2295 100644 --- a/moose-core/builtins/Interpol2D.h +++ b/moose-core/builtins/Interpol2D.h @@ -48,7 +48,7 @@ class Interpol2D double getSy() const; double getInterpolatedValue(vector<double> xy) const; - + //////////////////////////////////////////////////////////// // Here are the Interpol2D Destination functions //////////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ class Interpol2D const vector< vector< double > >& value ); /** - * Resizes 2-D vector. If either argument is zero, it remains + * Resizes 2-D vector. If either argument is zero, it remains * unchanged */ void resize( unsigned int xsize, unsigned int ysize, double init = 0.0 ); diff --git a/moose-core/builtins/Mstring.h b/moose-core/builtins/Mstring.h index b253b172ccd38ad1c82de5ea1328800c4b314681..c667b3c15b92a076d2934eadb8bf54f42e8904ac 100644 --- a/moose-core/builtins/Mstring.h +++ b/moose-core/builtins/Mstring.h @@ -11,14 +11,14 @@ class Mstring { - public: + public: Mstring(); Mstring( string other ); - + //////////////////////////////////////////////////////////////// // Field assignment stuff. //////////////////////////////////////////////////////////////// - + void setThis( string v ); string getThis() const; @@ -28,7 +28,7 @@ class Mstring // const Mstring& operator=( const Mstring& other ); // string operator=( const Mstring& other ); // string operator=( const string& other ); - + //////////////////////////////////////////////////////////////// static const Cinfo* initCinfo(); diff --git a/moose-core/builtins/NSDFWriter.cpp b/moose-core/builtins/NSDFWriter.cpp index 32f081b08d539a4b0535d23452ab587e5679a216..1e30dc4d35f4dccc40cee214df2ed0ef52abfa56 100644 --- a/moose-core/builtins/NSDFWriter.cpp +++ b/moose-core/builtins/NSDFWriter.cpp @@ -1,47 +1,47 @@ -// NSDFWriter.cpp --- -// +// NSDFWriter.cpp --- +// // Filename: NSDFWriter.cpp -// Description: +// Description: // Author: subha -// Maintainer: +// Maintainer: // Created: Thu Jun 18 23:16:11 2015 (-0400) -// Version: +// Version: // Last-Updated: Sun Dec 20 23:20:19 2015 (-0500) // By: subha // Update #: 49 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// 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: #ifdef USE_HDF5 @@ -87,7 +87,7 @@ string iso_time(time_t * t) } const Cinfo * NSDFWriter::initCinfo() -{ +{ static FieldElementFinfo< NSDFWriter, InputVariable > eventInputFinfo( "eventInput", "Sets up field elements for event inputs", @@ -101,7 +101,7 @@ const Cinfo * NSDFWriter::initCinfo() "The moose element tree root to be saved under /model/modeltree", &NSDFWriter::setModelRoot, &NSDFWriter::getModelRoot); - + static DestFinfo process( "process", "Handle process calls. Collects data in buffer and if number of steps" @@ -117,7 +117,7 @@ const Cinfo * NSDFWriter::initCinfo() static Finfo * processShared[] = { &process, &reinit }; - + static SharedFinfo proc( "proc", "Shared message to receive process and reinit", @@ -211,7 +211,7 @@ void NSDFWriter::sortOutUniformSources(const Eref& eref) // Go through all the sources and determine the index of the // source message in the dataset ///////////////////////////////////////////////////////////// - + for (unsigned int ii = 0; ii < func_.size(); ++ii){ string varname = func_[ii]; size_t found = varname.find("get"); @@ -234,7 +234,7 @@ void NSDFWriter::sortOutUniformSources(const Eref& eref) /** Handle the datasets for the requested fields (connected to - requestOut). This is is similar to what HDF5DataWriter does. + requestOut). This is is similar to what HDF5DataWriter does. */ void NSDFWriter::openUniformData(const Eref &eref) { @@ -290,7 +290,7 @@ void NSDFWriter::createUniformMap() status = H5Tset_size(memtype, H5T_VARIABLE); assert(status >= 0); status = H5Dwrite(ds, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, sources); -#ifndef NDEBUG +#ifndef NDEBUG cout << "Write dataset: status=" << status << endl; #endif assert(status >= 0); @@ -302,8 +302,8 @@ void NSDFWriter::createUniformMap() status = H5DSattach_scale(classFieldToUniform_[ii->first], ds, 0); status = H5DSset_label(classFieldToUniform_[ii->first], 0, "source"); status = H5Dclose(ds); - status = H5Tclose(memtype); - } + status = H5Tclose(memtype); + } } void NSDFWriter::closeEventData() @@ -314,7 +314,7 @@ void NSDFWriter::closeEventData() } } events_.clear(); - eventInputs_.clear(); + eventInputs_.clear(); eventDatasets_.clear(); eventSrc_.clear(); eventSrcFields_.clear(); @@ -348,7 +348,7 @@ void NSDFWriter::openEventData(const Eref &eref) stringstream path; path << src[0].path() << "." << srcFields[0]; hid_t dataSet = getEventDataset(src[0].path(), srcFields[0]); - eventDatasets_.push_back(dataSet); + eventDatasets_.push_back(dataSet); } else { cerr <<"NSDFWriter::openEventData - cannot handle multiple connections at single input." <<endl; } @@ -357,7 +357,7 @@ void NSDFWriter::openEventData(const Eref &eref) void NSDFWriter::createEventMap() { - herr_t status; + herr_t status; hid_t eventMapContainer = require_group(filehandle_, MAPEVENTSRC); // Open the container for the event maps // Create the Datasets themselves (one for each field - each row @@ -396,7 +396,7 @@ void NSDFWriter::createEventMap() } status = H5Rcreate(&(buf->data), filehandle_, dsname, H5R_OBJECT, -1); free(dsname); - assert(status >= 0); + assert(status >= 0); } // create memory space hid_t memtype = H5Tcreate(H5T_COMPOUND, sizeof(map_type)); @@ -451,8 +451,8 @@ void NSDFWriter::flush() { // We need to update the tend on each write since we do not know // when the simulation is getting over and when it is just paused. - writeScalarAttr<string>(filehandle_, "tend", iso_time(NULL)); - + writeScalarAttr<string>(filehandle_, "tend", iso_time(NULL)); + // append all uniform data for (map< string, hid_t>::iterator it = classFieldToUniform_.begin(); it != classFieldToUniform_.end(); ++it){ @@ -463,7 +463,7 @@ void NSDFWriter::flush() } if (data_.size() == 0 || data_[0].size() == 0){ break; - } + } double * buffer = (double*)calloc(idxit->second.size() * steps_, sizeof(double)); vector< double > values; for (unsigned int ii = 0; ii < idxit->second.size(); ++ii){ @@ -472,7 +472,7 @@ void NSDFWriter::flush() } data_[idxit->second[ii]].clear(); } - + hid_t filespace = H5Dget_space(it->second); if (filespace < 0){ break; @@ -480,11 +480,11 @@ void NSDFWriter::flush() hsize_t dims[2]; hsize_t maxdims[2]; // retrieve current datset dimensions - herr_t status = H5Sget_simple_extent_dims(filespace, dims, maxdims); + herr_t status = H5Sget_simple_extent_dims(filespace, dims, maxdims); hsize_t newdims[] = {dims[0], dims[1] + steps_}; // new column count status = H5Dset_extent(it->second, newdims); // extend dataset to new column count H5Sclose(filespace); - filespace = H5Dget_space(it->second); // get the updated filespace + filespace = H5Dget_space(it->second); // get the updated filespace hsize_t start[2] = {0, dims[1]}; dims[1] = steps_; // change dims for memspace & hyperslab hid_t memspace = H5Screate_simple(2, dims, NULL); @@ -494,7 +494,7 @@ void NSDFWriter::flush() H5Sclose(filespace); free(buffer); } - + // append all event data for (unsigned int ii = 0; ii < eventSrc_.size(); ++ii){ appendToDataset(getEventDataset(eventSrc_[ii], eventSrcFields_[ii]), @@ -571,7 +571,7 @@ void NSDFWriter::process(const Eref& eref, ProcPtr proc) NSDFWriter& NSDFWriter::operator=( const NSDFWriter& other) { eventInputs_ = other.eventInputs_; - for ( vector< InputVariable >::iterator + for ( vector< InputVariable >::iterator i = eventInputs_.begin(); i != eventInputs_.end(); ++i ) i->setOwner( this ); for (unsigned int ii = 0; ii < getNumEventInputs(); ++ii){ @@ -625,7 +625,7 @@ string NSDFWriter::getModelRoot() const { return modelRoot_; } - + void NSDFWriter::writeModelTree() { @@ -674,5 +674,5 @@ void NSDFWriter::writeModelTree() } #endif // USE_HDF5 -// +// // NSDFWriter.cpp ends here diff --git a/moose-core/builtins/NSDFWriter.h b/moose-core/builtins/NSDFWriter.h index 86751348dd694f28bd57adf67246caa6e54e3cc9..8998ed951a98c91f275fdc233487ecaff660b68e 100644 --- a/moose-core/builtins/NSDFWriter.h +++ b/moose-core/builtins/NSDFWriter.h @@ -1,41 +1,41 @@ -/* NSDFWriter.h --- - * +/* NSDFWriter.h --- + * * Filename: NSDFWriter.h - * Description: + * Description: * Author: subha - * Maintainer: + * Maintainer: * Created: Thu Jun 18 23:06:59 2015 (-0400) - * Version: + * Version: * Last-Updated: Sun Dec 20 23:17:32 2015 (-0500) * By: subha * Update #: 2 - * URL: - * Keywords: - * Compatibility: - * + * URL: + * Keywords: + * Compatibility: + * */ -/* Commentary: - * - * - * +/* 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 @@ -72,7 +72,7 @@ typedef struct { - One DestFinfo where SrcFinfos sending out event times can be connected. These will go under Event data. - + */ class NSDFWriter: public HDF5DataWriter { @@ -101,10 +101,10 @@ class NSDFWriter: public HDF5DataWriter void process(const Eref &e, ProcPtr p); void reinit(const Eref &e, ProcPtr p); NSDFWriter& operator=(const NSDFWriter&other); - + static const Cinfo *initCinfo(); - protected: + protected: hid_t getEventDataset(string srcPath, string srcField); void sortOutUniformSources(const Eref& eref); /* hid_t getUniformDataset(string srcPath, string srcField); */ @@ -112,7 +112,7 @@ class NSDFWriter: public HDF5DataWriter vector < hid_t > eventDatasets_; // event times data_ and datasets_ inherited from HDF5DataWriter // are still attached to requestOut message - vector < vector < double > > events_; + vector < vector < double > > events_; vector < InputVariable > eventInputs_; vector < string > eventSrcFields_; vector < string > eventSrc_; @@ -139,7 +139,7 @@ class NSDFWriter: public HDF5DataWriter < class.field, vector<unsigned int> > that maps the class.field to a vector of indices in dataBuffer. the index vector contents should be in the same order as the sequence of objects - + */ // The last number of rows in each dataset // (/data/uniform/className/fieldName -> size) @@ -153,7 +153,7 @@ class NSDFWriter: public HDF5DataWriter map< string, vector < string > > classFieldToObjectField_; vector < string > vars_; string modelRoot_; - + }; #endif // _NSDFWRITER_H #endif // USE_HDF5 diff --git a/moose-core/builtins/SpikeStats.cpp b/moose-core/builtins/SpikeStats.cpp index c21be39bcfebd4947acdfa2b7913319f9b1a3155..544d843f044c53d1a389c492f72e3b5007fefe46 100644 --- a/moose-core/builtins/SpikeStats.cpp +++ b/moose-core/builtins/SpikeStats.cpp @@ -46,7 +46,7 @@ const Cinfo* SpikeStats::initCinfo() &Vm, // DestFinfo }; - static string doc[] = + static string doc[] = { "Name", "SpikeStats", "Author", "Upi Bhalla Aug 2014", diff --git a/moose-core/builtins/SpikeStats.h b/moose-core/builtins/SpikeStats.h index 93eb5cfce322073bbfc270bdac69e8f158ad95a5..2666ced6f90a6e77453aaa9c0747db7a08c942f4 100644 --- a/moose-core/builtins/SpikeStats.h +++ b/moose-core/builtins/SpikeStats.h @@ -11,18 +11,18 @@ class SpikeStats: public Stats { - public: + public: SpikeStats(); /** * Inserts an event into the pendingEvents queue for spikes. */ void addSpike( DataId synIndex, const double time ); - + //////////////////////////////////////////////////////////////// // Field assignment stuff. //////////////////////////////////////////////////////////////// - + void setThreshold( double thresh ); double getThreshold() const; diff --git a/moose-core/builtins/Stats.cpp b/moose-core/builtins/Stats.cpp index 3aa7056684d541c1f059378710b9e555f408a2ca..cc2f94b35133fe5ef5cd3a255f52663897630cf9 100644 --- a/moose-core/builtins/Stats.cpp +++ b/moose-core/builtins/Stats.cpp @@ -132,7 +132,7 @@ static const Cinfo* statsCinfo = Stats::initCinfo(); /////////////////////////////////////////////////////////////////////////// Stats::Stats() - : + : mean_( 0.0 ), sdev_( 0.0 ), sum_( 0.0 ), num_( 0 ), wmean_( 0.0 ), wsdev_( 0.0 ), wsum_( 0.0 ), wnum_( 0 ), sumsq_( 0.0 ), isWindowDirty_( true ) diff --git a/moose-core/builtins/Stats.h b/moose-core/builtins/Stats.h index aa4864761077f62501fbe4f7639f5e00f7d9c8a8..58ae7612f95403781e37490a6a91343b8a82a2b2 100644 --- a/moose-core/builtins/Stats.h +++ b/moose-core/builtins/Stats.h @@ -11,13 +11,13 @@ class Stats { - public: + public: Stats(); //////////////////////////////////////////////////////////////// // Field assignment stuff. //////////////////////////////////////////////////////////////// - + double getMean() const; double getSdev() const; double getSum() const; @@ -35,7 +35,7 @@ class Stats // Dest Func //////////////////////////////////////////////////////////////// void input( double v ); - + void process( const Eref& e, ProcPtr p ); void reinit( const Eref& e, ProcPtr p ); diff --git a/moose-core/builtins/StimulusTable.cpp b/moose-core/builtins/StimulusTable.cpp index 7e83f1db9950c8c05cfacbe269fb681f7524d9dc..00b442f78f6f248c63135d6dc4b4391c22b2d28a 100644 --- a/moose-core/builtins/StimulusTable.cpp +++ b/moose-core/builtins/StimulusTable.cpp @@ -136,8 +136,8 @@ const Cinfo* StimulusTable::initCinfo() static const Cinfo* stimulusTableCinfo = StimulusTable::initCinfo(); StimulusTable::StimulusTable() - : start_( 0 ), stop_( 1 ), loopTime_( 1 ), - stepSize_( 0 ), stepPosition_( 0 ), + : start_( 0 ), stop_( 1 ), loopTime_( 1 ), + stepSize_( 0 ), stepPosition_( 0 ), doLoop_( 0 ) { ; } @@ -202,8 +202,8 @@ void StimulusTable::setLoopTime( double v ) { if ( loopTime_ >= 0 ) loopTime_ = v; - else - cout << "StimulusTable::setLoopTime: Warning: Cannot set to " << + else + cout << "StimulusTable::setLoopTime: Warning: Cannot set to " << v << " as this value is below zero. Left unchanged at " << loopTime_ << "\n"; } diff --git a/moose-core/builtins/StimulusTable.h b/moose-core/builtins/StimulusTable.h index 101843b1bb39bc1084e71b76865390b4ddac39f3..8bb808da9dcbca488f8a61e34c794e16950ad953 100644 --- a/moose-core/builtins/StimulusTable.h +++ b/moose-core/builtins/StimulusTable.h @@ -15,7 +15,7 @@ */ class StimulusTable: public TableBase { - public: + public: StimulusTable(); ////////////////////////////////////////////////////////////////// // Field assignment stuff diff --git a/moose-core/builtins/Streamer.h b/moose-core/builtins/Streamer.h index cc379e6ca2b0586673b74044496de314b5c65ba1..0a06e547ac26227744727256a8579c1434159fe3 100644 --- a/moose-core/builtins/Streamer.h +++ b/moose-core/builtins/Streamer.h @@ -30,7 +30,7 @@ using namespace std; -class Streamer : public StreamerBase +class Streamer : public StreamerBase { public: diff --git a/moose-core/builtins/StreamerBase.cpp b/moose-core/builtins/StreamerBase.cpp index 7eebfcbf17059887cb4e117ed09f95192d04724e..be264dd03f00da5178db28c10a285b8be160c0d7 100644 --- a/moose-core/builtins/StreamerBase.cpp +++ b/moose-core/builtins/StreamerBase.cpp @@ -27,7 +27,7 @@ #include <memory> // Class function definitions -StreamerBase::StreamerBase() +StreamerBase::StreamerBase() { } @@ -42,7 +42,7 @@ StreamerBase::~StreamerBase() { } - + string StreamerBase::getOutFilepath( void ) const { @@ -55,10 +55,10 @@ void StreamerBase::setOutFilepath( string filepath ) } -void StreamerBase::writeToOutFile( const string& filepath - , const string& outputFormat - , const string& openmode - , const vector<double>& data +void StreamerBase::writeToOutFile( const string& filepath + , const string& outputFormat + , const string& openmode + , const vector<double>& data , const vector<string>& columns ) { @@ -71,7 +71,7 @@ void StreamerBase::writeToOutFile( const string& filepath writeToCSVFile( filepath, openmode, data, columns ); else { - LOG( moose::warning, "Unsupported format " << outputFormat + LOG( moose::warning, "Unsupported format " << outputFormat << ". Use npy or csv. Falling back to default csv" ); writeToCSVFile( filepath, openmode, data, columns ); @@ -95,11 +95,11 @@ void StreamerBase::writeToCSVFile( const string& filepath, const string& openmod if( openmode == "w" ) { string headerText = ""; - for( vector<string>::const_iterator it = columns.begin(); + for( vector<string>::const_iterator it = columns.begin(); it != columns.end(); it++ ) headerText += ( *it + delimiter_ ); headerText += eol; - fprintf( fp, "%s", headerText.c_str() ); + fprintf( fp, "%s", headerText.c_str() ); } string text = ""; diff --git a/moose-core/builtins/StreamerBase.h b/moose-core/builtins/StreamerBase.h index 3fd70ad0ae23c00ad43b7f3696c2561928806eb6..c23dd5001c59b9a13b6f8852a5a14330386ac4df 100644 --- a/moose-core/builtins/StreamerBase.h +++ b/moose-core/builtins/StreamerBase.h @@ -41,30 +41,30 @@ public: void setOutFilepath( string stream ); string getOutFilepath() const; - /** @brief Write to a output file in given format. + /** @brief Write to a output file in given format. * * @param filepath, path of * output file. If parent directories do not exist, they will be created. If * creation fails for some reason, data will be saved in current working * directory. The name of the file will be computed from the given directory - * name by replacing '/' or '\' by '_'. + * name by replacing '/' or '\' by '_'. * - * @param format + * @param format * * npy : numpy binary format (version 1 and 2), version 1 is default. * csv or dat: comma separated value (delimiter ' ' ) * * @param openmode (write or append) - * + * * @param data, vector of values * * @param ncols (number of columns). Incoming data will be formatted into a * matrix with ncols. */ - static void writeToOutFile( + static void writeToOutFile( const string& filepath, const string& format , const string& openmode - , const vector<double>& data + , const vector<double>& data , const vector<string>& columns ); @@ -82,7 +82,7 @@ public: */ static void writeToNPYFile( const string& filepath, const string& openmode , const vector<double>& data - , const vector<string>& columns + , const vector<string>& columns ); diff --git a/moose-core/builtins/Table.cpp b/moose-core/builtins/Table.cpp index 5b6914b0a131dbeabaecdd13cd76ec71e8f29d08..e07e4172ad6e40f8f7c41c30b6a7ef4a1eaed551 100644 --- a/moose-core/builtins/Table.cpp +++ b/moose-core/builtins/Table.cpp @@ -129,7 +129,7 @@ const Cinfo* Table::initCinfo() &threshold, // Value &format, // Value &columnName, // Value - &outfile, // Value + &outfile, // Value &useStreamer, // Value handleInput(), // DestFinfo &spike, // DestFinfo @@ -241,7 +241,7 @@ void Table::process( const Eref& e, ProcPtr p ) vec().insert( vec().end(), ret.begin(), ret.end() ); /* If we are streaming to a file, let's write to a file. And clean the - * vector. + * vector. * Write at every 5 seconds or whenever size of vector is more than 10k. */ if( useStreamer_ ) @@ -281,7 +281,7 @@ void Table::reinit( const Eref& e, ProcPtr p ) // with rootdit as path. if( ! outfileIsSet_ ) setOutfile( rootdir_ + - moose::moosePathToUserPath(tablePath_) + '.' + format_ + moose::moosePathToUserPath(tablePath_) + '.' + format_ ); } @@ -338,7 +338,7 @@ void Table::setFormat( string format ) format_ = format; else LOG( moose::warning - , "Unsupported format " << format + , "Unsupported format " << format << " only npy and csv are supported" ); } @@ -404,11 +404,11 @@ double Table::getDt( void ) const */ void Table::zipWithTime( const vector<double>& v , vector<double>& tvec - , const double& currTime + , const double& currTime ) { size_t N = v.size(); - for (size_t i = 0; i < N; i++) + for (size_t i = 0; i < N; i++) { tvec.push_back( currTime - (N - i - 1 ) * dt_ ); tvec.push_back( v[i] ); diff --git a/moose-core/builtins/TableBase.cpp b/moose-core/builtins/TableBase.cpp index e2e05ba521d49b3992534bf7164e6084a397e804..4ed17b6904f5b83c40d4c9a61c12fb4eb969eeb5 100644 --- a/moose-core/builtins/TableBase.cpp +++ b/moose-core/builtins/TableBase.cpp @@ -66,14 +66,14 @@ const Cinfo* TableBase::initCinfo() static DestFinfo loadCSV( "loadCSV", "Reads a single column from a CSV file. " "Arguments: filename, column#, starting row#, separator", - new OpFunc4< TableBase, string, int, int, char >( + new OpFunc4< TableBase, string, int, int, char >( &TableBase::loadCSV ) ); static DestFinfo loadXplot( "loadXplot", "Reads a single plot from an xplot file. " "Arguments: filename, plotname" "When the file has 2 columns, the 2nd column is loaded.", - new OpFunc2< TableBase, string, string >( + new OpFunc2< TableBase, string, string >( &TableBase::loadXplot ) ); static DestFinfo loadXplotRange( "loadXplotRange", @@ -82,7 +82,7 @@ const Cinfo* TableBase::initCinfo() "Arguments: filename, plotname, startindex, endindex" "Uses C convention: startindex included, endindex not included." "When the file has 2 columns, the 2nd column is loaded.", - new OpFunc4< TableBase, string, string, unsigned int, unsigned int >( + new OpFunc4< TableBase, string, string, unsigned int, unsigned int >( &TableBase::loadXplotRange ) ); static DestFinfo compareXplot( "compareXplot", @@ -93,7 +93,7 @@ const Cinfo* TableBase::initCinfo() "Arguments: filename, plotname, comparison_operation" "Operations: rmsd (for RMSDifference), rmsr (RMSratio ), " "dotp (Dot product, not yet implemented).", - new OpFunc3< TableBase, string, string, string >( + new OpFunc3< TableBase, string, string, string >( &TableBase::compareXplot ) ); static DestFinfo compareVec( "compareVec", @@ -106,7 +106,7 @@ const Cinfo* TableBase::initCinfo() "dotp (Dot product, not yet implemented).", new OpFunc2< TableBase, vector< double >, string >( &TableBase::compareVec ) ); - + static DestFinfo clearVec( "clearVec", "Handles request to clear the data vector", @@ -148,7 +148,7 @@ const Cinfo* TableBase::initCinfo() static const Cinfo* tableBaseCinfo = TableBase::initCinfo(); TableBase::TableBase() : output_( 0 ) -{ +{ } ////////////////////////////////////////////////////////////// @@ -291,7 +291,7 @@ void TableBase::loadXplot( string fname, string plotname ) } } -void TableBase::loadXplotRange( string fname, string plotname, +void TableBase::loadXplotRange( string fname, string plotname, unsigned int start, unsigned int end ) { vector< double > temp; @@ -300,7 +300,7 @@ void TableBase::loadXplotRange( string fname, string plotname, return; } if ( start > end || end > temp.size() ) { - cout << "TableBase::loadXplotRange: Bad range (" << start << + cout << "TableBase::loadXplotRange: Bad range (" << start << ", " << end << "] for table of size " << temp.size() << " from file " << fname << endl; return; @@ -309,7 +309,7 @@ void TableBase::loadXplotRange( string fname, string plotname, vec_.insert( vec_.end(), temp.begin() + start, temp.begin() + end ); } -void TableBase::loadCSV( +void TableBase::loadCSV( string fname, int startLine, int colNum, char separator ) { cout << "TODO: Not implemented yet" << endl; @@ -337,7 +337,7 @@ double getRMS( const vector< double >& v ) return -1; for ( vector< double >::const_iterator i = v.begin(); i != v.end(); ++i) sumsq += *i * *i; - + return sqrt( sumsq / size ); } @@ -429,7 +429,7 @@ double TableBase::getY( unsigned int index ) const return 0; } -double TableBase::interpolate( double xmin, double xmax, double input ) +double TableBase::interpolate( double xmin, double xmax, double input ) const { if ( vec_.size() == 0 ) @@ -438,7 +438,7 @@ double TableBase::interpolate( double xmin, double xmax, double input ) return vec_[0]; if ( input > xmax ) return ( vec_.back() ); - + unsigned int xdivs = vec_.size() - 1; double fraction = ( input - xmin ) / ( xmax - xmin ); @@ -448,7 +448,7 @@ double TableBase::interpolate( double xmin, double xmax, double input ) unsigned int j = xdivs * fraction; if ( j >= ( vec_.size() - 1 ) ) return vec_.back(); - + double dx = (xmax - xmin ) / xdivs; double lowerBound = xmin + j * dx; double subFraction = ( input - lowerBound ) / dx; diff --git a/moose-core/builtins/TableBase.h b/moose-core/builtins/TableBase.h index 7d4bccb6fd36c5da6193e61b31bb86dc87b4b55b..5c497a9ed409339ff9b2c1ad2a81000b23e6fa90 100644 --- a/moose-core/builtins/TableBase.h +++ b/moose-core/builtins/TableBase.h @@ -1,5 +1,5 @@ /********************************************************************** -** This program is part of 'MOOSE', +** This program is part of 'MOOSE', ** the Multi Object Oriented Simulation Environment. ** ** Copyright (C) 2003-2016 Upinder S. Bhalla. and NCBS @@ -42,9 +42,9 @@ public: void plainPlot( string file ); void loadXplot( string fname, string plotname ); - void loadXplotRange( + void loadXplotRange( string fname, string plotname, - unsigned int start, unsigned int end + unsigned int start, unsigned int end ); void loadCSV( string fname, int startLine, int colNum, char separator ); @@ -64,7 +64,7 @@ public: protected: vector< double >& vec(); - + private: double output_; vector< double > vec_; diff --git a/moose-core/builtins/TimeTable.cpp b/moose-core/builtins/TimeTable.cpp index a1805a20f161b62a8166c3595b1ab83af4e4b091..d2ebdb8051e849cb2eaa41cd6dcab0a2728d9597 100644 --- a/moose-core/builtins/TimeTable.cpp +++ b/moose-core/builtins/TimeTable.cpp @@ -20,7 +20,7 @@ static SrcFinfo1< double > *eventOut() { "Sends out spike time if it falls in current timestep."); return &eventOut; } - + const Cinfo* TimeTable::initCinfo() { /////////////////////////////////////////////////////// @@ -31,13 +31,13 @@ const Cinfo* TimeTable::initCinfo() "separated by any space character.", &TimeTable::setFilename, &TimeTable::getFilename); - + static ValueFinfo< TimeTable, int > method( "method", "Method to use for filling up the entries. Currently only method 4\n" "(loading from file) is supported.", &TimeTable::setMethod , &TimeTable::getMethod); - + static ReadOnlyValueFinfo <TimeTable, double> state( "state", "Current state of the time table.", &TimeTable::getState ); @@ -52,7 +52,7 @@ const Cinfo* TimeTable::initCinfo() static DestFinfo reinit("reinit", "Handles reinit call", new ProcOpFunc< TimeTable > ( &TimeTable::reinit)); - + ////////////////////////////////////////////////////////////// // SharedMsg Definitions ////////////////////////////////////////////////////////////// @@ -71,14 +71,14 @@ const Cinfo* TimeTable::initCinfo() eventOut(), &proc, }; - + static string doc[] = { "Name", "TimeTable", "Author", "Johannes Hjorth, 2008, KTH, Stockholm. Ported to buildQ branch using new API by Subhasis Ray, NCBS, Bangalore, 2013.", "Description", "TimeTable: Read in spike times from file and send out eventOut messages\n" "at the specified times.", }; - + static Dinfo< TimeTable > dinfo; static Cinfo timeTableCinfo( "TimeTable", @@ -88,7 +88,7 @@ const Cinfo* TimeTable::initCinfo() &dinfo, doc, sizeof(doc)/sizeof(string)); - + return &timeTableCinfo; } @@ -122,21 +122,21 @@ string TimeTable::getFilename() const void TimeTable::setFilename( string filename ) { filename_ = filename; - + std::ifstream fin( filename_.c_str() ); string line; - + if( !fin.good()) { - cout << "Error: TimeTable::innerload: Unable to open file" + cout << "Error: TimeTable::innerload: Unable to open file" << filename_ << endl; } - + //~ If lines need to be skipped: //~ for(unsigned int i = 0; (i < skipLines) & fin.good() ; i++) //~ getline( fin, line ); - + vec().clear(); - + double dataPoint, dataPointOld = -1000; while( fin >> dataPoint ) { vec().push_back(dataPoint); @@ -159,7 +159,7 @@ void TimeTable::setMethod(int method ) "Error: TimeTable::setMethod: " "Currently only method 4 (loading from file) supported.\n"; return; - } + } method_ = method; } diff --git a/moose-core/builtins/TimeTable.h b/moose-core/builtins/TimeTable.h index 6a791ee9b31880b110979288976241be874aafcd..f6f172aff85e57dfa11e6a4835954366795e891b 100644 --- a/moose-core/builtins/TimeTable.h +++ b/moose-core/builtins/TimeTable.h @@ -18,41 +18,41 @@ class TimeTable: public TableBase /* Functions to set and get TimeTable fields */ void setFilename(string filename ); string getFilename() const; - + void setMethod(int method ); int getMethod() const; double getState() const; - + /* Dest functions */ /** * The process function called by scheduler on every tick */ void process(const Eref& e, ProcPtr p); - + /** - * The reinit function called by scheduler for the reset + * The reinit function called by scheduler for the reset */ void reinit(const Eref& e, ProcPtr p); static const Cinfo * initCinfo(); - + private: /* * Fields */ string filename_; - + /* The table with (spike)times */ vector < double > timeTable_; /* 1 if it spiked in current step, 0 otherwise */ double state_; - + /* Current position within the table */ unsigned int curPos_; - - /* How to fill the timetable, + + /* How to fill the timetable, currently only 4 = reading from ASCII file is supported */ int method_; diff --git a/moose-core/builtins/Variable.cpp b/moose-core/builtins/Variable.cpp index cfe977d8b0782d03cd9110e123f0ca8c71a135fd..bfeb69954692e097078ee6fbe5b082f90ed72838 100644 --- a/moose-core/builtins/Variable.cpp +++ b/moose-core/builtins/Variable.cpp @@ -1,47 +1,47 @@ -// Variable.cpp --- -// +// Variable.cpp --- +// // Filename: Variable.cpp -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Fri May 30 19:56:06 2014 (+0530) -// Version: -// Last-Updated: -// By: +// Version: +// Last-Updated: +// By: // Update #: 0 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// -// -// -// +// 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: @@ -60,7 +60,7 @@ const Cinfo * Variable::initCinfo() "input", "Handles incoming variable value.", new EpFunc1< Variable, double >( &Variable::epSetValue )); - + static Finfo * variableFinfos[] = { &value, &input @@ -80,7 +80,7 @@ const Cinfo * Variable::initCinfo() sizeof(doc) / sizeof(string), true // is FieldElement, not to be created directly ); - return & variableCinfo; + return & variableCinfo; } static const Cinfo * variableCinfo = Variable::initCinfo(); @@ -103,17 +103,17 @@ void Variable::addMsgCallback(const Eref& e, const string& finfoName, ObjId msg, // // This imitates Synapse::dropMsgCallback // void Variable::dropMsgCallback( -// const Eref& e, const string& finfoName, +// const Eref& e, const string& finfoName, // ObjId msg, unsigned int msgLookup ) // { // if ( finfoName == "input" ) { // ObjId pa = Neutral::parent( e ); -// SynHandlerBase* sh = +// SynHandlerBase* sh = // reinterpret_cast< Function* >( pa.data() ); // sh->dropVar( msgLookup ); // } // } -// +// // Variable.cpp ends here diff --git a/moose-core/builtins/Variable.h b/moose-core/builtins/Variable.h index 992b4fe9eee57ebb89adfd80a62e54db5c5e14ce..99cb05d03dfdcb6d10ab0a3bc0134984a68b381a 100644 --- a/moose-core/builtins/Variable.h +++ b/moose-core/builtins/Variable.h @@ -1,47 +1,47 @@ -// Variable.h --- -// +// Variable.h --- +// // Filename: Variable.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Fri May 30 19:37:24 2014 (+0530) -// Version: -// Last-Updated: -// By: +// Version: +// Last-Updated: +// By: // Update #: 0 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// +// Commentary: +// // Field element for variables in Function class. -// -// +// +// // 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 _VARIABLE_H @@ -72,7 +72,7 @@ public: { value = v; } - + double getValue() const { return value; @@ -89,5 +89,5 @@ public: -// +// // Variable.h ends here diff --git a/moose-core/builtins/testBuiltins.cpp b/moose-core/builtins/testBuiltins.cpp index 2ce6ef7fc58248d3dd7ae58e9f4b0e46b348dff4..c301a6a27331df29739bc53bd600794ce6ac0744 100644 --- a/moose-core/builtins/testBuiltins.cpp +++ b/moose-core/builtins/testBuiltins.cpp @@ -24,7 +24,7 @@ void testArith() { Id a1id = Id::nextId(); unsigned int size = 10; - Element* a1 = new GlobalDataElement( + Element* a1 = new GlobalDataElement( a1id, Arith::initCinfo(), "a1", size ); Eref a1_0( a1, 0 ); @@ -52,7 +52,7 @@ void testArith() cout << "." << flush; } -/** +/** * This test uses the Diagonal Msg and summing in the Arith element to * generate a Fibonacci series. */ @@ -62,7 +62,7 @@ void testFibonacci() return; unsigned int numFib = 20; Id a1id = Id::nextId(); - Element* a1 = new LocalDataElement( + Element* a1 = new LocalDataElement( a1id, Arith::initCinfo(), "a1", numFib ); Arith* data = reinterpret_cast< Arith* >( a1->data( 0 ) ); @@ -120,7 +120,7 @@ void testFibonacci() cout << "." << flush; } -/** +/** * This test uses the Diagonal Msg and summing in the Arith element to * generate a Fibonacci series. */ @@ -144,16 +144,16 @@ void testMpiFibonacci() } */ - ObjId mid1 = shell->doAddMsg( "Diagonal", + ObjId mid1 = shell->doAddMsg( "Diagonal", ObjId( a1id, 0 ), "output", ObjId( a1id, 0 ), "arg1" ); bool ret = Field< int >::set( mid1, "stride", 1 ); assert( ret ); - ObjId mid2 = shell->doAddMsg( "Diagonal", + ObjId mid2 = shell->doAddMsg( "Diagonal", ObjId( a1id, 0 ), "output", ObjId( a1id, 0 ), "arg2" ); ret = Field< int >::set( mid2, "stride", 2 ); assert( ret ); - + /* bool ret = DiagonalMsg::add( a1, "output", a1, "arg1", 1 ); assert( ret ); @@ -277,7 +277,7 @@ void testGetMsg() ObjId arithid = shell->doCreate( "Arith", ObjId(), "arith", 1 ); assert( arithid != ObjId() ); // Table* t = reinterpret_cast< Table* >( tabid.eref().data() ); - ObjId ret = shell->doAddMsg( "Single", + ObjId ret = shell->doAddMsg( "Single", tabid.eref().objId(), "requestOut", arithid.eref().objId(), "getOutputValue" ); assert( ret != ObjId() ); @@ -316,7 +316,7 @@ void testGetMsg() ///////////////////////////////////////////////////////////////// Id arith2 = shell->doCopy( arithid, ObjId(), "arith2", 1, false, false); shell->doUseClock( "/arith2", "process", 0 ); - ret = shell->doAddMsg( "Single", + ret = shell->doAddMsg( "Single", tabid.eref().objId(), "requestOut", arith2.eref().objId(), "getOutputValue" ); shell->doReinit(); @@ -328,7 +328,7 @@ void testGetMsg() numEntries = Field< unsigned int >::get( tabid, "size" ); // One for reinit call, 100 for process, and there are two targets. - assert( numEntries == 202 ); + assert( numEntries == 202 ); temp = Field< vector< double > >::get( tabid, "vector" ); for ( unsigned int i = 1; i < 100; ++i ) { @@ -339,7 +339,7 @@ void testGetMsg() // Perhaps I should do another test without reinit. /* - SetGet2< string, string >::set( + SetGet2< string, string >::set( tabid.eref(), "xplot", "testfile", "testplot" ); tabentry.destroy(); */ @@ -347,7 +347,7 @@ void testGetMsg() shell->doDelete( arith2 ); shell->doDelete( tabid ); cout << "." << flush; - + } void testStats() @@ -371,7 +371,7 @@ void testStats() ObjId stat1 = shell->doCreate( "Stats", ObjId(), "stat1", 1 ); Field< unsigned int >::set( stat1, "windowLength", size ); - ObjId mid = shell->doAddMsg( "Single", tabid, "output", + ObjId mid = shell->doAddMsg( "Single", tabid, "output", stat1, "input" ); shell->doUseClock( "/tab", "process", 0 ); diff --git a/moose-core/builtins/testNSDF.cpp b/moose-core/builtins/testNSDF.cpp index 18283748ad6370009c6f1ff100eda4d3cfcae37a..b99782f1e4c7280cfcc17dbf11bd1cf39469e395 100644 --- a/moose-core/builtins/testNSDF.cpp +++ b/moose-core/builtins/testNSDF.cpp @@ -1,47 +1,47 @@ -// testNSDF.cpp --- -// +// testNSDF.cpp --- +// // Filename: testNSDF.cpp -// Description: +// Description: // Author: subha -// Maintainer: +// Maintainer: // Created: Tue Aug 25 22:36:07 2015 (-0400) -// Version: +// Version: // Last-Updated: Sat Aug 29 12:34:08 2015 (-0400) // By: subha // Update #: 43 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// -// -// -// +// 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: @@ -99,5 +99,5 @@ void testNSDF() testCreateStringDataset(); } -// +// // testNSDF.cpp ends here diff --git a/moose-core/cmake_modules/FindSIP.py b/moose-core/cmake_modules/FindSIP.py index ecb734f2ccac4421aa0d9d08918298de9943633b..a0cda067269e3aab0f1c0ef2be70796bcf9b90f9 100644 --- a/moose-core/cmake_modules/FindSIP.py +++ b/moose-core/cmake_modules/FindSIP.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # FindSIP.py # # Copyright (c) 2007, Simon Edwards <simon@simonzone.com> diff --git a/moose-core/device/CMakeLists.txt b/moose-core/device/CMakeLists.txt index 91369fa7607d52a5bc56415016fd9c7d04df56e6..564ae44c3764a8e95c5f0eae832e3d4c82a45dfb 100644 --- a/moose-core/device/CMakeLists.txt +++ b/moose-core/device/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories(../msg) include_directories(../basecode) -add_library(device +add_library(device PulseGen.cpp DiffAmp.cpp PIDController.cpp diff --git a/moose-core/device/DiffAmp.cpp b/moose-core/device/DiffAmp.cpp index 80a56428944ae5e3cfd7ef6fbf86a557b9559d32..60bbb422fdf41448ff274596f27d1e58734d8bb8 100644 --- a/moose-core/device/DiffAmp.cpp +++ b/moose-core/device/DiffAmp.cpp @@ -1,30 +1,30 @@ -// DiffAmp.cpp --- -// +// DiffAmp.cpp --- +// // Filename: DiffAmp.cpp -// Description: +// Description: // Author: subhasis ray -// Maintainer: +// Maintainer: // Created: Mon Dec 29 16:01:22 2008 (+0530) -// Version: +// Version: // Last-Updated: Tue Jun 11 17:00:33 2013 (+0530) // By: subha // Update #: 290 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: +// Commentary: // This implements an equivalent of the diffamp object in GENESIS. -// -// -// +// +// +// // Change log: // 2008-12-30 16:21:19 (+0530) - Initial version. // 2012-02-22 03:05:40 (+0530) - Ported to dh_branch -// +// /********************************************************************** ** This program is part of 'MOOSE', the ** Messaging Object Oriented Simulation Environment, @@ -63,24 +63,24 @@ const Cinfo* DiffAmp::initCinfo() " number representable on the system." , &DiffAmp::setSaturation, &DiffAmp::getSaturation); - + static ReadOnlyValueFinfo<DiffAmp, double> output( "outputValue", "Output of the amplifier, i.e. gain * (plus - minus)." , &DiffAmp::getOutput); /////////////////////////////////////////////////////////////// // Dest messages /////////////////////////////////////////////////////////////// - + static DestFinfo gainIn( "gainIn", - "Destination message to control gain dynamically.", + "Destination message to control gain dynamically.", new OpFunc1<DiffAmp, double> (&DiffAmp::setGain)); - - static DestFinfo plusIn( "plusIn", + + static DestFinfo plusIn( "plusIn", "Positive input terminal of the amplifier. All the messages connected" - " here are summed up to get total positive input.", + " here are summed up to get total positive input.", new OpFunc1<DiffAmp, double> (&DiffAmp::plusFunc)); - - static DestFinfo minusIn( "minusIn", + + static DestFinfo minusIn( "minusIn", "Negative input terminal of the amplifier. All the messages connected" " here are summed up to get total positive input.", new OpFunc1<DiffAmp, double> (&DiffAmp::minusFunc)); @@ -97,7 +97,7 @@ const Cinfo* DiffAmp::initCinfo() { &process, &reinit }; - + static SharedFinfo proc( "proc", "This is a shared message to receive Process messages " "from the scheduler objects." @@ -109,7 +109,7 @@ const Cinfo* DiffAmp::initCinfo() processShared, sizeof( processShared ) / sizeof( Finfo* ) ); - + static Finfo * diffAmpFinfos[] = { &gain, &saturation, @@ -139,8 +139,8 @@ const Cinfo* DiffAmp::initCinfo() doc, sizeof(doc)/sizeof(string) ); - - return &diffAmpCinfo; + + return &diffAmpCinfo; } static const Cinfo* diffAmpCinfo = DiffAmp::initCinfo(); @@ -195,7 +195,7 @@ void DiffAmp::process(const Eref& e, ProcPtr p) } if ( output < -saturation_ ) { output = -saturation_; - } + } output_ = output; outputOut()->send(e, output_); } @@ -208,5 +208,5 @@ void DiffAmp::reinit(const Eref& e, ProcPtr p) minus_ = 0.0; } -// +// // DiffAmp.cpp ends here diff --git a/moose-core/device/DiffAmp.h b/moose-core/device/DiffAmp.h index e4d121b0980f87c4907d73818ff0e035db8c3540..a834d65757dd0a4724b73f60202009c21ceb7521 100644 --- a/moose-core/device/DiffAmp.h +++ b/moose-core/device/DiffAmp.h @@ -1,30 +1,30 @@ -// DiffAmp.h --- -// +// DiffAmp.h --- +// // Filename: DiffAmp.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Wed Feb 22 02:28:54 2012 (+0530) -// Version: +// Version: // Last-Updated: Wed Feb 22 03:03:01 2012 (+0530) // By: Subhasis Ray // Update #: 15 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// -// -// -// +// Commentary: +// +// +// +// // Change log: -// -// -// +// +// +// // Code: @@ -47,7 +47,7 @@ class DiffAmp void minusFunc(double input); void process(const Eref& e, ProcPtr p); void reinit(const Eref& e, ProcPtr p); - + static const Cinfo* initCinfo(); protected: @@ -57,8 +57,8 @@ class DiffAmp double minus_; double output_; }; - + #endif -// +// // DiffAmp.h ends here diff --git a/moose-core/device/PIDController.cpp b/moose-core/device/PIDController.cpp index 232a4852519ae3e39316c131f1c5c6d3d0aa4cc4..54f5b1fe3a869dd4b48b6d838e364aa15bc4f183 100644 --- a/moose-core/device/PIDController.cpp +++ b/moose-core/device/PIDController.cpp @@ -1,31 +1,31 @@ -// PIDController.cpp --- -// +// PIDController.cpp --- +// // Filename: PIDController.cpp -// Description: +// Description: // Author: subhasis ray -// Maintainer: +// Maintainer: // Created: Tue Dec 30 23:36:01 2008 (+0530) -// Version: +// Version: // Last-Updated: Tue Jun 11 17:00:51 2013 (+0530) // By: subha // Update #: 338 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// +// +// +// // Change log: -// -// -// -// +// +// +// +// /********************************************************************** ** This program is part of 'MOOSE', the ** Messaging Object Oriented Simulation Environment, @@ -44,7 +44,7 @@ static SrcFinfo1< double > * outputOut() { - static SrcFinfo1 <double> outputOut("output", + static SrcFinfo1 <double> outputOut("output", "Sends the output of the PIDController. This is known as manipulated" " variable (MV) in control theory. This should be fed into the process" " which we are trying to control."); @@ -62,7 +62,7 @@ const Cinfo* PIDController::initCinfo() static Finfo* processShared[] = { &process, &reinit }; - + static ValueFinfo<PIDController, double> gain( "gain", "This is the proportional gain (Kp). This tuning parameter scales the" " proportional term. Larger gain usually results in faster response, but" @@ -76,14 +76,14 @@ const Cinfo* PIDController::initCinfo() &PIDController::getSaturation); static ValueFinfo<PIDController, double> command("command", "The command (desired) value of the sensed parameter. In control theory" - " this is commonly known as setpoint(SP).", - &PIDController::setCommand, + " this is commonly known as setpoint(SP).", + &PIDController::setCommand, &PIDController::getCommand); static ReadOnlyValueFinfo<PIDController, double> sensed( "sensed", "Sensed (measured) value. This is commonly known as process variable" "(PV) in control theory.", &PIDController::getSensed); - static ValueFinfo<PIDController, double> tauI( "tauI", + static ValueFinfo<PIDController, double> tauI( "tauI", "The integration time constant, typically = dt. This is actually" " proportional gain divided by integral gain (Kp/Ki)). Larger Ki" " (smaller tauI) usually leads to fast elimination of steady state" @@ -97,14 +97,14 @@ const Cinfo* PIDController::initCinfo() " and may lead to instability.", &PIDController::setTauD, &PIDController::getTauD); - static ReadOnlyValueFinfo<PIDController, double> outputValue( "outputValue", + static ReadOnlyValueFinfo<PIDController, double> outputValue( "outputValue", "Output of the PIDController. This is given by:" " gain * ( error + INTEGRAL[ error dt ] / tau_i + tau_d * d(error)/dt )\n" "Where gain = proportional gain (Kp), tau_i = integral gain (Kp/Ki) and" " tau_d = derivative gain (Kd/Kp). In control theory this is also known" " as the manipulated variable (MV)", - &PIDController::getOutput); - static ReadOnlyValueFinfo<PIDController, double> error( "error", + &PIDController::getOutput); + static ReadOnlyValueFinfo<PIDController, double> error( "error", "The error term, which is the difference between command and sensed" " value.", &PIDController::getError); @@ -326,5 +326,5 @@ void PIDController::reinit(const Eref& e, ProcPtr proc ) -// +// // PIDController.cpp ends here diff --git a/moose-core/device/PIDController.h b/moose-core/device/PIDController.h index c268e563c4021d56b86bce61ff7c1de6871f9ba3..7e2914e15ad125dfa67927976834da6e2cc439ae 100644 --- a/moose-core/device/PIDController.h +++ b/moose-core/device/PIDController.h @@ -1,30 +1,30 @@ -// PIDController.h --- -// +// PIDController.h --- +// // Filename: PIDController.h -// Description: +// Description: // Author: subhasis ray -// Maintainer: +// Maintainer: // Created: Tue Dec 30 23:14:00 2008 (+0530) -// Version: +// Version: // Last-Updated: Wed Feb 22 18:34:37 2012 (+0530) // By: Subhasis Ray // Update #: 57 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// -// -// -// +// Commentary: +// +// +// +// // Change log: -// +// // 2012-02-22 17:14:29 (+0530) subha - started porting to dh_branch -// +// // /********************************************************************** ** This program is part of 'MOOSE', the @@ -44,7 +44,7 @@ class PIDController{ public: PIDController(); - + void setCommand( double command ); double getCommand() const; void setSensed(double sensed ); @@ -65,21 +65,21 @@ class PIDController{ void process(const Eref&e, ProcPtr process ); void reinit(const Eref& e, ProcPtr process ); static const Cinfo * initCinfo(); - + private: double command_; double saturation_; double gain_; double tau_i_; double tau_d_; - double sensed_; + double sensed_; double output_; double error_; // e of PIDController in GENESIS ( error = command - sensed ) double e_integral_; // integral of error dt - double e_derivative_; // derivative of error + double e_derivative_; // derivative of error double e_previous_; }; - + #endif // Code: @@ -87,5 +87,5 @@ class PIDController{ -// +// // PIDController.h ends here diff --git a/moose-core/device/PulseGen.cpp b/moose-core/device/PulseGen.cpp index 105aa8282b182ecc8255b352f25fea698065f34f..20a10af5d63f06ba08b32b13a15180a3fef6ff8f 100644 --- a/moose-core/device/PulseGen.cpp +++ b/moose-core/device/PulseGen.cpp @@ -305,7 +305,7 @@ double PulseGen::getOutput() const int PulseGen::getPreviousInput() const { - return prevInput_; + return prevInput_; } void PulseGen::setCount(unsigned int count) diff --git a/moose-core/device/PulseGen.h b/moose-core/device/PulseGen.h index 2a6feec03e7e5d46b5e0f30ceadc72b7ac0af55f..0349f594a9581c7dcddf7e71d3b2093627a25472 100644 --- a/moose-core/device/PulseGen.h +++ b/moose-core/device/PulseGen.h @@ -1,31 +1,31 @@ -// PulseGen.h --- -// +// PulseGen.h --- +// // Filename: PulseGen.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Created: Mon Feb 20 01:21:32 2012 (+0530) -// Version: +// Version: // Last-Updated: Mon Feb 20 16:42:41 2012 (+0530) // By: Subhasis Ray // Update #: 60 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// +// +// +// // Change log: -// +// // 2012-02-20 01:22:01 (+0530) Subha - started porting old moose code // to dh_branch. -// +// // Code: @@ -42,7 +42,7 @@ class PulseGen /** With trigMode = FREE_RUN the pulse generator will create a train of pulses determined by the firstDealy, firstWidth, - firstLevel, secondDelay, secondWidth and secondLevel. + firstLevel, secondDelay, secondWidth and secondLevel. */ static const int FREE_RUN = 0; /** @@ -65,19 +65,19 @@ class PulseGen With trigMode = EXT_GATE, the pulse occurs firstDelay later from the leading edge of the input. */ - static const int EXT_GATE = 2; - + static const int EXT_GATE = 2; + #ifdef DO_UNIT_TESTS friend void testPulseGen(); #endif public: PulseGen(); ~PulseGen(); - + ///////////////////////////////////////////////////////////// // Value field access function definitions ///////////////////////////////////////////////////////////// - + void setFirstDelay(double value ); double getFirstDelay() const; void setFirstWidth(double value ); @@ -101,19 +101,19 @@ class PulseGen unsigned int getCount() const; void setLevel(unsigned int pulseNo, double level); void setWidth(unsigned int pulseNo, double width); - void setDelay(unsigned int pulseNo, double delay); + void setDelay(unsigned int pulseNo, double delay); double getWidth(unsigned int index) const; double getDelay(unsigned int index) const; double getLevel(unsigned int index) const; - + ///////////////////////////////////////////////////////////// // Dest function definitions ///////////////////////////////////////////////////////////// - + void input(double input); void process( const Eref& e, ProcPtr p ); - + void reinit( const Eref& e, ProcPtr p ); ///////////////////////////////////////////////////////////// @@ -123,17 +123,17 @@ class PulseGen vector <double> delay_; vector <double> level_; vector <double> width_; - + double output_; double baseLevel_; double trigTime_; unsigned int trigMode_; bool secondPulse_; - + int prevInput_; - int input_; + int input_; }; #endif // _PULSEGEN_H -// +// // PulseGen.h ends here diff --git a/moose-core/device/RC.cpp b/moose-core/device/RC.cpp index 100d534a0045115af9aad38addd8b6d8b70542d3..6ce69f23a741d469e316a31da7cb476034c5bdec 100644 --- a/moose-core/device/RC.cpp +++ b/moose-core/device/RC.cpp @@ -1,31 +1,31 @@ -// RC.cpp --- -// +// RC.cpp --- +// // Filename: RC.cpp -// Description: +// Description: // Author: subhasis ray -// Maintainer: +// Maintainer: // Created: Wed Dec 31 15:47:45 2008 (+0530) -// Version: +// Version: // Last-Updated: Tue Jun 11 17:01:03 2013 (+0530) // By: subha // Update #: 247 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// +// +// +// // Change log: -// -// -// -// +// +// +// +// /********************************************************************** ** This program is part of 'MOOSE', the ** Messaging Object Oriented Simulation Environment, @@ -68,19 +68,19 @@ const Cinfo* RC::initCinfo() "for the Reinit operation. It also uses ProcInfo. ", processShared, sizeof( processShared ) / sizeof( Finfo* )); - static ValueFinfo<RC, double> V0( "V0", + static ValueFinfo<RC, double> V0( "V0", "Initial value of 'state'", &RC::setV0, &RC::getV0 ); - static ValueFinfo<RC, double> R( "R", + static ValueFinfo<RC, double> R( "R", "Series resistance of the RC circuit.", &RC::setResistance, &RC::getResistance); - static ValueFinfo<RC, double> C( "C", + static ValueFinfo<RC, double> C( "C", "Parallel capacitance of the RC circuit.", &RC::setCapacitance, &RC::getCapacitance); - static ReadOnlyValueFinfo<RC, double> state("state", + static ReadOnlyValueFinfo<RC, double> state("state", "Output value of the RC circuit. This is the voltage across the" " capacitor.", &RC::getState); @@ -134,7 +134,7 @@ RC::RC(): { ; // Do nothing } - + void RC::setV0( double v0 ) { @@ -219,7 +219,7 @@ void RC::reinit(const Eref& e, const ProcPtr proc) dt_tau_ = proc->dt / (resistance_ * capacitance_); state_ = v0_; - if (dt_tau_ > 1e-15){ + if (dt_tau_ > 1e-15){ exp_ = exp(-dt_tau_); } else {// use approximation exp_ = 1 - dt_tau_; @@ -229,5 +229,5 @@ void RC::reinit(const Eref& e, const ProcPtr proc) } -// +// // RC.cpp ends here diff --git a/moose-core/device/RC.h b/moose-core/device/RC.h index 2e667be1f482fa19495a0775673f36bcaca5d48e..3023ddbb1324e26277463a7b71e11e16c39b87d1 100644 --- a/moose-core/device/RC.h +++ b/moose-core/device/RC.h @@ -1,31 +1,31 @@ // RC.h --- -// +// // Filename: RC.h -// Description: +// Description: // Author: subhasis ray -// Maintainer: +// Maintainer: // Created: Wed Dec 31 15:18:22 2008 (+0530) -// Version: +// Version: // Last-Updated: Wed Feb 22 20:29:35 2012 (+0530) // By: Subhasis Ray // Update #: 54 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// -// -// -// +// Commentary: +// +// +// +// // Change log: -// -// -// -// +// +// +// +// /********************************************************************** ** This program is part of 'MOOSE', the ** Messaging Object Oriented Simulation Environment, @@ -45,7 +45,7 @@ class RC{ public: - RC(); + RC(); void setV0(double voltage); double getV0() const; void setResistance(double resistance); @@ -73,5 +73,5 @@ class RC{ #endif -// +// // RC.h ends here diff --git a/moose-core/diffusion/DiffPoolVec.cpp b/moose-core/diffusion/DiffPoolVec.cpp index 7164a72b6a6d2597a0d162316bccac7a98412675..e6faaa63133205c2dc3ec6be1e9f8197eb300e3c 100644 --- a/moose-core/diffusion/DiffPoolVec.cpp +++ b/moose-core/diffusion/DiffPoolVec.cpp @@ -23,7 +23,7 @@ using namespace std; * work on in single-compartment models. */ DiffPoolVec::DiffPoolVec() - : id_( 0 ), n_( 1, 0.0 ), nInit_( 1, 0.0 ), + : id_( 0 ), n_( 1, 0.0 ), nInit_( 1, 0.0 ), diffConst_( 1.0e-12 ), motorConst_( 0.0 ) {;} @@ -91,7 +91,7 @@ void DiffPoolVec::setMotorConst( double v ) motorConst_ = v; } -void DiffPoolVec::setNumVoxels( unsigned int num ) +void DiffPoolVec::setNumVoxels( unsigned int num ) { nInit_.resize( num, 0.0 ); n_.resize( num, 0.0 ); @@ -102,7 +102,7 @@ unsigned int DiffPoolVec::getNumVoxels() const return n_.size(); } -void DiffPoolVec::setId( unsigned int id ) +void DiffPoolVec::setId( unsigned int id ) { id_ = id; } diff --git a/moose-core/diffusion/DiffPoolVec.h b/moose-core/diffusion/DiffPoolVec.h index 982cd9002b41280318ddfef195f28df7c5fbd763..345403f691cb6a12bb581a576a43a62bfa664a72 100644 --- a/moose-core/diffusion/DiffPoolVec.h +++ b/moose-core/diffusion/DiffPoolVec.h @@ -41,12 +41,12 @@ class DiffPoolVec ///////////////////////////////////////////////// /// Used by parent solver to manipulate 'n' - const vector< double >& getNvec() const; + 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 setOps( const vector< Triplet< double > >& ops_, + void setNvec( const vector< double >& n ); + void setNvec( unsigned int start, unsigned int num, + vector< double >::const_iterator q ); + void setOps( const vector< Triplet< double > >& ops_, const vector< double >& diagVal_ ); /// Assign operations. // static const Cinfo* initCinfo(); diff --git a/moose-core/diffusion/Dsolve.cpp b/moose-core/diffusion/Dsolve.cpp index 1924bee4f46967bcfe2f02de22e4c785d2166d54..9185ab6537ffab493c4df27be085420e8bc18671 100644 --- a/moose-core/diffusion/Dsolve.cpp +++ b/moose-core/diffusion/Dsolve.cpp @@ -36,14 +36,14 @@ const Cinfo* Dsolve::initCinfo() /////////////////////////////////////////////////////// // Field definitions /////////////////////////////////////////////////////// - + static ValueFinfo< Dsolve, Id > stoich ( "stoich", "Stoichiometry object for handling this reaction system.", &Dsolve::setStoich, &Dsolve::getStoich ); - + static ElementValueFinfo< Dsolve, string > path ( "path", "Path of reaction system. Must include all the pools that " @@ -65,7 +65,7 @@ const Cinfo* Dsolve::initCinfo() "current diffusion solver. ", &Dsolve::getNumVoxels ); - static LookupValueFinfo< + static LookupValueFinfo< Dsolve, unsigned int, vector< double > > nVec( "nVec", "vector of # of molecules along diffusion length, " @@ -130,12 +130,12 @@ const Cinfo* Dsolve::initCinfo() static DestFinfo buildMeshJunctions( "buildMeshJunctions", "Builds junctions between mesh on current Dsolve, and another" " Dsolve. The meshes have to be compatible. ", - new EpFunc1< Dsolve, Id >( + new EpFunc1< Dsolve, Id >( &Dsolve::buildMeshJunctions ) ); static DestFinfo buildNeuroMeshJunctions( "buildNeuroMeshJunctions", "Builds junctions between NeuroMesh, SpineMesh and PsdMesh", - new EpFunc2< Dsolve, Id, Id >( + new EpFunc2< Dsolve, Id, Id >( &Dsolve::buildNeuroMeshJunctions ) ); /////////////////////////////////////////////////////// @@ -165,7 +165,7 @@ const Cinfo* Dsolve::initCinfo() &buildNeuroMeshJunctions, // DestFinfo &proc, // SharedFinfo }; - + static Dinfo< Dsolve > dinfo; static Cinfo dsolveCinfo( "Dsolve", @@ -184,7 +184,7 @@ static const Cinfo* dsolveCinfo = Dsolve::initCinfo(); // Class definitions ////////////////////////////////////////////////////////////// Dsolve::Dsolve() - : + : dt_( -1.0 ), numTotPools_( 0 ), numLocalPools_( 0 ), @@ -330,7 +330,7 @@ void Dsolve::calcJunction( const DiffJunction& jn, double dt ) continue; // This geom mean is used in case we have the odd situation of // different diffusion constants. - double effectiveDiffConst = + double effectiveDiffConst = sqrt( myDv.getDiffConst() * otherDv.getDiffConst() ); for ( vector< VoxelJunction >::const_iterator j = jn.vj.begin(); j != jn.vj.end(); ++j ) { @@ -338,13 +338,13 @@ void Dsolve::calcJunction( const DiffJunction& jn, double dt ) double otherN = otherDv.getN( j->second ); // Here we do an exp Euler calculation // rf is rate from self to other. - // double k = myDv.getDiffConst() * j->diffScale; - double k = effectiveDiffConst * j->diffScale; + // double k = myDv.getDiffConst() * j->diffScale; + double k = effectiveDiffConst * j->diffScale; double lastN = myN; - myN = integ( myN, - k * myN / j->firstVol, - k * otherN / j->secondVol, - dt + myN = integ( myN, + k * myN / j->firstVol, + k * otherN / j->secondVol, + dt ); otherN += lastN - myN; // Simple mass conservation if ( otherN < 0.0 ) { // Avoid negatives @@ -359,7 +359,7 @@ void Dsolve::calcJunction( const DiffJunction& jn, double dt ) void Dsolve::process( const Eref& e, ProcPtr p ) { - for ( vector< DiffPoolVec >::iterator + for ( vector< DiffPoolVec >::iterator i = pools_.begin(); i != pools_.end(); ++i ) { i->advance( p->dt ); } @@ -373,7 +373,7 @@ void Dsolve::process( const Eref& e, ProcPtr p ) void Dsolve::reinit( const Eref& e, ProcPtr p ) { build( p->dt ); - for ( vector< DiffPoolVec >::iterator + for ( vector< DiffPoolVec >::iterator i = pools_.begin(); i != pools_.end(); ++i ) { i->reinit(); } @@ -403,7 +403,7 @@ void Dsolve::setStoich( Id id ) // assert( poolIndex < pools_.size() ); Id pid( i + poolMapStart_ ); assert( pid.element()->cinfo()->isA( "PoolBase" ) ); - PoolBase* pb = + PoolBase* pb = reinterpret_cast< PoolBase* >( pid.eref().data()); double diffConst = pb->getDiffConst( pid.eref() ); double motorConst = pb->getMotorConst( pid.eref() ); @@ -412,7 +412,7 @@ void Dsolve::setStoich( Id id ) pools_[ poolIndex ].setMotorConst( motorConst ); /* cout << i << " poolIndex=" << poolIndex << - ", id=" << pid.value() << + ", id=" << pid.value() << ", name=" << pid.element()->getName() << endl; */ } @@ -431,12 +431,12 @@ void Dsolve::setDsolve( Id dsolve ) void Dsolve::setCompartment( Id id ) { const Cinfo* c = id.element()->cinfo(); - if ( c->isA( "NeuroMesh" ) || c->isA( "SpineMesh" ) || + if ( c->isA( "NeuroMesh" ) || c->isA( "SpineMesh" ) || c->isA( "PsdMesh" ) || c->isA( "CylMesh" ) ) { compartment_ = id; numVoxels_ = Field< unsigned int >::get( id, "numMesh" ); /* - const MeshCompt* m = reinterpret_cast< const MeshCompt* >( + const MeshCompt* m = reinterpret_cast< const MeshCompt* >( id.eref().data() ); numVoxels_ = m->getStencil().nRows(); */ @@ -446,17 +446,17 @@ void Dsolve::setCompartment( Id id ) } } -void Dsolve::makePoolMapFromElist( const vector< ObjId >& elist, +void Dsolve::makePoolMapFromElist( const vector< ObjId >& elist, vector< Id >& temp ) { unsigned int minId = 0; unsigned int maxId = 0; temp.resize( 0 ); - for ( vector< ObjId >::const_iterator + for ( vector< ObjId >::const_iterator i = elist.begin(); i != elist.end(); ++i ) { if ( i->element()->cinfo()->isA( "PoolBase" ) ) { temp.push_back( i->id ); - if ( minId == 0 ) + if ( minId == 0 ) maxId = minId = i->id.value(); else if ( i->id.value() < minId ) minId = i->id.value(); @@ -466,7 +466,7 @@ void Dsolve::makePoolMapFromElist( const vector< ObjId >& elist, } if ( temp.size() == 0 ) { - cout << "Dsolve::makePoolMapFromElist::( " << path_ << + cout << "Dsolve::makePoolMapFromElist::( " << path_ << " ): Error: path is has no pools\n"; return; } @@ -507,7 +507,7 @@ void Dsolve::setPath( const Eref& e, string path ) // This needs them to be replicated, and for their messages // to be copied over. Not really set up here. } else { - cout << "Error: Dsolve::setPath( " << path << " ): unknown pool class:" << c->name() << endl; + cout << "Error: Dsolve::setPath( " << path << " ): unknown pool class:" << c->name() << endl; } id.element()->resize( numVoxels_ ); @@ -528,7 +528,7 @@ string Dsolve::getPath( const Eref& e ) const // Solver building ////////////////////////////////////////////////////////////// -/** +/** * build: This function is called either by setStoich or setPath. * By this point the diffusion consts etc will be assigned to the * poolVecs. @@ -555,7 +555,7 @@ void Dsolve::build( double dt ) return; } dt_ = dt; - const MeshCompt* m = reinterpret_cast< const MeshCompt* >( + const MeshCompt* m = reinterpret_cast< const MeshCompt* >( compartment_.eref().data() ); unsigned int numVoxels = m->getNumEntries(); @@ -565,10 +565,10 @@ void Dsolve::build( double dt ) vector< double > diagVal; vector< Triplet< double > > fops; FastMatrixElim elim( numVoxels, numVoxels ); - if ( elim.buildForDiffusion( - m->getParentVoxel(), m->getVoxelVolume(), - m->getVoxelArea(), m->getVoxelLength(), - pools_[i].getDiffConst(), pools_[i].getMotorConst(), dt ) ) + if ( elim.buildForDiffusion( + m->getParentVoxel(), m->getVoxelVolume(), + m->getVoxelArea(), m->getVoxelLength(), + pools_[i].getDiffConst(), pools_[i].getMotorConst(), dt ) ) { vector< unsigned int > parentVoxel = m->getParentVoxel(); assert( elim.checkSymmetricShape() ); @@ -619,14 +619,14 @@ void Dsolve::buildMeshJunctions( const Eref& e, Id other ) Id otherMesh; if ( other.element()->cinfo()->isA( "Dsolve" ) ) { otherMesh = Field< Id >::get( other, "compartment" ); - if ( compartment_.element()->cinfo()->isA( "ChemCompt" ) && + if ( compartment_.element()->cinfo()->isA( "ChemCompt" ) && otherMesh.element()->cinfo()->isA( "ChemCompt" ) ) { innerBuildMeshJunctions( e.id(), other ); return; } } cout << "Warning: Dsolve::buildMeshJunctions: one of '" << - compartment_.path() << ", " << otherMesh.path() << + compartment_.path() << ", " << otherMesh.path() << "' is not a Mesh\n"; } @@ -662,7 +662,7 @@ void Dsolve::innerBuildMeshJunctions( Id self, Id other ) other.eref().data() ); for ( unsigned int i = 0; i < otherSolve->pools_.size(); ++i ) { Id otherPool( otherSolve->pools_[i].getId() ); - map< string, unsigned int >::iterator p = + map< string, unsigned int >::iterator p = myPools.find( otherPool.element()->getName() ); if ( p != myPools.end() ) { jn.otherPools.push_back( i ); @@ -674,14 +674,14 @@ void Dsolve::innerBuildMeshJunctions( Id self, Id other ) Id myMesh = Field< Id >::get( self, "compartment" ); Id otherMesh = Field< Id >::get( other, "compartment" ); - const ChemCompt* myCompt = reinterpret_cast< const ChemCompt* >( + const ChemCompt* myCompt = reinterpret_cast< const ChemCompt* >( myMesh.eref().data() ); - const ChemCompt* otherCompt = reinterpret_cast< const ChemCompt* >( + const ChemCompt* otherCompt = reinterpret_cast< const ChemCompt* >( otherMesh.eref().data() ); myCompt->matchMeshEntries( otherCompt, jn.vj ); vector< double > myVols = myCompt->getVoxelVolume(); vector< double > otherVols = otherCompt->getVoxelVolume(); - for ( vector< VoxelJunction >::iterator + for ( vector< VoxelJunction >::iterator i = jn.vj.begin(); i != jn.vj.end(); ++i ) { i->firstVol = myVols[i->first]; i->secondVol = otherVols[i->second]; @@ -705,7 +705,7 @@ unsigned int Dsolve::getNumVoxels() const return numVoxels_; } -void Dsolve::setNumAllVoxels( unsigned int num ) +void Dsolve::setNumAllVoxels( unsigned int num ) { numVoxels_ = num; for ( unsigned int i = 0 ; i < numLocalPools_; ++i ) @@ -728,7 +728,7 @@ void Dsolve::setN( const Eref& e, double v ) { unsigned int pid = convertIdToPoolIndex( e ); // Ignore silently, as this may be a valid pid for the ksolve to use. - if ( pid >= pools_.size() ) + if ( pid >= pools_.size() ) return; unsigned int vox = e.dataIndex(); if ( vox < numVoxels_ ) { @@ -841,7 +841,7 @@ void Dsolve::getBlock( vector< double >& values ) const if ( j >= poolStartIndex_ && j < poolStartIndex_ + numLocalPools_ ){ vector< double >::const_iterator q = pools_[ j - poolStartIndex_ ].getNvec().begin(); - + values.insert( values.end(), q + startVoxel, q + startVoxel + numVoxels ); } @@ -863,7 +863,7 @@ 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_ ){ - vector< double >::const_iterator + vector< double >::const_iterator q = values.begin() + 4 + i * numVoxels; pools_[ j - poolStartIndex_ ].setNvec( startVoxel, numVoxels, q ); } diff --git a/moose-core/diffusion/Dsolve.h b/moose-core/diffusion/Dsolve.h index 91b4594f2517f5f87b1535a4d687f80555668080..0a16e7727432fe9aea86e117512e02a12d9c2caa 100644 --- a/moose-core/diffusion/Dsolve.h +++ b/moose-core/diffusion/Dsolve.h @@ -12,11 +12,11 @@ /** * The Dsolve manages a large number of pools, each inhabiting a large - * number of voxels that are shared for all the pools. + * number of voxels that are shared for all the pools. * Each pool is represented by an array of concs, one for each voxel. * Each such array is kept on a single node for efficient solution. * The different pool arrays are assigned to different nodes for balance. - * All pool arrays + * All pool arrays * We have the parent Dsolve as a global. It constructs the diffusion * matrix from the NeuroMesh and generates the opvecs. * We have the child DiffPoolVec as a local. Each one contains a @@ -28,7 +28,7 @@ */ class Dsolve: public ZombiePoolInterface { - public: + public: Dsolve(); ~Dsolve(); @@ -69,13 +69,13 @@ class Dsolve: public ZombiePoolInterface /** * Builds junctions between Dsolves handling NeuroMesh, SpineMesh, - * and PsdMesh. Must only be called from the one handling the - * NeuroMesh. + * and PsdMesh. Must only be called from the one handling the + * NeuroMesh. * These junctions handle diffusion between different meshes. * Note that a single NeuroMesh may contact many spines which are * all in a single SpineMesh. Likewise each spine has a single * PSD, but there are many spines in the SpineMesh and matching - * psds in the PsdMesh. Finally, note that + * psds in the PsdMesh. Finally, note that * there may be many molecules which diffuse across each diffusion * junction. */ @@ -89,7 +89,7 @@ class Dsolve: public ZombiePoolInterface void buildMeshJunctions( const Eref& e, Id other ); /** - * buildMeshJunctions is the inner utility function for building + * buildMeshJunctions is the inner utility function for building * the junction between any specified pair of Dsolves. * Note that it builds the junction on the 'self' Dsolve. */ @@ -99,7 +99,7 @@ class Dsolve: public ZombiePoolInterface * Computes flux through a junction between diffusion solvers. * Most used at junctions on spines and PSDs, but can also be used * when a given diff solver is decomposed. At present the lookups - * on the other diffusion solver assume that the data is on the + * on the other diffusion solver assume that the data is on the * local node. Once this works well I can figure out how to do * across nodes. */ @@ -125,9 +125,9 @@ class Dsolve: public ZombiePoolInterface void setBlock( const vector< double >& values ); // This one isn't used in Dsolve, but is defined as a dummy. - void setupCrossSolverReacs( + void setupCrossSolverReacs( const map< Id, vector< Id > >& xr, Id otherStoich ); - void setupCrossSolverReacVols( + void setupCrossSolverReacVols( const vector< vector< Id > >& subCompts, const vector< vector< Id > >& prdCompts ); void filterCrossRateTerms( const vector< pair< Id, Id > >& xrt ); @@ -140,16 +140,16 @@ class Dsolve: public ZombiePoolInterface unsigned int convertIdToPoolIndex( const Eref& e ) const; unsigned int getPoolIndex( const Eref& e ) const; - /** - * Fills in poolMap_ using elist of objects found when the + /** + * Fills in poolMap_ using elist of objects found when the * 'setPath' function is executed. temp is returned with the * list of PoolBase objects that exist on the path. */ void makePoolMapFromElist( const vector< ObjId >& elist, vector< Id >& temp ); - /** - * This key function does the work of setting up the Dsolve. + /** + * This key function does the work of setting up the Dsolve. * Should be called after the compartment has been attached to * the Dsolve, and the stoich is assigned. * Called during the setStoich function. @@ -167,7 +167,7 @@ class Dsolve: public ZombiePoolInterface private: /// Path of pools managed by Dsolve, may include other classes too. - string path_; + string path_; /// Timestep used by diffusion calculations. double dt_; @@ -188,7 +188,7 @@ class Dsolve: public ZombiePoolInterface /** * Lists all the diffusion junctions managed by this Dsolve. - * Each junction entry provides the info needed to do the + * Each junction entry provides the info needed to do the * numerical integration for flux between the Dsolves. */ vector< DiffJunction > junctions_; diff --git a/moose-core/diffusion/FastMatrixElim.cpp b/moose-core/diffusion/FastMatrixElim.cpp index 3e76ad54fb40f2b960792edc8477e5e0a1ec700e..2076ab952c5ecba94f693e02f0ceaf60598690f1 100644 --- a/moose-core/diffusion/FastMatrixElim.cpp +++ b/moose-core/diffusion/FastMatrixElim.cpp @@ -38,11 +38,11 @@ FastMatrixElim::FastMatrixElim( const SparseMatrix< double >& orig ) : SparseMatrix< double >( orig ) {;} -void sortByColumn( +void sortByColumn( vector< unsigned int >& col, vector< double >& entry ); void testSorting(); -// +// // static unsigned int parents[] = { 1,6,3,6,5,8,7,8,9,10,-1}; // unsigned int numKids[] = {0,1,0,1,0,2, @@ -53,18 +53,18 @@ bool FastMatrixElim::checkSymmetricShape() const FastMatrixElim temp = *this; temp.transpose(); return ( - nrows_ == temp.nrows_ && + nrows_ == temp.nrows_ && ncolumns_ == temp.ncolumns_ && N_.size() == temp.N_.size() && rowStart_ == temp.rowStart_ && - colIndex_ == temp.colIndex_ + colIndex_ == temp.colIndex_ ); } bool FastMatrixElim::operator==( const FastMatrixElim& other ) const { - if ( - nrows_ == other.nrows_ && + if ( + nrows_ == other.nrows_ && ncolumns_ == other.ncolumns_ && N_.size() == other.N_.size() && rowStart_ == other.rowStart_ && @@ -77,7 +77,7 @@ bool FastMatrixElim::operator==( const FastMatrixElim& other ) const return false; } -bool FastMatrixElim::isSymmetric() const +bool FastMatrixElim::isSymmetric() const { FastMatrixElim temp = *this; temp.transpose(); @@ -86,8 +86,8 @@ bool FastMatrixElim::isSymmetric() const /** * Scans the current matrix starting from index 0, to build tree of parent - * voxels using the contents of the sparase matrix to indicate - * connectivity. Emits warning noises and returns an empty vector if + * voxels using the contents of the sparase matrix to indicate + * connectivity. Emits warning noises and returns an empty vector if * the entire tree cannot be traversed, or * if the current matrix is not tree-like. * This still doesn't work. Fails because it cannot detect branches in @@ -99,8 +99,8 @@ bool FastMatrixElim::buildTree( unsigned int parentRow, assert( nRows() == nColumns() ); if ( parentRow == 0 ) { parentVoxel.assign( nRows, EMPTY_VOXEL ); - if ( !checkSymmetricShape() ) - return false; // shape of matrix should be symmetric. + if ( !checkSymmetricShape() ) + return false; // shape of matrix should be symmetric. } const double* entry; const unsigned int* colIndex; @@ -132,16 +132,16 @@ bool FastMatrixElim::buildTree( unsigned int parentRow, */ /** - * Reorders rows and columns to put the matrix in the form suitable for + * Reorders rows and columns to put the matrix in the form suitable for * rapid single-pass inversion. Returns 0 on failure, but at this * point I don't have a proper test for this. */ -bool FastMatrixElim::hinesReorder( +bool FastMatrixElim::hinesReorder( const vector< unsigned int >& parentVoxel, vector< unsigned int >& lookupOldRowFromNew ) { - // First we fill in the vector that specifies the old row number + // First we fill in the vector that specifies the old row number // assigned to each row of the reordered matrix. assert( parentVoxel.size() == nrows_ ); lookupOldRowFromNew.clear(); @@ -190,7 +190,7 @@ bool FastMatrixElim::hinesReorder( // Fill in the reordered matrix. Note we need to reorder columns too. -void FastMatrixElim::shuffleRows( +void FastMatrixElim::shuffleRows( const vector< unsigned int >& lookupOldRowFromNew ) { vector< unsigned int > lookupNewRowFromOld( nrows_ ); @@ -224,7 +224,7 @@ void sortByColumn( vector< unsigned int >& col, vector< double >& entry ) { unsigned int num = col.size(); assert( num == entry.size() ); - // Stupid bubble sort, as we only have up to 5 entries and need to + // Stupid bubble sort, as we only have up to 5 entries and need to // sort both the col and reorder the entries by the same sequence. for ( unsigned int i = 0; i < num; ++i ) { for ( unsigned int j = 1; j < num; ++j ) { @@ -241,7 +241,7 @@ void sortByColumn( vector< unsigned int >& col, vector< double >& entry ) } -void FastMatrixElim::makeTestMatrix( +void FastMatrixElim::makeTestMatrix( const double* test, unsigned int numCompts ) { setSize( numCompts, numCompts ); @@ -266,10 +266,10 @@ back-substitution. */ /** - * Builds the vector of forward ops: ratio, i, j - * RHS[i] = RHS[i] - RHS[j] * ratio + * Builds the vector of forward ops: ratio, i, j + * RHS[i] = RHS[i] - RHS[j] * ratio * This vec tells the routine which rows below have to be eliminated. - * This includes the rows if any in the tridiagonal band and also + * This includes the rows if any in the tridiagonal band and also * rows, if any, on branches. */ void FastMatrixElim::buildForwardElim( vector< unsigned int >& diag, @@ -324,26 +324,26 @@ void FastMatrixElim::buildForwardElim( vector< unsigned int >& diag, cout << endl; } for ( unsigned int i = 0; i < fops.size(); ++i ) { - cout << "fops[" << i << "]= " << fops[i].b_ << " " << fops[i].c_ << + cout << "fops[" << i << "]= " << fops[i].b_ << " " << fops[i].c_ << " " << fops[i].a_ << endl; } */ } -/** +/** * Operations to be done on the RHS for the back sub are generated and - * put into the bops (backward ops) vector. - * col > row here, row is the entry being operated on, and col is given by + * put into the bops (backward ops) vector. + * col > row here, row is the entry being operated on, and col is given by * rowsToSub. - * offDiagVal is the value on the off-diagonal at row,col. - * diagVal is the value on the diagonal at [row][row]. + * offDiagVal is the value on the off-diagonal at row,col. + * diagVal is the value on the diagonal at [row][row]. * RHS[row] = ( RHS[row] - offDiagVal * RHS[col] ) / diagVal */ void FastMatrixElim::buildBackwardSub( vector< unsigned int >& diag, vector< Triplet< double > >& bops, vector< double >& diagVal ) { // This vec tells the routine which rows below have to be back-subbed. - // This includes the rows if any in the tridiagonal band and also + // This includes the rows if any in the tridiagonal band and also // rows, if any, on branches. vector< vector< unsigned int > > rowsToSub( nrows_ ); @@ -384,7 +384,7 @@ void FastMatrixElim::buildBackwardSub( vector< unsigned int >& diag, /* for ( unsigned int i = 0; i < bops.size(); ++i ) { - cout << i << ": " << bops[i].a_ << " " << + cout << i << ": " << bops[i].a_ << " " << bops[i].b_ << " " << // diagonal index bops[i].c_ << " " << // off-diagonal index 1.0 / diagVal[bops[i].b_] << // diagonal value. @@ -402,18 +402,18 @@ void FastMatrixElim::buildBackwardSub( vector< unsigned int >& diag, * Note that there will be only one parent term but possibly many * distal terms. */ -void FastMatrixElim::setDiffusionAndTransport( +void FastMatrixElim::setDiffusionAndTransport( const vector< unsigned int >& parentVoxel, double diffConst, double motorConst, double dt ) { - FastMatrixElim m; + FastMatrixElim m; m.nrows_ = m.ncolumns_ = nrows_; m.rowStart_.resize( nrows_ + 1 ); m.rowStart_[0] = 0; for ( unsigned int i = 1; i <= nrows_; ++i ) { // Insert an entry for diagonal in each. - m.rowStart_[i] = rowStart_[i] + i; + m.rowStart_[i] = rowStart_[i] + i; } for ( unsigned int i = 0; i < nrows_; ++i ) { double proximalTerms = 0.0; @@ -454,9 +454,9 @@ void FastMatrixElim::setDiffusionAndTransport( m.N_.push_back( 0 ); // placeholder } assert( diagonalIndex != EMPTY_VOXEL ); - m.N_[diagonalIndex] = 1.0 - dt * ( + m.N_[diagonalIndex] = 1.0 - dt * ( diffConst * ( proximalTerms + distalTerms ) + - motorConst * distalTerms + motorConst * distalTerms ); } *this = m; @@ -488,7 +488,7 @@ void FastMatrixElim::advance( vector< double >& y, * static function. Reorders the ops and diagVal vectors so as to restore * the original indexing of the input vectors. */ -void FastMatrixElim::opsReorder( +void FastMatrixElim::opsReorder( const vector< unsigned int >& lookupOldRowsFromNew, vector< Triplet< double > >& ops, vector< double >& diagVal ) @@ -531,11 +531,11 @@ void buildColIndex( unsigned int nrows, } } -/** +/** * Motor transport into branches is divided between the child branches * in proportion to their area. This function computes these proportions. */ -void findAreaProportion( vector< double >& areaProportion, +void findAreaProportion( vector< double >& areaProportion, const vector< unsigned int >& parentVoxel, const vector< double >& area ) { @@ -554,7 +554,7 @@ void findAreaProportion( vector< double >& areaProportion, } /// This function makes the diffusion matrix. -bool FastMatrixElim::buildForDiffusion( +bool FastMatrixElim::buildForDiffusion( const vector< unsigned int >& parentVoxel, const vector< double >& volume, const vector< double >& area, @@ -562,7 +562,7 @@ bool FastMatrixElim::buildForDiffusion( double diffConst, double motorConst, double dt ) { // Too slow to matter. - if ( diffConst < 1e-18 && fabs( motorConst ) < 1e-12 ) + if ( diffConst < 1e-18 && fabs( motorConst ) < 1e-12 ) return false; assert( nrows_ == parentVoxel.size() ); assert( nrows_ == volume.size() ); @@ -611,7 +611,7 @@ bool FastMatrixElim::buildForDiffusion( e[j] += 1.0; // term for self. } else { // Not diagonal. // Fill in diffusion from this entry to i. - e[j] = diffConst * + e[j] = diffConst * (area[i] + a)/(length[i] + len )/vol; // Fill in motor transport diff --git a/moose-core/diffusion/FastMatrixElim.h b/moose-core/diffusion/FastMatrixElim.h index e1fb6fa49973a0888f65a70cfe56f6c91bfe60ec..e05fa4b1fc917f3396f7e1e71265d8b7b594aded 100644 --- a/moose-core/diffusion/FastMatrixElim.h +++ b/moose-core/diffusion/FastMatrixElim.h @@ -18,27 +18,27 @@ class FastMatrixElim: public SparseMatrix< double > /** * Recursively scans the current matrix, to build tree of parent - * voxels using the contents of the sparase matrix to indicate - * connectivity. Emits warning noises and returns an empty vector if + * voxels using the contents of the sparase matrix to indicate + * connectivity. Emits warning noises and returns an empty vector if * the entire tree cannot be traversed, or * if the current matrix is not tree-like. - * Assumes row 0 is root row. User should always call with + * Assumes row 0 is root row. User should always call with * parentRow == 0; - * Doesn't work yet. + * Doesn't work yet. bool buildTree( unsigned int parentRow, vector< unsigned int >& parentVoxel ) const; */ - /** + /** * Reduces the forward elimination phase into a series of operations - * defined by the fops vector. + * defined by the fops vector. */ void buildForwardElim( vector< unsigned int >& diag, vector< Triplet< double > >& fops ); - /** - * Reduces the backward substitution phase into a series of + /** + * Reduces the backward substitution phase into a series of * operations defined by the bops vector, and by the list of - * values on the diagonal. + * values on the diagonal. */ void buildBackwardSub( vector< unsigned int >& diag, vector< Triplet< double > >& bops, vector< double >& diagVal ); @@ -59,18 +59,18 @@ class FastMatrixElim: public SparseMatrix< double > * static function. Reorders the ops and diagVal vectors so as to * restore the original indexing of the input vectors. */ - static void opsReorder( + static void opsReorder( const vector< unsigned int >& lookupOldRowsFromNew, vector< Triplet< double > >& ops, vector< double >& diagVal ); /** - * Reorders rows of the matrix according to the vector + * Reorders rows of the matrix according to the vector * lookupOldRowFromNew. The vector tells the function which old * row to put in the ith row of the new matrix. Since the * matrix has matching column entries, those get shuffled too. */ - void shuffleRows( + void shuffleRows( const vector< unsigned int >& lookupOldRowFromNew ); /** @@ -86,7 +86,7 @@ class FastMatrixElim: public SparseMatrix< double > * This function incorporates molecule-specific diffusion and * motor transport terms into the matrix. */ - void setDiffusionAndTransport( + void setDiffusionAndTransport( const vector< unsigned int >& parentVoxel, double diffConst, double motorConst, double dt ); @@ -94,7 +94,7 @@ class FastMatrixElim: public SparseMatrix< double > * This function makes the matrix for computing diffusion and * transport equations. */ - bool buildForDiffusion( + bool buildForDiffusion( const vector< unsigned int >& parentVoxel, const vector< double >& volume, const vector< double >& area, @@ -111,7 +111,7 @@ class FastMatrixElim: public SparseMatrix< double > const vector< double >& diagVal ); }; -void sortByColumn( +void sortByColumn( vector< unsigned int >& col, vector< double >& entry ); // Todo: Maintain an internal vector of the mapping between rows so that diff --git a/moose-core/diffusion/standaloneTestFastElim.cpp b/moose-core/diffusion/standaloneTestFastElim.cpp index 0ab8aee90cbb9c81265ec69d11047760c630c3c5..9e4eb675ffd734802186728e693dba0799662777 100644 --- a/moose-core/diffusion/standaloneTestFastElim.cpp +++ b/moose-core/diffusion/standaloneTestFastElim.cpp @@ -1,5 +1,5 @@ // To compile: -// g++ standaloneTestFastElim.cpp -lgsl -lgslcblas +// g++ standaloneTestFastElim.cpp -lgsl -lgslcblas #include <vector> @@ -17,7 +17,7 @@ const unsigned int SM_MAX_ROWS = 200000; const unsigned int SM_MAX_COLUMNS = 200000; const unsigned int SM_RESERVE = 8; -void sortByColumn( +void sortByColumn( vector< unsigned int >& col, vector< double >& entry ); void testSorting(); @@ -25,7 +25,7 @@ class Unroll { public: Unroll( double diag, double off, unsigned int i, unsigned int j ) - : + : diagVal( diag ), offDiagVal( off ), row( i ), @@ -42,7 +42,7 @@ class FastElim: public SparseMatrix< double > public: void makeTestMatrix( const double* test, unsigned int numCompts ); /* - void rowElim( unsigned int row1, unsigned int row2, + void rowElim( unsigned int row1, unsigned int row2, vector< double >& rhs ); */ void buildForwardElim( vector< unsigned int >& diag, @@ -54,17 +54,17 @@ class FastElim: public SparseMatrix< double > ///////////////////////////////////////////////////////////// bool hinesReorder( const vector< unsigned int >& parentVoxel ); const double* allEntries() const; - void shuffleRows( + void shuffleRows( const vector< unsigned int >& lookupOldRowFromNew ); /* bool hinesReorder(); - void extractTwig( unsigned int i, + void extractTwig( unsigned int i, vector< unsigned int >& rowReorder, vector< bool >& extracted ); void findClosedEnds( vector< unsigned int >& rowReorder, vector< bool >& extracted ); - void extractClosedEnds( unsigned int i, + void extractClosedEnds( unsigned int i, vector< unsigned int >& rowReorder, vector< bool >& extracted ); */ @@ -74,17 +74,17 @@ const double* FastElim::allEntries() const { return &N_[0]; } -// +// // static unsigned int parents[] = { 1,6,3,6,5,8,7,8,9,10,-1}; // unsigned int numKids[] = {0,1,0,1,0,2, /** - * Reorders rows and columns to put the matrix in the form suitable for + * Reorders rows and columns to put the matrix in the form suitable for * rapid single-pass inversion. Returns 0 on failure. */ bool FastElim::hinesReorder( const vector< unsigned int >& parentVoxel ) { - // First we fill in the vector that specifies the old row number + // First we fill in the vector that specifies the old row number // assigned to each row of the reordered matrix. assert( parentVoxel.size() == nrows_ ); vector< unsigned int > numKids( nrows_, 0 ); @@ -129,7 +129,7 @@ bool FastElim::hinesReorder( const vector< unsigned int >& parentVoxel ) } // Fill in the reordered matrix. Note we need to reorder columns too. -void FastElim::shuffleRows( +void FastElim::shuffleRows( const vector< unsigned int >& lookupOldRowFromNew ) { vector< unsigned int > lookupNewRowFromOld( nrows_ ); @@ -163,7 +163,7 @@ void sortByColumn( vector< unsigned int >& col, vector< double >& entry ) { unsigned int num = col.size(); assert( num == entry.size() ); - // Stupid bubble sort, as we only have up to 5 entries and need to + // Stupid bubble sort, as we only have up to 5 entries and need to // sort both the col and reorder the entries by the same sequence. for ( unsigned int i = 0; i < num; ++i ) { for ( unsigned int j = 1; j < num; ++j ) { @@ -189,11 +189,11 @@ bool FastElim::hinesReorder() extractTwig( i, rowReorder, extracted ); } // List of rows that now have all sub-branches extracted - vector< unsigned int > closedEnds; + vector< unsigned int > closedEnds; do { closedEnds.resize( 0 ); findClosedEnds( closedEnds, extracted ); - for ( vector< unsigned int >::iterator + for ( vector< unsigned int >::iterator i = closedEnds.begin(); i != closedEnds.end(); ++i ) { extractClosedEnds( *i, rowReorder, extracted ); } @@ -203,7 +203,7 @@ bool FastElim::hinesReorder() /** * Finds the 'twigs' of the matrix: Only one end connected. -void FastElim::extractTwig( unsigned int i, +void FastElim::extractTwig( unsigned int i, vector< unsigned int >& rowReorder, vector< bool >& extracted ) { @@ -217,7 +217,7 @@ void FastElim::findClosedEnds( ; } -void FastElim::extractClosedEnds( unsigned int i, +void FastElim::extractClosedEnds( unsigned int i, vector< unsigned int >& rowReorder, vector< bool >& extracted ) { @@ -226,7 +226,7 @@ void FastElim::extractClosedEnds( unsigned int i, */ /* -void FastElim::rowElim( unsigned int row1, unsigned int row2, +void FastElim::rowElim( unsigned int row1, unsigned int row2, vector< double >& rhs ) { unsigned int rs1 = rowStart_[row1]; @@ -239,14 +239,14 @@ void FastElim::rowElim( unsigned int row1, unsigned int row2, double r = temp/diag1; const double* p1 = &(N_[ diagIndex_[row1] + 1 ] ); - double* p2 = N_ + - for ( unsigned int i = + double* p2 = N_ + + for ( unsigned int i = N_[rs2+1] double* v1 = N_ + rs1; double* v2 = N_ + rs2; - - + + v2' - v1'*v2/v1 } @@ -277,10 +277,10 @@ back-substitution. */ /** - * Builds the vector of forward ops: ratio, i, j - * RHS[i] = RHS[i] - RHS[j] * ratio + * Builds the vector of forward ops: ratio, i, j + * RHS[i] = RHS[i] - RHS[j] * ratio * This vec tells the routine which rows below have to be eliminated. - * This includes the rows if any in the tridiagonal band and also + * This includes the rows if any in the tridiagonal band and also * rows, if any, on branches. */ void FastElim::buildForwardElim( vector< unsigned int >& diag, @@ -333,27 +333,27 @@ void FastElim::buildForwardElim( vector< unsigned int >& diag, cout << endl; } for ( unsigned int i = 0; i < fops.size(); ++i ) { - cout << "fops[" << i << "]= " << fops[i].b_ << " " << fops[i].c_ << + cout << "fops[" << i << "]= " << fops[i].b_ << " " << fops[i].c_ << " " << fops[i].a_ << endl; } /* */ } -/** +/** * Operations to be done on the RHS for the back sub are generated and - * put into the bops (backward ops) vector. - * col > row here, row is the entry being operated on, and col is given by + * put into the bops (backward ops) vector. + * col > row here, row is the entry being operated on, and col is given by * rowsToSub. - * offDiagVal is the value on the off-diagonal at row,col. - * diagVal is the value on the diagonal at [row][row]. + * offDiagVal is the value on the off-diagonal at row,col. + * diagVal is the value on the diagonal at [row][row]. * RHS[row] = ( RHS[row] - offDiagVal * RHS[col] ) / diagVal */ void FastElim::buildBackwardSub( vector< unsigned int >& diag, vector< Triplet< double > >& bops, vector< double >& diagVal ) { // This vec tells the routine which rows below have to be back-subbed. - // This includes the rows if any in the tridiagonal band and also + // This includes the rows if any in the tridiagonal band and also // rows, if any, on branches. vector< vector< unsigned int > > rowsToSub( nrows_ ); @@ -391,7 +391,7 @@ void FastElim::buildBackwardSub( vector< unsigned int >& diag, } for ( unsigned int i = 0; i < bops.size(); ++i ) { - cout << i << ": " << bops[i].a_ << " " << + cout << i << ": " << bops[i].a_ << " " << bops[i].b_ << " " << // diagonal index bops[i].c_ << " " << // off-diagonal index 1.0 / diagVal[bops[i].b_] << // diagonal value. @@ -414,8 +414,8 @@ void advance( vector< double >& y, *iy++ *= *i; } -double checkAns( - const double* m, unsigned int numCompts, +double checkAns( + const double* m, unsigned int numCompts, const double* ans, const double* rhs ) { vector< double > check( numCompts, 0.0 ); @@ -446,15 +446,15 @@ main() 1 2 3 4 5 6 7 8 9 10 11 1 x x x x -2 x x +2 x x 3 x x x x 4 x x x x 5 x x x x 6 x x x x 7 x x x -8 x x -9 x x x x -10 x x +8 x x +9 x x x x +10 x x 11 x x static double test[] = { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, @@ -601,14 +601,14 @@ Linear cable, 12 segments. cout << "y" << i << "]= " << y[i] << endl; // Here we verify the answer - + vector< double > alle; for( unsigned int i = 0; i < numCompts; ++i ) { for( unsigned int j = 0; j < numCompts; ++j ) { alle.push_back( foo.get( i, j ) ); } } - cout << "myCode: " << + cout << "myCode: " << checkAns( &alle[0], numCompts, &y[0], &ones[0] ) << endl; @@ -649,7 +649,7 @@ void testSorting() sortByColumn( col, entry ); cout << "testing sorting\n"; for ( int i = 0; i < col.size(); ++i ) { - cout << "d[" << i << "]= " << k[i] << + cout << "d[" << i << "]= " << k[i] << ", col[" << i << "]= " << col[i] << ", e=" << entry[i] << endl; } cout << endl; diff --git a/moose-core/diffusion/testDiffusion.cpp b/moose-core/diffusion/testDiffusion.cpp index b4f61d9e32f7bb42f0962f11cca9769b11350d6a..f887cff1d966d407389c7dde0c1ceead895e0bd7 100644 --- a/moose-core/diffusion/testDiffusion.cpp +++ b/moose-core/diffusion/testDiffusion.cpp @@ -26,8 +26,8 @@ using namespace std; -double checkAns( - const double* m, unsigned int numCompts, +double checkAns( + const double* m, unsigned int numCompts, const double* ans, const double* rhs ) { vector< double > check( numCompts, 0.0 ); @@ -58,15 +58,15 @@ void testFastMatrixElim() 1 2 3 4 5 6 7 8 9 10 11 1 x x x x -2 x x +2 x x 3 x x x x 4 x x x x 5 x x x x 6 x x x x 7 x x x -8 x x -9 x x x x -10 x x +8 x x +9 x x x x +10 x x 11 x x static double test[] = { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, @@ -213,7 +213,7 @@ Linear cable, 12 segments. */ // Here we verify the answer - + vector< double > alle; for( unsigned int i = 0; i < numCompts; ++i ) { for( unsigned int j = 0; j < numCompts; ++j ) { @@ -277,7 +277,7 @@ void testSorting() /* cout << "testing sorting\n"; for ( unsigned int i = 0; i < col.size(); ++i ) { - cout << "d[" << i << "]= " << k[i] << + cout << "d[" << i << "]= " << k[i] << ", col[" << i << "]= " << col[i] << ", e=" << entry[i] << endl; } cout << endl; @@ -330,7 +330,7 @@ void testSetDiffusionAndTransport() assert( doubleEq( fm.get( i, j ), 0.8 ) ); else if ( i == numCompts - 1 ) assert( doubleEq( fm.get( i, j ), -0.1 ) ); - else + else assert( doubleEq( fm.get( i, j ), -0.3 ) ); } } @@ -347,7 +347,7 @@ void testCylDiffn() double diffLength = 1e-6; // 1e-6 is the highest dx for which error is OK double runtime = 10.0; double dt = 0.1; // 0.2 is the highest dt for which the error is in bounds - double diffConst = 1.0e-12; + double diffConst = 1.0e-12; Id model = s->doCreate( "Neutral", Id(), "model", 1 ); Id cyl = s->doCreate( "CylMesh", model, "cyl", 1 ); Field< double >::set( cyl, "r0", r0 ); @@ -374,15 +374,15 @@ void testCylDiffn() assert( doubleEq( poolVec[0], 1.0 ) ); assert( doubleEq( poolVec[1], 0.0 ) ); - vector< double > nvec = - LookupField< unsigned int, vector< double > >::get( + vector< double > nvec = + LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); assert( nvec.size() == ndc ); s->doReinit(); s->doStart( runtime ); - nvec = LookupField< unsigned int, vector< double > >::get( + nvec = LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); Field< double >::getVec( pool, "n", poolVec ); assert( nvec.size() == poolVec.size() ); @@ -403,13 +403,13 @@ void testCylDiffn() double x = i * dx + dx * 0.5; // This part is the solution as a func of x,t. double y = dx * // This part represents the init n of 1 in dx - ( 1.0 / sqrt( PI * diffConst * runtime ) ) * - exp( -x * x / ( 4 * diffConst * runtime ) ); + ( 1.0 / sqrt( PI * diffConst * runtime ) ) * + exp( -x * x / ( 4 * diffConst * runtime ) ); err += ( y - nvec[i] ) * ( y - nvec[i] ); //cout << i << " " << x << " " << y << " " << conc[i] << endl; analyticTot += y; myTot += nvec[i]; - } + } assert( doubleEq( myTot, 1.0 ) ); // cout << "analyticTot= " << analyticTot << ", myTot= " << myTot << endl; assert( err < 1.0e-5 ); @@ -428,9 +428,9 @@ void testTaperingCylDiffn() double diffLength = 1e-6; // 1e-6 is the highest dx for which error is OK double runtime = 10.0; double dt = 0.1; // 0.2 is the highest dt for which the error is in bounds - double diffConst = 1.0e-12; + double diffConst = 1.0e-12; // Should set explicitly, currently during creation of DiffPoolVec - //double diffConst = 1.0e-12; + //double diffConst = 1.0e-12; Id model = s->doCreate( "Neutral", Id(), "model", 1 ); Id cyl = s->doCreate( "CylMesh", model, "cyl", 1 ); Field< double >::set( cyl, "r0", r0 ); @@ -461,7 +461,7 @@ void testTaperingCylDiffn() Field< double >::getVec( pool, "n", poolVec ); for ( unsigned int i = 0; i < poolVec.size(); ++i ) { myTot += poolVec[i]; - } + } assert( doubleEq( myTot, 1.0 ) ); s->doDelete( model ); @@ -493,7 +493,7 @@ void testTaperingCylDiffn() * t21 0 0 0 0 0 0 0 1 # 0 0 * b20 0 0 1 c 0 0 0 0 0 # 1 * b21 0 0 0 0 0 0 0 0 0 1 # - * + * */ void testSmallCellDiffn() { @@ -505,7 +505,7 @@ void testSmallCellDiffn() double diffLength = 10e-6; double dt = 1.0e-1; double runtime = 100.0; - double diffConst = 1.0e-12; + double diffConst = 1.0e-12; Id model = s->doCreate( "Neutral", Id(), "model", 1 ); Id soma = makeCompt( Id(), model, "soma", dia, dia, 90 ); Id dend = makeCompt( soma, model, "dend", len, 3e-6, 0 ); @@ -537,8 +537,8 @@ void testSmallCellDiffn() // Next: build diffusion by setting path Field< string >::set( dsolve, "path", "/model/neuromesh/pool#" ); - vector< double > nvec = - LookupField< unsigned int, vector< double > >::get( + vector< double > nvec = + LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); assert( nvec.size() == ndc ); assert( pool1.element()->numData() == ndc ); @@ -547,13 +547,13 @@ void testSmallCellDiffn() Field< double >::set( ObjId( pool3, 0 ), "nInit", 3.0 ); s->doReinit(); - nvec = LookupField< unsigned int, vector< double > >::get( + nvec = LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); assert( doubleEq( nvec[0], 1.0 ) ); assert( doubleEq( nvec[1], 0.0 ) ); s->doStart( runtime ); - nvec = LookupField< unsigned int, vector< double > >::get( + nvec = LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); vector< double > pool1Vec; Field< double >::getVec( pool1, "n", pool1Vec ); @@ -602,7 +602,7 @@ void testCellDiffn() double diffLength = 1e-6; double dt = 1.0e-1; double runtime = 100.0; - double diffConst = 1.0e-12; + double diffConst = 1.0e-12; Id model = s->doCreate( "Neutral", Id(), "model", 1 ); Id soma = makeCompt( Id(), model, "soma", dia, dia, 90 ); Id dend = makeCompt( soma, model, "dend", len, 3e-6, 0 ); @@ -632,8 +632,8 @@ void testCellDiffn() // Next: build by setting path Field< string >::set( dsolve, "path", "/model/neuromesh/pool#" ); - vector< double > nvec = - LookupField< unsigned int, vector< double > >::get( + vector< double > nvec = + LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); assert( nvec.size() == ndc ); assert( pool1.element()->numData() == ndc ); @@ -643,7 +643,7 @@ void testCellDiffn() s->doReinit(); s->doStart( runtime ); - nvec = LookupField< unsigned int, vector< double > >::get( + nvec = LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); vector< double > pool1Vec; Field< double >::getVec( pool1, "n", pool1Vec ); @@ -685,7 +685,7 @@ void testCylDiffnWithStoich() double runtime = 10.0; double dt0 = 0.1; // Used for diffusion. 0.2 is the highest dt for which the error is in bounds double dt1 = 1; // Used for chem. - double diffConst = 1.0e-12; + double diffConst = 1.0e-12; Id model = s->doCreate( "Neutral", Id(), "model", 1 ); Id cyl = s->doCreate( "CylMesh", model, "cyl", 1 ); Field< double >::set( cyl, "r0", r0 ); @@ -718,8 +718,8 @@ void testCylDiffnWithStoich() assert( doubleEq( poolVec[0], 1.0 ) ); assert( doubleEq( poolVec[1], 0.0 ) ); - vector< double > nvec = - LookupField< unsigned int, vector< double > >::get( + vector< double > nvec = + LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); assert( nvec.size() == ndc ); @@ -731,7 +731,7 @@ void testCylDiffnWithStoich() s->doReinit(); s->doStart( runtime ); - nvec = LookupField< unsigned int, vector< double > >::get( + nvec = LookupField< unsigned int, vector< double > >::get( dsolve, "nVec", 0); Field< double >::getVec( pool1, "n", poolVec ); assert( nvec.size() == poolVec.size() ); @@ -752,13 +752,13 @@ void testCylDiffnWithStoich() double x = i * dx + dx * 0.5; // This part is the solution as a func of x,t. double y = dx * // This part represents the init n of 1 in dx - ( 1.0 / sqrt( PI * diffConst * runtime ) ) * - exp( -x * x / ( 4 * diffConst * runtime ) ); + ( 1.0 / sqrt( PI * diffConst * runtime ) ) * + exp( -x * x / ( 4 * diffConst * runtime ) ); err += ( y - nvec[i] ) * ( y - nvec[i] ); //cout << i << " " << x << " " << y << " " << conc[i] << endl; analyticTot += y; myTot += nvec[i]; - } + } assert( doubleEq( myTot, 1.0 ) ); // cout << "analyticTot= " << analyticTot << ", myTot= " << myTot << endl; assert( err < 1.0e-5 ); @@ -890,7 +890,7 @@ void testCalcJunction() assert( Field< unsigned int >::get( dendsolve, "numPools" ) == 3 ); assert( Field< unsigned int >::get( spinesolve, "numPools" ) == 3 ); assert( Field< unsigned int >::get( psdsolve, "numPools" ) == 3 ); - SetGet2< Id, Id >::set( dendsolve, "buildNeuroMeshJunctions", + SetGet2< Id, Id >::set( dendsolve, "buildNeuroMeshJunctions", spinesolve, psdsolve ); s->doSetClock( 0, 0.01 ); s->doUseClock( "/model/#solve", "process", 0 ); diff --git a/moose-core/examples/Ex.cpp b/moose-core/examples/Ex.cpp index 49fb32e2b0113e675f73ae3e53a23e07aa864931..761bb4f7bd7d06c01aad24cb6989871c71453a07 100644 --- a/moose-core/examples/Ex.cpp +++ b/moose-core/examples/Ex.cpp @@ -29,14 +29,14 @@ const Cinfo* Ex::initCinfo() &Ex::setN, &Ex::getN ); - + static ValueFinfo< Ex, double > x( "x", "Double element.", &Ex::setX, &Ex::getX ); - + // Lookup field def static LookupValueFinfo< Ex, unsigned int, double > values( "value", @@ -44,51 +44,51 @@ const Cinfo* Ex::initCinfo() &Ex::setVal, &Ex::getVal ); - + // Dest field def static DestFinfo handleX( "handleX", "Sets value of x_", new OpFunc1< Ex, double >(&Ex::handleX) ); - + static DestFinfo handleN( "handleN", "Sets value of n_", new OpFunc1< Ex, int >(&Ex::handleN) ); - + static DestFinfo handleValues( "handleValues", "Handle a vector of values", new OpFunc2< Ex, unsigned int, double >(&Ex::setVal) ); - + // Shared field def static DestFinfo process( "process", "Handles process call", new ProcOpFunc< Ex >(&Ex::process) ); - + static DestFinfo reinit( "reinit", "Handles reinit call", new ProcOpFunc< Ex >(&Ex::reinit) ); - + static Finfo* processShared[] = { &process, &reinit }; - + static SharedFinfo proc( "proc", "Handles 'reinit' and 'process' calls from a clock.", processShared, sizeof(processShared) / sizeof(Finfo*) ); - + static Finfo* exFinfos[] = { &n, &x, @@ -99,16 +99,16 @@ const Cinfo* Ex::initCinfo() outputOut(), &proc }; - + static Dinfo< Ex > exDinfo; - + static string doc[] = { "Name", "Ex", "Author", "Viktor Toth", - "Description", "Example Moose class.", + "Description", "Example Moose class.", }; - + static Cinfo exCinfo( "Ex", Neutral::initCinfo(), @@ -118,12 +118,12 @@ const Cinfo* Ex::initCinfo() doc, sizeof(doc) / sizeof(string) ); - + return &exCinfo; } static const Cinfo* exCinfo = Ex::initCinfo(); - + void Ex::process(const Eref& e, ProcPtr p) { for (vector<double>::iterator it = values_.begin(); it != values_.end(); ++it) @@ -169,7 +169,7 @@ double Ex::getVal(unsigned int index) const { throw "Out of index!"; } - + return values_[index]; } @@ -179,6 +179,6 @@ void Ex::setVal(unsigned int index, double val) { throw "Out of index!"; } - + values_[index] = val; } diff --git a/moose-core/examples/Ex.h b/moose-core/examples/Ex.h index 3ec7930ba23d1f41d90cd63cba10ac244ea51acf..4188bfa1128eb5258307b3d9407130203457902c 100644 --- a/moose-core/examples/Ex.h +++ b/moose-core/examples/Ex.h @@ -7,7 +7,7 @@ public: Ex(); ~Ex(); static const Cinfo* initCinfo(); - + void process(const Eref& e, ProcPtr p); void reinit(const Eref& e, ProcPtr p); @@ -19,14 +19,14 @@ public: double getVal(unsigned int index) const; void setVal(unsigned int index, double val); void getVal(unsigned int index, double val); - + void handleX(double x); void handleN(int n); - + private: double x_; int n_; vector< double > values_; }; -#endif \ No newline at end of file +#endif diff --git a/moose-core/examples/Example.cpp b/moose-core/examples/Example.cpp index de4a4d155f1ec9d65184c6e01b0656939d0ffec3..9f9609f887fd8612f763088cb56cb3c1f2ec6fdf 100644 --- a/moose-core/examples/Example.cpp +++ b/moose-core/examples/Example.cpp @@ -5,15 +5,15 @@ #include <stdio.h> static SrcFinfo1< double > *output() { - static SrcFinfo1< double > output( - "output", + static SrcFinfo1< double > output( + "output", "Sends out the computed value" ); return &output; } const Cinfo* Example::initCinfo(){ - + //Value Field Definitions static ValueFinfo< Example, double > x( "x", @@ -33,25 +33,25 @@ const Cinfo* Example::initCinfo(){ static DestFinfo handleX( "handleX", "Saves arg value to x_", new OpFunc1< Example, double >( &Example::handleX ) - ); + ); static DestFinfo handleY( "handleY", "Saves arg value to y_", new OpFunc1< Example, double >( &Example::handleY ) - ); + ); static DestFinfo process( "process", "Handles process call", - new ProcOpFunc< Example >( &Example::process ) + new ProcOpFunc< Example >( &Example::process ) ); static DestFinfo reinit( "reinit", "Handles reinit call", - new ProcOpFunc< Example >( &Example::reinit ) + new ProcOpFunc< Example >( &Example::reinit ) ); - - - static ReadOnlyLookupElementValueFinfo< Example, string, vector< Id > > fieldNeighbors( + + + static ReadOnlyLookupElementValueFinfo< Example, string, vector< Id > > fieldNeighbors( "fieldNeighbors", - "Ids of Elements connected this Element on specified field.", + "Ids of Elements connected this Element on specified field.", &Example::getNeighbors ); ////////////////////////////////////////////////////////////// @@ -66,8 +66,8 @@ const Cinfo* Example::initCinfo(){ ); - static Finfo *exampleFinfos[] = - { + static Finfo *exampleFinfos[] = + { &x, //Value &y, //Value &handleX, //DestFinfo @@ -90,7 +90,7 @@ const Cinfo* Example::initCinfo(){ static const Cinfo* exampleCinfo = Example::initCinfo(); Example::Example() - : + : output_( 0.0 ), x_( 0.0 ), y_( 0.0 ) { @@ -106,7 +106,7 @@ void Example::process( const Eref& e, ProcPtr p ) void Example::reinit( const Eref& e, ProcPtr p ) { - + } void Example::handleX(double arg ) @@ -146,7 +146,7 @@ vector< Id > Example::getNeighbors( const Eref& e, string field ) const if ( finfo ) e.element()->getNeighbors( ret, finfo ); else - cout << "Warning: Example::getNeighbors: Id.Field '" << + cout << "Warning: Example::getNeighbors: Id.Field '" << e.id().path() << "." << field << "' not found\n"; return ret; diff --git a/moose-core/examples/Example.h b/moose-core/examples/Example.h index ec5f552e9d1c4056580b963e15e944ef343b039d..e643506d098525bec27daaae72d8534a6dd95787 100644 --- a/moose-core/examples/Example.h +++ b/moose-core/examples/Example.h @@ -8,7 +8,7 @@ class Example { public: Example(); - + double getX() const; void setX( double x ); double getY() const; @@ -19,9 +19,9 @@ class Example { void handleX(double arg); void handleY(double arg); - + vector< Id > getNeighbors( const Eref& e, string field ) const; static const Cinfo* initCinfo(); -}; +}; diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos.hpp index 7434236bfd669ca5520aea8abd8e2a11d5b7c2ae..e9df212a16e21e5fa98f0b898addec3c1698ecbb 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos.hpp @@ -20,9 +20,9 @@ namespace boost { namespace numeric { namespace bindings { namespace amos { template < typename vector_type, typename value_type > int besi(const value_type& z, // std::complex< float > or std::complex< double > const typename traits::type_traits< value_type >::real_type fnu, // float or double - int kode, - vector_type& cy, - int& nz) + int kode, + vector_type& cy, + int& nz) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename traits::vector_traits<vector_type>::value_type >::value ) ) ; @@ -39,11 +39,11 @@ namespace boost { namespace numeric { namespace bindings { namespace amos { } template < typename vector_type, typename value_type > - int besj(const value_type& z, - const typename traits::type_traits< value_type >::real_type fnu, - int kode, - vector_type& cy, - int& nz) + int besj(const value_type& z, + const typename traits::type_traits< value_type >::real_type fnu, + int kode, + vector_type& cy, + int& nz) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename traits::vector_traits<vector_type>::value_type >::value ) ) ; @@ -60,11 +60,11 @@ namespace boost { namespace numeric { namespace bindings { namespace amos { } template < typename vector_type, typename value_type > - int besy(const value_type& z, - const typename traits::type_traits< value_type >::real_type fnu, - int kode, - vector_type& cy, - int& nz) + int besy(const value_type& z, + const typename traits::type_traits< value_type >::real_type fnu, + int kode, + vector_type& cy, + int& nz) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename traits::vector_traits<vector_type>::value_type >::value ) ) ; diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_names.h b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_names.h index 6eeff611ea1b35d6897cecab393f4d8fb7721c0e..032d0f9596a6e502f087aca22ed9821487364154 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_names.h +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_names.h @@ -11,9 +11,9 @@ #include <boost/numeric/bindings/traits/fortran.h> -#define AMOS_DBESI FORTRAN_ID( dbesi ) -#define AMOS_CBESI FORTRAN_ID( cbesi ) -#define AMOS_ZBESI FORTRAN_ID( zbesi ) +#define AMOS_DBESI FORTRAN_ID( dbesi ) +#define AMOS_CBESI FORTRAN_ID( cbesi ) +#define AMOS_ZBESI FORTRAN_ID( zbesi ) #define AMOS_DBESJ FORTRAN_ID( dbesj ) #define AMOS_CBESJ FORTRAN_ID( cbesj ) diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_overloads.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_overloads.hpp index 207b473a6e316b3bae798698c50290106cbcfac0..5be96b6375ba83b04c94fe68323c1b05ad98e397 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_overloads.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_overloads.hpp @@ -25,36 +25,36 @@ namespace boost { namespace numeric { namespace bindings { namespace amos { name //void besi(const fcomplex * z, const fcomplex * fnu, const int * kode, const int * n, fcomplex* cy, int * nz, int * error) ; inline - void besi(const double& z, const double& fnu, const int& kode, const int& n, double* cy, int& nz, int& error) + void besi(const double& z, const double& fnu, const int& kode, const int& n, double* cy, int& nz, int& error) { AMOS_DBESI( &z, &fnu, &kode, &n, cy, &nz ) ; } inline - void besi(const complex_f& z, const float& fnu, const int& kode, const int& n, complex_f* cy, int & nz, int & error) + void besi(const complex_f& z, const float& fnu, const int& kode, const int& n, complex_f* cy, int & nz, int & error) { AMOS_CBESI( complex_ptr( &z ), &fnu, &kode, &n, complex_ptr( cy ), &nz, &error ) ; } // inline // void besi(const complex_d* z, const double* fnu, const int * kode, const int * n, complex_d* cy, int * nz, int * error) ; - + // // BESJ // - + inline - void besj(const double& z, const double& fnu, const int& kode, const int& n, double* cy, int& nz, int& error) + void besj(const double& z, const double& fnu, const int& kode, const int& n, double* cy, int& nz, int& error) { AMOS_DBESJ( &z, &fnu, &n, cy, &nz ) ; } inline - void besj(const complex_f& z, const float& fnu, const int& kode, const int& n, complex_f* cy, int & nz, int & error) + void besj(const complex_f& z, const float& fnu, const int& kode, const int& n, complex_f* cy, int & nz, int & error) { AMOS_CBESJ( complex_ptr( &z ), &fnu, &kode, &n, complex_ptr( cy ), &nz, &error ) ; } - + // // BESY // - + inline - void besy(const double& z, const double& fnu, const int& kode, const int& n, double* cy, int& nz, double* wrk, int& error) + void besy(const double& z, const double& fnu, const int& kode, const int& n, double* cy, int& nz, double* wrk, int& error) { AMOS_DBESY( &z, &fnu, &n, cy ) ; } }}}}} diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas.hpp index 2e57cb883fd1a36b4906a6c7b91d314bef4286f3..b288c7a19caec72e05eddf83ca979858ed0d82e9 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -18,4 +18,4 @@ #include <boost/numeric/bindings/atlas/cblas2.hpp> #include <boost/numeric/bindings/atlas/cblas3.hpp> -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas1.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas1.hpp index 1159021362e9eb42e6d306fbdd0c02094495293f..9456c72029b0015720ffe911739699bdb11e65e3 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas1.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas1.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -23,214 +23,214 @@ #ifndef BOOST_NUMERIC_BINDINGS_NO_TYPE_CHECK # include <boost/type_traits/same_traits.hpp> # include <boost/static_assert.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { // x_i <- alpha for all i - template <typename T, typename Vct> - inline + template <typename T, typename Vct> + inline void set (T const& alpha, Vct& x) { - detail::set (traits::vector_size (x), alpha, - traits::vector_storage (x), traits::vector_stride (x)); + detail::set (traits::vector_size (x), alpha, + traits::vector_storage (x), traits::vector_stride (x)); } // y <- x template <typename VctX, typename VctY> - inline + inline void copy (VctX const& x, VctY& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); detail::copy (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), -#endif - traits::vector_stride (x), - traits::vector_storage (y), traits::vector_stride (y)); + traits::vector_storage_const (x), +#endif + traits::vector_stride (x), + traits::vector_storage (y), traits::vector_stride (y)); } // x <-> y template <typename VctX, typename VctY> - inline + inline void swap (VctX& x, VctY& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); detail::swap (traits::vector_size (x), - traits::vector_storage (x), traits::vector_stride (x), - traits::vector_storage (y), traits::vector_stride (y)); + traits::vector_storage (x), traits::vector_stride (x), + traits::vector_storage (y), traits::vector_stride (y)); } // x <- alpha * x - template <typename T, typename Vct> - inline + template <typename T, typename Vct> + inline void scal (T const& alpha, Vct& x) { #ifndef BOOST_NUMERIC_BINDINGS_NO_TYPE_CHECK typedef traits::vector_traits<Vct> vtraits; BOOST_STATIC_ASSERT( (boost::is_same<T, typename vtraits::value_type>::value - || - boost::is_same<T, + || + boost::is_same<T, typename traits::type_traits<typename vtraits::value_type>::real_type >::value )); -#endif - detail::scal (traits::vector_size (x), alpha, - traits::vector_storage (x), traits::vector_stride (x)); +#endif + detail::scal (traits::vector_size (x), alpha, + traits::vector_storage (x), traits::vector_stride (x)); } // y <- alpha * x + y template <typename T, typename VctX, typename VctY> - inline + inline void axpy (T const& alpha, VctX const& x, VctY& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); - detail::axpy (traits::vector_size (x), alpha, + detail::axpy (traits::vector_size (x), alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), - traits::vector_storage (y), traits::vector_stride (y)); + traits::vector_stride (x), + traits::vector_storage (y), traits::vector_stride (y)); } // y <- x + y template <typename VctX, typename VctY> - inline + inline void xpy (VctX const& x, VctY& y) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::vector_traits<VctX>::value_type val_t; + typedef typename traits::vector_traits<VctX>::value_type val_t; #else - typedef typename VctX::value_type val_t; + typedef typename VctX::value_type val_t; #endif - axpy ((val_t) 1, x, y); + axpy ((val_t) 1, x, y); } // y <- alpha * x + beta * y template <typename T, typename VctX, typename VctY> - inline - void axpby (T const& alpha, VctX const& x, - T const& beta, VctY& y) { + inline + void axpby (T const& alpha, VctX const& x, + T const& beta, VctY& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); - detail::axpby (traits::vector_size (x), alpha, + detail::axpby (traits::vector_size (x), alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), - beta, - traits::vector_storage (y), traits::vector_stride (y)); + traits::vector_stride (x), + beta, + traits::vector_storage (y), traits::vector_stride (y)); } /////////////////////////////////////////// - // dot <- x^T * y + // dot <- x^T * y // .. real & complex types template <typename VctX, typename VctY> - inline + inline #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits<VctX>::value_type + typename traits::vector_traits<VctX>::value_type #else - typename VctX::value_type + typename VctX::value_type #endif dot (VctX const& x, VctY const& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); return detail::dot (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), + traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif - traits::vector_stride (y)); + traits::vector_stride (y)); } - // dot <- x^T * y + // dot <- x^T * y // .. float only -- with double accumulation template <typename VctX, typename VctY> - inline + inline double dsdot (VctX const& x, VctY const& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); return cblas_dsdot (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), + traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif - traits::vector_stride (y)); + traits::vector_stride (y)); } - // apdot <- alpha + x^T * y - // .. float only -- computation uses double precision + // apdot <- alpha + x^T * y + // .. float only -- computation uses double precision template <typename VctX, typename VctY> - inline + inline float sdsdot (float const alpha, VctX const& x, VctY const& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); - return cblas_sdsdot (traits::vector_size (x), alpha, + return cblas_sdsdot (traits::vector_size (x), alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), + traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif - traits::vector_stride (y)); + traits::vector_stride (y)); } - // dotu <- x^T * y + // dotu <- x^T * y // .. complex types only // .. function template <typename VctX, typename VctY> - inline + inline #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits<VctX>::value_type + typename traits::vector_traits<VctX>::value_type #else - typename VctX::value_type + typename VctX::value_type #endif dotu (VctX const& x, VctY const& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::vector_traits<VctX>::value_type val; #else - typename VctX::value_type val; + typename VctX::value_type val; #endif detail::dotu (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), + traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif - traits::vector_stride (y), + traits::vector_stride (y), &val); - return val; + return val; } - // .. procedure + // .. procedure template <typename VctX, typename VctY> - inline - void dotu (VctX const& x, VctY const& y, + inline + void dotu (VctX const& x, VctY const& y, #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::vector_traits<VctX>::value_type& val #else @@ -240,57 +240,57 @@ namespace boost { namespace numeric { namespace bindings { assert (traits::vector_size (y) >= traits::vector_size (x)); detail::dotu (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), + traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif - traits::vector_stride (y), + traits::vector_stride (y), &val); } - // dotc <- x^H * y + // dotc <- x^H * y // .. complex types only // .. function template <typename VctX, typename VctY> - inline + inline #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits<VctX>::value_type + typename traits::vector_traits<VctX>::value_type #else - typename VctX::value_type + typename VctX::value_type #endif dotc (VctX const& x, VctY const& y) { assert (traits::vector_size (y) >= traits::vector_size (x)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::vector_traits<VctX>::value_type val; #else - typename VctX::value_type val; + typename VctX::value_type val; #endif detail::dotc (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), + traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), &val); - return val; + return val; } - // .. procedure + // .. procedure template <typename VctX, typename VctY> - inline - void dotc (VctX const& x, VctY const& y, + inline + void dotc (VctX const& x, VctY const& y, #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::vector_traits<VctX>::value_type& val #else @@ -300,77 +300,77 @@ namespace boost { namespace numeric { namespace bindings { assert (traits::vector_size (y) >= traits::vector_size (x)); detail::dotc (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x), + traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif - traits::vector_stride (y), + traits::vector_stride (y), &val); } // nrm2 <- ||x||_2 - template <typename Vct> - inline + template <typename Vct> + inline typename traits::type_traits< #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits<Vct>::value_type -#else - typename Vct::value_type -#endif - >::real_type + typename traits::vector_traits<Vct>::value_type +#else + typename Vct::value_type +#endif + >::real_type nrm2 (Vct const& x) { return detail::nrm2 (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x)); + traits::vector_stride (x)); } // asum <- ||re (x)|| + ||im (x)|| - template <typename Vct> - inline + template <typename Vct> + inline typename traits::type_traits< #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits<Vct>::value_type -#else - typename Vct::value_type -#endif - >::real_type + typename traits::vector_traits<Vct>::value_type +#else + typename Vct::value_type +#endif + >::real_type asum (Vct const& x) { return detail::asum (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x)); + traits::vector_stride (x)); } // iamax <- 1st i: max (|re (x_i)| + |im (x_i)|) - template <typename Vct> - inline + template <typename Vct> + inline CBLAS_INDEX iamax (Vct const& x) { return detail::iamax (traits::vector_size (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif - traits::vector_stride (x)); + traits::vector_stride (x)); } - // TO DO: plane rotations + // TO DO: plane rotations } // namespace atlas -}}} +}}} #endif // BOOST_NUMERIC_BINDINGS_CBLAS_LEVEL_1_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas1_overloads.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas1_overloads.hpp index 853b08f4fafc98d17355a31419f14aaa253b63d5..616a1121de48bad22880a3be50d1d18d7ee8d64e 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas1_overloads.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas1_overloads.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,342 +14,342 @@ #ifndef BOOST_NUMERIC_BINDINGS_CBLAS1_OVERLOADS_HPP #define BOOST_NUMERIC_BINDINGS_CBLAS1_OVERLOADS_HPP -#include <complex> +#include <complex> #include <boost/numeric/bindings/atlas/cblas_inc.hpp> #include <boost/numeric/bindings/traits/type.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { namespace detail { // dot <- x^T * y // .. real types: calls cblas_xdot // .. complex types: calls cblas_xdotu - inline + inline float dot (int const N, float const* X, int const incX, float const* Y, int const incY) { - return cblas_sdot (N, X, incX, Y, incY); + return cblas_sdot (N, X, incX, Y, incY); } - inline + inline double dot (int const N, double const* X, int const incX, double const* Y, int const incY) { - return cblas_ddot (N, X, incX, Y, incY); + return cblas_ddot (N, X, incX, Y, incY); } - inline - traits::complex_f + inline + traits::complex_f dot (int const N, traits::complex_f const* X, int const incX, traits::complex_f const* Y, int const incY) { - traits::complex_f val; - cblas_cdotu_sub (N, - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (&val)); - return val; - } - inline - traits::complex_d + traits::complex_f val; + cblas_cdotu_sub (N, + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (&val)); + return val; + } + inline + traits::complex_d dot (int const N, traits::complex_d const* X, int const incX, traits::complex_d const* Y, int const incY) { - traits::complex_d val; - cblas_zdotu_sub (N, - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (&val)); - return val; + traits::complex_d val; + cblas_zdotu_sub (N, + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (&val)); + return val; } - // dotu <- x^T * y + // dotu <- x^T * y // .. complex types only - inline + inline void dotu (int const N, traits::complex_f const* X, int const incX, traits::complex_f const* Y, int const incY, - traits::complex_f* val) + traits::complex_f* val) { - cblas_cdotu_sub (N, - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (val)); + cblas_cdotu_sub (N, + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (val)); } - inline + inline void dotu (int const N, traits::complex_d const* X, int const incX, traits::complex_d const* Y, int const incY, - traits::complex_d* val) + traits::complex_d* val) { - cblas_zdotu_sub (N, - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (val)); + cblas_zdotu_sub (N, + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (val)); } - // dotc <- x^H * y - // .. complex types only - inline + // dotc <- x^H * y + // .. complex types only + inline void dotc (int const N, traits::complex_f const* X, int const incX, traits::complex_f const* Y, int const incY, - traits::complex_f* val) + traits::complex_f* val) { - cblas_cdotc_sub (N, - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (val)); + cblas_cdotc_sub (N, + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (val)); } - inline + inline void dotc (int const N, traits::complex_d const* X, int const incX, traits::complex_d const* Y, int const incY, - traits::complex_d* val) + traits::complex_d* val) { - cblas_zdotc_sub (N, - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (val)); + cblas_zdotc_sub (N, + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (val)); } // nrm2 <- ||x||_2 - inline + inline float nrm2 (int const N, float const* X, int const incX) { return cblas_snrm2 (N, X, incX); } - inline + inline double nrm2 (int const N, double const* X, int const incX) { return cblas_dnrm2 (N, X, incX); } - inline + inline float nrm2 (int const N, traits::complex_f const* X, int const incX) { return cblas_scnrm2 (N, static_cast<void const*> (X), incX); } - inline + inline double nrm2 (int const N, traits::complex_d const* X, int const incX) { return cblas_dznrm2 (N, static_cast<void const*> (X), incX); } // asum <- ||re (x)|| + ||im (x)|| - inline + inline float asum (int const N, float const* X, int const incX) { return cblas_sasum (N, X, incX); } - inline + inline double asum (int const N, double const* X, int const incX) { return cblas_dasum (N, X, incX); } - inline + inline float asum (int const N, traits::complex_f const* X, int const incX) { return cblas_scasum (N, static_cast<void const*> (X), incX); } - inline + inline double asum (int const N, traits::complex_d const* X, int const incX) { return cblas_dzasum (N, static_cast<void const*> (X), incX); } // iamax <- 1st i: max (|re (x_i)| + |im (x_i)|) - inline + inline CBLAS_INDEX iamax (int const N, float const* X, int const incX) { return cblas_isamax (N, X, incX); } - inline + inline CBLAS_INDEX iamax (int const N, double const* X, int const incX) { return cblas_idamax (N, X, incX); } - inline - CBLAS_INDEX + inline + CBLAS_INDEX iamax (int const N, traits::complex_f const* X, int const incX) { return cblas_icamax (N, static_cast<void const*> (X), incX); } - inline - CBLAS_INDEX + inline + CBLAS_INDEX iamax (int const N, traits::complex_d const* X, int const incX) { return cblas_izamax (N, static_cast<void const*> (X), incX); } // x <-> y - inline + inline void swap (int const N, float* X, int const incX, float* Y, int const incY) { - cblas_sswap (N, X, incX, Y, incY); + cblas_sswap (N, X, incX, Y, incY); } - inline + inline void swap (int const N, double* X, int const incX, double* Y, int const incY) { - cblas_dswap (N, X, incX, Y, incY); + cblas_dswap (N, X, incX, Y, incY); } - inline + inline void swap (int const N, traits::complex_f* X, int const incX, traits::complex_f* Y, int const incY) { - cblas_cswap (N, - static_cast<void*> (X), incX, - static_cast<void*> (Y), incY); + cblas_cswap (N, + static_cast<void*> (X), incX, + static_cast<void*> (Y), incY); } - inline + inline void swap (int const N, traits::complex_d* X, int const incX, traits::complex_d* Y, int const incY) { - cblas_zswap (N, - static_cast<void*> (X), incX, - static_cast<void*> (Y), incY); + cblas_zswap (N, + static_cast<void*> (X), incX, + static_cast<void*> (Y), incY); } // y <- x inline void copy (int const N, float const* X, int const incX, float* Y, int const incY) { - cblas_scopy (N, X, incX, Y, incY); + cblas_scopy (N, X, incX, Y, incY); } inline void copy (int const N, double const* X, int const incX, double* Y, int const incY) { - cblas_dcopy (N, X, incX, Y, incY); + cblas_dcopy (N, X, incX, Y, incY); } - inline + inline void copy (int const N, traits::complex_f const* X, int const incX, traits::complex_f* Y, int const incY) { - cblas_ccopy (N, - static_cast<void const*> (X), incX, - static_cast<void*> (Y), incY); + cblas_ccopy (N, + static_cast<void const*> (X), incX, + static_cast<void*> (Y), incY); } - inline + inline void copy (int const N, traits::complex_d const* X, int const incX, traits::complex_d* Y, int const incY) { - cblas_zcopy (N, - static_cast<void const*> (X), incX, - static_cast<void*> (Y), incY); + cblas_zcopy (N, + static_cast<void const*> (X), incX, + static_cast<void*> (Y), incY); } // y <- alpha * x + y inline - void axpy (int const N, - float const alpha, float const* X, int const incX, - float* Y, int const incY) + void axpy (int const N, + float const alpha, float const* X, int const incX, + float* Y, int const incY) { cblas_saxpy (N, alpha, X, incX, Y, incY); } inline - void axpy (int const N, - double const alpha, double const* X, int const incX, - double* Y, int const incY) + void axpy (int const N, + double const alpha, double const* X, int const incX, + double* Y, int const incY) { cblas_daxpy (N, alpha, X, incX, Y, incY); } inline - void axpy (int const N, - traits::complex_f const& alpha, - traits::complex_f const* X, int const incX, - traits::complex_f* Y, int const incY) + void axpy (int const N, + traits::complex_f const& alpha, + traits::complex_f const* X, int const incX, + traits::complex_f* Y, int const incY) { - cblas_caxpy (N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, + cblas_caxpy (N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, static_cast<void*> (Y), incY); } inline - void axpy (int const N, - traits::complex_d const& alpha, - traits::complex_d const* X, int const incX, - traits::complex_d* Y, int const incY) + void axpy (int const N, + traits::complex_d const& alpha, + traits::complex_d const* X, int const incX, + traits::complex_d* Y, int const incY) { - cblas_zaxpy (N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, + cblas_zaxpy (N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, static_cast<void*> (Y), incY); } // y <- alpha * x + beta * y inline - void axpby (int const N, - float const alpha, float const* X, int const incX, - float const beta, float* Y, int const incY) + void axpby (int const N, + float const alpha, float const* X, int const incX, + float const beta, float* Y, int const incY) { catlas_saxpby (N, alpha, X, incX, beta, Y, incY); } inline - void axpby (int const N, - double const alpha, double const* X, int const incX, - double const beta, double* Y, int const incY) + void axpby (int const N, + double const alpha, double const* X, int const incX, + double const beta, double* Y, int const incY) { catlas_daxpby (N, alpha, X, incX, beta, Y, incY); } inline - void axpby (int const N, - traits::complex_f const& alpha, - traits::complex_f const* X, int const incX, - traits::complex_f const& beta, - traits::complex_f* Y, int const incY) + void axpby (int const N, + traits::complex_f const& alpha, + traits::complex_f const* X, int const incX, + traits::complex_f const& beta, + traits::complex_f* Y, int const incY) { - catlas_caxpby (N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (&beta), + catlas_caxpby (N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (&beta), static_cast<void*> (Y), incY); } inline - void axpby (int const N, - traits::complex_d const& alpha, - traits::complex_d const* X, int const incX, - traits::complex_d const& beta, - traits::complex_d* Y, int const incY) + void axpby (int const N, + traits::complex_d const& alpha, + traits::complex_d const* X, int const incX, + traits::complex_d const& beta, + traits::complex_d* Y, int const incY) { - catlas_zaxpby (N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (&beta), + catlas_zaxpby (N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (&beta), static_cast<void*> (Y), incY); } // x_i <- alpha for all i inline void set (int const N, float const alpha, float* X, int const incX) { - catlas_sset (N, alpha, X, incX); + catlas_sset (N, alpha, X, incX); } inline void set (int const N, double const alpha, double* X, int const incX) { - catlas_dset (N, alpha, X, incX); + catlas_dset (N, alpha, X, incX); } inline - void set (int const N, traits::complex_f const& alpha, + void set (int const N, traits::complex_f const& alpha, traits::complex_f* X, int const incX) { - catlas_cset (N, static_cast<void const*> (&alpha), + catlas_cset (N, static_cast<void const*> (&alpha), static_cast<void*> (X), incX); } inline - void set (int const N, traits::complex_d const& alpha, + void set (int const N, traits::complex_d const& alpha, traits::complex_d* X, int const incX) { - catlas_zset (N, static_cast<void const*> (&alpha), + catlas_zset (N, static_cast<void const*> (&alpha), static_cast<void*> (X), incX); } // x <- alpha * x inline void scal (int const N, float const alpha, float* X, int const incX) { - cblas_sscal (N, alpha, X, incX); + cblas_sscal (N, alpha, X, incX); } inline void scal (int const N, double const alpha, double* X, int const incX) { - cblas_dscal (N, alpha, X, incX); + cblas_dscal (N, alpha, X, incX); } inline - void scal (int const N, traits::complex_f const& alpha, + void scal (int const N, traits::complex_f const& alpha, traits::complex_f* X, int const incX) { - cblas_cscal (N, static_cast<void const*> (&alpha), + cblas_cscal (N, static_cast<void const*> (&alpha), static_cast<void*> (X), incX); } inline - void scal (int const N, float const alpha, + void scal (int const N, float const alpha, traits::complex_f* X, int const incX) { cblas_csscal (N, alpha, static_cast<void*> (X), incX); } inline - void scal (int const N, traits::complex_d const& alpha, + void scal (int const N, traits::complex_d const& alpha, traits::complex_d* X, int const incX) { - cblas_zscal (N, static_cast<void const*> (&alpha), + cblas_zscal (N, static_cast<void const*> (&alpha), static_cast<void*> (X), incX); } inline - void scal (int const N, double const alpha, + void scal (int const N, double const alpha, traits::complex_d* X, int const incX) { cblas_zdscal (N, alpha, static_cast<void*> (X), incX); } }} // namepaces detail & atlas -}}} +}}} #endif // BOOST_NUMERIC_BINDINGS_CBLAS1_OVERLOADS_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas2.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas2.hpp index dd33ad2a91c12054b2839c1ceca11ca601c248e9..64a213d75247fc811a89b7a67b6d4c1d40a6297f 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas2.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas2.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Kresimir Fresl 2002, 2003 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -27,31 +27,31 @@ #endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { // y <- alpha * op (A) * x + beta * y // op (A) == A || A^T || A^H template <typename T, typename Matr, typename VctX, typename VctY> - inline - void gemv (CBLAS_TRANSPOSE const TransA, - T const& alpha, Matr const& a, VctX const& x, + inline + void gemv (CBLAS_TRANSPOSE const TransA, + T const& alpha, Matr const& a, VctX const& x, T const& beta, VctY& y ) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<Matr>::matrix_structure, + typename traits::matrix_traits<Matr>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - assert (traits::vector_size (x) >= (TransA == CblasNoTrans ? n : m)); - assert (traits::vector_size (y) >= (TransA == CblasNoTrans ? m : n)); - // .. what about AtlasConj? + assert (traits::vector_size (x) >= (TransA == CblasNoTrans ? n : m)); + assert (traits::vector_size (y) >= (TransA == CblasNoTrans ? m : n)); + // .. what about AtlasConj? CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -59,45 +59,45 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<Matr>::ordering_type #else - typename Matr::orientation_category -#endif - >::value); + typename Matr::orientation_category +#endif + >::value); - detail::gemv (stor_ord, TransA, m, n, alpha, + detail::gemv (stor_ord, TransA, m, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - beta, - traits::vector_storage (y), + beta, + traits::vector_storage (y), traits::vector_stride (y)); } - // y <- alpha * A * x + beta * y + // y <- alpha * A * x + beta * y template <typename T, typename Matr, typename VctX, typename VctY> - inline - void gemv (T const& alpha, Matr const& a, VctX const& x, + inline + void gemv (T const& alpha, Matr const& a, VctX const& x, T const& beta, VctY& y) { - gemv (CblasNoTrans, alpha, a, x, beta, y); + gemv (CblasNoTrans, alpha, a, x, beta, y); } // y <- A * x template <typename Matr, typename VctX, typename VctY> - inline + inline void gemv (Matr const& a, VctX const& x, VctY& y) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<Matr>::value_type val_t; + typedef typename traits::matrix_traits<Matr>::value_type val_t; #else - typedef typename Matr::value_type val_t; -#endif + typedef typename Matr::value_type val_t; +#endif gemv (CblasNoTrans, (val_t) 1, a, x, (val_t) 0, y); } @@ -105,31 +105,31 @@ namespace boost { namespace numeric { namespace bindings { // y <- alpha * A * x + beta * y // A real symmetric matrix (T == float | double) // [from 'dsymv.f':] - /* [...] with UPLO = 'U' or 'u', the leading n by n upper + /* [...] with UPLO = 'U' or 'u', the leading n by n upper * triangular part of the array A must contain the upper triangular - * part of the symmetric matrix and the strictly lower triangular + * part of the symmetric matrix and the strictly lower triangular * part of A is not referenced. * [...] with UPLO = 'L' or 'l', the leading n by n lower - * triangular part of the array A must contain the lower triangular + * triangular part of the array A must contain the lower triangular * part of the symmetric matrix and the strictly upper * triangular part of A is not referenced. - */ + */ template <typename T, typename SymmMatr, typename VctX, typename VctY> - inline - void symv (CBLAS_UPLO const uplo, T const& alpha, SymmMatr const& a, + inline + void symv (CBLAS_UPLO const uplo, T const& alpha, SymmMatr const& a, VctX const& x, T const& beta, VctY& y) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmMatr>::matrix_structure, + typename traits::matrix_traits<SymmMatr>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -137,44 +137,44 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmMatr>::ordering_type #else - typename SymmMatr::orientation_category + typename SymmMatr::orientation_category #endif - >::value); + >::value); - detail::symv (stor_ord, uplo, n, alpha, + detail::symv (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - beta, - traits::vector_storage (y), + beta, + traits::vector_storage (y), traits::vector_stride (y)); } template <typename T, typename SymmMatr, typename VctX, typename VctY> - inline - void symv (T const& alpha, SymmMatr const& a, VctX const& x, + inline + void symv (T const& alpha, SymmMatr const& a, VctX const& x, T const& beta, VctY& y) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmMatr>::matrix_structure, + typename traits::matrix_traits<SymmMatr>::matrix_structure, traits::symmetric_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -182,9 +182,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmMatr>::ordering_type #else - typename SymmMatr::orientation_category + typename SymmMatr::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -192,36 +192,36 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmMatr>::uplo_type #else - typename SymmMatr::packed_category -#endif - >::value); + typename SymmMatr::packed_category +#endif + >::value); - detail::symv (stor_ord, uplo, n, alpha, + detail::symv (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - beta, - traits::vector_storage (y), + beta, + traits::vector_storage (y), traits::vector_stride (y)); } // y <- A * x template <typename SymmMatr, typename VctX, typename VctY> - inline + inline void symv (SymmMatr const& a, VctX const& x, VctY& y) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmMatr>::value_type val_t; + typedef typename traits::matrix_traits<SymmMatr>::value_type val_t; #else - typedef typename SymmMatr::value_type val_t; + typedef typename SymmMatr::value_type val_t; #endif symv ((val_t) 1, a, x, (val_t) 0, y); } @@ -232,32 +232,32 @@ namespace boost { namespace numeric { namespace bindings { // [from 'dspmv.f' (description assumes column major order):] /* A is an array of DIMENSION ( ( n*( n + 1 ) )/2 ). * Before entry with UPLO = 'U' or 'u', the array A must contain - * the upper triangular part of the symmetric matrix packed + * the upper triangular part of the symmetric matrix packed * sequentially, column by column, so that A( 1 ) contains a(1,1), * A( 2 ) and A( 3 ) contain a(1,2) and a(2,2) respectively, and * so on. * Before entry with UPLO = 'L' or 'l', the array A must contain - * the lower triangular part of the symmetric matrix packed + * the lower triangular part of the symmetric matrix packed * sequentially, column by column, so that A( 1 ) contains a(1,1), * A( 2 ) and A( 3 ) contain a(2,1) and a(3,1) respectively, and - * so on. - */ + * so on. + */ template <typename T, typename SymmMatr, typename VctX, typename VctY> - inline - void spmv (T const& alpha, SymmMatr const& a, VctX const& x, + inline + void spmv (T const& alpha, SymmMatr const& a, VctX const& x, T const& beta, VctY& y) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmMatr>::matrix_structure, + typename traits::matrix_traits<SymmMatr>::matrix_structure, traits::symmetric_packed_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -265,9 +265,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmMatr>::ordering_type #else - typename SymmMatr::orientation_category + typename SymmMatr::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -275,56 +275,56 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmMatr>::uplo_type #else - typename SymmMatr::packed_category -#endif - >::value); + typename SymmMatr::packed_category +#endif + >::value); - detail::spmv (stor_ord, uplo, n, alpha, + detail::spmv (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), - traits::vector_storage (x), + traits::matrix_storage (a), + traits::vector_storage (x), #else - traits::matrix_storage_const (a), - traits::vector_storage_const (x), + traits::matrix_storage_const (a), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - beta, - traits::vector_storage (y), + beta, + traits::vector_storage (y), traits::vector_stride (y)); } // y <- A * x template <typename SymmMatr, typename VctX, typename VctY> - inline + inline void spmv (SymmMatr const& a, VctX const& x, VctY& y) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmMatr>::value_type val_t; + typedef typename traits::matrix_traits<SymmMatr>::value_type val_t; #else - typedef typename SymmMatr::value_type val_t; + typedef typename SymmMatr::value_type val_t; #endif spmv ((val_t) 1, a, x, (val_t) 0, y); } // y <- alpha * A * x + beta * y - // A complex hermitian matrix + // A complex hermitian matrix // (T == std::complex<float> | std::complex<double>) template <typename T, typename HermMatr, typename VctX, typename VctY> - inline - void hemv (CBLAS_UPLO const uplo, T const& alpha, HermMatr const& a, + inline + void hemv (CBLAS_UPLO const uplo, T const& alpha, HermMatr const& a, VctX const& x, T const& beta, VctY& y) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermMatr>::matrix_structure, + typename traits::matrix_traits<HermMatr>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -332,44 +332,44 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermMatr>::ordering_type #else - typename HermMatr::orientation_category + typename HermMatr::orientation_category #endif - >::value); + >::value); - detail::hemv (stor_ord, uplo, n, alpha, + detail::hemv (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - beta, - traits::vector_storage (y), + beta, + traits::vector_storage (y), traits::vector_stride (y)); } template <typename T, typename HermMatr, typename VctX, typename VctY> - inline - void hemv (T const& alpha, HermMatr const& a, VctX const& x, + inline + void hemv (T const& alpha, HermMatr const& a, VctX const& x, T const& beta, VctY& y) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermMatr>::matrix_structure, + typename traits::matrix_traits<HermMatr>::matrix_structure, traits::hermitian_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -377,9 +377,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermMatr>::ordering_type #else - typename HermMatr::orientation_category + typename HermMatr::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -387,60 +387,60 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermMatr>::uplo_type #else - typename HermMatr::packed_category -#endif - >::value); + typename HermMatr::packed_category +#endif + >::value); - detail::hemv (stor_ord, uplo, n, alpha, + detail::hemv (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - beta, - traits::vector_storage (y), + beta, + traits::vector_storage (y), traits::vector_stride (y)); } // y <- A * x template <typename HermMatr, typename VctX, typename VctY> - inline + inline void hemv (HermMatr const& a, VctX const& x, VctY& y) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermMatr>::value_type val_t; + typedef typename traits::matrix_traits<HermMatr>::value_type val_t; #else - typedef typename HermMatr::value_type val_t; + typedef typename HermMatr::value_type val_t; #endif hemv ((val_t) 1, a, x, (val_t) 0, y); } // y <- alpha * A * x + beta * y - // A complex hermitian matrix in packed form + // A complex hermitian matrix in packed form // (T == std::complex<float> | std::complex<double>) template <typename T, typename HermMatr, typename VctX, typename VctY> - inline - void hpmv (T const& alpha, HermMatr const& a, VctX const& x, + inline + void hpmv (T const& alpha, HermMatr const& a, VctX const& x, T const& beta, VctY& y) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermMatr>::matrix_structure, + typename traits::matrix_traits<HermMatr>::matrix_structure, traits::hermitian_packed_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -448,9 +448,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermMatr>::ordering_type #else - typename HermMatr::orientation_category + typename HermMatr::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -458,53 +458,53 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermMatr>::uplo_type #else - typename HermMatr::packed_category -#endif - >::value); + typename HermMatr::packed_category +#endif + >::value); - detail::hpmv (stor_ord, uplo, n, alpha, + detail::hpmv (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), - traits::vector_storage (x), + traits::matrix_storage (a), + traits::vector_storage (x), #else - traits::matrix_storage_const (a), - traits::vector_storage_const (x), + traits::matrix_storage_const (a), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - beta, - traits::vector_storage (y), + beta, + traits::vector_storage (y), traits::vector_stride (y)); } // y <- A * x template <typename HermMatr, typename VctX, typename VctY> - inline + inline void hpmv (HermMatr const& a, VctX const& x, VctY& y) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermMatr>::value_type val_t; + typedef typename traits::matrix_traits<HermMatr>::value_type val_t; #else - typedef typename HermMatr::value_type val_t; + typedef typename HermMatr::value_type val_t; #endif hpmv ((val_t) 1, a, x, (val_t) 0, y); } - // A <- alpha * x * y^T + A + // A <- alpha * x * y^T + A // .. real & complex types template <typename T, typename Matr, typename VctX, typename VctY> - inline + inline void ger (T const& alpha, VctX const& x, VctY const& y, Matr& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<Matr>::matrix_structure, + typename traits::matrix_traits<Matr>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - assert (traits::vector_size (x) >= m); - assert (traits::vector_size (y) >= n); + assert (traits::vector_size (x) >= m); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -512,55 +512,55 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<Matr>::ordering_type #else - typename Matr::orientation_category -#endif - >::value); + typename Matr::orientation_category +#endif + >::value); - detail::ger (stor_ord, m, n, alpha, + detail::ger (stor_ord, m, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } - // A <- x * y^T + A + // A <- x * y^T + A template <typename Matr, typename VctX, typename VctY> - inline + inline void ger (VctX const& x, VctY const& y, Matr& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<Matr>::value_type val_t; + typedef typename traits::matrix_traits<Matr>::value_type val_t; #else - typedef typename Matr::value_type val_t; -#endif - ger ((val_t) 1, x, y, a); + typedef typename Matr::value_type val_t; +#endif + ger ((val_t) 1, x, y, a); } - // A <- alpha * x * y^T + A + // A <- alpha * x * y^T + A // .. complex types only template <typename T, typename Matr, typename VctX, typename VctY> - inline + inline void geru (T const& alpha, VctX const& x, VctY const& y, Matr& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<Matr>::matrix_structure, + typename traits::matrix_traits<Matr>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - assert (traits::vector_size (x) >= m); - assert (traits::vector_size (y) >= n); + assert (traits::vector_size (x) >= m); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -568,55 +568,55 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<Matr>::ordering_type #else - typename Matr::orientation_category -#endif - >::value); + typename Matr::orientation_category +#endif + >::value); - detail::geru (stor_ord, m, n, alpha, + detail::geru (stor_ord, m, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } - // A <- x * y^T + A + // A <- x * y^T + A template <typename Matr, typename VctX, typename VctY> - inline + inline void geru (VctX const& x, VctY const& y, Matr& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<Matr>::value_type val_t; + typedef typename traits::matrix_traits<Matr>::value_type val_t; #else - typedef typename Matr::value_type val_t; -#endif - geru ((val_t) 1, x, y, a); + typedef typename Matr::value_type val_t; +#endif + geru ((val_t) 1, x, y, a); } - // A <- alpha * x * y^H + A + // A <- alpha * x * y^H + A // .. complex types only template <typename T, typename Matr, typename VctX, typename VctY> - inline + inline void gerc (T const& alpha, VctX const& x, VctY const& y, Matr& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<Matr>::matrix_structure, + typename traits::matrix_traits<Matr>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - assert (traits::vector_size (x) >= m); - assert (traits::vector_size (y) >= n); + assert (traits::vector_size (x) >= m); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -624,55 +624,55 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<Matr>::ordering_type #else - typename Matr::orientation_category -#endif - >::value); + typename Matr::orientation_category +#endif + >::value); - detail::gerc (stor_ord, m, n, alpha, + detail::gerc (stor_ord, m, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } - // A <- x * y^H + A + // A <- x * y^H + A template <typename Matr, typename VctX, typename VctY> - inline + inline void gerc (VctX const& x, VctY const& y, Matr& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<Matr>::value_type val_t; + typedef typename traits::matrix_traits<Matr>::value_type val_t; #else - typedef typename Matr::value_type val_t; -#endif - gerc ((val_t) 1, x, y, a); + typedef typename Matr::value_type val_t; +#endif + gerc ((val_t) 1, x, y, a); } - // A <- alpha * x * x^T + A - // A real symmetric (see leading comments for 'symv()') + // A <- alpha * x * x^T + A + // A real symmetric (see leading comments for 'symv()') template <typename T, typename SymmM, typename VctX> - inline + inline void syr (CBLAS_UPLO const uplo, T const& alpha, VctX const& x, SymmM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmM>::matrix_structure, + typename traits::matrix_traits<SymmM>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -680,34 +680,34 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::ordering_type #else - typename SymmM::orientation_category + typename SymmM::orientation_category #endif - >::value); + >::value); - detail::syr (stor_ord, uplo, n, alpha, + detail::syr (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } template <typename T, typename SymmM, typename VctX> - inline + inline void syr (T const& alpha, VctX const& x, SymmM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmM>::matrix_structure, + typename traits::matrix_traits<SymmM>::matrix_structure, traits::symmetric_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -715,9 +715,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::ordering_type #else - typename SymmM::orientation_category + typename SymmM::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -725,49 +725,49 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::uplo_type #else - typename SymmM::packed_category -#endif - >::value); + typename SymmM::packed_category +#endif + >::value); - detail::syr (stor_ord, uplo, n, alpha, + detail::syr (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } - // A <- x * x^T + A + // A <- x * x^T + A template <typename SymmM, typename VctX> - inline - void syr (VctX const& x, SymmM& a) { + inline + void syr (VctX const& x, SymmM& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmM>::value_type val_t; + typedef typename traits::matrix_traits<SymmM>::value_type val_t; #else - typedef typename SymmM::value_type val_t; -#endif - syr ((val_t) 1, x, a); + typedef typename SymmM::value_type val_t; +#endif + syr ((val_t) 1, x, a); } - // A <- alpha * x * x^T + A - // A real symmetric in packed form (see leading comments for 'spmv()') + // A <- alpha * x * x^T + A + // A real symmetric in packed form (see leading comments for 'spmv()') template <typename T, typename SymmM, typename VctX> - inline + inline void spr (T const& alpha, VctX const& x, SymmM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmM>::matrix_structure, + typename traits::matrix_traits<SymmM>::matrix_structure, traits::symmetric_packed_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -775,9 +775,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::ordering_type #else - typename SymmM::orientation_category + typename SymmM::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -785,51 +785,51 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::uplo_type #else - typename SymmM::packed_category -#endif - >::value); + typename SymmM::packed_category +#endif + >::value); - detail::spr (stor_ord, uplo, n, alpha, + detail::spr (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), traits::matrix_storage (a)); } - // A <- x * x^T + A + // A <- x * x^T + A template <typename SymmM, typename VctX> - inline - void spr (VctX const& x, SymmM& a) { + inline + void spr (VctX const& x, SymmM& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmM>::value_type val_t; + typedef typename traits::matrix_traits<SymmM>::value_type val_t; #else - typedef typename SymmM::value_type val_t; -#endif - spr ((val_t) 1, x, a); + typedef typename SymmM::value_type val_t; +#endif + spr ((val_t) 1, x, a); } - // A <- alpha * x * y^T + alpha * y * x^T + A - // A real symmetric (see leading comments for 'symv()') + // A <- alpha * x * y^T + alpha * y * x^T + A + // A real symmetric (see leading comments for 'symv()') template <typename T, typename SymmM, typename VctX, typename VctY> - inline - void syr2 (CBLAS_UPLO const uplo, T const& alpha, - VctX const& x, VctY const& y, SymmM& a) + inline + void syr2 (CBLAS_UPLO const uplo, T const& alpha, + VctX const& x, VctY const& y, SymmM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmM>::matrix_structure, + typename traits::matrix_traits<SymmM>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -837,41 +837,41 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::ordering_type #else - typename SymmM::orientation_category + typename SymmM::orientation_category #endif - >::value); + >::value); - detail::syr2 (stor_ord, uplo, n, alpha, + detail::syr2 (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } template <typename T, typename SymmM, typename VctX, typename VctY> - inline + inline void syr2 (T const& alpha, VctX const& x, VctY const& y, SymmM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmM>::matrix_structure, + typename traits::matrix_traits<SymmM>::matrix_structure, traits::symmetric_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -879,9 +879,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::ordering_type #else - typename SymmM::orientation_category + typename SymmM::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -889,56 +889,56 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::uplo_type #else - typename SymmM::packed_category -#endif - >::value); + typename SymmM::packed_category +#endif + >::value); - detail::syr2 (stor_ord, uplo, n, alpha, + detail::syr2 (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } - // A <- x * y^T + y * x^T + A + // A <- x * y^T + y * x^T + A template <typename SymmM, typename VctX, typename VctY> - inline - void syr2 (VctX const& x, VctY const& y, SymmM& a) { + inline + void syr2 (VctX const& x, VctY const& y, SymmM& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmM>::value_type val_t; + typedef typename traits::matrix_traits<SymmM>::value_type val_t; #else - typedef typename SymmM::value_type val_t; -#endif - syr2 ((val_t) 1, x, y, a); + typedef typename SymmM::value_type val_t; +#endif + syr2 ((val_t) 1, x, y, a); } - // A <- alpha * x * y^T + alpha * y * x^T + A - // A real symmetric in packed form (see leading comments for 'spmv()') + // A <- alpha * x * y^T + alpha * y * x^T + A + // A real symmetric in packed form (see leading comments for 'spmv()') template <typename T, typename SymmM, typename VctX, typename VctY> - inline + inline void spr2 (T const& alpha, VctX const& x, VctY const& y, SymmM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmM>::matrix_structure, + typename traits::matrix_traits<SymmM>::matrix_structure, traits::symmetric_packed_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -946,9 +946,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::ordering_type #else - typename SymmM::orientation_category + typename SymmM::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -956,54 +956,54 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmM>::uplo_type #else - typename SymmM::packed_category -#endif - >::value); + typename SymmM::packed_category +#endif + >::value); - detail::spr2 (stor_ord, uplo, n, alpha, + detail::spr2 (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), traits::matrix_storage (a)); } - // A <- x * y^T + y * x^T + A + // A <- x * y^T + y * x^T + A template <typename SymmM, typename VctX, typename VctY> - inline - void spr2 (VctX const& x, VctY const& y, SymmM& a) { + inline + void spr2 (VctX const& x, VctY const& y, SymmM& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmM>::value_type val_t; + typedef typename traits::matrix_traits<SymmM>::value_type val_t; #else - typedef typename SymmM::value_type val_t; -#endif - spr2 ((val_t) 1, x, y, a); + typedef typename SymmM::value_type val_t; +#endif + spr2 ((val_t) 1, x, y, a); } - // A <- alpha * x * x^H + A - // A hermitian + // A <- alpha * x * x^H + A + // A hermitian template <typename T, typename HermM, typename VctX> - inline + inline void her (CBLAS_UPLO const uplo, T const& alpha, VctX const& x, HermM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermM>::matrix_structure, + typename traits::matrix_traits<HermM>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -1011,34 +1011,34 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::ordering_type #else - typename HermM::orientation_category + typename HermM::orientation_category #endif - >::value); + >::value); - detail::her (stor_ord, uplo, n, alpha, + detail::her (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } template <typename T, typename HermM, typename VctX> - inline + inline void her (T const& alpha, VctX const& x, HermM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermM>::matrix_structure, + typename traits::matrix_traits<HermM>::matrix_structure, traits::hermitian_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -1046,9 +1046,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::ordering_type #else - typename HermM::orientation_category + typename HermM::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -1056,50 +1056,50 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::uplo_type #else - typename HermM::packed_category -#endif - >::value); + typename HermM::packed_category +#endif + >::value); - detail::her (stor_ord, uplo, n, alpha, + detail::her (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } - // A <- x * x^H + A + // A <- x * x^H + A template <typename HermM, typename VctX> - inline - void her (VctX const& x, HermM& a) { + inline + void her (VctX const& x, HermM& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermM>::value_type val_t; + typedef typename traits::matrix_traits<HermM>::value_type val_t; #else - typedef typename HermM::value_type val_t; -#endif - typedef typename traits::type_traits<val_t>::real_type real_t; - her ((real_t) 1, x, a); + typedef typename HermM::value_type val_t; +#endif + typedef typename traits::type_traits<val_t>::real_type real_t; + her ((real_t) 1, x, a); } - // A <- alpha * x * x^H + A - // A hermitian in packed form + // A <- alpha * x * x^H + A + // A hermitian in packed form template <typename T, typename HermM, typename VctX> - inline + inline void hpr (T const& alpha, VctX const& x, HermM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermM>::matrix_structure, + typename traits::matrix_traits<HermM>::matrix_structure, traits::hermitian_packed_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -1107,9 +1107,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::ordering_type #else - typename HermM::orientation_category + typename HermM::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -1117,52 +1117,52 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::uplo_type #else - typename HermM::packed_category -#endif - >::value); + typename HermM::packed_category +#endif + >::value); - detail::hpr (stor_ord, uplo, n, alpha, + detail::hpr (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), traits::matrix_storage (a)); } - // A <- x * x^H + A + // A <- x * x^H + A template <typename HermM, typename VctX> - inline - void hpr (VctX const& x, HermM& a) { + inline + void hpr (VctX const& x, HermM& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermM>::value_type val_t; + typedef typename traits::matrix_traits<HermM>::value_type val_t; #else - typedef typename HermM::value_type val_t; -#endif - typedef typename traits::type_traits<val_t>::real_type real_t; - hpr ((real_t) 1, x, a); + typedef typename HermM::value_type val_t; +#endif + typedef typename traits::type_traits<val_t>::real_type real_t; + hpr ((real_t) 1, x, a); } - // A <- alpha * x * y^H + y * (alpha * x)^H + A + // A <- alpha * x * y^H + y * (alpha * x)^H + A // A hermitian template <typename T, typename HermM, typename VctX, typename VctY> - inline - void her2 (CBLAS_UPLO const uplo, T const& alpha, - VctX const& x, VctY const& y, HermM& a) + inline + void her2 (CBLAS_UPLO const uplo, T const& alpha, + VctX const& x, VctY const& y, HermM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermM>::matrix_structure, + typename traits::matrix_traits<HermM>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -1170,41 +1170,41 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::ordering_type #else - typename HermM::orientation_category + typename HermM::orientation_category #endif - >::value); + >::value); - detail::her2 (stor_ord, uplo, n, alpha, + detail::her2 (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } template <typename T, typename HermM, typename VctX, typename VctY> - inline + inline void her2 (T const& alpha, VctX const& x, VctY const& y, HermM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermM>::matrix_structure, + typename traits::matrix_traits<HermM>::matrix_structure, traits::hermitian_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -1212,9 +1212,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::ordering_type #else - typename HermM::orientation_category + typename HermM::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -1222,56 +1222,56 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::uplo_type #else - typename HermM::packed_category -#endif - >::value); + typename HermM::packed_category +#endif + >::value); - detail::her2 (stor_ord, uplo, n, alpha, + detail::her2 (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), - traits::matrix_storage (a), - traits::leading_dimension (a)); + traits::matrix_storage (a), + traits::leading_dimension (a)); } - // A <- x * y^H + y * x^H + A + // A <- x * y^H + y * x^H + A template <typename HermM, typename VctX, typename VctY> - inline - void her2 (VctX const& x, VctY const& y, HermM& a) { + inline + void her2 (VctX const& x, VctY const& y, HermM& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermM>::value_type val_t; + typedef typename traits::matrix_traits<HermM>::value_type val_t; #else - typedef typename HermM::value_type val_t; -#endif - her2 ((val_t) 1, x, y, a); + typedef typename HermM::value_type val_t; +#endif + her2 ((val_t) 1, x, y, a); } - // A <- alpha * x * y^H + y * (alpha * x)^H + A - // A hermitian in packed form + // A <- alpha * x * y^H + y * (alpha * x)^H + A + // A hermitian in packed form template <typename T, typename HermM, typename VctX, typename VctY> - inline + inline void hpr2 (T const& alpha, VctX const& x, VctY const& y, HermM& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermM>::matrix_structure, + typename traits::matrix_traits<HermM>::matrix_structure, traits::hermitian_packed_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (x) >= n); - assert (traits::vector_size (y) >= n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (x) >= n); + assert (traits::vector_size (y) >= n); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -1279,9 +1279,9 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::ordering_type #else - typename HermM::orientation_category + typename HermM::orientation_category #endif - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -1289,41 +1289,41 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermM>::uplo_type #else - typename HermM::packed_category -#endif - >::value); + typename HermM::packed_category +#endif + >::value); - detail::hpr2 (stor_ord, uplo, n, alpha, + detail::hpr2 (stor_ord, uplo, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (x), + traits::vector_storage (x), #else - traits::vector_storage_const (x), + traits::vector_storage_const (x), #endif traits::vector_stride (x), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (y), + traits::vector_storage (y), #else - traits::vector_storage_const (y), + traits::vector_storage_const (y), #endif traits::vector_stride (y), traits::matrix_storage (a)); } - // A <- x * y^H + y * x^H + A + // A <- x * y^H + y * x^H + A template <typename HermM, typename VctX, typename VctY> - inline - void hpr2 (VctX const& x, VctY const& y, HermM& a) { + inline + void hpr2 (VctX const& x, VctY const& y, HermM& a) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermM>::value_type val_t; + typedef typename traits::matrix_traits<HermM>::value_type val_t; #else - typedef typename HermM::value_type val_t; -#endif - hpr2 ((val_t) 1, x, y, a); + typedef typename HermM::value_type val_t; +#endif + hpr2 ((val_t) 1, x, y, a); } } // namespace atlas -}}} +}}} #endif // BOOST_NUMERIC_BINDINGS_CBLAS_LEVEL_2_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas2_overloads.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas2_overloads.hpp index e102a2e3f8f1ed0380cf96739cce28a084da6a2d..f664ba330643d406c568e838f95f1b1eb5539dff 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas2_overloads.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas2_overloads.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Kresimir Fresl 2002, 2003 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,109 +14,109 @@ #ifndef BOOST_NUMERIC_BINDINGS_CBLAS2_OVERLOADS_HPP #define BOOST_NUMERIC_BINDINGS_CBLAS2_OVERLOADS_HPP -#include <complex> +#include <complex> #include <boost/numeric/bindings/atlas/cblas_inc.hpp> #include <boost/numeric/bindings/traits/type.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { namespace detail { // y <- alpha * op (A) * x + beta * y - inline - void gemv (CBLAS_ORDER const Order, + inline + void gemv (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const TransA, int const M, int const N, float const alpha, float const* A, int const lda, - float const* X, int const incX, - float const beta, float* Y, int const incY) + float const* X, int const incX, + float const beta, float* Y, int const incY) { - cblas_sgemv (Order, TransA, M, N, alpha, A, lda, + cblas_sgemv (Order, TransA, M, N, alpha, A, lda, X, incX, - beta, Y, incY); + beta, Y, incY); } - - inline - void gemv (CBLAS_ORDER const Order, + + inline + void gemv (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const TransA, int const M, int const N, double const alpha, double const* A, int const lda, - double const* X, int const incX, - double const beta, double* Y, int const incY) + double const* X, int const incX, + double const beta, double* Y, int const incY) { - cblas_dgemv (Order, TransA, M, N, alpha, A, lda, + cblas_dgemv (Order, TransA, M, N, alpha, A, lda, X, incX, - beta, Y, incY); + beta, Y, incY); } - - inline - void gemv (CBLAS_ORDER const Order, + + inline + void gemv (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const TransA, int const M, int const N, - traits::complex_f const& alpha, + traits::complex_f const& alpha, traits::complex_f const* A, int const lda, - traits::complex_f const* X, int const incX, - traits::complex_f const& beta, - traits::complex_f* Y, int const incY) + traits::complex_f const* X, int const incX, + traits::complex_f const& beta, + traits::complex_f* Y, int const incY) { - cblas_cgemv (Order, TransA, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, + cblas_cgemv (Order, TransA, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, static_cast<void const*> (X), incX, - static_cast<void const*> (&beta), - static_cast<void*> (Y), incY); + static_cast<void const*> (&beta), + static_cast<void*> (Y), incY); } - - inline - void gemv (CBLAS_ORDER const Order, + + inline + void gemv (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const TransA, int const M, int const N, - traits::complex_d const& alpha, + traits::complex_d const& alpha, traits::complex_d const* A, int const lda, - traits::complex_d const* X, int const incX, - traits::complex_d const& beta, - traits::complex_d* Y, int const incY) + traits::complex_d const* X, int const incX, + traits::complex_d const& beta, + traits::complex_d* Y, int const incY) { - cblas_zgemv (Order, TransA, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, + cblas_zgemv (Order, TransA, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, static_cast<void const*> (X), incX, - static_cast<void const*> (&beta), - static_cast<void*> (Y), incY); + static_cast<void const*> (&beta), + static_cast<void*> (Y), incY); } // y <- alpha * A * x + beta * y // A real symmetric - inline + inline void symv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, float const alpha, float const* A, int const lda, float const* X, int const incX, - float const beta, float* Y, int const incY) + float const beta, float* Y, int const incY) { - cblas_ssymv (Order, Uplo, N, alpha, A, lda, + cblas_ssymv (Order, Uplo, N, alpha, A, lda, X, incX, beta, Y, incY); } - inline + inline void symv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, double const alpha, double const* A, int const lda, double const* X, int const incX, - double const beta, double* Y, int const incY) + double const beta, double* Y, int const incY) { - cblas_dsymv (Order, Uplo, N, alpha, A, lda, + cblas_dsymv (Order, Uplo, N, alpha, A, lda, X, incX, beta, Y, incY); } // y <- alpha * A * x + beta * y - // A real symmetric in packed form + // A real symmetric in packed form inline void spmv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, float const alpha, float const* Ap, float const* X, int const incX, - float const beta, float* Y, int const incY) + float const beta, float* Y, int const incY) { cblas_sspmv (Order, Uplo, N, alpha, Ap, X, incX, beta, Y, incY); } @@ -125,400 +125,400 @@ namespace boost { namespace numeric { namespace bindings { void spmv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, double const alpha, double const* Ap, double const* X, int const incX, - double const beta, double* Y, int const incY) + double const beta, double* Y, int const incY) { cblas_dspmv (Order, Uplo, N, alpha, Ap, X, incX, beta, Y, incY); } // y <- alpha * A * x + beta * y - // A complex hermitian + // A complex hermitian - inline + inline void hemv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_f const& alpha, - traits::complex_f const* A, int const lda, + int const N, traits::complex_f const& alpha, + traits::complex_f const* A, int const lda, traits::complex_f const* X, int const incX, - traits::complex_f const& beta, - traits::complex_f* Y, int const incY) - { - cblas_chemv (Order, Uplo, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, - static_cast<void const*> (X), incX, - static_cast<void const*> (&beta), + traits::complex_f const& beta, + traits::complex_f* Y, int const incY) + { + cblas_chemv (Order, Uplo, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, + static_cast<void const*> (X), incX, + static_cast<void const*> (&beta), static_cast<void*> (Y), incY); } - inline + inline void hemv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_d const& alpha, - traits::complex_d const* A, int const lda, + int const N, traits::complex_d const& alpha, + traits::complex_d const* A, int const lda, traits::complex_d const* X, int const incX, - traits::complex_d const& beta, - traits::complex_d* Y, int const incY) - { - cblas_zhemv (Order, Uplo, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, - static_cast<void const*> (X), incX, - static_cast<void const*> (&beta), + traits::complex_d const& beta, + traits::complex_d* Y, int const incY) + { + cblas_zhemv (Order, Uplo, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, + static_cast<void const*> (X), incX, + static_cast<void const*> (&beta), static_cast<void*> (Y), incY); } // y <- alpha * A * x + beta * y - // A complex hermitian in packed form + // A complex hermitian in packed form - inline + inline void hpmv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_f const& alpha, - traits::complex_f const* Ap, + int const N, traits::complex_f const& alpha, + traits::complex_f const* Ap, traits::complex_f const* X, int const incX, - traits::complex_f const& beta, - traits::complex_f* Y, int const incY) - { - cblas_chpmv (Order, Uplo, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (Ap), - static_cast<void const*> (X), incX, - static_cast<void const*> (&beta), + traits::complex_f const& beta, + traits::complex_f* Y, int const incY) + { + cblas_chpmv (Order, Uplo, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (Ap), + static_cast<void const*> (X), incX, + static_cast<void const*> (&beta), static_cast<void*> (Y), incY); } - inline + inline void hpmv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_d const& alpha, - traits::complex_d const* Ap, + int const N, traits::complex_d const& alpha, + traits::complex_d const* Ap, traits::complex_d const* X, int const incX, - traits::complex_d const& beta, - traits::complex_d* Y, int const incY) - { - cblas_zhpmv (Order, Uplo, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (Ap), - static_cast<void const*> (X), incX, - static_cast<void const*> (&beta), + traits::complex_d const& beta, + traits::complex_d* Y, int const incY) + { + cblas_zhpmv (Order, Uplo, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (Ap), + static_cast<void const*> (X), incX, + static_cast<void const*> (&beta), static_cast<void*> (Y), incY); } - // A <- alpha * x * y^T + A + // A <- alpha * x * y^T + A // .. real types: calls cblas_xger // .. complex types: calls cblas_xgeru - inline + inline void ger (CBLAS_ORDER const Order, int const M, int const N, float const alpha, float const* X, int const incX, float const* Y, int const incY, float* A, int const lda) { - cblas_sger (Order, M, N, alpha, X, incX, Y, incY, A, lda); + cblas_sger (Order, M, N, alpha, X, incX, Y, incY, A, lda); } - inline + inline void ger (CBLAS_ORDER const Order, int const M, int const N, double const alpha, double const* X, int const incX, double const* Y, int const incY, double* A, int const lda) { - cblas_dger (Order, M, N, alpha, X, incX, Y, incY, A, lda); + cblas_dger (Order, M, N, alpha, X, incX, Y, incY, A, lda); } - inline + inline void ger (CBLAS_ORDER const Order, int const M, int const N, - traits::complex_f const& alpha, + traits::complex_f const& alpha, traits::complex_f const* X, int const incX, - traits::complex_f const* Y, int const incY, + traits::complex_f const* Y, int const incY, traits::complex_f* A, int const lda) { - cblas_cgeru (Order, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (A), lda); + cblas_cgeru (Order, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (A), lda); } - inline + inline void ger (CBLAS_ORDER const Order, int const M, int const N, - traits::complex_d const& alpha, + traits::complex_d const& alpha, traits::complex_d const* X, int const incX, - traits::complex_d const* Y, int const incY, + traits::complex_d const* Y, int const incY, traits::complex_d* A, int const lda) { - cblas_zgeru (Order, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (A), lda); + cblas_zgeru (Order, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (A), lda); } - // A <- alpha * x * y^T + A - // .. complex types only + // A <- alpha * x * y^T + A + // .. complex types only - inline + inline void geru (CBLAS_ORDER const Order, int const M, int const N, - traits::complex_f const& alpha, + traits::complex_f const& alpha, traits::complex_f const* X, int const incX, - traits::complex_f const* Y, int const incY, + traits::complex_f const* Y, int const incY, traits::complex_f* A, int const lda) { - cblas_cgeru (Order, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (A), lda); + cblas_cgeru (Order, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (A), lda); } - inline + inline void geru (CBLAS_ORDER const Order, int const M, int const N, - traits::complex_d const& alpha, + traits::complex_d const& alpha, traits::complex_d const* X, int const incX, - traits::complex_d const* Y, int const incY, + traits::complex_d const* Y, int const incY, traits::complex_d* A, int const lda) { - cblas_zgeru (Order, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (A), lda); + cblas_zgeru (Order, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (A), lda); } - - // A <- alpha * x * y^H + A - // .. complex types only - inline + // A <- alpha * x * y^H + A + // .. complex types only + + inline void gerc (CBLAS_ORDER const Order, int const M, int const N, - traits::complex_f const& alpha, + traits::complex_f const& alpha, traits::complex_f const* X, int const incX, - traits::complex_f const* Y, int const incY, + traits::complex_f const* Y, int const incY, traits::complex_f* A, int const lda) { - cblas_cgerc (Order, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (A), lda); + cblas_cgerc (Order, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (A), lda); } - inline + inline void gerc (CBLAS_ORDER const Order, int const M, int const N, - traits::complex_d const& alpha, + traits::complex_d const& alpha, traits::complex_d const* X, int const incX, - traits::complex_d const* Y, int const incY, + traits::complex_d const* Y, int const incY, traits::complex_d* A, int const lda) { - cblas_zgerc (Order, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (A), lda); + cblas_zgerc (Order, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (A), lda); } - // A <- alpha * x * x^T + A - // A real symmetric + // A <- alpha * x * x^T + A + // A real symmetric - inline + inline void syr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, float const alpha, + int const N, float const alpha, float const* X, int const incX, float* A, int const lda) { - cblas_ssyr (Order, Uplo, N, alpha, X, incX, A, lda); + cblas_ssyr (Order, Uplo, N, alpha, X, incX, A, lda); } - inline + inline void syr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, double const alpha, + int const N, double const alpha, double const* X, int const incX, double* A, int const lda) { - cblas_dsyr (Order, Uplo, N, alpha, X, incX, A, lda); + cblas_dsyr (Order, Uplo, N, alpha, X, incX, A, lda); } - // A <- alpha * x * x^T + A - // A real symmetric in packed form - - inline + // A <- alpha * x * x^T + A + // A real symmetric in packed form + + inline void spr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, float const alpha, + int const N, float const alpha, float const* X, int const incX, float* Ap) { - cblas_sspr (Order, Uplo, N, alpha, X, incX, Ap); + cblas_sspr (Order, Uplo, N, alpha, X, incX, Ap); } - inline + inline void spr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, double const alpha, + int const N, double const alpha, double const* X, int const incX, double* Ap) { - cblas_dspr (Order, Uplo, N, alpha, X, incX, Ap); + cblas_dspr (Order, Uplo, N, alpha, X, incX, Ap); } - // A <- alpha * x * y^T + alpha * y * x^T + A - // A real symmetric + // A <- alpha * x * y^T + alpha * y * x^T + A + // A real symmetric - inline + inline void syr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, float const alpha, - float const* X, int const incX, - float const* Y, int const incY, + int const N, float const alpha, + float const* X, int const incX, + float const* Y, int const incY, float* A, int const lda) { - cblas_ssyr2 (Order, Uplo, N, alpha, X, incX, Y, incY, A, lda); + cblas_ssyr2 (Order, Uplo, N, alpha, X, incX, Y, incY, A, lda); } - inline + inline void syr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, double const alpha, - double const* X, int const incX, - double const* Y, int const incY, + int const N, double const alpha, + double const* X, int const incX, + double const* Y, int const incY, double* A, int const lda) { - cblas_dsyr2 (Order, Uplo, N, alpha, X, incX, Y, incY, A, lda); + cblas_dsyr2 (Order, Uplo, N, alpha, X, incX, Y, incY, A, lda); } - // A <- alpha * x * y^T + alpha * y * x^T + A - // A real symmetric in packed form - - inline + // A <- alpha * x * y^T + alpha * y * x^T + A + // A real symmetric in packed form + + inline void spr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, float const alpha, - float const* X, int const incX, + int const N, float const alpha, + float const* X, int const incX, float const* Y, int const incY, float* Ap) { - cblas_sspr2 (Order, Uplo, N, alpha, X, incX, Y, incY, Ap); + cblas_sspr2 (Order, Uplo, N, alpha, X, incX, Y, incY, Ap); } - inline + inline void spr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, double const alpha, - double const* X, int const incX, + int const N, double const alpha, + double const* X, int const incX, double const* Y, int const incY, double* Ap) { - cblas_dspr2 (Order, Uplo, N, alpha, X, incX, Y, incY, Ap); + cblas_dspr2 (Order, Uplo, N, alpha, X, incX, Y, incY, Ap); } - // A <- alpha * x * x^H + A + // A <- alpha * x * x^H + A // A hermitian - inline + inline void her (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, float const alpha, - traits::complex_f const* X, int const incX, + int const N, float const alpha, + traits::complex_f const* X, int const incX, traits::complex_f* A, int const lda) { - cblas_cher (Order, Uplo, N, alpha, - static_cast<void const*> (X), incX, - static_cast<void*> (A), lda); + cblas_cher (Order, Uplo, N, alpha, + static_cast<void const*> (X), incX, + static_cast<void*> (A), lda); } - inline + inline void her (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, double const alpha, - traits::complex_d const* X, int const incX, + int const N, double const alpha, + traits::complex_d const* X, int const incX, traits::complex_d* A, int const lda) { - cblas_zher (Order, Uplo, N, alpha, - static_cast<void const*> (X), incX, - static_cast<void*> (A), lda); + cblas_zher (Order, Uplo, N, alpha, + static_cast<void const*> (X), incX, + static_cast<void*> (A), lda); } - // A <- alpha * x * x^H + A - // A hermitian in packed form - - inline + // A <- alpha * x * x^H + A + // A hermitian in packed form + + inline void hpr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, float const alpha, - traits::complex_f const* X, int const incX, + int const N, float const alpha, + traits::complex_f const* X, int const incX, traits::complex_f* Ap) { - cblas_chpr (Order, Uplo, N, alpha, - static_cast<void const*> (X), incX, - static_cast<void*> (Ap)); + cblas_chpr (Order, Uplo, N, alpha, + static_cast<void const*> (X), incX, + static_cast<void*> (Ap)); } - inline + inline void hpr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, double const alpha, - traits::complex_d const* X, int const incX, + int const N, double const alpha, + traits::complex_d const* X, int const incX, traits::complex_d* Ap) { - cblas_zhpr (Order, Uplo, N, alpha, - static_cast<void const*> (X), incX, - static_cast<void*> (Ap)); + cblas_zhpr (Order, Uplo, N, alpha, + static_cast<void const*> (X), incX, + static_cast<void*> (Ap)); } - // A <- alpha * x * y^H + y * (alpha * x)^H + A + // A <- alpha * x * y^H + y * (alpha * x)^H + A // A hermitian - inline + inline void her2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_f const& alpha, - traits::complex_f const* X, int const incX, - traits::complex_f const* Y, int const incY, + int const N, traits::complex_f const& alpha, + traits::complex_f const* X, int const incX, + traits::complex_f const* Y, int const incY, traits::complex_f* A, int const lda) { - cblas_cher2 (Order, Uplo, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (A), lda); + cblas_cher2 (Order, Uplo, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (A), lda); } - inline + inline void her2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_d const& alpha, - traits::complex_d const* X, int const incX, - traits::complex_d const* Y, int const incY, + int const N, traits::complex_d const& alpha, + traits::complex_d const* X, int const incX, + traits::complex_d const* Y, int const incY, traits::complex_d* A, int const lda) { - cblas_zher2 (Order, Uplo, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (A), lda); + cblas_zher2 (Order, Uplo, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (A), lda); } - // A <- alpha * x * y^H + y * (alpha * x)^H + A - // A hermitian in packed form - - inline + // A <- alpha * x * y^H + y * (alpha * x)^H + A + // A hermitian in packed form + + inline void hpr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_f const& alpha, - traits::complex_f const* X, int const incX, - traits::complex_f const* Y, int const incY, + int const N, traits::complex_f const& alpha, + traits::complex_f const* X, int const incX, + traits::complex_f const* Y, int const incY, traits::complex_f* Ap) { - cblas_chpr2 (Order, Uplo, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (Ap)); + cblas_chpr2 (Order, Uplo, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (Ap)); } - inline + inline void hpr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_d const& alpha, - traits::complex_d const* X, int const incX, - traits::complex_d const* Y, int const incY, + int const N, traits::complex_d const& alpha, + traits::complex_d const* X, int const incX, + traits::complex_d const* Y, int const incY, traits::complex_d* Ap) { - cblas_zhpr2 (Order, Uplo, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (X), incX, - static_cast<void const*> (Y), incY, - static_cast<void*> (Ap)); + cblas_zhpr2 (Order, Uplo, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (X), incX, + static_cast<void const*> (Y), incY, + static_cast<void*> (Ap)); } }} // namepaces detail & atlas -}}} +}}} #endif // BOOST_NUMERIC_BINDINGS_CBLAS2_OVERLOADS_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas3.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas3.hpp index c84652cf6838f96aa8edfa268eccba495b6f4259..7c81dac9881583a017696b5dde50b0d425fd2808 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas3.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas3.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -23,53 +23,53 @@ #include <boost/type_traits/same_traits.hpp> #include <boost/mpl/if.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> #endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { - // C <- alpha * op (A) * op (B) + beta * C + // C <- alpha * op (A) * op (B) + beta * C // op (A) == A || A^T || A^H template <typename T, typename MatrA, typename MatrB, typename MatrC> inline - void gemm (CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, - T const& alpha, MatrA const& a, MatrB const& b, + void gemm (CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, + T const& alpha, MatrA const& a, MatrB const& b, T const& beta, MatrC& c ) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrC>::matrix_structure, + typename traits::matrix_traits<MatrC>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrC>::ordering_type - >::value)); -#endif + >::value)); +#endif - assert (TransA == CblasNoTrans - || TransA == CblasTrans - || TransA == CblasConjTrans); - assert (TransB == CblasNoTrans - || TransB == CblasTrans - || TransB == CblasConjTrans); + assert (TransA == CblasNoTrans + || TransA == CblasTrans + || TransA == CblasConjTrans); + assert (TransB == CblasNoTrans + || TransB == CblasTrans + || TransB == CblasConjTrans); int const m = TransA == CblasNoTrans ? traits::matrix_size1 (a) @@ -79,16 +79,16 @@ namespace boost { namespace numeric { namespace bindings { : traits::matrix_size1 (b); int const k = TransA == CblasNoTrans ? traits::matrix_size2 (a) - : traits::matrix_size1 (a); - assert (m == traits::matrix_size1 (c)); - assert (n == traits::matrix_size2 (c)); + : traits::matrix_size1 (a); + assert (m == traits::matrix_size1 (c)); + assert (n == traits::matrix_size2 (c)); #ifndef NDEBUG int const k1 = TransB == CblasNoTrans ? traits::matrix_size1 (b) : traits::matrix_size2 (b); - assert (k == k1); + assert (k == k1); #endif - // .. what about AtlasConj? + // .. what about AtlasConj? CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -96,98 +96,98 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<MatrA>::ordering_type #else - typename MatrA::orientation_category -#endif - >::value); + typename MatrA::orientation_category +#endif + >::value); - detail::gemm (stor_ord, TransA, TransB, m, n, k, alpha, + detail::gemm (stor_ord, TransA, TransB, m, n, k, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (b), + traits::matrix_storage (b), #else - traits::matrix_storage_const (b), + traits::matrix_storage_const (b), #endif traits::leading_dimension (b), - beta, - traits::matrix_storage (c), - traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), + traits::leading_dimension (c)); } - // C <- alpha * A * B + beta * C + // C <- alpha * A * B + beta * C template <typename T, typename MatrA, typename MatrB, typename MatrC> inline - void gemm (T const& alpha, MatrA const& a, MatrB const& b, - T const& beta, MatrC& c) + void gemm (T const& alpha, MatrA const& a, MatrB const& b, + T const& beta, MatrC& c) { gemm (CblasNoTrans, CblasNoTrans, alpha, a, b, beta, c) ; } - - // C <- A * B + + // C <- A * B template <typename MatrA, typename MatrB, typename MatrC> inline void gemm (MatrA const& a, MatrB const& b, MatrC& c) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrC>::value_type val_t; + typedef typename traits::matrix_traits<MatrC>::value_type val_t; #else - typedef typename MatrC::value_type val_t; -#endif + typedef typename MatrC::value_type val_t; +#endif gemm (CblasNoTrans, CblasNoTrans, (val_t) 1, a, b, (val_t) 0, c); } - // C <- alpha * A * B + beta * C - // C <- alpha * B * A + beta * C + // C <- alpha * A * B + beta * C + // C <- alpha * B * A + beta * C // A == A^T namespace detail { template <typename T, typename SymmA, typename MatrB, typename MatrC> inline - void symm (CBLAS_SIDE const side, CBLAS_UPLO const uplo, - T const& alpha, SymmA const& a, MatrB const& b, + void symm (CBLAS_SIDE const side, CBLAS_UPLO const uplo, + T const& alpha, SymmA const& a, MatrB const& b, T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrC>::matrix_structure, + typename traits::matrix_traits<MatrC>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<SymmA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<SymmA>::ordering_type, typename traits::matrix_traits<MatrC>::ordering_type - >::value)); -#endif + >::value)); +#endif assert (side == CblasLeft || side == CblasRight); - assert (uplo == CblasUpper || uplo == CblasLower); + assert (uplo == CblasUpper || uplo == CblasLower); int const m = traits::matrix_size1 (c); int const n = traits::matrix_size2 (c); - assert (side == CblasLeft - ? m == traits::matrix_size1 (a) + assert (side == CblasLeft + ? m == traits::matrix_size1 (a) && m == traits::matrix_size2 (a) - : n == traits::matrix_size1 (a) - && n == traits::matrix_size2 (a)); - assert (m == traits::matrix_size1 (b) - && n == traits::matrix_size2 (b)); + : n == traits::matrix_size1 (a) + && n == traits::matrix_size2 (a)); + assert (m == traits::matrix_size1 (b) + && n == traits::matrix_size2 (b)); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -195,62 +195,62 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::ordering_type #else - typename SymmA::orientation_category -#endif - >::value); + typename SymmA::orientation_category +#endif + >::value); - symm (stor_ord, side, uplo, - m, n, alpha, + symm (stor_ord, side, uplo, + m, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (b), + traits::matrix_storage (b), #else - traits::matrix_storage_const (b), + traits::matrix_storage_const (b), #endif traits::leading_dimension (b), - beta, - traits::matrix_storage (c), - traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), + traits::leading_dimension (c)); } - } // detail - - // C <- alpha * A * B + beta * C - // C <- alpha * B * A + beta * C + } // detail + + // C <- alpha * A * B + beta * C + // C <- alpha * B * A + beta * C // A == A^T template <typename T, typename SymmA, typename MatrB, typename MatrC> inline - void symm (CBLAS_SIDE const side, CBLAS_UPLO const uplo, - T const& alpha, SymmA const& a, MatrB const& b, + void symm (CBLAS_SIDE const side, CBLAS_UPLO const uplo, + T const& alpha, SymmA const& a, MatrB const& b, T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif - detail::symm (side, uplo, alpha, a, b, beta, c); + detail::symm (side, uplo, alpha, a, b, beta, c); } template <typename T, typename SymmA, typename MatrB, typename MatrC> inline - void symm (CBLAS_SIDE const side, - T const& alpha, SymmA const& a, MatrB const& b, + void symm (CBLAS_SIDE const side, + T const& alpha, SymmA const& a, MatrB const& b, T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -258,11 +258,11 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::uplo_type #else - typename SymmA::packed_category -#endif - >::value); + typename SymmA::packed_category +#endif + >::value); - detail::symm (side, uplo, alpha, a, b, beta, c); + detail::symm (side, uplo, alpha, a, b, beta, c); } @@ -273,140 +273,140 @@ namespace boost { namespace numeric { namespace bindings { // C <- alpha * A * B + beta * C ; A == A^T struct symm_left { template <typename T, typename SymmA, typename MatrB, typename MatrC> - static void f (T const& alpha, SymmA const& a, MatrB const& b, - T const& beta, MatrC& c) + static void f (T const& alpha, SymmA const& a, MatrB const& b, + T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); -#endif +#endif int const m = traits::matrix_size1 (c); int const n = traits::matrix_size2 (c); - assert (m == traits::matrix_size1 (a) - && m == traits::matrix_size2 (a)); - assert (m == traits::matrix_size1 (b) - && n == traits::matrix_size2 (b)); + assert (m == traits::matrix_size1 (a) + && m == traits::matrix_size2 (a)); + assert (m == traits::matrix_size1 (b) + && n == traits::matrix_size2 (b)); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> (storage_order< typename traits::matrix_traits<SymmA>::ordering_type - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> (uplo_triang< typename traits::matrix_traits<SymmA>::uplo_type - >::value); + >::value); - symm (stor_ord, CblasLeft, uplo, - m, n, alpha, + symm (stor_ord, CblasLeft, uplo, + m, n, alpha, traits::matrix_storage (a), traits::leading_dimension (a), traits::matrix_storage (b), traits::leading_dimension (b), - beta, - traits::matrix_storage (c), traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), traits::leading_dimension (c)); } - }; + }; // C <- alpha * A * B + beta * C ; B == B^T struct symm_right { template <typename T, typename MatrA, typename SymmB, typename MatrC> - static void f (T const& alpha, MatrA const& a, SymmB const& b, - T const& beta, MatrC& c) + static void f (T const& alpha, MatrA const& a, SymmB const& b, + T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmB>::matrix_structure, + typename traits::matrix_traits<SymmB>::matrix_structure, traits::symmetric_t >::value)); -#endif +#endif int const m = traits::matrix_size1 (c); int const n = traits::matrix_size2 (c); - assert (n == traits::matrix_size1 (b) - && n == traits::matrix_size2 (b)); - assert (m == traits::matrix_size1 (a) - && n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b) + && n == traits::matrix_size2 (b)); + assert (m == traits::matrix_size1 (a) + && n == traits::matrix_size2 (a)); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> (storage_order< typename traits::matrix_traits<SymmB>::ordering_type - >::value); - + >::value); + CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> (uplo_triang< typename traits::matrix_traits<SymmB>::uplo_type - >::value); + >::value); - symm (stor_ord, CblasRight, uplo, - m, n, alpha, + symm (stor_ord, CblasRight, uplo, + m, n, alpha, traits::matrix_storage (b), traits::leading_dimension (b), traits::matrix_storage (a), traits::leading_dimension (a), - beta, - traits::matrix_storage (c), traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), traits::leading_dimension (c)); } - }; + }; + + } // detail - } // detail - - // C <- alpha * A * B + beta * C - // C <- alpha * B * A + beta * C + // C <- alpha * A * B + beta * C + // C <- alpha * B * A + beta * C // A == A^T template <typename T, typename MatrA, typename MatrB, typename MatrC> inline - void symm (T const& alpha, MatrA const& a, MatrB const& b, + void symm (T const& alpha, MatrA const& a, MatrB const& b, T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrC>::matrix_structure, + typename traits::matrix_traits<MatrC>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrC>::ordering_type - >::value)); -#endif + >::value)); +#endif typedef typename boost::mpl::if_c< boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::symmetric_t >::value, - detail::symm_left, + detail::symm_left, detail::symm_right - >::type functor; + >::type functor; - functor::f (alpha, a, b, beta, c); + functor::f (alpha, a, b, beta, c); } - // C <- A * B - // C <- B * A + // C <- A * B + // C <- B * A template <typename MatrA, typename MatrB, typename MatrC> inline void symm (MatrA const& a, MatrB const& b, MatrC& c) { - typedef typename traits::matrix_traits<MatrC>::value_type val_t; + typedef typename traits::matrix_traits<MatrC>::value_type val_t; symm ((val_t) 1, a, b, (val_t) 0, c); } @@ -414,51 +414,51 @@ namespace boost { namespace numeric { namespace bindings { - // C <- alpha * A * B + beta * C - // C <- alpha * B * A + beta * C + // C <- alpha * A * B + beta * C + // C <- alpha * B * A + beta * C // A == A^H namespace detail { template <typename T, typename HermA, typename MatrB, typename MatrC> inline - void hemm (CBLAS_SIDE const side, CBLAS_UPLO const uplo, - T const& alpha, HermA const& a, MatrB const& b, + void hemm (CBLAS_SIDE const side, CBLAS_UPLO const uplo, + T const& alpha, HermA const& a, MatrB const& b, T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrC>::matrix_structure, + typename traits::matrix_traits<MatrC>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<HermA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<HermA>::ordering_type, typename traits::matrix_traits<MatrC>::ordering_type - >::value)); -#endif + >::value)); +#endif assert (side == CblasLeft || side == CblasRight); - assert (uplo == CblasUpper || uplo == CblasLower); + assert (uplo == CblasUpper || uplo == CblasLower); int const m = traits::matrix_size1 (c); int const n = traits::matrix_size2 (c); - assert (side == CblasLeft - ? m == traits::matrix_size1 (a) + assert (side == CblasLeft + ? m == traits::matrix_size1 (a) && m == traits::matrix_size2 (a) - : n == traits::matrix_size1 (a) - && n == traits::matrix_size2 (a)); - assert (m == traits::matrix_size1 (b) - && n == traits::matrix_size2 (b)); + : n == traits::matrix_size1 (a) + && n == traits::matrix_size2 (a)); + assert (m == traits::matrix_size1 (b) + && n == traits::matrix_size2 (b)); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -466,62 +466,62 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermA>::ordering_type #else - typename HermA::orientation_category -#endif - >::value); + typename HermA::orientation_category +#endif + >::value); - hemm (stor_ord, side, uplo, - m, n, alpha, + hemm (stor_ord, side, uplo, + m, n, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (b), + traits::matrix_storage (b), #else - traits::matrix_storage_const (b), + traits::matrix_storage_const (b), #endif traits::leading_dimension (b), - beta, - traits::matrix_storage (c), - traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), + traits::leading_dimension (c)); } - } // detail - - // C <- alpha * A * B + beta * C - // C <- alpha * B * A + beta * C + } // detail + + // C <- alpha * A * B + beta * C + // C <- alpha * B * A + beta * C // A == A^H template <typename T, typename HermA, typename MatrB, typename MatrC> inline - void hemm (CBLAS_SIDE const side, CBLAS_UPLO const uplo, - T const& alpha, HermA const& a, MatrB const& b, + void hemm (CBLAS_SIDE const side, CBLAS_UPLO const uplo, + T const& alpha, HermA const& a, MatrB const& b, T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif - detail::hemm (side, uplo, alpha, a, b, beta, c); + detail::hemm (side, uplo, alpha, a, b, beta, c); } template <typename T, typename HermA, typename MatrB, typename MatrC> inline - void hemm (CBLAS_SIDE const side, - T const& alpha, HermA const& a, MatrB const& b, + void hemm (CBLAS_SIDE const side, + T const& alpha, HermA const& a, MatrB const& b, T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -529,11 +529,11 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermA>::uplo_type #else - typename HermA::packed_category -#endif - >::value); + typename HermA::packed_category +#endif + >::value); - detail::hemm (side, uplo, alpha, a, b, beta, c); + detail::hemm (side, uplo, alpha, a, b, beta, c); } @@ -544,143 +544,143 @@ namespace boost { namespace numeric { namespace bindings { // C <- alpha * A * B + beta * C ; A == A^H struct hemm_left { template <typename T, typename HermA, typename MatrB, typename MatrC> - static void f (T const& alpha, HermA const& a, MatrB const& b, - T const& beta, MatrC& c) + static void f (T const& alpha, HermA const& a, MatrB const& b, + T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); -#endif +#endif int const m = traits::matrix_size1 (c); int const n = traits::matrix_size2 (c); - assert (m == traits::matrix_size1 (a) - && m == traits::matrix_size2 (a)); - assert (m == traits::matrix_size1 (b) - && n == traits::matrix_size2 (b)); + assert (m == traits::matrix_size1 (a) + && m == traits::matrix_size2 (a)); + assert (m == traits::matrix_size1 (b) + && n == traits::matrix_size2 (b)); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> (storage_order< typename traits::matrix_traits<HermA>::ordering_type - >::value); + >::value); CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> (uplo_triang< typename traits::matrix_traits<HermA>::uplo_type - >::value); + >::value); - hemm (stor_ord, CblasLeft, uplo, - m, n, alpha, + hemm (stor_ord, CblasLeft, uplo, + m, n, alpha, traits::matrix_storage (a), traits::leading_dimension (a), traits::matrix_storage (b), traits::leading_dimension (b), - beta, - traits::matrix_storage (c), traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), traits::leading_dimension (c)); } - }; + }; // C <- alpha * A * B + beta * C ; B == B^H struct hemm_right { template <typename T, typename MatrA, typename HermB, typename MatrC> - static void f (T const& alpha, MatrA const& a, HermB const& b, - T const& beta, MatrC& c) + static void f (T const& alpha, MatrA const& a, HermB const& b, + T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermB>::matrix_structure, + typename traits::matrix_traits<HermB>::matrix_structure, traits::hermitian_t >::value)); -#endif +#endif int const m = traits::matrix_size1 (c); int const n = traits::matrix_size2 (c); - assert (n == traits::matrix_size1 (b) - && n == traits::matrix_size2 (b)); - assert (m == traits::matrix_size1 (a) - && n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b) + && n == traits::matrix_size2 (b)); + assert (m == traits::matrix_size1 (a) + && n == traits::matrix_size2 (a)); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> (storage_order< typename traits::matrix_traits<HermB>::ordering_type - >::value); - + >::value); + CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> (uplo_triang< typename traits::matrix_traits<HermB>::uplo_type - >::value); + >::value); - hemm (stor_ord, CblasRight, uplo, - m, n, alpha, + hemm (stor_ord, CblasRight, uplo, + m, n, alpha, traits::matrix_storage (b), traits::leading_dimension (b), traits::matrix_storage (a), traits::leading_dimension (a), - beta, - traits::matrix_storage (c), traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), traits::leading_dimension (c)); } - }; + }; + + } - } - template <typename T, typename MatrA, typename MatrB, typename MatrC> inline - void hemm (T const& alpha, MatrA const& a, MatrB const& b, + void hemm (T const& alpha, MatrA const& a, MatrB const& b, T const& beta, MatrC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrC>::matrix_structure, + typename traits::matrix_traits<MatrC>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrC>::ordering_type - >::value)); -#endif + >::value)); +#endif typedef typename boost::mpl::if_c< boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::hermitian_t >::value, - detail::hemm_left, + detail::hemm_left, detail::hemm_right - >::type functor; + >::type functor; - functor::f (alpha, a, b, beta, c); + functor::f (alpha, a, b, beta, c); } - // C <- A * B - // C <- B * A + // C <- A * B + // C <- B * A template <typename MatrA, typename MatrB, typename MatrC> inline void hemm (MatrA const& a, MatrB const& b, MatrC& c) { - typedef typename traits::matrix_traits<MatrC>::value_type val_t; + typedef typename traits::matrix_traits<MatrC>::value_type val_t; hemm ((val_t) 1, a, b, (val_t) 0, c); } #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - + // C <- alpha * A * A^T + beta * C // C <- alpha * A^T * A + beta * C // C == C^T @@ -689,35 +689,35 @@ namespace boost { namespace numeric { namespace bindings { template <typename T, typename MatrA, typename SymmC> inline - void syrk (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, + void syrk (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, T const& beta, SymmC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<SymmC>::ordering_type - >::value)); -#endif + >::value)); +#endif - assert (uplo == CblasUpper || uplo == CblasLower); - assert (trans == CblasNoTrans - || trans == CblasTrans - || trans == CblasConjTrans); + assert (uplo == CblasUpper || uplo == CblasLower); + assert (trans == CblasNoTrans + || trans == CblasTrans + || trans == CblasConjTrans); int const n = traits::matrix_size1 (c); - assert (n == traits::matrix_size2 (c)); - + assert (n == traits::matrix_size2 (c)); + int const k = trans == CblasNoTrans ? traits::matrix_size2 (a) - : traits::matrix_size1 (a); + : traits::matrix_size1 (a); assert (n == (trans == CblasNoTrans ? traits::matrix_size1 (a) - : traits::matrix_size2 (a))); + : traits::matrix_size2 (a))); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -725,56 +725,56 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmC>::ordering_type #else - typename SymmC::orientation_category -#endif - >::value); + typename SymmC::orientation_category +#endif + >::value); - syrk (stor_ord, uplo, trans, - n, k, alpha, + syrk (stor_ord, uplo, trans, + n, k, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), - beta, - traits::matrix_storage (c), - traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), + traits::leading_dimension (c)); } - } // detail - + } // detail + // C <- alpha * A * A^T + beta * C // C <- alpha * A^T * A + beta * C // C == C^T template <typename T, typename MatrA, typename SymmC> inline - void syrk (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, + void syrk (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, T const& beta, SymmC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmC>::matrix_structure, + typename traits::matrix_traits<SymmC>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif - detail::syrk (uplo, trans, alpha, a, beta, c); + detail::syrk (uplo, trans, alpha, a, beta, c); } template <typename T, typename MatrA, typename SymmC> inline - void syrk (CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, + void syrk (CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, T const& beta, SymmC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmC>::matrix_structure, + typename traits::matrix_traits<SymmC>::matrix_structure, traits::symmetric_t - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -782,11 +782,11 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmC>::uplo_type #else - typename SymmC::packed_category -#endif - >::value); + typename SymmC::packed_category +#endif + >::value); - detail::syrk (uplo, trans, alpha, a, beta, c); + detail::syrk (uplo, trans, alpha, a, beta, c); } // C <- A * A^T + C @@ -795,14 +795,14 @@ namespace boost { namespace numeric { namespace bindings { inline void syrk (CBLAS_TRANSPOSE trans, MatrA const& a, SymmC& c) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmC>::value_type val_t; + typedef typename traits::matrix_traits<SymmC>::value_type val_t; #else - typedef typename SymmC::value_type val_t; -#endif + typedef typename SymmC::value_type val_t; +#endif syrk (trans, (val_t) 1, a, (val_t) 0, c); } - + // C <- alpha * A * B^T + conj(alpha) * B * A^T + beta * C // C <- alpha * A^T * B + conj(alpha) * B^T * A + beta * C // C == C^T @@ -811,49 +811,49 @@ namespace boost { namespace numeric { namespace bindings { template <typename T, typename MatrA, typename MatrB, typename SymmC> inline - void syr2k (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, MatrB const& b, + void syr2k (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, MatrB const& b, T const& beta, SymmC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<SymmC>::ordering_type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrB>::ordering_type, typename traits::matrix_traits<SymmC>::ordering_type - >::value)); -#endif + >::value)); +#endif - assert (uplo == CblasUpper || uplo == CblasLower); - assert (trans == CblasNoTrans - || trans == CblasTrans - || trans == CblasConjTrans); + assert (uplo == CblasUpper || uplo == CblasLower); + assert (trans == CblasNoTrans + || trans == CblasTrans + || trans == CblasConjTrans); int const n = traits::matrix_size1 (c); - assert (n == traits::matrix_size2 (c)); - + assert (n == traits::matrix_size2 (c)); + int const k = trans == CblasNoTrans ? traits::matrix_size2 (a) - : traits::matrix_size1 (a); + : traits::matrix_size1 (a); assert (k == (trans == CblasNoTrans ? traits::matrix_size2 (b) - : traits::matrix_size1 (b))); + : traits::matrix_size1 (b))); assert (n == (trans == CblasNoTrans ? traits::matrix_size1 (a) - : traits::matrix_size2 (a))); + : traits::matrix_size2 (a))); assert (n == (trans == CblasNoTrans ? traits::matrix_size1 (b) - : traits::matrix_size2 (b))); + : traits::matrix_size2 (b))); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -861,62 +861,62 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmC>::ordering_type #else - typename SymmC::orientation_category -#endif - >::value); + typename SymmC::orientation_category +#endif + >::value); - syr2k (stor_ord, uplo, trans, - n, k, alpha, + syr2k (stor_ord, uplo, trans, + n, k, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (b), + traits::matrix_storage (b), #else - traits::matrix_storage_const (b), + traits::matrix_storage_const (b), #endif traits::leading_dimension (b), - beta, - traits::matrix_storage (c), - traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), + traits::leading_dimension (c)); } - } // detail - + } // detail + // C <- alpha * A * B^T + conj(alpha) * B * A^T + beta * C // C <- alpha * A^T * B + conj(alpha) * B^T * A + beta * C // C == C^T template <typename T, typename MatrA, typename MatrB, typename SymmC> inline - void syr2k (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, MatrB const& b, + void syr2k (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, MatrB const& b, T const& beta, SymmC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmC>::matrix_structure, + typename traits::matrix_traits<SymmC>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif - detail::syr2k (uplo, trans, alpha, a, b, beta, c); + detail::syr2k (uplo, trans, alpha, a, b, beta, c); } template <typename T, typename MatrA, typename MatrB, typename SymmC> inline - void syr2k (CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, MatrB const& b, + void syr2k (CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, MatrB const& b, T const& beta, SymmC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmC>::matrix_structure, + typename traits::matrix_traits<SymmC>::matrix_structure, traits::symmetric_t - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -924,29 +924,29 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmC>::uplo_type #else - typename SymmC::packed_category -#endif - >::value); + typename SymmC::packed_category +#endif + >::value); - detail::syr2k (uplo, trans, alpha, a, b, beta, c); + detail::syr2k (uplo, trans, alpha, a, b, beta, c); } // C <- A * B^T + B * A^T + C // C <- A^T * B + B^T * A + C template <typename MatrA, typename MatrB, typename SymmC> inline - void syr2k (CBLAS_TRANSPOSE trans, - MatrA const& a, MatrB const& b, SymmC& c) + void syr2k (CBLAS_TRANSPOSE trans, + MatrA const& a, MatrB const& b, SymmC& c) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmC>::value_type val_t; + typedef typename traits::matrix_traits<SymmC>::value_type val_t; #else - typedef typename SymmC::value_type val_t; -#endif + typedef typename SymmC::value_type val_t; +#endif syr2k (trans, (val_t) 1, a, b, (val_t) 0, c); } - + // C <- alpha * A * A^H + beta * C // C <- alpha * A^H * A + beta * C // C == C^H @@ -955,33 +955,33 @@ namespace boost { namespace numeric { namespace bindings { template <typename T, typename MatrA, typename HermC> inline - void herk (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, + void herk (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, T const& beta, HermC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<HermC>::ordering_type - >::value)); -#endif + >::value)); +#endif - assert (uplo == CblasUpper || uplo == CblasLower); - assert (trans == CblasNoTrans || trans == CblasConjTrans); + assert (uplo == CblasUpper || uplo == CblasLower); + assert (trans == CblasNoTrans || trans == CblasConjTrans); int const n = traits::matrix_size1 (c); - assert (n == traits::matrix_size2 (c)); - + assert (n == traits::matrix_size2 (c)); + int const k = trans == CblasNoTrans ? traits::matrix_size2 (a) - : traits::matrix_size1 (a); + : traits::matrix_size1 (a); assert (n == (trans == CblasNoTrans ? traits::matrix_size1 (a) - : traits::matrix_size2 (a))); + : traits::matrix_size2 (a))); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -989,56 +989,56 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermC>::ordering_type #else - typename HermC::orientation_category -#endif - >::value); + typename HermC::orientation_category +#endif + >::value); - herk (stor_ord, uplo, trans, - n, k, alpha, + herk (stor_ord, uplo, trans, + n, k, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), - beta, - traits::matrix_storage (c), - traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), + traits::leading_dimension (c)); } - } // detail - + } // detail + // C <- alpha * A * A^H + beta * C // C <- alpha * A^H * A + beta * C // C == C^H template <typename T, typename MatrA, typename HermC> inline - void herk (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, + void herk (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, T const& beta, HermC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermC>::matrix_structure, + typename traits::matrix_traits<HermC>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif - detail::herk (uplo, trans, alpha, a, beta, c); + detail::herk (uplo, trans, alpha, a, beta, c); } template <typename T, typename MatrA, typename HermC> inline - void herk (CBLAS_TRANSPOSE trans, - T const& alpha, MatrA const& a, + void herk (CBLAS_TRANSPOSE trans, + T const& alpha, MatrA const& a, T const& beta, HermC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermC>::matrix_structure, + typename traits::matrix_traits<HermC>::matrix_structure, traits::hermitian_t - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -1046,11 +1046,11 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermC>::uplo_type #else - typename HermC::packed_category -#endif - >::value); + typename HermC::packed_category +#endif + >::value); - detail::herk (uplo, trans, alpha, a, beta, c); + detail::herk (uplo, trans, alpha, a, beta, c); } // C <- A * A^H + C @@ -1059,11 +1059,11 @@ namespace boost { namespace numeric { namespace bindings { inline void herk (CBLAS_TRANSPOSE trans, MatrA const& a, HermC& c) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermC>::value_type val_t; + typedef typename traits::matrix_traits<HermC>::value_type val_t; #else - typedef typename HermC::value_type val_t; -#endif - typedef typename traits::type_traits<val_t>::real_type real_t; + typedef typename HermC::value_type val_t; +#endif + typedef typename traits::type_traits<val_t>::real_type real_t; herk (trans, (real_t) 1, a, (real_t) 0, c); } @@ -1074,50 +1074,50 @@ namespace boost { namespace numeric { namespace bindings { namespace detail { - template <typename T1, typename T2, + template <typename T1, typename T2, typename MatrA, typename MatrB, typename HermC> inline - void her2k (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, - T1 const& alpha, MatrA const& a, MatrB const& b, + void her2k (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, + T1 const& alpha, MatrA const& a, MatrB const& b, T2 const& beta, HermC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<HermC>::ordering_type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrB>::ordering_type, typename traits::matrix_traits<HermC>::ordering_type - >::value)); -#endif + >::value)); +#endif - assert (uplo == CblasUpper || uplo == CblasLower); - assert (trans == CblasNoTrans || trans == CblasConjTrans); + assert (uplo == CblasUpper || uplo == CblasLower); + assert (trans == CblasNoTrans || trans == CblasConjTrans); int const n = traits::matrix_size1 (c); - assert (n == traits::matrix_size2 (c)); - + assert (n == traits::matrix_size2 (c)); + int const k = trans == CblasNoTrans ? traits::matrix_size2 (a) - : traits::matrix_size1 (a); + : traits::matrix_size1 (a); assert (k == (trans == CblasNoTrans ? traits::matrix_size2 (b) - : traits::matrix_size1 (b))); + : traits::matrix_size1 (b))); assert (n == (trans == CblasNoTrans ? traits::matrix_size1 (a) - : traits::matrix_size2 (a))); + : traits::matrix_size2 (a))); assert (n == (trans == CblasNoTrans ? traits::matrix_size1 (b) - : traits::matrix_size2 (b))); + : traits::matrix_size2 (b))); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -1125,64 +1125,64 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermC>::ordering_type #else - typename HermC::orientation_category -#endif - >::value); + typename HermC::orientation_category +#endif + >::value); - her2k (stor_ord, uplo, trans, - n, k, alpha, + her2k (stor_ord, uplo, trans, + n, k, alpha, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), + traits::matrix_storage_const (a), #endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (b), + traits::matrix_storage (b), #else - traits::matrix_storage_const (b), + traits::matrix_storage_const (b), #endif traits::leading_dimension (b), - beta, - traits::matrix_storage (c), - traits::leading_dimension (c)); + beta, + traits::matrix_storage (c), + traits::leading_dimension (c)); } - } // detail - + } // detail + // C <- alpha * A * B^H + conj(alpha) * B * A^H + beta * C // C <- alpha * A^H * B + conj(alpha) * B^H * A + beta * C // C == C^H - template <typename T1, typename T2, + template <typename T1, typename T2, typename MatrA, typename MatrB, typename HermC> inline - void her2k (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, - T1 const& alpha, MatrA const& a, MatrB const& b, + void her2k (CBLAS_UPLO const uplo, CBLAS_TRANSPOSE trans, + T1 const& alpha, MatrA const& a, MatrB const& b, T2 const& beta, HermC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermC>::matrix_structure, + typename traits::matrix_traits<HermC>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif - detail::her2k (uplo, trans, alpha, a, b, beta, c); + detail::her2k (uplo, trans, alpha, a, b, beta, c); } - template <typename T1, typename T2, + template <typename T1, typename T2, typename MatrA, typename MatrB, typename HermC> inline - void her2k (CBLAS_TRANSPOSE trans, - T1 const& alpha, MatrA const& a, MatrB const& b, + void her2k (CBLAS_TRANSPOSE trans, + T1 const& alpha, MatrA const& a, MatrB const& b, T2 const& beta, HermC& c) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermC>::matrix_structure, + typename traits::matrix_traits<HermC>::matrix_structure, traits::hermitian_t - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -1190,32 +1190,32 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<HermC>::uplo_type #else - typename HermC::packed_category -#endif - >::value); + typename HermC::packed_category +#endif + >::value); - detail::her2k (uplo, trans, alpha, a, b, beta, c); + detail::her2k (uplo, trans, alpha, a, b, beta, c); } // C <- A * B^H + B * A^H + C // C <- A^H * B + B^H * A + C template <typename MatrA, typename MatrB, typename HermC> inline - void her2k (CBLAS_TRANSPOSE trans, - MatrA const& a, MatrB const& b, HermC& c) + void her2k (CBLAS_TRANSPOSE trans, + MatrA const& a, MatrB const& b, HermC& c) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermC>::value_type val_t; + typedef typename traits::matrix_traits<HermC>::value_type val_t; #else - typedef typename HermC::value_type val_t; -#endif - typedef typename traits::type_traits<val_t>::real_type real_t; + typedef typename HermC::value_type val_t; +#endif + typedef typename traits::type_traits<val_t>::real_type real_t; her2k (trans, (val_t) 1, a, b, (real_t) 0, c); } - + } // namespace atlas -}}} +}}} #endif // BOOST_NUMERIC_BINDINGS_CBLAS_LEVEL_3_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas3_overloads.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas3_overloads.hpp index 5fa1e93e9fa3c61e807e0c297e58ee16d8c5329f..174097a35ad2881e72330ecc2975cee2834662a9 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas3_overloads.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas3_overloads.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,183 +14,183 @@ #ifndef BOOST_NUMERIC_BINDINGS_CBLAS3_OVERLOADS_HPP #define BOOST_NUMERIC_BINDINGS_CBLAS3_OVERLOADS_HPP -#include <complex> +#include <complex> #include <boost/numeric/bindings/atlas/cblas_inc.hpp> #include <boost/numeric/bindings/traits/type.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { namespace detail { - // C <- alpha * op (A) * op (B) + beta * C - - inline - void gemm (CBLAS_ORDER const Order, - CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, - int const M, int const N, int const K, + // C <- alpha * op (A) * op (B) + beta * C + + inline + void gemm (CBLAS_ORDER const Order, + CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, + int const M, int const N, int const K, float const alpha, float const* A, int const lda, - float const* B, int const ldb, - float const beta, float* C, int const ldc) + float const* B, int const ldb, + float const beta, float* C, int const ldc) { - cblas_sgemm (Order, TransA, TransB, M, N, K, - alpha, A, lda, + cblas_sgemm (Order, TransA, TransB, M, N, K, + alpha, A, lda, B, ldb, - beta, C, ldc); + beta, C, ldc); } - inline - void gemm (CBLAS_ORDER const Order, - CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, - int const M, int const N, int const K, + inline + void gemm (CBLAS_ORDER const Order, + CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, + int const M, int const N, int const K, double const alpha, double const* A, int const lda, - double const* B, int const ldb, - double const beta, double* C, int const ldc) + double const* B, int const ldb, + double const beta, double* C, int const ldc) { - cblas_dgemm (Order, TransA, TransB, M, N, K, - alpha, A, lda, + cblas_dgemm (Order, TransA, TransB, M, N, K, + alpha, A, lda, B, ldb, - beta, C, ldc); + beta, C, ldc); } - inline - void gemm (CBLAS_ORDER const Order, - CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, - int const M, int const N, int const K, - traits::complex_f const& alpha, + inline + void gemm (CBLAS_ORDER const Order, + CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, + int const M, int const N, int const K, + traits::complex_f const& alpha, traits::complex_f const* A, int const lda, - traits::complex_f const* B, int const ldb, - traits::complex_f const& beta, - traits::complex_f* C, int const ldc) + traits::complex_f const* B, int const ldb, + traits::complex_f const& beta, + traits::complex_f* C, int const ldc) { - cblas_cgemm (Order, TransA, TransB, M, N, K, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, + cblas_cgemm (Order, TransA, TransB, M, N, K, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, static_cast<void const*> (B), ldb, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } - - inline - void gemm (CBLAS_ORDER const Order, - CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, - int const M, int const N, int const K, - traits::complex_d const& alpha, + + inline + void gemm (CBLAS_ORDER const Order, + CBLAS_TRANSPOSE const TransA, CBLAS_TRANSPOSE const TransB, + int const M, int const N, int const K, + traits::complex_d const& alpha, traits::complex_d const* A, int const lda, - traits::complex_d const* B, int const ldb, - traits::complex_d const& beta, - traits::complex_d* C, int const ldc) + traits::complex_d const* B, int const ldb, + traits::complex_d const& beta, + traits::complex_d* C, int const ldc) { - cblas_zgemm (Order, TransA, TransB, M, N, K, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, + cblas_zgemm (Order, TransA, TransB, M, N, K, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, static_cast<void const*> (B), ldb, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } - - // C <- alpha * A * B + beta * C - // C <- alpha * B * A + beta * C + + // C <- alpha * A * B + beta * C + // C <- alpha * B * A + beta * C // A == A^T - inline + inline void symm (CBLAS_ORDER const Order, CBLAS_SIDE const Side, - CBLAS_UPLO const Uplo, int const M, int const N, + CBLAS_UPLO const Uplo, int const M, int const N, float const alpha, float const* A, int const lda, - float const* B, int const ldb, - float const beta, float* C, int const ldc) + float const* B, int const ldb, + float const beta, float* C, int const ldc) { - cblas_ssymm (Order, Side, Uplo, M, N, - alpha, A, lda, + cblas_ssymm (Order, Side, Uplo, M, N, + alpha, A, lda, B, ldb, - beta, C, ldc); + beta, C, ldc); } - - inline + + inline void symm (CBLAS_ORDER const Order, CBLAS_SIDE const Side, - CBLAS_UPLO const Uplo, int const M, int const N, + CBLAS_UPLO const Uplo, int const M, int const N, double const alpha, double const* A, int const lda, - double const* B, int const ldb, - double const beta, double* C, int const ldc) + double const* B, int const ldb, + double const beta, double* C, int const ldc) { - cblas_dsymm (Order, Side, Uplo, M, N, - alpha, A, lda, + cblas_dsymm (Order, Side, Uplo, M, N, + alpha, A, lda, B, ldb, - beta, C, ldc); + beta, C, ldc); } - - inline + + inline void symm (CBLAS_ORDER const Order, CBLAS_SIDE const Side, - CBLAS_UPLO const Uplo, int const M, int const N, - traits::complex_f const& alpha, + CBLAS_UPLO const Uplo, int const M, int const N, + traits::complex_f const& alpha, traits::complex_f const* A, int const lda, - traits::complex_f const* B, int const ldb, - traits::complex_f const& beta, - traits::complex_f* C, int const ldc) + traits::complex_f const* B, int const ldb, + traits::complex_f const& beta, + traits::complex_f* C, int const ldc) { - cblas_csymm (Order, Side, Uplo, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, + cblas_csymm (Order, Side, Uplo, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, static_cast<void const*> (B), ldb, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } - - inline + + inline void symm (CBLAS_ORDER const Order, CBLAS_SIDE const Side, - CBLAS_UPLO const Uplo, int const M, int const N, - traits::complex_d const& alpha, + CBLAS_UPLO const Uplo, int const M, int const N, + traits::complex_d const& alpha, traits::complex_d const* A, int const lda, - traits::complex_d const* B, int const ldb, - traits::complex_d const& beta, - traits::complex_d* C, int const ldc) + traits::complex_d const* B, int const ldb, + traits::complex_d const& beta, + traits::complex_d* C, int const ldc) { - cblas_zsymm (Order, Side, Uplo, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, + cblas_zsymm (Order, Side, Uplo, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, static_cast<void const*> (B), ldb, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } - - // C <- alpha * A * B + beta * C - // C <- alpha * B * A + beta * C + + // C <- alpha * A * B + beta * C + // C <- alpha * B * A + beta * C // A == A^H - - inline + + inline void hemm (CBLAS_ORDER const Order, CBLAS_SIDE const Side, - CBLAS_UPLO const Uplo, int const M, int const N, - traits::complex_f const& alpha, + CBLAS_UPLO const Uplo, int const M, int const N, + traits::complex_f const& alpha, traits::complex_f const* A, int const lda, - traits::complex_f const* B, int const ldb, - traits::complex_f const& beta, - traits::complex_f* C, int const ldc) + traits::complex_f const* B, int const ldb, + traits::complex_f const& beta, + traits::complex_f* C, int const ldc) { - cblas_chemm (Order, Side, Uplo, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, + cblas_chemm (Order, Side, Uplo, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, static_cast<void const*> (B), ldb, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } - - inline + + inline void hemm (CBLAS_ORDER const Order, CBLAS_SIDE const Side, - CBLAS_UPLO const Uplo, int const M, int const N, - traits::complex_d const& alpha, + CBLAS_UPLO const Uplo, int const M, int const N, + traits::complex_d const& alpha, traits::complex_d const* A, int const lda, - traits::complex_d const* B, int const ldb, - traits::complex_d const& beta, - traits::complex_d* C, int const ldc) + traits::complex_d const* B, int const ldb, + traits::complex_d const& beta, + traits::complex_d* C, int const ldc) { - cblas_zhemm (Order, Side, Uplo, M, N, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, + cblas_zhemm (Order, Side, Uplo, M, N, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, static_cast<void const*> (B), ldb, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } @@ -202,48 +202,48 @@ namespace boost { namespace numeric { namespace bindings { void syrk (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, float const alpha, float const* A, int const lda, - float const beta, float* C, int const ldc) + float const beta, float* C, int const ldc) { - cblas_ssyrk (Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); + cblas_ssyrk (Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); } inline void syrk (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, double const alpha, double const* A, int const lda, - double const beta, double* C, int const ldc) + double const beta, double* C, int const ldc) { - cblas_dsyrk (Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); + cblas_dsyrk (Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); } inline void syrk (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, - traits::complex_f const& alpha, + traits::complex_f const& alpha, traits::complex_f const* A, int const lda, - traits::complex_f const& beta, - traits::complex_f* C, int const ldc) + traits::complex_f const& beta, + traits::complex_f* C, int const ldc) { - cblas_csyrk (Order, Uplo, Trans, N, K, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + cblas_csyrk (Order, Uplo, Trans, N, K, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } inline void syrk (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, - traits::complex_d const& alpha, + traits::complex_d const& alpha, traits::complex_d const* A, int const lda, - traits::complex_d const& beta, - traits::complex_d* C, int const ldc) + traits::complex_d const& beta, + traits::complex_d* C, int const ldc) { - cblas_zsyrk (Order, Uplo, Trans, N, K, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + cblas_zsyrk (Order, Uplo, Trans, N, K, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } @@ -256,10 +256,10 @@ namespace boost { namespace numeric { namespace bindings { CBLAS_TRANSPOSE const Trans, int const N, int const K, float const alpha, float const* A, int const lda, float const* B, int const ldb, - float const beta, float* C, int const ldc) + float const beta, float* C, int const ldc) { - cblas_ssyr2k (Order, Uplo, Trans, N, K, - alpha, A, lda, B, ldb, beta, C, ldc); + cblas_ssyr2k (Order, Uplo, Trans, N, K, + alpha, A, lda, B, ldb, beta, C, ldc); } inline @@ -267,44 +267,44 @@ namespace boost { namespace numeric { namespace bindings { CBLAS_TRANSPOSE const Trans, int const N, int const K, double const alpha, double const* A, int const lda, double const* B, int const ldb, - double const beta, double* C, int const ldc) + double const beta, double* C, int const ldc) { - cblas_dsyr2k (Order, Uplo, Trans, N, K, - alpha, A, lda, B, ldb, beta, C, ldc); + cblas_dsyr2k (Order, Uplo, Trans, N, K, + alpha, A, lda, B, ldb, beta, C, ldc); } inline void syr2k (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, - traits::complex_f const& alpha, + traits::complex_f const& alpha, traits::complex_f const* A, int const lda, traits::complex_f const* B, int const ldb, - traits::complex_f const& beta, - traits::complex_f* C, int const ldc) + traits::complex_f const& beta, + traits::complex_f* C, int const ldc) { - cblas_csyr2k (Order, Uplo, Trans, N, K, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, - static_cast<void const*> (B), ldb, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + cblas_csyr2k (Order, Uplo, Trans, N, K, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, + static_cast<void const*> (B), ldb, + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } inline void syr2k (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, - traits::complex_d const& alpha, + traits::complex_d const& alpha, traits::complex_d const* A, int const lda, traits::complex_d const* B, int const ldb, - traits::complex_d const& beta, - traits::complex_d* C, int const ldc) + traits::complex_d const& beta, + traits::complex_d* C, int const ldc) { - cblas_zsyr2k (Order, Uplo, Trans, N, K, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, - static_cast<void const*> (B), ldb, - static_cast<void const*> (&beta), - static_cast<void*> (C), ldc); + cblas_zsyr2k (Order, Uplo, Trans, N, K, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, + static_cast<void const*> (B), ldb, + static_cast<void const*> (&beta), + static_cast<void*> (C), ldc); } @@ -316,22 +316,22 @@ namespace boost { namespace numeric { namespace bindings { void herk (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, float alpha, traits::complex_f const* A, int const lda, - float beta, traits::complex_f* C, int const ldc) + float beta, traits::complex_f* C, int const ldc) { - cblas_cherk (Order, Uplo, Trans, N, K, - alpha, static_cast<void const*> (A), lda, - beta, static_cast<void*> (C), ldc); + cblas_cherk (Order, Uplo, Trans, N, K, + alpha, static_cast<void const*> (A), lda, + beta, static_cast<void*> (C), ldc); } inline void herk (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, double alpha, traits::complex_d const* A, int const lda, - double beta, traits::complex_d* C, int const ldc) + double beta, traits::complex_d* C, int const ldc) { - cblas_zherk (Order, Uplo, Trans, N, K, - alpha, static_cast<void const*> (A), lda, - beta, static_cast<void*> (C), ldc); + cblas_zherk (Order, Uplo, Trans, N, K, + alpha, static_cast<void const*> (A), lda, + beta, static_cast<void*> (C), ldc); } @@ -342,37 +342,37 @@ namespace boost { namespace numeric { namespace bindings { inline void her2k (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, - traits::complex_f const& alpha, + traits::complex_f const& alpha, traits::complex_f const* A, int const lda, traits::complex_f const* B, int const ldb, - float beta, traits::complex_f* C, int const ldc) + float beta, traits::complex_f* C, int const ldc) { - cblas_cher2k (Order, Uplo, Trans, N, K, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, - static_cast<void const*> (B), ldb, - beta, static_cast<void*> (C), ldc); + cblas_cher2k (Order, Uplo, Trans, N, K, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, + static_cast<void const*> (B), ldb, + beta, static_cast<void*> (C), ldc); } inline void her2k (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, CBLAS_TRANSPOSE const Trans, int const N, int const K, - traits::complex_d const& alpha, + traits::complex_d const& alpha, traits::complex_d const* A, int const lda, traits::complex_d const* B, int const ldb, - double beta, traits::complex_d* C, int const ldc) + double beta, traits::complex_d* C, int const ldc) { - cblas_zher2k (Order, Uplo, Trans, N, K, - static_cast<void const*> (&alpha), - static_cast<void const*> (A), lda, - static_cast<void const*> (B), ldb, - beta, static_cast<void*> (C), ldc); + cblas_zher2k (Order, Uplo, Trans, N, K, + static_cast<void const*> (&alpha), + static_cast<void const*> (A), lda, + static_cast<void const*> (B), ldb, + beta, static_cast<void*> (C), ldc); } - + }} // namepaces detail & atlas -}}} +}}} #endif // BOOST_NUMERIC_BINDINGS_CBLAS3_OVERLOADS_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_enum.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_enum.hpp index 2a9b045faafcb042f519f795d5f1f69464ef5af2..a909df99473572ac24d5098abe4217f72c7712a8 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_enum.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_enum.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -17,17 +17,17 @@ #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/numeric/bindings/atlas/cblas_inc.hpp> #ifdef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS -# include <boost/numeric/ublas/config.hpp> -#endif +# include <boost/numeric/ublas/config.hpp> +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { template <typename Ord> struct storage_order {}; #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS template<> struct storage_order<traits::row_major_t> { - // 'ename' - como (in enum_cast<>): + // 'ename' - como (in enum_cast<>): // a template argument may not reference an unnamed type enum ename { value = CblasRowMajor }; }; @@ -41,7 +41,7 @@ namespace boost { namespace numeric { namespace bindings { template<> struct storage_order<boost::numeric::ublas::column_major_tag> { enum ename { value = CblasColMajor }; }; -#endif +#endif template <typename UpLo> struct uplo_triang {}; #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS @@ -58,16 +58,16 @@ namespace boost { namespace numeric { namespace bindings { template<> struct uplo_triang<boost::numeric::ublas::lower_tag> { enum ename { value = CblasLower }; }; -#endif +#endif // g++ 3.0.4 rejects 'static_cast<E1> (e2)' template <typename E1, typename E2> E1 enum_cast (E2 e2) { - return static_cast<E1> (static_cast<int> (e2)); + return static_cast<E1> (static_cast<int> (e2)); } } }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_inc.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_inc.hpp index d02b1efc310419a256ba91adf660ec5c2f9fe3d3..1ea7a8269300ddce05abba7b01b24cefafe930ac 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_inc.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_inc.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -15,7 +15,7 @@ // // ATLAS (Automatically Tuned Linear Algebra Software) // -// ''At present, it provides C and Fortran77 interfaces to a portably +// ''At present, it provides C and Fortran77 interfaces to a portably // efficient BLAS implementation, as well as a few routines from LAPACK.'' // // see: http://math-atlas.sourceforge.net/ @@ -26,7 +26,7 @@ #define BOOST_NUMERIC_BINDINGS_CBLAS_INC_H extern "C" { -#include <cblas.h> +#include <cblas.h> } -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack.hpp index 00117fe4283e40130e2828ab3fb16dd813cb954e..bfc2e853947142aacf37c40de6e0ffb971aec4b3 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -20,7 +20,7 @@ #include <boost/numeric/bindings/traits/traits.hpp> #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS # include <boost/numeric/bindings/traits/detail/symm_herm_traits.hpp> -#endif +#endif #include <boost/numeric/bindings/atlas/cblas_enum.hpp> // see libs/numeric/bindings/atlas/doc/index.html, section 2.5.2 @@ -28,23 +28,23 @@ #include <boost/numeric/bindings/atlas/clapack_overloads.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/same_traits.hpp> #endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { ///////////////////////////////////////////////////////////////////// // // general system of linear equations A * X = B - // + // ///////////////////////////////////////////////////////////////////// - // gesv(): 'driver' function + // gesv(): 'driver' function // // [comments from 'clapack_dgesv.c':] /* clapack_xgesv computes the solution to a system of linear equations @@ -53,45 +53,45 @@ namespace boost { namespace numeric { namespace bindings { */ // [but ATLAS FAQ says:] /* What's the deal with the RHS in the row-major factorization/solves? - * Most users are confused by the row major factorization and related - * solves. The right-hand side vectors are probably the biggest source - * of confusion. The RHS array does not represent a matrix in the - * mathematical sense, it is instead a pasting together of the various - * RHS into one array for calling convenience. As such, RHS vectors are - * always stored contiguously, regardless of the row/col major that is - * chosen. This means that ldb/ldx is always independent of NRHS, and - * dependant on N, regardless of the row/col major setting. - */ - // That is, it seems that, if B is row-major, it should be NRHS-by-N, - // and RHS vectors should be its rows, not columns. + * Most users are confused by the row major factorization and related + * solves. The right-hand side vectors are probably the biggest source + * of confusion. The RHS array does not represent a matrix in the + * mathematical sense, it is instead a pasting together of the various + * RHS into one array for calling convenience. As such, RHS vectors are + * always stored contiguously, regardless of the row/col major that is + * chosen. This means that ldb/ldx is always independent of NRHS, and + * dependant on N, regardless of the row/col major setting. + */ + // That is, it seems that, if B is row-major, it should be NRHS-by-N, + // and RHS vectors should be its rows, not columns. // // [comments from 'clapack_dgesv.c':] - /* The LU factorization used to factor A is dependent on the Order + /* The LU factorization used to factor A is dependent on the Order * parameter, as detailed in the leading comments of clapack_dgetrf. - * The factored form of A is then used to solve the system of equations + * The factored form of A is then used to solve the system of equations * A * X = B. * A is overwritten with the appropriate LU factorization, and B [...] * is overwritten with the solution X on output. */ - // If B is row-major, solution vectors are its rows. + // If B is row-major, solution vectors are its rows. template <typename MatrA, typename MatrB, typename IVec> inline int gesv (MatrA& a, IVec& ipiv, MatrB& b) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); -#endif + >::value)); +#endif CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -99,24 +99,24 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<MatrA>::ordering_type #else - typename MatrA::orientation_category -#endif - >::value); + typename MatrA::orientation_category +#endif + >::value); int const n = traits::matrix_size1 (a); int const nrhs = stor_ord == CblasColMajor ? traits::matrix_size2 (b) - : traits::matrix_size1 (b); - assert (n == traits::matrix_size2 (a)); + : traits::matrix_size1 (b); + assert (n == traits::matrix_size2 (a)); assert (n == (stor_ord == CblasColMajor ? traits::matrix_size1 (b) - : traits::matrix_size2 (b))); - assert (n == traits::vector_size (ipiv)); + : traits::matrix_size2 (b))); + assert (n == traits::vector_size (ipiv)); - return detail::gesv (stor_ord, n, nrhs, - traits::matrix_storage (a), + return detail::gesv (stor_ord, n, nrhs, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), traits::matrix_storage (b), traits::leading_dimension (b)); } @@ -125,21 +125,21 @@ namespace boost { namespace numeric { namespace bindings { inline int gesv (MatrA& a, MatrB& b) { // with 'internal' pivot vector -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); -#endif + >::value)); +#endif CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -147,74 +147,74 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<MatrA>::ordering_type #else - typename MatrA::orientation_category -#endif - >::value); + typename MatrA::orientation_category +#endif + >::value); int const n = traits::matrix_size1 (a); int const nrhs = stor_ord == CblasColMajor ? traits::matrix_size2 (b) - : traits::matrix_size1 (b); - assert (n == traits::matrix_size2 (a)); + : traits::matrix_size1 (b); + assert (n == traits::matrix_size2 (a)); assert (n == (stor_ord == CblasColMajor ? traits::matrix_size1 (b) - : traits::matrix_size2 (b))); + : traits::matrix_size2 (b))); - int *ipiv = new (std::nothrow) int[n]; - int ierr = -101; - // clapack_dgesv() errors: + int *ipiv = new (std::nothrow) int[n]; + int ierr = -101; + // clapack_dgesv() errors: // if (ierr == 0), successful // if (ierr < 0), the -ierr argument had an illegal value // -- we will use -101 if allocation fails - // if (ierr > 0), U(i-1,i-1) (or L(i-1,i-1)) is exactly zero - + // if (ierr > 0), U(i-1,i-1) (or L(i-1,i-1)) is exactly zero + if (ipiv) { - ierr = detail::gesv (stor_ord, n, nrhs, - traits::matrix_storage (a), + ierr = detail::gesv (stor_ord, n, nrhs, + traits::matrix_storage (a), traits::leading_dimension (a), - ipiv, + ipiv, traits::matrix_storage (b), traits::leading_dimension (b)); - delete[] ipiv; + delete[] ipiv; } - return ierr; + return ierr; } template <typename MatrA, typename MatrB> inline int lu_solve (MatrA& a, MatrB& b) { - return gesv (a, b); + return gesv (a, b); } // getrf(): LU factorization of A // [comments from 'clapack_dgetrf.c':] - /* Computes one of two LU factorizations based on the setting of + /* Computes one of two LU factorizations based on the setting of * the Order parameter, as follows: * --------------------------------------------------------------- * Order == CblasColMajor * Column-major factorization of form * A = P * L * U * where P is a row-permutation matrix, L is lower triangular with - * unit diagonal elements (lower trapezoidal if M > N), and U is + * unit diagonal elements (lower trapezoidal if M > N), and U is * upper triangular (upper trapezoidal if M < N). * --------------------------------------------------------------- * Order == CblasRowMajor * Row-major factorization of form * A = P * L * U - * where P is a column-permutation matrix, L is lower triangular - * (lower trapezoidal if M > N), and U is upper triangular with + * where P is a column-permutation matrix, L is lower triangular + * (lower trapezoidal if M > N), and U is upper triangular with * unit diagonals (upper trapezoidal if M < N). */ - template <typename MatrA, typename IVec> + template <typename MatrA, typename IVec> inline int getrf (MatrA& a, IVec& ipiv) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -222,24 +222,24 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<MatrA>::ordering_type #else - typename MatrA::orientation_category -#endif - >::value); + typename MatrA::orientation_category +#endif + >::value); int const m = traits::matrix_size1 (a); - int const n = traits::matrix_size2 (a); - assert (traits::vector_size (ipiv) == (m < n ? m : n)); + int const n = traits::matrix_size2 (a); + assert (traits::vector_size (ipiv) == (m < n ? m : n)); - return detail::getrf (stor_ord, m, n, - traits::matrix_storage (a), + return detail::getrf (stor_ord, m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (ipiv)); + traits::vector_storage (ipiv)); } - template <typename MatrA, typename IVec> + template <typename MatrA, typename IVec> inline int lu_factor (MatrA& a, IVec& ipiv) { - return getrf (a, ipiv); + return getrf (a, ipiv); } @@ -248,28 +248,28 @@ namespace boost { namespace numeric { namespace bindings { // using the LU factorization previously computed by getrf() template <typename MatrA, typename MatrB, typename IVec> inline - int getrs (CBLAS_TRANSPOSE const Trans, - MatrA const& a, IVec const& ipiv, MatrB& b) + int getrs (CBLAS_TRANSPOSE const Trans, + MatrA const& a, IVec const& ipiv, MatrB& b) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<MatrA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); -#endif + >::value)); +#endif - assert (Trans == CblasNoTrans - || Trans == CblasTrans - || Trans == CblasConjTrans); + assert (Trans == CblasNoTrans + || Trans == CblasTrans + || Trans == CblasConjTrans); CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -277,61 +277,61 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<MatrA>::ordering_type #else - typename MatrA::orientation_category -#endif - >::value); + typename MatrA::orientation_category +#endif + >::value); int const n = traits::matrix_size1 (a); int const nrhs = stor_ord == CblasColMajor ? traits::matrix_size2 (b) - : traits::matrix_size1 (b); - assert (n == traits::matrix_size2 (a)); + : traits::matrix_size1 (b); + assert (n == traits::matrix_size2 (a)); assert (n == (stor_ord == CblasColMajor ? traits::matrix_size1 (b) - : traits::matrix_size2 (b))); - assert (n == traits::vector_size (ipiv)); - - return detail::getrs (stor_ord, Trans, n, nrhs, + : traits::matrix_size2 (b))); + assert (n == traits::vector_size (ipiv)); + + return detail::getrs (stor_ord, Trans, n, nrhs, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), #else - traits::vector_storage_const (ipiv), + traits::vector_storage_const (ipiv), #endif traits::matrix_storage (b), - traits::leading_dimension (b)); + traits::leading_dimension (b)); } // getrs(): solves A * X = B (after getrf()) template <typename MatrA, typename MatrB, typename IVec> inline int getrs (MatrA const& a, IVec const& ipiv, MatrB& b) { - return getrs (CblasNoTrans, a, ipiv, b); + return getrs (CblasNoTrans, a, ipiv, b); } template <typename MatrA, typename MatrB, typename IVec> inline int lu_substitute (MatrA const& a, IVec const& ipiv, MatrB& b) { - return getrs (CblasNoTrans, a, ipiv, b); + return getrs (CblasNoTrans, a, ipiv, b); } - // getri(): computes the inverse of a matrix A - // using the LU factorization previously computed by getrf() - template <typename MatrA, typename IVec> + // getri(): computes the inverse of a matrix A + // using the LU factorization previously computed by getrf() + template <typename MatrA, typename IVec> inline int getri (MatrA& a, IVec const& ipiv) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -339,29 +339,29 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<MatrA>::ordering_type #else - typename MatrA::orientation_category -#endif - >::value); + typename MatrA::orientation_category +#endif + >::value); int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (traits::vector_size (ipiv) == n); + assert (n == traits::matrix_size2 (a)); + assert (traits::vector_size (ipiv) == n); - return detail::getri (stor_ord, n, - traits::matrix_storage (a), + return detail::getri (stor_ord, n, + traits::matrix_storage (a), traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING traits::vector_storage (ipiv) #else traits::vector_storage_const (ipiv) #endif - ); + ); } - template <typename MatrA, typename IVec> + template <typename MatrA, typename IVec> inline int lu_invert (MatrA& a, IVec& ipiv) { - return getri (a, ipiv); + return getri (a, ipiv); } @@ -374,25 +374,25 @@ namespace boost { namespace numeric { namespace bindings { ///////////////////////////////////////////////////////////////////// #ifndef BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG - // posv(): 'driver' function + // posv(): 'driver' function // // [from 'dposv.f' (slightly edited):] /* XPOSV computes the solution to a system of linear equations * A * X = B, - * where A is an N-by-N symmetric/Hermitian positive definite matrix + * where A is an N-by-N symmetric/Hermitian positive definite matrix * and X and B are N-by-NRHS matrices. [See also comments of gesv().] * - * A -- On entry, the symmetric/Hermitian matrix A. - * If UPLO = 'U', the leading N-by-N upper triangular part of A - * contains the upper triangular part of the matrix A, and the - * strictly lower triangular part of A is not referenced. - * If UPLO = 'L', the leading N-by-N lower triangular part of A - * contains the lower triangular part of the matrix A, and the + * A -- On entry, the symmetric/Hermitian matrix A. + * If UPLO = 'U', the leading N-by-N upper triangular part of A + * contains the upper triangular part of the matrix A, and the + * strictly lower triangular part of A is not referenced. + * If UPLO = 'L', the leading N-by-N lower triangular part of A + * contains the lower triangular part of the matrix A, and the * strictly upper triangular part of A is not referenced. * * On exit, if INFO = 0, the factor U or L from the Cholesky * factorization A = U**T*U or A = L*L**T - * [or A = U**H*U or A = L*L**H]. + * [or A = U**H*U or A = L*L**H]. * * B -- On entry, the right hand side matrix B. * On exit, if INFO = 0, the solution matrix X. @@ -402,12 +402,12 @@ namespace boost { namespace numeric { namespace bindings { template <typename SymmA, typename MatrB> inline int posv (CBLAS_UPLO const uplo, SymmA& a, MatrB& b) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<SymmA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); -#endif + >::value)); +#endif CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -415,59 +415,59 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::ordering_type #else - typename SymmA::orientation_category -#endif - >::value); + typename SymmA::orientation_category +#endif + >::value); int const n = traits::matrix_size1 (a); int const nrhs = stor_ord == CblasColMajor ? traits::matrix_size2 (b) - : traits::matrix_size1 (b); - assert (n == traits::matrix_size2 (a)); + : traits::matrix_size1 (b); + assert (n == traits::matrix_size2 (a)); assert (n == (stor_ord == CblasColMajor ? traits::matrix_size1 (b) - : traits::matrix_size2 (b))); + : traits::matrix_size2 (b))); - return posv (stor_ord, uplo, n, nrhs, - traits::matrix_storage (a), + return posv (stor_ord, uplo, n, nrhs, + traits::matrix_storage (a), traits::leading_dimension (a), traits::matrix_storage (b), traits::leading_dimension (b)); } - } // detail + } // detail template <typename SymmA, typename MatrB> inline int posv (CBLAS_UPLO const uplo, SymmA& a, MatrB& b) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - assert (uplo == CblasUpper || uplo == CblasLower); - return detail::posv (uplo, a, b); + assert (uplo == CblasUpper || uplo == CblasLower); + return detail::posv (uplo, a, b); } template <typename SymmA, typename MatrB> inline int posv (SymmA& a, MatrB& b) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename traits::matrix_traits<SymmA>::value_type val_t; BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, typename traits::detail::symm_herm_t<val_t>::type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -475,11 +475,11 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::uplo_type #else - typename SymmA::packed_category -#endif - >::value); - - return detail::posv (uplo, a, b); + typename SymmA::packed_category +#endif + >::value); + + return detail::posv (uplo, a, b); } template <typename SymmA, typename MatrB> @@ -488,7 +488,7 @@ namespace boost { namespace numeric { namespace bindings { #endif // BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG - // potrf(): Cholesky factorization of A + // potrf(): Cholesky factorization of A namespace detail { template <typename SymmA> @@ -501,43 +501,43 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::ordering_type #else - typename SymmA::orientation_category -#endif - >::value); + typename SymmA::orientation_category +#endif + >::value); int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size2 (a)); - return potrf (stor_ord, uplo, n, - traits::matrix_storage (a), + return potrf (stor_ord, uplo, n, + traits::matrix_storage (a), traits::leading_dimension (a)); } - } // detail + } // detail template <typename SymmA> inline int potrf (CBLAS_UPLO const uplo, SymmA& a) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); #endif - assert (uplo == CblasUpper || uplo == CblasLower); - return detail::potrf (uplo, a); - } + assert (uplo == CblasUpper || uplo == CblasLower); + return detail::potrf (uplo, a); + } template <typename SymmA> inline int potrf (SymmA& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename traits::matrix_traits<SymmA>::value_type val_t; BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, typename traits::detail::symm_herm_t<val_t>::type - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -545,11 +545,11 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::uplo_type #else - typename SymmA::packed_category -#endif - >::value); - - return detail::potrf (uplo, a); + typename SymmA::packed_category +#endif + >::value); + + return detail::potrf (uplo, a); } template <typename SymmA> @@ -564,12 +564,12 @@ namespace boost { namespace numeric { namespace bindings { template <typename SymmA, typename MatrB> inline int potrs (CBLAS_UPLO const uplo, SymmA const& a, MatrB& b) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< typename traits::matrix_traits<SymmA>::ordering_type, typename traits::matrix_traits<MatrB>::ordering_type - >::value)); -#endif + >::value)); +#endif CBLAS_ORDER const stor_ord = enum_cast<CBLAS_ORDER const> @@ -577,88 +577,88 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::ordering_type #else - typename SymmA::orientation_category -#endif - >::value); + typename SymmA::orientation_category +#endif + >::value); int const n = traits::matrix_size1 (a); int const nrhs = stor_ord == CblasColMajor ? traits::matrix_size2 (b) - : traits::matrix_size1 (b); - assert (n == traits::matrix_size2 (a)); + : traits::matrix_size1 (b); + assert (n == traits::matrix_size2 (a)); assert (n == (stor_ord == CblasColMajor ? traits::matrix_size1 (b) - : traits::matrix_size2 (b))); + : traits::matrix_size2 (b))); #ifndef BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG - return potrs (stor_ord, uplo, n, nrhs, + return potrs (stor_ord, uplo, n, nrhs, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif traits::leading_dimension (a), traits::matrix_storage (b), traits::leading_dimension (b)); #else // BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG - int ierr; + int ierr; if (stor_ord == CblasColMajor) - ierr = potrs (stor_ord, uplo, n, nrhs, + ierr = potrs (stor_ord, uplo, n, nrhs, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif traits::leading_dimension (a), traits::matrix_storage (b), traits::leading_dimension (b)); - else // ATLAS bug with CblasRowMajor - ierr = potrs_bug (stor_ord, uplo, n, nrhs, + else // ATLAS bug with CblasRowMajor + ierr = potrs_bug (stor_ord, uplo, n, nrhs, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif traits::leading_dimension (a), traits::matrix_storage (b), traits::leading_dimension (b)); - return ierr; + return ierr; #endif // BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG } - } // detail + } // detail template <typename SymmA, typename MatrB> inline int potrs (CBLAS_UPLO const uplo, SymmA const& a, MatrB& b) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - assert (uplo == CblasUpper || uplo == CblasLower); - return detail::potrs (uplo, a, b); + assert (uplo == CblasUpper || uplo == CblasLower); + return detail::potrs (uplo, a, b); } template <typename SymmA, typename MatrB> inline int potrs (SymmA const& a, MatrB& b) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename traits::matrix_traits<SymmA>::value_type val_t; BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, typename traits::detail::symm_herm_t<val_t>::type - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -666,49 +666,49 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::uplo_type #else - typename SymmA::packed_category -#endif - >::value); - - return detail::potrs (uplo, a, b); + typename SymmA::packed_category +#endif + >::value); + + return detail::potrs (uplo, a, b); } template <typename SymmA, typename MatrB> - inline + inline int cholesky_substitute (SymmA const& a, MatrB& b) { return potrs (a, b); } #ifdef BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG - // posv(): 'driver' function + // posv(): 'driver' function template <typename SymmA, typename MatrB> inline int posv (CBLAS_UPLO const uplo, SymmA& a, MatrB& b) { - int ierr = potrf (uplo, a); + int ierr = potrf (uplo, a); if (ierr == 0) ierr = potrs (uplo, a, b); - return ierr; + return ierr; } template <typename SymmA, typename MatrB> inline int posv (SymmA& a, MatrB& b) { - int ierr = potrf (a); + int ierr = potrf (a); if (ierr == 0) ierr = potrs (a, b); - return ierr; + return ierr; } template <typename SymmA, typename MatrB> inline int cholesky_solve (SymmA& a, MatrB& b) { - return posv (a, b); + return posv (a, b); } -#endif // BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG +#endif // BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG - // potri(): computes the inverse of a symmetric or Hermitian positive - // definite matrix A using the Cholesky factorization - // previously computed by potrf() + // potri(): computes the inverse of a symmetric or Hermitian positive + // definite matrix A using the Cholesky factorization + // previously computed by potrf() namespace detail { template <typename SymmA> @@ -721,43 +721,43 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::ordering_type #else - typename SymmA::orientation_category -#endif - >::value); + typename SymmA::orientation_category +#endif + >::value); int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size2 (a)); - return potri (stor_ord, uplo, n, - traits::matrix_storage (a), + return potri (stor_ord, uplo, n, + traits::matrix_storage (a), traits::leading_dimension (a)); } - } // detail + } // detail template <typename SymmA> inline int potri (CBLAS_UPLO const uplo, SymmA& a) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); #endif - assert (uplo == CblasUpper || uplo == CblasLower); - return detail::potri (uplo, a); - } + assert (uplo == CblasUpper || uplo == CblasLower); + return detail::potri (uplo, a); + } template <typename SymmA> inline int potri (SymmA& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename traits::matrix_traits<SymmA>::value_type val_t; BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, typename traits::detail::symm_herm_t<val_t>::type - >::value)); -#endif + >::value)); +#endif CBLAS_UPLO const uplo = enum_cast<CBLAS_UPLO const> @@ -765,11 +765,11 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typename traits::matrix_traits<SymmA>::uplo_type #else - typename SymmA::packed_category -#endif - >::value); - - return detail::potri (uplo, a); + typename SymmA::packed_category +#endif + >::value); + + return detail::potri (uplo, a); } template <typename SymmA> @@ -779,6 +779,6 @@ namespace boost { namespace numeric { namespace bindings { } // namespace atlas -}}} +}}} #endif // BOOST_NUMERIC_BINDINGS_CLAPACK_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_inc.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_inc.hpp index d858ea17e2ed5c13af38e08f3c008b441c6166de..0a146dafd1bab71d58521450ece37b42b8c0bf72 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_inc.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_inc.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,8 +14,8 @@ ////////////////////////////////////////////////////////////////////////// // // ATLAS (Automatically Tuned Linear Algebra Software) -// -// ''At present, it provides C and Fortran77 interfaces to a portably +// +// ''At present, it provides C and Fortran77 interfaces to a portably // efficient BLAS implementation, as well as a few routines from LAPACK.'' // // see: http://math-atlas.sourceforge.net/ @@ -26,9 +26,9 @@ #define BOOST_NUMERIC_BINDINGS_CLAPACK_INC_H extern "C" { -/* see footnote [2] in libs/numeric/bindings/lapack/doc/index.html */ +/* see footnote [2] in libs/numeric/bindings/lapack/doc/index.html */ /* #include <atlas_enum.h> */ -#include <clapack.h> +#include <clapack.h> } -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_overloads.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_overloads.hpp index c295040679da1d89553fbdd474c575ee3713e2c2..793f9b364eeee7d712e0c6424a1ff2098bf4d12a 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_overloads.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_overloads.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -18,7 +18,7 @@ #include <boost/numeric/bindings/traits/type.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace atlas { namespace detail { @@ -27,151 +27,151 @@ namespace boost { namespace numeric { namespace bindings { // // 'driver' function -- factor and solve - inline - int gesv (CBLAS_ORDER const Order, + inline + int gesv (CBLAS_ORDER const Order, int const N, int const NRHS, - float* A, int const lda, int* ipiv, - float* B, int const ldb) + float* A, int const lda, int* ipiv, + float* B, int const ldb) { return clapack_sgesv (Order, N, NRHS, A, lda, ipiv, B, ldb); } - - inline - int gesv (CBLAS_ORDER const Order, + + inline + int gesv (CBLAS_ORDER const Order, int const N, int const NRHS, - double* A, int const lda, int* ipiv, - double* B, int const ldb) + double* A, int const lda, int* ipiv, + double* B, int const ldb) { return clapack_dgesv (Order, N, NRHS, A, lda, ipiv, B, ldb); } - - inline - int gesv (CBLAS_ORDER const Order, + + inline + int gesv (CBLAS_ORDER const Order, int const N, int const NRHS, - traits::complex_f* A, int const lda, int* ipiv, - traits::complex_f* B, int const ldb) + traits::complex_f* A, int const lda, int* ipiv, + traits::complex_f* B, int const ldb) { - return clapack_cgesv (Order, N, NRHS, - static_cast<void*> (A), lda, ipiv, + return clapack_cgesv (Order, N, NRHS, + static_cast<void*> (A), lda, ipiv, static_cast<void*> (B), ldb); } - - inline - int gesv (CBLAS_ORDER const Order, + + inline + int gesv (CBLAS_ORDER const Order, int const N, int const NRHS, - traits::complex_d* A, int const lda, int* ipiv, - traits::complex_d* B, int const ldb) + traits::complex_d* A, int const lda, int* ipiv, + traits::complex_d* B, int const ldb) { - return clapack_zgesv (Order, N, NRHS, - static_cast<void*> (A), lda, ipiv, + return clapack_zgesv (Order, N, NRHS, + static_cast<void*> (A), lda, ipiv, static_cast<void*> (B), ldb); } - - // LU factorization - inline - int getrf (CBLAS_ORDER const Order, + + // LU factorization + inline + int getrf (CBLAS_ORDER const Order, int const M, int const N, float* A, int const lda, int* ipiv) { return clapack_sgetrf (Order, M, N, A, lda, ipiv); } - - inline - int getrf (CBLAS_ORDER const Order, + + inline + int getrf (CBLAS_ORDER const Order, int const M, int const N, double* A, int const lda, int* ipiv) { return clapack_dgetrf (Order, M, N, A, lda, ipiv); } - - inline - int getrf (CBLAS_ORDER const Order, + + inline + int getrf (CBLAS_ORDER const Order, int const M, int const N, traits::complex_f* A, int const lda, int* ipiv) { - return clapack_cgetrf (Order, M, N, static_cast<void*> (A), lda, ipiv); + return clapack_cgetrf (Order, M, N, static_cast<void*> (A), lda, ipiv); } - - inline - int getrf (CBLAS_ORDER const Order, + + inline + int getrf (CBLAS_ORDER const Order, int const M, int const N, traits::complex_d* A, int const lda, int* ipiv) { - return clapack_zgetrf (Order, M, N, static_cast<void*> (A), lda, ipiv); + return clapack_zgetrf (Order, M, N, static_cast<void*> (A), lda, ipiv); } - // solve (using factorization computed by getrf()) - inline - int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans, + // solve (using factorization computed by getrf()) + inline + int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans, int const N, int const NRHS, - float const* A, int const lda, int const* ipiv, - float* B, int const ldb) + float const* A, int const lda, int const* ipiv, + float* B, int const ldb) { return clapack_sgetrs (Order, Trans, N, NRHS, A, lda, ipiv, B, ldb); } - - inline - int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans, + + inline + int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans, int const N, int const NRHS, - double const* A, int const lda, int const* ipiv, - double* B, int const ldb) + double const* A, int const lda, int const* ipiv, + double* B, int const ldb) { return clapack_dgetrs (Order, Trans, N, NRHS, A, lda, ipiv, B, ldb); } - - inline - int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans, + + inline + int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans, int const N, int const NRHS, - traits::complex_f const* A, int const lda, - int const* ipiv, - traits::complex_f* B, int const ldb) + traits::complex_f const* A, int const lda, + int const* ipiv, + traits::complex_f* B, int const ldb) { - return clapack_cgetrs (Order, Trans, N, NRHS, - static_cast<void const*> (A), lda, ipiv, + return clapack_cgetrs (Order, Trans, N, NRHS, + static_cast<void const*> (A), lda, ipiv, static_cast<void*> (B), ldb); } - - inline - int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans, + + inline + int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans, int const N, int const NRHS, - traits::complex_d const* A, int const lda, - int const* ipiv, - traits::complex_d* B, int const ldb) + traits::complex_d const* A, int const lda, + int const* ipiv, + traits::complex_d* B, int const ldb) { - return clapack_zgetrs (Order, Trans, N, NRHS, - static_cast<void const*> (A), lda, ipiv, + return clapack_zgetrs (Order, Trans, N, NRHS, + static_cast<void const*> (A), lda, ipiv, static_cast<void*> (B), ldb); } - // invert (using factorization computed by getrf()) - inline - int getri (CBLAS_ORDER const Order, + // invert (using factorization computed by getrf()) + inline + int getri (CBLAS_ORDER const Order, int const N, float* A, int const lda, - int const* ipiv) + int const* ipiv) { return clapack_sgetri (Order, N, A, lda, ipiv); } - inline - int getri (CBLAS_ORDER const Order, + inline + int getri (CBLAS_ORDER const Order, int const N, double* A, int const lda, - int const* ipiv) + int const* ipiv) { return clapack_dgetri (Order, N, A, lda, ipiv); } - inline - int getri (CBLAS_ORDER const Order, + inline + int getri (CBLAS_ORDER const Order, int const N, traits::complex_f* A, int const lda, - int const* ipiv) + int const* ipiv) { return clapack_cgetri (Order, N, static_cast<void*> (A), lda, ipiv); } - inline - int getri (CBLAS_ORDER const Order, + inline + int getri (CBLAS_ORDER const Order, int const N, traits::complex_d* A, int const lda, - int const* ipiv) + int const* ipiv) { return clapack_zgetri (Order, N, static_cast<void*> (A), lda, ipiv); } @@ -183,191 +183,191 @@ namespace boost { namespace numeric { namespace bindings { // // 'driver' function -- factor and solve - inline + inline int posv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - float* A, int const lda, float* B, int const ldb) + float* A, int const lda, float* B, int const ldb) { return clapack_sposv (Order, Uplo, N, NRHS, A, lda, B, ldb); } - - inline + + inline int posv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - double* A, int const lda, double* B, int const ldb) + double* A, int const lda, double* B, int const ldb) { return clapack_dposv (Order, Uplo, N, NRHS, A, lda, B, ldb); } - - inline + + inline int posv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - traits::complex_f* A, int const lda, - traits::complex_f* B, int const ldb) + traits::complex_f* A, int const lda, + traits::complex_f* B, int const ldb) { - return clapack_cposv (Order, Uplo, N, NRHS, - static_cast<void*> (A), lda, + return clapack_cposv (Order, Uplo, N, NRHS, + static_cast<void*> (A), lda, static_cast<void*> (B), ldb); } - - inline + + inline int posv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - traits::complex_d* A, int const lda, - traits::complex_d* B, int const ldb) + traits::complex_d* A, int const lda, + traits::complex_d* B, int const ldb) { - return clapack_zposv (Order, Uplo, N, NRHS, - static_cast<void*> (A), lda, + return clapack_zposv (Order, Uplo, N, NRHS, + static_cast<void*> (A), lda, static_cast<void*> (B), ldb); } // Cholesky factorization - inline + inline int potrf (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, float* A, int const lda) + int const N, float* A, int const lda) { return clapack_spotrf (Order, Uplo, N, A, lda); } - - inline + + inline int potrf (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, double* A, int const lda) + int const N, double* A, int const lda) { return clapack_dpotrf (Order, Uplo, N, A, lda); } - - inline + + inline int potrf (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_f* A, int const lda) + int const N, traits::complex_f* A, int const lda) { return clapack_cpotrf (Order, Uplo, N, static_cast<void*> (A), lda); } - - inline + + inline int potrf (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_d* A, int const lda) + int const N, traits::complex_d* A, int const lda) { return clapack_zpotrf (Order, Uplo, N, static_cast<void*> (A), lda); } - - // solve (using factorization computed by potrf()) - inline + + // solve (using factorization computed by potrf()) + inline int potrs (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - float const* A, int const lda, float* B, int const ldb) + float const* A, int const lda, float* B, int const ldb) { return clapack_spotrs (Order, Uplo, N, NRHS, A, lda, B, ldb); } - inline + inline int potrs (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - double const* A, int const lda, double* B, int const ldb) + double const* A, int const lda, double* B, int const ldb) { return clapack_dpotrs (Order, Uplo, N, NRHS, A, lda, B, ldb); } - - inline + + inline int potrs (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - traits::complex_f const* A, int const lda, - traits::complex_f* B, int const ldb) + traits::complex_f const* A, int const lda, + traits::complex_f* B, int const ldb) { - return clapack_cpotrs (Order, Uplo, N, NRHS, - static_cast<void const*> (A), lda, + return clapack_cpotrs (Order, Uplo, N, NRHS, + static_cast<void const*> (A), lda, static_cast<void*> (B), ldb); } - - inline + + inline int potrs (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - traits::complex_d const* A, int const lda, - traits::complex_d* B, int const ldb) + traits::complex_d const* A, int const lda, + traits::complex_d* B, int const ldb) { - return clapack_zpotrs (Order, Uplo, N, NRHS, - static_cast<void const*> (A), lda, + return clapack_zpotrs (Order, Uplo, N, NRHS, + static_cast<void const*> (A), lda, static_cast<void*> (B), ldb); } -#ifdef BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG - // .. ATLAS bug with row major hermitian matrices - // .... symmetric matrices are OK, but to simplify generic potrs() ... - inline +#ifdef BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG + // .. ATLAS bug with row major hermitian matrices + // .... symmetric matrices are OK, but to simplify generic potrs() ... + inline int potrs_bug (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - float const* A, int const lda, float* B, int const ldb) + float const* A, int const lda, float* B, int const ldb) { return clapack_spotrs (Order, Uplo, N, NRHS, A, lda, B, ldb); } - inline + inline int potrs_bug (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - double const* A, int const lda, double* B, int const ldb) + double const* A, int const lda, double* B, int const ldb) { return clapack_dpotrs (Order, Uplo, N, NRHS, A, lda, B, ldb); } - - inline + + inline int potrs_bug (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - traits::complex_f const* A, int const lda, - traits::complex_f* B, int const ldb) - { - int sz = N * lda; - traits::complex_f* A1 = new traits::complex_f[sz]; - for (int i = 0; i < sz; ++i) - A1[i] = std::conj (A[i]); - int r = clapack_cpotrs (Order, Uplo, N, NRHS, - static_cast<void const*> (A1), lda, + traits::complex_f const* A, int const lda, + traits::complex_f* B, int const ldb) + { + int sz = N * lda; + traits::complex_f* A1 = new traits::complex_f[sz]; + for (int i = 0; i < sz; ++i) + A1[i] = std::conj (A[i]); + int r = clapack_cpotrs (Order, Uplo, N, NRHS, + static_cast<void const*> (A1), lda, static_cast<void*> (B), ldb); - delete[] A1; - return r; + delete[] A1; + return r; } - - inline + + inline int potrs_bug (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, int const N, int const NRHS, - traits::complex_d const* A, int const lda, - traits::complex_d* B, int const ldb) - { - int sz = N * lda; - traits::complex_d* A1 = new traits::complex_d[sz]; - for (int i = 0; i < sz; ++i) - A1[i] = std::conj (A[i]); - int r = clapack_zpotrs (Order, Uplo, N, NRHS, - static_cast<void const*> (A1), lda, + traits::complex_d const* A, int const lda, + traits::complex_d* B, int const ldb) + { + int sz = N * lda; + traits::complex_d* A1 = new traits::complex_d[sz]; + for (int i = 0; i < sz; ++i) + A1[i] = std::conj (A[i]); + int r = clapack_zpotrs (Order, Uplo, N, NRHS, + static_cast<void const*> (A1), lda, static_cast<void*> (B), ldb); - delete[] A1; - return r; + delete[] A1; + return r; } -#endif // BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG +#endif // BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG - // invert (using factorization computed by potrf()) - inline + // invert (using factorization computed by potrf()) + inline int potri (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, float* A, int const lda) + int const N, float* A, int const lda) { return clapack_spotri (Order, Uplo, N, A, lda); } - inline + inline int potri (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, double* A, int const lda) + int const N, double* A, int const lda) { return clapack_dpotri (Order, Uplo, N, A, lda); } - inline + inline int potri (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_f* A, int const lda) + int const N, traits::complex_f* A, int const lda) { return clapack_cpotri (Order, Uplo, N, static_cast<void*> (A), lda); } - inline + inline int potri (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo, - int const N, traits::complex_d* A, int const lda) + int const N, traits::complex_d* A, int const lda) { return clapack_zpotri (Order, Uplo, N, static_cast<void*> (A), lda); } @@ -375,7 +375,7 @@ namespace boost { namespace numeric { namespace bindings { }} // namepaces detail & atlas -}}} +}}} #endif // BOOST_NUMERIC_BINDINGS_CLAPACK_OVERLOADS_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas.h b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas.h index 362a5deea188b97dbac0a58046c28a348a12a59d..6fabde79a7371122aaefb021d355baee123a4790 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas.h +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2002, 2003 Si-Lab b.v.b.a and Toon Knapen +// Copyright (C) 2002, 2003 Si-Lab b.v.b.a and Toon Knapen // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -11,7 +11,7 @@ /* * const-correct prototypes for BLAS functions - * + * */ #include <boost/numeric/bindings/blas/blas_names.h> @@ -36,8 +36,8 @@ extern "C" double BLAS_DDOT (const int *n, const double *x, const int *incx, const double *y, const int *incy); void BLAS_CDOTU(fcomplex_t* ret, const int *n, const fcomplex_t *x, const int *incx, const fcomplex_t *y, const int *incy); - void BLAS_ZDOTU(dcomplex_t* ret, const int *n, const dcomplex_t *x, const int *incx, const dcomplex_t *y, const int *incy); - + void BLAS_ZDOTU(dcomplex_t* ret, const int *n, const dcomplex_t *x, const int *incx, const dcomplex_t *y, const int *incy); + void BLAS_CDOTC(fcomplex_t* ret, const int *n, const fcomplex_t *x, const int *incx, const fcomplex_t *y, const int *incy); void BLAS_ZDOTC(dcomplex_t* ret, const int *n, const dcomplex_t *x, const int *incx, const dcomplex_t *y, const int *incy); diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas1.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas1.hpp index cd115cc87585bd1d657dbce20a9f795050c126ee..471485a4aa231c66258d01e73cee382c3a8ede21 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas1.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas1.hpp @@ -13,7 +13,7 @@ #include <boost/numeric/bindings/traits/vector_traits.hpp> #include <boost/static_assert.hpp> #include <boost/type_traits/is_same.hpp> -#include <cassert> +#include <cassert> namespace boost { namespace numeric { namespace bindings { namespace blas { @@ -59,7 +59,7 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { // y <- alpha * x + y template < typename value_type, typename vector_type_x, typename vector_type_y > void axpy(const value_type& alpha, const vector_type_x &x, vector_type_y &y ) - { + { #ifdef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS BOOST_STATIC_ASSERT( ( is_same< value_type, typename vector_type_x::value_type >::value ) ) ; BOOST_STATIC_ASSERT( ( is_same< value_type, typename vector_type_y::value_type >::value ) ) ; @@ -75,14 +75,14 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { const value_type *x_ptr = traits::vector_storage( x ) ; value_type *y_ptr = traits::vector_storage( y ) ; - detail::axpy( n, alpha, x_ptr, stride_x, y_ptr, stride_y ) ; + detail::axpy( n, alpha, x_ptr, stride_x, y_ptr, stride_y ) ; } // dot <- x^T * y (real vectors) template < typename vector_type_x, typename vector_type_y > #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits< vector_type_x >::value_type + typename traits::vector_traits< vector_type_x >::value_type #else typename vector_type_x::value_type #endif @@ -98,7 +98,7 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { typedef #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits< vector_type_x >::value_type + typename traits::vector_traits< vector_type_x >::value_type #else typename vector_type_x::value_type #endif @@ -117,7 +117,7 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { // dotu <- x^T * y (complex vectors) template < typename vector_type_x, typename vector_type_y > #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits< vector_type_x >::value_type + typename traits::vector_traits< vector_type_x >::value_type #else typename vector_type_x::value_type #endif @@ -143,16 +143,16 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { const int stride_y = traits::vector_stride( y ) ; const value_type *x_ptr = traits::vector_storage( x ) ; const value_type *y_ptr = traits::vector_storage( y ) ; - + value_type ret ; detail::dotu( ret, n, x_ptr, stride_x, y_ptr, stride_y ) ; return ret; } - // dotc <- x^H * y (complex vectors) + // dotc <- x^H * y (complex vectors) template < typename vector_type_x, typename vector_type_y > #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::vector_traits< vector_type_x >::value_type + typename traits::vector_traits< vector_type_x >::value_type #else typename vector_type_x::value_type #endif @@ -178,7 +178,7 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { const int stride_y = traits::vector_stride( y ) ; const value_type *x_ptr = traits::vector_storage( x ) ; const value_type *y_ptr = traits::vector_storage( y ) ; - + value_type ret ; detail::dotc( ret, n, x_ptr, stride_x, y_ptr, stride_y ) ; return ret; @@ -192,7 +192,7 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { #else typename traits::type_traits< typename vector_type::value_type >::real_type #endif - nrm2(const vector_type &x) + nrm2(const vector_type &x) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typedef typename traits::vector_traits< vector_type >::value_type value_type; @@ -212,11 +212,11 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { // .. for now works only with real vectors template < typename vector_type > #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typename traits::type_traits< typename traits::vector_traits< vector_type >::value_type >::real_type + typename traits::type_traits< typename traits::vector_traits< vector_type >::value_type >::real_type #else typename traits::type_traits< typename vector_type::value_type >::real_type #endif - asum(const vector_type &x) + asum(const vector_type &x) { #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS typedef typename traits::vector_traits< vector_type >::value_type value_type; diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas1_overloads.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas1_overloads.hpp index cbe9d56440f7b32952baa73a9e7a9d0d396d9cd2..a52bbf722f56569e98c9e6106b441f5f05e95283 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas1_overloads.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas1_overloads.hpp @@ -17,19 +17,19 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { name using namespace boost::numeric::bindings::traits ; - // x *= alpha - inline void scal(const int& n, const float& alpha, float* x, const int& incx) { BLAS_SSCAL( &n, &alpha, x , &incx ) ; } + // x *= alpha + inline void scal(const int& n, const float& alpha, float* x, const int& incx) { BLAS_SSCAL( &n, &alpha, x , &incx ) ; } inline void scal(const int& n, const double& alpha, double* x, const int& incx) { BLAS_DSCAL( &n, &alpha, x , &incx ) ; } inline void scal(const int& n, const complex_f& alpha, complex_f* x, const int& incx) { BLAS_CSCAL( &n, complex_ptr( &alpha ), complex_ptr( x ), &incx ) ; } inline void scal(const int& n, const complex_d& alpha, complex_d* x, const int& incx) { BLAS_ZSCAL( &n, complex_ptr( &alpha ), complex_ptr( x ), &incx ) ; } - // y += alpha * x + // y += alpha * x inline void axpy(const int& n, const float & alpha, const float * x, const int& incx, float * y, const int& incy) { BLAS_SAXPY( &n, &alpha , x , &incx, y , &incy ) ; } inline void axpy(const int& n, const double & alpha, const double * x, const int& incx, double * y, const int& incy) { BLAS_DAXPY( &n, &alpha , x , &incx, y , &incy ) ; } inline void axpy(const int& n, const complex_f& alpha, const complex_f* x, const int& incx, complex_f* y, const int& incy) { BLAS_CAXPY( &n, complex_ptr( &alpha ), complex_ptr( x ), &incx, complex_ptr( y ), &incy ) ; } inline void axpy(const int& n, const complex_d& alpha, const complex_d* x, const int& incx, complex_d* y, const int& incy) { BLAS_ZAXPY( &n, complex_ptr( &alpha ), complex_ptr( x ), &incx, complex_ptr( y ), &incy ) ; } - // x^T . y + // x^T . y inline float dot(const int& n, const float * x, const int& incx, const float * y, const int& incy) { return BLAS_SDOT( &n, x, &incx, y, &incy ) ; } inline double dot(const int& n, const double* x, const int& incx, const double* y, const int& incy) { return BLAS_DDOT( &n, x, &incx, y, &incy ) ; } @@ -46,13 +46,13 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { name inline double nrm2(const int& n, const double* x, const int& incx) { return BLAS_DNRM2( &n, x, &incx ) ; } inline float nrm2(const int& n, const complex_f* x, const int& incx) { return BLAS_SCNRM2( &n, complex_ptr(x), &incx ) ; } inline double nrm2(const int& n, const complex_d* x, const int& incx) { return BLAS_DZNRM2( &n, complex_ptr(x), &incx ) ; } - + // 1-norm inline float asum(const int& n, const float* x, const int& incx) { return BLAS_SASUM( &n, x, &incx ) ; } inline double asum(const int& n, const double* x, const int& incx) { return BLAS_DASUM( &n, x, &incx ) ; } inline float asum(const int& n, const complex_f* x, const int& incx) { return BLAS_SCASUM( &n, complex_ptr(x), &incx ) ; } inline double asum(const int& n, const complex_d* x, const int& incx) { return BLAS_DZASUM( &n, complex_ptr(x), &incx ) ; } - + // copy inline void copy(const int& n, const float* x, const int& incx, float* y, const int& incy) { BLAS_SCOPY( &n, x, &incx, y, &incy ) ; } inline void copy(const int& n, const double* x, const int& incx, double* y, const int& incy) { BLAS_DCOPY( &n, x, &incx, y, &incy ) ; } diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas2.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas2.hpp index 19ad1b08d58e46cc43bf900fe3714d6645bee3a6..e00a1a218d30fcd7fd4d2c12b5e5d41f940fd975 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas2.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas2.hpp @@ -14,7 +14,7 @@ #include <boost/numeric/bindings/traits/transpose.hpp> #include <boost/static_assert.hpp> #include <boost/type_traits.hpp> -#include <cassert> +#include <cassert> namespace boost { namespace numeric { namespace bindings { namespace blas { @@ -23,10 +23,10 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { // ! CAUTION this function assumes that all matrices involved are column-major matrices template < typename matrix_type, typename vector_type_x, typename vector_type_y, typename value_type > inline - void gemv(const char TRANS, - const value_type& alpha, - const matrix_type &a, - const vector_type_x &x, + void gemv(const char TRANS, + const value_type& alpha, + const matrix_type &a, + const vector_type_x &x, const value_type& beta, vector_type_y &y ) @@ -40,9 +40,9 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { const int m = traits::matrix_size1( a ) ; const int n = traits::matrix_size2( a ) ; - assert ( traits::vector_size( x ) >= (TRANS == traits::NO_TRANSPOSE ? n : m) ) ; - assert ( traits::vector_size( y ) >= (TRANS == traits::NO_TRANSPOSE ? m : n) ) ; - const int lda = traits::leading_dimension( a ) ; + assert ( traits::vector_size( x ) >= (TRANS == traits::NO_TRANSPOSE ? n : m) ) ; + assert ( traits::vector_size( y ) >= (TRANS == traits::NO_TRANSPOSE ? m : n) ) ; + const int lda = traits::leading_dimension( a ) ; const int stride_x = traits::vector_stride( x ) ; const int stride_y = traits::vector_stride( y ) ; @@ -53,14 +53,14 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { detail::gemv( TRANS, m, n, alpha, a_ptr, lda, x_ptr, stride_x, beta, y_ptr, stride_y ); } - // A <- alpha * x * trans(y) ( outer product ), alpha, x and y are real-valued + // A <- alpha * x * trans(y) ( outer product ), alpha, x and y are real-valued // ! CAUTION this function assumes that all matrices involved are column-major matrices template < typename vector_type_x, typename vector_type_y, typename value_type, typename matrix_type > inline - void ger( const value_type& alpha, - const vector_type_x &x, + void ger( const value_type& alpha, + const vector_type_x &x, const vector_type_y &y, - matrix_type &a + matrix_type &a ) { // precondition: matrix_type must be dense or dense_proxy @@ -72,26 +72,26 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { const int m = traits::matrix_size1( a ) ; const int n = traits::matrix_size2( a ) ; - assert ( traits::vector_size( x ) <= m ) ; - assert ( traits::vector_size( y ) <= n ) ; - const int lda = traits::leading_dimension( a ) ; + assert ( traits::vector_size( x ) <= m ) ; + assert ( traits::vector_size( y ) <= n ) ; + const int lda = traits::leading_dimension( a ) ; const int stride_x = traits::vector_stride( x ) ; const int stride_y = traits::vector_stride( y ) ; const value_type *x_ptr = traits::vector_storage( x ) ; const value_type *y_ptr = traits::vector_storage( y ) ; value_type *a_ptr = traits::matrix_storage( a ) ; - + detail::ger( m, n, alpha, x_ptr, stride_x, y_ptr, stride_y, a_ptr, lda ); } /* - // A <- alpha * x * trans(y) ( outer product ), alpha, x and y are complex-valued + // A <- alpha * x * trans(y) ( outer product ), alpha, x and y are complex-valued template < typename vector_type_x, typename vector_type_y, typename value_type, typename matrix_type > inline - void geru( const value_type& alpha, - const vector_type_x &x, + void geru( const value_type& alpha, + const vector_type_x &x, const vector_type_y &y, - matrix_type &a + matrix_type &a ) { // precondition: matrix_type must be dense or dense_proxy @@ -99,45 +99,45 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { // BOOST_STATIC_ASSERT( ( boost::is_same< typename mtraits::matrix_structure, // boost::numeric::bindings::traits::general_t // >::value ) ) ; - + // BOOST_STATIC_ASSERT( ( boost::is_same< x.value_type(), FEMTown::Complex() >::value ) ) ; const int m = traits::matrix_size1( a ) ; const int n = traits::matrix_size2( a ) ; - assert ( traits::vector_size( x ) <= m ) ; - assert ( traits::vector_size( y ) <= n ) ; - const int lda = traits::leading_dimension( a ) ; + assert ( traits::vector_size( x ) <= m ) ; + assert ( traits::vector_size( y ) <= n ) ; + const int lda = traits::leading_dimension( a ) ; const int stride_x = traits::vector_stride( x ) ; const int stride_y = traits::vector_stride( y ) ; const value_type *x_ptr = traits::vector_storage( x ) ; const value_type *y_ptr = traits::vector_storage( y ) ; value_type *a_ptr = traits::matrix_storage( a ) ; - + detail::geru( m, n, alpha, x_ptr, stride_x, y_ptr, stride_y, a_ptr, lda ); } */ /* - // y <- alpha * A * x + beta * y + // y <- alpha * A * x + beta * y template < typename matrix_type, typename vector_type_x, typename vector_type_y > - inline - void gemv(const typename traits::matrix_traits<matrix_type>::value_type &alpha, - const matrix_type &a, - const vector_type_x &x, + inline + void gemv(const typename traits::matrix_traits<matrix_type>::value_type &alpha, + const matrix_type &a, + const vector_type_x &x, const typename traits::vector_traits<vector_type_y>::value_type &beta, vector_type_y &y ) { - gemv( traits::NO_TRANSPOSE, alpha, a, x, beta, y ); + gemv( traits::NO_TRANSPOSE, alpha, a, x, beta, y ); } // y <- A * x template < typename matrix_type, typename vector_type_x, typename vector_type_y > - inline + inline void gemv(const matrix_type &a, const vector_type_x &x, vector_type_y &y) { - typedef typename traits::matrix_traits<matrix_type>::value_type val_t; + typedef typename traits::matrix_traits<matrix_type>::value_type val_t; gemv( traits::NO_TRANSPOSE, (val_t) 1, a, x, (val_t) 0, y ); } */ diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas2_overloads.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas2_overloads.hpp index da6b7fc14dc3c89da830200a81cc638d9b04b5dc..7ee270689ab88531f8a76e63da6e82694db61c5f 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas2_overloads.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas2_overloads.hpp @@ -29,7 +29,7 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { name void ger( const int& m, const int& n, const float & alpha, const float * x_ptr, const int& incx, const float * y_ptr, const int& incy, float * a_ptr, const int& lda ) { BLAS_SGER( &m, &n, &alpha, x_ptr, &incx, y_ptr, &incy, a_ptr, &lda ) ; } inline void ger( const int& m, const int& n, const double & alpha, const double * x_ptr, const int& incx, const double * y_ptr, const int& incy, double * a_ptr, const int& lda ) { BLAS_DGER( &m, &n, &alpha, x_ptr, &incx, y_ptr, &incy, a_ptr, &lda ) ; } -/* +/* inline void geru( const int& m, const int& n, const complex_f & alpha, const complex_f * x_ptr, const int& incx, complex_f * y_ptr, const int& incy, complex_f * a_ptr, const int& lda ) { BLAS_CGERU( &m, &n, complex_ptr( &alpha ), complex_ptr( x_ptr ), &incx, complex_ptr( y_ptr ), &incy, complex_ptr( a_ptr ), &lda ) ; } inline diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas3.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas3.hpp index cf5562df8b8e6e5b3916d7a5e6311e0c0a8c37fd..9cfb8db4d9806c052c11e485ea06ba9013f2fa9b 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas3.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas3.hpp @@ -15,11 +15,11 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { - // C <- alpha * op (A) * op (B) + beta * C + // C <- alpha * op (A) * op (B) + beta * C // op (X) == X || X^T || X^H template < typename value_type, typename matrix_type_a, typename matrix_type_b, typename matrix_type_c > // ! CAUTION this function assumes that all matrices involved are column-major matrices - void gemm(const char TRANSA, const char TRANSB, + void gemm(const char TRANSA, const char TRANSB, const value_type& alpha, const matrix_type_a &a, const matrix_type_b &b, @@ -31,8 +31,8 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { const int n = TRANSB == traits::NO_TRANSPOSE ? traits::matrix_size2( b ) : traits::matrix_size1( b ); const int k = TRANSA == traits::NO_TRANSPOSE ? traits::matrix_size2( a ) : traits::matrix_size1( a ) ; assert( k == ( TRANSB == traits::NO_TRANSPOSE ? traits::matrix_size1( b ) : traits::matrix_size2( b ) ) ) ; - assert( m == traits::matrix_size1( c ) ); - assert( n == traits::matrix_size2( c ) ); + assert( m == traits::matrix_size1( c ) ); + assert( n == traits::matrix_size2( c ) ); const int lda = traits::leading_dimension( a ); const int ldb = traits::leading_dimension( b ); const int ldc = traits::leading_dimension( c ); @@ -45,7 +45,7 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { } - // C <- alpha * A * B + beta * C + // C <- alpha * A * B + beta * C template < typename value_type, typename matrix_type_a, typename matrix_type_b, typename matrix_type_c > void gemm(const value_type& alpha, const matrix_type_a &a, @@ -58,14 +58,14 @@ namespace boost { namespace numeric { namespace bindings { namespace blas { } - // C <- A * B + // C <- A * B // ! CAUTION this function assumes that all matrices involved are column-major matrices - template < - typename matrix_type_a, typename matrix_type_b, typename matrix_type_c + template < + typename matrix_type_a, typename matrix_type_b, typename matrix_type_c > void gemm(const matrix_type_a &a, const matrix_type_b &b, matrix_type_c &c) { - typedef typename traits::matrix_traits<matrix_type_c>::value_type val_t; + typedef typename traits::matrix_traits<matrix_type_c>::value_type val_t; gemm( traits::NO_TRANSPOSE, traits::NO_TRANSPOSE, (val_t) 1, a, b, (val_t) 0, c ) ; } diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas_names.h b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas_names.h index 5441de0c873cc6f6934e93252a977088842d2548..29bd4bd20ef8813204656f8539f021a2f2268c36 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas_names.h +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/blas/blas_names.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2002, 2003 Si-Lab b.v.b.a and Toon Knapen +// Copyright (C) 2002, 2003 Si-Lab b.v.b.a and Toon Knapen // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gbsv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gbsv.hpp index 6fd4c2e32f4fe76433acb088d47da89382ea9aec..a2eb3e0d9d3acc59e3d059766d49798bfbdaeda4 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gbsv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gbsv.hpp @@ -15,21 +15,21 @@ #include <boost/numeric/bindings/traits/ublas_banded.hpp> #include <boost/numeric/bindings/traits/ublas_vector2.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { namespace detail { - inline + inline void gbtrf (int const n, int const m, int const kl, int const ku, - double* ab, int const ldab, int* ipiv, int* info) + double* ab, int const ldab, int* ipiv, int* info) { LAPACK_DGBTRF (&n, &m, &kl, &ku, ab, &ldab, ipiv, info); } @@ -39,19 +39,19 @@ namespace boost { namespace numeric { namespace bindings { inline int gbtrf (MatrA& a, IVec& ipiv) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::banded_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::ordering_type, + typename traits::matrix_traits<MatrA>::ordering_type, traits::row_major_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - int const m = traits::matrix_size2 (a); + int const m = traits::matrix_size2 (a); assert (traits::vector_size (ipiv) == (m < n ? m : n)); // if the matrix has kl lower and ku upper diagonals, then we should have @@ -62,21 +62,21 @@ namespace boost { namespace numeric { namespace bindings { assert(ku >= 0); - int info; + int info; detail::gbtrf (n, m, kl, ku, - traits::matrix_storage (a), + traits::matrix_storage (a), ld, - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), &info); - return info; + return info; } namespace detail { - inline + inline void gbtrs (char const trans, int const n, int const kl, int const ku, int const m, double const* ab, int const ldab, int const* ipiv, - double* b, int const ldb, int* info) + double* b, int const ldb, int* info) { LAPACK_DGBTRS (&trans, &n, &kl, &ku, &m, ab, &ldab, ipiv, b, &ldb, info); } @@ -85,21 +85,21 @@ namespace boost { namespace numeric { namespace bindings { template <typename MatrA, typename MatrB, typename IVec> inline - int gbtrs (char const trans, MatrA const& a, IVec const& ipiv, MatrB& b) + int gbtrs (char const trans, MatrA const& a, IVec const& ipiv, MatrB& b) { - assert (trans == 'N' || trans == 'T' || trans == 'C'); + assert (trans == 'N' || trans == 'T' || trans == 'C'); -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::banded_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (ipiv)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (ipiv)); // if the matrix has kl lower and ku upper diagonals, then we should have // allocated kl lower and kl+ku upper diagonals @@ -109,23 +109,23 @@ namespace boost { namespace numeric { namespace bindings { assert(ku >= 0); - int info; - detail::gbtrs (trans, n, kl, ku, traits::matrix_size2 (b), + int info; + detail::gbtrs (trans, n, kl, ku, traits::matrix_size2 (b), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif ld, #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), #else - traits::vector_storage_const (ipiv), + traits::vector_storage_const (ipiv), #endif traits::matrix_storage (b), traits::leading_dimension (b), &info); - return info; + return info; } @@ -133,4 +133,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gees.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gees.hpp index c3385c5528d11fcbb690cf0b27355ab79e988dc8..2c2531c93010a797ebc71497106b5ef253f1c6ac 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gees.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gees.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -22,23 +22,23 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> #include <boost/numeric/bindings/traits/detail/utils.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Schur factorization of general matrix. - // + // /////////////////////////////////////////////////////////////////// - /* + /* * gees() computes a Schur factorization of an N-by-N matrix A. * * The Schur decomposition is A = U S * herm(U) where U is a @@ -56,14 +56,14 @@ namespace boost { namespace numeric { namespace bindings { * array with vector_size( work ) >= 2*matrix_size1( a ) * and rwork is a real array with * vector_size( rwork ) >= matrix_size1( a ). - */ + */ namespace detail { - inline + inline void gees (char const jobvs, char const sort, logical_t* select, int const n, float* a, int const lda, int& sdim, traits::complex_f* w, float* vs, int const ldvs, float* work, int const lwork, - bool* bwork, int& info) + bool* bwork, int& info) { traits::detail::array<float> wr(n); traits::detail::array<float> wi(n); @@ -77,11 +77,11 @@ namespace boost { namespace numeric { namespace bindings { } - inline + inline void gees (char const jobvs, char const sort, logical_t* select, int const n, double* a, int const lda, int& sdim, traits::complex_d* w, double* vs, int const ldvs, double* work, int const lwork, - bool* bwork, int& info) + bool* bwork, int& info) { traits::detail::array<double> wr(n); traits::detail::array<double> wi(n); @@ -95,12 +95,12 @@ namespace boost { namespace numeric { namespace bindings { } - inline + inline void gees (char const jobvs, char const sort, logical_t* select, int const n, traits::complex_f* a, int const lda, int& sdim, traits::complex_f* w, traits::complex_f* vs, int const ldvs, traits::complex_f* work, int lwork, float* rwork, bool* bwork, - int& info) + int& info) { LAPACK_CGEES (&jobvs, &sort, select, &n, traits::complex_ptr(a), &lda, &sdim, traits::complex_ptr(w), traits::complex_ptr (vs), &ldvs, @@ -108,19 +108,19 @@ namespace boost { namespace numeric { namespace bindings { } - inline + inline void gees (char const jobvs, char const sort, logical_t* select, int const n, traits::complex_d* a, int const lda, int& sdim, traits::complex_d* w, traits::complex_d* vs, int const ldvs, traits::complex_d* work, int lwork, double* rwork, bool* bwork, - int& info) + int& info) { LAPACK_ZGEES (&jobvs, &sort, select, &n, traits::complex_ptr(a), &lda, &sdim, traits::complex_ptr(w), traits::complex_ptr(vs), &ldvs, traits::complex_ptr(work), &lwork, rwork, bwork, &info); } - } + } namespace detail { @@ -129,32 +129,32 @@ namespace boost { namespace numeric { namespace bindings { inline int gees (char jobvs, MatrA& a, EigVal& w, SchVec& vs, Work& work) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SchVec>::matrix_structure, + typename traits::matrix_traits<SchVec>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif typedef typename MatrA::value_type value_type ; int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (vs)); - assert (n == traits::matrix_size2 (vs)); - assert (n == traits::vector_size (w)); - assert (3*n <= traits::vector_size (work)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (vs)); + assert (n == traits::matrix_size2 (vs)); + assert (n == traits::vector_size (w)); + assert (3*n <= traits::vector_size (work)); logical_t* select=0; bool* bwork=0; - int info, sdim; + int info, sdim; detail::gees (jobvs, 'N', select, n, - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), sdim, traits::vector_storage (w), @@ -174,33 +174,33 @@ namespace boost { namespace numeric { namespace bindings { int gees (char jobvs, MatrA& a, EigVal& w, SchVec& vs, Work& work, RWork& rwork) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SchVec>::matrix_structure, + typename traits::matrix_traits<SchVec>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif typedef typename MatrA::value_type value_type ; int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (vs)); - assert (n == traits::matrix_size2 (vs)); - assert (n == traits::vector_size (w)); - assert (2*n <= traits::vector_size (work)); - assert (n <= traits::vector_size (rwork)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (vs)); + assert (n == traits::matrix_size2 (vs)); + assert (n == traits::vector_size (w)); + assert (2*n <= traits::vector_size (work)); + assert (n <= traits::vector_size (rwork)); logical_t* select=0; bool* bwork=0; - int info, sdim; + int info, sdim; detail::gees (jobvs, 'N', select, n, - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), sdim, traits::vector_storage (w), @@ -339,4 +339,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/geev.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/geev.hpp index 10f7498d1c6038b1b2807a1928e6a57c675f09a1..c22f3488ec4c82448f9b334ee1cb6fae19edd1b6 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/geev.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/geev.hpp @@ -1,5 +1,5 @@ /* - * + * * Copyright (c) Andreas Kloeckner 2004 * Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * @@ -7,7 +7,7 @@ * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -22,26 +22,26 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Eigendecomposition of a general matrix A * V = V * D - // + // /////////////////////////////////////////////////////////////////// - /* + /* * geev() computes the eigendecomposition of a N x N matrix, - * where V is a N x N matrix and D is a diagonal matrix. The - * diagonal element D(i,i) is an eigenvalue of A and Q(:,i) is + * where V is a N x N matrix and D is a diagonal matrix. The + * diagonal element D(i,i) is an eigenvalue of A and Q(:,i) is * a corresponding eigenvector. * * @@ -65,9 +65,9 @@ namespace boost { namespace numeric { namespace bindings { * If you choose to leave them real, you have to pick apart the complex-conjugate * eigenpairs as per the LAPACK documentation. If you choose them complex, * the code will do the picking-apart on your behalf, at the expense of 4*N - * extra storage. Only if vr is complex, it will really fulfill its invariant + * extra storage. Only if vr is complex, it will really fulfill its invariant * on exit to the code in all cases, since complex pairs spoil that relation. - */ + */ namespace detail { @@ -98,12 +98,12 @@ namespace boost { namespace numeric { namespace bindings { float* rwork) { int info; - LAPACK_CGEEV(jobvl, jobvr, n, - traits::complex_ptr(a), lda, - traits::complex_ptr(w), - traits::complex_ptr(vl), ldvl, - traits::complex_ptr(vr), ldvr, - traits::complex_ptr(work), lwork, + LAPACK_CGEEV(jobvl, jobvr, n, + traits::complex_ptr(a), lda, + traits::complex_ptr(w), + traits::complex_ptr(vl), ldvl, + traits::complex_ptr(vr), ldvr, + traits::complex_ptr(work), lwork, rwork, &info); return info; } @@ -115,12 +115,12 @@ namespace boost { namespace numeric { namespace bindings { double* rwork) { int info; - LAPACK_ZGEEV(jobvl, jobvr, n, - traits::complex_ptr(a), lda, - traits::complex_ptr(w), - traits::complex_ptr(vl), ldvl, - traits::complex_ptr(vr), ldvr, - traits::complex_ptr(work), lwork, + LAPACK_ZGEEV(jobvl, jobvr, n, + traits::complex_ptr(a), lda, + traits::complex_ptr(w), + traits::complex_ptr(vl), ldvl, + traits::complex_ptr(vr), ldvr, + traits::complex_ptr(work), lwork, rwork, &info); return info; } @@ -135,7 +135,7 @@ namespace boost { namespace numeric { namespace bindings { // real case template <typename A, typename W, typename V> - int geev(real_case, const char jobvl, const char jobvr, A& a, W& w, + int geev(real_case, const char jobvl, const char jobvr, A& a, W& w, V* vl, V *vr) { int const n = traits::matrix_size1(a); @@ -155,8 +155,8 @@ namespace boost { namespace numeric { namespace bindings { int lwork = -1; value_type work_temp; int result = geev_backend(&jobvl, &jobvr, &n, - traits::matrix_storage(a), &n, - wr.storage(), wi.storage(), + traits::matrix_storage(a), &n, + wr.storage(), wi.storage(), vl_real, &ldvl, vr_real, &ldvr, &work_temp, &lwork); if (result != 0) @@ -165,8 +165,8 @@ namespace boost { namespace numeric { namespace bindings { lwork = (int) work_temp; traits::detail::array<value_type> work(lwork); result = geev_backend(&jobvl, &jobvr, &n, - traits::matrix_storage(a), &n, - wr.storage(), wi.storage(), + traits::matrix_storage(a), &n, + wr.storage(), wi.storage(), vl_real, &ldvl, vr_real, &ldvr, work.storage(), &lwork); @@ -177,7 +177,7 @@ namespace boost { namespace numeric { namespace bindings { // mixed (i.e. real with complex vectors) case template <typename A, typename W, typename V> - int geev(mixed_case, const char jobvl, const char jobvr, A& a, W& w, + int geev(mixed_case, const char jobvl, const char jobvr, A& a, W& w, V* vl, V *vr) { int const n = traits::matrix_size1(a); @@ -194,8 +194,8 @@ namespace boost { namespace numeric { namespace bindings { int lwork = -1; value_type work_temp; int result = geev_backend(&jobvl, &jobvr, &n, - traits::matrix_storage(a), &n, - wr.storage(), wi.storage(), + traits::matrix_storage(a), &n, + wr.storage(), wi.storage(), vl2.storage(), &ldvl2, vr2.storage(), &ldvr2, &work_temp, &lwork); if (result != 0) @@ -204,8 +204,8 @@ namespace boost { namespace numeric { namespace bindings { lwork = (int) work_temp; traits::detail::array<value_type> work(lwork); result = geev_backend(&jobvl, &jobvr, &n, - traits::matrix_storage(a), &n, - wr.storage(), wi.storage(), + traits::matrix_storage(a), &n, + wr.storage(), wi.storage(), vl2.storage(), &ldvl2, vr2.storage(), &ldvr2, work.storage(), &lwork); @@ -223,7 +223,7 @@ namespace boost { namespace numeric { namespace bindings { vr_stor = traits::matrix_storage(*vr); ldvr = traits::matrix_size2(*vr); } - + for (int i = 0; i < n; i++) { traits::vector_storage(w)[i] = std::complex<value_type>(wr[i], wi[i]); @@ -266,7 +266,7 @@ namespace boost { namespace numeric { namespace bindings { // complex case template <typename A, typename W, typename V> - int geev(complex_case, const char jobvl, const char jobvr, A& a, W& w, + int geev(complex_case, const char jobvl, const char jobvr, A& a, W& w, V* vl, V *vr) { typedef typename A::value_type value_type; @@ -286,7 +286,7 @@ namespace boost { namespace numeric { namespace bindings { int lwork = -1; value_type work_temp; int result = geev_backend(&jobvl, &jobvr, &n, - traits::matrix_storage(a), &n, + traits::matrix_storage(a), &n, traits::vector_storage(w), vl_real, &ldvl, vr_real, &ldvr, &work_temp, &lwork, rwork.storage()); @@ -296,10 +296,10 @@ namespace boost { namespace numeric { namespace bindings { lwork = (int) std::real(work_temp); traits::detail::array<value_type> work(lwork); result = geev_backend(&jobvl, &jobvr, &n, - traits::matrix_storage(a), &n, + traits::matrix_storage(a), &n, traits::vector_storage(w), vl_real, &ldvl, vr_real, &ldvr, - work.storage(), &lwork, + work.storage(), &lwork, rwork.storage()); return result; @@ -310,25 +310,25 @@ namespace boost { namespace numeric { namespace bindings { // gateway / dispatch routine template <typename A, typename W, typename V> - int geev(A& a, W& w, V* vl, V* vr, optimal_workspace) + int geev(A& a, W& w, V* vl, V* vr, optimal_workspace) { // input checking -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif #ifndef NDEBUG int const n = traits::matrix_size1(a); #endif - assert(traits::matrix_size2(a)==n); - assert(traits::vector_size(w)==n); - assert(traits::vector_size(w)==n); - assert(!vr || traits::matrix_size1(*vr)==n); - assert(!vl || traits::matrix_size1(*vl)==n); + assert(traits::matrix_size2(a)==n); + assert(traits::vector_size(w)==n); + assert(traits::vector_size(w)==n); + assert(!vr || traits::matrix_size1(*vr)==n); + assert(!vl || traits::matrix_size1(*vl)==n); // preparation typedef typename A::value_type value_type; @@ -343,7 +343,7 @@ namespace boost { namespace numeric { namespace bindings { detail::real_case, detail::mixed_case>::type, detail::complex_case>::type(), - vl != 0 ? 'V' : 'N', + vl != 0 ? 'V' : 'N', vr != 0 ? 'V' : 'N', a, w, vl, vr); } @@ -352,4 +352,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gels.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gels.hpp index 30e5b4a2bb94766c532dccf5b17a61616dad073d..c6877ee93d6a28c6b14ba9353e1f95636e888757 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gels.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gels.hpp @@ -21,22 +21,22 @@ // included to implicitly convert a vector to an nx1 matrix // so that it is compatible with lapack binding -#include <boost/numeric/bindings/traits/ublas_vector2.hpp> +#include <boost/numeric/bindings/traits/ublas_vector2.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> #endif namespace boost { namespace numeric { namespace bindings { - + namespace lapack { //////////////////////////////////////////////////////////////////////// // // Linear Least Squares of an underdetermined or overdetermined matrix - // + // /////////////////////////////////////////////////////////////////////// /* gels - uses the LQ or QR factorization to solve an overdetermined @@ -44,8 +44,8 @@ namespace boost { namespace numeric { namespace bindings { * assumed. * * The linear least squares system is defined by A*x=b. A is the m-by-n - * coefficients matrix and b is the m-by-nrhs matrix. Several - * right hand side vectors b and solution vectors x can be handled in + * coefficients matrix and b is the m-by-nrhs matrix. Several + * right hand side vectors b and solution vectors x can be handled in * a single call; they are stored as the columns of the m-by-nrhs right * hand side matrix B and the n-by-nrh solution matrix x. * @@ -94,9 +94,9 @@ namespace boost { namespace numeric { namespace bindings { traits::complex_f *b, const int ldb, traits::complex_f *work, const int lwork, int *info) { - LAPACK_CGELS(&trans, &m, &n, &nrhs, - traits::complex_ptr(a), &lda, - traits::complex_ptr(b), &ldb, + LAPACK_CGELS(&trans, &m, &n, &nrhs, + traits::complex_ptr(a), &lda, + traits::complex_ptr(b), &ldb, traits::complex_ptr(work), &lwork, info); } @@ -105,12 +105,12 @@ namespace boost { namespace numeric { namespace bindings { traits::complex_d *b, const int ldb, traits::complex_d *work, const int lwork, int *info) { - LAPACK_ZGELS(&trans, &m, &n, &nrhs, - traits::complex_ptr(a), &lda, - traits::complex_ptr(b), &ldb, + LAPACK_ZGELS(&trans, &m, &n, &nrhs, + traits::complex_ptr(a), &lda, + traits::complex_ptr(b), &ldb, traits::complex_ptr(work), &lwork, info); } - + // generic function that calls more detailed lapack function template <typename MatrA, typename VecB, typename Work> int gels(const char trans, MatrA& A, VecB& b, Work& work) @@ -138,7 +138,7 @@ namespace boost { namespace numeric { namespace bindings { traits::leading_dimension(b), traits::vector_storage(work), traits::vector_size(work), - &info); + &info); return info; } diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gelsd.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gelsd.hpp index 1347b78b72921a72ff17ac1f5a8e516811485c83..7108bd62467b7f60264ee7067c174a3d5f485850 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gelsd.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gelsd.hpp @@ -22,10 +22,10 @@ // included to implicitly convert a vector to an nx1 matrix // so that it is compatible with lapack binding -#include <boost/numeric/bindings/traits/ublas_vector2.hpp> +#include <boost/numeric/bindings/traits/ublas_vector2.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> #endif @@ -36,45 +36,45 @@ namespace boost { namespace numeric { namespace bindings { namespace detail { - inline void gelsd(const int m, const int n, const int nrhs, - float *a, const int lda, float *b, const int ldb, + inline void gelsd(const int m, const int n, const int nrhs, + float *a, const int lda, float *b, const int ldb, float *s, const float rcond, int *rank, float *work, const int lwork, int *iwork, int *info) { - LAPACK_SGELSD(&m, &n, &nrhs, a, &lda, b, &ldb, s, + LAPACK_SGELSD(&m, &n, &nrhs, a, &lda, b, &ldb, s, &rcond, rank, work, &lwork, iwork, info); } - inline void gelsd(const int m, const int n, const int nrhs, - double *a, const int lda, double *b, const int ldb, + inline void gelsd(const int m, const int n, const int nrhs, + double *a, const int lda, double *b, const int ldb, double *s, const double rcond, int *rank, double *work, const int lwork, int *iwork, int *info) { - LAPACK_DGELSD(&m, &n, &nrhs, a, &lda, b, &ldb, s, + LAPACK_DGELSD(&m, &n, &nrhs, a, &lda, b, &ldb, s, &rcond, rank, work, &lwork, iwork, info); } - inline void gelsd(const int m, const int n, const int nrhs, - traits::complex_f *a, const int lda, traits::complex_f *b, - const int ldb, float *s, const float rcond, int *rank, - traits::complex_f *work, const int lwork, float *rwork, + inline void gelsd(const int m, const int n, const int nrhs, + traits::complex_f *a, const int lda, traits::complex_f *b, + const int ldb, float *s, const float rcond, int *rank, + traits::complex_f *work, const int lwork, float *rwork, int *iwork, int *info) { - LAPACK_CGELSD(&m, &n, &nrhs, traits::complex_ptr(a), - &lda, traits::complex_ptr(b), &ldb, s, - &rcond, rank, traits::complex_ptr(work), + LAPACK_CGELSD(&m, &n, &nrhs, traits::complex_ptr(a), + &lda, traits::complex_ptr(b), &ldb, s, + &rcond, rank, traits::complex_ptr(work), &lwork, rwork, iwork, info); } - inline void gelsd(const int m, const int n, const int nrhs, - traits::complex_d *a, const int lda, traits::complex_d *b, - const int ldb, double *s, const double rcond, int *rank, - traits::complex_d *work, const int lwork, double *rwork, + inline void gelsd(const int m, const int n, const int nrhs, + traits::complex_d *a, const int lda, traits::complex_d *b, + const int ldb, double *s, const double rcond, int *rank, + traits::complex_d *work, const int lwork, double *rwork, int *iwork, int *info) { - LAPACK_ZGELSD(&m, &n, &nrhs, traits::complex_ptr(a), - &lda, traits::complex_ptr(b), &ldb, s, - &rcond, rank, traits::complex_ptr(work), + LAPACK_ZGELSD(&m, &n, &nrhs, traits::complex_ptr(a), + &lda, traits::complex_ptr(b), &ldb, s, + &rcond, rank, traits::complex_ptr(work), &lwork, rwork, iwork, info); } @@ -128,7 +128,7 @@ namespace boost { namespace numeric { namespace bindings { } // gelsd for complex type - template <typename MatrA, typename MatrB, typename VecS, + template <typename MatrA, typename MatrB, typename VecS, typename Work, typename RWork> inline int gelsd(MatrA& A, MatrB& B, VecS& s, Work& work, RWork& rwork) { @@ -202,7 +202,7 @@ namespace boost { namespace numeric { namespace bindings { const int smlsiz = ilaenv(9, "GELSD", ""); const int nlvl = static_cast<int>(((std::log(static_cast<float>(minmn))/std::log(2.f))/ (smlsiz+1)) + 1); - const int lwork = 12*minmn + 2*minmn*smlsiz + 8*minmn*nlvl + + const int lwork = 12*minmn + 2*minmn*smlsiz + 8*minmn*nlvl + minmn*nrhs + (smlsiz+1)*(smlsiz+1); traits::detail::array<val_t> work(lwork); @@ -295,7 +295,7 @@ namespace boost { namespace numeric { namespace bindings { traits::detail::array<val_t> work(2*minmn + minmn*nrhs); - const int rwork_size = 10*minmn + 2*minmn*smlsiz + 8*minmn*nlvl + + const int rwork_size = 10*minmn + 2*minmn*smlsiz + 8*minmn*nlvl + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1); traits::detail::array<real_t> rwork(std::max(1, rwork_size)); @@ -352,7 +352,7 @@ namespace boost { namespace numeric { namespace bindings { const int smlsiz = ilaenv(9, "GELSD", ""); const int nlvl = static_cast<int>(((std::log(static_cast<float>(minmn))/std::log(2.f))/ (smlsiz+1)) + 1); - const int rwork_size = 10*minmn + 2*minmn*smlsiz + 8*minmn*nlvl + + const int rwork_size = 10*minmn + 2*minmn*smlsiz + 8*minmn*nlvl + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1); traits::detail::array<real_t> rwork(std::max(1, rwork_size)); diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gelss.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gelss.hpp index e93ee1bec788f5ad8a21c7894207bb1c0e33946d..083627f9b669930e483561281f14ba81cac1ca46 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gelss.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gelss.hpp @@ -21,10 +21,10 @@ // included to implicitly convert a vector to an nx1 matrix // so that it is compatible with lapack binding -#include <boost/numeric/bindings/traits/ublas_vector2.hpp> +#include <boost/numeric/bindings/traits/ublas_vector2.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> #endif @@ -32,47 +32,47 @@ namespace boost { namespace numeric { namespace bindings { namespace lapack { - + namespace detail { - inline void gelss(const int m, const int n, const int nrhs, - float *a, const int lda, float *b, const int ldb, + inline void gelss(const int m, const int n, const int nrhs, + float *a, const int lda, float *b, const int ldb, float *s, const float rcond, int *rank, float *work, const int lwork, int *info) { LAPACK_SGELSS(&m, &n, &nrhs, a, &lda, b, &ldb, s, &rcond, rank, work, &lwork, info); } - inline void gelss(const int m, const int n, const int nrhs, - double *a, const int lda, double *b, const int ldb, + inline void gelss(const int m, const int n, const int nrhs, + double *a, const int lda, double *b, const int ldb, double *s, const double rcond, int *rank, double *work, const int lwork, int *info) { LAPACK_DGELSS(&m, &n, &nrhs, a, &lda, b, &ldb, s, &rcond, rank, work, &lwork, info); } - inline void gelss(const int m, const int n, const int nrhs, - traits::complex_f *a, const int lda, traits::complex_f *b, - const int ldb, float *s, const float rcond, int *rank, + inline void gelss(const int m, const int n, const int nrhs, + traits::complex_f *a, const int lda, traits::complex_f *b, + const int ldb, float *s, const float rcond, int *rank, traits::complex_f *work, const int lwork, float *rwork, int *info) { - LAPACK_CGELSS(&m, &n, &nrhs, traits::complex_ptr(a), - &lda, traits::complex_ptr(b), &ldb, s, - &rcond, rank, traits::complex_ptr(work), + LAPACK_CGELSS(&m, &n, &nrhs, traits::complex_ptr(a), + &lda, traits::complex_ptr(b), &ldb, s, + &rcond, rank, traits::complex_ptr(work), &lwork, rwork, info); } - inline void gelss(const int m, const int n, const int nrhs, - traits::complex_d *a, const int lda, traits::complex_d *b, - const int ldb, double *s, const double rcond, int *rank, + inline void gelss(const int m, const int n, const int nrhs, + traits::complex_d *a, const int lda, traits::complex_d *b, + const int ldb, double *s, const double rcond, int *rank, traits::complex_d *work, const int lwork, double *rwork, int *info) { - LAPACK_ZGELSS(&m, &n, &nrhs, traits::complex_ptr(a), - &lda, traits::complex_ptr(b), &ldb, s, - &rcond, rank, traits::complex_ptr(work), + LAPACK_ZGELSS(&m, &n, &nrhs, traits::complex_ptr(a), + &lda, traits::complex_ptr(b), &ldb, s, + &rcond, rank, traits::complex_ptr(work), &lwork, rwork, info); } - + // gelss for real type template <typename MatrA, typename MatrB, typename VecS, typename Work> inline int gelss(MatrA& A, MatrB& B, VecS& s, Work& work) @@ -178,7 +178,7 @@ namespace boost { namespace numeric { namespace bindings { const int minmn = std::min(m, n); // minmn = m < n ? m : n const int maxmn = std::max(m, n); // maxmn = m > n ? m : n const int maxmnr = std::max(maxmn, rhs); // maxmnr = maxmn > rhs ? maxmn : rhs - + traits::detail::array<val_t> work(3*minmn + std::max(2*minmn, maxmnr)); return gelss(A, B, s, work); @@ -255,7 +255,7 @@ namespace boost { namespace numeric { namespace bindings { traits::detail::array<val_t> work(2*minmn + maxmnr); traits::detail::array<real_t> rwork(std::max(1, (5*minmn))); - + return gelss(A, B, s, work, rwork); } diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/geqrf.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/geqrf.hpp index bb51903573c61b22f9c06c30be41a1e162ec4c70..1f54cbfe24ea8f511dff9af4ffb8b2152e3abcb6 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/geqrf.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/geqrf.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -21,24 +21,24 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // QR factorization of a general m x n matrix A = Q * R - // + // /////////////////////////////////////////////////////////////////// - /* + /* * geqrf() computes the QR factorization of a rectangular matrix * A = Q * R, where Q is a M x min(M,N) matrix with orthogonal * and normalized column (i.e. herm(Q) $ Q = I) and R is a @@ -49,78 +49,78 @@ namespace boost { namespace numeric { namespace bindings { * upper triangular if m >= n); the elements below the diagonal, * with the array TAU, represent the orthogonal matrix Q as a product * of min(M,N) elementary reflectors. - */ + */ namespace detail { - inline + inline void geqrf (int const m, int const n, float* a, int const lda, - float* tau, float* work, int const lwork, int& info) + float* tau, float* work, int const lwork, int& info) { LAPACK_SGEQRF (&m, &n, a, &lda, tau, work, &lwork, &info); } - inline + inline void geqrf (int const m, int const n, double* a, int const lda, - double* tau, double* work, int const lwork, int& info) + double* tau, double* work, int const lwork, int& info) { LAPACK_DGEQRF (&m, &n, a, &lda, tau, work, &lwork, &info); } - inline + inline void geqrf (int const m, int const n, traits::complex_f* a, int const lda, traits::complex_f* tau, traits::complex_f* work, - int const lwork, int& info) + int const lwork, int& info) { LAPACK_CGEQRF (&m, &n, traits::complex_ptr (a), &lda, traits::complex_ptr (tau), traits::complex_ptr (work), &lwork, &info ); } - - inline + + inline void geqrf (int const m, int const n, traits::complex_d* a, int const lda, traits::complex_d* tau, traits::complex_d* work, - int const lwork, int& info) + int const lwork, int& info) { LAPACK_ZGEQRF (&m, &n, traits::complex_ptr (a), &lda, traits::complex_ptr (tau), traits::complex_ptr (work), &lwork, &info ); } - - } + + } template <typename A, typename Tau, typename Work> inline int geqrf (A& a, Tau& tau, Work& work) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - assert (std::min<int>(m,n) <= traits::vector_size (tau)); - assert (n <= traits::vector_size (work)); + assert (std::min<int>(m,n) <= traits::vector_size (tau)); + assert (n <= traits::vector_size (work)); - int info; + int info; detail::geqrf (m, n, - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (tau), + traits::vector_storage (tau), traits::vector_storage (work), traits::vector_size (work), info); - return info; + return info; } // Computation of the QR factorization. @@ -172,4 +172,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesdd.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesdd.hpp index 0831242277c70173cf792f02a93f02d302680597..b7d39f0fe34fcbbd9c5a24fe38340429764588a1 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesdd.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesdd.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -20,372 +20,372 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> #include <boost/numeric/bindings/traits/detail/utils.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // - // singular value decomposition - // + // singular value decomposition + // /////////////////////////////////////////////////////////////////// - /* - * (divide and conquer driver) - * gesdd() computes the singular value decomposition (SVD) of - * M-by-N matrix A, optionally computing the left and/or right - * singular vectors, by using divide-and-conquer method. + /* + * (divide and conquer driver) + * gesdd() computes the singular value decomposition (SVD) of + * M-by-N matrix A, optionally computing the left and/or right + * singular vectors, by using divide-and-conquer method. * The SVD is written * * A = U * S * V^T or A = U * S * V^H * * where S is an M-by-N matrix which is zero except for its min(m,n) - * diagonal elements, U is an M-by-M orthogonal/unitary matrix, and V + * diagonal elements, U is an M-by-M orthogonal/unitary matrix, and V * is an N-by-N orthogonal/unitary matrix. The diagonal elements of S - * are the singular values of A; they are real and non-negative, and - * are returnede in descending order. The first min(m,n) columns of - * U and V are the left and right singular vectors of A. (Note that + * are the singular values of A; they are real and non-negative, and + * are returnede in descending order. The first min(m,n) columns of + * U and V are the left and right singular vectors of A. (Note that * the routine returns V^T or V^H, not V. - */ + */ namespace detail { - inline - void gesdd (char const jobz, int const m, int const n, - float* a, int const lda, - float* s, float* u, int const ldu, + inline + void gesdd (char const jobz, int const m, int const n, + float* a, int const lda, + float* s, float* u, int const ldu, float* vt, int const ldvt, - float* work, int const lwork, float* /* dummy */, + float* work, int const lwork, float* /* dummy */, int* iwork, int* info) { - LAPACK_SGESDD (&jobz, &m, &n, a, &lda, s, - u, &ldu, vt, &ldvt, work, &lwork, iwork, info); + LAPACK_SGESDD (&jobz, &m, &n, a, &lda, s, + u, &ldu, vt, &ldvt, work, &lwork, iwork, info); } - inline - void gesdd (char const jobz, int const m, int const n, - double* a, int const lda, - double* s, double* u, int const ldu, + inline + void gesdd (char const jobz, int const m, int const n, + double* a, int const lda, + double* s, double* u, int const ldu, double* vt, int const ldvt, - double* work, int const lwork, double* /* dummy */, + double* work, int const lwork, double* /* dummy */, int* iwork, int* info) { - LAPACK_DGESDD (&jobz, &m, &n, a, &lda, s, - u, &ldu, vt, &ldvt, work, &lwork, iwork, info); + LAPACK_DGESDD (&jobz, &m, &n, a, &lda, s, + u, &ldu, vt, &ldvt, work, &lwork, iwork, info); } - inline - void gesdd (char const jobz, int const m, int const n, - traits::complex_f* a, int const lda, - float* s, traits::complex_f* u, int const ldu, + inline + void gesdd (char const jobz, int const m, int const n, + traits::complex_f* a, int const lda, + float* s, traits::complex_f* u, int const ldu, traits::complex_f* vt, int const ldvt, - traits::complex_f* work, int const lwork, + traits::complex_f* work, int const lwork, float* rwork, int* iwork, int* info) { - LAPACK_CGESDD (&jobz, &m, &n, - traits::complex_ptr (a), &lda, s, - traits::complex_ptr (u), &ldu, - traits::complex_ptr (vt), &ldvt, - traits::complex_ptr (work), &lwork, - rwork, iwork, info); + LAPACK_CGESDD (&jobz, &m, &n, + traits::complex_ptr (a), &lda, s, + traits::complex_ptr (u), &ldu, + traits::complex_ptr (vt), &ldvt, + traits::complex_ptr (work), &lwork, + rwork, iwork, info); } - inline - void gesdd (char const jobz, int const m, int const n, - traits::complex_d* a, int const lda, - double* s, traits::complex_d* u, int const ldu, + inline + void gesdd (char const jobz, int const m, int const n, + traits::complex_d* a, int const lda, + double* s, traits::complex_d* u, int const ldu, traits::complex_d* vt, int const ldvt, - traits::complex_d* work, int const lwork, + traits::complex_d* work, int const lwork, double* rwork, int* iwork, int* info) { - LAPACK_ZGESDD (&jobz, &m, &n, - traits::complex_ptr (a), &lda, s, - traits::complex_ptr (u), &ldu, - traits::complex_ptr (vt), &ldvt, - traits::complex_ptr (work), &lwork, - rwork, iwork, info); + LAPACK_ZGESDD (&jobz, &m, &n, + traits::complex_ptr (a), &lda, s, + traits::complex_ptr (u), &ldu, + traits::complex_ptr (vt), &ldvt, + traits::complex_ptr (work), &lwork, + rwork, iwork, info); } - inline + inline int gesdd_min_work (float, char jobz, int m, int n) { - int minmn = m < n ? m : n; - int maxmn = m < n ? n : m; - int m3 = 3 * minmn; - int m4 = 4 * minmn; - int minw; + int minmn = m < n ? m : n; + int maxmn = m < n ? n : m; + int m3 = 3 * minmn; + int m4 = 4 * minmn; + int minw; if (jobz == 'N') { // leading comments: // LWORK >= 3*min(M,N) + max(max(M,N), 6*min(M,N)) // code: // LWORK >= 3*min(M,N) + max(max(M,N), 7*min(M,N)) - int m7 = 7 * minmn; + int m7 = 7 * minmn; minw = maxmn < m7 ? m7 : maxmn; - minw += m3; + minw += m3; } if (jobz == 'O') { - // LWORK >= 3*min(M,N)*min(M,N) + // LWORK >= 3*min(M,N)*min(M,N) // + max(max(M,N), 5*min(M,N)*min(M,N)+4*min(M,N)) - int m5 = 5 * minmn * minmn + m4; + int m5 = 5 * minmn * minmn + m4; minw = maxmn < m5 ? m5 : maxmn; - minw += m3 * minmn; + minw += m3 * minmn; } if (jobz == 'S' || jobz == 'A') { - // LWORK >= 3*min(M,N)*min(M,N) + // LWORK >= 3*min(M,N)*min(M,N) // + max(max(M,N), 4*min(M,N)*min(M,N)+4*min(M,N)). - int m44 = m4 * minmn + m4; + int m44 = m4 * minmn + m4; minw = maxmn < m44 ? m44 : maxmn; - minw += m3 * minmn; + minw += m3 * minmn; } - return minw; + return minw; } - inline + inline int gesdd_min_work (double, char jobz, int m, int n) { - int minmn = m < n ? m : n; - int maxmn = m < n ? n : m; - int m3 = 3 * minmn; - int m4 = 4 * minmn; - int minw; + int minmn = m < n ? m : n; + int maxmn = m < n ? n : m; + int m3 = 3 * minmn; + int m4 = 4 * minmn; + int minw; if (jobz == 'N') { // leading comments: // LWORK >= 3*min(M,N) + max(max(M,N), 6*min(M,N)) // code: // LWORK >= 3*min(M,N) + max(max(M,N), 7*min(M,N)) - int m7 = 7 * minmn; + int m7 = 7 * minmn; minw = maxmn < m7 ? m7 : maxmn; - minw += m3; + minw += m3; } else if (jobz == 'O') { - // LWORK >= 3*min(M,N)*min(M,N) + // LWORK >= 3*min(M,N)*min(M,N) // + max(max(M,N), 5*min(M,N)*min(M,N)+4*min(M,N)) - int m5 = 5 * minmn * minmn + m4; + int m5 = 5 * minmn * minmn + m4; minw = maxmn < m5 ? m5 : maxmn; - minw += m3 * minmn; + minw += m3 * minmn; } else if (jobz == 'S' || jobz == 'A') { - // LWORK >= 3*min(M,N)*min(M,N) + // LWORK >= 3*min(M,N)*min(M,N) // + max(max(M,N), 4*min(M,N)*min(M,N)+4*min(M,N)). - int m44 = m4 * minmn + m4; + int m44 = m4 * minmn + m4; minw = maxmn < m44 ? m44 : maxmn; - minw += m3 * minmn; + minw += m3 * minmn; } else { - std::cerr << "Invalid option passed to gesdd" << std::endl ; + std::cerr << "Invalid option passed to gesdd" << std::endl ; return 0 ; } - return minw; + return minw; } - inline + inline int gesdd_min_work (traits::complex_f, char jobz, int m, int n) { - int minmn = m < n ? m : n; - int maxmn = m < n ? n : m; + int minmn = m < n ? m : n; + int maxmn = m < n ? n : m; int m2 = 2 * minmn; - int minw = m2 + maxmn; - if (jobz == 'N') + int minw = m2 + maxmn; + if (jobz == 'N') // LWORK >= 2*min(M,N)+max(M,N) - ; - if (jobz == 'O') + ; + if (jobz == 'O') // LWORK >= 2*min(M,N)*min(M,N) + 2*min(M,N) + max(M,N) - minw += m2 * minmn; - if (jobz == 'S' || jobz == 'A') + minw += m2 * minmn; + if (jobz == 'S' || jobz == 'A') // LWORK >= min(M,N)*min(M,N) + 2*min(M,N) + max(M,N) - minw += minmn * minmn; - return minw; + minw += minmn * minmn; + return minw; } - inline + inline int gesdd_min_work (traits::complex_d, char jobz, int m, int n) { - int minmn = m < n ? m : n; - int maxmn = m < n ? n : m; + int minmn = m < n ? m : n; + int maxmn = m < n ? n : m; int m2 = 2 * minmn; - int minw = m2 + maxmn; - if (jobz == 'N') + int minw = m2 + maxmn; + if (jobz == 'N') // LWORK >= 2*min(M,N)+max(M,N) - ; - if (jobz == 'O') + ; + if (jobz == 'O') // LWORK >= 2*min(M,N)*min(M,N) + 2*min(M,N) + max(M,N) - minw += m2 * minmn; - if (jobz == 'S' || jobz == 'A') + minw += m2 * minmn; + if (jobz == 'S' || jobz == 'A') // LWORK >= min(M,N)*min(M,N) + 2*min(M,N) + max(M,N) - minw += minmn * minmn; - return minw; + minw += minmn * minmn; + return minw; } - inline + inline int gesdd_rwork (float, char, int, int) { return 1; } - inline + inline int gesdd_rwork (double, char, int, int) { return 1; } - inline + inline int gesdd_rwork (traits::complex_f, char jobz, int m, int n) { - int minmn = m < n ? m : n; - int minw; - if (jobz == 'N') + int minmn = m < n ? m : n; + int minw; + if (jobz == 'N') // LWORK >= 7*min(M,N) - minw = 7 * minmn; - else + minw = 7 * minmn; + else // LRWORK >= 5*min(M,N)*min(M,N) + 5*min(M,N) minw = 5 * (minmn * minmn + minmn); - return minw; + return minw; } - inline + inline int gesdd_rwork (traits::complex_d, char jobz, int m, int n) { - int minmn = m < n ? m : n; - int minw; - if (jobz == 'N') + int minmn = m < n ? m : n; + int minw; + if (jobz == 'N') // LWORK >= 7*min(M,N) - minw = 7 * minmn; - else + minw = 7 * minmn; + else // LRWORK >= 5*min(M,N)*min(M,N) + 5*min(M,N) minw = 5 * (minmn * minmn + minmn); - return minw; + return minw; } inline int gesdd_iwork (int m, int n) { - int minmn = m < n ? m : n; - return 8 * minmn; + int minmn = m < n ? m : n; + return 8 * minmn; } - } // detail + } // detail - template <typename MatrA> + template <typename MatrA> inline - int gesdd_work (char const q, char const jobz, MatrA const& a) + int gesdd_work (char const q, char const jobz, MatrA const& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif #ifdef BOOST_NUMERIC_BINDINGS_LAPACK_2 - assert (q == 'M'); + assert (q == 'M'); #else - assert (q == 'M' || q == 'O'); -#endif - assert (jobz == 'N' || jobz == 'O' || jobz == 'A' || jobz == 'S'); + assert (q == 'M' || q == 'O'); +#endif + assert (jobz == 'N' || jobz == 'O' || jobz == 'A' || jobz == 'S'); int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - int lw = -13; + int lw = -13; #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif - if (q == 'M') + if (q == 'M') lw = detail::gesdd_min_work (val_t(), jobz, m, n); #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_2 - MatrA& a2 = const_cast<MatrA&> (a); + MatrA& a2 = const_cast<MatrA&> (a); if (q == 'O') { - // traits::detail::array<val_t> w (1); - val_t w; - int info; - detail::gesdd (jobz, m, n, - traits::matrix_storage (a2), + // traits::detail::array<val_t> w (1); + val_t w; + int info; + detail::gesdd (jobz, m, n, + traits::matrix_storage (a2), traits::leading_dimension (a2), - 0, // traits::vector_storage (s), + 0, // traits::vector_storage (s), 0, // traits::matrix_storage (u), m, // traits::leading_dimension (u), 0, // traits::matrix_storage (vt), n, // traits::leading_dimension (vt), - &w, // traits::vector_storage (w), - -1, // traits::vector_size (w), - 0, // traits::vector_storage (rw), - 0, // traits::vector_storage (iw), + &w, // traits::vector_storage (w), + -1, // traits::vector_size (w), + 0, // traits::vector_storage (rw), + 0, // traits::vector_storage (iw), &info); - assert (info == 0); + assert (info == 0); - lw = traits::detail::to_int (w); - // // lw = traits::detail::to_int (w[0]); + lw = traits::detail::to_int (w); + // // lw = traits::detail::to_int (w[0]); /* * is there a bug in LAPACK? or in Mandrake's .rpm? - * if m == 3, n == 4 and jobz == 'N' (real A), + * if m == 3, n == 4 and jobz == 'N' (real A), * gesdd() returns optimal size == 1 while minimum size == 27 */ - // int lwo = traits::detail::to_int (w); + // int lwo = traits::detail::to_int (w); // int lwmin = detail::gesdd_min_work (val_t(), jobz, m, n); - // lw = lwo < lwmin ? lwmin : lwo; + // lw = lwo < lwmin ? lwmin : lwo; } -#endif - - return lw; +#endif + + return lw; } - template <typename MatrA> + template <typename MatrA> inline int gesdd_rwork (char jobz, MatrA const& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif - assert (jobz == 'N' || jobz == 'O' || jobz == 'A' || jobz == 'S'); + assert (jobz == 'N' || jobz == 'O' || jobz == 'A' || jobz == 'S'); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif - return detail::gesdd_rwork (val_t(), jobz, + return detail::gesdd_rwork (val_t(), jobz, traits::matrix_size1 (a), traits::matrix_size2 (a)); } - template <typename MatrA> + template <typename MatrA> inline int gesdd_iwork (MatrA const& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif return detail::gesdd_iwork (traits::matrix_size1 (a), traits::matrix_size2 (a)); } - template <typename MatrA, typename VecS, + template <typename MatrA, typename VecS, typename MatrU, typename MatrV, typename VecW, typename VecIW> inline - int gesdd (char const jobz, MatrA& a, - VecS& s, MatrU& u, MatrV& vt, VecW& w, VecIW& iw) + int gesdd (char const jobz, MatrA& a, + VecS& s, MatrU& u, MatrV& vt, VecW& w, VecIW& iw) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrU>::matrix_structure, + typename traits::matrix_traits<MatrU>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrV>::matrix_structure, + typename traits::matrix_traits<MatrV>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT( (boost::is_same< @@ -395,241 +395,241 @@ namespace boost { namespace numeric { namespace bindings { boost::is_same< typename traits::matrix_traits<MatrA>::value_type, double >::value)); -#endif +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - int const minmn = m < n ? m : n; + int const minmn = m < n ? m : n; - assert (minmn == traits::vector_size (s)); + assert (minmn == traits::vector_size (s)); assert ((jobz == 'N') || ((jobz == 'O' || jobz == 'A') && m >= n) - || ((jobz == 'O' || jobz == 'A') - && m < n + || ((jobz == 'O' || jobz == 'A') + && m < n && m == traits::matrix_size2 (u)) - || (jobz == 'S' && minmn == traits::matrix_size2 (u))); + || (jobz == 'S' && minmn == traits::matrix_size2 (u))); assert ((jobz == 'N' && traits::leading_dimension (u) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m >= n && traits::leading_dimension (u) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m < n && traits::leading_dimension (u) >= m) || (jobz == 'A' && traits::leading_dimension (u) >= m) || (jobz == 'S' && traits::leading_dimension (u) >= m)); - assert (n == traits::matrix_size2 (vt)); + assert (n == traits::matrix_size2 (vt)); assert ((jobz == 'N' && traits::leading_dimension (vt) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m < n && traits::leading_dimension (vt) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m >= n && traits::leading_dimension (vt) >= n) || (jobz == 'A' && traits::leading_dimension (vt) >= n) || (jobz == 'S' && traits::leading_dimension (vt) >= minmn)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif - assert (traits::vector_size (w) - >= detail::gesdd_min_work (val_t(), jobz, m, n)); - assert (traits::vector_size (iw) >= detail::gesdd_iwork (m, n)); - - int info; - detail::gesdd (jobz, m, n, - traits::matrix_storage (a), + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif + assert (traits::vector_size (w) + >= detail::gesdd_min_work (val_t(), jobz, m, n)); + assert (traits::vector_size (iw) >= detail::gesdd_iwork (m, n)); + + int info; + detail::gesdd (jobz, m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (s), + traits::vector_storage (s), traits::matrix_storage (u), traits::leading_dimension (u), traits::matrix_storage (vt), traits::leading_dimension (vt), - traits::vector_storage (w), - traits::vector_size (w), - 0, // dummy argument - traits::vector_storage (iw), + traits::vector_storage (w), + traits::vector_size (w), + 0, // dummy argument + traits::vector_storage (iw), &info); - return info; + return info; } - template <typename MatrA, typename VecS, typename MatrU, + template <typename MatrA, typename VecS, typename MatrU, typename MatrV, typename VecW, typename VecRW, typename VecIW> inline - int gesdd (char const jobz, MatrA& a, - VecS& s, MatrU& u, MatrV& vt, VecW& w, VecRW& rw, VecIW& iw) + int gesdd (char const jobz, MatrA& a, + VecS& s, MatrU& u, MatrV& vt, VecW& w, VecRW& rw, VecIW& iw) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrU>::matrix_structure, + typename traits::matrix_traits<MatrU>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrV>::matrix_structure, + typename traits::matrix_traits<MatrV>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - int const minmn = m < n ? m : n; + int const minmn = m < n ? m : n; - assert (minmn == traits::vector_size (s)); + assert (minmn == traits::vector_size (s)); assert ((jobz == 'N') || ((jobz == 'O' || jobz == 'A') && m >= n) - || ((jobz == 'O' || jobz == 'A') - && m < n + || ((jobz == 'O' || jobz == 'A') + && m < n && m == traits::matrix_size2 (u)) - || (jobz == 'S' && minmn == traits::matrix_size2 (u))); + || (jobz == 'S' && minmn == traits::matrix_size2 (u))); assert ((jobz == 'N' && traits::leading_dimension (u) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m >= n && traits::leading_dimension (u) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m < n && traits::leading_dimension (u) >= m) || (jobz == 'A' && traits::leading_dimension (u) >= m) || (jobz == 'S' && traits::leading_dimension (u) >= m)); - assert (n == traits::matrix_size2 (vt)); + assert (n == traits::matrix_size2 (vt)); assert ((jobz == 'N' && traits::leading_dimension (vt) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m < n && traits::leading_dimension (vt) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m >= n && traits::leading_dimension (vt) >= n) || (jobz == 'A' && traits::leading_dimension (vt) >= n) || (jobz == 'S' && traits::leading_dimension (vt) >= minmn)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif - assert (traits::vector_size (w) - >= detail::gesdd_min_work (val_t(), jobz, m, n)); - assert (traits::vector_size (rw) + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif + assert (traits::vector_size (w) + >= detail::gesdd_min_work (val_t(), jobz, m, n)); + assert (traits::vector_size (rw) >= detail::gesdd_rwork (val_t(), jobz, m, n)); - assert (traits::vector_size (iw) >= detail::gesdd_iwork (m, n)); + assert (traits::vector_size (iw) >= detail::gesdd_iwork (m, n)); - int info; - detail::gesdd (jobz, m, n, - traits::matrix_storage (a), + int info; + detail::gesdd (jobz, m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (s), + traits::vector_storage (s), traits::matrix_storage (u), traits::leading_dimension (u), traits::matrix_storage (vt), traits::leading_dimension (vt), - traits::vector_storage (w), - traits::vector_size (w), - traits::vector_storage (rw), - traits::vector_storage (iw), + traits::vector_storage (w), + traits::vector_size (w), + traits::vector_storage (rw), + traits::vector_storage (iw), &info); - return info; + return info; } template <typename MatrA, typename VecS, typename MatrU, typename MatrV> inline - int gesdd (char const opt, char const jobz, - MatrA& a, VecS& s, MatrU& u, MatrV& vt) + int gesdd (char const opt, char const jobz, + MatrA& a, VecS& s, MatrU& u, MatrV& vt) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrU>::matrix_structure, + typename traits::matrix_traits<MatrU>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrV>::matrix_structure, + typename traits::matrix_traits<MatrV>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); #ifndef NDEBUG - int const minmn = m < n ? m : n; + int const minmn = m < n ? m : n; #endif // NDEBUG - assert (minmn == traits::vector_size (s)); + assert (minmn == traits::vector_size (s)); assert ((jobz == 'N') || ((jobz == 'O' || jobz == 'A') && m >= n) - || ((jobz == 'O' || jobz == 'A') - && m < n + || ((jobz == 'O' || jobz == 'A') + && m < n && m == traits::matrix_size2 (u)) - || (jobz == 'S' && minmn == traits::matrix_size2 (u))); + || (jobz == 'S' && minmn == traits::matrix_size2 (u))); assert ((jobz == 'N' && traits::leading_dimension (u) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m >= n && traits::leading_dimension (u) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m < n && traits::leading_dimension (u) >= m) || (jobz == 'A' && traits::leading_dimension (u) >= m) || (jobz == 'S' && traits::leading_dimension (u) >= m)); - assert (n == traits::matrix_size2 (vt)); + assert (n == traits::matrix_size2 (vt)); assert ((jobz == 'N' && traits::leading_dimension (vt) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m < n && traits::leading_dimension (vt) >= 1) - || (jobz == 'O' + || (jobz == 'O' && m >= n && traits::leading_dimension (vt) >= n) || (jobz == 'A' && traits::leading_dimension (vt) >= n) || (jobz == 'S' && traits::leading_dimension (vt) >= minmn)); #ifdef BOOST_NUMERIC_BINDINGS_LAPACK_2 - assert (opt == 'M'); + assert (opt == 'M'); #else - assert (opt == 'M' || opt == 'O'); -#endif + assert (opt == 'M' || opt == 'O'); +#endif #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif typedef typename traits::type_traits<val_t>::real_type real_t; - int const lw = gesdd_work (opt, jobz, a); - traits::detail::array<val_t> w (lw); - if (!w.valid()) return -101; + int const lw = gesdd_work (opt, jobz, a); + traits::detail::array<val_t> w (lw); + if (!w.valid()) return -101; - int const lrw = gesdd_rwork (jobz, a); - traits::detail::array<real_t> rw (lrw); - if (!rw.valid()) return -102; + int const lrw = gesdd_rwork (jobz, a); + traits::detail::array<real_t> rw (lrw); + if (!rw.valid()) return -102; - int const liw = gesdd_iwork (a); - traits::detail::array<int> iw (liw); - if (!iw.valid()) return -103; + int const liw = gesdd_iwork (a); + traits::detail::array<int> iw (liw); + if (!iw.valid()) return -103; - int info; - detail::gesdd (jobz, m, n, - traits::matrix_storage (a), + int info; + detail::gesdd (jobz, m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (s), + traits::vector_storage (s), traits::matrix_storage (u), traits::leading_dimension (u), traits::matrix_storage (vt), traits::leading_dimension (vt), - traits::vector_storage (w), - lw, //traits::vector_size (w), - traits::vector_storage (rw), - traits::vector_storage (iw), + traits::vector_storage (w), + lw, //traits::vector_size (w), + traits::vector_storage (rw), + traits::vector_storage (iw), &info); - return info; + return info; } @@ -638,72 +638,72 @@ namespace boost { namespace numeric { namespace bindings { template <typename MatrA, typename VecS, typename MatrU, typename MatrV> inline int gesdd (char const jobz, MatrA& a, VecS& s, MatrU& u, MatrV& vt) { - return gesdd ('O', jobz, a, s, u, vt); + return gesdd ('O', jobz, a, s, u, vt); } template <typename MatrA, typename VecS, typename MatrU, typename MatrV> inline int gesdd (MatrA& a, VecS& s, MatrU& u, MatrV& vt) { - return gesdd ('O', 'S', a, s, u, vt); + return gesdd ('O', 'S', a, s, u, vt); } - template <typename MatrA, typename VecS> + template <typename MatrA, typename VecS> inline int gesdd (MatrA& a, VecS& s) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - int const minmn = m < n ? m : n; + int const minmn = m < n ? m : n; - assert (minmn == traits::vector_size (s)); + assert (minmn == traits::vector_size (s)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif typedef typename traits::type_traits<val_t>::real_type real_t; - int const lw = gesdd_work ('O', 'N', a); - traits::detail::array<val_t> w (lw); - if (!w.valid()) return -101; + int const lw = gesdd_work ('O', 'N', a); + traits::detail::array<val_t> w (lw); + if (!w.valid()) return -101; - int const lrw = gesdd_rwork ('N', a); - traits::detail::array<real_t> rw (lrw); - if (!rw.valid()) return -102; + int const lrw = gesdd_rwork ('N', a); + traits::detail::array<real_t> rw (lrw); + if (!rw.valid()) return -102; - int const liw = gesdd_iwork (a); - traits::detail::array<int> iw (liw); - if (!iw.valid()) return -103; + int const liw = gesdd_iwork (a); + traits::detail::array<int> iw (liw); + if (!iw.valid()) return -103; - int info; - detail::gesdd ('N', m, n, - traits::matrix_storage (a), + int info; + detail::gesdd ('N', m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (s), + traits::vector_storage (s), 0, // traits::matrix_storage (u), 1, // traits::leading_dimension (u), 0, // traits::matrix_storage (vt), 1, // traits::leading_dimension (vt), - traits::vector_storage (w), - traits::vector_size (w), - traits::vector_storage (rw), - traits::vector_storage (iw), + traits::vector_storage (w), + traits::vector_size (w), + traits::vector_storage (rw), + traits::vector_storage (iw), &info); - return info; + return info; } -#endif +#endif } // namespace lapack }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesv.hpp index 7db880cfbfb3b51d77ac1802a898620cd2fee369..912394d4f1e6ec895a3d121530f5a82ce08a5d77 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesv.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -22,71 +22,71 @@ #include <boost/numeric/bindings/lapack/ilaenv.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // general system of linear equations A * X = B - // + // /////////////////////////////////////////////////////////////////// - /* - * gesv() computes the solution to a system of linear equations - * A * X = B, where A is an N-by-N matrix and X and B are N-by-NRHS + /* + * gesv() computes the solution to a system of linear equations + * A * X = B, where A is an N-by-N matrix and X and B are N-by-NRHS * matrices. * - * The LU decomposition with partial pivoting and row interchanges - * is used to factor A as A = P * L * U, where P is a permutation - * matrix, L is unit lower triangular, and U is upper triangular. - * The factored form of A is then used to solve the system of + * The LU decomposition with partial pivoting and row interchanges + * is used to factor A as A = P * L * U, where P is a permutation + * matrix, L is unit lower triangular, and U is upper triangular. + * The factored form of A is then used to solve the system of * equations A * X = B. - */ + */ namespace detail { - inline + inline void gesv (int const n, int const nrhs, - float* a, int const lda, int* ipiv, - float* b, int const ldb, int* info) + float* a, int const lda, int* ipiv, + float* b, int const ldb, int* info) { LAPACK_SGESV (&n, &nrhs, a, &lda, ipiv, b, &ldb, info); } - inline + inline void gesv (int const n, int const nrhs, - double* a, int const lda, int* ipiv, - double* b, int const ldb, int* info) + double* a, int const lda, int* ipiv, + double* b, int const ldb, int* info) { LAPACK_DGESV (&n, &nrhs, a, &lda, ipiv, b, &ldb, info); } - inline + inline void gesv (int const n, int const nrhs, - traits::complex_f* a, int const lda, int* ipiv, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f* a, int const lda, int* ipiv, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CGESV (&n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_CGESV (&n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (b), &ldb, info); } - - inline + + inline void gesv (int const n, int const nrhs, - traits::complex_d* a, int const lda, int* ipiv, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d* a, int const lda, int* ipiv, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZGESV (&n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_ZGESV (&n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (b), &ldb, info); } @@ -96,88 +96,88 @@ namespace boost { namespace numeric { namespace bindings { inline int gesv (MatrA& a, IVec& ipiv, MatrB& b) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (ipiv)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (ipiv)); - int info; - detail::gesv (n, traits::matrix_size2 (b), - traits::matrix_storage (a), + int info; + detail::gesv (n, traits::matrix_size2 (b), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), traits::matrix_storage (b), traits::leading_dimension (b), &info); - return info; + return info; } template <typename MatrA, typename MatrB> inline int gesv (MatrA& a, MatrB& b) { - // with 'internal' pivot vector - - // gesv() errors: + // with 'internal' pivot vector + + // gesv() errors: // if (info == 0), successful // if (info < 0), the -info argument had an illegal value // -- we will use -101 if allocation fails - // if (info > 0), U(i-1,i-1) is exactly zero - int info = -101; - traits::detail::array<int> ipiv (traits::matrix_size1 (a)); - if (ipiv.valid()) - info = gesv (a, ipiv, b); - return info; + // if (info > 0), U(i-1,i-1) is exactly zero + int info = -101; + traits::detail::array<int> ipiv (traits::matrix_size1 (a)); + if (ipiv.valid()) + info = gesv (a, ipiv, b); + return info; } - /* - * getrf() computes an LU factorization of a general M-by-N matrix A - * using partial pivoting with row interchanges. The factorization - * has the form A = P * L * U, where P is a permutation matrix, + /* + * getrf() computes an LU factorization of a general M-by-N matrix A + * using partial pivoting with row interchanges. The factorization + * has the form A = P * L * U, where P is a permutation matrix, * L is lower triangular with unit diagonal elements (lower - * trapezoidal if M > N), and U is upper triangular (upper + * trapezoidal if M > N), and U is upper triangular (upper * trapezoidal if M < N). - */ + */ namespace detail { - inline + inline void getrf (int const n, int const m, - float* a, int const lda, int* ipiv, int* info) + float* a, int const lda, int* ipiv, int* info) { LAPACK_SGETRF (&n, &m, a, &lda, ipiv, info); } - inline + inline void getrf (int const n, int const m, - double* a, int const lda, int* ipiv, int* info) + double* a, int const lda, int* ipiv, int* info) { LAPACK_DGETRF (&n, &m, a, &lda, ipiv, info); } - inline + inline void getrf (int const n, int const m, - traits::complex_f* a, int const - lda, int* ipiv, int* info) + traits::complex_f* a, int const + lda, int* ipiv, int* info) { LAPACK_CGETRF (&n, &m, traits::complex_ptr (a), &lda, ipiv, info); } - inline + inline void getrf (int const n, int const m, - traits::complex_d* a, int const lda, - int* ipiv, int* info) + traits::complex_d* a, int const lda, + int* ipiv, int* info) { LAPACK_ZGETRF (&n, &m, traits::complex_ptr (a), &lda, ipiv, info); } @@ -188,70 +188,70 @@ namespace boost { namespace numeric { namespace bindings { inline int getrf (MatrA& a, IVec& ipiv) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - int const m = traits::matrix_size2 (a); + int const m = traits::matrix_size2 (a); assert (traits::vector_size (ipiv) == (m < n ? m : n)); - int info; - detail::getrf (n, m, - traits::matrix_storage (a), + int info; + detail::getrf (n, m, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), &info); - return info; + return info; } /* - * getrs() solves a system of linear equations A * X = B - * or A^T * X = B with a general N-by-N matrix A using + * getrs() solves a system of linear equations A * X = B + * or A^T * X = B with a general N-by-N matrix A using * the LU factorization computed by getrf(). */ namespace detail { - inline + inline void getrs (char const trans, int const n, int const nrhs, - float const* a, int const lda, int const* ipiv, - float* b, int const ldb, int* info) + float const* a, int const lda, int const* ipiv, + float* b, int const ldb, int* info) { LAPACK_SGETRS (&trans, &n, &nrhs, a, &lda, ipiv, b, &ldb, info); } - inline + inline void getrs (char const trans, int const n, int const nrhs, - double const* a, int const lda, int const* ipiv, - double* b, int const ldb, int* info) + double const* a, int const lda, int const* ipiv, + double* b, int const ldb, int* info) { LAPACK_DGETRS (&trans, &n, &nrhs, a, &lda, ipiv, b, &ldb, info); } - inline + inline void getrs (char const trans, int const n, int const nrhs, - traits::complex_f const* a, int const lda, - int const* ipiv, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f const* a, int const lda, + int const* ipiv, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CGETRS (&trans, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_CGETRS (&trans, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (b), &ldb, info); } - inline + inline void getrs (char const trans, int const n, int const nrhs, - traits::complex_d const* a, int const lda, - int const* ipiv, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d const* a, int const lda, + int const* ipiv, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZGETRS (&trans, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_ZGETRS (&trans, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (b), &ldb, info); } @@ -259,127 +259,127 @@ namespace boost { namespace numeric { namespace bindings { template <typename MatrA, typename MatrB, typename IVec> inline - int getrs (char const trans, MatrA const& a, IVec const& ipiv, MatrB& b) + int getrs (char const trans, MatrA const& a, IVec const& ipiv, MatrB& b) { - assert (trans == 'N' || trans == 'T' || trans == 'C'); + assert (trans == 'N' || trans == 'T' || trans == 'C'); -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (ipiv)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (ipiv)); - int info; - detail::getrs (trans, n, traits::matrix_size2 (b), + int info; + detail::getrs (trans, n, traits::matrix_size2 (b), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), #else - traits::vector_storage_const (ipiv), + traits::vector_storage_const (ipiv), #endif traits::matrix_storage (b), traits::leading_dimension (b), &info); - return info; + return info; } template <typename MatrA, typename MatrB, typename IVec> inline int getrs (MatrA const& a, IVec const& ipiv, MatrB& b) { - char const no_transpose = 'N'; - return getrs (no_transpose, a, ipiv, b); + char const no_transpose = 'N'; + return getrs (no_transpose, a, ipiv, b); } /* - * getri() computes the inverse of a matrix using + * getri() computes the inverse of a matrix using * the LU factorization computed by getrf(). */ namespace detail { - inline - void getri (int const n, float* a, int const lda, int const* ipiv, - float* work, int const lwork, int* info) + inline + void getri (int const n, float* a, int const lda, int const* ipiv, + float* work, int const lwork, int* info) { LAPACK_SGETRI (&n, a, &lda, ipiv, work, &lwork, info); } - inline - void getri (int const n, double* a, int const lda, int const* ipiv, - double* work, int const lwork, int* info) + inline + void getri (int const n, double* a, int const lda, int const* ipiv, + double* work, int const lwork, int* info) { LAPACK_DGETRI (&n, a, &lda, ipiv, work, &lwork, info); } - inline - void getri (int const n, traits::complex_f* a, int const lda, - int const* ipiv, traits::complex_f* work, int const lwork, - int* info) + inline + void getri (int const n, traits::complex_f* a, int const lda, + int const* ipiv, traits::complex_f* work, int const lwork, + int* info) { - LAPACK_CGETRI (&n, traits::complex_ptr (a), &lda, ipiv, + LAPACK_CGETRI (&n, traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (work), &lwork, info); } - inline - void getri (int const n, traits::complex_d* a, int const lda, - int const* ipiv, traits::complex_d* work, int const lwork, - int* info) + inline + void getri (int const n, traits::complex_d* a, int const lda, + int const* ipiv, traits::complex_d* work, int const lwork, + int* info) { - LAPACK_ZGETRI (&n, traits::complex_ptr (a), &lda, ipiv, + LAPACK_ZGETRI (&n, traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (work), &lwork, info); } - - + + template <typename MatrA, typename IVec, typename Work> inline - int getri (MatrA& a, IVec const& ipiv, Work& work) + int getri (MatrA& a, IVec const& ipiv, Work& work) { - #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK + #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); - #endif + >::value)); + #endif int const n = traits::matrix_size1 (a); assert (n > 0); - assert (n <= traits::leading_dimension (a)); + assert (n <= traits::leading_dimension (a)); assert (n == traits::matrix_size2 (a)); - assert (n == traits::vector_size (ipiv)); + assert (n == traits::vector_size (ipiv)); assert (n <= traits::vector_size (work)); //Minimal workspace size int info; //double* dummy = traits::matrix_storage (a); - detail::getri (n, traits::matrix_storage (a), + detail::getri (n, traits::matrix_storage (a), traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), #else - traits::vector_storage_const (ipiv), + traits::vector_storage_const (ipiv), #endif traits::vector_storage (work), traits::vector_size (work), &info); return info; } - - + + inline int getri_block(float) { @@ -406,7 +406,7 @@ namespace boost { namespace numeric { namespace bindings { } // namespace detail - + template <typename MatrA, typename IVec> inline int getri(MatrA& a, IVec& ipiv, minimal_workspace) @@ -418,7 +418,7 @@ namespace boost { namespace numeric { namespace bindings { return detail::getri(a, ipiv, work); - } + } // optimal workspace allocation @@ -449,7 +449,7 @@ namespace boost { namespace numeric { namespace bindings { int getri(MatrA& a, IVec& ipiv, Work& work) { return detail::getri(a, ipiv, work); - } + } } // namespace lapack @@ -458,4 +458,4 @@ namespace boost { namespace numeric { namespace bindings { -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesvd.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesvd.hpp index a40ab77c46081a0b784a65aa6b88ca8cc2b223c0..0bb01fdbc8a35d2727d8f32434d04ff3e84fef86 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesvd.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/gesvd.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -20,248 +20,248 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> #include <boost/numeric/bindings/traits/detail/utils.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // - // singular value decomposition - // + // singular value decomposition + // /////////////////////////////////////////////////////////////////// - /* - * (simple driver) - * gesvd() computes the singular value decomposition (SVD) of - * M-by-N matrix A, optionally computing the left and/or right + /* + * (simple driver) + * gesvd() computes the singular value decomposition (SVD) of + * M-by-N matrix A, optionally computing the left and/or right * singular vectors. The SVD is written * * A = U * S * V^T or A = U * S * V^H * * where S is an M-by-N matrix which is zero except for its min(m,n) - * diagonal elements, U is an M-by-M orthogonal/unitary matrix, and V + * diagonal elements, U is an M-by-M orthogonal/unitary matrix, and V * is an N-by-N orthogonal/unitary matrix. The diagonal elements of S - * are the singular values of A; they are real and non-negative, and - * are returned in descending order. The first min(m,n) columns of - * U and V are the left and right singular vectors of A. (Note that + * are the singular values of A; they are real and non-negative, and + * are returned in descending order. The first min(m,n) columns of + * U and V are the left and right singular vectors of A. (Note that * the routine returns V^T or V^H, not V. - */ + */ namespace detail { - inline - void gesvd (char const jobu, char const jobvt, - int const m, int const n, float* a, int const lda, - float* s, float* u, int const ldu, + inline + void gesvd (char const jobu, char const jobvt, + int const m, int const n, float* a, int const lda, + float* s, float* u, int const ldu, float* vt, int const ldvt, - float* work, int const lwork, float* /* dummy */, + float* work, int const lwork, float* /* dummy */, int* info) { - LAPACK_SGESVD (&jobu, &jobvt, &m, &n, a, &lda, - s, u, &ldu, vt, &ldvt, work, &lwork, info); + LAPACK_SGESVD (&jobu, &jobvt, &m, &n, a, &lda, + s, u, &ldu, vt, &ldvt, work, &lwork, info); } - inline - void gesvd (char const jobu, char const jobvt, - int const m, int const n, double* a, int const lda, - double* s, double* u, int const ldu, + inline + void gesvd (char const jobu, char const jobvt, + int const m, int const n, double* a, int const lda, + double* s, double* u, int const ldu, double* vt, int const ldvt, - double* work, int const lwork, double* /* dummy */, + double* work, int const lwork, double* /* dummy */, int* info) { - LAPACK_DGESVD (&jobu, &jobvt, &m, &n, a, &lda, - s, u, &ldu, vt, &ldvt, work, &lwork, info); + LAPACK_DGESVD (&jobu, &jobvt, &m, &n, a, &lda, + s, u, &ldu, vt, &ldvt, work, &lwork, info); } - inline - void gesvd (char const jobu, char const jobvt, - int const m, int const n, - traits::complex_f* a, int const lda, - float* s, traits::complex_f* u, int const ldu, + inline + void gesvd (char const jobu, char const jobvt, + int const m, int const n, + traits::complex_f* a, int const lda, + float* s, traits::complex_f* u, int const ldu, traits::complex_f* vt, int const ldvt, - traits::complex_f* work, int const lwork, + traits::complex_f* work, int const lwork, float* rwork, int* info) { - LAPACK_CGESVD (&jobu, &jobvt, &m, &n, - traits::complex_ptr (a), &lda, s, - traits::complex_ptr (u), &ldu, - traits::complex_ptr (vt), &ldvt, - traits::complex_ptr (work), &lwork, rwork, info); + LAPACK_CGESVD (&jobu, &jobvt, &m, &n, + traits::complex_ptr (a), &lda, s, + traits::complex_ptr (u), &ldu, + traits::complex_ptr (vt), &ldvt, + traits::complex_ptr (work), &lwork, rwork, info); } - inline - void gesvd (char const jobu, char const jobvt, - int const m, int const n, - traits::complex_d* a, int const lda, - double* s, traits::complex_d* u, int const ldu, + inline + void gesvd (char const jobu, char const jobvt, + int const m, int const n, + traits::complex_d* a, int const lda, + double* s, traits::complex_d* u, int const ldu, traits::complex_d* vt, int const ldvt, - traits::complex_d* work, int const lwork, + traits::complex_d* work, int const lwork, double* rwork, int* info) { - LAPACK_ZGESVD (&jobu, &jobvt, &m, &n, - traits::complex_ptr (a), &lda, s, - traits::complex_ptr (u), &ldu, - traits::complex_ptr (vt), &ldvt, - traits::complex_ptr (work), &lwork, rwork, info); + LAPACK_ZGESVD (&jobu, &jobvt, &m, &n, + traits::complex_ptr (a), &lda, s, + traits::complex_ptr (u), &ldu, + traits::complex_ptr (vt), &ldvt, + traits::complex_ptr (work), &lwork, rwork, info); } - inline + inline int gesvd_min_work (float, int m, int n) { - int minmn = m < n ? m : n; - int maxmn = m < n ? n : m; - int m3x = 3 * minmn + maxmn; - int m5 = 5 * minmn; - return m3x < m5 ? m5 : m3x; + int minmn = m < n ? m : n; + int maxmn = m < n ? n : m; + int m3x = 3 * minmn + maxmn; + int m5 = 5 * minmn; + return m3x < m5 ? m5 : m3x; } - inline + inline int gesvd_min_work (double, int m, int n) { - int minmn = m < n ? m : n; - int maxmn = m < n ? n : m; - int m3x = 3 * minmn + maxmn; - int m5 = 5 * minmn; - return m3x < m5 ? m5 : m3x; + int minmn = m < n ? m : n; + int maxmn = m < n ? n : m; + int m3x = 3 * minmn + maxmn; + int m5 = 5 * minmn; + return m3x < m5 ? m5 : m3x; } - inline + inline int gesvd_min_work (traits::complex_f, int m, int n) { - int minmn = m < n ? m : n; - int maxmn = m < n ? n : m; - return 2 * minmn + maxmn; + int minmn = m < n ? m : n; + int maxmn = m < n ? n : m; + return 2 * minmn + maxmn; } - inline + inline int gesvd_min_work (traits::complex_d, int m, int n) { - int minmn = m < n ? m : n; - int maxmn = m < n ? n : m; - return 2 * minmn + maxmn; + int minmn = m < n ? m : n; + int maxmn = m < n ? n : m; + return 2 * minmn + maxmn; } - inline + inline int gesvd_rwork (float, int, int) { return 1; } - inline + inline int gesvd_rwork (double, int, int) { return 1; } - inline + inline int gesvd_rwork (traits::complex_f, int m, int n) { return 5 * (m < n ? m : n); } - inline + inline int gesvd_rwork (traits::complex_d, int m, int n) { return 5 * (m < n ? m : n); } - } // detail + } // detail - template <typename MatrA> + template <typename MatrA> inline - int gesvd_work (char const q, - char const jobu, char const jobvt, MatrA const& a) + int gesvd_work (char const q, + char const jobu, char const jobvt, MatrA const& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif #ifdef BOOST_NUMERIC_BINDINGS_LAPACK_2 - assert (q == 'M'); + assert (q == 'M'); #else - assert (q == 'M' || q == 'O'); -#endif - assert (jobu == 'N' || jobu == 'O' || jobu == 'A' || jobu == 'S'); - assert (jobvt == 'N' || jobvt == 'O' || jobvt == 'A' || jobvt == 'S'); - assert (!(jobu == 'O' && jobvt == 'O')); + assert (q == 'M' || q == 'O'); +#endif + assert (jobu == 'N' || jobu == 'O' || jobu == 'A' || jobu == 'S'); + assert (jobvt == 'N' || jobvt == 'O' || jobvt == 'A' || jobvt == 'S'); + assert (!(jobu == 'O' && jobvt == 'O')); int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); - int lw = -13; + int lw = -13; #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif - if (q == 'M') + if (q == 'M') lw = detail::gesvd_min_work (val_t(), m, n); #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_2 - MatrA& a2 = const_cast<MatrA&> (a); + MatrA& a2 = const_cast<MatrA&> (a); if (q == 'O') { - // traits::detail::array<val_t> w (0); - val_t w; - int info; - detail::gesvd (jobu, jobvt, m, n, - traits::matrix_storage (a2), + // traits::detail::array<val_t> w (0); + val_t w; + int info; + detail::gesvd (jobu, jobvt, m, n, + traits::matrix_storage (a2), traits::leading_dimension (a2), - 0, // traits::vector_storage (s), + 0, // traits::vector_storage (s), 0, // traits::matrix_storage (u), m, // traits::leading_dimension (u), 0, // traits::matrix_storage (vt), n, // traits::leading_dimension (vt), - &w, // traits::vector_storage (w), - -1, // traits::vector_size (w), - 0, // traits::vector_storage (rw), + &w, // traits::vector_storage (w), + -1, // traits::vector_size (w), + 0, // traits::vector_storage (rw), &info); - assert (info == 0); - lw = traits::detail::to_int (w); // (w[0]); + assert (info == 0); + lw = traits::detail::to_int (w); // (w[0]); } -#endif - - return lw; +#endif + + return lw; } - template <typename MatrA> + template <typename MatrA> inline int gesvd_rwork (MatrA const& a) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif - return detail::gesvd_rwork (val_t(), + return detail::gesvd_rwork (val_t(), traits::matrix_size1 (a), traits::matrix_size2 (a)); } - template <typename MatrA, typename VecS, + template <typename MatrA, typename VecS, typename MatrU, typename MatrV, typename VecW> inline - int gesvd (char const jobu, char const jobvt, - MatrA& a, VecS& s, MatrU& u, MatrV& vt, VecW& w) + int gesvd (char const jobu, char const jobvt, + MatrA& a, VecS& s, MatrU& u, MatrV& vt, VecW& w) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrU>::matrix_structure, + typename traits::matrix_traits<MatrU>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrV>::matrix_structure, + typename traits::matrix_traits<MatrV>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT( (boost::is_same< @@ -271,154 +271,154 @@ namespace boost { namespace numeric { namespace bindings { boost::is_same< typename traits::matrix_traits<MatrA>::value_type, double >::value)); -#endif +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); #ifndef NDEBUG /* this variable is only used in assertions below */ - int const minmn = m < n ? m : n; + int const minmn = m < n ? m : n; #endif - assert (minmn == traits::vector_size (s)); - assert (!(jobu == 'O' && jobvt == 'O')); + assert (minmn == traits::vector_size (s)); + assert (!(jobu == 'O' && jobvt == 'O')); assert ((jobu == 'N') || (jobu == 'O') || (jobu == 'A' && m == traits::matrix_size2 (u)) - || (jobu == 'S' && minmn == traits::matrix_size2 (u))); + || (jobu == 'S' && minmn == traits::matrix_size2 (u))); assert ((jobu == 'N' && traits::leading_dimension (u) >= 1) || (jobu == 'O' && traits::leading_dimension (u) >= 1) || (jobu == 'A' && traits::leading_dimension (u) >= m) || (jobu == 'S' && traits::leading_dimension (u) >= m)); - assert (n == traits::matrix_size2 (vt)); + assert (n == traits::matrix_size2 (vt)); assert ((jobvt == 'N' && traits::leading_dimension (vt) >= 1) || (jobvt == 'O' && traits::leading_dimension (vt) >= 1) || (jobvt == 'A' && traits::leading_dimension (vt) >= n) || (jobvt == 'S' && traits::leading_dimension (vt) >= minmn)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif - assert (traits::vector_size(w) >= detail::gesvd_min_work(val_t(),m,n)); - - int info; - detail::gesvd (jobu, jobvt, m, n, - traits::matrix_storage (a), + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif + assert (traits::vector_size(w) >= detail::gesvd_min_work(val_t(),m,n)); + + int info; + detail::gesvd (jobu, jobvt, m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (s), + traits::vector_storage (s), traits::matrix_storage (u), traits::leading_dimension (u), traits::matrix_storage (vt), traits::leading_dimension (vt), - traits::vector_storage (w), - traits::vector_size (w), - 0, // dummy argument + traits::vector_storage (w), + traits::vector_size (w), + 0, // dummy argument &info); - return info; + return info; } - template <typename MatrA, typename VecS, + template <typename MatrA, typename VecS, typename MatrU, typename MatrV, typename VecW, typename VecRW> inline - int gesvd (char const jobu, char const jobvt, - MatrA& a, VecS& s, MatrU& u, MatrV& vt, VecW& w, VecRW& rw) + int gesvd (char const jobu, char const jobvt, + MatrA& a, VecS& s, MatrU& u, MatrV& vt, VecW& w, VecRW& rw) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrU>::matrix_structure, + typename traits::matrix_traits<MatrU>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrV>::matrix_structure, + typename traits::matrix_traits<MatrV>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); #ifndef NDEBUG /* this variable is only used in assertions below */ - int const minmn = m < n ? m : n; + int const minmn = m < n ? m : n; #endif - assert (minmn == traits::vector_size (s)); - assert (!(jobu == 'O' && jobvt == 'O')); + assert (minmn == traits::vector_size (s)); + assert (!(jobu == 'O' && jobvt == 'O')); assert ((jobu == 'N') || (jobu == 'O') || (jobu == 'A' && m == traits::matrix_size2 (u)) - || (jobu == 'S' && minmn == traits::matrix_size2 (u))); + || (jobu == 'S' && minmn == traits::matrix_size2 (u))); assert ((jobu == 'N' && traits::leading_dimension (u) >= 1) || (jobu == 'O' && traits::leading_dimension (u) >= 1) || (jobu == 'A' && traits::leading_dimension (u) >= m) || (jobu == 'S' && traits::leading_dimension (u) >= m)); - assert (n == traits::matrix_size2 (vt)); + assert (n == traits::matrix_size2 (vt)); assert ((jobvt == 'N' && traits::leading_dimension (vt) >= 1) || (jobvt == 'O' && traits::leading_dimension (vt) >= 1) || (jobvt == 'A' && traits::leading_dimension (vt) >= n) || (jobvt == 'S' && traits::leading_dimension (vt) >= minmn)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif - assert (traits::vector_size(w) >= detail::gesvd_min_work(val_t(),m,n)); + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif + assert (traits::vector_size(w) >= detail::gesvd_min_work(val_t(),m,n)); assert (traits::vector_size(rw) >= detail::gesvd_rwork(val_t(),m,n)); - int info; - detail::gesvd (jobu, jobvt, m, n, - traits::matrix_storage (a), + int info; + detail::gesvd (jobu, jobvt, m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (s), + traits::vector_storage (s), traits::matrix_storage (u), traits::leading_dimension (u), traits::matrix_storage (vt), traits::leading_dimension (vt), - traits::vector_storage (w), - traits::vector_size (w), - traits::vector_storage (rw), + traits::vector_storage (w), + traits::vector_size (w), + traits::vector_storage (rw), &info); - return info; + return info; } template <typename MatrA, typename VecS, typename MatrU, typename MatrV> inline - int gesvd (char const opt, char const jobu, char const jobvt, - MatrA& a, VecS& s, MatrU& u, MatrV& vt) + int gesvd (char const opt, char const jobu, char const jobvt, + MatrA& a, VecS& s, MatrU& u, MatrV& vt) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrU>::matrix_structure, + typename traits::matrix_traits<MatrU>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrV>::matrix_structure, + typename traits::matrix_traits<MatrV>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); #ifndef NDEBUG /* this variable is only used in assertions below */ - int const minmn = m < n ? m : n; + int const minmn = m < n ? m : n; #endif - assert (minmn == traits::vector_size (s)); - assert (!(jobu == 'O' && jobvt == 'O')); + assert (minmn == traits::vector_size (s)); + assert (!(jobu == 'O' && jobvt == 'O')); assert ((jobu == 'N') || (jobu == 'O') || (jobu == 'A' && m == traits::matrix_size2 (u)) - || (jobu == 'S' && minmn == traits::matrix_size2 (u))); + || (jobu == 'S' && minmn == traits::matrix_size2 (u))); assert ((jobu == 'N' && traits::leading_dimension (u) >= 1) || (jobu == 'O' && traits::leading_dimension (u) >= 1) || (jobu == 'A' && traits::leading_dimension (u) >= m) @@ -430,40 +430,40 @@ namespace boost { namespace numeric { namespace bindings { || (jobvt == 'S' && traits::leading_dimension (vt) >= minmn)); #ifdef BOOST_NUMERIC_BINDINGS_LAPACK_2 - assert (opt == 'M'); + assert (opt == 'M'); #else - assert (opt == 'M' || opt == 'O'); -#endif + assert (opt == 'M' || opt == 'O'); +#endif #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif typedef typename traits::type_traits<val_t>::real_type real_t; - int const lw = gesvd_work (opt, jobu, jobvt, a); - traits::detail::array<val_t> w (lw); - if (!w.valid()) return -101; + int const lw = gesvd_work (opt, jobu, jobvt, a); + traits::detail::array<val_t> w (lw); + if (!w.valid()) return -101; - int const lrw = gesvd_rwork (a); - traits::detail::array<real_t> rw (lrw); - if (!rw.valid()) return -102; + int const lrw = gesvd_rwork (a); + traits::detail::array<real_t> rw (lrw); + if (!rw.valid()) return -102; - int info; - detail::gesvd (jobu, jobvt, m, n, - traits::matrix_storage (a), + int info; + detail::gesvd (jobu, jobvt, m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (s), + traits::vector_storage (s), traits::matrix_storage (u), traits::leading_dimension (u), traits::matrix_storage (vt), traits::leading_dimension (vt), - traits::vector_storage (w), - traits::vector_size (w), - traits::vector_storage (rw), + traits::vector_storage (w), + traits::vector_size (w), + traits::vector_storage (rw), &info); - return info; + return info; } @@ -471,72 +471,72 @@ namespace boost { namespace numeric { namespace bindings { template <typename MatrA, typename VecS, typename MatrU, typename MatrV> inline - int gesvd (char const jobu, char const jobvt, - MatrA& a, VecS& s, MatrU& u, MatrV& vt) + int gesvd (char const jobu, char const jobvt, + MatrA& a, VecS& s, MatrU& u, MatrV& vt) { - return gesvd ('O', jobu, jobvt, a, s, u, vt); + return gesvd ('O', jobu, jobvt, a, s, u, vt); } template <typename MatrA, typename VecS, typename MatrU, typename MatrV> inline int gesvd (MatrA& a, VecS& s, MatrU& u, MatrV& vt) { - return gesvd ('O', 'S', 'S', a, s, u, vt); + return gesvd ('O', 'S', 'S', a, s, u, vt); } - template <typename MatrA, typename VecS> + template <typename MatrA, typename VecS> inline int gesvd (MatrA& a, VecS& s) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrA>::matrix_structure, + typename traits::matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (a); int const n = traits::matrix_size2 (a); #ifndef NDEBUG /* this variable is only used in assertions below */ - int const minmn = m < n ? m : n; + int const minmn = m < n ? m : n; #endif - assert (minmn == traits::vector_size (s)); + assert (minmn == traits::vector_size (s)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<MatrA>::value_type val_t; -#else - typedef typename MatrA::value_type val_t; -#endif + typedef typename traits::matrix_traits<MatrA>::value_type val_t; +#else + typedef typename MatrA::value_type val_t; +#endif typedef typename traits::type_traits<val_t>::real_type real_t; - int const lw = gesvd_work ('O', 'N', 'N', a); - traits::detail::array<val_t> w (lw); - if (!w.valid()) return -101; + int const lw = gesvd_work ('O', 'N', 'N', a); + traits::detail::array<val_t> w (lw); + if (!w.valid()) return -101; - int const lrw = gesvd_rwork (a); - traits::detail::array<real_t> rw (lrw); - if (!rw.valid()) return -102; + int const lrw = gesvd_rwork (a); + traits::detail::array<real_t> rw (lrw); + if (!rw.valid()) return -102; - int info; - detail::gesvd ('N', 'N', m, n, - traits::matrix_storage (a), + int info; + detail::gesvd ('N', 'N', m, n, + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (s), + traits::vector_storage (s), 0, // traits::matrix_storage (u), 1, // traits::leading_dimension (u), 0, // traits::matrix_storage (vt), 1, // traits::leading_dimension (vt), - traits::vector_storage (w), - traits::vector_size (w), - traits::vector_storage (rw), + traits::vector_storage (w), + traits::vector_size (w), + traits::vector_storage (rw), &info); - return info; + return info; } -#endif +#endif } // namespace lapack }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hbev.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hbev.hpp index b4c1a84fcd0fe2676dfa98d2b4f4c5121cbb7aad..2851c3ae5220a2307b0d1748cf8e67ac440c6597 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hbev.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hbev.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -21,23 +21,23 @@ #include <boost/numeric/bindings/lapack/workspace.hpp> #include <boost/numeric/bindings/traits/detail/array.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Eigendecomposition of a banded Hermitian matrix. - // + // /////////////////////////////////////////////////////////////////// - /* + /* * hbev() computes the eigenvalues and optionally the associated * eigenvectors of a banded Hermitian matrix A. A matrix is Hermitian * when herm( A ) == A. When A is real, a Hermitian matrix is also @@ -71,13 +71,13 @@ namespace boost { namespace numeric { namespace bindings { * When uplo=='L', the (i,j) element with j>=i is in position (i-j) + j * (KD+1). * * The matrix A is thus a rectangular matrix with KD+1 rows and N columns. - */ + */ namespace detail { - inline + inline void hbev (char const jobz, char const uplo, int const n, int const kd, float* ab, int const ldab, float* w, float* z, int const ldz, - float* work, int& info) + float* work, int& info) { //for (int i=0; i<n*kd; ++i) std::cout << *(ab+i) << " " ; //std::cout << "\n" ; @@ -85,37 +85,37 @@ namespace boost { namespace numeric { namespace bindings { work, &info); } - inline + inline void hbev (char const jobz, char const uplo, int const n, int const kd, double* ab, int const ldab, double* w, double* z, int const ldz, - double* work, int& info) + double* work, int& info) { LAPACK_DSBEV (&jobz, &uplo, &n, &kd, ab, &ldab, w, z, &ldz, work, &info); } - inline + inline void hbev (char const jobz, char const uplo, int const n, int const kd, traits::complex_f* ab, int const ldab, float* w, traits::complex_f* z, int const ldz, - traits::complex_f* work, float* rwork, int& info) + traits::complex_f* work, float* rwork, int& info) { LAPACK_CHBEV (&jobz, &uplo, &n, &kd, traits::complex_ptr(ab), &ldab, w, traits::complex_ptr(z), &ldz, traits::complex_ptr(work), rwork, &info); } - inline + inline void hbev (char const jobz, char const uplo, int const n, int const kd, traits::complex_d* ab, int const ldab, double* w, traits::complex_d* z, int const ldz, - traits::complex_d* work, double* rwork, int& info) + traits::complex_d* work, double* rwork, int& info) { LAPACK_ZHBEV (&jobz, &uplo, &n, &kd, traits::complex_ptr(ab), &ldab, w, traits::complex_ptr(z), &ldz, traits::complex_ptr(work), rwork, &info); } - } + } namespace detail { @@ -204,7 +204,7 @@ namespace boost { namespace numeric { namespace bindings { info ); } }; // Hbev< 2 > - + /// Compute eigendecomposition of the banded Hermitian matrix ab. @@ -223,25 +223,25 @@ namespace boost { namespace numeric { namespace bindings { /// vector_size( rwork ) >= 3*matrix_size1( a )-2. template <typename AB, typename Z, typename W, typename Work> int hbev( char const jobz, AB& ab, W& w, Z& z, Work work ) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<AB>::matrix_structure, + typename traits::matrix_traits<AB>::matrix_structure, traits::hermitian_t - >::value)); -#endif + >::value)); +#endif typedef typename AB::value_type value_type ; int const n = traits::matrix_size2 (ab); - assert (n == traits::matrix_size1 (z)); + assert (n == traits::matrix_size1 (z)); assert (n == traits::vector_size (w)); assert ( jobz=='N' || jobz=='V' ); - int info ; + int info ; detail::Hbev< n_workspace_args<value_type>::value >() (jobz, traits::matrix_uplo_tag( ab ), n, traits::matrix_upper_bandwidth(ab), - traits::matrix_storage (ab), + traits::matrix_storage (ab), traits::leading_dimension (ab), traits::vector_storage (w), traits::matrix_storage (z), @@ -249,7 +249,7 @@ namespace boost { namespace numeric { namespace bindings { work, info); return info ; } // hbev() - + } // namespace detail @@ -266,12 +266,12 @@ namespace boost { namespace numeric { namespace bindings { inline int hbev (AB& ab, W& w, Z& z, Work work) { BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<Z>::matrix_structure, + typename traits::matrix_traits<Z>::matrix_structure, traits::general_t - >::value)); + >::value)); int const n = traits::matrix_size2 (ab); - assert (n == traits::matrix_size1 (z)); - assert (n == traits::matrix_size2 (z)); + assert (n == traits::matrix_size1 (z)); + assert (n == traits::matrix_size2 (z)); return detail::hbev( 'V', ab, w, z, work ); } // hbev() @@ -279,4 +279,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hbevx.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hbevx.hpp index 6c0850577b46465a4fa2513727d655c1a5f9dc37..bfb595749cf78b3bd8d7a50674cc3ca3f1c5b390 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hbevx.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hbevx.hpp @@ -1,5 +1,5 @@ /* - * + * * Copyright Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * Copyright Thomas Klimpel 2008 * @@ -7,7 +7,7 @@ * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -22,23 +22,23 @@ #include <boost/numeric/bindings/lapack/workspace.hpp> #include <boost/numeric/bindings/traits/detail/array.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Eigendecomposition of a banded Hermitian matrix. - // + // /////////////////////////////////////////////////////////////////// - /* + /* * hbevx() computes the eigenvalues and optionally the associated * eigenvectors of a banded Hermitian matrix A. A matrix is Hermitian * when herm( A ) == A. When A is real, a Hermitian matrix is also @@ -61,17 +61,17 @@ namespace boost { namespace numeric { namespace bindings { * When uplo=='L', the (i,j) element with j>=i is in position (i-j) + j * (KD+1). * * The matrix A is thus a rectangular matrix with KD+1 rows and N columns. - */ + */ namespace detail { - inline + inline void hbevx ( char const jobz, char const range, char const uplo, int const n, int const kd, float* ab, int const ldab, float* q, int const ldq, float const vl, float const vu, int const il, int const iu, float const abstol, int& m, float* w, float* z, int const ldz, - float* work, int* iwork, int* ifail, int& info) + float* work, int* iwork, int* ifail, int& info) { LAPACK_SSBEVX ( &jobz, &range, &uplo, &n, &kd, ab, &ldab, q, &ldq, @@ -80,14 +80,14 @@ namespace boost { namespace numeric { namespace bindings { work, iwork, ifail, &info); } - inline + inline void hbevx ( char const jobz, char const range, char const uplo, int const n, int const kd, double* ab, int const ldab, double* q, int const ldq, double const vl, double const vu, int const il, int const iu, double const abstol, int& m, double* w, double* z, int const ldz, - double* work, int* iwork, int* ifail, int& info) + double* work, int* iwork, int* ifail, int& info) { LAPACK_DSBEVX ( &jobz, &range, &uplo, &n, &kd, ab, &ldab, q, &ldq, @@ -96,14 +96,14 @@ namespace boost { namespace numeric { namespace bindings { work, iwork, ifail, &info); } - inline + inline void hbevx ( char const jobz, char const range, char const uplo, int const n, int const kd, traits::complex_f* ab, int const ldab, traits::complex_f* q, int const ldq, float const vl, float const vu, int const il, int const iu, float const abstol, int& m, float* w, traits::complex_f* z, int const ldz, - traits::complex_f* work, float* rwork, int* iwork, int* ifail, int& info) + traits::complex_f* work, float* rwork, int* iwork, int* ifail, int& info) { LAPACK_CHBEVX ( &jobz, &range, &uplo, &n, &kd, traits::complex_ptr(ab), &ldab, @@ -113,14 +113,14 @@ namespace boost { namespace numeric { namespace bindings { traits::complex_ptr(work), rwork, iwork, ifail, &info); } - inline + inline void hbevx ( char const jobz, char const range, char const uplo, int const n, int const kd, traits::complex_d* ab, int const ldab, traits::complex_d* q, int const ldq, double const vl, double const vu, int const il, int const iu, double const abstol, int& m, double* w, traits::complex_d* z, int const ldz, - traits::complex_d* work, double* rwork, int* iwork, int* ifail, int& info) + traits::complex_d* work, double* rwork, int* iwork, int* ifail, int& info) { LAPACK_ZHBEVX ( &jobz, &range, &uplo, &n, &kd, traits::complex_ptr(ab), &ldab, @@ -129,7 +129,7 @@ namespace boost { namespace numeric { namespace bindings { w, traits::complex_ptr(z), &ldz, traits::complex_ptr(work), rwork, iwork, ifail, &info); } - } + } namespace detail { @@ -260,28 +260,28 @@ namespace boost { namespace numeric { namespace bindings { template <typename AB, typename Q, typename R, typename Z, typename W, typename IFail, typename Work> int hbevx( char const jobz, char const range, AB& ab, Q& q, R vl, R vu, int il, int iu, R abstol, int& m, W& w, Z& z, IFail& ifail, Work work ) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<AB>::matrix_structure, + typename traits::matrix_traits<AB>::matrix_structure, traits::hermitian_t - >::value)); -#endif + >::value)); +#endif typedef typename AB::value_type value_type ; int const n = traits::matrix_size2 (ab); - assert (n == traits::matrix_size1 (z)); + assert (n == traits::matrix_size1 (z)); assert (n == traits::vector_size (w)); assert (n == traits::vector_size (ifail)); assert ( jobz=='N' || jobz=='V' ); - int info ; + int info ; detail::Hbevx< n_workspace_args<value_type>::value >() (jobz, range, traits::matrix_uplo_tag( ab ), n, traits::matrix_upper_bandwidth(ab), - traits::matrix_storage (ab), + traits::matrix_storage (ab), traits::leading_dimension (ab), - traits::matrix_storage (q), + traits::matrix_storage (q), traits::leading_dimension (q), vl, vu, il, iu, abstol, m, traits::vector_storage (w), diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heev.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heev.hpp index 8103aa4d41ee58d1f46ad1c52a0fbbdc8d2a4278..07cd5bf7c131192ae09309300362a2b58572795d 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heev.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heev.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -21,23 +21,23 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Eigendecomposition of a complex Hermitian matrix A = Q * D * Q' - // + // /////////////////////////////////////////////////////////////////// - /* + /* * heev() computes the eigendecomposition of a N x N matrix * A = Q * D * Q', where Q is a N x N unitary matrix and * D is a diagonal matrix. The diagonal element D(i,i) is an @@ -52,15 +52,15 @@ namespace boost { namespace numeric { namespace bindings { * 'N' : do not compute eigenvectors * uplo : 'U' : only the upper triangular part of A is used on input. * 'L' : only the lower triangular part of A is used on input. - */ + */ namespace detail { - inline + inline void heev (char const jobz, char const uplo, int const n, traits::complex_f* a, int const lda, float* w, traits::complex_f* work, int const lwork, - float* rwork, int& info) + float* rwork, int& info) { LAPACK_CHEEV (&jobz, &uplo, &n, traits::complex_ptr(a), &lda, w, @@ -68,11 +68,11 @@ namespace boost { namespace numeric { namespace bindings { rwork, &info); } - inline + inline void heev (char const jobz, char const uplo, int const n, traits::complex_d* a, int const lda, double* w, traits::complex_d* work, int const lwork, - double* rwork, int& info) + double* rwork, int& info) { LAPACK_ZHEEV (&jobz, &uplo, &n, traits::complex_ptr(a), &lda, w, @@ -85,31 +85,31 @@ namespace boost { namespace numeric { namespace bindings { inline int heev (char jobz, char uplo, A& a, W& w, Work& work, RWork& rwork) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); - assert (traits::matrix_size2 (a)==n); - assert (traits::vector_size (w)==n); - assert (2*n-1 <= traits::vector_size (work)); - assert (3*n-2 <= traits::vector_size (rwork)); + assert (traits::matrix_size2 (a)==n); + assert (traits::vector_size (w)==n); + assert (2*n-1 <= traits::vector_size (work)); + assert (3*n-2 <= traits::vector_size (rwork)); assert ( uplo=='U' || uplo=='L' ); assert ( jobz=='N' || jobz=='V' ); - int info; + int info; detail::heev (jobz, uplo, n, - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (w), + traits::vector_storage (w), traits::vector_storage (work), traits::vector_size (work), traits::vector_storage (rwork), info); - return info; + return info; } } // namespace detail @@ -157,4 +157,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heevd.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heevd.hpp index 8371acb7d46e71c313beda7829c5a83044aab635..ff9eb242a8166ab6c7c43f48e31ccb4ac8a503f3 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heevd.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heevd.hpp @@ -1,5 +1,5 @@ /* - * + * * Copyright Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * Copyright Thomas Klimpel 2008 * @@ -250,7 +250,7 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t >::value)); #endif @@ -261,7 +261,7 @@ namespace boost { namespace numeric { namespace bindings { assert ( uplo=='U' || uplo=='L' ); assert ( jobz=='N' || jobz=='V' ); - int info; + int info; detail::Heevd< n_workspace_args<typename A::value_type>::value >() ( jobz, uplo, n, traits::matrix_storage (a), diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heevx.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heevx.hpp index 87c7309c608bc322fc89cbbc8273ea4198c992b9..d005b3d7d3618a9bc0595e68caaef07062dc6d27 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heevx.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/heevx.hpp @@ -1,5 +1,5 @@ /* - * + * * Copyright Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * Copyright Thomas Klimpel 2008 * @@ -283,7 +283,7 @@ namespace boost { namespace numeric { namespace bindings { typedef typename A::value_type value_type ; typedef typename traits::type_traits< value_type >::real_type real_type ; BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::hermitian_t >::value || (boost::is_same< typename traits::matrix_traits<A>::matrix_structure, @@ -300,7 +300,7 @@ namespace boost { namespace numeric { namespace bindings { assert ( uplo=='U' || uplo=='L' ); assert ( jobz=='N' || jobz=='V' ); - int info; + int info; detail::Heevx< n_workspace_args<typename A::value_type>::value >() ( jobz, range, uplo, n, traits::matrix_storage (a), diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hegv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hegv.hpp index a4057bf91fa62867f79bc148cf4197dcb5f92fa7..3b072d653c3ab7c27757c41c95c43080b5ee62d8 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hegv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hegv.hpp @@ -15,25 +15,25 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // hegv - // + // /////////////////////////////////////////////////////////////////// - /* + /* * hegv() computes all the eigenvalues, and optionally, the eigenvectors * of a real generalized symmetric-definite eigenproblem, of the form * A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. @@ -117,38 +117,38 @@ namespace boost { namespace numeric { namespace bindings { * The factorization of B could not be completed and * no eigenvalues or eigenvectors were computed. * - */ + */ namespace detail { - inline - void hegv (int const itype, char const jobz, char const uplo, int const n, - float *a, int const lda, float *b, int const ldb, + inline + void hegv (int const itype, char const jobz, char const uplo, int const n, + float *a, int const lda, float *b, int const ldb, float *w, float *work, int const lwork, int& info) { LAPACK_SSYGV (&itype, &jobz, &uplo, &n, a, &lda, b, &ldb, w, work, &lwork, &info); } - inline - void hegv (int const itype, char const jobz, char const uplo, int const n, - double *a, int const lda, double *b, int const ldb, + inline + void hegv (int const itype, char const jobz, char const uplo, int const n, + double *a, int const lda, double *b, int const ldb, double *w, double *work, int const lwork, int& info) { LAPACK_DSYGV (&itype, &jobz, &uplo, &n, a, &lda, b, &ldb, w, work, &lwork, &info); } - inline - void hegv (int const itype, char const jobz, char const uplo, int const n, - traits::complex_f *a, int const lda, traits::complex_f *b, int const ldb, + inline + void hegv (int const itype, char const jobz, char const uplo, int const n, + traits::complex_f *a, int const lda, traits::complex_f *b, int const ldb, float *w, traits::complex_f *work, int const lwork, float *rwork, int& info) { LAPACK_CHEGV (&itype, &jobz, &uplo, &n, traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb, w, traits::complex_ptr(work), &lwork, rwork, &info); } - inline - void hegv (int const itype, char const jobz, char const uplo, int const n, - traits::complex_d *a, int const lda, traits::complex_d *b, int const ldb, + inline + void hegv (int const itype, char const jobz, char const uplo, int const n, + traits::complex_d *a, int const lda, traits::complex_d *b, int const ldb, double *w, traits::complex_d *work, int const lwork, double *rwork, int& info) { LAPACK_ZHEGV (&itype, &jobz, &uplo, &n, traits::complex_ptr(a), &lda, @@ -167,8 +167,8 @@ namespace boost { namespace numeric { namespace bindings { // Function that allocates work arrays template <typename T, typename R> void operator() ( - int const itype, char const jobz, char const uplo, int const n, - T *a, int const lda, T *b, int const ldb, + int const itype, char const jobz, char const uplo, int const n, + T *a, int const lda, T *b, int const ldb, R *w, optimal_workspace, int& info ) { traits::detail::array<T> work( std::max<int>(1,34*n) ); @@ -179,8 +179,8 @@ namespace boost { namespace numeric { namespace bindings { // Function that allocates work arrays template <typename T, typename R> void operator() ( - int const itype, char const jobz, char const uplo, int const n, - T *a, int const lda, T *b, int const ldb, + int const itype, char const jobz, char const uplo, int const n, + T *a, int const lda, T *b, int const ldb, R *w, minimal_workspace, int& info ) { traits::detail::array<T> work( std::max<int>(1,3*n-1) ); @@ -191,8 +191,8 @@ namespace boost { namespace numeric { namespace bindings { // Function that uses given workarrays template <typename T, typename R, typename W> void operator() ( - int const itype, char const jobz, char const uplo, int const n, - T *a, int const lda, T *b, int const ldb, + int const itype, char const jobz, char const uplo, int const n, + T *a, int const lda, T *b, int const ldb, R *w, detail::workspace1<W> work, int& info ) { assert (traits::vector_size (work.w_) >= 3*n-1); @@ -208,8 +208,8 @@ namespace boost { namespace numeric { namespace bindings { // Function that allocates work arrays template <typename T, typename R> void operator() ( - int const itype, char const jobz, char const uplo, int const n, - T *a, int const lda, T *b, int const ldb, + int const itype, char const jobz, char const uplo, int const n, + T *a, int const lda, T *b, int const ldb, R *w, optimal_workspace, int& info ) { traits::detail::array<T> work( std::max<int>(1,34*n) ); @@ -222,8 +222,8 @@ namespace boost { namespace numeric { namespace bindings { // Function that allocates work arrays template <typename T, typename R> void operator() ( - int const itype, char const jobz, char const uplo, int const n, - T *a, int const lda, T *b, int const ldb, + int const itype, char const jobz, char const uplo, int const n, + T *a, int const lda, T *b, int const ldb, R *w, minimal_workspace, int& info ) { traits::detail::array<T> work( std::max<int>(1,2*n-1) ); @@ -236,8 +236,8 @@ namespace boost { namespace numeric { namespace bindings { // Function that uses given workarrays template <typename T, typename R, typename WC, typename WR> void operator() ( - int const itype, char const jobz, char const uplo, int const n, - T *a, int const lda, T *b, int const ldb, + int const itype, char const jobz, char const uplo, int const n, + T *a, int const lda, T *b, int const ldb, R *w, detail::workspace2<WC,WR> work, int& info ) { assert (traits::vector_size (work.w_) >= 2*n-1); @@ -252,23 +252,23 @@ namespace boost { namespace numeric { namespace bindings { template <typename A, typename B, typename W, typename Work> int hegv (int itype, char jobz, char uplo, A& a, B& b, W& w, Work work = optimal_workspace()) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); assert ( n>0 ); - assert (traits::matrix_size2 (a)==n); - assert (traits::leading_dimension (a)>=n); - assert (traits::vector_size (w)==n); + assert (traits::matrix_size2 (a)==n); + assert (traits::leading_dimension (a)>=n); + assert (traits::vector_size (w)==n); int const nb = traits::matrix_size1 (b); assert ( nb>0 ); - assert (traits::matrix_size2 (b)==nb); - assert (traits::leading_dimension (b)>=nb); + assert (traits::matrix_size2 (b)==nb); + assert (traits::leading_dimension (b)>=nb); assert ( n== nb); assert ( uplo=='U' || uplo=='L' ); @@ -280,14 +280,14 @@ namespace boost { namespace numeric { namespace bindings { int info; detail::Hegv< n_workspace_args<typename A::value_type>::value >() ( itype, jobz, uplo, n, - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::matrix_storage (b), + traits::matrix_storage (b), traits::leading_dimension (b), - traits::vector_storage (w), + traits::vector_storage (w), work, info); - return info; + return info; } } diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hesv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hesv.hpp index 05e2cde38a40438fed6e056c5ec8ebe219bfb32b..7768c1f57b9f9c11dff6c54d3907ed3ff6352b8c 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hesv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hesv.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -20,15 +20,15 @@ #include <boost/numeric/bindings/lapack/ilaenv.hpp> #include <boost/numeric/bindings/traits/detail/array.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { @@ -41,19 +41,19 @@ namespace boost { namespace numeric { namespace bindings { namespace detail { - inline - int hetrf_block (traits::complex_f, - int const ispec, char const ul, int const n) + inline + int hetrf_block (traits::complex_f, + int const ispec, char const ul, int const n) { - char ul2[2] = "x"; ul2[0] = ul; - return ilaenv (ispec, "CHETRF", ul2, n); + char ul2[2] = "x"; ul2[0] = ul; + return ilaenv (ispec, "CHETRF", ul2, n); } - inline - int hetrf_block (traits::complex_d, - int const ispec, char const ul, int const n) + inline + int hetrf_block (traits::complex_d, + int const ispec, char const ul, int const n) { - char ul2[2] = "x"; ul2[0] = ul; - return ilaenv (ispec, "ZHETRF", ul2, n); + char ul2[2] = "x"; ul2[0] = ul; + return ilaenv (ispec, "ZHETRF", ul2, n); } } @@ -65,23 +65,23 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::general_t >::value)); #endif - assert (q == 'O' || q == 'M'); - assert (ul == 'U' || ul == 'L'); + assert (q == 'O' || q == 'M'); + assert (ul == 'U' || ul == 'L'); - int n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + int n = traits::matrix_size1 (a); + assert (n == traits::matrix_size2 (a)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermA>::value_type val_t; -#else - typedef typename HermA::value_type val_t; -#endif - int ispec = (q == 'O' ? 1 : 2); - return detail::hetrf_block (val_t(), ispec, ul, n); + typedef typename traits::matrix_traits<HermA>::value_type val_t; +#else + typedef typename HermA::value_type val_t; +#endif + int ispec = (q == 'O' ? 1 : 2); + return detail::hetrf_block (val_t(), ispec, ul, n); } template <typename HermA> @@ -90,23 +90,23 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t >::value)); #endif - assert (q == 'O' || q == 'M'); + assert (q == 'O' || q == 'M'); char ul = traits::matrix_uplo_tag (a); - int n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + int n = traits::matrix_size1 (a); + assert (n == traits::matrix_size2 (a)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermA>::value_type val_t; -#else - typedef typename HermA::value_type val_t; -#endif - int ispec = (q == 'O' ? 1 : 2); - return detail::hetrf_block (val_t(), ispec, ul, n); + typedef typename traits::matrix_traits<HermA>::value_type val_t; +#else + typedef typename HermA::value_type val_t; +#endif + int ispec = (q == 'O' ? 1 : 2); + return detail::hetrf_block (val_t(), ispec, ul, n); } template <typename HermA> @@ -115,27 +115,27 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::general_t >::value)); #endif - assert (q == 'O' || q == 'M'); - assert (ul == 'U' || ul == 'L'); + assert (q == 'O' || q == 'M'); + assert (ul == 'U' || ul == 'L'); - int n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + int n = traits::matrix_size1 (a); + assert (n == traits::matrix_size2 (a)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermA>::value_type val_t; -#else - typedef typename HermA::value_type val_t; -#endif - int lw = -13; - if (q == 'M') + typedef typename traits::matrix_traits<HermA>::value_type val_t; +#else + typedef typename HermA::value_type val_t; +#endif + int lw = -13; + if (q == 'M') lw = 1; - if (q == 'O') - lw = n * detail::hetrf_block (val_t(), 1, ul, n); - return lw; + if (q == 'O') + lw = n * detail::hetrf_block (val_t(), 1, ul, n); + return lw; } template <typename HermA> @@ -144,34 +144,34 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t >::value)); #endif - assert (q == 'O' || q == 'M'); + assert (q == 'O' || q == 'M'); char ul = traits::matrix_uplo_tag (a); - int n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + int n = traits::matrix_size1 (a); + assert (n == traits::matrix_size2 (a)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermA>::value_type val_t; -#else - typedef typename HermA::value_type val_t; -#endif - int lw = -13; - if (q == 'M') + typedef typename traits::matrix_traits<HermA>::value_type val_t; +#else + typedef typename HermA::value_type val_t; +#endif + int lw = -13; + if (q == 'M') lw = 1; - if (q == 'O') - lw = n * detail::hetrf_block (val_t(), 1, ul, n); - return lw; + if (q == 'O') + lw = n * detail::hetrf_block (val_t(), 1, ul, n); + return lw; } template <typename HermA> inline int hesv_work (char const q, char const ul, HermA const& a) { - return hetrf_work (q, ul, a); + return hetrf_work (q, ul, a); } template <typename HermA> @@ -180,42 +180,42 @@ namespace boost { namespace numeric { namespace bindings { /* - * hesv() computes the solution to a system of linear equations - * A * X = B, where A is an N-by-N Hermitian matrix and X and B + * hesv() computes the solution to a system of linear equations + * A * X = B, where A is an N-by-N Hermitian matrix and X and B * are N-by-NRHS matrices. * * The diagonal pivoting method is used to factor A as - * A = U * D * U^H, if UPLO = 'U', + * A = U * D * U^H, if UPLO = 'U', * A = L * D * L^H, if UPLO = 'L', - * where U (or L) is a product of permutation and unit upper - * (lower) triangular matrices, and D is Hermitian and block - * diagonal with 1-by-1 and 2-by-2 diagonal blocks. The factored + * where U (or L) is a product of permutation and unit upper + * (lower) triangular matrices, and D is Hermitian and block + * diagonal with 1-by-1 and 2-by-2 diagonal blocks. The factored * form of A is then used to solve the system of equations A * X = B. */ namespace detail { - inline + inline void hesv (char const uplo, int const n, int const nrhs, - traits::complex_f* a, int const lda, int* ipiv, - traits::complex_f* b, int const ldb, - traits::complex_f* w, int const lw, int* info) + traits::complex_f* a, int const lda, int* ipiv, + traits::complex_f* b, int const ldb, + traits::complex_f* w, int const lw, int* info) { - LAPACK_CHESV (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, - traits::complex_ptr (b), &ldb, + LAPACK_CHESV (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, + traits::complex_ptr (b), &ldb, traits::complex_ptr (w), &lw, info); } - inline + inline void hesv (char const uplo, int const n, int const nrhs, - traits::complex_d* a, int const lda, int* ipiv, - traits::complex_d* b, int const ldb, - traits::complex_d* w, int const lw, int* info) + traits::complex_d* a, int const lda, int* ipiv, + traits::complex_d* b, int const ldb, + traits::complex_d* w, int const lw, int* info) { - LAPACK_ZHESV (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, - traits::complex_ptr (b), &ldb, + LAPACK_ZHESV (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, + traits::complex_ptr (b), &ldb, traits::complex_ptr (w), &lw, info); } @@ -224,21 +224,21 @@ namespace boost { namespace numeric { namespace bindings { int hesv (char const ul, HermA& a, IVec& i, MatrB& b, Work& w) { int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (i)); - int info; - hesv (ul, n, traits::matrix_size2 (b), - traits::matrix_storage (a), + int info; + hesv (ul, n, traits::matrix_size2 (b), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (i), + traits::vector_storage (i), traits::matrix_storage (b), traits::leading_dimension (b), - traits::vector_storage (w), - traits::vector_size (w), + traits::vector_storage (w), + traits::vector_size (w), &info); - return info; + return info; } } @@ -247,22 +247,22 @@ namespace boost { namespace numeric { namespace bindings { inline int hesv (char const ul, HermA& a, IVec& i, MatrB& b, Work& w) { - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - int const lw = traits::vector_size (w); - assert (lw >= 1); - return detail::hesv (ul, a, i, b, w); + int const lw = traits::vector_size (w); + assert (lw >= 1); + return detail::hesv (ul, a, i, b, w); } template <typename HermA, typename MatrB, typename IVec, typename Work> @@ -271,127 +271,127 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - int const lw = traits::vector_size (w); - assert (lw >= 1); + int const lw = traits::vector_size (w); + assert (lw >= 1); char uplo = traits::matrix_uplo_tag (a); - return detail::hesv (uplo, a, i, b, w); + return detail::hesv (uplo, a, i, b, w); } template <typename HermA, typename MatrB> inline int hesv (char const ul, HermA& a, MatrB& b) { - // with 'internal' pivot and work vectors + // with 'internal' pivot and work vectors - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - int const n = traits::matrix_size1 (a); - int info = -101; - traits::detail::array<int> i (n); + int const n = traits::matrix_size1 (a); + int info = -101; + traits::detail::array<int> i (n); if (i.valid()) { - info = -102; - int lw = hetrf_work ('O', ul, a); - assert (lw >= 1); // paranoia ? + info = -102; + int lw = hetrf_work ('O', ul, a); + assert (lw >= 1); // paranoia ? #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermA>::value_type val_t; -#else - typedef typename HermA::value_type val_t; -#endif - traits::detail::array<val_t> w (lw); - if (w.valid()) - info = detail::hesv (ul, a, i, b, w); + typedef typename traits::matrix_traits<HermA>::value_type val_t; +#else + typedef typename HermA::value_type val_t; +#endif + traits::detail::array<val_t> w (lw); + if (w.valid()) + info = detail::hesv (ul, a, i, b, w); } - return info; + return info; } template <typename HermA, typename MatrB> inline int hesv (HermA& a, MatrB& b) { - // with 'internal' pivot and work vectors + // with 'internal' pivot and work vectors #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - int const n = traits::matrix_size1 (a); + int const n = traits::matrix_size1 (a); char uplo = traits::matrix_uplo_tag (a); - int info = -101; - traits::detail::array<int> i (n); + int info = -101; + traits::detail::array<int> i (n); if (i.valid()) { - info = -102; - int lw = hetrf_work ('O', a); - assert (lw >= 1); // paranoia ? + info = -102; + int lw = hetrf_work ('O', a); + assert (lw >= 1); // paranoia ? #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermA>::value_type val_t; -#else - typedef typename HermA::value_type val_t; -#endif - traits::detail::array<val_t> w (lw); - w.resize (lw); - if (w.valid()) - info = detail::hesv (uplo, a, i, b, w); + typedef typename traits::matrix_traits<HermA>::value_type val_t; +#else + typedef typename HermA::value_type val_t; +#endif + traits::detail::array<val_t> w (lw); + w.resize (lw); + if (w.valid()) + info = detail::hesv (uplo, a, i, b, w); } - return info; + return info; } /* * hetrf() computes the factorization of a Hermitian matrix A using - * the Bunch-Kaufman diagonal pivoting method. The form of the + * the Bunch-Kaufman diagonal pivoting method. The form of the * factorization is * A = U * D * U^H or A = L * D * L^H - * where U (or L) is a product of permutation and unit upper (lower) - * triangular matrices, and D is Hermitian and block diagonal with + * where U (or L) is a product of permutation and unit upper (lower) + * triangular matrices, and D is Hermitian and block diagonal with * 1-by-1 and 2-by-2 diagonal blocks. */ namespace detail { - inline - void hetrf (char const uplo, int const n, - traits::complex_f* a, int const lda, int* ipiv, - traits::complex_f* w, int const lw, int* info) + inline + void hetrf (char const uplo, int const n, + traits::complex_f* a, int const lda, int* ipiv, + traits::complex_f* w, int const lw, int* info) { - LAPACK_CHETRF (&uplo, &n, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_CHETRF (&uplo, &n, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (w), &lw, info); } - inline - void hetrf (char const uplo, int const n, - traits::complex_d* a, int const lda, int* ipiv, - traits::complex_d* w, int const lw, int* info) + inline + void hetrf (char const uplo, int const n, + traits::complex_d* a, int const lda, int* ipiv, + traits::complex_d* w, int const lw, int* info) { - LAPACK_ZHETRF (&uplo, &n, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_ZHETRF (&uplo, &n, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (w), &lw, info); } @@ -400,17 +400,17 @@ namespace boost { namespace numeric { namespace bindings { int hetrf (char const ul, HermA& a, IVec& i, Work& w) { int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::vector_size (i)); - int info; - hetrf (ul, n, traits::matrix_storage (a), + int info; + hetrf (ul, n, traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (i), - traits::vector_storage (w), - traits::vector_size (w), + traits::vector_storage (i), + traits::vector_storage (w), + traits::vector_size (w), &info); - return info; + return info; } } @@ -419,18 +419,18 @@ namespace boost { namespace numeric { namespace bindings { inline int hetrf (char const ul, HermA& a, IVec& i, Work& w) { - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::general_t >::value)); #endif - int const lw = traits::vector_size (w); - assert (lw >= 1); - return detail::hetrf (ul, a, i, w); + int const lw = traits::vector_size (w); + assert (lw >= 1); + return detail::hetrf (ul, a, i, w); } template <typename HermA, typename IVec, typename Work> @@ -439,15 +439,15 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t >::value)); #endif - int const lw = traits::vector_size (w); - assert (lw >= 1); + int const lw = traits::vector_size (w); + assert (lw >= 1); char uplo = traits::matrix_uplo_tag (a); - return detail::hetrf (uplo, a, i, w); + return detail::hetrf (uplo, a, i, w); } template <typename HermA, typename Ivec> @@ -455,85 +455,85 @@ namespace boost { namespace numeric { namespace bindings { int hetrf (char const ul, HermA& a, Ivec& i) { // with 'internal' work vector - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::general_t >::value)); #endif - int info = -101; - int lw = hetrf_work ('O', ul, a); - assert (lw >= 1); // paranoia ? + int info = -101; + int lw = hetrf_work ('O', ul, a); + assert (lw >= 1); // paranoia ? #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermA>::value_type val_t; -#else - typedef typename HermA::value_type val_t; -#endif - traits::detail::array<val_t> w (lw); - if (w.valid()) - info = detail::hetrf (ul, a, i, w); - return info; + typedef typename traits::matrix_traits<HermA>::value_type val_t; +#else + typedef typename HermA::value_type val_t; +#endif + traits::detail::array<val_t> w (lw); + if (w.valid()) + info = detail::hetrf (ul, a, i, w); + return info; } template <typename HermA, typename Ivec> inline int hetrf (HermA& a, Ivec& i) { - // with 'internal' work vector + // with 'internal' work vector #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t >::value)); #endif char uplo = traits::matrix_uplo_tag (a); - int info = -101; - int lw = hetrf_work ('O', a); - assert (lw >= 1); // paranoia ? + int info = -101; + int lw = hetrf_work ('O', a); + assert (lw >= 1); // paranoia ? #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<HermA>::value_type val_t; -#else - typedef typename HermA::value_type val_t; -#endif - traits::detail::array<val_t> w (lw); - if (w.valid()) - info = detail::hetrf (uplo, a, i, w); - return info; + typedef typename traits::matrix_traits<HermA>::value_type val_t; +#else + typedef typename HermA::value_type val_t; +#endif + traits::detail::array<val_t> w (lw); + if (w.valid()) + info = detail::hetrf (uplo, a, i, w); + return info; } /* - * hetrs() solves a system of linear equations A*X = B with - * a Hermitian matrix A using the factorization + * hetrs() solves a system of linear equations A*X = B with + * a Hermitian matrix A using the factorization * A = U * D * U^H or A = L * D * L^H * computed by hetrf(). */ namespace detail { - inline + inline void hetrs (char const uplo, int const n, int const nrhs, - traits::complex_f const* a, int const lda, - int const* ipiv, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f const* a, int const lda, + int const* ipiv, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CHETRS (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_CHETRS (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (b), &ldb, info); } - inline + inline void hetrs (char const uplo, int const n, int const nrhs, - traits::complex_d const* a, int const lda, - int const* ipiv, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d const* a, int const lda, + int const* ipiv, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZHETRS (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_ZHETRS (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (b), &ldb, info); } @@ -542,26 +542,26 @@ namespace boost { namespace numeric { namespace bindings { int hetrs (char const ul, HermA const& a, IVec const& i, MatrB& b) { int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (i)); - int info; - hetrs (ul, n, traits::matrix_size2 (b), + int info; + hetrs (ul, n, traits::matrix_size2 (b), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (i), + traits::vector_storage (i), #else - traits::vector_storage_const (i), + traits::vector_storage_const (i), #endif traits::matrix_storage (b), traits::leading_dimension (b), &info); - return info; + return info; } } @@ -570,20 +570,20 @@ namespace boost { namespace numeric { namespace bindings { inline int hetrs (char const ul, HermA const& a, IVec const& i, MatrB& b) { - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - return detail::hetrs (ul, a, i, b); + return detail::hetrs (ul, a, i, b); } template <typename HermA, typename MatrB, typename IVec> @@ -592,17 +592,17 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif char uplo = traits::matrix_uplo_tag (a); - return detail::hetrs (uplo, a, i, b); + return detail::hetrs (uplo, a, i, b); } @@ -612,4 +612,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hpsv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hpsv.hpp index 2f3fced91b7144754d395a2a354f6155ece43671..88cb14452ecee38f1740076226c60549d20d628c 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hpsv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hpsv.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -19,57 +19,57 @@ #include <boost/numeric/bindings/lapack/lapack.h> #include <boost/numeric/bindings/traits/detail/array.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { ///////////////////////////////////////////////////////////////////// // // system of linear equations A * X = B - // with A Hermitian indefinite matrix stored in packed format + // with A Hermitian indefinite matrix stored in packed format // ///////////////////////////////////////////////////////////////////// /* - * hpsv() computes the solution to a system of linear equations + * hpsv() computes the solution to a system of linear equations * A * X = B, where A is an N-by-N Hermitian matrix in packed * storage and X and B are N-by-NRHS matrices. * * The diagonal pivoting method is used to factor A as - * A = U * D * U^H, if UPLO = 'U', + * A = U * D * U^H, if UPLO = 'U', * A = L * D * L^H, if UPLO = 'L', - * where U (or L) is a product of permutation and unit upper - * (lower) triangular matrices, and D is Hermitian and block - * diagonal with 1-by-1 and 2-by-2 diagonal blocks. The factored + * where U (or L) is a product of permutation and unit upper + * (lower) triangular matrices, and D is Hermitian and block + * diagonal with 1-by-1 and 2-by-2 diagonal blocks. The factored * form of A is then used to solve the system of equations A * X = B. */ namespace detail { - inline + inline void hpsv (char const uplo, int const n, int const nrhs, - traits::complex_f* ap, int* ipiv, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f* ap, int* ipiv, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CHPSV (&uplo, &n, &nrhs, - traits::complex_ptr (ap), ipiv, + LAPACK_CHPSV (&uplo, &n, &nrhs, + traits::complex_ptr (ap), ipiv, traits::complex_ptr (b), &ldb, info); } - inline + inline void hpsv (char const uplo, int const n, int const nrhs, - traits::complex_d* ap, int* ipiv, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d* ap, int* ipiv, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZHPSV (&uplo, &n, &nrhs, - traits::complex_ptr (ap), ipiv, + LAPACK_ZHPSV (&uplo, &n, &nrhs, + traits::complex_ptr (ap), ipiv, traits::complex_ptr (b), &ldb, info); } @@ -79,37 +79,37 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_packed_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); char uplo = traits::matrix_uplo_tag (a); - int info; - hpsv (uplo, n, traits::matrix_size2 (b), - traits::matrix_storage (a), - traits::vector_storage (i), + int info; + hpsv (uplo, n, traits::matrix_size2 (b), + traits::matrix_storage (a), + traits::vector_storage (i), traits::matrix_storage (b), traits::leading_dimension (b), &info); - return info; + return info; } } - template <typename HermA, typename MatrB, typename IVec> + template <typename HermA, typename MatrB, typename IVec> inline int hpsv (HermA& a, IVec& i, MatrB& b) { - assert (traits::matrix_size1 (a) == traits::vector_size (i)); - return detail::hpsv (a, i, b); + assert (traits::matrix_size1 (a) == traits::vector_size (i)); + return detail::hpsv (a, i, b); } template <typename HermA, typename MatrB> @@ -117,92 +117,92 @@ namespace boost { namespace numeric { namespace bindings { int hpsv (HermA& a, MatrB& b) { // with 'internal' pivot vector - int info = -101; - traits::detail::array<int> i (traits::matrix_size1 (a)); + int info = -101; + traits::detail::array<int> i (traits::matrix_size1 (a)); - if (i.valid()) - info = detail::hpsv (a, i, b); - return info; + if (i.valid()) + info = detail::hpsv (a, i, b); + return info; } /* - * hptrf() computes the factorization of a Hermitian matrix A - * in packed storage using the Bunch-Kaufman diagonal pivoting + * hptrf() computes the factorization of a Hermitian matrix A + * in packed storage using the Bunch-Kaufman diagonal pivoting * method. The form of the factorization is * A = U * D * U^H or A = L * D * L^H - * where U (or L) is a product of permutation and unit upper (lower) - * triangular matrices, and D is Hermitian and block diagonal with + * where U (or L) is a product of permutation and unit upper (lower) + * triangular matrices, and D is Hermitian and block diagonal with * 1-by-1 and 2-by-2 diagonal blocks. */ namespace detail { - inline - void hptrf (char const uplo, int const n, - traits::complex_f* ap, int* ipiv, int* info) + inline + void hptrf (char const uplo, int const n, + traits::complex_f* ap, int* ipiv, int* info) { LAPACK_CHPTRF (&uplo, &n, traits::complex_ptr (ap), ipiv, info); } - inline - void hptrf (char const uplo, int const n, - traits::complex_d* ap, int* ipiv, int* info) + inline + void hptrf (char const uplo, int const n, + traits::complex_d* ap, int* ipiv, int* info) { LAPACK_ZHPTRF (&uplo, &n, traits::complex_ptr (ap), ipiv, info); } } - template <typename HermA, typename IVec> + template <typename HermA, typename IVec> inline int hptrf (HermA& a, IVec& i) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_packed_t >::value)); #endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::vector_size (i)); char uplo = traits::matrix_uplo_tag (a); - int info; - detail::hptrf (uplo, n, traits::matrix_storage (a), + int info; + detail::hptrf (uplo, n, traits::matrix_storage (a), traits::vector_storage (i), &info); - return info; + return info; } /* - * hptrs() solves a system of linear equations A*X = B with - * a Hermitian matrix A in packed storage using the factorization + * hptrs() solves a system of linear equations A*X = B with + * a Hermitian matrix A in packed storage using the factorization * A = U * D * U^H or A = L * D * L^H * computed by hptrf(). */ namespace detail { - inline + inline void hptrs (char const uplo, int const n, int const nrhs, - traits::complex_f const* ap, int const* ipiv, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f const* ap, int const* ipiv, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CHPTRS (&uplo, &n, &nrhs, - traits::complex_ptr (ap), ipiv, + LAPACK_CHPTRS (&uplo, &n, &nrhs, + traits::complex_ptr (ap), ipiv, traits::complex_ptr (b), &ldb, info); } - inline + inline void hptrs (char const uplo, int const n, int const nrhs, - traits::complex_d const* ap, int const* ipiv, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d const* ap, int const* ipiv, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZHPTRS (&uplo, &n, &nrhs, - traits::complex_ptr (ap), ipiv, + LAPACK_ZHPTRS (&uplo, &n, &nrhs, + traits::complex_ptr (ap), ipiv, traits::complex_ptr (b), &ldb, info); } @@ -214,34 +214,34 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<HermA>::matrix_structure, + typename traits::matrix_traits<HermA>::matrix_structure, traits::hermitian_packed_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (i)); char uplo = traits::matrix_uplo_tag (a); - int info; - detail::hptrs (uplo, n, traits::matrix_size2 (b), + int info; + detail::hptrs (uplo, n, traits::matrix_size2 (b), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), - traits::vector_storage (i), + traits::matrix_storage (a), + traits::vector_storage (i), #else - traits::matrix_storage_const (a), - traits::vector_storage_const (i), -#endif + traits::matrix_storage_const (a), + traits::vector_storage_const (i), +#endif traits::matrix_storage (b), - traits::leading_dimension (b), + traits::leading_dimension (b), &info); - return info; + return info; } @@ -251,4 +251,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hseqr.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hseqr.hpp index 3a43b55d48e7a0cebe53920b29beb52f68d7fc62..ae5efd77812cbc4b719d8285f9e88d2466fc1f87 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hseqr.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/hseqr.hpp @@ -1,5 +1,5 @@ /* - * + * * Copyright Jeremy Conlin 2008 * * Distributed under the Boost Software License, Version 1.0. @@ -20,23 +20,23 @@ #include <boost/numeric/bindings/lapack/workspace.hpp> #include <boost/numeric/bindings/traits/detail/array.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Compute eigenvalues of an Hessenberg matrix, H. - // + // /////////////////////////////////////////////////////////////////// - /* + /* * hseqr() computes the eigenvalues of a Hessenberg matrix H * and, optionally, the matrices T and Z from the Schur decomposition * H = Z U Z**T, where U is an upper quasi-triangular matrix (the @@ -46,7 +46,7 @@ namespace boost { namespace numeric { namespace bindings { * matrix Q so that this routine can give the Schur factorization * of a matrix A which has been reduced to the Hessenberg form H * by the orthogonal matrix Q: A = Q*H*Q**T = (QZ)*U*(QZ)**T. - * + * * There are two forms of the hseqr function: * * int hseqr( const char job, A& H, W& w) @@ -67,18 +67,18 @@ namespace boost { namespace numeric { namespace bindings { * of Schur vectors of H is returned; * = 'V': Z must contain an orthogonal matrix Q on entry, and * the product Q*Z is returned. - * - * H is the Hessenberg matrix whose eigenpairs you're interested - * in. (input/output) On exit, if computation is successful and + * + * H is the Hessenberg matrix whose eigenpairs you're interested + * in. (input/output) On exit, if computation is successful and * job = 'S', then H contains the * upper quasi-triangular matrix U from the Schur decomposition * (the Schur form); 2-by-2 diagonal blocks (corresponding to * complex conjugate pairs of eigenvalues) are returned in * standard form, with H(i,i) = H(i+1,i+1) and - * H(i+1,i)*H(i,i+1) < 0. If computation is successful and - * job = 'E', the contents of H are unspecified on exit. + * H(i+1,i)*H(i,i+1) < 0. If computation is successful and + * job = 'E', the contents of H are unspecified on exit. * - * w (output) contains the computed eigenvalues of H which is the diagonal + * w (output) contains the computed eigenvalues of H which is the diagonal * of U. Must be a complex object. * * Z. (input/output) @@ -89,67 +89,67 @@ namespace boost { namespace numeric { namespace bindings { * N-by-N matrix Q, which is assumed to be equal to the unit * matrix . On exit, if computation is successful, Z contains Q*Z. * - */ + */ namespace detail { // float inline - int hseqr_backend(const char* job, const char* compz, const int* n, - const int ilo, const int ihi, float* H, const int ldH, + int hseqr_backend(const char* job, const char* compz, const int* n, + const int ilo, const int ihi, float* H, const int ldH, float* wr, float* wi, float* Z, const int ldz, float* work, const int* lwork){ int info; -// std::cout << "I'm inside lapack::detail::hseqr_backend for floats" +// std::cout << "I'm inside lapack::detail::hseqr_backend for floats" // << std::endl; - LAPACK_SHSEQR(job, compz, n, &ilo, &ihi, H, &ldH, wr, wi, + LAPACK_SHSEQR(job, compz, n, &ilo, &ihi, H, &ldH, wr, wi, Z, &ldz, work, lwork, &info); return info; } // double inline - int hseqr_backend(const char* job, const char* compz, const int* n, - const int ilo, const int ihi, double* H, const int ldH, + int hseqr_backend(const char* job, const char* compz, const int* n, + const int ilo, const int ihi, double* H, const int ldH, double* wr, double* wi, double* Z, const int ldz, double* work, const int* lwork){ int info; -// std::cout << "I'm inside lapack::detail::hseqr_backend for doubles" +// std::cout << "I'm inside lapack::detail::hseqr_backend for doubles" // << std::endl; - LAPACK_DHSEQR(job, compz, n, &ilo, &ihi, H, &ldH, wr, wi, + LAPACK_DHSEQR(job, compz, n, &ilo, &ihi, H, &ldH, wr, wi, Z, &ldz, work, lwork, &info); return info; } // complex<float> inline - int hseqr_backend(const char* job, const char* compz, int* n, - const int ilo, const int ihi, traits::complex_f* H, const int ldH, - traits::complex_f* w, traits::complex_f* Z, int ldz, + int hseqr_backend(const char* job, const char* compz, int* n, + const int ilo, const int ihi, traits::complex_f* H, const int ldH, + traits::complex_f* w, traits::complex_f* Z, int ldz, traits::complex_f* work, const int* lwork){ int info; -// std::cout << "I'm inside lapack::detail::hseqr_backend for complex<float>" +// std::cout << "I'm inside lapack::detail::hseqr_backend for complex<float>" // << std::endl; - LAPACK_CHSEQR(job, compz, n, &ilo, &ihi, - traits::complex_ptr(H), &ldH, - traits::complex_ptr(w), - traits::complex_ptr(Z), &ldz, + LAPACK_CHSEQR(job, compz, n, &ilo, &ihi, + traits::complex_ptr(H), &ldH, + traits::complex_ptr(w), + traits::complex_ptr(Z), &ldz, traits::complex_ptr(work), lwork, &info); return info; } // complex<double> inline - int hseqr_backend(const char* job, const char* compz, int* n, - const int ilo, const int ihi, traits::complex_d* H, const int ldH, - traits::complex_d* w, traits::complex_d* Z, int ldz, + int hseqr_backend(const char* job, const char* compz, int* n, + const int ilo, const int ihi, traits::complex_d* H, const int ldH, + traits::complex_d* w, traits::complex_d* Z, int ldz, traits::complex_d* work, const int* lwork){ int info; -// std::cout << "I'm inside lapack::detail::hseqr_backend for complex<double>" +// std::cout << "I'm inside lapack::detail::hseqr_backend for complex<double>" // << std::endl; - LAPACK_ZHSEQR(job, compz, n, &ilo, &ihi, - traits::complex_ptr(H), &ldH, - traits::complex_ptr(w), - traits::complex_ptr(Z), &ldz, + LAPACK_ZHSEQR(job, compz, n, &ilo, &ihi, + traits::complex_ptr(H), &ldH, + traits::complex_ptr(w), + traits::complex_ptr(Z), &ldz, traits::complex_ptr(work), lwork, &info); return info; } @@ -172,7 +172,7 @@ namespace boost { namespace numeric { namespace bindings { int lwork = -1; value_type work_temp; int result = detail::hseqr_backend(&job, &compz, &n, 1, n, - traits::matrix_storage(H), + traits::matrix_storage(H), traits::leading_dimension(H), wr.storage(), wi.storage(), traits::matrix_storage(Z), @@ -184,7 +184,7 @@ namespace boost { namespace numeric { namespace bindings { lwork = (int) work_temp; traits::detail::array<value_type> work(lwork); result = detail::hseqr_backend(&job, &compz, &n, 1, n, - traits::matrix_storage(H), + traits::matrix_storage(H), traits::leading_dimension(H), wr.storage(), wi.storage(), traits::matrix_storage(Z), @@ -212,7 +212,7 @@ namespace boost { namespace numeric { namespace bindings { value_type work_temp; int result = detail::hseqr_backend(&job, &compz, &n, 1, n, traits::matrix_storage(H), - traits::leading_dimension(H), + traits::leading_dimension(H), traits::vector_storage(w), traits::matrix_storage(Z), traits::leading_dimension(Z), &work_temp, &lwork); @@ -223,7 +223,7 @@ namespace boost { namespace numeric { namespace bindings { traits::detail::array<value_type> work(lwork); result = detail::hseqr_backend(&job, &compz, &n, 1, n, traits::matrix_storage(H), - traits::leading_dimension(H), + traits::leading_dimension(H), traits::vector_storage(w), traits::matrix_storage(Z), traits::leading_dimension(Z), work.storage(), &lwork); @@ -231,7 +231,7 @@ namespace boost { namespace numeric { namespace bindings { return result; } }; - + template < typename A, typename W, typename V> int hseqr( const char job, const char compz, A& H, W& w, V& Z ){ // std::cout << "I'm inside lapack::detail::hseqr." << std::endl; @@ -246,18 +246,18 @@ namespace boost { namespace numeric { namespace bindings { return result; } - } // namespace detail + } // namespace detail // Compute eigenvalues without the Schur vectors template < typename A, typename W> int hseqr( const char job, A& H, W& w){ // input checking -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif #ifndef NDEBUG int const n = traits::matrix_size1(H); @@ -267,7 +267,7 @@ namespace boost { namespace numeric { namespace bindings { typedef typename W::value_type complex_value_type; assert(traits::matrix_size2(H) == n); // Square matrix - assert(traits::vector_size(w) == n); + assert(traits::vector_size(w) == n); ublas::matrix<value_type, ublas::column_major> Z(1,1); return detail::hseqr( job, 'N', H, w, Z ); @@ -277,12 +277,12 @@ namespace boost { namespace numeric { namespace bindings { template < typename A, typename W, typename Z> int hseqr( const char job, const char compz, A& H, W& w, Z& z){ // input checking -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif #ifndef NDEBUG int const n = traits::matrix_size1(H); @@ -290,7 +290,7 @@ namespace boost { namespace numeric { namespace bindings { typedef typename A::value_type value_type; assert(traits::matrix_size2(H) == n); // Square matrix - assert(traits::vector_size(w) == n); + assert(traits::vector_size(w) == n); assert(traits::matrix_size2(z) == n); return detail::hseqr( job, compz, H, w, z ); diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ilaenv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ilaenv.hpp index 2c4d9c95bcd0a3470642974e1dc18c47b59cca28..0c0ae7a0c9038b82efba6cf40b7afc159c90d1b9 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ilaenv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ilaenv.hpp @@ -14,20 +14,20 @@ #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_ILAENV_HPP #define BOOST_NUMERIC_BINDINGS_LAPACK_ILAENV_HPP -#include <cstring> +#include <cstring> #include <boost/numeric/bindings/lapack/lapack.h> namespace boost { namespace numeric { namespace bindings { namespace lapack { /* - * ilaenv() is called from the LAPACK routines to choose - * problem-dependent parameters such as the block sizes + * ilaenv() is called from the LAPACK routines to choose + * problem-dependent parameters such as the block sizes * for the local environment. */ - + inline int ilaenv (int const ispec, const char* name, const char* opts, - int const n1 = -1, int const n2 = -1, + int const n1 = -1, int const n2 = -1, int const n3 = -1, int const n4 = -1) { return ::LAPACK_ILAENV (&ispec, name, opts, &n1, &n2, &n3, &n4, diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack.h b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack.h index 38d8e5f29f0bb424239ffd4e304296fab2f9b229..bb68ead4fe1721b434d48f845d60786075c7b7dd 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack.h +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack.h @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -17,9 +17,9 @@ #include <boost/numeric/bindings/traits/type.h> #include <boost/numeric/bindings/lapack/lapack_names.h> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # define BOOST_NUMERIC_BINDINGS_FORTRAN -#endif +#endif extern "C" { @@ -29,22 +29,22 @@ extern "C" { /* general */ - void LAPACK_SGESV (int const* n, int const* nrhs, - float* a, int const* lda, int* ipiv, + void LAPACK_SGESV (int const* n, int const* nrhs, + float* a, int const* lda, int* ipiv, float* b, int const* ldb, int* info); - void LAPACK_DGESV (int const* n, int const* nrhs, - double* a, int const* lda, int* ipiv, + void LAPACK_DGESV (int const* n, int const* nrhs, + double* a, int const* lda, int* ipiv, double* b, int const* ldb, int* info); void LAPACK_CGESV (int const* n, int const* nrhs, - fcomplex_t* a, int const* lda, int* ipiv, + fcomplex_t* a, int const* lda, int* ipiv, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZGESV (int const* n, int const* nrhs, - dcomplex_t* a, int const* lda, int* ipiv, + dcomplex_t* a, int const* lda, int* ipiv, dcomplex_t* b, int const* ldb, int* info); - void LAPACK_SGETRF (int const* n, int const* nrhs, + void LAPACK_SGETRF (int const* n, int const* nrhs, float* a, int const* lda, int* ipiv, int* info); - void LAPACK_DGETRF (int const* n, int const* nrhs, + void LAPACK_DGETRF (int const* n, int const* nrhs, double* a, int const* lda, int* ipiv, int* info); void LAPACK_CGETRF (int const* n, int const* nrhs, fcomplex_t* a, int const* lda, @@ -53,35 +53,35 @@ extern "C" { dcomplex_t* a, int const* lda, int* ipiv, int* info); - void LAPACK_SGETRS (char const* trans, int const* n, int const* nrhs, - float const* a, int const* lda, int const* ipiv, + void LAPACK_SGETRS (char const* trans, int const* n, int const* nrhs, + float const* a, int const* lda, int const* ipiv, float* b, int const* ldb, int* info); - void LAPACK_DGETRS (char const* trans, int const* n, int const* nrhs, - double const* a, int const* lda, int const* ipiv, + void LAPACK_DGETRS (char const* trans, int const* n, int const* nrhs, + double const* a, int const* lda, int const* ipiv, double* b, int const* ldb, int* info); void LAPACK_CGETRS (char const* trans, int const* n, int const* nrhs, - fcomplex_t const* a, int const* lda, int const* ipiv, + fcomplex_t const* a, int const* lda, int const* ipiv, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZGETRS (char const* trans, int const* n, int const* nrhs, - dcomplex_t const* a, int const* lda, int const* ipiv, + dcomplex_t const* a, int const* lda, int const* ipiv, dcomplex_t* b, int const* ldb, int* info); - void LAPACK_SGETRI (int const* n, float* a, int const* lda, int const* ipiv, + void LAPACK_SGETRI (int const* n, float* a, int const* lda, int const* ipiv, float* work, int const* lwork, int* info); - void LAPACK_DGETRI (int const* n, double* a, int const* lda, int const* ipiv, + void LAPACK_DGETRI (int const* n, double* a, int const* lda, int const* ipiv, double* work, int const* lwork, int* info); - void LAPACK_CGETRI (int const* n, fcomplex_t* a, int const* lda, int const* ipiv, + void LAPACK_CGETRI (int const* n, fcomplex_t* a, int const* lda, int const* ipiv, fcomplex_t* work, int const* lwork, int* info); - void LAPACK_ZGETRI (int const* n, dcomplex_t* a, int const* lda, int const* ipiv, + void LAPACK_ZGETRI (int const* n, dcomplex_t* a, int const* lda, int const* ipiv, dcomplex_t* work, int const* lwork, int* info); /* symmetric/Hermitian positive definite */ - void LAPACK_SPOSV (char const* uplo, int const* n, int const* nrhs, - float* a, int const* lda, + void LAPACK_SPOSV (char const* uplo, int const* n, int const* nrhs, + float* a, int const* lda, float* b, int const* ldb, int* info); - void LAPACK_DPOSV (char const* uplo, int const* n, int const* nrhs, - double* a, int const* lda, + void LAPACK_DPOSV (char const* uplo, int const* n, int const* nrhs, + double* a, int const* lda, double* b, int const* ldb, int* info); void LAPACK_CPOSV (char const* uplo, int const* n, int const* nrhs, fcomplex_t* a, int const* lda, @@ -90,20 +90,20 @@ extern "C" { dcomplex_t* a, int const* lda, dcomplex_t* b, int const* ldb, int* info); - void LAPACK_SPOTRF (char const* uplo, int const* n, + void LAPACK_SPOTRF (char const* uplo, int const* n, float* a, int const* lda, int* info); - void LAPACK_DPOTRF (char const* uplo, int const* n, + void LAPACK_DPOTRF (char const* uplo, int const* n, double* a, int const* lda, int* info); - void LAPACK_CPOTRF (char const* uplo, int const* n, + void LAPACK_CPOTRF (char const* uplo, int const* n, fcomplex_t* a, int const* lda, int* info); - void LAPACK_ZPOTRF (char const* uplo, int const* n, + void LAPACK_ZPOTRF (char const* uplo, int const* n, dcomplex_t* a, int const* lda, int* info); - void LAPACK_SPOTRS (char const* uplo, int const* n, int const* nrhs, - float const* a, int const* lda, + void LAPACK_SPOTRS (char const* uplo, int const* n, int const* nrhs, + float const* a, int const* lda, float* b, int const* ldb, int* info); - void LAPACK_DPOTRS (char const* uplo, int const* n, int const* nrhs, - double const* a, int const* lda, + void LAPACK_DPOTRS (char const* uplo, int const* n, int const* nrhs, + double const* a, int const* lda, double* b, int const* ldb, int* info); void LAPACK_CPOTRS (char const* uplo, int const* n, int const* nrhs, fcomplex_t const* a, int const* lda, @@ -115,9 +115,9 @@ extern "C" { /* symmetric/Hermitian positive definite in packed storage */ - void LAPACK_SPPSV (char const* uplo, int const* n, int const* nrhs, + void LAPACK_SPPSV (char const* uplo, int const* n, int const* nrhs, float* ap, float* b, int const* ldb, int* info); - void LAPACK_DPPSV (char const* uplo, int const* n, int const* nrhs, + void LAPACK_DPPSV (char const* uplo, int const* n, int const* nrhs, double* ap, double* b, int const* ldb, int* info); void LAPACK_CPPSV (char const* uplo, int const* n, int const* nrhs, fcomplex_t* ap, fcomplex_t* b, int const* ldb, int* info); @@ -126,27 +126,27 @@ extern "C" { void LAPACK_SPPTRF (char const* uplo, int const* n, float* ap, int* info); void LAPACK_DPPTRF (char const* uplo, int const* n, double* ap, int* info); - void LAPACK_CPPTRF (char const* uplo, int const* n, + void LAPACK_CPPTRF (char const* uplo, int const* n, fcomplex_t* ap, int* info); - void LAPACK_ZPPTRF (char const* uplo, int const* n, + void LAPACK_ZPPTRF (char const* uplo, int const* n, dcomplex_t* ap, int* info); - void LAPACK_SPPTRS (char const* uplo, int const* n, int const* nrhs, + void LAPACK_SPPTRS (char const* uplo, int const* n, int const* nrhs, float const* ap, float* b, int const* ldb, int* info); - void LAPACK_DPPTRS (char const* uplo, int const* n, int const* nrhs, + void LAPACK_DPPTRS (char const* uplo, int const* n, int const* nrhs, double const* ap, double* b, int const* ldb, int* info); void LAPACK_CPPTRS (char const* uplo, int const* n, int const* nrhs, - fcomplex_t const* ap, + fcomplex_t const* ap, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZPPTRS (char const* uplo, int const* n, int const* nrhs, - dcomplex_t const* ap, + dcomplex_t const* ap, dcomplex_t* b, int const* ldb, int* info); void LAPACK_SPPTRI (char const* uplo, int const* n, float* ap, int* info); void LAPACK_DPPTRI (char const* uplo, int const* n, double* ap, int* info); - void LAPACK_CPPTRI (char const* uplo, int const* n, + void LAPACK_CPPTRI (char const* uplo, int const* n, fcomplex_t* ap, int* info); - void LAPACK_ZPPTRI (char const* uplo, int const* n, + void LAPACK_ZPPTRI (char const* uplo, int const* n, dcomplex_t* ap, int* info); /* symmetric/Hermitian positive definite tridiagonal */ @@ -169,10 +169,10 @@ extern "C" { void LAPACK_CPTTRF ( int const* n, float* d, fcomplex_t* e, int* info); void LAPACK_ZPTTRF ( int const* n, double* d, dcomplex_t* e, int* info); - void LAPACK_SPTTRS ( int const* n, int const* nrhs, + void LAPACK_SPTTRS ( int const* n, int const* nrhs, float const* d, float const* e, float* b, int const* ldb, int* info); - void LAPACK_DPTTRS ( int const* n, int const* nrhs, + void LAPACK_DPTTRS ( int const* n, int const* nrhs, double const* d, double const* e, double* b, int const* ldb, int* info); void LAPACK_CPTTRS (char const* uplo, int const* n, int const* nrhs, @@ -186,149 +186,149 @@ extern "C" { /* symmetric/Hermitian indefinite and complex symmetric */ - void LAPACK_SSYSV (char const* uplo, int const* n, int const* nrhs, - float* a, int const* lda, int* ipiv, - float* b, int const* ldb, + void LAPACK_SSYSV (char const* uplo, int const* n, int const* nrhs, + float* a, int const* lda, int* ipiv, + float* b, int const* ldb, float* w, int const* lw, int* info); - void LAPACK_DSYSV (char const* uplo, int const* n, int const* nrhs, - double* a, int const* lda, int* ipiv, - double* b, int const* ldb, + void LAPACK_DSYSV (char const* uplo, int const* n, int const* nrhs, + double* a, int const* lda, int* ipiv, + double* b, int const* ldb, double* w, int const* lw, int* info); void LAPACK_CSYSV (char const* uplo, int const* n, int const* nrhs, - fcomplex_t* a, int const* lda, int* ipiv, - fcomplex_t* b, int const* ldb, + fcomplex_t* a, int const* lda, int* ipiv, + fcomplex_t* b, int const* ldb, fcomplex_t* w, int const* lw, int* info); void LAPACK_ZSYSV (char const* uplo, int const* n, int const* nrhs, - dcomplex_t* a, int const* lda, int* ipiv, - dcomplex_t* b, int const* ldb, + dcomplex_t* a, int const* lda, int* ipiv, + dcomplex_t* b, int const* ldb, dcomplex_t* w, int const* lw, int* info); void LAPACK_CHESV (char const* uplo, int const* n, int const* nrhs, - fcomplex_t* a, int const* lda, int* ipiv, - fcomplex_t* b, int const* ldb, + fcomplex_t* a, int const* lda, int* ipiv, + fcomplex_t* b, int const* ldb, fcomplex_t* w, int const* lw, int* info); void LAPACK_ZHESV (char const* uplo, int const* n, int const* nrhs, - dcomplex_t* a, int const* lda, int* ipiv, - dcomplex_t* b, int const* ldb, + dcomplex_t* a, int const* lda, int* ipiv, + dcomplex_t* b, int const* ldb, dcomplex_t* w, int const* lw, int* info); - void LAPACK_SSYTRF (char const* uplo, int const* n, - float* a, int const* lda, int* ipiv, + void LAPACK_SSYTRF (char const* uplo, int const* n, + float* a, int const* lda, int* ipiv, float* w, int const* lw, int* info); - void LAPACK_DSYTRF (char const* uplo, int const* n, - double* a, int const* lda, int* ipiv, + void LAPACK_DSYTRF (char const* uplo, int const* n, + double* a, int const* lda, int* ipiv, double* w, int const* lw, int* info); - void LAPACK_CSYTRF (char const* uplo, int const* n, - fcomplex_t* a, int const* lda, int* ipiv, + void LAPACK_CSYTRF (char const* uplo, int const* n, + fcomplex_t* a, int const* lda, int* ipiv, fcomplex_t* w, int const* lw, int* info); - void LAPACK_ZSYTRF (char const* uplo, int const* n, - dcomplex_t* a, int const* lda, int* ipiv, + void LAPACK_ZSYTRF (char const* uplo, int const* n, + dcomplex_t* a, int const* lda, int* ipiv, dcomplex_t* w, int const* lw, int* info); - void LAPACK_CHETRF (char const* uplo, int const* n, - fcomplex_t* a, int const* lda, int* ipiv, + void LAPACK_CHETRF (char const* uplo, int const* n, + fcomplex_t* a, int const* lda, int* ipiv, fcomplex_t* w, int const* lw, int* info); - void LAPACK_ZHETRF (char const* uplo, int const* n, - dcomplex_t* a, int const* lda, int* ipiv, + void LAPACK_ZHETRF (char const* uplo, int const* n, + dcomplex_t* a, int const* lda, int* ipiv, dcomplex_t* w, int const* lw, int* info); - void LAPACK_SSYTRS (char const* uplo, int const* n, int const* nrhs, - float const* a, int const* lda, int const* ipiv, + void LAPACK_SSYTRS (char const* uplo, int const* n, int const* nrhs, + float const* a, int const* lda, int const* ipiv, float* b, int const* ldb, int* info); - void LAPACK_DSYTRS (char const* uplo, int const* n, int const* nrhs, - double const* a, int const* lda, int const* ipiv, + void LAPACK_DSYTRS (char const* uplo, int const* n, int const* nrhs, + double const* a, int const* lda, int const* ipiv, double* b, int const* ldb, int* info); void LAPACK_CSYTRS (char const* uplo, int const* n, int const* nrhs, - fcomplex_t const* a, int const* lda, int const* ipiv, + fcomplex_t const* a, int const* lda, int const* ipiv, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZSYTRS (char const* uplo, int const* n, int const* nrhs, - dcomplex_t const* a, int const* lda, int const* ipiv, + dcomplex_t const* a, int const* lda, int const* ipiv, dcomplex_t* b, int const* ldb, int* info); - void LAPACK_SSYTRI (char const* uplo, int const* n, float* a, - int const* lda, int const* ipiv, float* work, + void LAPACK_SSYTRI (char const* uplo, int const* n, float* a, + int const* lda, int const* ipiv, float* work, int* info); - void LAPACK_DSYTRI (char const* uplo, int const* n, double* a, - int const* lda, int const* ipiv, double* work, + void LAPACK_DSYTRI (char const* uplo, int const* n, double* a, + int const* lda, int const* ipiv, double* work, int* info); - void LAPACK_CSYTRI (char const* uplo, int const* n, fcomplex_t* a, - int const* lda, int const* ipiv, fcomplex_t* work, + void LAPACK_CSYTRI (char const* uplo, int const* n, fcomplex_t* a, + int const* lda, int const* ipiv, fcomplex_t* work, int* info); - void LAPACK_ZSYTRI (char const* uplo, int const* n, dcomplex_t* a, - int const* lda, int const* ipiv, dcomplex_t* work, + void LAPACK_ZSYTRI (char const* uplo, int const* n, dcomplex_t* a, + int const* lda, int const* ipiv, dcomplex_t* work, int* info); - + void LAPACK_CHETRS (char const* uplo, int const* n, int const* nrhs, - fcomplex_t const* a, int const* lda, int const* ipiv, + fcomplex_t const* a, int const* lda, int const* ipiv, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZHETRS (char const* uplo, int const* n, int const* nrhs, - dcomplex_t const* a, int const* lda, int const* ipiv, + dcomplex_t const* a, int const* lda, int const* ipiv, dcomplex_t* b, int const* ldb, int* info); /* symmetric/Hermitian indefinite and complex symmetric in packed storage */ - void LAPACK_SSPSV (char const* uplo, int const* n, int const* nrhs, - float* ap, int* ipiv, + void LAPACK_SSPSV (char const* uplo, int const* n, int const* nrhs, + float* ap, int* ipiv, float* b, int const* ldb, int* info); - void LAPACK_DSPSV (char const* uplo, int const* n, int const* nrhs, - double* ap, int* ipiv, + void LAPACK_DSPSV (char const* uplo, int const* n, int const* nrhs, + double* ap, int* ipiv, double* b, int const* ldb, int* info); void LAPACK_CSPSV (char const* uplo, int const* n, int const* nrhs, - fcomplex_t* ap, int* ipiv, + fcomplex_t* ap, int* ipiv, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZSPSV (char const* uplo, int const* n, int const* nrhs, - dcomplex_t* ap, int* ipiv, + dcomplex_t* ap, int* ipiv, dcomplex_t* b, int const* ldb, int* info); void LAPACK_CHPSV (char const* uplo, int const* n, int const* nrhs, - fcomplex_t* ap, int* ipiv, + fcomplex_t* ap, int* ipiv, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZHPSV (char const* uplo, int const* n, int const* nrhs, - dcomplex_t* ap, int* ipiv, + dcomplex_t* ap, int* ipiv, dcomplex_t* b, int const* ldb, int* info); - void LAPACK_SSPTRF (char const* uplo, int const* n, + void LAPACK_SSPTRF (char const* uplo, int const* n, float* ap, int* ipiv, int* info); - void LAPACK_DSPTRF (char const* uplo, int const* n, + void LAPACK_DSPTRF (char const* uplo, int const* n, double* ap, int* ipiv, int* info); - void LAPACK_CSPTRF (char const* uplo, int const* n, + void LAPACK_CSPTRF (char const* uplo, int const* n, fcomplex_t* ap, int* ipiv, int* info); - void LAPACK_ZSPTRF (char const* uplo, int const* n, + void LAPACK_ZSPTRF (char const* uplo, int const* n, dcomplex_t* ap, int* ipiv, int* info); - void LAPACK_CHPTRF (char const* uplo, int const* n, + void LAPACK_CHPTRF (char const* uplo, int const* n, fcomplex_t* ap, int* ipiv, int* info); - void LAPACK_ZHPTRF (char const* uplo, int const* n, + void LAPACK_ZHPTRF (char const* uplo, int const* n, dcomplex_t* ap, int* ipiv, int* info); - void LAPACK_SSPTRS (char const* uplo, int const* n, int const* nrhs, - float const* ap, int const* ipiv, + void LAPACK_SSPTRS (char const* uplo, int const* n, int const* nrhs, + float const* ap, int const* ipiv, float* b, int const* ldb, int* info); - void LAPACK_DSPTRS (char const* uplo, int const* n, int const* nrhs, - double const* ap, int const* ipiv, + void LAPACK_DSPTRS (char const* uplo, int const* n, int const* nrhs, + double const* ap, int const* ipiv, double* b, int const* ldb, int* info); void LAPACK_CSPTRS (char const* uplo, int const* n, int const* nrhs, - fcomplex_t const* ap, int const* ipiv, + fcomplex_t const* ap, int const* ipiv, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZSPTRS (char const* uplo, int const* n, int const* nrhs, - dcomplex_t const* ap, int const* ipiv, + dcomplex_t const* ap, int const* ipiv, dcomplex_t* b, int const* ldb, int* info); - void LAPACK_SSPTRI (char const* uplo, int const* n, float const* ap, + void LAPACK_SSPTRI (char const* uplo, int const* n, float const* ap, int const* ipiv, float* work, int* info); - void LAPACK_DSPTRI (char const* uplo, int const* n, double const* ap, + void LAPACK_DSPTRI (char const* uplo, int const* n, double const* ap, int const* ipiv, double* work, int* info); - void LAPACK_CSPTRI (char const* uplo, int const* n, fcomplex_t const* ap, + void LAPACK_CSPTRI (char const* uplo, int const* n, fcomplex_t const* ap, int const* ipiv, fcomplex_t* work, int* info); - void LAPACK_ZSPTRI (char const* uplo, int const* n, dcomplex_t const* ap, + void LAPACK_ZSPTRI (char const* uplo, int const* n, dcomplex_t const* ap, int const* ipiv, dcomplex_t* work, int* info); void LAPACK_CHPTRS (char const* uplo, int const* n, int const* nrhs, - fcomplex_t const* ap, int const* ipiv, + fcomplex_t const* ap, int const* ipiv, fcomplex_t* b, int const* ldb, int* info); void LAPACK_ZHPTRS (char const* uplo, int const* n, int const* nrhs, - dcomplex_t const* ap, int const* ipiv, + dcomplex_t const* ap, int const* ipiv, dcomplex_t* b, int const* ldb, int* info); /* banded */ @@ -336,8 +336,8 @@ extern "C" { void LAPACK_DGBTRF (int const* n, int const* m, int const* kl, int const* ku, double* ab, int const* ldab, int* ipiv, int* info); - void LAPACK_DGBTRS (char const* trans, int const* n, int const* kl, int const* ku, int const* nrhs, - double const* ab, int const* ldab, int const* ipiv, + void LAPACK_DGBTRS (char const* trans, int const* n, int const* kl, int const* ku, int const* nrhs, + double const* ab, int const* ldab, int const* ipiv, double* b, int const* ldb, int* info); @@ -491,29 +491,29 @@ extern "C" { /* Hessenberg matrices */ - void LAPACK_SHSEQR( const char* JOB, const char* COMPZ, const int* N, const int* ILO, const int* IHI, float* H, + void LAPACK_SHSEQR( const char* JOB, const char* COMPZ, const int* N, const int* ILO, const int* IHI, float* H, const int* LDH, float* WR, float* WI, float* Z, int const* LDZ, float* WORK, const int* LWORK, int* INFO ) ; - void LAPACK_CHSEQR( const char* JOB, const char* COMPZ, const int* N, const int* ILO, const int* IHI, fcomplex_t* H, + void LAPACK_CHSEQR( const char* JOB, const char* COMPZ, const int* N, const int* ILO, const int* IHI, fcomplex_t* H, const int* LDH, fcomplex_t* W, fcomplex_t* Z, int const* LDZ, fcomplex_t* WORK, const int* LWORK, int* INFO ) ; - void LAPACK_DHSEQR( const char* JOB, const char* COMPZ, const int* N, const int* ILO, const int* IHI, double* H, + void LAPACK_DHSEQR( const char* JOB, const char* COMPZ, const int* N, const int* ILO, const int* IHI, double* H, const int* LDH, double* WR, double* WI, double* Z, int const* LDZ, double* WORK, const int* LWORK, int* INFO ) ; - void LAPACK_ZHSEQR( const char* JOB, const char* COMPZ, const int* N, const int* ILO, const int* IHI, dcomplex_t* H, + void LAPACK_ZHSEQR( const char* JOB, const char* COMPZ, const int* N, const int* ILO, const int* IHI, dcomplex_t* H, const int* LDH, dcomplex_t* W, dcomplex_t* Z, int const* LDZ, dcomplex_t* WORK, const int* LWORK, int* INFO ) ; /* Hermitian tridiagonal matrices */ - + void LAPACK_SSTEQR( char const* compz, int const* n, float* d, float* E, float* z, int const* ldz, float* work, int* info ) ; void LAPACK_DSTEQR( char const* compz, int const* n, double* d, double* E, double* z, int const* ldz, double* work, int* info ) ; /* Hermitian banded matrices */ - + void LAPACK_SSBEV( char const* jobz, char const* uplo, int const* n, int const* kd, float* ab, int const* ldab, float* w, float* z, int const* ldz, float* work, int* info ); @@ -598,53 +598,53 @@ extern "C" { /* SVD */ /*********************************************************************/ - void LAPACK_SGESVD (char const* jobu, char const* jobvt, - int const* m, int const* n, float* a, int const* lda, - float* s, float* u, int const* ldu, + void LAPACK_SGESVD (char const* jobu, char const* jobvt, + int const* m, int const* n, float* a, int const* lda, + float* s, float* u, int const* ldu, float* vt, int const* ldvt, - float* work, int const* lwork, int* info); - void LAPACK_DGESVD (char const* jobu, char const* jobvt, - int const* m, int const* n, double* a, int const* lda, - double* s, double* u, int const* ldu, + float* work, int const* lwork, int* info); + void LAPACK_DGESVD (char const* jobu, char const* jobvt, + int const* m, int const* n, double* a, int const* lda, + double* s, double* u, int const* ldu, double* vt, int const* ldvt, - double* work, int const* lwork, int* info); - void LAPACK_CGESVD (char const* jobu, char const* jobvt, - int const* m, int const* n, - fcomplex_t* a, int const* lda, - float* s, fcomplex_t* u, int const* ldu, + double* work, int const* lwork, int* info); + void LAPACK_CGESVD (char const* jobu, char const* jobvt, + int const* m, int const* n, + fcomplex_t* a, int const* lda, + float* s, fcomplex_t* u, int const* ldu, fcomplex_t* vt, int const* ldvt, - fcomplex_t* work, int const* lwork, - float* rwork, int* info); - void LAPACK_ZGESVD (char const* jobu, char const* jobvt, - int const* m, int const* n, - dcomplex_t* a, int const* lda, - double* s, dcomplex_t* u, int const* ldu, + fcomplex_t* work, int const* lwork, + float* rwork, int* info); + void LAPACK_ZGESVD (char const* jobu, char const* jobvt, + int const* m, int const* n, + dcomplex_t* a, int const* lda, + double* s, dcomplex_t* u, int const* ldu, dcomplex_t* vt, int const* ldvt, - dcomplex_t* work, int const* lwork, - double* rwork, int* info); + dcomplex_t* work, int const* lwork, + double* rwork, int* info); - void LAPACK_SGESDD (char const* jobz, int const* m, int const* n, - float* a, int const* lda, - float* s, float* u, int const* ldu, + void LAPACK_SGESDD (char const* jobz, int const* m, int const* n, + float* a, int const* lda, + float* s, float* u, int const* ldu, float* vt, int const* ldvt, - float* work, int const* lwork, int* iwork, int* info); - void LAPACK_DGESDD (char const* jobz, int const* m, int const* n, - double* a, int const* lda, - double* s, double* u, int const* ldu, + float* work, int const* lwork, int* iwork, int* info); + void LAPACK_DGESDD (char const* jobz, int const* m, int const* n, + double* a, int const* lda, + double* s, double* u, int const* ldu, double* vt, int const* ldvt, - double* work, int const* lwork, int* iwork, int* info); - void LAPACK_CGESDD (char const* jobz, int const* m, int const* n, - fcomplex_t* a, int const* lda, - float* s, fcomplex_t* u, int const* ldu, + double* work, int const* lwork, int* iwork, int* info); + void LAPACK_CGESDD (char const* jobz, int const* m, int const* n, + fcomplex_t* a, int const* lda, + float* s, fcomplex_t* u, int const* ldu, fcomplex_t* vt, int const* ldvt, - fcomplex_t* work, int const* lwork, - float* rwork, int* iwork, int* info); - void LAPACK_ZGESDD (char const* jobz, int const* m, int const* n, - dcomplex_t* a, int const* lda, - double* s, dcomplex_t* u, int const* ldu, + fcomplex_t* work, int const* lwork, + float* rwork, int* iwork, int* info); + void LAPACK_ZGESDD (char const* jobz, int const* m, int const* n, + dcomplex_t* a, int const* lda, + double* s, dcomplex_t* u, int const* ldu, dcomplex_t* vt, int const* ldvt, - dcomplex_t* work, int const* lwork, - double* rwork, int* iwork, int* info); + dcomplex_t* work, int const* lwork, + double* rwork, int* iwork, int* info); /*********************************************************************/ @@ -701,19 +701,19 @@ extern "C" { /* Least Squares */ /********************************************************************/ - void LAPACK_SGELS(const char* trans, const int* m, const int* n, + void LAPACK_SGELS(const char* trans, const int* m, const int* n, const int *nrhs, float* a, const int* lda, float* b, const int* ldb, float* work, const int* lwork, int* info); - void LAPACK_DGELS(const char* trans, const int* m, const int* n, + void LAPACK_DGELS(const char* trans, const int* m, const int* n, const int *nrhs, double* a, const int* lda, double* b, const int* ldb, double* work, const int* lwork, int* info); - void LAPACK_CGELS(const char* trans, const int* m, const int* n, + void LAPACK_CGELS(const char* trans, const int* m, const int* n, const int *nrhs, fcomplex_t* a, const int* lda, fcomplex_t* b, const int* ldb, fcomplex_t* work, const int* lwork, int* info); - void LAPACK_ZGELS(const char* trans, const int* m, const int* n, + void LAPACK_ZGELS(const char* trans, const int* m, const int* n, const int *nrhs, dcomplex_t* a, const int* lda, dcomplex_t* b, const int* ldb, dcomplex_t* work, const int* lwork, int* info); @@ -761,9 +761,9 @@ extern "C" { /********************************************************************/ int LAPACK_ILAENV (int const* ispec, const char* name, const char* opt, - int const* n1, int const* n2, int const* n3, - int const* n4, int, int); + int const* n1, int const* n2, int const* n3, + int const* n4, int, int); } -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack.hpp index 77ff783142683bb0ee62577e2de327f79cac738c..175f8d9b75fb0eec3c927dae7212cdc22658a17c 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack.hpp @@ -1,15 +1,15 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * - * Permission to copy, modify, use and distribute this software - * for any non-commercial or commercial purpose is granted provided + * Permission to copy, modify, use and distribute this software + * for any non-commercial or commercial purpose is granted provided * that this license appear on all copies of the software source code. * - * Authors assume no responsibility whatsoever for its use and makes + * Authors assume no responsibility whatsoever for its use and makes * no guarantees about its quality, correctness or reliability. * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -33,7 +33,7 @@ #include <boost/numeric/bindings/lapack/gelss.hpp> #include <boost/numeric/bindings/lapack/gelsd.hpp> -// eigenproblems +// eigenproblems #include <boost/numeric/bindings/lapack/gees.hpp> #include <boost/numeric/bindings/lapack/trevc.hpp> diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack_names.h b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack_names.h index 9cb758cdc85755f125d78735a4b4ba97c06ef4cf..7a00b70f1d18f4345a2d0f41d97764b9ba2447d5 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack_names.h +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/lapack_names.h @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -18,7 +18,7 @@ # include <boost/numeric/bindings/traits/fortran.h> #else # define FORTRAN_ID( id ) id##_ -#endif +#endif /* linear systems */ @@ -174,7 +174,7 @@ /********************************************/ -/* eigenproblems */ +/* eigenproblems */ #define LAPACK_SGEES FORTRAN_ID( sgees ) #define LAPACK_DGEES FORTRAN_ID( dgees ) @@ -212,7 +212,7 @@ #define LAPACK_ZTREXC FORTRAN_ID( ztrexc ) /********************************************/ -/* eigenproblems for Hessenberg matrices */ +/* eigenproblems for Hessenberg matrices */ #define LAPACK_SHSEQR FORTRAN_ID( shseqr ) #define LAPACK_DHSEQR FORTRAN_ID( dhseqr ) @@ -220,7 +220,7 @@ #define LAPACK_ZHSEQR FORTRAN_ID( zhseqr ) /********************************************/ -/* eigenproblems for banded matrices */ +/* eigenproblems for banded matrices */ #define LAPACK_SSBEV FORTRAN_ID( ssbev ) #define LAPACK_DSBEV FORTRAN_ID( dsbev ) @@ -233,7 +233,7 @@ #define LAPACK_ZHBEVX FORTRAN_ID( zhbevx ) /********************************************/ -/* eigenproblems for tridiagonal matrices */ +/* eigenproblems for tridiagonal matrices */ #define LAPACK_SSTEQR FORTRAN_ID( ssteqr ) #define LAPACK_DSTEQR FORTRAN_ID( dsteqr ) @@ -241,9 +241,9 @@ /********************************************/ /* generalized eigenvalue/eigenvector */ -#define LAPACK_SSYGV FORTRAN_ID( ssygv ) +#define LAPACK_SSYGV FORTRAN_ID( ssygv ) #define LAPACK_DSYGV FORTRAN_ID( dsygv ) -#define LAPACK_CHEGV FORTRAN_ID( chegv ) +#define LAPACK_CHEGV FORTRAN_ID( chegv ) #define LAPACK_ZHEGV FORTRAN_ID( zhegv ) /********************************************/ @@ -285,7 +285,7 @@ /********************************************/ -/* Least Squares */ +/* Least Squares */ #define LAPACK_SGELS FORTRAN_ID( sgels ) #define LAPACK_DGELS FORTRAN_ID( dgels ) @@ -303,10 +303,10 @@ #define LAPACK_ZGELSD FORTRAN_ID( zgelsd ) /********************************************/ -/* auxiliary */ +/* auxiliary */ #define LAPACK_ILAENV FORTRAN_ID( ilaenv ) -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/orgqr.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/orgqr.hpp index d85ac13c9074f2d89bf148ce21c9035f73d54205..6e81c3bfbc450b6971b37eae1998bb589490840b 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/orgqr.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/orgqr.hpp @@ -13,10 +13,10 @@ * reflectors of order M * Q = H(1) H(2) . . . H(k) * - * \warning - * \todo + * \warning + * \todo * \date 2005 - * \author CEA/DRT/DTSI/SARC + * \author CEA/DRT/DTSI/SARC * \author Q.C. PHAM * **/ @@ -32,59 +32,59 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { - + /////////////////////////////////////////////////////////////////// - /* + /* * Generates an M-by-N real matrix Q with orthonormal columns, * which is defined as the first N columns of a product of K elementary * reflectors of order M * Q = H(1) H(2) . . . H(k) * as returned by geqrf(). * The init value of matrix Q is the matrix A returned by geqrf() - */ + */ /////////////////////////////////////////////////////////////////// namespace detail { - inline + inline void orgqr(int const m, int const n, int const k, float* a, int const lda, - float* tau, float* work, int const lwork, int& info) + float* tau, float* work, int const lwork, int& info) { LAPACK_SORGQR (&m, &n, &k, a, &lda, tau, work, &lwork, &info); } - inline + inline void orgqr(int const m, int const n, int const k, double* a, int const lda, - double* tau, double* work, int const lwork, int& info) + double* tau, double* work, int const lwork, int& info) { LAPACK_DORGQR (&m, &n, &k, a, &lda, tau, work, &lwork, &info); } - inline + inline void orgqr(int const m, int const n, int const k, traits::complex_f* a, int const lda, - traits::complex_f* tau, traits::complex_f* work, int const lwork, int& info) + traits::complex_f* tau, traits::complex_f* work, int const lwork, int& info) { LAPACK_CUNGQR (&m, &n, &k, traits::complex_ptr(a), &lda, traits::complex_ptr(tau), traits::complex_ptr(work), &lwork, &info); } - inline + inline void orgqr(int const m, int const n, int const k, traits::complex_d* a, int const lda, - traits::complex_d* tau, traits::complex_d* work, int const lwork, int& info) + traits::complex_d* tau, traits::complex_d* work, int const lwork, int& info) { LAPACK_ZUNGQR (&m, &n, &k, traits::complex_ptr(a), &lda, traits::complex_ptr(tau), traits::complex_ptr(work), &lwork, &info); @@ -98,25 +98,25 @@ namespace boost { namespace numeric { namespace bindings { template <typename A, typename Tau, typename Work> inline int orgqr(A& a, Tau& tau, Work &work) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif const int m = traits::matrix_size1 (a); const int n = traits::matrix_size2 (a); const int k = n; - assert (std::min<int>(m,n) <= traits::vector_size (tau)); - assert (n <= traits::vector_size (work)); - - int info; + assert (std::min<int>(m,n) <= traits::vector_size (tau)); + assert (n <= traits::vector_size (work)); + + int info; detail::orgqr (m, n, k, - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (tau), + traits::vector_storage (tau), traits::vector_storage (work), traits::vector_size (work), info); @@ -133,7 +133,7 @@ namespace boost { namespace numeric { namespace bindings { const int n = traits::matrix_size2 (a); traits::detail::array<value_type> work(std::max<int>(1, n*32)); return orgqr( a, tau, work ); - + } // Computation of Q @@ -150,7 +150,7 @@ namespace boost { namespace numeric { namespace bindings { // Computation of the Q // Workspace is taken from the array in workspace. - + template <typename A, typename Tau, typename Work> inline int orgqr (A& a, Tau& tau, detail::workspace1<Work> workspace ) { @@ -171,4 +171,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ormqr.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ormqr.hpp index 7f6ce9a0dfb8eae316b5c697833f4d5f3d647235..efbec08045ebbbb253c8f67adeb9a3b0766c2e4e 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ormqr.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ormqr.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -21,13 +21,13 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { @@ -35,10 +35,10 @@ namespace boost { namespace numeric { namespace bindings { // // Apply the orthogonal transformation abtained by geqrf() to // a general matrix. - // + // /////////////////////////////////////////////////////////////////// - /* + /* * ormqr() overwrites the general M by N matrix C with * * SIDE = 'L' SIDE = 'R' @@ -61,16 +61,16 @@ namespace boost { namespace numeric { namespace bindings { * as C. * We must have that vector_size( work ) >= matrix_size2( c ) * if SIDE=='L' otherwise vector_size( work ) >= matrix_size1( c ) - */ + */ namespace detail { - inline + inline void ormqr (char const side, char const trans, int const m, int const n, int const k, const float* a, int const lda, const float* tau, float* c, int const ldc, float* work, int const lwork, - int& info) + int& info) { assert ( trans=='N' || trans=='T' ); LAPACK_SORMQR (&side, &trans, &m, &n, &k, @@ -81,12 +81,12 @@ namespace boost { namespace numeric { namespace bindings { &info); } - inline + inline void ormqr (char const side, char const trans, int const m, int const n, int const k, const double* a, int const lda, const double* tau, double* c, int const ldc, double* work, int const lwork, - int& info) + int& info) { assert ( trans=='N' || trans=='T' ); LAPACK_DORMQR (&side, &trans, &m, &n, &k, @@ -97,12 +97,12 @@ namespace boost { namespace numeric { namespace bindings { &info); } - inline + inline void ormqr (char const side, char const trans, int const m, int const n, int const k, const traits::complex_f* a, int const lda, const traits::complex_f* tau, traits::complex_f* c, int const ldc, traits::complex_f* work, int const lwork, - int& info) + int& info) { assert ( trans=='N' || trans=='C' ); LAPACK_CUNMQR (&side, &trans, &m, &n, &k, @@ -113,12 +113,12 @@ namespace boost { namespace numeric { namespace bindings { &info); } - inline + inline void ormqr (char const side, char const trans, int const m, int const n, int const k, const traits::complex_d* a, int const lda, const traits::complex_d* tau, traits::complex_d* c, int const ldc, traits::complex_d* work, int const lwork, - int& info) + int& info) { assert ( trans=='N' || trans=='C' ); LAPACK_ZUNMQR (&side, &trans, &m, &n, &k, @@ -135,16 +135,16 @@ namespace boost { namespace numeric { namespace bindings { int ormqr (char side, char trans, const A& a, const Tau& tau, C& c, Work& work) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<C>::matrix_structure, + typename traits::matrix_traits<C>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const m = traits::matrix_size1 (c); int const n = traits::matrix_size2 (c); @@ -158,22 +158,22 @@ namespace boost { namespace numeric { namespace bindings { assert ( (side=='L' ? m == traits::matrix_size1 (a) : n == traits::matrix_size1 (a) ) ); - assert (traits::matrix_size2 (a)==k); + assert (traits::matrix_size2 (a)==k); assert ( (side=='L' ? lwork >= n : lwork >= m ) ); - int info; + int info; ormqr (side, trans, m, n, k, - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (tau), - traits::matrix_storage (c), + traits::vector_storage (tau), + traits::matrix_storage (c), traits::leading_dimension (c), traits::vector_storage (work), lwork, info); - return info; + return info; } } // namespace detail @@ -223,4 +223,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/posv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/posv.hpp index 3e773704d0b7d12bf16ba18cbd740bb6229b7ffa..5835ea52eb687d3875977dcb8ec453158b6016f1 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/posv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/posv.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -18,15 +18,15 @@ #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/numeric/bindings/lapack/lapack.h> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/numeric/bindings/traits/detail/symm_herm_traits.hpp> # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { @@ -38,60 +38,60 @@ namespace boost { namespace numeric { namespace bindings { ///////////////////////////////////////////////////////////////////// /* - * posv() computes the solution to a system of linear equations - * A * X = B, where A is an N-by-N symmetric or Hermitian positive + * posv() computes the solution to a system of linear equations + * A * X = B, where A is an N-by-N symmetric or Hermitian positive * definite matrix and X and B are N-by-NRHS matrices. * * The Cholesky decomposition is used to factor A as - * A = U^T * U or A = U^H * U, if UPLO = 'U', + * A = U^T * U or A = U^H * U, if UPLO = 'U', * A = L * L^T or A = L * L^H, if UPLO = 'L', * where U is an upper triangular matrix and L is a lower triangular * matrix. The factored form of A is then used to solve the system of * equations A * X = B. - * - * If UPLO = 'U', the leading N-by-N upper triangular part of A - * contains the upper triangular part of the matrix A, and the - * strictly lower triangular part of A is not referenced. - * If UPLO = 'L', the leading N-by-N lower triangular part of A - * contains the lower triangular part of the matrix A, and the + * + * If UPLO = 'U', the leading N-by-N upper triangular part of A + * contains the upper triangular part of the matrix A, and the + * strictly lower triangular part of A is not referenced. + * If UPLO = 'L', the leading N-by-N lower triangular part of A + * contains the lower triangular part of the matrix A, and the * strictly upper triangular part of A is not referenced. */ namespace detail { - inline + inline void posv (char const uplo, int const n, int const nrhs, - float* a, int const lda, - float* b, int const ldb, int* info) + float* a, int const lda, + float* b, int const ldb, int* info) { LAPACK_SPOSV (&uplo, &n, &nrhs, a, &lda, b, &ldb, info); } - inline + inline void posv (char const uplo, int const n, int const nrhs, - double* a, int const lda, - double* b, int const ldb, int* info) + double* a, int const lda, + double* b, int const ldb, int* info) { LAPACK_DPOSV (&uplo, &n, &nrhs, a, &lda, b, &ldb, info); } - inline + inline void posv (char const uplo, int const n, int const nrhs, - traits::complex_f* a, int const lda, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f* a, int const lda, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CPOSV (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, + LAPACK_CPOSV (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, traits::complex_ptr (b), &ldb, info); } - inline + inline void posv (char const uplo, int const n, int const nrhs, - traits::complex_d* a, int const lda, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d* a, int const lda, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZPOSV (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, + LAPACK_ZPOSV (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, traits::complex_ptr (b), &ldb, info); } @@ -101,14 +101,14 @@ namespace boost { namespace numeric { namespace bindings { int const n = traits::matrix_size1 (a); assert (n == traits::matrix_size2 (a)); assert (n == traits::matrix_size1 (b)); - int info; + int info; posv (uplo, n, traits::matrix_size2 (b), - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::matrix_storage (b), - traits::leading_dimension (b), + traits::matrix_storage (b), + traits::leading_dimension (b), &info); - return info; + return info; } } @@ -117,20 +117,20 @@ namespace boost { namespace numeric { namespace bindings { inline int posv (char const uplo, SymmMatrA& a, MatrB& b) { - assert (uplo == 'U' || uplo == 'L'); + assert (uplo == 'U' || uplo == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmMatrA>::matrix_structure, + typename traits::matrix_traits<SymmMatrA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - return detail::posv (uplo, a, b); + return detail::posv (uplo, a, b); } template <typename SymmMatrA, typename MatrB> @@ -142,82 +142,82 @@ namespace boost { namespace numeric { namespace bindings { typedef typename matraits::value_type val_t; BOOST_STATIC_ASSERT( (traits::detail::symm_herm_compatible< val_t, typename matraits::matrix_structure >::value ) ) ; BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif char uplo = traits::matrix_uplo_tag (a); - return detail::posv (uplo, a, b); + return detail::posv (uplo, a, b); } /* * potrf() computes the Cholesky factorization of a symmetric - * or Hermitian positive definite matrix A. The factorization has + * or Hermitian positive definite matrix A. The factorization has * the form - * A = U^T * U or A = U^H * U, if UPLO = 'U', + * A = U^T * U or A = U^H * U, if UPLO = 'U', * A = L * L^T or A = L * L^H, if UPLO = 'L', * where U is an upper triangular matrix and L is lower triangular. */ namespace detail { - inline - void potrf (char const uplo, int const n, - float* a, int const lda, int* info) + inline + void potrf (char const uplo, int const n, + float* a, int const lda, int* info) { LAPACK_SPOTRF (&uplo, &n, a, &lda, info); } - inline - void potrf (char const uplo, int const n, - double* a, int const lda, int* info) + inline + void potrf (char const uplo, int const n, + double* a, int const lda, int* info) { LAPACK_DPOTRF (&uplo, &n, a, &lda, info); } - inline - void potrf (char const uplo, int const n, - traits::complex_f* a, int const lda, int* info) + inline + void potrf (char const uplo, int const n, + traits::complex_f* a, int const lda, int* info) { LAPACK_CPOTRF (&uplo, &n, traits::complex_ptr (a), &lda, info); } - inline - void potrf (char const uplo, int const n, - traits::complex_d* a, int const lda, int* info) + inline + void potrf (char const uplo, int const n, + traits::complex_d* a, int const lda, int* info) { LAPACK_ZPOTRF (&uplo, &n, traits::complex_ptr (a), &lda, info); } - template <typename SymmMatrA> + template <typename SymmMatrA> inline int potrf (char const uplo, SymmMatrA& a) { int const n = traits::matrix_size1 (a); assert (n == traits::matrix_size2 (a)); - int info; - potrf (uplo, n, traits::matrix_storage (a), + int info; + potrf (uplo, n, traits::matrix_storage (a), traits::leading_dimension (a), &info); - return info; + return info; } } - template <typename SymmMatrA> + template <typename SymmMatrA> inline int potrf (char const uplo, SymmMatrA& a) { - assert (uplo == 'U' || uplo == 'L'); + assert (uplo == 'U' || uplo == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmMatrA>::matrix_structure, + typename traits::matrix_traits<SymmMatrA>::matrix_structure, traits::general_t >::value)); #endif - return detail::potrf (uplo, a); + return detail::potrf (uplo, a); } template <typename SymmMatrA> @@ -232,53 +232,53 @@ namespace boost { namespace numeric { namespace bindings { typename traits::detail::symm_herm_t<val_t>::type >::value)); #endif - + char uplo = traits::matrix_uplo_tag (a); - return detail::potrf (uplo, a); + return detail::potrf (uplo, a); } /* - * potrs() solves a system of linear equations A*X = B with - * a symmetric or Hermitian positive definite matrix A using + * potrs() solves a system of linear equations A*X = B with + * a symmetric or Hermitian positive definite matrix A using * the Cholesky factorization computed by potrf(). */ namespace detail { - inline + inline void potrs (char const uplo, int const n, int const nrhs, - float const* a, int const lda, - float* b, int const ldb, int* info) + float const* a, int const lda, + float* b, int const ldb, int* info) { LAPACK_SPOTRS (&uplo, &n, &nrhs, a, &lda, b, &ldb, info); } - inline + inline void potrs (char const uplo, int const n, int const nrhs, - double const* a, int const lda, - double* b, int const ldb, int* info) + double const* a, int const lda, + double* b, int const ldb, int* info) { LAPACK_DPOTRS (&uplo, &n, &nrhs, a, &lda, b, &ldb, info); } - inline + inline void potrs (char const uplo, int const n, int const nrhs, - traits::complex_f const* a, int const lda, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f const* a, int const lda, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CPOTRS (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, + LAPACK_CPOTRS (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, traits::complex_ptr (b), &ldb, info); } - inline + inline void potrs (char const uplo, int const n, int const nrhs, - traits::complex_d const* a, int const lda, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d const* a, int const lda, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZPOTRS (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, + LAPACK_ZPOTRS (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, traits::complex_ptr (b), &ldb, info); } @@ -288,18 +288,18 @@ namespace boost { namespace numeric { namespace bindings { int const n = traits::matrix_size1 (a); assert (n == traits::matrix_size2 (a)); assert (n == traits::matrix_size1 (b)); - int info; + int info; potrs (uplo, n, traits::matrix_size2 (b), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif traits::leading_dimension (a), - traits::matrix_storage (b), - traits::leading_dimension (b), + traits::matrix_storage (b), + traits::leading_dimension (b), &info); - return info; + return info; } } @@ -308,20 +308,20 @@ namespace boost { namespace numeric { namespace bindings { inline int potrs (char const uplo, SymmMatrA const& a, MatrB& b) { - assert (uplo == 'U' || uplo == 'L'); + assert (uplo == 'U' || uplo == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmMatrA>::matrix_structure, + typename traits::matrix_traits<SymmMatrA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - return detail::potrs (uplo, a, b); + return detail::potrs (uplo, a, b); } template <typename SymmMatrA, typename MatrB> @@ -342,13 +342,13 @@ namespace boost { namespace numeric { namespace bindings { #endif char uplo = traits::matrix_uplo_tag (a); - return detail::potrs (uplo, a, b); + return detail::potrs (uplo, a, b); } - // TO DO: potri() + // TO DO: potri() } }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ppsv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ppsv.hpp index 0b32af2ec0b742aee87fd40aaa19b5cab3a0f27f..c59200fc7efb65c25df73de64bcf6a5926c2ccbe 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ppsv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ppsv.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Kresimir Fresl Toon Knapen 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -19,15 +19,15 @@ #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/numeric/bindings/lapack/lapack.h> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/numeric/bindings/traits/detail/symm_herm_traits.hpp> # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { @@ -35,60 +35,60 @@ namespace boost { namespace numeric { namespace bindings { // // system of linear equations A * X = B // with A symmetric or Hermitian positive definite matrix - // stored in packed format + // stored in packed format // ///////////////////////////////////////////////////////////////////// /* - * ppsv() computes the solution to a system of linear equations - * A * X = B, where A is an N-by-N symmetric or Hermitian positive - * definite matrix stored in packed format and X and B are N-by-NRHS + * ppsv() computes the solution to a system of linear equations + * A * X = B, where A is an N-by-N symmetric or Hermitian positive + * definite matrix stored in packed format and X and B are N-by-NRHS * matrices. * * The Cholesky decomposition is used to factor A as - * A = U^T * U or A = U^H * U, if UPLO = 'U', + * A = U^T * U or A = U^H * U, if UPLO = 'U', * A = L * L^T or A = L * L^H, if UPLO = 'L', * where U is an upper triangular matrix and L is a lower triangular * matrix. The factored form of A is then used to solve the system of * equations A * X = B. - * - * Only upper or lower triangle of the symmetric matrix A is stored, - * packed columnwise in a linear array AP. + * + * Only upper or lower triangle of the symmetric matrix A is stored, + * packed columnwise in a linear array AP. */ namespace detail { - inline + inline void ppsv (char const uplo, int const n, int const nrhs, - float* ap, float* b, int const ldb, int* info) + float* ap, float* b, int const ldb, int* info) { LAPACK_SPPSV (&uplo, &n, &nrhs, ap, b, &ldb, info); } - inline + inline void ppsv (char const uplo, int const n, int const nrhs, - double* ap, double* b, int const ldb, int* info) + double* ap, double* b, int const ldb, int* info) { LAPACK_DPPSV (&uplo, &n, &nrhs, ap, b, &ldb, info); } - inline + inline void ppsv (char const uplo, int const n, int const nrhs, - traits::complex_f* ap, traits::complex_f* b, int const ldb, - int* info) + traits::complex_f* ap, traits::complex_f* b, int const ldb, + int* info) { - LAPACK_CPPSV (&uplo, &n, &nrhs, - traits::complex_ptr (ap), + LAPACK_CPPSV (&uplo, &n, &nrhs, + traits::complex_ptr (ap), traits::complex_ptr (b), &ldb, info); } - inline + inline void ppsv (char const uplo, int const n, int const nrhs, - traits::complex_d* ap, traits::complex_d* b, int const ldb, - int* info) + traits::complex_d* ap, traits::complex_d* b, int const ldb, + int* info) { - LAPACK_ZPPSV (&uplo, &n, &nrhs, - traits::complex_ptr (ap), + LAPACK_ZPPSV (&uplo, &n, &nrhs, + traits::complex_ptr (ap), traits::complex_ptr (b), &ldb, info); } @@ -106,7 +106,7 @@ namespace boost { namespace numeric { namespace bindings { >::type >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif @@ -116,47 +116,47 @@ namespace boost { namespace numeric { namespace bindings { assert (n == traits::matrix_size1 (b)); char uplo = traits::matrix_uplo_tag (a); - int info; + int info; detail::ppsv (uplo, n, traits::matrix_size2 (b), - traits::matrix_storage (a), - traits::matrix_storage (b), - traits::leading_dimension (b), + traits::matrix_storage (a), + traits::matrix_storage (b), + traits::leading_dimension (b), &info); - return info; + return info; } /* * pptrf() computes the Cholesky factorization of a symmetric - * or Hermitian positive definite matrix A in packed storage. + * or Hermitian positive definite matrix A in packed storage. * The factorization has the form - * A = U^T * U or A = U^H * U, if UPLO = 'U', + * A = U^T * U or A = U^H * U, if UPLO = 'U', * A = L * L^T or A = L * L^H, if UPLO = 'L', * where U is an upper triangular matrix and L is lower triangular. */ namespace detail { - inline + inline void pptrf (char const uplo, int const n, float* ap, int* info) { LAPACK_SPPTRF (&uplo, &n, ap, info); } - inline + inline void pptrf (char const uplo, int const n, double* ap, int* info) { LAPACK_DPPTRF (&uplo, &n, ap, info); } - inline - void pptrf (char const uplo, int const n, - traits::complex_f* ap, int* info) + inline + void pptrf (char const uplo, int const n, + traits::complex_f* ap, int* info) { LAPACK_CPPTRF (&uplo, &n, traits::complex_ptr (ap), info); } - inline - void pptrf (char const uplo, int const n, - traits::complex_d* ap, int* info) + inline + void pptrf (char const uplo, int const n, + traits::complex_d* ap, int* info) { LAPACK_ZPPTRF (&uplo, &n, traits::complex_ptr (ap), info); } @@ -179,51 +179,51 @@ namespace boost { namespace numeric { namespace bindings { int const n = traits::matrix_size1 (a); assert (n == traits::matrix_size2 (a)); char uplo = traits::matrix_uplo_tag (a); - int info; + int info; detail::pptrf (uplo, n, traits::matrix_storage (a), &info); - return info; + return info; } /* - * pptrs() solves a system of linear equations A*X = B with - * a symmetric or Hermitian positive definite matrix A in packed + * pptrs() solves a system of linear equations A*X = B with + * a symmetric or Hermitian positive definite matrix A in packed * storage using the Cholesky factorization computed by pptrf(). */ namespace detail { - inline + inline void pptrs (char const uplo, int const n, int const nrhs, - float const* ap, float* b, int const ldb, int* info) + float const* ap, float* b, int const ldb, int* info) { LAPACK_SPPTRS (&uplo, &n, &nrhs, ap, b, &ldb, info); } - inline + inline void pptrs (char const uplo, int const n, int const nrhs, - double const* ap, double* b, int const ldb, int* info) + double const* ap, double* b, int const ldb, int* info) { LAPACK_DPPTRS (&uplo, &n, &nrhs, ap, b, &ldb, info); } - inline + inline void pptrs (char const uplo, int const n, int const nrhs, - traits::complex_f const* ap, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f const* ap, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CPPTRS (&uplo, &n, &nrhs, - traits::complex_ptr (ap), + LAPACK_CPPTRS (&uplo, &n, &nrhs, + traits::complex_ptr (ap), traits::complex_ptr (b), &ldb, info); } - inline + inline void pptrs (char const uplo, int const n, int const nrhs, - traits::complex_d const* ap, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d const* ap, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZPPTRS (&uplo, &n, &nrhs, - traits::complex_ptr (ap), + LAPACK_ZPPTRS (&uplo, &n, &nrhs, + traits::complex_ptr (ap), traits::complex_ptr (b), &ldb, info); } @@ -241,7 +241,7 @@ namespace boost { namespace numeric { namespace bindings { >::type >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif @@ -249,19 +249,19 @@ namespace boost { namespace numeric { namespace bindings { int const n = traits::matrix_size1 (a); assert (n == traits::matrix_size2 (a)); assert (n == traits::matrix_size1 (b)); - + char uplo = traits::matrix_uplo_tag (a); - int info; + int info; detail::pptrs (uplo, n, traits::matrix_size2 (b), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif - traits::matrix_storage (b), - traits::leading_dimension (b), + traits::matrix_storage_const (a), +#endif + traits::matrix_storage (b), + traits::leading_dimension (b), &info); - return info; + return info; } @@ -270,29 +270,29 @@ namespace boost { namespace numeric { namespace bindings { * matrix A using the Cholesky factorization A = U**T*U or A = L*L**T * computed by pptrf(). */ - + namespace detail { - inline + inline void pptri (char const uplo, int const n, float* ap, int* info) { LAPACK_SPPTRI (&uplo, &n, ap, info); } - inline + inline void pptri (char const uplo, int const n, double* ap, int* info) { LAPACK_DPPTRI (&uplo, &n, ap, info); } - inline - void pptri (char const uplo, int const n, - traits::complex_f* ap, int* info) + inline + void pptri (char const uplo, int const n, + traits::complex_f* ap, int* info) { LAPACK_CPPTRI (&uplo, &n, traits::complex_ptr (ap), info); } - inline - void pptri (char const uplo, int const n, - traits::complex_d* ap, int* info) + inline + void pptri (char const uplo, int const n, + traits::complex_d* ap, int* info) { LAPACK_ZPPTRI(&uplo, &n, traits::complex_ptr (ap), info); } @@ -315,9 +315,9 @@ namespace boost { namespace numeric { namespace bindings { int const n = traits::matrix_size1 (a); assert (n == traits::matrix_size2 (a)); char uplo = traits::matrix_uplo_tag (a); - int info; + int info; detail::pptri (uplo, n, traits::matrix_storage (a), &info); - return info; + return info; } @@ -325,4 +325,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ptsv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ptsv.hpp index ff1b1c81c42802f1dbbe63a25e99861064bc7d5b..5d45a1445f88996efc6f27ab018c59589214222d 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ptsv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/ptsv.hpp @@ -1,5 +1,5 @@ /* - * + * * Copyright (c) Karl Meerbergen 2008 * * Distributed under the Boost Software License, Version 1.0. @@ -15,13 +15,13 @@ #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/numeric/bindings/lapack/lapack.h> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { @@ -43,32 +43,32 @@ namespace boost { namespace numeric { namespace bindings { namespace detail { - inline + inline void ptsv ( int const n, int const nrhs, - float* d, float* e, float* b, int const ldb, int* info) + float* d, float* e, float* b, int const ldb, int* info) { LAPACK_SPTSV (&n, &nrhs, d, e, b, &ldb, info); } - inline + inline void ptsv ( int const n, int const nrhs, - double* d, double* e, double* b, int const ldb, int* info) + double* d, double* e, double* b, int const ldb, int* info) { LAPACK_DPTSV (&n, &nrhs, d, e, b, &ldb, info); } - inline + inline void ptsv ( int const n, int const nrhs, - float* d, traits::complex_f* e, traits::complex_f* b, int const ldb, - int* info) + float* d, traits::complex_f* e, traits::complex_f* b, int const ldb, + int* info) { LAPACK_CPTSV (&n, &nrhs, d, traits::complex_ptr(e), traits::complex_ptr(b), &ldb, info); } - inline + inline void ptsv ( int const n, int const nrhs, - double* d, traits::complex_d* e, traits::complex_d* b, int const ldb, - int* info) + double* d, traits::complex_d* e, traits::complex_d* b, int const ldb, + int* info) { LAPACK_ZPTSV (&n, &nrhs, d, traits::complex_ptr(e), traits::complex_ptr(b), &ldb, info); } @@ -101,24 +101,24 @@ namespace boost { namespace numeric { namespace bindings { namespace detail { - inline + inline void pttrf ( int const n, float* d, float* e, int* info) { LAPACK_SPTTRF ( &n, d, e, info) ; } - inline + inline void pttrf ( int const n, double* d, double* e, int* info) { LAPACK_DPTTRF ( &n, d, e, info); } - inline - void pttrf ( int const n, float* d, traits::complex_f* e, int* info) + inline + void pttrf ( int const n, float* d, traits::complex_f* e, int* info) { LAPACK_CPTTRF ( &n, d, traits::complex_ptr(e), info); } - inline - void pttrf ( int const n, double* d, traits::complex_d* e, int* info) + inline + void pttrf ( int const n, double* d, traits::complex_d* e, int* info) { LAPACK_ZPTTRF ( &n, d, traits::complex_ptr(e), info); } @@ -130,9 +130,9 @@ namespace boost { namespace numeric { namespace bindings { int pttrf (D& d, E& e) { int const n = traits::vector_size (d); assert (n == traits::vector_size (e) + 1); - int info; + int info; detail::pttrf ( n, traits::vector_storage(d), traits::vector_storage(e), &info); - return info; + return info; } @@ -147,39 +147,39 @@ namespace boost { namespace numeric { namespace bindings { namespace detail { - inline + inline void pttrs (char const uplo, int const n, int const nrhs, - float const* d, float const* e, float* b, int const ldb, int* info) + float const* d, float const* e, float* b, int const ldb, int* info) { LAPACK_SPTTRS (&n, &nrhs, d, e, b, &ldb, info); } - inline + inline void pttrs (char const uplo, int const n, int const nrhs, - double const* d, double const* e, double* b, int const ldb, int* info) + double const* d, double const* e, double* b, int const ldb, int* info) { LAPACK_DPTTRS (&n, &nrhs, d, e, b, &ldb, info); } - inline + inline void pttrs (char const uplo, int const n, int const nrhs, - float const* d, - traits::complex_f const* e, - traits::complex_f* b, int const ldb, int* info) + float const* d, + traits::complex_f const* e, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CPTTRS (&uplo, &n, &nrhs, d, - traits::complex_ptr (e), + LAPACK_CPTTRS (&uplo, &n, &nrhs, d, + traits::complex_ptr (e), traits::complex_ptr (b), &ldb, info); } - inline + inline void pttrs (char const uplo, int const n, int const nrhs, - double const* d, - traits::complex_d const* e, - traits::complex_d* b, int const ldb, int* info) + double const* d, + traits::complex_d const* e, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZPTTRS (&uplo, &n, &nrhs, d, - traits::complex_ptr (e), + LAPACK_ZPTTRS (&uplo, &n, &nrhs, d, + traits::complex_ptr (e), traits::complex_ptr (b), &ldb, info); } @@ -191,19 +191,19 @@ namespace boost { namespace numeric { namespace bindings { int const n = traits::vector_size (d); assert (n == traits::vector_size (e) + 1); assert (n == traits::matrix_num_rows (b)); - - int info; + + int info; detail::pttrs (uplo, n, traits::matrix_num_columns (b), - traits::vector_storage (d), - traits::vector_storage (e), - traits::matrix_storage (b), - traits::leading_dimension (b), + traits::vector_storage (d), + traits::vector_storage (e), + traits::matrix_storage (b), + traits::leading_dimension (b), &info); - return info; + return info; } // pttrs() } }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/spsv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/spsv.hpp index c863bf6068cddc20ebf193dab3647d80307d0c74..de381b5f3539bf5d2e543dd65494784260fa53b3 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/spsv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/spsv.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Kresimir Fresl & Toon Knapen 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -19,74 +19,74 @@ #include <boost/numeric/bindings/lapack/lapack.h> #include <boost/numeric/bindings/traits/detail/array.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { ///////////////////////////////////////////////////////////////////// // // system of linear equations A * X = B with A symmetric matrix - // stored in packed format + // stored in packed format // ///////////////////////////////////////////////////////////////////// /* - * spsv() computes the solution to a system of linear equations - * A * X = B, where A is an N-by-N symmetric matrix stored in packed + * spsv() computes the solution to a system of linear equations + * A * X = B, where A is an N-by-N symmetric matrix stored in packed * format and X and B are N-by-NRHS matrices. * * The diagonal pivoting method is used to factor A as - * A = U * D * U^T, if UPLO = 'U', + * A = U * D * U^T, if UPLO = 'U', * A = L * D * L^T, if UPLO = 'L', - * where U (or L) is a product of permutation and unit upper - * (lower) triangular matrices, and D is symmetric and block - * diagonal with 1-by-1 and 2-by-2 diagonal blocks. - * The factored form of A is then used to solve the system + * where U (or L) is a product of permutation and unit upper + * (lower) triangular matrices, and D is symmetric and block + * diagonal with 1-by-1 and 2-by-2 diagonal blocks. + * The factored form of A is then used to solve the system * of equations A * X = B. */ namespace detail { - inline + inline void spsv (char const uplo, int const n, int const nrhs, - float* ap, int* ipiv, - float* b, int const ldb, int* info) + float* ap, int* ipiv, + float* b, int const ldb, int* info) { LAPACK_SSPSV (&uplo, &n, &nrhs, ap, ipiv, b, &ldb, info); } - inline + inline void spsv (char const uplo, int const n, int const nrhs, - double* ap, int* ipiv, - double* b, int const ldb, int* info) + double* ap, int* ipiv, + double* b, int const ldb, int* info) { LAPACK_DSPSV (&uplo, &n, &nrhs, ap, ipiv, b, &ldb, info); } - inline + inline void spsv (char const uplo, int const n, int const nrhs, - traits::complex_f* ap, int* ipiv, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f* ap, int* ipiv, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CSPSV (&uplo, &n, &nrhs, - traits::complex_ptr (ap), ipiv, + LAPACK_CSPSV (&uplo, &n, &nrhs, + traits::complex_ptr (ap), ipiv, traits::complex_ptr (b), &ldb, info); } - inline + inline void spsv (char const uplo, int const n, int const nrhs, - traits::complex_d* ap, int* ipiv, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d* ap, int* ipiv, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZSPSV (&uplo, &n, &nrhs, - traits::complex_ptr (ap), ipiv, + LAPACK_ZSPSV (&uplo, &n, &nrhs, + traits::complex_ptr (ap), ipiv, traits::complex_ptr (b), &ldb, info); } @@ -96,28 +96,28 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_packed_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); char uplo = traits::matrix_uplo_tag (a); - int info; - spsv (uplo, n, traits::matrix_size2 (b), - traits::matrix_storage (a), - traits::vector_storage (i), + int info; + spsv (uplo, n, traits::matrix_size2 (b), + traits::matrix_storage (a), + traits::vector_storage (i), traits::matrix_storage (b), traits::leading_dimension (b), &info); - return info; + return info; } } @@ -125,8 +125,8 @@ namespace boost { namespace numeric { namespace bindings { template <typename SymmA, typename MatrB, typename IVec> inline int spsv (SymmA& a, IVec& i, MatrB& b) { - assert (traits::matrix_size1 (a) == traits::vector_size (i)); - return detail::spsv (a, i, b); + assert (traits::matrix_size1 (a) == traits::vector_size (i)); + return detail::spsv (a, i, b); } template <typename SymmA, typename MatrB> @@ -134,51 +134,51 @@ namespace boost { namespace numeric { namespace bindings { int spsv (SymmA& a, MatrB& b) { // with 'internal' pivot vector - int info = -101; - traits::detail::array<int> i (traits::matrix_size1 (a)); + int info = -101; + traits::detail::array<int> i (traits::matrix_size1 (a)); - if (i.valid()) - info = detail::spsv (a, i, b); - return info; + if (i.valid()) + info = detail::spsv (a, i, b); + return info; } /* - * sptrf() computes the factorization of a symmetric matrix A - * in packed storage using the Bunch-Kaufman diagonal pivoting + * sptrf() computes the factorization of a symmetric matrix A + * in packed storage using the Bunch-Kaufman diagonal pivoting * method. The form of the factorization is * A = U * D * U^T or A = L * D * L^T - * where U (or L) is a product of permutation and unit upper (lower) - * triangular matrices, and D is symmetric and block diagonal with + * where U (or L) is a product of permutation and unit upper (lower) + * triangular matrices, and D is symmetric and block diagonal with * 1-by-1 and 2-by-2 diagonal blocks. */ namespace detail { - inline - void sptrf (char const uplo, int const n, - float* ap, int* ipiv, int* info) + inline + void sptrf (char const uplo, int const n, + float* ap, int* ipiv, int* info) { LAPACK_SSPTRF (&uplo, &n, ap, ipiv, info); } - inline - void sptrf (char const uplo, int const n, - double* ap, int* ipiv, int* info) + inline + void sptrf (char const uplo, int const n, + double* ap, int* ipiv, int* info) { LAPACK_DSPTRF (&uplo, &n, ap, ipiv, info); } - inline - void sptrf (char const uplo, int const n, - traits::complex_f* ap, int* ipiv, int* info) + inline + void sptrf (char const uplo, int const n, + traits::complex_f* ap, int* ipiv, int* info) { LAPACK_CSPTRF (&uplo, &n, traits::complex_ptr (ap), ipiv, info); } - inline - void sptrf (char const uplo, int const n, - traits::complex_d* ap, int* ipiv, int* info) + inline + void sptrf (char const uplo, int const n, + traits::complex_d* ap, int* ipiv, int* info) { LAPACK_ZSPTRF (&uplo, &n, traits::complex_ptr (ap), ipiv, info); } @@ -191,65 +191,65 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_packed_t >::value)); #endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::vector_size (i)); char uplo = traits::matrix_uplo_tag (a); - int info; - detail::sptrf (uplo, n, traits::matrix_storage (a), + int info; + detail::sptrf (uplo, n, traits::matrix_storage (a), traits::vector_storage (i), &info); - return info; + return info; } /* - * sptrs() solves a system of linear equations A*X = B with - * a symmetric matrix A in packed storage using the factorization + * sptrs() solves a system of linear equations A*X = B with + * a symmetric matrix A in packed storage using the factorization * A = U * D * U^T or A = L * D * L^T * computed by sptrf(). */ namespace detail { - inline + inline void sptrs (char const uplo, int const n, int const nrhs, - float const* a, int const* ipiv, - float* b, int const ldb, int* info) + float const* a, int const* ipiv, + float* b, int const ldb, int* info) { LAPACK_SSPTRS (&uplo, &n, &nrhs, a, ipiv, b, &ldb, info); } - inline + inline void sptrs (char const uplo, int const n, int const nrhs, - double const* a, int const* ipiv, - double* b, int const ldb, int* info) + double const* a, int const* ipiv, + double* b, int const ldb, int* info) { LAPACK_DSPTRS (&uplo, &n, &nrhs, a, ipiv, b, &ldb, info); } - inline + inline void sptrs (char const uplo, int const n, int const nrhs, - traits::complex_f const* a, int const* ipiv, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f const* a, int const* ipiv, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CSPTRS (&uplo, &n, &nrhs, - traits::complex_ptr (a), ipiv, + LAPACK_CSPTRS (&uplo, &n, &nrhs, + traits::complex_ptr (a), ipiv, traits::complex_ptr (b), &ldb, info); } - inline + inline void sptrs (char const uplo, int const n, int const nrhs, - traits::complex_d const* a, int const* ipiv, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d const* a, int const* ipiv, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZSPTRS (&uplo, &n, &nrhs, - traits::complex_ptr (a), ipiv, + LAPACK_ZSPTRS (&uplo, &n, &nrhs, + traits::complex_ptr (a), ipiv, traits::complex_ptr (b), &ldb, info); } @@ -261,99 +261,99 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_packed_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (i)); char uplo = traits::matrix_uplo_tag (a); - int info; - detail::sptrs (uplo, n, traits::matrix_size2 (b), + int info; + detail::sptrs (uplo, n, traits::matrix_size2 (b), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), - traits::vector_storage (i), + traits::matrix_storage (a), + traits::vector_storage (i), #else - traits::matrix_storage_const (a), - traits::vector_storage_const (i), -#endif + traits::matrix_storage_const (a), + traits::vector_storage_const (i), +#endif traits::matrix_storage (b), - traits::leading_dimension (b), + traits::leading_dimension (b), &info); - return info; + return info; } namespace detail { - inline - void sptri (char const uplo, int const n, - float* ap, int* ipiv, float* work, int* info) + inline + void sptri (char const uplo, int const n, + float* ap, int* ipiv, float* work, int* info) { LAPACK_SSPTRI (&uplo, &n, ap, ipiv, work, info); } - inline - void sptri (char const uplo, int const n, - double* ap, int* ipiv, double* work, int* info) + inline + void sptri (char const uplo, int const n, + double* ap, int* ipiv, double* work, int* info) { LAPACK_DSPTRI (&uplo, &n, ap, ipiv, work, info); } - inline - void sptri (char const uplo, int const n, - traits::complex_f* ap, int* ipiv, traits::complex_f* work, int* info) + inline + void sptri (char const uplo, int const n, + traits::complex_f* ap, int* ipiv, traits::complex_f* work, int* info) { - LAPACK_CSPTRI (&uplo, &n, traits::complex_ptr (ap), + LAPACK_CSPTRI (&uplo, &n, traits::complex_ptr (ap), ipiv, traits::complex_ptr (work), info); } - inline - void sptri (char const uplo, int const n, - traits::complex_d* ap, int* ipiv, traits::complex_d* work, int* info) + inline + void sptri (char const uplo, int const n, + traits::complex_d* ap, int* ipiv, traits::complex_d* work, int* info) { - LAPACK_ZSPTRI (&uplo, &n, traits::complex_ptr (ap), + LAPACK_ZSPTRI (&uplo, &n, traits::complex_ptr (ap), ipiv, traits::complex_ptr (work), info); } } // namespace detail template <typename SymmA, typename IVec> inline - int sptri (SymmA& a, IVec& ipiv) + int sptri (SymmA& a, IVec& ipiv) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_packed_t >::value)); #endif int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::vector_size (ipiv)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::vector_size (ipiv)); char uplo = traits::matrix_uplo_tag (a); - int info; + int info; typedef typename SymmA::value_type value_type; traits::detail::array<value_type> work(traits::matrix_size1(a)); - detail::sptri (uplo, n, traits::matrix_storage (a), + detail::sptri (uplo, n, traits::matrix_storage (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), #else - traits::vector_storage_const (ipiv), + traits::vector_storage_const (ipiv), #endif traits::vector_storage (work), &info); - return info; + return info; } } // namespace lapack @@ -363,4 +363,4 @@ namespace boost { namespace numeric { namespace bindings { -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/steqr.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/steqr.hpp index 1c39387358ad39736c1ddb265ee8422981d185b2..efdbda782d4826c1e24f3c98de62f63569eb2e52 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/steqr.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/steqr.hpp @@ -1,8 +1,8 @@ // // Copyright Karl Meerbergen 2007 // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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) // @@ -17,10 +17,10 @@ #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/numeric/bindings/lapack/lapack.h> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif /********************************************************************/ @@ -34,14 +34,14 @@ namespace boost { namespace numeric { namespace bindings { namespace lapack { namespace detail { - inline - void steqr ( char compz, int n, float* d, float* e, float* z, int ldz, float* work, int& info ) + inline + void steqr ( char compz, int n, float* d, float* e, float* z, int ldz, float* work, int& info ) { LAPACK_SSTEQR( &compz, &n, d, e, z, &ldz, work, &info ) ; } - inline - void steqr ( char compz, int n, double* d, double* e, double* z, int ldz, double* work, int& info ) + inline + void steqr ( char compz, int n, double* d, double* e, double* z, int ldz, double* work, int& info ) { LAPACK_DSTEQR( &compz, &n, d, e, z, &ldz, work, &info ) ; } @@ -61,15 +61,15 @@ namespace boost { namespace numeric { namespace bindings { namespace lapack { int lwork = traits::vector_size( work ) ; - int info; + int info; detail::steqr( compz, n, - traits::vector_storage( d ), - traits::vector_storage( e ), - traits::matrix_storage( z ), - traits::leading_dimension( z ), - traits::vector_storage( work ), + traits::vector_storage( d ), + traits::vector_storage( e ), + traits::matrix_storage( z ), + traits::leading_dimension( z ), + traits::vector_storage( work ), info ) ; - return info; + return info; } // steqr() diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syev.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syev.hpp index 195902cd3cf7ba824d9296d802bd6701ad549fa6..5aeaf382adf18cf3f9925cb9f8491d666cc1f5d1 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syev.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syev.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen, Karl Meerbergen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -20,25 +20,25 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Eigendecomposition of a real symmetric matrix A = Q * D * Q' - // + // /////////////////////////////////////////////////////////////////// - /* + /* * syev() computes the eigendecomposition of a N x N matrix * A = Q * D * Q', where Q is a N x N orthogonal matrix and * D is a diagonal matrix. The diagonal elements D(i,i) is an @@ -52,22 +52,22 @@ namespace boost { namespace numeric { namespace bindings { * 'N' : do not compute eigenvectors * uplo : 'U' : only the upper triangular part of A is used on input. * 'L' : only the lower triangular part of A is used on input. - */ + */ namespace detail { - inline + inline void syev (char const jobz, char const uplo, int const n, float* a, int const lda, - float* w, float* work, int const lwork, int& info) + float* w, float* work, int const lwork, int& info) { LAPACK_SSYEV (&jobz, &uplo, &n, a, &lda, w, work, &lwork, &info); } - inline + inline void syev (char const jobz, char const uplo, int const n, double* a, int const lda, - double* w, double* work, int const lwork, int& info) + double* w, double* work, int const lwork, int& info) { LAPACK_DSYEV (&jobz, &uplo, &n, a, &lda, w, work, &lwork, &info); } @@ -77,31 +77,31 @@ namespace boost { namespace numeric { namespace bindings { inline int syev (char jobz, char uplo, A& a, W& w, Work& work) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<A>::matrix_structure, + typename traits::matrix_traits<A>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (a); assert ( n>0 ); - assert (traits::matrix_size2 (a)==n); - assert (traits::leading_dimension (a)>=n); - assert (traits::vector_size (w)==n); - assert (3*n-1 <= traits::vector_size (work)); + assert (traits::matrix_size2 (a)==n); + assert (traits::leading_dimension (a)>=n); + assert (traits::vector_size (w)==n); + assert (3*n-1 <= traits::vector_size (work)); assert ( uplo=='U' || uplo=='L' ); assert ( jobz=='N' || jobz=='V' ); - int info; + int info; detail::syev (jobz, uplo, n, - traits::matrix_storage (a), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (w), + traits::vector_storage (w), traits::vector_storage (work), traits::vector_size (work), info); - return info; + return info; } } // namespace detail @@ -158,7 +158,7 @@ namespace boost { namespace numeric { namespace bindings { int const n = traits::matrix_size1 (a); char uplo = traits::matrix_uplo_tag( a ) ; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename traits::matrix_traits<A>::matrix_structure matrix_structure ; BOOST_STATIC_ASSERT( (boost::mpl::or_< boost::is_same< matrix_structure, traits::symmetric_t > , boost::is_same< matrix_structure, traits::hermitian_t > @@ -179,7 +179,7 @@ namespace boost { namespace numeric { namespace bindings { int const n = traits::matrix_size1 (a); char uplo = traits::matrix_uplo_tag( a ) ; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename traits::matrix_traits<A>::matrix_structure matrix_structure ; BOOST_STATIC_ASSERT( (boost::mpl::or_< boost::is_same< matrix_structure, traits::symmetric_t > , boost::is_same< matrix_structure, traits::hermitian_t > @@ -197,7 +197,7 @@ namespace boost { namespace numeric { namespace bindings { int syev (char jobz, A& a, W& w, detail::workspace1<Work> workspace ) { typedef typename A::value_type value_type ; char uplo = traits::matrix_uplo_tag( a ) ; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename traits::matrix_traits<A>::matrix_structure matrix_structure ; BOOST_STATIC_ASSERT( (boost::mpl::or_< boost::is_same< matrix_structure, traits::symmetric_t > , boost::is_same< matrix_structure, traits::hermitian_t > @@ -212,7 +212,7 @@ namespace boost { namespace numeric { namespace bindings { inline int syev (char jobz, A& a, W& w) { char uplo = traits::matrix_uplo_tag( a ) ; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename traits::matrix_traits<A>::matrix_structure matrix_structure ; BOOST_STATIC_ASSERT( (boost::mpl::or_< boost::is_same< matrix_structure, traits::symmetric_t > , boost::is_same< matrix_structure, traits::hermitian_t > @@ -228,4 +228,4 @@ namespace boost { namespace numeric { namespace bindings { }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevd.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevd.hpp index 22db46faa27b72299d854777ad42229a5fe59487..71f5d5c93b01ac2cdb7909f33705f1c46db264cd 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevd.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevd.hpp @@ -1,4 +1,4 @@ -// +// // Copyright (c) Thomas Klimpel 2008 // // Distributed under the Boost Software License, Version 1.0. @@ -11,7 +11,7 @@ #include <boost/numeric/bindings/lapack/heevd.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { template <typename A, typename W, typename Work> @@ -19,7 +19,7 @@ namespace boost { namespace numeric { namespace bindings { char jobz, char uplo, A& a, W& w, Work work = optimal_workspace() ) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename A::value_type value_type ; typedef typename traits::type_traits< value_type >::real_type real_type ; BOOST_STATIC_ASSERT((boost::is_same<value_type, real_type>::value)); diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevx.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevx.hpp index 92a6c0469b047b63afbabb68f1b3bd2f651151a3..a29d57c1926dd6e7ab03cdc8f644910194071b4b 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevx.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevx.hpp @@ -1,4 +1,4 @@ -// +// // Copyright (c) Thomas Klimpel 2008 // // Distributed under the Boost Software License, Version 1.0. @@ -11,14 +11,14 @@ #include <boost/numeric/bindings/lapack/heevx.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { template <typename A, typename T, typename W, typename Z, typename IFail, typename Work> int syevx ( char jobz, char range, A& a, T vl, T vu, int il, int iu, T abstol, int& m, W& w, Z& z, IFail& ifail, Work work = optimal_workspace() ) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename A::value_type value_type ; typedef typename traits::type_traits< value_type >::real_type real_type ; BOOST_STATIC_ASSERT((boost::is_same<value_type, real_type>::value)); diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sygv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sygv.hpp index 16940ed6aa1967ceac9f8ed0af1de0ea6e57b097..ab85a55ec0f05de6c754a0cf5ca198e7532a8884 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sygv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sygv.hpp @@ -11,13 +11,13 @@ #include <boost/numeric/bindings/lapack/hegv.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { template <typename A, typename B, typename W, typename Work> int sygv (int itype, char jobz, char uplo, A& a, B& b, W& w, Work work = optimal_workspace()) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK typedef typename A::value_type value_type ; typedef typename traits::type_traits< value_type >::real_type real_type ; BOOST_STATIC_ASSERT((boost::is_same<value_type, real_type>::value)); diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sysv.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sysv.hpp index 7c4bce71e047b8197c565811db2dc6cfdaab9647..7891a0bb73ea6f6a538d47ea043526a2e7b33bfb 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sysv.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sysv.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -23,14 +23,14 @@ #include <boost/numeric/bindings/lapack/workspace.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif #include <cassert> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { @@ -42,111 +42,111 @@ namespace boost { namespace numeric { namespace bindings { namespace detail { - inline - int sytrf_block (float, int const ispec, char const ul, int const n) + inline + int sytrf_block (float, int const ispec, char const ul, int const n) { - char ul2[2] = "x"; ul2[0] = ul; - return ilaenv (ispec, "SSYTRF", ul2, n); + char ul2[2] = "x"; ul2[0] = ul; + return ilaenv (ispec, "SSYTRF", ul2, n); } - inline + inline int sytrf_block (double, int const ispec, char const ul, int const n) { - char ul2[2] = "x"; ul2[0] = ul; - return ilaenv (ispec, "DSYTRF", ul2, n); + char ul2[2] = "x"; ul2[0] = ul; + return ilaenv (ispec, "DSYTRF", ul2, n); } - inline - int sytrf_block (traits::complex_f, - int const ispec, char const ul, int const n) + inline + int sytrf_block (traits::complex_f, + int const ispec, char const ul, int const n) { - char ul2[2] = "x"; ul2[0] = ul; - return ilaenv (ispec, "CSYTRF", ul2, n); + char ul2[2] = "x"; ul2[0] = ul; + return ilaenv (ispec, "CSYTRF", ul2, n); } - inline - int sytrf_block (traits::complex_d, - int const ispec, char const ul, int const n) + inline + int sytrf_block (traits::complex_d, + int const ispec, char const ul, int const n) { - char ul2[2] = "x"; ul2[0] = ul; - return ilaenv (ispec, "ZSYTRF", ul2, n); + char ul2[2] = "x"; ul2[0] = ul; + return ilaenv (ispec, "ZSYTRF", ul2, n); } } template <typename SymmA> inline - int sytrf_block (char const q, char const ul, SymmA const& a) + int sytrf_block (char const q, char const ul, SymmA const& a) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); #endif - assert (q == 'O' || q == 'M'); - assert (ul == 'U' || ul == 'L'); + assert (q == 'O' || q == 'M'); + assert (ul == 'U' || ul == 'L'); - int n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + int n = traits::matrix_size1 (a); + assert (n == traits::matrix_size2 (a)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmA>::value_type val_t; -#else - typedef typename SymmA::value_type val_t; -#endif - int ispec = (q == 'O' ? 1 : 2); - return detail::sytrf_block (val_t(), ispec, ul, n); + typedef typename traits::matrix_traits<SymmA>::value_type val_t; +#else + typedef typename SymmA::value_type val_t; +#endif + int ispec = (q == 'O' ? 1 : 2); + return detail::sytrf_block (val_t(), ispec, ul, n); } template <typename SymmA> inline - int sytrf_block (char const q, SymmA const& a) + int sytrf_block (char const q, SymmA const& a) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t >::value)); #endif - assert (q == 'O' || q == 'M'); + assert (q == 'O' || q == 'M'); char ul = traits::matrix_uplo_tag (a); - int n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + int n = traits::matrix_size1 (a); + assert (n == traits::matrix_size2 (a)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmA>::value_type val_t; -#else - typedef typename SymmA::value_type val_t; -#endif - int ispec = (q == 'O' ? 1 : 2); - return detail::sytrf_block (val_t(), ispec, ul, n); + typedef typename traits::matrix_traits<SymmA>::value_type val_t; +#else + typedef typename SymmA::value_type val_t; +#endif + int ispec = (q == 'O' ? 1 : 2); + return detail::sytrf_block (val_t(), ispec, ul, n); } template <typename SymmA> inline - int sytrf_work (char const q, char const ul, SymmA const& a) + int sytrf_work (char const q, char const ul, SymmA const& a) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); #endif - assert (q == 'O' || q == 'M'); - assert (ul == 'U' || ul == 'L'); + assert (q == 'O' || q == 'M'); + assert (ul == 'U' || ul == 'L'); - int n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + int n = traits::matrix_size1 (a); + assert (n == traits::matrix_size2 (a)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmA>::value_type val_t; -#else - typedef typename SymmA::value_type val_t; -#endif - int lw = -13; - if (q == 'M') + typedef typename traits::matrix_traits<SymmA>::value_type val_t; +#else + typedef typename SymmA::value_type val_t; +#endif + int lw = -13; + if (q == 'M') lw = 1; - if (q == 'O') - lw = n * detail::sytrf_block (val_t(), 1, ul, n); - return lw; + if (q == 'O') + lw = n * detail::sytrf_block (val_t(), 1, ul, n); + return lw; } template <typename SymmA> @@ -155,34 +155,34 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t >::value)); #endif - assert (q == 'O' || q == 'M'); + assert (q == 'O' || q == 'M'); char ul = traits::matrix_uplo_tag (a); - int n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + int n = traits::matrix_size1 (a); + assert (n == traits::matrix_size2 (a)); #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmA>::value_type val_t; -#else - typedef typename SymmA::value_type val_t; -#endif - int lw = -13; - if (q == 'M') + typedef typename traits::matrix_traits<SymmA>::value_type val_t; +#else + typedef typename SymmA::value_type val_t; +#endif + int lw = -13; + if (q == 'M') lw = 1; - if (q == 'O') - lw = n * detail::sytrf_block (val_t(), 1, ul, n); - return lw; + if (q == 'O') + lw = n * detail::sytrf_block (val_t(), 1, ul, n); + return lw; } template <typename SymmA> inline int sysv_work (char const q, char const ul, SymmA const& a) { - return sytrf_work (q, ul, a); + return sytrf_work (q, ul, a); } template <typename SymmA> @@ -191,108 +191,108 @@ namespace boost { namespace numeric { namespace bindings { /* - * sysv() computes the solution to a system of linear equations - * A * X = B, where A is an N-by-N symmetric matrix and X and B + * sysv() computes the solution to a system of linear equations + * A * X = B, where A is an N-by-N symmetric matrix and X and B * are N-by-NRHS matrices. * * The diagonal pivoting method is used to factor A as - * A = U * D * U^T, if UPLO = 'U', + * A = U * D * U^T, if UPLO = 'U', * A = L * D * L^T, if UPLO = 'L', - * where U (or L) is a product of permutation and unit upper - * (lower) triangular matrices, and D is symmetric and block - * diagonal with 1-by-1 and 2-by-2 diagonal blocks. - * The factored form of A is then used to solve the system + * where U (or L) is a product of permutation and unit upper + * (lower) triangular matrices, and D is symmetric and block + * diagonal with 1-by-1 and 2-by-2 diagonal blocks. + * The factored form of A is then used to solve the system * of equations A * X = B. */ - namespace detail + namespace detail { - inline + inline void sysv (char const uplo, int const n, int const nrhs, - float* a, int const lda, int* ipiv, - float* b, int const ldb, - float* w, int const lw, int* info) + float* a, int const lda, int* ipiv, + float* b, int const ldb, + float* w, int const lw, int* info) { LAPACK_SSYSV (&uplo, &n, &nrhs, a, &lda, ipiv, b, &ldb, w, &lw, info); } - inline + inline void sysv (char const uplo, int const n, int const nrhs, - double* a, int const lda, int* ipiv, - double* b, int const ldb, - double* w, int const lw, int* info) + double* a, int const lda, int* ipiv, + double* b, int const ldb, + double* w, int const lw, int* info) { LAPACK_DSYSV (&uplo, &n, &nrhs, a, &lda, ipiv, b, &ldb, w, &lw, info); } - inline + inline void sysv (char const uplo, int const n, int const nrhs, - traits::complex_f* a, int const lda, int* ipiv, - traits::complex_f* b, int const ldb, - traits::complex_f* w, int const lw, int* info) + traits::complex_f* a, int const lda, int* ipiv, + traits::complex_f* b, int const ldb, + traits::complex_f* w, int const lw, int* info) { - LAPACK_CSYSV (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, - traits::complex_ptr (b), &ldb, + LAPACK_CSYSV (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, + traits::complex_ptr (b), &ldb, traits::complex_ptr (w), &lw, info); } - inline + inline void sysv (char const uplo, int const n, int const nrhs, - traits::complex_d* a, int const lda, int* ipiv, - traits::complex_d* b, int const ldb, - traits::complex_d* w, int const lw, int* info) + traits::complex_d* a, int const lda, int* ipiv, + traits::complex_d* b, int const ldb, + traits::complex_d* w, int const lw, int* info) { - LAPACK_ZSYSV (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, - traits::complex_ptr (b), &ldb, + LAPACK_ZSYSV (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, + traits::complex_ptr (b), &ldb, traits::complex_ptr (w), &lw, info); } template <typename SymmA, typename MatrB, typename IVec, typename Work> inline - int sysv (char const ul, SymmA& a, IVec& i, MatrB& b, Work& w) + int sysv (char const ul, SymmA& a, IVec& i, MatrB& b, Work& w) { int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (i)); - int info; - sysv (ul, n, traits::matrix_size2 (b), - traits::matrix_storage (a), + int info; + sysv (ul, n, traits::matrix_size2 (b), + traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (i), + traits::vector_storage (i), traits::matrix_storage (b), traits::leading_dimension (b), - traits::vector_storage (w), - traits::vector_size (w), + traits::vector_storage (w), + traits::vector_size (w), &info); - return info; + return info; } } template <typename SymmA, typename MatrB, typename IVec, typename Work> inline - int sysv (char const ul, SymmA& a, IVec& i, MatrB& b, Work& w) + int sysv (char const ul, SymmA& a, IVec& i, MatrB& b, Work& w) { - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - assert (traits::vector_size (w) >= 1); - return detail::sysv (ul, a, i, b, w); + assert (traits::vector_size (w) >= 1); + return detail::sysv (ul, a, i, b, w); } template <typename SymmA, typename MatrB, typename IVec, typename Work> @@ -301,143 +301,143 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - assert (traits::vector_size (w) >= 1); + assert (traits::vector_size (w) >= 1); char uplo = traits::matrix_uplo_tag (a); - return detail::sysv (uplo, a, i, b, w); + return detail::sysv (uplo, a, i, b, w); } template <typename SymmA, typename MatrB> inline - int sysv (char const ul, SymmA& a, MatrB& b) + int sysv (char const ul, SymmA& a, MatrB& b) { - // with 'internal' pivot and work vectors + // with 'internal' pivot and work vectors - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - int const n = traits::matrix_size1 (a); - int info = -101; - traits::detail::array<int> i (n); + int const n = traits::matrix_size1 (a); + int info = -101; + traits::detail::array<int> i (n); if (i.valid()) { - info = -102; - int lw = sytrf_work ('O', ul, a); - assert (lw >= 1); // paranoia ? + info = -102; + int lw = sytrf_work ('O', ul, a); + assert (lw >= 1); // paranoia ? #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmA>::value_type val_t; -#else - typedef typename SymmA::value_type val_t; -#endif - traits::detail::array<val_t> w (lw); - if (w.valid()) - info = detail::sysv (ul, a, i, b, w); + typedef typename traits::matrix_traits<SymmA>::value_type val_t; +#else + typedef typename SymmA::value_type val_t; +#endif + traits::detail::array<val_t> w (lw); + if (w.valid()) + info = detail::sysv (ul, a, i, b, w); } - return info; + return info; } template <typename SymmA, typename MatrB> inline - int sysv (SymmA& a, MatrB& b) + int sysv (SymmA& a, MatrB& b) { - // with 'internal' pivot and work vectors + // with 'internal' pivot and work vectors #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - int const n = traits::matrix_size1 (a); + int const n = traits::matrix_size1 (a); char uplo = traits::matrix_uplo_tag (a); - int info = -101; - traits::detail::array<int> i (n); + int info = -101; + traits::detail::array<int> i (n); if (i.valid()) { - info = -102; - int lw = sytrf_work ('O', a); - assert (lw >= 1); // paranoia ? + info = -102; + int lw = sytrf_work ('O', a); + assert (lw >= 1); // paranoia ? #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmA>::value_type val_t; -#else - typedef typename SymmA::value_type val_t; -#endif - traits::detail::array<val_t> w (lw); - if (w.valid()) - info = detail::sysv (uplo, a, i, b, w); + typedef typename traits::matrix_traits<SymmA>::value_type val_t; +#else + typedef typename SymmA::value_type val_t; +#endif + traits::detail::array<val_t> w (lw); + if (w.valid()) + info = detail::sysv (uplo, a, i, b, w); } - return info; + return info; } /* * sytrf() computes the factorization of a symmetric matrix A using - * the Bunch-Kaufman diagonal pivoting method. The form of the + * the Bunch-Kaufman diagonal pivoting method. The form of the * factorization is * A = U * D * U^T or A = L * D * L^T - * where U (or L) is a product of permutation and unit upper (lower) - * triangular matrices, and D is symmetric and block diagonal with + * where U (or L) is a product of permutation and unit upper (lower) + * triangular matrices, and D is symmetric and block diagonal with * 1-by-1 and 2-by-2 diagonal blocks. */ - namespace detail + namespace detail { - inline - void sytrf (char const uplo, int const n, - float* a, int const lda, int* ipiv, - float* w, int const lw, int* info) + inline + void sytrf (char const uplo, int const n, + float* a, int const lda, int* ipiv, + float* w, int const lw, int* info) { LAPACK_SSYTRF (&uplo, &n, a, &lda, ipiv, w, &lw, info); } - inline - void sytrf (char const uplo, int const n, - double* a, int const lda, int* ipiv, - double* w, int const lw, int* info) + inline + void sytrf (char const uplo, int const n, + double* a, int const lda, int* ipiv, + double* w, int const lw, int* info) { LAPACK_DSYTRF (&uplo, &n, a, &lda, ipiv, w, &lw, info); } - inline - void sytrf (char const uplo, int const n, - traits::complex_f* a, int const lda, int* ipiv, - traits::complex_f* w, int const lw, int* info) + inline + void sytrf (char const uplo, int const n, + traits::complex_f* a, int const lda, int* ipiv, + traits::complex_f* w, int const lw, int* info) { - LAPACK_CSYTRF (&uplo, &n, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_CSYTRF (&uplo, &n, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (w), &lw, info); } - inline - void sytrf (char const uplo, int const n, - traits::complex_d* a, int const lda, int* ipiv, - traits::complex_d* w, int const lw, int* info) + inline + void sytrf (char const uplo, int const n, + traits::complex_d* a, int const lda, int* ipiv, + traits::complex_d* w, int const lw, int* info) { - LAPACK_ZSYTRF (&uplo, &n, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_ZSYTRF (&uplo, &n, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (w), &lw, info); } @@ -446,156 +446,156 @@ namespace boost { namespace numeric { namespace bindings { int sytrf (char const ul, SymmA& a, IVec& i, Work& w) { int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::vector_size (i)); - int info; - sytrf (ul, n, traits::matrix_storage (a), + int info; + sytrf (ul, n, traits::matrix_storage (a), traits::leading_dimension (a), - traits::vector_storage (i), - traits::vector_storage (w), - traits::vector_size (w), + traits::vector_storage (i), + traits::vector_storage (w), + traits::vector_size (w), &info); - return info; + return info; } } template <typename SymmA, typename IVec, typename Work> inline - int sytrf (char const ul, SymmA& a, IVec& i, Work& w) + int sytrf (char const ul, SymmA& a, IVec& i, Work& w) { - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); #endif - assert (traits::vector_size (w) >= 1); - return detail::sytrf (ul, a, i, w); + assert (traits::vector_size (w) >= 1); + return detail::sytrf (ul, a, i, w); } template <typename SymmA, typename IVec, typename Work> inline - int sytrf (SymmA& a, IVec& i, Work& w) + int sytrf (SymmA& a, IVec& i, Work& w) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t >::value)); #endif - assert (traits::vector_size (w) >= 1); + assert (traits::vector_size (w) >= 1); char uplo = traits::matrix_uplo_tag (a); - return detail::sytrf (uplo, a, i, w); + return detail::sytrf (uplo, a, i, w); } template <typename SymmA, typename Ivec> inline - int sytrf (char const ul, SymmA& a, Ivec& i) + int sytrf (char const ul, SymmA& a, Ivec& i) { // with 'internal' work vector - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); #endif - int info = -101; - int lw = sytrf_work ('O', ul, a); - assert (lw >= 1); // paranoia ? + int info = -101; + int lw = sytrf_work ('O', ul, a); + assert (lw >= 1); // paranoia ? #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmA>::value_type val_t; -#else - typedef typename SymmA::value_type val_t; -#endif - traits::detail::array<val_t> w (lw); - if (w.valid()) - info = detail::sytrf (ul, a, i, w); - return info; + typedef typename traits::matrix_traits<SymmA>::value_type val_t; +#else + typedef typename SymmA::value_type val_t; +#endif + traits::detail::array<val_t> w (lw); + if (w.valid()) + info = detail::sytrf (ul, a, i, w); + return info; } template <typename SymmA, typename Ivec> inline - int sytrf (SymmA& a, Ivec& i) + int sytrf (SymmA& a, Ivec& i) { - // with 'internal' work vector + // with 'internal' work vector #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t >::value)); #endif char uplo = traits::matrix_uplo_tag (a); - int info = -101; - int lw = sytrf_work ('O', a); - assert (lw >= 1); // paranoia ? + int info = -101; + int lw = sytrf_work ('O', a); + assert (lw >= 1); // paranoia ? #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef typename traits::matrix_traits<SymmA>::value_type val_t; -#else - typedef typename SymmA::value_type val_t; -#endif - traits::detail::array<val_t> w (lw); - if (w.valid()) - info = detail::sytrf (uplo, a, i, w); - return info; + typedef typename traits::matrix_traits<SymmA>::value_type val_t; +#else + typedef typename SymmA::value_type val_t; +#endif + traits::detail::array<val_t> w (lw); + if (w.valid()) + info = detail::sytrf (uplo, a, i, w); + return info; } /* - * sytrs() solves a system of linear equations A*X = B with - * a symmetric matrix A using the factorization + * sytrs() solves a system of linear equations A*X = B with + * a symmetric matrix A using the factorization * A = U * D * U^T or A = L * D * L^T * computed by sytrf(). */ namespace detail { - inline + inline void sytrs (char const uplo, int const n, int const nrhs, - float const* a, int const lda, int const* ipiv, - float* b, int const ldb, int* info) + float const* a, int const lda, int const* ipiv, + float* b, int const ldb, int* info) { LAPACK_SSYTRS (&uplo, &n, &nrhs, a, &lda, ipiv, b, &ldb, info); } - inline + inline void sytrs (char const uplo, int const n, int const nrhs, - double const* a, int const lda, int const* ipiv, - double* b, int const ldb, int* info) + double const* a, int const lda, int const* ipiv, + double* b, int const ldb, int* info) { LAPACK_DSYTRS (&uplo, &n, &nrhs, a, &lda, ipiv, b, &ldb, info); } - inline + inline void sytrs (char const uplo, int const n, int const nrhs, - traits::complex_f const* a, int const lda, - int const* ipiv, - traits::complex_f* b, int const ldb, int* info) + traits::complex_f const* a, int const lda, + int const* ipiv, + traits::complex_f* b, int const ldb, int* info) { - LAPACK_CSYTRS (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_CSYTRS (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (b), &ldb, info); } - inline + inline void sytrs (char const uplo, int const n, int const nrhs, - traits::complex_d const* a, int const lda, - int const* ipiv, - traits::complex_d* b, int const ldb, int* info) + traits::complex_d const* a, int const lda, + int const* ipiv, + traits::complex_d* b, int const ldb, int* info) { - LAPACK_ZSYTRS (&uplo, &n, &nrhs, - traits::complex_ptr (a), &lda, ipiv, + LAPACK_ZSYTRS (&uplo, &n, &nrhs, + traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (b), &ldb, info); } @@ -604,26 +604,26 @@ namespace boost { namespace numeric { namespace bindings { int sytrs (char const ul, SymmA const& a, IVec const& i, MatrB& b) { int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); - assert (n == traits::matrix_size1 (b)); - assert (n == traits::vector_size (i)); + assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size1 (b)); + assert (n == traits::vector_size (i)); - int info; - sytrs (ul, n, traits::matrix_size2 (b), + int info; + sytrs (ul, n, traits::matrix_size2 (b), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::matrix_storage (a), + traits::matrix_storage (a), #else - traits::matrix_storage_const (a), -#endif + traits::matrix_storage_const (a), +#endif traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (i), + traits::vector_storage (i), #else - traits::vector_storage_const (i), + traits::vector_storage_const (i), #endif traits::matrix_storage (b), traits::leading_dimension (b), &info); - return info; + return info; } } @@ -632,20 +632,20 @@ namespace boost { namespace numeric { namespace bindings { inline int sytrs (char const ul, SymmA const& a, IVec const& i, MatrB& b) { - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif - return detail::sytrs (ul, a, i, b); + return detail::sytrs (ul, a, i, b); } template <typename SymmA, typename MatrB, typename IVec> @@ -654,48 +654,48 @@ namespace boost { namespace numeric { namespace bindings { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrB>::matrix_structure, + typename traits::matrix_traits<MatrB>::matrix_structure, traits::general_t >::value)); #endif char uplo = traits::matrix_uplo_tag (a); - return detail::sytrs (uplo, a, i, b); + return detail::sytrs (uplo, a, i, b); } - namespace detail + namespace detail { - inline - void sytri (char const uplo, int const n, float* a, int const lda, - int const* ipiv, float* work, int* info) + inline + void sytri (char const uplo, int const n, float* a, int const lda, + int const* ipiv, float* work, int* info) { LAPACK_SSYTRI (&uplo, &n, a, &lda, ipiv, work, info); } - inline - void sytri (char const uplo, int const n, double* a, int const lda, - int const* ipiv, double* work, int* info) + inline + void sytri (char const uplo, int const n, double* a, int const lda, + int const* ipiv, double* work, int* info) { LAPACK_DSYTRI (&uplo, &n, a, &lda, ipiv, work, info); } - inline - void sytri (char const uplo, int const n, traits::complex_f* a, - int const lda, int const* ipiv, traits::complex_f* work, int* info) + inline + void sytri (char const uplo, int const n, traits::complex_f* a, + int const lda, int const* ipiv, traits::complex_f* work, int* info) { - LAPACK_CSYTRI (&uplo, &n, traits::complex_ptr (a), &lda, ipiv, + LAPACK_CSYTRI (&uplo, &n, traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (work), info); } - inline - void sytri (char const uplo, int const n, traits::complex_d* a, - int const lda, int const* ipiv, traits::complex_d* work, int* info) + inline + void sytri (char const uplo, int const n, traits::complex_d* a, + int const lda, int const* ipiv, traits::complex_d* work, int* info) { LAPACK_ZSYTRI (&uplo, &n, traits::complex_ptr (a), &lda, ipiv, traits::complex_ptr (work), info); @@ -703,23 +703,23 @@ namespace boost { namespace numeric { namespace bindings { template <typename SymmA, typename IVec, typename Work> inline - int sytri (char const ul, SymmA& a, IVec const& ipiv, Work& work) + int sytri (char const ul, SymmA& a, IVec const& ipiv, Work& work) { - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); int const n = traits::matrix_size1 (a); - assert (n == traits::matrix_size2 (a)); + assert (n == traits::matrix_size2 (a)); assert (n == traits::vector_size (ipiv)); assert (n == traits::vector_size (work)); int info; //const double* dummy = traits::matrix_storage (a); - detail::sytri (ul, n, traits::matrix_storage (a), + detail::sytri (ul, n, traits::matrix_storage (a), traits::leading_dimension (a), #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - traits::vector_storage (ipiv), + traits::vector_storage (ipiv), #else - traits::vector_storage_const (ipiv), + traits::vector_storage_const (ipiv), #endif traits::vector_storage (work), &info); @@ -732,13 +732,13 @@ namespace boost { namespace numeric { namespace bindings { //Internal allocation of workspace, general matrix with up/low tag template <typename SymmA, typename IVec> inline - int sytri (char const ul, SymmA& a, IVec const& ipiv) + int sytri (char const ul, SymmA& a, IVec const& ipiv) { - assert (ul == 'U' || ul == 'L'); + assert (ul == 'U' || ul == 'L'); #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::general_t >::value)); #endif @@ -747,26 +747,26 @@ namespace boost { namespace numeric { namespace bindings { int n = traits::matrix_size1(a); traits::detail::array<value_type> work(std::max<int>(1,n)); - return detail::sytri (ul, a, ipiv, work); + return detail::sytri (ul, a, ipiv, work); } //Internal allocation of workspace, symmetric matrix - /*Warning: the function will work only if SymmA is a + /*Warning: the function will work only if SymmA is a symmetric_adaptor. With SymmA = symmetric_matrix a boost::STATIC_ASSERTION_FAILURE will be thrown at compile - time, because symmetric_matrix has a symmetric_packed_t + time, because symmetric_matrix has a symmetric_packed_t structure instead of symmetric_t. Use sptri() for symmetric packed matrices. - */ + */ template <typename SymmA, typename IVec> inline - int sytri (SymmA& a, IVec const& ipiv) + int sytri (SymmA& a, IVec const& ipiv) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<SymmA>::matrix_structure, + typename traits::matrix_traits<SymmA>::matrix_structure, traits::symmetric_t >::value)); #endif @@ -776,11 +776,11 @@ namespace boost { namespace numeric { namespace bindings { traits::detail::array<value_type> work(std::max<int>(1,n)); char uplo = traits::matrix_uplo_tag (a); - return detail::sytri (uplo, a, ipiv, work); - } + return detail::sytri (uplo, a, ipiv, work); + } } // namespace lapack }}} // namespace boost::numeric::bindings -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sytrd.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sytrd.hpp index 25d7bf72e96df654b8e6a059f079011f5d38d553..6e37723054eb3fc7d28d9cae7f231433fa6cc5bd 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sytrd.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/sytrd.hpp @@ -1,8 +1,8 @@ // // Copyright Karl Meerbergen 2007 // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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) // @@ -17,10 +17,10 @@ #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/numeric/bindings/lapack/lapack.h> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/is_same.hpp> -#endif +#endif /********************************************************************/ @@ -34,14 +34,14 @@ namespace boost { namespace numeric { namespace bindings { namespace lapack { namespace detail { - inline - void sytrd ( char uplo, int n, float* a, int lda, float* d, float* e, float* tau, float* work, int lwork, int& info ) + inline + void sytrd ( char uplo, int n, float* a, int lda, float* d, float* e, float* tau, float* work, int lwork, int& info ) { LAPACK_SSYTRD( &uplo, &n, a, &lda, d, e, tau, work, &lwork, &info ) ; } - inline - void sytrd ( char uplo, int n, double* a, int lda, double* d, double* e, double* tau, double* work, int lwork, int& info ) + inline + void sytrd ( char uplo, int n, double* a, int lda, double* d, double* e, double* tau, double* work, int lwork, int& info ) { LAPACK_DSYTRD( &uplo, &n, a, &lda, d, e, tau, work, &lwork, &info ) ; } @@ -63,29 +63,29 @@ namespace boost { namespace numeric { namespace bindings { namespace lapack { int lwork = traits::vector_size( work ) ; assert( lwork >= 1 ); - int info; + int info; detail::sytrd( uplo, n, - traits::matrix_storage( a ), - traits::leading_dimension( a ), - traits::vector_storage( d ), - traits::vector_storage( e ), - traits::vector_storage( tau ), + traits::matrix_storage( a ), + traits::leading_dimension( a ), + traits::vector_storage( d ), + traits::vector_storage( e ), + traits::vector_storage( tau ), traits::vector_storage( work ), lwork, info ) ; - return info; + return info; } // sytrd() template <typename A, typename D, typename E, typename Tau> inline int sytrd( char uplo, A& a, D& d, E& e, Tau& tau, optimal_workspace=optimal_workspace() ) { - int info; + int info; detail::sytrd( uplo, traits::matrix_size1( a ), - traits::matrix_storage( a ), - traits::leading_dimension( a ), - traits::vector_storage( d ), - traits::vector_storage( e ), - traits::vector_storage( tau ), + traits::matrix_storage( a ), + traits::leading_dimension( a ), + traits::vector_storage( d ), + traits::vector_storage( e ), + traits::vector_storage( tau ), traits::vector_storage( tau ), -1, info ) ; if (info) return info ; diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/trevc.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/trevc.hpp index f89914811a4570423ab1c2cfa2b91aa82000d324..8c2f12b0de945fea981c8a872342042e9db09301 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/trevc.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/trevc.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -21,58 +21,58 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Compute eigenvectors of Schur matrix (computed by gees). - // + // /////////////////////////////////////////////////////////////////// - /* + /* * trevc() computes the eigenvectors using the Schur factorization * * Let A = U * S * herm(U), then trecv computes the eigenvectors of * S, and may optionally apply them to U. * * To compute the Schur factorization, see gees. - */ + */ namespace detail { - inline + inline void trevc (char const side, char const howmny, const logical_t* select, int const n, float* t, int const ldt, float* vl, int const ldvl, float* vr, int const ldvr, - int const mm, int& m, float* work, int& info) + int const mm, int& m, float* work, int& info) { LAPACK_STREVC (&side, &howmny, select, &n, t, &ldt, vl, &ldvl, vr, &ldvr, &mm, &m, work, &info); } - inline + inline void trevc (char const side, char const howmny, const logical_t* select, int const n, double* t, int const ldt, double* vl, int const ldvl, double* vr, int const ldvr, - int const mm, int& m, double* work, int& info) + int const mm, int& m, double* work, int& info) { LAPACK_DTREVC (&side, &howmny, select, &n, t, &ldt, vl, &ldvl, vr, &ldvr, &mm, &m, work, &info); } - inline + inline void trevc (char const side, char const howmny, const logical_t* select, int const n, traits::complex_f* t, int const ldt, traits::complex_f* vl, int const ldvl, traits::complex_f* vr, int const ldvr, - int const mm, int& m, traits::complex_f* work, int& info) + int const mm, int& m, traits::complex_f* work, int& info) { LAPACK_CTREVC (&side, &howmny, select, &n, traits::complex_ptr(t), &ldt, traits::complex_ptr(vl), &ldvl, traits::complex_ptr(vr), &ldvr, &mm, &m, traits::complex_ptr(work+n), traits::complex_ptr(work), &info); } - inline + inline void trevc (char const side, char const howmny, const logical_t* select, int const n, traits::complex_d* t, int const ldt, traits::complex_d* vl, int const ldvl, traits::complex_d* vr, int const ldvr, int const mm, int& m, traits::complex_d* work, int& info) @@ -82,43 +82,43 @@ namespace boost { namespace numeric { namespace bindings { &mm, &m, traits::complex_ptr(work+n), traits::complex_ptr(work), &info); } - } + } // Compute Schur factorization with Schur vectors template <typename MatrT, typename VL, typename VR, typename Work> inline int trevc (char const side, char const howmny, MatrT& t, VL& vl, VR& vr, Work& work) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrT>::matrix_structure, + typename traits::matrix_traits<MatrT>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<VL>::matrix_structure, + typename traits::matrix_traits<VL>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<VR>::matrix_structure, + typename traits::matrix_traits<VR>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (t); - assert (n == traits::matrix_size2 (t)); - assert (n == traits::matrix_size1 (vl)); - assert (n == traits::matrix_size2 (vl)); - assert (n == traits::matrix_size1 (vr)); - assert (n == traits::matrix_size2 (vr)); - assert (3*n <= traits::vector_size (work)); + assert (n == traits::matrix_size2 (t)); + assert (n == traits::matrix_size1 (vl)); + assert (n == traits::matrix_size2 (vl)); + assert (n == traits::matrix_size1 (vr)); + assert (n == traits::matrix_size2 (vr)); + assert (3*n <= traits::vector_size (work)); logical_t* select=0; int mm=n; int m; - int info; + int info; detail::trevc (side, howmny, select, n, - traits::matrix_storage (t), + traits::matrix_storage (t), traits::leading_dimension (t), traits::matrix_storage (vl), traits::leading_dimension (vl), @@ -128,11 +128,11 @@ namespace boost { namespace numeric { namespace bindings { m, traits::vector_storage (work), info); - return info; + return info; } } }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/trexc.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/trexc.hpp index f64875a38a2693893e4505fbde636d7eaf69003c..6e5f24601d82290bbd9cb2426289313c90c4c53c 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/trexc.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/trexc.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Toon Knapen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -21,39 +21,39 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> // #include <boost/numeric/bindings/traits/std_vector.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> -#endif +#endif -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace lapack { /////////////////////////////////////////////////////////////////// // // Reorder the Schur factorization of a matrix. - // + // /////////////////////////////////////////////////////////////////// - /* + /* * trexc() reorders the Schur factorization of a matrix * A = Q*T*Q**T, so that the diagonal block of T with row * index IFST is moved to row ILST. - */ + */ namespace detail { - inline + inline int trexc_work_size( int const n, float ) {return n;} - inline + inline int trexc_work_size( int const n, double ) {return n;} - inline + inline int trexc_work_size( int const n, traits::complex_f ) {return 0;} - inline + inline int trexc_work_size( int const n, traits::complex_d ) {return 0;} } @@ -64,76 +64,76 @@ namespace boost { namespace numeric { namespace bindings { } namespace detail { - inline + inline void trexc (char const compq, int const n, float* t, int const ldt, float* q, int const ldq, int& ifst, int& ilst, - float* work, int& info) + float* work, int& info) { LAPACK_STREXC (&compq, &n, t, &ldt, q, &ldq, &ifst, &ilst, work, &info); } - inline + inline void trexc (char const compq, int const n, double* t, int const ldt, double* q, int const ldq, int& ifst, int& ilst, - double* work, int& info) + double* work, int& info) { LAPACK_DTREXC (&compq, &n, t, &ldt, q, &ldq, &ifst, &ilst, work, &info); } - inline + inline void trexc (char const compq, int const n, traits::complex_f* t, int const ldt, traits::complex_f* q, int const ldq, int& ifst, int& ilst, - float* work, int& info) + float* work, int& info) { LAPACK_CTREXC (&compq, &n, traits::complex_ptr(t), &ldt, traits::complex_ptr(q), &ldq, &ifst, &ilst, &info); } - inline + inline void trexc (char const compq, int const n, traits::complex_d* t, int const ldt, traits::complex_d* q, int const ldq, int& ifst, int& ilst, - double* work, int& info) + double* work, int& info) { LAPACK_ZTREXC (&compq, &n, traits::complex_ptr(t), &ldt, traits::complex_ptr(q), &ldq, &ifst, &ilst, &info); } - } + } // Reorder Schur factorization with Schur vectors template <typename MatrT, typename Q, typename Work> inline int trexc (char const compq, MatrT& t, Q& q, int& ifst, int& ilst, Work& work) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<MatrT>::matrix_structure, + typename traits::matrix_traits<MatrT>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< - typename traits::matrix_traits<Q>::matrix_structure, + typename traits::matrix_traits<Q>::matrix_structure, traits::general_t - >::value)); -#endif + >::value)); +#endif int const n = traits::matrix_size1 (t); - assert (n == traits::matrix_size2 (t)); - assert (n == traits::matrix_size1 (q)); - assert (n == traits::matrix_size2 (q)); - assert (trexc_work_size(t) <= traits::vector_size (work)); + assert (n == traits::matrix_size2 (t)); + assert (n == traits::matrix_size1 (q)); + assert (n == traits::matrix_size2 (q)); + assert (trexc_work_size(t) <= traits::vector_size (work)); - int info; + int info; detail::trexc (compq, n, - traits::matrix_storage (t), + traits::matrix_storage (t), traits::leading_dimension (t), traits::matrix_storage (q), traits::leading_dimension (q), ifst, ilst, traits::vector_storage (work), info); - return info; + return info; } } }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/workspace.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/workspace.hpp index 7dde4c2bdf116616ff7120366ff45efc74519515..994db8a495a04ad402946691203ca579a96d46dc 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/workspace.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/lapack/workspace.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Karl Meerbergen & Kresimir Fresl 2003 * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -20,7 +20,7 @@ #include <boost/numeric/bindings/traits/vector_traits.hpp> #include <memory> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { /* * Organization of workspace in Lapack. diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp index 72077b84230542e27eaf3179b9a03dbb96ef43f8..829e41ab34cd8331f0352719d006f52215f853ab 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp @@ -9,7 +9,7 @@ This version of MUMPS is provided to you free of charge. It is public domain, based on public domain software developed during the Esprit IV - European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL. + European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL. Since this first public domain version in 1999, the developments are supported by the following institutions: CERFACS, ENSEEIHT-IRIT, and INRIA. @@ -68,7 +68,7 @@ typedef struct CMUMPS_INT icntl[40]; CMUMPS_DOUBLE2 cntl[5]; CMUMPS_INT n; - + CMUMPS_INT nz_alloc; /* used in matlab interface to decide if we free + malloc when we have large variation */ diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp index ebde12378418bbfe8bd5c97212042d0483d095ae..691b858f8de132cd87981b0961ba438ab5aaea9a 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp @@ -9,7 +9,7 @@ This version of MUMPS is provided to you free of charge. It is public domain, based on public domain software developed during the Esprit IV - European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL. + European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL. Since this first public domain version in 1999, the developments are supported by the following institutions: CERFACS, ENSEEIHT-IRIT, and INRIA. @@ -67,7 +67,7 @@ typedef struct DMUMPS_INT icntl[40]; DMUMPS_DOUBLE2 cntl[5]; DMUMPS_INT n; - + DMUMPS_INT nz_alloc; /* used in matlab interface to decide if we free + malloc when we have large variation */ @@ -111,7 +111,7 @@ typedef struct #define MUMPS_CALL #if defined(_WIN32) -/* +/* * Next line May be needed depending on your Windows environment: * #define MUMPS_CALL __stdcall */ diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/smumps_c.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/smumps_c.hpp index 41212e2f0906572cdd6cdd215a1006e4f4d8770e..3592c0eb6d74a211e4565dd8d17cbb1f73b52f29 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/smumps_c.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/smumps_c.hpp @@ -9,7 +9,7 @@ This version of MUMPS is provided to you free of charge. It is public domain, based on public domain software developed during the Esprit IV - European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL. + European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL. Since this first public domain version in 1999, the developments are supported by the following institutions: CERFACS, ENSEEIHT-IRIT, and INRIA. @@ -67,7 +67,7 @@ typedef struct SMUMPS_INT icntl[40]; SMUMPS_DOUBLE2 cntl[5]; SMUMPS_INT n; - + SMUMPS_INT nz_alloc; /* used in matlab interface to decide if we free + malloc when we have large variation */ diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp index 7777591353450fced6f7ef18e7261ce87dff9405..57f959f42dffd6c1061a9fedfc32c1ce323ac007 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp @@ -9,7 +9,7 @@ This version of MUMPS is provided to you free of charge. It is public domain, based on public domain software developed during the Esprit IV - European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL. + European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL. Since this first public domain version in 1999, the developments are supported by the following institutions: CERFACS, ENSEEIHT-IRIT, and INRIA. @@ -68,7 +68,7 @@ typedef struct ZMUMPS_INT icntl[40]; ZMUMPS_DOUBLE2 cntl[5]; ZMUMPS_INT n; - + ZMUMPS_INT nz_alloc; /* used in matlab interface to decide if we free + malloc when we have large variation */ diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver.hpp index 92482cdd9822c601c0eef7bb9e0571f93adfecd1..cca88ad2bf975660362fa444a4eaefd39f6300c4 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver.hpp @@ -1,8 +1,8 @@ // // Copyright Karl Meerbergen 2007 // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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) // diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver_4_6_4.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver_4_6_4.hpp index aa7379f6025717f6fb97f69601003bbd9acc1260..4940a2dfc9a0ce5d76925630a04d430ee2865764 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver_4_6_4.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver_4_6_4.hpp @@ -1,8 +1,8 @@ // // Copyright Karl Meerbergen 2007 // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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) // @@ -46,103 +46,103 @@ namespace boost { namespace numeric { namespace bindings { namespace mumps { template <class T> struct mumps_type { } ; - + template <class T> struct mumps_call { } ; - + template <class T> struct mumps_internal_value_type { typedef T type ; } ; - + // // Specialization for float // - + template <> struct mumps_type< float > { typedef SMUMPS_STRUC_C type ; } ; - + template <> struct mumps_call< float > { void operator() ( SMUMPS_STRUC_C& struc ) const { smumps_c( &struc ) ; } } ; - + // // Specialization for double // - + template <> struct mumps_type< double > { typedef DMUMPS_STRUC_C type ; } ; - + template <> struct mumps_call< double > { void operator() ( DMUMPS_STRUC_C& struc ) const { dmumps_c( &struc ) ; } } ; - + // // Specialization for complex<float> // - + template <> struct mumps_type< std::complex< float > > { typedef CMUMPS_STRUC_C type ; } ; - + template <> struct mumps_call< std::complex< float > > { void operator() ( CMUMPS_STRUC_C& struc ) const { cmumps_c( &struc ) ; } } ; - + template <> struct mumps_internal_value_type< std::complex<float> > { typedef mumps_complex type ; } ; - + // // Specialization for complex<double> // - + template <> struct mumps_type< std::complex< double > > { typedef ZMUMPS_STRUC_C type ; } ; - + template <> struct mumps_call< std::complex< double > > { void operator() ( ZMUMPS_STRUC_C& struc ) const { zmumps_c( &struc ) ; } } ; - + template <> struct mumps_internal_value_type< std::complex<double> > { typedef mumps_double_complex type ; } ; - + // // Symmetry map // - + template <class T> struct mumps_sym { } ; - + template <> struct mumps_sym< boost::numeric::bindings::traits::symmetric_t > { static int const value = 2 ; } ; - + template <> struct mumps_sym< boost::numeric::bindings::traits::general_t > { static int const value = 0 ; @@ -156,20 +156,20 @@ namespace boost { namespace numeric { namespace bindings { namespace mumps { rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ; cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ; } - + template <typename M> void indices( boost::numeric::bindings::traits::column_major_t, int*& rows, int*& cols, M const& m ) { cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ; rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ; } - + // Pointer Cast float* cast_2_mumps( float* p ) { return p ; } double* cast_2_mumps( double* p ) { return p ; } mumps_double_complex* cast_2_mumps( std::complex<double>* p ) { return reinterpret_cast<mumps_double_complex*>( p ) ; } mumps_complex* cast_2_mumps( std::complex<float>* p ) { return reinterpret_cast<mumps_complex*>( p ) ; } } // namespace detail - + // diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver_4_8_0.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver_4_8_0.hpp index f20a37bdbef017fdf87420dc35fd9db73c67beba..62e4a1de3fb080655613d0c21a1468ce002c8b3d 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver_4_8_0.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver_4_8_0.hpp @@ -1,8 +1,8 @@ // // Copyright Karl Meerbergen 2008 // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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) // @@ -46,103 +46,103 @@ namespace boost { namespace numeric { namespace bindings { namespace mumps { template <class T> struct mumps_type { } ; - + template <class T> struct mumps_call { } ; - + template <class T> struct mumps_internal_value_type { typedef T type ; } ; - + // // Specialization for float // - + template <> struct mumps_type< float > { typedef SMUMPS_STRUC_C type ; } ; - + template <> struct mumps_call< float > { void operator() ( SMUMPS_STRUC_C& struc ) const { smumps_c( &struc ) ; } } ; - + // // Specialization for double // - + template <> struct mumps_type< double > { typedef DMUMPS_STRUC_C type ; } ; - + template <> struct mumps_call< double > { void operator() ( DMUMPS_STRUC_C& struc ) const { dmumps_c( &struc ) ; } } ; - + // // Specialization for complex<float> // - + template <> struct mumps_type< std::complex< float > > { typedef CMUMPS_STRUC_C type ; } ; - + template <> struct mumps_call< std::complex< float > > { void operator() ( CMUMPS_STRUC_C& struc ) const { cmumps_c( &struc ) ; } } ; - + template <> struct mumps_internal_value_type< std::complex<float> > { typedef mumps_complex type ; } ; - + // // Specialization for complex<double> // - + template <> struct mumps_type< std::complex< double > > { typedef ZMUMPS_STRUC_C type ; } ; - + template <> struct mumps_call< std::complex< double > > { void operator() ( ZMUMPS_STRUC_C& struc ) const { zmumps_c( &struc ) ; } } ; - + template <> struct mumps_internal_value_type< std::complex<double> > { typedef mumps_double_complex type ; } ; - + // // Symmetry map // - + template <class T> struct mumps_sym { } ; - + template <> struct mumps_sym< boost::numeric::bindings::traits::symmetric_t > { static int const value = 2 ; } ; - + template <> struct mumps_sym< boost::numeric::bindings::traits::general_t > { static int const value = 0 ; @@ -156,20 +156,20 @@ namespace boost { namespace numeric { namespace bindings { namespace mumps { rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ; cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ; } - + template <typename M> void indices( boost::numeric::bindings::traits::column_major_t, int*& rows, int*& cols, M const& m ) { cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ; rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ; } - + // Pointer Cast float* cast_2_mumps( float* p ) { return p ; } double* cast_2_mumps( double* p ) { return p ; } mumps_double_complex* cast_2_mumps( std::complex<double>* p ) { return reinterpret_cast<mumps_double_complex*>( p ) ; } mumps_complex* cast_2_mumps( std::complex<float>* p ) { return reinterpret_cast<mumps_complex*>( p ) ; } } // namespace detail - + // diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/algorithm.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/algorithm.hpp index 0ef2047a8c6b76a6c0e30d53d28a136d7fbc2573..520acece312e9c50c7751fb030f81a7b4cbb80cc 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/algorithm.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/algorithm.hpp @@ -13,12 +13,12 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template < typename T > struct is_equal { - is_equal(typename type_traits< T >::real_type tolerance) : tolerance_( tolerance ) {} + is_equal(typename type_traits< T >::real_type tolerance) : tolerance_( tolerance ) {} bool operator()(const T& a, const T& b) { return std::abs( a - b ) < tolerance_ ; } - // bool operator()(const T& a, const T& b, typename value_traits< T >::value_type tolerance) + // bool operator()(const T& a, const T& b, typename value_traits< T >::value_type tolerance) // { return std::abs( a - b ) < tolerance ; } typename type_traits< T >::real_type tolerance_ ; diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/boost_array.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/boost_array.hpp index a09ae9a41f406586b46e0f695e20bb38cedb618b..7da679502ea115d5e6479a93f931ff78949c657f 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/boost_array.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/boost_array.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,9 +14,9 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_BOOST_ARRAY_H #define BOOST_NUMERIC_BINDINGS_TRAITS_BOOST_ARRAY_H -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/vector_traits.hpp> #include <boost/array.hpp> @@ -25,6 +25,6 @@ #error with your compiler boost::array<> cannot be used in bindings -#endif +#endif -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/c_array.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/c_array.hpp index aca1179329184cbf6eeab11862bf5e23cbf5909f..344cb2a2737b02fab9bf9ca40a28920323fa2718 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/c_array.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/c_array.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,40 +14,40 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_C_ARRAY_H #define BOOST_NUMERIC_BINDINGS_TRAITS_C_ARRAY_H -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/vector_traits.hpp> namespace boost { namespace numeric { namespace bindings { namespace traits { // built-in array - template <typename T, std::size_t N, typename V> + template <typename T, std::size_t N, typename V> struct vector_detail_traits<T[N], V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same<T[N], typename boost::remove_const<V>::type>::value) + BOOST_STATIC_ASSERT( + (boost::is_same<T[N], typename boost::remove_const<V>::type>::value) ); #endif - typedef T identifier_type [N]; // C++ syntax is amazing ;o) + typedef T identifier_type [N]; // C++ syntax is amazing ;o) typedef V vector_type; - typedef T value_type; - typedef typename detail::generate_const<V, T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<V, T>::type* pointer; static pointer storage (vector_type& v) { return v; } - static int size (vector_type&) { return N; } - static int stride (vector_type&) { return 1; } - }; + static int size (vector_type&) { return N; } + static int stride (vector_type&) { return 1; } + }; }}}} -#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS -#error with your compiler plain C array cannot be used in bindings +#error with your compiler plain C array cannot be used in bindings -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_C_ARRAY_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/c_array2.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/c_array2.hpp index d8e12bbd4849f6ba98a032044dc29af06e8831b0..98575290ff5d9d30a7487357391fb1674c4035a2 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/c_array2.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/c_array2.hpp @@ -1,5 +1,5 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * Copyright (c) 2008 Markus Rickert * @@ -7,7 +7,7 @@ * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -15,9 +15,9 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_C_ARRAY2_H #define BOOST_NUMERIC_BINDINGS_TRAITS_C_ARRAY2_H -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/c_array.hpp> #include <boost/numeric/bindings/traits/matrix_traits.hpp> @@ -26,26 +26,26 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // built-in array as matrix (nx1) template <typename T, std::size_t N, typename V> - struct matrix_detail_traits<T[N], V> + struct matrix_detail_traits<T[N], V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - T[N], - typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + T[N], + typename boost::remove_const<V>::type >::value) ); #endif typedef T identifier_type [N]; - typedef V matrix_type; - typedef general_t matrix_structure; - typedef column_major_t ordering_type; + typedef V matrix_type; + typedef general_t matrix_structure; + typedef column_major_t ordering_type; - typedef T value_type; - typedef typename default_vector_traits< V, T >::pointer pointer; + typedef T value_type; + typedef typename default_vector_traits< V, T >::pointer pointer; static pointer storage (matrix_type& v) { - return vector_traits<matrix_type>::storage (v); + return vector_traits<matrix_type>::storage (v); } static std::ptrdiff_t num_rows (matrix_type& v) { return N; } static std::ptrdiff_t num_columns (matrix_type&) { return 1; } @@ -53,14 +53,14 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } // static std::ptrdiff_t stride2 (matrix_type&) { return 1; } static std::ptrdiff_t leading_dimension (matrix_type& v) { return N; } - }; + }; }}}} -#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS -#error with your compiler plain C array cannot be used in bindings +#error with your compiler plain C array cannot be used in bindings -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_C_ARRAY2_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/config.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/config.hpp index f3787be2ecc106ace0cfbc11411b16ac60a0c27f..87f6b708fcc0eedf02338c46e302cd960d6b5414 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/config.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/config.hpp @@ -2,15 +2,15 @@ // Copyright (c) 2002-2003 // Toon Knapen, Kresimir Fresl, Joerg Walter // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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_BINDINGS_CONFIG_HPP #define BOOST_NUMERIC_BINDINGS_CONFIG_HPP -#include <boost/config.hpp> +#include <boost/config.hpp> // Microsoft Visual C++ #if defined (BOOST_MSVC) @@ -36,17 +36,17 @@ // because the checks above are no longer in sync with "boost/config/select_compiler_config.hpp" //#error bindings do not recognise compiler #endif - + #if defined (BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS) // structure checks require proper traits -# define BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +# define BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK -// type checks require proper traits -# define BOOST_NUMERIC_BINDINGS_NO_TYPE_CHECK +// type checks require proper traits +# define BOOST_NUMERIC_BINDINGS_NO_TYPE_CHECK -#endif +#endif #endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/dense_traits.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/dense_traits.hpp index 0cdcfe88489666ac022a7c4d5d1bb1ce8294cb20..807743443ffe7dab70502a156c264a19057d2828 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/dense_traits.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/dense_traits.hpp @@ -9,9 +9,9 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DENSE_TRAITS_H #define BOOST_NUMERIC_BINDINGS_TRAITS_DENSE_TRAITS_H -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/numeric/bindings/traits/detail/dense_ordering.hpp> @@ -20,23 +20,23 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename M> inline - std::ptrdiff_t - dense_matrix_stride1 (M& m) { - return detail::dense_ordering< typename matrix_traits<M>::ordering_type >::stride1 (m); + std::ptrdiff_t + dense_matrix_stride1 (M& m) { + return detail::dense_ordering< typename matrix_traits<M>::ordering_type >::stride1 (m); } template <typename M> inline - std::ptrdiff_t - dense_matrix_stride2 (M& m) { - return detail::dense_ordering< typename matrix_traits<M>::ordering_type >::stride2 (m); + std::ptrdiff_t + dense_matrix_stride2 (M& m) { + return detail::dense_ordering< typename matrix_traits<M>::ordering_type >::stride2 (m); } -}}}} +}}}} -#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #error with your compiler dense matrices cannot be used in bindings -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_DENSE_TRAITS_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array.hpp index 2c17a46489d9e891ab3df28d4df45f8d7ad282f5..e46f3695828301b4f572e3d8474b8607424a2a5d 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Kresimir Fresl 2003 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -16,7 +16,7 @@ #include <boost/numeric/bindings/traits/vector_traits.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/detail/array_impl.hpp> @@ -26,15 +26,15 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { struct vector_traits<detail::array<T> > { typedef T value_type; typedef std::ptrdiff_t size_type; - typedef T* pointer; + typedef T* pointer; static pointer storage (detail::array<T>& a) { return a.storage(); } - static size_type size (detail::array<T>& a) { return a.size(); } - }; - + static size_type size (detail::array<T>& a) { return a.size(); } + }; + }}}} -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_ARRAY_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array_impl.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array_impl.hpp index 7d73fd53d5dc0bf686b014029d5d5226e22a3155..27c3866fc182af84e01a10f81355d8f30a5671c0 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array_impl.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array_impl.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Kresimir Fresl 2003 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -15,52 +15,52 @@ #define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_ARRAY_IMPL_HPP /* - very simple dynamic array class which is used in `higher level' - bindings functions for pivot and work arrays + very simple dynamic array class which is used in `higher level' + bindings functions for pivot and work arrays - Namely, there are (at least) two versions of all bindings functions + Namely, there are (at least) two versions of all bindings functions where called LAPACK function expects work and/or pivot array, e.g. - + `lower' level (user should provide work and pivot arrays): int sysv (SymmA& a, IVec& i, MatrB& b, Work& w); - + `higher' level (with `internal' work and pivot arrays): int sysv (SymmA& a, MatrB& b); - - Probably you ask why I didn't use std::vector. There are two reasons. - First is efficiency -- std::vector's constructor initialises vector - elements. Second is consistency. LAPACK functions use `info' parameter + + Probably you ask why I didn't use std::vector. There are two reasons. + First is efficiency -- std::vector's constructor initialises vector + elements. Second is consistency. LAPACK functions use `info' parameter as an error indicator. On the other hand, std::vector's allocator can - throw an exception if memory allocation fails. detail::array's - constructor uses `new (nothrow)' which returns 0 if allocation fails. - So I can check whether array::storage == 0 and return appropriate error + throw an exception if memory allocation fails. detail::array's + constructor uses `new (nothrow)' which returns 0 if allocation fails. + So I can check whether array::storage == 0 and return appropriate error in `info'. */ #include <new> -#include <boost/noncopyable.hpp> +#include <boost/noncopyable.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace traits { namespace detail { - template <typename T> + template <typename T> class array : private noncopyable { public: typedef std::ptrdiff_t size_type ; array (size_type n) { - stg = new (std::nothrow) T[n]; - sz = (stg != 0) ? n : 0; + stg = new (std::nothrow) T[n]; + sz = (stg != 0) ? n : 0; } ~array() { delete[] stg; } size_type size() const { return sz; } - bool valid() const { return stg != 0; } + bool valid() const { return stg != 0; } void resize (int n) { - delete[] stg; - stg = new (std::nothrow) T[n]; - sz = (stg != 0) ? n : 0; + delete[] stg; + stg = new (std::nothrow) T[n]; + sz = (stg != 0) ? n : 0; } T* storage() { return stg; } @@ -70,12 +70,12 @@ namespace boost { namespace numeric { namespace bindings { T const& operator[] (int i) const { return stg[i]; } private: - size_type sz; - T* stg; + size_type sz; + T* stg; }; }} }}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/dense_ordering.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/dense_ordering.hpp index 5f2ed809a36c8082e6b4e0805ea05fe78c43a553..9703e1cd269fc2f88bdeaee65b03ca893328b6a5 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/dense_ordering.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/dense_ordering.hpp @@ -9,45 +9,45 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_DENSE_ORDERING_H #define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_DENSE_ORDERING_H -#include <boost/numeric/ublas/fwd.hpp> +#include <boost/numeric/ublas/fwd.hpp> namespace boost { namespace numeric { namespace bindings { namespace traits { namespace detail { - + template <typename StOrdTag> struct dense_ordering {}; - - template<> + + template<> struct dense_ordering<row_major_t> { - typedef row_major_t type; - + typedef row_major_t type; + template <typename M> static std::ptrdiff_t stride1( M const& m ) { return leading_dimension (m) ; } - + template <typename M> static std::ptrdiff_t stride2( M const& m ) { return 1 ; } }; - - template<> + + template<> struct dense_ordering<column_major_t> { - typedef column_major_t type; - + typedef column_major_t type; + template <typename M> static std::ptrdiff_t stride1( M const& m ) { return 1 ; } - + template <typename M> static std::ptrdiff_t stride2( M const& m ) { return leading_dimension (m) ; } }; - + } }}}} diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/generate_const.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/generate_const.hpp index 1becabe916a108e29a410bdaf35ec56cd32ef885..cfe280657eb8f940e4264d485040742d8c350102 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/generate_const.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/generate_const.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * First author acknowledges the support of the Faculty of Civil + * First author acknowledges the support of the Faculty of Civil * Engineering, University of Zagreb, Croatia. * */ @@ -14,37 +14,37 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_GENERATE_CONST_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_GENERATE_CONST_HPP -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS namespace boost { namespace numeric { namespace bindings { namespace traits { namespace detail { - + /// Copy const from V to X if present template <typename V, typename X> struct generate_const { - typedef X type; + typedef X type; }; template <typename V, typename X> struct generate_const< const V, X > { - typedef X const type; + typedef X const type; }; template <typename V, typename X> struct generate_const< V const, X const > { - typedef X const type; + typedef X const type; }; template <typename T, int N, typename X> struct generate_const< const T[N], X > { - typedef X const type; + typedef X const type; }; template <typename T, int N, typename X> struct generate_const< const T[N], X const > { - typedef X const type; + typedef X const type; }; }}}}} diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/symm_herm_traits.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/symm_herm_traits.hpp index 8200f9fc6cedd6efe93f811dc991f9be80e93c38..47835f67a46c50a17722870f64623c1a76750303 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/symm_herm_traits.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/symm_herm_traits.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,7 +14,7 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_TRAITS_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_TRAITS_HPP -#include <boost/numeric/bindings/traits/type.hpp> +#include <boost/numeric/bindings/traits/type.hpp> #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/static_assert.hpp> @@ -24,45 +24,45 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { namespace detail { - // select symmetric or hermitian matrix structure + // select symmetric or hermitian matrix structure - template <typename T> - struct symm_herm_t {}; + template <typename T> + struct symm_herm_t {}; template<> struct symm_herm_t<float> { typedef symmetric_t type; - }; + }; template<> struct symm_herm_t<double> { typedef symmetric_t type; - }; + }; template<> struct symm_herm_t<complex_f> { typedef hermitian_t type; - }; + }; template<> struct symm_herm_t<complex_d> { typedef hermitian_t type; - }; + }; - template <typename T> - struct symm_herm_pack_t {}; + template <typename T> + struct symm_herm_pack_t {}; template<> struct symm_herm_pack_t<float> { typedef symmetric_packed_t type; - }; + }; template<> struct symm_herm_pack_t<double> { typedef symmetric_packed_t type; - }; + }; template<> struct symm_herm_pack_t<complex_f> { typedef hermitian_packed_t type; - }; + }; template<> struct symm_herm_pack_t<complex_d> { typedef hermitian_packed_t type; - }; + }; template <class T, class S> @@ -91,4 +91,4 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS -#endif // BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_TRAITS_HPP +#endif // BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_TRAITS_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_ordering.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_ordering.hpp index 4a626ed146d000136ab4560e40fefa0a67243877..c2b227f10b32e39406cf8f00c83a60ecfd2abb76 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_ordering.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_ordering.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,7 +14,7 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_UBLAS_ORDERING_H #define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_UBLAS_ORDERING_H -#include <boost/numeric/ublas/fwd.hpp> +#include <boost/numeric/ublas/fwd.hpp> namespace boost { namespace numeric { namespace bindings { namespace traits { @@ -22,11 +22,11 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename StOrdTag> struct ublas_ordering {}; - - template<> + + template<> struct ublas_ordering<boost::numeric::ublas::row_major_tag> { - typedef row_major_t type; - typedef boost::numeric::ublas::row_major functor_type; + typedef row_major_t type; + typedef boost::numeric::ublas::row_major functor_type; template <typename M> static typename M::size_type leading_dimension( M const& m ) { @@ -43,11 +43,11 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { return 1 ; } }; - - template<> + + template<> struct ublas_ordering<boost::numeric::ublas::column_major_tag> { - typedef column_major_t type; - typedef boost::numeric::ublas::column_major functor_type; + typedef column_major_t type; + typedef boost::numeric::ublas::column_major functor_type; template <typename M> static typename M::size_type leading_dimension( M const& m ) { @@ -67,8 +67,8 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename StOrdTag> struct ublas_banded_ordering {}; - - template<> + + template<> struct ublas_banded_ordering<boost::numeric::ublas::row_major_tag> { template <typename M> @@ -86,8 +86,8 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { return leading_dimension(m)-1 ; } }; - - template<> + + template<> struct ublas_banded_ordering<boost::numeric::ublas::column_major_tag> { template <typename M> @@ -109,4 +109,4 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { }}}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_uplo.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_uplo.hpp index 595b2b03bf1d3763d4a9ec625a6d9e43d758c66c..ee1e48898d2a7e01407503efa5b3b0c11ddf6dca 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_uplo.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_uplo.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl 2002 + * + * Copyright (c) Kresimir Fresl 2002 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,7 +14,7 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_UPLO_H #define BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_UPLO_H -#include <boost/numeric/ublas/fwd.hpp> +#include <boost/numeric/ublas/fwd.hpp> namespace boost { namespace numeric { namespace bindings { namespace traits { @@ -22,18 +22,18 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename UpLoTag> struct ublas_uplo {}; - - template<> + + template<> struct ublas_uplo<boost::numeric::ublas::lower> { - typedef lower_t type; + typedef lower_t type; }; - template<> + template<> struct ublas_uplo<boost::numeric::ublas::upper> { - typedef upper_t type; + typedef upper_t type; }; } }}}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/utils.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/utils.hpp index f60a2d072078f226cf59ec9cf42d1467f1e497c1..d7ba23eb6c5f0d8fdada6ff049399d5e247f9537 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/utils.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/utils.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Kresimir Fresl 2003 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,7 +14,7 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_UTILS_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_UTILS_HPP -// #include <cstring> +// #include <cstring> #include <iterator> #include <boost/numeric/bindings/traits/type_traits.hpp> @@ -23,45 +23,45 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { namespace detail { // complex array => real & imaginary arrays - template <typename CIt, typename RIt> - inline + template <typename CIt, typename RIt> + inline void disentangle (CIt c, CIt c_end, RIt rr, RIt ri) { for (; c != c_end; ++c, ++rr, ++ri) { - *rr = traits::real (*c); - *ri = traits::imag (*c); + *rr = traits::real (*c); + *ri = traits::imag (*c); } } // real & imaginary arrays => complex array - template <typename RIt, typename CIt> - inline + template <typename RIt, typename CIt> + inline void interlace (RIt r, RIt r_end, RIt ri, CIt c) { typedef typename std::iterator_traits<CIt>::value_type cmplx_t; #ifdef BOOST_NUMERIC_BINDINGS_BY_THE_BOOK - for (; r != r_end; ++r, ++ri, ++c) - *c = cmplx_t (*r, *ri); + for (; r != r_end; ++r, ++ri, ++c) + *c = cmplx_t (*r, *ri); #else - typedef typename type_traits<cmplx_t>::real_type real_t; + typedef typename type_traits<cmplx_t>::real_type real_t; real_t *cp = reinterpret_cast<real_t*> (&*c); for (; r != r_end; ++r, ++ri) { *cp = *r; ++cp; *cp = *ri; ++cp; } -#endif - } +#endif + } // converts real/complex to int inline int to_int (float f) { return static_cast<int> (f); } inline int to_int (double d) { return static_cast<int> (d); } - inline int to_int (traits::complex_f const& cf) { - return static_cast<int> (traits::real (cf)); + inline int to_int (traits::complex_f const& cf) { + return static_cast<int> (traits::real (cf)); } - inline int to_int (traits::complex_d const& cd) { - return static_cast<int> (traits::real (cd)); + inline int to_int (traits::complex_d const& cd) { + return static_cast<int> (traits::real (cd)); } } }}}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/fortran.h b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/fortran.h index 257a24f87155b917aa65fefed24d1f200a8e147d..4871f3c04d59bbed26968960b321db7e61238b81 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/fortran.h +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/fortran.h @@ -1,8 +1,8 @@ // -// Copyright (C) 2002, 2003 Si-Lab b.v.b.a., Toon Knapen and Kresimir Fresl +// Copyright (C) 2002, 2003 Si-Lab b.v.b.a., Toon Knapen and Kresimir Fresl // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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) // @@ -26,7 +26,7 @@ #endif -// Next we define macro's to convert our symbols to +// Next we define macro's to convert our symbols to // the current convention #if defined(BIND_FORTRAN_LOWERCASE_UNDERSCORE) #define FORTRAN_ID( id ) id##_ diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/matrix_raw.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/matrix_raw.hpp index 9e18ac75d18d7b4bdaeadcbff2601971bba3b750..ade37ce3dc5cf73d120beede700f95be547078f5 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/matrix_raw.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/matrix_raw.hpp @@ -2,25 +2,25 @@ // Copyright (c) 2002-2003 // Toon Knapen, Kresimir Fresl, Joerg Walter // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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_BINDINGS_TRAITS_MATRIX_RAW_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_MATRIX_RAW_HPP -#include <cstddef> -#include <boost/numeric/ublas/config.hpp> +#include <cstddef> +#include <boost/numeric/ublas/config.hpp> #ifndef BOOST_UBLAS_HAVE_BINDINGS -# include <boost/numeric/ublas/matrix.hpp> -#endif +# include <boost/numeric/ublas/matrix.hpp> +#endif namespace boost { namespace numeric { namespace bindings { namespace traits { - namespace ublas = boost::numeric::ublas; + namespace ublas = boost::numeric::ublas; - // size: + // size: template <typename M> BOOST_UBLAS_INLINE @@ -34,7 +34,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { } #if 0 - // MSVC seems to dislike overloads if there is 'generic' template + // MSVC seems to dislike overloads if there is 'generic' template template <typename M> BOOST_UBLAS_INLINE int matrix_size1 (const ublas::matrix_reference<M> &m) { @@ -52,7 +52,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { BOOST_UBLAS_INLINE int matrix_storage_size (const ublas::matrix<T,F,A>& m) { return (int) (m.size1() * m.size2()); - } + } template <typename T, std::size_t M, std::size_t N> BOOST_UBLAS_INLINE int matrix_storage_size (const ublas::c_matrix<T, M, N> &m) { @@ -73,7 +73,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename T, typename F, typename A> BOOST_UBLAS_INLINE int leading_dimension (const ublas::matrix<T,F,A> &m) { - typedef ublas::matrix<T,F,A> matrix_t; + typedef ublas::matrix<T,F,A> matrix_t; return bindings::traits::leading_dimension (m, BOOST_UBLAS_TYPENAME matrix_t::orientation_category()); } @@ -94,10 +94,10 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { } - // stride: + // stride: #if 0 - // MSVC seems to dislike overloads if there is 'generic' template + // MSVC seems to dislike overloads if there is 'generic' template template <typename M> BOOST_UBLAS_INLINE int matrix_stride1 (const M &m) { @@ -170,12 +170,12 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { } - // storage: + // storage: #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename T, typename F, typename A> BOOST_UBLAS_INLINE - typename ublas::matrix<T,F,A>::const_pointer + typename ublas::matrix<T,F,A>::const_pointer matrix_storage (const ublas::matrix<T,F,A> &m) { return &m.data().begin()[0]; } @@ -184,19 +184,19 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template <typename T, typename F, typename A> BOOST_UBLAS_INLINE - typename ublas::matrix<T,F,A>::const_pointer + typename ublas::matrix<T,F,A>::const_pointer matrix_storage_const (const ublas::matrix<T,F,A> &m) { return &m.data().begin()[0]; } template <typename T, typename F, typename A> BOOST_UBLAS_INLINE - typename ublas::matrix<T,F,A>::pointer + typename ublas::matrix<T,F,A>::pointer matrix_storage (ublas::matrix<T,F,A> &m) { return &m.data().begin()[0]; } #if 0 - // MSVC seems to dislike overloads if there is 'generic' template + // MSVC seems to dislike overloads if there is 'generic' template #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename M> BOOST_UBLAS_INLINE @@ -216,12 +216,12 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { typename M::pointer matrix_storage (M &m) { return &m.data().begin()[0]; } -#endif // 0 +#endif // 0 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage (const ublas::matrix_reference<M> &m) { return matrix_storage (m.expression ()); } @@ -230,7 +230,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage_const (const ublas::matrix_reference<M> &m) { return matrix_storage_const (m.expression ()); } @@ -243,7 +243,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename T, std::size_t M, std::size_t N> BOOST_UBLAS_INLINE - typename ublas::c_matrix<T, M, N>::const_pointer + typename ublas::c_matrix<T, M, N>::const_pointer matrix_storage (const ublas::c_matrix<T, M, N> &m) { return m.data(); } @@ -253,13 +253,13 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template <typename T, std::size_t M, std::size_t N> BOOST_UBLAS_INLINE - typename ublas::c_matrix<T, M, N>::const_pointer + typename ublas::c_matrix<T, M, N>::const_pointer matrix_storage_const (const ublas::c_matrix<T, M, N> &m) { return m.data(); } template <typename T, std::size_t M, std::size_t N> BOOST_UBLAS_INLINE - typename ublas::c_matrix<T, M, N>::pointer + typename ublas::c_matrix<T, M, N>::pointer matrix_storage (ublas::c_matrix<T, M, N> &m) { return m.data(); } @@ -268,18 +268,18 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage (const ublas::matrix_range<M> &m) { - return matrix_storage (m.data()) - + m.start1() * matrix_stride1 (m.data()) + return matrix_storage (m.data()) + + m.start1() * matrix_stride1 (m.data()) + m.start2() * matrix_stride2 (m.data()); } template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage (const ublas::matrix_slice<M> &m) { - return matrix_storage (m.data()) - + m.start1() * matrix_stride1 (m.data ()) + return matrix_storage (m.data()) + + m.start1() * matrix_stride1 (m.data ()) + m.start2() * matrix_stride2 (m.data ()); } #endif @@ -287,48 +287,48 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage_const (const ublas::matrix_range<M> &m) { - return matrix_storage_const (m.data()) - + m.start1() * matrix_stride1 (m.data ()) + return matrix_storage_const (m.data()) + + m.start1() * matrix_stride1 (m.data ()) + m.start2() * matrix_stride2 (m.data ()); } template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage_const (const ublas::matrix_slice<M> &m) { - return matrix_storage_const (m.data()) - + m.start1() * matrix_stride1 (m.data ()) + return matrix_storage_const (m.data()) + + m.start1() * matrix_stride1 (m.data ()) + m.start2() * matrix_stride2 (m.data ()); } template <typename M> BOOST_UBLAS_INLINE typename M::pointer matrix_storage (ublas::matrix_range<M> &m) { - return matrix_storage (m.data()) - + m.start1() * matrix_stride1 (m.data ()) + return matrix_storage (m.data()) + + m.start1() * matrix_stride1 (m.data ()) + m.start2() * matrix_stride2 (m.data ()); } template <typename M> BOOST_UBLAS_INLINE typename M::pointer matrix_storage (ublas::matrix_slice<M> &m) { - return matrix_storage (m.data()) - + m.start1() * matrix_stride1 (m.data ()) + return matrix_storage (m.data()) + + m.start1() * matrix_stride1 (m.data ()) + m.start2() * matrix_stride2 (m.data ()); } #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer vector_storage (const ublas::matrix_row<M> &v) { - return matrix_storage (v.data()) + return matrix_storage (v.data()) + v.index() * matrix_stride1 (v.data()); } template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer vector_storage (const ublas::matrix_column<M> &v) { - return matrix_storage (v.data()) + return matrix_storage (v.data()) + v.index() * matrix_stride2 (v.data()); } #endif @@ -336,37 +336,37 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer vector_storage_const (const ublas::matrix_row<M> &v) { - return matrix_storage_const (v.data()) + return matrix_storage_const (v.data()) + v.index() * matrix_stride1 (v.data()); } template <typename M> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer vector_storage_const (const ublas::matrix_column<M> &v) { - return matrix_storage_const (v.data()) + return matrix_storage_const (v.data()) + v.index() * matrix_stride2 (v.data()); } template <typename M> BOOST_UBLAS_INLINE typename M::pointer vector_storage (ublas::matrix_row<M> &v) { - return matrix_storage (v.data()) + return matrix_storage (v.data()) + v.index() * matrix_stride1 (v.data()); } template <typename M> BOOST_UBLAS_INLINE typename M::pointer vector_storage (ublas::matrix_column<M> &v) { - return matrix_storage (v.data()) + return matrix_storage (v.data()) + v.index() * matrix_stride2 (v.data()); } }}}} -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_NO_SYMMETRIC_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_NO_SYMMETRIC_TRAITS -#include <boost/numeric/bindings/traits/symm_herm_raw.hpp> +#include <boost/numeric/bindings/traits/symm_herm_raw.hpp> -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_NO_SYMMETRIC_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_NO_SYMMETRIC_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_MATRIX_RAW_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/matrix_traits.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/matrix_traits.hpp index f84cf9a146ff46eb383c5accfc6215557fe4462b..b72bdb6669b1a8cbc23d05d5a2f7f71f91d06f01 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/matrix_traits.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/matrix_traits.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,20 +14,20 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_MATRIX_TRAITS_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_MATRIX_TRAITS_HPP -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS -#include <boost/numeric/bindings/traits/detail/generate_const.hpp> -#include <boost/type_traits/remove_const.hpp> +#include <boost/numeric/bindings/traits/detail/generate_const.hpp> +#include <boost/type_traits/remove_const.hpp> #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK -# include <boost/type_traits/is_same.hpp> -# include <boost/static_assert.hpp> -#endif +# include <boost/type_traits/is_same.hpp> +# include <boost/static_assert.hpp> +#endif namespace boost { namespace numeric { namespace bindings { namespace traits { - /// There is no default implementation since there is no reasonable default. + /// There is no default implementation since there is no reasonable default. /// Most matrix libraries provide totally different functions. @@ -36,44 +36,44 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { /// MIdentifier is used to specialize the traits for a specific matrix type, e.g. /// matrix_detail_traits< ublas::matrix<double>, ublas::matrix<double> const > /// matrix_detail_traits< ublas::matrix<double>, ublas::matrix<double> > - /// Note that remove_const<MType>::type == MIdentifier + /// Note that remove_const<MType>::type == MIdentifier template <typename MIdentifier, typename MType> struct matrix_detail_traits { typedef MIdentifier identifier_type; - typedef MType matrix_type; + typedef MType matrix_type; }; - /// matrix_traits<> generic version: + /// matrix_traits<> generic version: template <typename M> struct matrix_traits : matrix_detail_traits< typename boost::remove_const<M>::type, M> { // typedefs: - // matrix_structure + // matrix_structure // ordering_type // value_type // pointer // symmetric/hermitian typedefs: - // uplo_type + // uplo_type // static functions: // pointer storage() // std::ptrdiff_t num_rows() // std::ptrdiff_t num_columns() - // std::ptrdiff_t lower_bandwidth() // only banded matrix types - // std::ptrdiff_t upper_bandwidth() // only banded matrix types + // std::ptrdiff_t lower_bandwidth() // only banded matrix types + // std::ptrdiff_t upper_bandwidth() // only banded matrix types // std::ptrdiff_t storage_size() // not all matrix types - // std::ptrdiff_t leading_dimension() // not all matrix types - }; + // std::ptrdiff_t leading_dimension() // not all matrix types + }; // matrix structure tags: - struct general_t {}; - struct symmetric_t {}; - struct symmetric_packed_t {}; - struct hermitian_t {}; - struct hermitian_packed_t {}; - struct banded_t {}; - // TO DO: add triangular, etc. - struct unknown_structure_t {}; - - // storage ordering tags: + struct general_t {}; + struct symmetric_t {}; + struct symmetric_packed_t {}; + struct hermitian_t {}; + struct hermitian_packed_t {}; + struct banded_t {}; + // TO DO: add triangular, etc. + struct unknown_structure_t {}; + + // storage ordering tags: struct row_major_t {}; struct column_major_t {}; @@ -90,22 +90,22 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename M> inline - typename matrix_traits<M>::pointer matrix_storage (M& m) { - return matrix_traits<M>::storage (m); + typename matrix_traits<M>::pointer matrix_storage (M& m) { + return matrix_traits<M>::storage (m); } - + template <typename M> inline std::ptrdiff_t matrix_num_rows (M& m) { return matrix_traits<M>::num_rows (m); } - + template <typename M> inline std::ptrdiff_t matrix_num_columns (M& m) { return matrix_traits<M>::num_columns (m); } - + template <typename M> inline std::ptrdiff_t matrix_storage_size (M& m) { return matrix_traits<M>::storage_size (m); } - + template <typename M> inline std::ptrdiff_t matrix_stride1 (M& m) { return matrix_traits<M>::stride1 (m); } @@ -121,27 +121,27 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename M> inline std::ptrdiff_t matrix_lower_bandwidth (M& m) { return matrix_traits<M>::lower_bandwidth (m); } - + template <typename M> inline - std::ptrdiff_t leading_dimension (M& m) { - return matrix_traits<M>::leading_dimension (m); + std::ptrdiff_t leading_dimension (M& m) { + return matrix_traits<M>::leading_dimension (m); } - + namespace detail { - inline char matrix_uplo_tag (upper_t const&) { return 'U'; } - inline char matrix_uplo_tag (lower_t const&) { return 'L'; } + inline char matrix_uplo_tag (upper_t const&) { return 'U'; } + inline char matrix_uplo_tag (lower_t const&) { return 'L'; } } - template <typename SymmM> - inline + template <typename SymmM> + inline char matrix_uplo_tag (SymmM&) { - typedef typename matrix_traits<SymmM>::uplo_type uplo_t; + typedef typename matrix_traits<SymmM>::uplo_type uplo_t; return detail::matrix_uplo_tag (uplo_t()); } - + // Retain for older bindings: template <typename M> inline @@ -150,12 +150,12 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename M> inline std::ptrdiff_t matrix_size2 (M& m) { return matrix_traits<M>::num_columns (m); } - -}}}} + +}}}} #else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS -#include <boost/numeric/bindings/traits/matrix_raw.hpp> +#include <boost/numeric/bindings/traits/matrix_raw.hpp> #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/sparse_traits.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/sparse_traits.hpp index 735ccde391204f84d5a3c75def44b4c90b6869e6..24644c8077fa28c1cf9eff955af584340afee4e4 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/sparse_traits.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/sparse_traits.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF author acknowledges the support of the Faculty of Civil Engineering, + * KF author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,42 +14,42 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_SPARSE_TRAITS_H #define BOOST_NUMERIC_BINDINGS_TRAITS_SPARSE_TRAITS_H -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/traits.hpp> namespace boost { namespace numeric { namespace bindings { namespace traits { - /// There is no default implementation since there is no reasonable default. + /// There is no default implementation since there is no reasonable default. /// Most matrix libraries provide totally different functions. /// Auxiliary traits class to reduce the number of specializations. template <typename MIdentifier, typename MType> struct sparse_matrix_detail_traits { typedef MIdentifier identifier_type; - typedef MType matrix_type; + typedef MType matrix_type; }; - /// sparse_matrix_traits<> generic version: + /// sparse_matrix_traits<> generic version: template <typename M> - struct sparse_matrix_traits + struct sparse_matrix_traits : sparse_matrix_detail_traits <typename boost::remove_const<M>::type, M> { // typedefs: - // matrix_structure - // storage_format + // matrix_structure + // storage_format // ordering_type // value_type // value_pointer - // index_pointer - // enum (or static size_t const): + // index_pointer + // enum (or static size_t const): // index_base // static functions: // index_pointer index1_storage() - // - compressed column: array of column start locations - // - compressed row: array of row start locations + // - compressed column: array of column start locations + // - compressed row: array of row start locations // - coordinate, column major: column indices of nonzeros // - coordinate, row major: row indices of nonzeros // index_pointer index2_storage() @@ -58,16 +58,16 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // - coordinate, column major: row indices of nonzeros // - coordinate, row major: column indices of nonzeros // value_pointer value_storage() - // - array of nonzeros + // - array of nonzeros // std::ptrdiff_t num_rows() // std::ptrdiff_t num_columns() - // std::ptrdiff_t num_nonzeros() - }; + // std::ptrdiff_t num_nonzeros() + }; - // storage format tags + // storage format tags struct compressed_t {}; - struct coordinate_t {}; + struct coordinate_t {}; /////////////////////////// @@ -78,37 +78,37 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename M> inline - typename sparse_matrix_traits<M>::index_pointer - spmatrix_index1_storage (M& m) { - return sparse_matrix_traits<M>::index1_storage (m); + typename sparse_matrix_traits<M>::index_pointer + spmatrix_index1_storage (M& m) { + return sparse_matrix_traits<M>::index1_storage (m); } template <typename M> inline - typename sparse_matrix_traits<M>::index_pointer - spmatrix_index2_storage (M& m) { - return sparse_matrix_traits<M>::index2_storage (m); + typename sparse_matrix_traits<M>::index_pointer + spmatrix_index2_storage (M& m) { + return sparse_matrix_traits<M>::index2_storage (m); } - + template <typename M> inline - typename sparse_matrix_traits<M>::value_pointer - spmatrix_value_storage (M& m) { - return sparse_matrix_traits<M>::value_storage (m); + typename sparse_matrix_traits<M>::value_pointer + spmatrix_value_storage (M& m) { + return sparse_matrix_traits<M>::value_storage (m); } - + template <typename M> inline std::ptrdiff_t spmatrix_num_rows (M& m) { return sparse_matrix_traits<M>::num_rows (m); } template <typename M> inline std::ptrdiff_t spmatrix_num_columns (M& m) { return sparse_matrix_traits<M>::num_columns (m); } - + template <typename M> inline - std::ptrdiff_t spmatrix_num_nonzeros (M& m) { - return sparse_matrix_traits<M>::num_nonzeros (m); + std::ptrdiff_t spmatrix_num_nonzeros (M& m) { + return sparse_matrix_traits<M>::num_nonzeros (m); } - + // Retain for older codes template <typename M> @@ -117,13 +117,13 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename M> inline std::ptrdiff_t spmatrix_size2 (M& m) { return sparse_matrix_traits<M>::num_columns (m); } - -}}}} -#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +}}}} + +#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #error with your compiler sparse matrices cannot be used in bindings -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_SPARSE_TRAITS_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_valarray.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_valarray.hpp index 672f00d9329be84862d2fbbdf3eae3674ae8a41a..60bff30db1c7bbfa6ba826558bc70f92fe45980e 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_valarray.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_valarray.hpp @@ -1,15 +1,15 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * - * Permission to copy, modify, use and distribute this software - * for any non-commercial or commercial purpose is granted provided + * Permission to copy, modify, use and distribute this software + * for any non-commercial or commercial purpose is granted provided * that this license appear on all copies of the software source code. * - * Authors assume no responsibility whatsoever for its use and makes + * Authors assume no responsibility whatsoever for its use and makes * no guarantees about its quality, correctness or reliability. * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -17,9 +17,9 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY_H #define BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY_H -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/vector_traits.hpp> #include <valarray> @@ -28,35 +28,35 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // std::valarray<> - template <typename T, typename V> - struct vector_detail_traits<std::valarray<T>, V> - : default_vector_traits<V, T> + template <typename T, typename V> + struct vector_detail_traits<std::valarray<T>, V> + : default_vector_traits<V, T> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - std::valarray<T>, typename boost::remove_const<V>::type - >::value) + BOOST_STATIC_ASSERT( + (boost::is_same< + std::valarray<T>, typename boost::remove_const<V>::type + >::value) ); #endif - typedef std::valarray<T> identifier_type; + typedef std::valarray<T> identifier_type; typedef V vector_type; typedef typename default_vector_traits<V, T>::pointer pointer; - static pointer storage (vector_type& va) { + static pointer storage (vector_type& va) { std::valarray<T>& ncva = const_cast<std::valarray<T>&> (va); return &ncva[0]; } - }; + }; -}}}} +}}}} -#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #error with your compiler std::valarray<> cannot be used in bindings -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_valarray2.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_valarray2.hpp index fbba3af0651313cbc100c151db3bc37cacd864ce..fa23b395a036ad49fc36b80f61ae8edce359d6d2 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_valarray2.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_valarray2.hpp @@ -1,16 +1,16 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * Copyright (c) 2008 Markus Rickert * - * Permission to copy, modify, use and distribute this software - * for any non-commercial or commercial purpose is granted provided + * Permission to copy, modify, use and distribute this software + * for any non-commercial or commercial purpose is granted provided * that this license appear on all copies of the software source code. * - * Authors assume no responsibility whatsoever for its use and makes + * Authors assume no responsibility whatsoever for its use and makes * no guarantees about its quality, correctness or reliability. * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -18,9 +18,9 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY2_H #define BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY2_H -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/matrix_traits.hpp> #include <valarray> @@ -30,26 +30,26 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // std::valarray<> treated as matrix (nx1) template <typename T, typename V> - struct matrix_detail_traits<std::valarray<T>, V> + struct matrix_detail_traits<std::valarray<T>, V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - std::valarray<T>, - typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + std::valarray<T>, + typename boost::remove_const<V>::type >::value) ); #endif typedef std::valarray<T> identifier_type; - typedef V matrix_type; - typedef general_t matrix_structure; - typedef column_major_t ordering_type; + typedef V matrix_type; + typedef general_t matrix_structure; + typedef column_major_t ordering_type; - typedef T value_type; - typedef typename default_vector_traits< V, T >::pointer pointer; + typedef T value_type; + typedef typename default_vector_traits< V, T >::pointer pointer; static pointer storage (matrix_type& v) { - return vector_traits<matrix_type>::storage (v); + return vector_traits<matrix_type>::storage (v); } static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } static std::ptrdiff_t num_columns (matrix_type&) { return 1; } @@ -57,14 +57,14 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } // static std::ptrdiff_t stride2 (matrix_type&) { return 1; } static std::ptrdiff_t leading_dimension (matrix_type& v) { return v.size(); } - }; + }; -}}}} +}}}} -#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #error with your compiler std::valarray<> cannot be used in bindings -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY2_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector.hpp index e317c142f31bd6481c78f31ab541991b7a47764d..ad9c5b051991c7664decb726d917da8f12381ff9 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -16,7 +16,7 @@ #include <boost/numeric/bindings/traits/vector_traits.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <vector> @@ -25,7 +25,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // std::vector<> template <typename T, typename Alloc, typename V> - struct vector_detail_traits<std::vector<T, Alloc>, V> + struct vector_detail_traits<std::vector<T, Alloc>, V> : default_vector_traits< V, T > { @@ -33,15 +33,15 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { BOOST_STATIC_ASSERT( (boost::is_same< std::vector<T, Alloc>, typename boost::remove_const<V>::type >::value) ); #endif - typedef std::vector<T,Alloc> identifier_type; + typedef std::vector<T,Alloc> identifier_type; typedef V vector_type; typedef typename default_vector_traits< V, T >::pointer pointer; static pointer storage (vector_type& v) { return &v.front(); } - }; + }; -}}}} +}}}} -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_STD_VECTOR_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector2.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector2.hpp index 0316bcbc62eaec440e93fe8a6071d62ffdfdf70c..ec50e0ef2fbc79cd6b2e6761d53ccec5e671f46a 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector2.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector2.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -16,7 +16,7 @@ #include <boost/numeric/bindings/traits/matrix_traits.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <vector> @@ -25,37 +25,37 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // std::vector<> treated as matrix (nx1) template <typename T, typename Alloc, typename V> - struct matrix_detail_traits<std::vector<T, Alloc>, V> + struct matrix_detail_traits<std::vector<T, Alloc>, V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - std::vector<T, Alloc>, - typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + std::vector<T, Alloc>, + typename boost::remove_const<V>::type >::value) ); #endif typedef std::vector<T, Alloc> identifier_type; - typedef V matrix_type; - typedef general_t matrix_structure; - typedef column_major_t ordering_type; + typedef V matrix_type; + typedef general_t matrix_structure; + typedef column_major_t ordering_type; - typedef T value_type; - typedef typename default_vector_traits< V, T >::pointer pointer; + typedef T value_type; + typedef typename default_vector_traits< V, T >::pointer pointer; static pointer storage (matrix_type& v) { - return vector_traits<matrix_type>::storage (v); + return vector_traits<matrix_type>::storage (v); } - static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } + static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } static std::ptrdiff_t num_columns (matrix_type&) { return 1; } static std::ptrdiff_t storage_size (matrix_type& v) { return v.size(); } -// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } +// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } // static std::ptrdiff_t stride2 (matrix_type&) { return 1; } static std::ptrdiff_t leading_dimension (matrix_type& v) { return v.size(); } - }; + }; -}}}} +}}}} -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_STD_VECTOR2_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/symm_herm_raw.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/symm_herm_raw.hpp index 0de0568a96a9d85b37eca13915dc652f9fd60027..a464ee351de05d7a775a605a66131ec76158eb48 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/symm_herm_raw.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/symm_herm_raw.hpp @@ -2,23 +2,23 @@ // Copyright (c) 2002-2003 // Toon Knapen, Kresimir Fresl, Joerg Walter // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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_BINDINGS_TRAITS_SYMM_HERM_RAW_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_RAW_HPP -#include <boost/numeric/bindings/traits/matrix_raw.hpp> +#include <boost/numeric/bindings/traits/matrix_raw.hpp> #ifndef BOOST_UBLAS_HAVE_BINDINGS -# include <boost/numeric/ublas/symmetric.hpp> -# include <boost/numeric/ublas/hermitian.hpp> -#endif +# include <boost/numeric/ublas/symmetric.hpp> +# include <boost/numeric/ublas/hermitian.hpp> +#endif namespace boost { namespace numeric { namespace bindings { namespace traits { - namespace ublas = boost::numeric::ublas; + namespace ublas = boost::numeric::ublas; template <typename M, typename F> BOOST_UBLAS_INLINE @@ -37,25 +37,25 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { template <typename M, typename F> BOOST_UBLAS_INLINE int matrix_storage_size (const ublas::symmetric_adaptor<M, F> &m) { - return matrix_storage_size (m.data()); + return matrix_storage_size (m.data()); } template <typename M, typename F> BOOST_UBLAS_INLINE int matrix_storage_size (const ublas::hermitian_adaptor<M, F> &m) { - return matrix_storage_size (m.data()); + return matrix_storage_size (m.data()); } template<typename T, typename F1, typename F2, typename A> BOOST_UBLAS_INLINE int matrix_storage_size (const ublas::symmetric_matrix<T,F1,F2,A> &m) { - return (int) ((m.size1() * (m.size1() + 1)) / 2); + return (int) ((m.size1() * (m.size1() + 1)) / 2); } template<typename T, typename F1, typename F2, typename A> BOOST_UBLAS_INLINE int matrix_storage_size (const ublas::hermitian_matrix<T,F1,F2,A> &m) { - return (int) ((m.size1() * (m.size1() + 1)) / 2); + return (int) ((m.size1() * (m.size1() + 1)) / 2); } @@ -63,7 +63,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template<typename T, typename F1, typename F2, typename A> BOOST_UBLAS_INLINE - typename ublas::symmetric_matrix<T,F1,F2,A>::const_pointer + typename ublas::symmetric_matrix<T,F1,F2,A>::const_pointer matrix_storage (const ublas::symmetric_matrix<T,F1,F2,A> &m) { return &m.data().begin()[0]; } @@ -72,13 +72,13 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template<typename T, typename F1, typename F2, typename A> BOOST_UBLAS_INLINE - typename ublas::symmetric_matrix<T,F1,F2,A>::const_pointer + typename ublas::symmetric_matrix<T,F1,F2,A>::const_pointer matrix_storage_const (const ublas::symmetric_matrix<T,F1,F2,A> &m) { return &m.data().begin()[0]; } template<typename T, typename F1, typename F2, typename A> BOOST_UBLAS_INLINE - typename ublas::symmetric_matrix<T,F1,F2,A>::pointer + typename ublas::symmetric_matrix<T,F1,F2,A>::pointer matrix_storage (ublas::symmetric_matrix<T,F1,F2,A> &m) { return &m.data().begin()[0]; } @@ -86,30 +86,30 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename M, typename F> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage (const ublas::symmetric_adaptor<M, F> &m) { - return matrix_storage (m.data()); + return matrix_storage (m.data()); } #endif // We need data_const() mostly due to MSVC 6.0. // But how shall we write portable code otherwise? template <typename M, typename F> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage_const (const ublas::symmetric_adaptor<M, F> &m) { - return matrix_storage_const (m.data()); + return matrix_storage_const (m.data()); } template <typename M, typename F> BOOST_UBLAS_INLINE typename M::pointer matrix_storage (ublas::symmetric_adaptor<M, F> &m) { - return matrix_storage (m.data()); + return matrix_storage (m.data()); } #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template<typename T, typename F1, typename F2, typename A> BOOST_UBLAS_INLINE - typename ublas::hermitian_matrix<T,F1,F2,A>::const_pointer + typename ublas::hermitian_matrix<T,F1,F2,A>::const_pointer matrix_storage (const ublas::hermitian_matrix<T,F1,F2,A> &m) { return &m.data().begin()[0]; } @@ -118,13 +118,13 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template<typename T, typename F1, typename F2, typename A> BOOST_UBLAS_INLINE - typename ublas::hermitian_matrix<T,F1,F2,A>::const_pointer + typename ublas::hermitian_matrix<T,F1,F2,A>::const_pointer matrix_storage_const (const ublas::hermitian_matrix<T,F1,F2,A> &m) { return &m.data().begin()[0]; } template<typename T, typename F1, typename F2, typename A> BOOST_UBLAS_INLINE - typename ublas::hermitian_matrix<T,F1,F2,A>::pointer + typename ublas::hermitian_matrix<T,F1,F2,A>::pointer matrix_storage (ublas::hermitian_matrix<T,F1,F2,A> &m) { return &m.data().begin()[0]; } @@ -132,39 +132,39 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename M, typename F> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage (const ublas::hermitian_adaptor<M, F> &m) { - return matrix_storage (m.data()); + return matrix_storage (m.data()); } #endif // We need data_const() mostly due to MSVC 6.0. // But how shall we write portable code otherwise? template <typename M, typename F> BOOST_UBLAS_INLINE - typename M::const_pointer + typename M::const_pointer matrix_storage_const (const ublas::hermitian_adaptor<M, F> &m) { - return matrix_storage_const (m.data()); + return matrix_storage_const (m.data()); } template <typename M, typename F> BOOST_UBLAS_INLINE typename M::pointer matrix_storage (ublas::hermitian_adaptor<M, F> &m) { - return matrix_storage (m.data()); + return matrix_storage (m.data()); } namespace detail { - inline char m_uplo_tag (ublas::upper_tag const&) { return 'U'; } - inline char m_uplo_tag (ublas::lower_tag const&) { return 'L'; } + inline char m_uplo_tag (ublas::upper_tag const&) { return 'U'; } + inline char m_uplo_tag (ublas::lower_tag const&) { return 'L'; } } - template <typename SymmM> - inline + template <typename SymmM> + inline char matrix_uplo_tag (SymmM&) { - typedef typename SymmM::packed_category uplo_t; + typedef typename SymmM::packed_category uplo_t; return detail::m_uplo_tag (uplo_t()); } - + }}}} diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/tnt.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/tnt.hpp index 35332d71a9b03b5ffc0b2a5c6b9cc0603aa6e337..10905bb3ff1ce692f0de7a69675c9a8a658215ef 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/tnt.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/tnt.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -17,9 +17,9 @@ // Roldan Pozo's TNT (Template Numerical Toolkit) // see: http://math.nist.gov/tnt/index.html -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #include <boost/numeric/bindings/traits/traits.hpp> #include <tnt/tnt_array1d.h> @@ -31,104 +31,104 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // TNT::Array1D<> template <typename T, typename V> - struct vector_detail_traits<TNT::Array1D<T>, V> + struct vector_detail_traits<TNT::Array1D<T>, V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - TNT::Array1D<T>, typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + TNT::Array1D<T>, typename boost::remove_const<V>::type >::value) ); #endif - typedef TNT::Array1D<T> identifier_type; + typedef TNT::Array1D<T> identifier_type; typedef V vector_type; - typedef T value_type; - typedef typename detail::generate_const<V,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<V,T>::type* pointer; static pointer storage (vector_type& v) { return &v[0]; } - static int size (vector_type& v) { return v.dim(); } - static int stride (vector_type& v) { return 1; } - }; + static int size (vector_type& v) { return v.dim(); } + static int stride (vector_type& v) { return 1; } + }; // TNT::Fortran_Array1D<> template <typename T, typename V> - struct vector_detail_traits<TNT::Fortran_Array1D<T>, V> + struct vector_detail_traits<TNT::Fortran_Array1D<T>, V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - TNT::Fortran_Array1D<T>, typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + TNT::Fortran_Array1D<T>, typename boost::remove_const<V>::type >::value) ); #endif - typedef TNT::Fortran_Array1D<T> identifier_type; + typedef TNT::Fortran_Array1D<T> identifier_type; typedef V vector_type; - typedef T value_type; - typedef typename detail::generate_const<V,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<V,T>::type* pointer; static pointer storage (vector_type& v) { return &v(1); } - static int size (vector_type& v) { return v.dim(); } - static int stride (vector_type& v) { return 1; } - }; + static int size (vector_type& v) { return v.dim(); } + static int stride (vector_type& v) { return 1; } + }; // TNT::Array2D<> template <typename T, typename M> - struct matrix_detail_traits<TNT::Array2D<T>, M> + struct matrix_detail_traits<TNT::Array2D<T>, M> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - TNT::Array2D<T>, typename boost::remove_const<M>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + TNT::Array2D<T>, typename boost::remove_const<M>::type >::value) ); #endif - typedef TNT::Array2D<T> identifier_type; + typedef TNT::Array2D<T> identifier_type; typedef M matrix_type; - typedef general_t matrix_structure; - typedef row_major_t ordering_type; + typedef general_t matrix_structure; + typedef row_major_t ordering_type; - typedef T value_type; - typedef typename detail::generate_const<M,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<M,T>::type* pointer; static pointer storage (matrix_type& m) { return m[0]; } - static int num_rows (matrix_type& m) { return m.dim1(); } - static int num_columns (matrix_type& m) { return m.dim2(); } + static int num_rows (matrix_type& m) { return m.dim1(); } + static int num_columns (matrix_type& m) { return m.dim2(); } static int storage_size (matrix_type& m) { return m.dim1() * m.dim2(); } - static int leading_dimension (matrix_type& m) { return m.dim2(); } - }; + static int leading_dimension (matrix_type& m) { return m.dim2(); } + }; // TNT::Fortran_Array2D<> template <typename T, typename M> struct matrix_detail_traits<TNT::Fortran_Array2D<T>, M> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - TNT::Fortran_Array2D<T>, typename boost::remove_const<M>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + TNT::Fortran_Array2D<T>, typename boost::remove_const<M>::type >::value) ); #endif - typedef TNT::Fortran_Array2D<T> identifier_type; + typedef TNT::Fortran_Array2D<T> identifier_type; typedef M matrix_type; - typedef general_t matrix_structure; - typedef column_major_t ordering_type; + typedef general_t matrix_structure; + typedef column_major_t ordering_type; - typedef T value_type; - typedef typename detail::generate_const<M,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<M,T>::type* pointer; static pointer storage (matrix_type& m) { return &m(1, 1); } - static int num_rows (matrix_type& m) { return m.dim1(); } - static int num_columns (matrix_type& m) { return m.dim2(); } + static int num_rows (matrix_type& m) { return m.dim1(); } + static int num_columns (matrix_type& m) { return m.dim2(); } static int storage_size (matrix_type& m) { return m.dim1() * m.dim2(); } - static int leading_dimension (matrix_type& m) { return m.dim1(); } - }; + static int leading_dimension (matrix_type& m) { return m.dim1(); } + }; -}}}} +}}}} -#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #error with your compiler TNT cannot be used in bindings -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_TNT_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/traits.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/traits.hpp index c39be6068136517ed87c9be8902f07d5084bd255..4bd7a7f10089edf80b8364de4e5cd0e17b5491bc 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/traits.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/traits.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -17,4 +17,4 @@ #include <boost/numeric/bindings/traits/vector_traits.hpp> #include <boost/numeric/bindings/traits/matrix_traits.hpp> -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/transpose.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/transpose.hpp index a4a56b175b413a1a73000d475f2eeabce1d0bf81..c7d7cd3fa869e54e6cf7fe4d6cadd46646e050bb 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/transpose.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/transpose.hpp @@ -1,8 +1,8 @@ // // Copyright Kresimir Fresl, Toon Knapen, and Karl Meerbergen 2002, 2003 // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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) // @@ -17,4 +17,4 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { }}}} -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type.h b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type.h index bca799742201b0a457189e5bf8359140b342b3c6..5d6557401db494340baeb548e556ffaf438e8957 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type.h +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2000,2001,2002,2003 Si-Lab b.v.b.a. and Toon Knapen - * + * * 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_BINDINGS_TRAITS_TYPE_H @@ -15,7 +15,7 @@ * COMPLEX and COMPLEX*16 of Fortran */ -#ifndef BOOST_NUMERIC_BINDINGS_USE_COMPLEX_STRUCT +#ifndef BOOST_NUMERIC_BINDINGS_USE_COMPLEX_STRUCT typedef float fcomplex_t ; typedef double dcomplex_t ; @@ -28,7 +28,7 @@ union { double align_struct_ ; } fcomplex_t ; -typedef +typedef struct { double cmplx[2] ; } dcomplex_t ; diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type.hpp index 73e73c2881a9664275284010ccdeb23c0963ea57..2c83c69c148c014ba3882e9549a7ce0e3071c137 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type.hpp @@ -18,12 +18,12 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { */ #ifndef BOOST_NUMERIC_BINDINGS_USE_CUSTOM_COMPLEX_TYPE typedef std::complex< float > complex_f ; - typedef std::complex< double > complex_d ; + typedef std::complex< double > complex_d ; #endif - template <typename T> + template <typename T> T real (std::complex<T> const& c) { return std::real (c); } - template <typename T> + template <typename T> T imag (std::complex<T> const& c) { return std::imag (c); } }}}} diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type_traits.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type_traits.hpp index ce1d7c8105b6781c882d418428568cf49a66f0be..5b08388ab998d8acc4b1acc71065951efb3e7a96 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type_traits.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/type_traits.hpp @@ -1,12 +1,12 @@ /* - * - * Copyright (c) Kresimir Fresl and Toon Knapen 2002, 2003 + * + * Copyright (c) Kresimir Fresl and Toon Knapen 2002, 2003 * * 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) * - * First author acknowledges the support of the Faculty of Civil Engineering, + * First author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -20,32 +20,32 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { - template <typename Real> - struct type_traits { + template <typename Real> + struct type_traits { #ifdef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS - typedef Real type; - typedef Real real_type; -#endif + typedef Real type; + typedef Real real_type; +#endif }; template<> - struct type_traits<float> { - typedef float type; - typedef float real_type; + struct type_traits<float> { + typedef float type; + typedef float real_type; }; - template<> - struct type_traits<double> { - typedef double type; - typedef double real_type; + template<> + struct type_traits<double> { + typedef double type; + typedef double real_type; }; - template<> - struct type_traits<complex_f> { - typedef complex_f type; - typedef float real_type; + template<> + struct type_traits<complex_f> { + typedef complex_f type; + typedef float real_type; }; - template<> - struct type_traits<complex_d> { - typedef complex_d type; - typedef double real_type; + template<> + struct type_traits<complex_d> { + typedef complex_d type; + typedef double real_type; }; diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_banded.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_banded.hpp index ebc26b4e089cfd1646508d46e6bd637b32e55b02..74d3b3d0a4f5d872d96dfeec3b5a6f5aa63bbe1d 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_banded.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_banded.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -16,11 +16,11 @@ #include <boost/numeric/bindings/traits/traits.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #ifndef BOOST_UBLAS_HAVE_BINDINGS -# include <boost/numeric/ublas/banded.hpp> -#endif +# include <boost/numeric/ublas/banded.hpp> +#endif #include <boost/numeric/bindings/traits/detail/ublas_ordering.hpp> #if defined (BOOST_NUMERIC_BINDINGS_FORTRAN) || !defined (BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK) @@ -39,57 +39,57 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // matrix_detail_traits< banded<T, F, ArrT>, banded<T, F, ArrT> const > // at once. template <typename T, typename F, typename ArrT, typename M> - struct matrix_detail_traits< boost::numeric::ublas::banded_matrix<T, F, ArrT>, M > + struct matrix_detail_traits< boost::numeric::ublas::banded_matrix<T, F, ArrT>, M > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same<boost::numeric::ublas::banded_matrix<T, F, ArrT>, typename boost::remove_const<M>::type>::value) ); #endif #ifdef BOOST_NUMERIC_BINDINGS_FORTRAN BOOST_STATIC_ASSERT((boost::is_same< - typename F::orientation_category, + typename F::orientation_category, boost::numeric::ublas::row_major_tag - >::value)); -#endif + >::value)); +#endif typedef boost::numeric::ublas::banded_matrix<T, F, ArrT> identifier_type ; typedef M matrix_type; - typedef banded_t matrix_structure; + typedef banded_t matrix_structure; typedef typename detail::ublas_ordering< typename F::orientation_category - >::type ordering_type; + >::type ordering_type; - typedef T value_type; - typedef typename detail::generate_const<M,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<M,T>::type* pointer; static pointer storage (matrix_type& m) { typedef typename detail::generate_const<M,ArrT>::type array_type ; - return vector_traits<array_type>::storage (m.data()); + return vector_traits<array_type>::storage (m.data()); } - static std::ptrdiff_t size1 (matrix_type& m) { return m.size1(); } + static std::ptrdiff_t size1 (matrix_type& m) { return m.size1(); } static std::ptrdiff_t size2 (matrix_type& m) { return m.size2(); } static std::ptrdiff_t lower_bandwidth (matrix_type& m) { return m.lower() ; } static std::ptrdiff_t upper_bandwidth (matrix_type& m) { return m.upper() ; } static std::ptrdiff_t storage_size (matrix_type& m) { return size1 (m) * size2 (m); } static std::ptrdiff_t leading_dimension (matrix_type& m) { - typedef typename identifier_type::orientation_category orientation_category; + typedef typename identifier_type::orientation_category orientation_category; return detail::ublas_banded_ordering<orientation_category>::leading_dimension(m) ; } - // stride1 == distance (m (i, j), m (i+1, j)) - static std::ptrdiff_t stride1 (matrix_type& m) { - typedef typename identifier_type::orientation_category orientation_category; + // stride1 == distance (m (i, j), m (i+1, j)) + static std::ptrdiff_t stride1 (matrix_type& m) { + typedef typename identifier_type::orientation_category orientation_category; return detail::ublas_banded_ordering<orientation_category>::stride1(m) ; - } - // stride2 == distance (m (i, j), m (i, j+1)) - static std::ptrdiff_t stride2 (matrix_type& m) { - typedef typename identifier_type::orientation_category orientation_category; + } + // stride2 == distance (m (i, j), m (i, j+1)) + static std::ptrdiff_t stride2 (matrix_type& m) { + typedef typename identifier_type::orientation_category orientation_category; return detail::ublas_banded_ordering<orientation_category>::stride2(m) ; } - }; + }; }}}} -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_BANDED_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_hermitian.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_hermitian.hpp index cb60a3732b0026a6b8c0be6622fd7d5c9901cfdc..beeeede76049c57a046f410bb70c2606da15ab7e 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_hermitian.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_hermitian.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -16,11 +16,11 @@ #include <boost/numeric/bindings/traits/traits.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #ifndef BOOST_UBLAS_HAVE_BINDINGS -# include <boost/numeric/ublas/hermitian.hpp> -#endif +# include <boost/numeric/ublas/hermitian.hpp> +#endif #include <boost/numeric/bindings/traits/ublas_matrix.hpp> #include <boost/numeric/bindings/traits/detail/ublas_uplo.hpp> @@ -36,33 +36,33 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #endif #ifdef BOOST_BINDINGS_FORTRAN BOOST_STATIC_ASSERT((boost::is_same< - typename F2::orientation_category, + typename F2::orientation_category, boost::numeric::ublas::column_major_tag - >::value)); -#endif + >::value)); +#endif typedef boost::numeric::ublas::hermitian_matrix<T, F1, F2, A> identifier_type; typedef M matrix_type; - typedef hermitian_packed_t matrix_structure; + typedef hermitian_packed_t matrix_structure; typedef typename detail::ublas_ordering< typename F2::orientation_category - >::type ordering_type; - typedef typename detail::ublas_uplo< F1 >::type uplo_type; + >::type ordering_type; + typedef typename detail::ublas_uplo< F1 >::type uplo_type; - typedef T value_type ; - typedef typename detail::generate_const<M,T>::type* pointer ; + typedef T value_type ; + typedef typename detail::generate_const<M,T>::type* pointer ; static pointer storage (matrix_type& hm) { typedef typename detail::generate_const<M,A>::type array_type ; - return vector_traits<array_type>::storage (hm.data()); + return vector_traits<array_type>::storage (hm.data()); } - static std::ptrdiff_t num_rows (matrix_type& hm) { return hm.size1(); } + static std::ptrdiff_t num_rows (matrix_type& hm) { return hm.size1(); } static std::ptrdiff_t num_columns (matrix_type& hm) { return hm.size2(); } - static std::ptrdiff_t storage_size (matrix_type& hm) { - return (num_rows (hm) + 1) * num_columns (hm) / 2; + static std::ptrdiff_t storage_size (matrix_type& hm) { + return (num_rows (hm) + 1) * num_columns (hm) / 2; } - }; + }; namespace detail { @@ -89,28 +89,28 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #endif typedef boost::numeric::ublas::hermitian_adaptor<M, F1> identifier_type; - typedef MA matrix_type; - typedef hermitian_t matrix_structure; - typedef typename matrix_traits<M>::ordering_type ordering_type; - typedef typename detail::ublas_uplo< F1 >::type uplo_type; + typedef MA matrix_type; + typedef hermitian_t matrix_structure; + typedef typename matrix_traits<M>::ordering_type ordering_type; + typedef typename detail::ublas_uplo< F1 >::type uplo_type; - typedef typename M::value_type value_type; - typedef typename detail::generate_const<MA, value_type>::type* pointer; + typedef typename M::value_type value_type; + typedef typename detail::generate_const<MA, value_type>::type* pointer; private: - typedef typename detail::generate_const<MA, typename MA::matrix_closure_type>::type m_type; + typedef typename detail::generate_const<MA, typename MA::matrix_closure_type>::type m_type; public: static pointer storage (matrix_type& hm) { return matrix_traits<m_type>::storage (hm.data()); } - static std::ptrdiff_t num_rows (matrix_type& hm) { return hm.size1(); } + static std::ptrdiff_t num_rows (matrix_type& hm) { return hm.size1(); } static std::ptrdiff_t num_columns (matrix_type& hm) { return hm.size2(); } - static std::ptrdiff_t storage_size (matrix_type& hm) { - return num_rows (hm) * num_columns (hm); + static std::ptrdiff_t storage_size (matrix_type& hm) { + return num_rows (hm) * num_columns (hm); } static std::ptrdiff_t leading_dimension (matrix_type& hm) { - return matrix_traits<m_type>::leading_dimension (hm.data()); + return matrix_traits<m_type>::leading_dimension (hm.data()); } // For banded M static std::ptrdiff_t upper_bandwidth(matrix_type& hm) { @@ -119,10 +119,10 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { static std::ptrdiff_t lower_bandwidth(matrix_type& hm) { return detail::matrix_bandwidth( hm.data(), uplo_type() ); } - }; + }; }}}} -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_HERMITIAN_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_matrix.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_matrix.hpp index 91113dba3ed5897b861379070bab49990f36e541..0b6ada1a19ac5dfa4885025972eb427ef6af8c79 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_matrix.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_matrix.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -16,11 +16,11 @@ #include <boost/numeric/bindings/traits/traits.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #ifndef BOOST_UBLAS_HAVE_BINDINGS -# include <boost/numeric/ublas/matrix.hpp> -#endif +# include <boost/numeric/ublas/matrix.hpp> +#endif #include <boost/numeric/bindings/traits/detail/ublas_ordering.hpp> #if defined (BOOST_NUMERIC_BINDINGS_FORTRAN) || !defined (BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK) @@ -37,93 +37,93 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // matrix_detail_traits< matrix<T, F, ArrT>, matrix<T, F, ArrT> const > // at once. template <typename T, typename F, typename ArrT, typename M> - struct matrix_detail_traits< boost::numeric::ublas::matrix<T, F, ArrT>, M > + struct matrix_detail_traits< boost::numeric::ublas::matrix<T, F, ArrT>, M > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same<boost::numeric::ublas::matrix<T, F, ArrT>, typename boost::remove_const<M>::type>::value) ); #endif #ifdef BOOST_NUMERIC_BINDINGS_FORTRAN BOOST_STATIC_ASSERT((boost::is_same< - typename F::orientation_category, + typename F::orientation_category, boost::numeric::ublas::column_major_tag - >::value)); -#endif + >::value)); +#endif typedef boost::numeric::ublas::matrix<T, F, ArrT> identifier_type ; typedef M matrix_type; - typedef general_t matrix_structure; + typedef general_t matrix_structure; typedef typename detail::ublas_ordering< typename F::orientation_category - >::type ordering_type; + >::type ordering_type; - typedef T value_type; - typedef typename detail::generate_const<M,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<M,T>::type* pointer; - typedef typename identifier_type::orientation_category orientation_category; + typedef typename identifier_type::orientation_category orientation_category; typedef typename detail::ublas_ordering<orientation_category>::functor_type functor_t ; static pointer storage (matrix_type& m) { typedef typename detail::generate_const<M,ArrT>::type array_type ; - return vector_traits<array_type>::storage (m.data()); + return vector_traits<array_type>::storage (m.data()); } - static std::ptrdiff_t num_rows (matrix_type& m) { return m.size1(); } + static std::ptrdiff_t num_rows (matrix_type& m) { return m.size1(); } static std::ptrdiff_t num_columns (matrix_type& m) { return m.size2(); } static std::ptrdiff_t storage_size (matrix_type& m) { return m.size1() * m.size2(); } static std::ptrdiff_t leading_dimension (matrix_type& m) { - // g++ 2.95.4 and 3.0.4 (with -pedantic) dislike + // g++ 2.95.4 and 3.0.4 (with -pedantic) dislike // identifier_type::functor_type::size2() //return functor_t::size_m (m.size1(), m.size2()); return detail::ublas_ordering<orientation_category>::leading_dimension( m ) ; } - // stride1 == distance (m (i, j), m (i+1, j)) - static std::ptrdiff_t stride1 (matrix_type& m) { + // stride1 == distance (m (i, j), m (i+1, j)) + static std::ptrdiff_t stride1 (matrix_type& m) { //return functor_t::one1 (m.size1(), m.size2()); return detail::ublas_ordering<orientation_category>::stride1( m ) ; - } - // stride2 == distance (m (i, j), m (i, j+1)) - static std::ptrdiff_t stride2 (matrix_type& m) { + } + // stride2 == distance (m (i, j), m (i, j+1)) + static std::ptrdiff_t stride2 (matrix_type& m) { //return functor_t::one2 (m.size1(), m.size2()); return detail::ublas_ordering<orientation_category>::stride2( m ) ; } - }; + }; - // ublas::matrix_reference<> + // ublas::matrix_reference<> template <typename M, typename MR> struct matrix_detail_traits<boost::numeric::ublas::matrix_reference<M>, MR > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::matrix_reference<M>, typename boost::remove_const<MR>::type>::value) ) ; -#endif +#endif typedef boost::numeric::ublas::matrix_reference<M> identifier_type; typedef MR matrix_type; - typedef typename matrix_traits<M>::matrix_structure matrix_structure; - typedef typename matrix_traits<M>::ordering_type ordering_type; + typedef typename matrix_traits<M>::matrix_structure matrix_structure; + typedef typename matrix_traits<M>::ordering_type ordering_type; typedef typename M::value_type value_type; - typedef typename detail::generate_const<MR,value_type>::type* pointer; + typedef typename detail::generate_const<MR,value_type>::type* pointer; private: - typedef typename detail::generate_const<MR, M>::type m_type; + typedef typename detail::generate_const<MR, M>::type m_type; public: static pointer storage (matrix_type& mr) { return matrix_traits<m_type>::storage (mr.expression()); } - static std::ptrdiff_t num_rows (matrix_type& mr) { return mr.size1(); } + static std::ptrdiff_t num_rows (matrix_type& mr) { return mr.size1(); } static std::ptrdiff_t num_columns (matrix_type& mr) { return mr.size2(); } static std::ptrdiff_t leading_dimension (matrix_type& mr) { - return matrix_traits<m_type>::leading_dimension (mr.expression()); + return matrix_traits<m_type>::leading_dimension (mr.expression()); } - static std::ptrdiff_t stride1 (matrix_type& mr) { - return matrix_traits<m_type>::stride1 (mr.expression()); - } - static std::ptrdiff_t stride2 (matrix_type& mr) { - return matrix_traits<m_type>::stride2 (mr.expression()); + static std::ptrdiff_t stride1 (matrix_type& mr) { + return matrix_traits<m_type>::stride1 (mr.expression()); + } + static std::ptrdiff_t stride2 (matrix_type& mr) { + return matrix_traits<m_type>::stride2 (mr.expression()); } // Only for banded matrices static std::ptrdiff_t upper_bandwidth(matrix_type& mr) { @@ -132,24 +132,24 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { static std::ptrdiff_t lower_bandwidth(matrix_type& mr) { return matrix_traits<m_type>::lower_bandwidth(mr.expression()); } - }; + }; - // ublas::matrix_range<> + // ublas::matrix_range<> template <typename M, typename MR> struct matrix_detail_traits<boost::numeric::ublas::matrix_range<M>, MR > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::matrix_range<M>, typename boost::remove_const<MR>::type>::value) ) ; -#endif +#endif typedef boost::numeric::ublas::matrix_range<M> identifier_type; typedef MR matrix_type; typedef typename matrix_traits<M>::matrix_structure matrix_structure; - typedef typename matrix_traits<M>::ordering_type ordering_type; + typedef typename matrix_traits<M>::ordering_type ordering_type; private: - typedef typename detail::generate_const<MR, typename MR::matrix_closure_type>::type m_type; + typedef typename detail::generate_const<MR, typename MR::matrix_closure_type>::type m_type; public: typedef typename matrix_traits<m_type>::value_type value_type; @@ -157,24 +157,24 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { public: static pointer storage (matrix_type& mr) { - m_type& mt = mr.data(); + m_type& mt = mr.data(); pointer ptr = matrix_traits<m_type>::storage (mt); - ptr += mr.start1() * matrix_traits<m_type>::stride1 (mt); - ptr += mr.start2() * matrix_traits<m_type>::stride2 (mt); - return ptr; + ptr += mr.start1() * matrix_traits<m_type>::stride1 (mt); + ptr += mr.start2() * matrix_traits<m_type>::stride2 (mt); + return ptr; } - static std::ptrdiff_t num_rows (matrix_type& mr) { return mr.size1(); } + static std::ptrdiff_t num_rows (matrix_type& mr) { return mr.size1(); } static std::ptrdiff_t num_columns (matrix_type& mr) { return mr.size2(); } static std::ptrdiff_t leading_dimension (matrix_type& mr) { - return matrix_traits<m_type>::leading_dimension (mr.data()); + return matrix_traits<m_type>::leading_dimension (mr.data()); } - static std::ptrdiff_t stride1 (matrix_type& mr) { - return matrix_traits<m_type>::stride1 (mr.data()); - } - static std::ptrdiff_t stride2 (matrix_type& mr) { - return matrix_traits<m_type>::stride2 (mr.data()); + static std::ptrdiff_t stride1 (matrix_type& mr) { + return matrix_traits<m_type>::stride1 (mr.data()); + } + static std::ptrdiff_t stride2 (matrix_type& mr) { + return matrix_traits<m_type>::stride2 (mr.data()); } // For band matrices only static std::ptrdiff_t upper_bandwidth (matrix_type& mr) { @@ -183,131 +183,131 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { static std::ptrdiff_t lower_bandwidth (matrix_type& mr) { return matrix_traits<m_type>::lower_bandwidth(mr.data()); } - }; + }; - // ublas::matrix_slice<> + // ublas::matrix_slice<> template <typename M, typename MS> - struct matrix_detail_traits<boost::numeric::ublas::matrix_slice<M>, MS > + struct matrix_detail_traits<boost::numeric::ublas::matrix_slice<M>, MS > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::matrix_slice<M>, typename boost::remove_const<MS>::type>::value) ) ; -#endif +#endif typedef boost::numeric::ublas::matrix_slice<M> identifier_type; typedef MS matrix_type; - typedef unknown_structure_t matrix_structure; - typedef typename matrix_traits<M>::ordering_type ordering_type; + typedef unknown_structure_t matrix_structure; + typedef typename matrix_traits<M>::ordering_type ordering_type; typedef typename M::value_type value_type; - typedef typename detail::generate_const<MS,value_type>::type* pointer; + typedef typename detail::generate_const<MS,value_type>::type* pointer; private: - typedef typename detail::generate_const<MS, typename MS::matrix_closure_type>::type m_type; + typedef typename detail::generate_const<MS, typename MS::matrix_closure_type>::type m_type; public: static pointer storage (matrix_type& ms) { - m_type& mt = ms.data(); + m_type& mt = ms.data(); pointer ptr = matrix_traits<M>::storage (mt); - ptr += ms.start1() * matrix_traits<M>::stride1 (mt); - ptr += ms.start2() * matrix_traits<M>::stride2 (mt); - return ptr; + ptr += ms.start1() * matrix_traits<M>::stride1 (mt); + ptr += ms.start2() * matrix_traits<M>::stride2 (mt); + return ptr; } - static std::ptrdiff_t num_rows (matrix_type& ms) { return ms.size1(); } + static std::ptrdiff_t num_rows (matrix_type& ms) { return ms.size1(); } static std::ptrdiff_t num_columns (matrix_type& ms) { return ms.size2(); } private: static std::ptrdiff_t ld (std::ptrdiff_t s1, std::ptrdiff_t s2, boost::numeric::ublas::row_major_tag) { - return s1; + return s1; } static std::ptrdiff_t ld (std::ptrdiff_t s1, std::ptrdiff_t s2, boost::numeric::ublas::column_major_tag) { - return s2; + return s2; } public: static std::ptrdiff_t leading_dimension (matrix_type& ms) { - typedef typename identifier_type::orientation_category oc_t; + typedef typename identifier_type::orientation_category oc_t; return ld (ms.stride1(), ms.stride2(), oc_t()) - * matrix_traits<m_type>::leading_dimension (ms.data()); + * matrix_traits<m_type>::leading_dimension (ms.data()); } - static std::ptrdiff_t stride1 (matrix_type& ms) { - return ms.stride1() * matrix_traits<m_type>::stride1 (ms.data()); - } - static std::ptrdiff_t stride2 (matrix_type& ms) { - return ms.stride2() * matrix_traits<m_type>::stride2 (ms.data()); + static std::ptrdiff_t stride1 (matrix_type& ms) { + return ms.stride1() * matrix_traits<m_type>::stride1 (ms.data()); + } + static std::ptrdiff_t stride2 (matrix_type& ms) { + return ms.stride2() * matrix_traits<m_type>::stride2 (ms.data()); } - }; + }; // matrix_row<> and matrix_column<> are vectors: // ublas::matrix_row<> template <typename M, typename MR> - struct vector_detail_traits< boost::numeric::ublas::matrix_row<M>, MR > - : default_vector_traits< MR, typename M::value_type > + struct vector_detail_traits< boost::numeric::ublas::matrix_row<M>, MR > + : default_vector_traits< MR, typename M::value_type > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::matrix_row<M>, typename boost::remove_const<MR>::type>::value) ) ; -#endif +#endif typedef boost::numeric::ublas::matrix_row<M> identifier_type; typedef MR vector_type; typedef typename M::value_type value_type; - typedef typename default_vector_traits<MR,value_type>::pointer pointer; + typedef typename default_vector_traits<MR,value_type>::pointer pointer; private: - typedef typename detail::generate_const<MR, typename MR::matrix_closure_type>::type m_type; + typedef typename detail::generate_const<MR, typename MR::matrix_closure_type>::type m_type; public: static pointer storage (vector_type& mr) { - m_type& mt = mr.data(); - pointer ptr = matrix_traits<m_type>::storage (mt); + m_type& mt = mr.data(); + pointer ptr = matrix_traits<m_type>::storage (mt); ptr += mr.index() * matrix_traits<m_type>::stride1 (mt); - return ptr; + return ptr; } - static std::ptrdiff_t stride (vector_type& mr) { + static std::ptrdiff_t stride (vector_type& mr) { return matrix_traits<m_type>::stride2 (mr.data()); - } - }; + } + }; // ublas::matrix_column<> template <typename M, typename MC> - struct vector_detail_traits< boost::numeric::ublas::matrix_column<M>, MC > - : default_vector_traits< MC, typename M::value_type > + struct vector_detail_traits< boost::numeric::ublas::matrix_column<M>, MC > + : default_vector_traits< MC, typename M::value_type > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::matrix_column<M>, typename boost::remove_const<MC>::type>::value) ) ; -#endif +#endif - typedef boost::numeric::ublas::matrix_column<M> identifier_type; + typedef boost::numeric::ublas::matrix_column<M> identifier_type; typedef MC vector_type; typedef typename M::value_type value_type ; - typedef typename default_vector_traits<MC,value_type>::pointer pointer; + typedef typename default_vector_traits<MC,value_type>::pointer pointer; private: - typedef typename detail::generate_const<MC, typename MC::matrix_closure_type>::type m_type; + typedef typename detail::generate_const<MC, typename MC::matrix_closure_type>::type m_type; public: static pointer storage (vector_type& mc) { - m_type& mt = mc.data(); - pointer ptr = matrix_traits<m_type>::storage (mt); + m_type& mt = mc.data(); + pointer ptr = matrix_traits<m_type>::storage (mt); ptr += mc.index() * matrix_traits<m_type>::stride2 (mt); - return ptr; + return ptr; } - static std::ptrdiff_t stride (vector_type& mc) { + static std::ptrdiff_t stride (vector_type& mc) { return matrix_traits<m_type>::stride1 (mc.data()); - } - }; + } + }; + +#ifndef BOOST_NUMERIC_BINDINGS_FORTRAN -#ifndef BOOST_NUMERIC_BINDINGS_FORTRAN - - // (undocumented) ublas::c_matrix<> + // (undocumented) ublas::c_matrix<> template <typename T, std::size_t M, std::size_t N, typename Matr> - struct matrix_detail_traits< boost::numeric::ublas::c_matrix<T,M,N>, Matr > + struct matrix_detail_traits< boost::numeric::ublas::c_matrix<T,M,N>, Matr > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same<boost::numeric::ublas::c_matrix<T,M,N>, typename boost::remove_const<Matr>::type>::value) ); @@ -315,132 +315,132 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { typedef boost::numeric::ublas::c_matrix<T,M,N> identifier_type ; typedef Matr matrix_type; - typedef general_t matrix_structure; - typedef row_major_t ordering_type; + typedef general_t matrix_structure; + typedef row_major_t ordering_type; - typedef T value_type; - typedef typename detail::generate_const<Matr,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<Matr,T>::type* pointer; static pointer storage (matrix_type& m) { return m.data(); } - static std::ptrdiff_t num_rows (matrix_type& m) { return m.size1(); } + static std::ptrdiff_t num_rows (matrix_type& m) { return m.size1(); } static std::ptrdiff_t num_columns (matrix_type& m) { return m.size2(); } static std::ptrdiff_t storage_size (matrix_type& m) { return M * N; } static std::ptrdiff_t leading_dimension (matrix_type& m) { return N; } - // stride1 == distance (m (i, j), m (i+1, j)) + // stride1 == distance (m (i, j), m (i+1, j)) static std::ptrdiff_t stride1 (matrix_type& m) { return N; } - // stride2 == distance (m (i, j), m (i, j+1)) + // stride2 == distance (m (i, j), m (i, j+1)) static std::ptrdiff_t stride2 (matrix_type& m) { return 1; } - }; + }; -#endif // BOOST_NUMERIC_BINDINGS_FORTRAN +#endif // BOOST_NUMERIC_BINDINGS_FORTRAN // ublas::matrix_vector_range<> template <typename M, typename MR> - struct vector_detail_traits< boost::numeric::ublas::matrix_vector_range<M>, MR > - : default_vector_traits< MR, typename M::value_type > + struct vector_detail_traits< boost::numeric::ublas::matrix_vector_range<M>, MR > + : default_vector_traits< MR, typename M::value_type > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::matrix_vector_range<M>, typename boost::remove_const<MR>::type >::value) ); #endif - typedef boost::numeric::ublas::matrix_vector_range<M> identifier_type; + typedef boost::numeric::ublas::matrix_vector_range<M> identifier_type; typedef MR vector_type; typedef typename M::value_type value_type; - typedef typename default_vector_traits<MR,value_type>::pointer pointer; + typedef typename default_vector_traits<MR,value_type>::pointer pointer; static pointer storage (vector_type& mr) { typedef typename detail::generate_const<MR, typename MR::matrix_closure_type>::type m_type; - return matrix_traits<m_type>::storage (mr.data()) + mr.start1() * matrix_traits<m_type>::stride1 (mr.data()) + mr.start2() * matrix_traits<m_type>::stride2 (mr.data()); + return matrix_traits<m_type>::storage (mr.data()) + mr.start1() * matrix_traits<m_type>::stride1 (mr.data()) + mr.start2() * matrix_traits<m_type>::stride2 (mr.data()); } static std::ptrdiff_t stride (vector_type& mr) { typedef typename detail::generate_const<MR, typename MR::matrix_closure_type>::type m_type; return matrix_traits<m_type>::stride1 (mr.data()) + matrix_traits<m_type>::stride2 (mr.data()); - } - }; + } + }; // ublas::matrix_vector_slice<> template <typename M, typename MR> - struct vector_detail_traits< boost::numeric::ublas::matrix_vector_slice<M>, MR > - : default_vector_traits< MR, typename M::value_type > + struct vector_detail_traits< boost::numeric::ublas::matrix_vector_slice<M>, MR > + : default_vector_traits< MR, typename M::value_type > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::matrix_vector_slice<M>, typename boost::remove_const<MR>::type >::value) ); #endif - typedef boost::numeric::ublas::matrix_vector_slice<M> identifier_type; + typedef boost::numeric::ublas::matrix_vector_slice<M> identifier_type; typedef MR vector_type; typedef typename M::value_type value_type; - typedef typename default_vector_traits<MR,value_type>::pointer pointer; + typedef typename default_vector_traits<MR,value_type>::pointer pointer; static pointer storage (vector_type& mr) { typedef typename detail::generate_const<MR, typename MR::matrix_closure_type>::type m_type; - return matrix_traits<m_type>::storage (mr.data()) + mr.start1() * matrix_traits<m_type>::stride1 (mr.data()) + mr.start2() * matrix_traits<m_type>::stride2 (mr.data()); + return matrix_traits<m_type>::storage (mr.data()) + mr.start1() * matrix_traits<m_type>::stride1 (mr.data()) + mr.start2() * matrix_traits<m_type>::stride2 (mr.data()); } static std::ptrdiff_t stride (vector_type& mr) { typedef typename detail::generate_const<MR, typename MR::matrix_closure_type>::type m_type; return mr.stride1() * matrix_traits<m_type>::stride1 (mr.data()) + mr.stride2() * matrix_traits<m_type>::stride2 (mr.data()); - } - }; + } + }; // ublas::bounded_matrix<> template <typename T, std::size_t R, std::size_t C, typename F, typename M> - struct matrix_detail_traits< boost::numeric::ublas::bounded_matrix<T, R, C, F>, M > + struct matrix_detail_traits< boost::numeric::ublas::bounded_matrix<T, R, C, F>, M > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same<boost::numeric::ublas::bounded_matrix<T, R, C, F>, typename boost::remove_const<M>::type>::value) ); #endif #ifdef BOOST_NUMERIC_BINDINGS_FORTRAN BOOST_STATIC_ASSERT((boost::is_same< - typename F::orientation_category, + typename F::orientation_category, boost::numeric::ublas::column_major_tag - >::value)); -#endif + >::value)); +#endif typedef boost::numeric::ublas::bounded_matrix<T, R, C, F> identifier_type ; typedef M matrix_type; - typedef general_t matrix_structure; + typedef general_t matrix_structure; typedef typename detail::ublas_ordering< typename F::orientation_category - >::type ordering_type; + >::type ordering_type; - typedef T value_type; - typedef typename detail::generate_const<M,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<M,T>::type* pointer; - typedef typename identifier_type::orientation_category orientation_category; + typedef typename identifier_type::orientation_category orientation_category; typedef typename detail::ublas_ordering<orientation_category>::functor_type functor_t ; static pointer storage (matrix_type& m) { typedef typename detail::generate_const<M,typename identifier_type::array_type>::type array_type ; - return vector_traits<array_type>::storage (m.data()); + return vector_traits<array_type>::storage (m.data()); } - static std::ptrdiff_t num_rows (matrix_type& m) { return m.size1(); } + static std::ptrdiff_t num_rows (matrix_type& m) { return m.size1(); } static std::ptrdiff_t num_columns (matrix_type& m) { return m.size2(); } static std::ptrdiff_t storage_size (matrix_type& m) { return m.size1() * m.size2(); } static std::ptrdiff_t leading_dimension (matrix_type& m) { - // g++ 2.95.4 and 3.0.4 (with -pedantic) dislike + // g++ 2.95.4 and 3.0.4 (with -pedantic) dislike // identifier_type::functor_type::size2() //return functor_t::size_m (m.size1(), m.size2()); return detail::ublas_ordering<orientation_category>::leading_dimension( m ) ; } - // stride1 == distance (m (i, j), m (i+1, j)) - static std::ptrdiff_t stride1 (matrix_type& m) { + // stride1 == distance (m (i, j), m (i+1, j)) + static std::ptrdiff_t stride1 (matrix_type& m) { //return functor_t::one1 (m.size1(), m.size2()); return detail::ublas_ordering<orientation_category>::stride1( m ) ; - } - // stride2 == distance (m (i, j), m (i, j+1)) - static std::ptrdiff_t stride2 (matrix_type& m) { + } + // stride2 == distance (m (i, j), m (i, j+1)) + static std::ptrdiff_t stride2 (matrix_type& m) { //return functor_t::one2 (m.size1(), m.size2()); return detail::ublas_ordering<orientation_category>::stride2( m ) ; } - }; + }; }}}} -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_MATRIX_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_sparse.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_sparse.hpp index 99f6d7107d005ef928b0e4bab2aa8ada8061e76f..b51976da5569a36a82e518bf46ea6b983e319cb2 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_sparse.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_sparse.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,10 +14,10 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_SPARSE_MATRIX_H #define BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_SPARSE_MATRIX_H -#include <cstddef> +#include <cstddef> #ifndef BOOST_UBLAS_HAVE_BINDINGS -# include <boost/numeric/ublas/matrix_sparse.hpp> -#endif +# include <boost/numeric/ublas/matrix_sparse.hpp> +#endif #include <boost/numeric/bindings/traits/sparse_traits.hpp> #include <boost/numeric/bindings/traits/detail/ublas_ordering.hpp> #include <algorithm> @@ -31,60 +31,60 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { > struct sparse_matrix_detail_traits< boost::numeric::ublas::compressed_matrix<T,F,IB,IA,TA>, - MType + MType > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( + BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::compressed_matrix<T,F,IB,IA,TA>, typename boost::remove_const<MType>::type - >::value) + >::value) ); #endif - typedef + typedef boost::numeric::ublas::compressed_matrix<T,F,IB,IA,TA> identifier_type; typedef MType matrix_type; - typedef general_t matrix_structure; - typedef compressed_t storage_format; + typedef general_t matrix_structure; + typedef compressed_t storage_format; typedef typename detail::ublas_ordering< typename F::orientation_category - >::type ordering_type; + >::type ordering_type; typedef F layout_type; - typedef T value_type; + typedef T value_type; - private: - typedef typename detail::generate_const<MType,TA>::type val_array_t; - typedef typename detail::generate_const<MType,IA>::type idx_array_t; + private: + typedef typename detail::generate_const<MType,TA>::type val_array_t; + typedef typename detail::generate_const<MType,IA>::type idx_array_t; - public: - typedef typename vector_traits<val_array_t>::pointer value_pointer; - typedef typename vector_traits<idx_array_t>::pointer index_pointer; + public: + typedef typename vector_traits<val_array_t>::pointer value_pointer; + typedef typename vector_traits<idx_array_t>::pointer index_pointer; BOOST_STATIC_CONSTANT (std::size_t, index_base = IB); static index_pointer index1_storage (matrix_type& cm) { //assert (cm.filled1() == layout_type::num_rows (cm.size1(), cm.size2()) + 1); - return vector_traits<idx_array_t>::storage (cm.index1_data()); + return vector_traits<idx_array_t>::storage (cm.index1_data()); } static index_pointer index2_storage (matrix_type& cm) { - return vector_traits<idx_array_t>::storage (cm.index2_data()); + return vector_traits<idx_array_t>::storage (cm.index2_data()); } static value_pointer value_storage (matrix_type& cm) { - return vector_traits<val_array_t>::storage (cm.value_data()); + return vector_traits<val_array_t>::storage (cm.value_data()); } - static std::ptrdiff_t num_rows (matrix_type& cm) { return cm.size1(); } + static std::ptrdiff_t num_rows (matrix_type& cm) { return cm.size1(); } static std::ptrdiff_t num_columns (matrix_type& cm) { return cm.size2(); } - static std::ptrdiff_t num_nonzeros (matrix_type& cm) { - return cm.nnz(); + static std::ptrdiff_t num_nonzeros (matrix_type& cm) { + return cm.nnz(); // Joerg, this isn't very intuitive :o( - // return cm.non_zeros(); - } - }; + // return cm.non_zeros(); + } + }; // ublas::coordinate_matrix<> @@ -93,58 +93,58 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { > struct sparse_matrix_detail_traits< boost::numeric::ublas::coordinate_matrix<T,F,IB,IA,TA>, - MType + MType > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( + BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::coordinate_matrix<T,F,IB,IA,TA>, typename boost::remove_const<MType>::type - >::value) + >::value) ); #endif - typedef + typedef boost::numeric::ublas::coordinate_matrix<T,F,IB,IA,TA> identifier_type; typedef MType matrix_type; - typedef general_t matrix_structure; - typedef coordinate_t storage_format; + typedef general_t matrix_structure; + typedef coordinate_t storage_format; typedef typename detail::ublas_ordering< typename F::orientation_category - >::type ordering_type; + >::type ordering_type; - typedef T value_type; + typedef T value_type; - private: - typedef typename detail::generate_const<MType,TA>::type val_array_t; - typedef typename detail::generate_const<MType,IA>::type idx_array_t; + private: + typedef typename detail::generate_const<MType,TA>::type val_array_t; + typedef typename detail::generate_const<MType,IA>::type idx_array_t; - public: - typedef typename vector_traits<val_array_t>::pointer value_pointer; - typedef typename vector_traits<idx_array_t>::pointer index_pointer; + public: + typedef typename vector_traits<val_array_t>::pointer value_pointer; + typedef typename vector_traits<idx_array_t>::pointer index_pointer; BOOST_STATIC_CONSTANT (std::size_t, index_base = IB); static index_pointer index1_storage (matrix_type& cm) { - return vector_traits<idx_array_t>::storage (cm.index1_data()); + return vector_traits<idx_array_t>::storage (cm.index1_data()); } static index_pointer index2_storage (matrix_type& cm) { - return vector_traits<idx_array_t>::storage (cm.index2_data()); + return vector_traits<idx_array_t>::storage (cm.index2_data()); } static value_pointer value_storage (matrix_type& cm) { - return vector_traits<val_array_t>::storage (cm.value_data()); + return vector_traits<val_array_t>::storage (cm.value_data()); } - static int num_rows (matrix_type& cm) { return cm.size1(); } + static int num_rows (matrix_type& cm) { return cm.size1(); } static int num_columns (matrix_type& cm) { return cm.size2(); } - static int num_nonzeros (matrix_type& cm) { - return cm.nnz(); + static int num_nonzeros (matrix_type& cm) { + return cm.nnz(); // Joerg, this isn't very intuitive :o( - // return cm.non_zeros(); - } - }; + // return cm.non_zeros(); + } + }; }}}} diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_symmetric.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_symmetric.hpp index 85262f62054b7d7d7fbd3ce929db08fd876fc2b3..69c589a8fe1e0aa3b4ec46554137b7465b3b868f 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_symmetric.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_symmetric.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -16,11 +16,11 @@ #include <boost/numeric/bindings/traits/traits.hpp> -#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #ifndef BOOST_UBLAS_HAVE_BINDINGS -# include <boost/numeric/ublas/symmetric.hpp> -#endif +# include <boost/numeric/ublas/symmetric.hpp> +#endif #include <boost/numeric/bindings/traits/ublas_matrix.hpp> #include <boost/numeric/bindings/traits/detail/ublas_uplo.hpp> @@ -36,33 +36,33 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #endif #ifdef BOOST_BINDINGS_FORTRAN BOOST_STATIC_ASSERT((boost::is_same< - typename F2::orientation_category, + typename F2::orientation_category, boost::numeric::ublas::column_major_tag - >::value)); -#endif + >::value)); +#endif typedef boost::numeric::ublas::symmetric_matrix<T, F1, F2, A> identifier_type; typedef M matrix_type; - typedef symmetric_packed_t matrix_structure; + typedef symmetric_packed_t matrix_structure; typedef typename detail::ublas_ordering< typename F2::orientation_category - >::type ordering_type; - typedef typename detail::ublas_uplo< F1 >::type uplo_type; + >::type ordering_type; + typedef typename detail::ublas_uplo< F1 >::type uplo_type; - typedef T value_type ; - typedef typename detail::generate_const<M,T>::type* pointer ; + typedef T value_type ; + typedef typename detail::generate_const<M,T>::type* pointer ; static pointer storage (matrix_type& sm) { typedef typename detail::generate_const<M,A>::type array_type ; - return vector_traits<array_type>::storage (sm.data()); + return vector_traits<array_type>::storage (sm.data()); } - static std::ptrdiff_t num_rows (matrix_type& sm) { return sm.size1(); } + static std::ptrdiff_t num_rows (matrix_type& sm) { return sm.size1(); } static std::ptrdiff_t num_columns (matrix_type& sm) { return sm.size2(); } - static std::ptrdiff_t storage_size (matrix_type& sm) { - return (num_rows (sm) + 1) * num_columns (sm) / 2; + static std::ptrdiff_t storage_size (matrix_type& sm) { + return (num_rows (sm) + 1) * num_columns (sm) / 2; } - }; + }; // ublas::symmetric_adaptor<> @@ -75,32 +75,32 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { typedef boost::numeric::ublas::symmetric_adaptor<M, F1> identifier_type; typedef MA matrix_type; - typedef symmetric_t matrix_structure; - typedef typename matrix_traits<M>::ordering_type ordering_type; - typedef typename detail::ublas_uplo< F1 >::type uplo_type; + typedef symmetric_t matrix_structure; + typedef typename matrix_traits<M>::ordering_type ordering_type; + typedef typename detail::ublas_uplo< F1 >::type uplo_type; - typedef typename M::value_type value_type; - typedef typename detail::generate_const<MA, value_type>::type* pointer; + typedef typename M::value_type value_type; + typedef typename detail::generate_const<MA, value_type>::type* pointer; private: - typedef typename detail::generate_const<MA, typename MA::matrix_closure_type>::type m_type; + typedef typename detail::generate_const<MA, typename MA::matrix_closure_type>::type m_type; public: static pointer storage (matrix_type& sm) { return matrix_traits<m_type>::storage (sm.data()); } - static std::ptrdiff_t num_rows (matrix_type& sm) { return sm.size1(); } + static std::ptrdiff_t num_rows (matrix_type& sm) { return sm.size1(); } static std::ptrdiff_t num_columns (matrix_type& sm) { return sm.size2(); } - static std::ptrdiff_t storage_size (matrix_type& sm) { - return num_rows (sm) * num_columns (sm); + static std::ptrdiff_t storage_size (matrix_type& sm) { + return num_rows (sm) * num_columns (sm); } static std::ptrdiff_t leading_dimension (matrix_type& sm) { - return matrix_traits<m_type>::leading_dimension (sm.data()); + return matrix_traits<m_type>::leading_dimension (sm.data()); } - }; + }; }}}} -#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #endif // BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_SYMMETRIC_H diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_vector.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_vector.hpp index 15f362ef5c738e9cabf6ba238909c882dd22399d..481d986bc497249295e70b1a48650b0d022c97cf 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_vector.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_vector.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -20,156 +20,156 @@ #ifndef BOOST_UBLAS_HAVE_BINDINGS # include <boost/numeric/ublas/vector.hpp> -#endif +#endif namespace boost { namespace numeric { namespace bindings { namespace traits { // ublas::vector<> template <typename T, typename ArrT, typename V> - struct vector_detail_traits< boost::numeric::ublas::vector<T, ArrT>, V > - : default_vector_traits< V, T > + struct vector_detail_traits< boost::numeric::ublas::vector<T, ArrT>, V > + : default_vector_traits< V, T > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::vector<T, ArrT>, typename boost::remove_const<V>::type >::value) ); #endif - typedef boost::numeric::ublas::vector<T, ArrT> identifier_type; + typedef boost::numeric::ublas::vector<T, ArrT> identifier_type; typedef V vector_type; typedef typename default_vector_traits< V, T >::pointer pointer; static pointer storage (vector_type& v) { typedef typename detail::generate_const<V,ArrT>::type array_type ; - return vector_traits<array_type>::storage (v.data()); + return vector_traits<array_type>::storage (v.data()); } - }; + }; // ublas::vector_reference<> template <typename V, typename VR> - struct vector_detail_traits< boost::numeric::ublas::vector_reference<V>, VR > - : default_vector_traits< VR, typename V::value_type > + struct vector_detail_traits< boost::numeric::ublas::vector_reference<V>, VR > + : default_vector_traits< VR, typename V::value_type > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::vector_reference<V>, typename boost::remove_const<VR>::type >::value) ); #endif - typedef boost::numeric::ublas::vector_reference<V> identifier_type; + typedef boost::numeric::ublas::vector_reference<V> identifier_type; typedef VR vector_type; typedef typename V::value_type value_type ; - typedef typename default_vector_traits<VR,value_type>::pointer pointer; + typedef typename default_vector_traits<VR,value_type>::pointer pointer; private: typedef typename detail::generate_const<VR,V>::type vct_t; public: static pointer storage (vector_type& v) { - return vector_traits<vct_t>::storage (v.expression()); + return vector_traits<vct_t>::storage (v.expression()); } static std::ptrdiff_t stride (vector_type& v) { - return vector_traits<vct_t>::stride (v.expression()); + return vector_traits<vct_t>::stride (v.expression()); } - }; + }; // ublas::vector_range<> template <typename V, typename VR> - struct vector_detail_traits< boost::numeric::ublas::vector_range<V>, VR > - : default_vector_traits< VR, typename V::value_type > + struct vector_detail_traits< boost::numeric::ublas::vector_range<V>, VR > + : default_vector_traits< VR, typename V::value_type > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::vector_range<V>, typename boost::remove_const<VR>::type >::value) ); #endif - typedef boost::numeric::ublas::vector_range<V> identifier_type; + typedef boost::numeric::ublas::vector_range<V> identifier_type; typedef VR vector_type; typedef typename V::value_type value_type ; - typedef typename default_vector_traits<VR,value_type>::pointer pointer; + typedef typename default_vector_traits<VR,value_type>::pointer pointer; private: - typedef typename detail::generate_const<VR, typename VR::vector_closure_type>::type v_type; + typedef typename detail::generate_const<VR, typename VR::vector_closure_type>::type v_type; public: static pointer storage (vector_type& vr) { - pointer ptr = vector_traits<v_type>::storage (vr.data()); + pointer ptr = vector_traits<v_type>::storage (vr.data()); ptr += vr.start() * vector_traits<v_type>::stride (vr.data()); - return ptr; + return ptr; } static std::ptrdiff_t stride (vector_type& vr) { - return vector_traits<v_type>::stride (vr.data()); + return vector_traits<v_type>::stride (vr.data()); } - }; + }; // ublas::vector_slice<> template <typename V, typename VS> - struct vector_detail_traits<boost::numeric::ublas::vector_slice<V>, VS > - : default_vector_traits< VS, typename V::value_type > + struct vector_detail_traits<boost::numeric::ublas::vector_slice<V>, VS > + : default_vector_traits< VS, typename V::value_type > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::vector_slice<V>, typename boost::remove_const<VS>::type >::value) ); #endif - typedef boost::numeric::ublas::vector_slice<V> identifier_type; + typedef boost::numeric::ublas::vector_slice<V> identifier_type; typedef VS vector_type; typedef typename V::value_type value_type ; - typedef typename default_vector_traits<VS,value_type>::pointer pointer; + typedef typename default_vector_traits<VS,value_type>::pointer pointer; private: - typedef typename detail::generate_const<VS, typename VS::vector_closure_type>::type v_type; + typedef typename detail::generate_const<VS, typename VS::vector_closure_type>::type v_type; public: static pointer storage (vector_type& vs) { - pointer ptr = vector_traits<v_type>::storage (vs.data()); + pointer ptr = vector_traits<v_type>::storage (vs.data()); ptr += vs.start() * vector_traits<v_type>::stride (vs.data()); - return ptr; + return ptr; } static std::ptrdiff_t stride (vector_type& vs) { - return vs.stride() * vector_traits<v_type>::stride (vs.data()); + return vs.stride() * vector_traits<v_type>::stride (vs.data()); } - }; + }; + +#ifndef BOOST_NUMERIC_BINDINGS_FORTRAN -#ifndef BOOST_NUMERIC_BINDINGS_FORTRAN - // (undocumented) ublas::c_vector<> template <typename T, std::size_t N, typename V> - struct vector_detail_traits< boost::numeric::ublas::c_vector<T, N>, V > - : default_vector_traits< V, T > + struct vector_detail_traits< boost::numeric::ublas::c_vector<T, N>, V > + : default_vector_traits< V, T > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::c_vector<T,N>, typename boost::remove_const<V>::type >::value) ); #endif - typedef boost::numeric::ublas::c_vector<T,N> identifier_type; + typedef boost::numeric::ublas::c_vector<T,N> identifier_type; typedef V vector_type; typedef typename default_vector_traits<V,T>::pointer pointer; static pointer storage (vector_type& v) { return v.data(); } - }; + }; -#endif // BOOST_NUMERIC_BINDINGS_FORTRAN +#endif // BOOST_NUMERIC_BINDINGS_FORTRAN // ublas::bounded_vector<> template <typename T, std::size_t N, typename V> - struct vector_detail_traits< boost::numeric::ublas::bounded_vector<T, N>, V > - : default_vector_traits< V, T > + struct vector_detail_traits< boost::numeric::ublas::bounded_vector<T, N>, V > + : default_vector_traits< V, T > { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK BOOST_STATIC_ASSERT( (boost::is_same< boost::numeric::ublas::bounded_vector<T, N>, typename boost::remove_const<V>::type >::value) ); #endif - typedef boost::numeric::ublas::bounded_vector<T, N> identifier_type; + typedef boost::numeric::ublas::bounded_vector<T, N> identifier_type; typedef V vector_type; typedef typename default_vector_traits< V, T >::pointer pointer; static pointer storage (vector_type& v) { typedef typename detail::generate_const<V,typename identifier_type::array_type>::type array_type ; - return vector_traits<array_type>::storage (v.data()); + return vector_traits<array_type>::storage (v.data()); } - }; + }; -}}}} +}}}} #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_vector2.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_vector2.hpp index 26f532f9e2887d8739c982a0145fb2aae887d3fb..c129835eed62e4b6acfe3a531680adc647e45f2c 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_vector2.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/ublas_vector2.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,19 +14,19 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_VECTOR_AS_MATRIX_H #define BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_VECTOR_AS_MATRIX_H -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #ifndef BOOST_UBLAS_HAVE_BINDINGS # include <boost/numeric/bindings/traits/ublas_vector.hpp> -#endif +#endif #include <boost/numeric/bindings/traits/matrix_traits.hpp> #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK # include <boost/static_assert.hpp> # include <boost/type_traits/same_traits.hpp> -# include <boost/mpl/if.hpp> +# include <boost/mpl/if.hpp> #endif @@ -34,138 +34,138 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // ublas::vector<> treated as matrix (nx1) template <typename T, typename ArrT, typename V> - struct matrix_detail_traits<boost::numeric::ublas::vector<T, ArrT>, V> + struct matrix_detail_traits<boost::numeric::ublas::vector<T, ArrT>, V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - boost::numeric::ublas::vector<T, ArrT>, - typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + boost::numeric::ublas::vector<T, ArrT>, + typename boost::remove_const<V>::type >::value) ); #endif typedef boost::numeric::ublas::vector<T, ArrT> identifier_type; - typedef V matrix_type; - typedef general_t matrix_structure; - typedef column_major_t ordering_type; + typedef V matrix_type; + typedef general_t matrix_structure; + typedef column_major_t ordering_type; - typedef T value_type; - typedef typename detail::generate_const<V,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<V,T>::type* pointer; static pointer storage (matrix_type& v) { typedef typename detail::generate_const<V,ArrT>::type array_type; - return vector_traits<array_type>::storage (v.data()); + return vector_traits<array_type>::storage (v.data()); } - static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } + static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } static std::ptrdiff_t num_columns (matrix_type&) { return 1; } static std::ptrdiff_t storage_size (matrix_type& v) { return v.size(); } -// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } +// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } // static std::ptrdiff_t stride2 (matrix_type&) { return 1; } static std::ptrdiff_t leading_dimension (matrix_type& v) { return v.size(); } - }; + }; // ublas::vector_range<> treated as matrix (nx1) template <typename T, typename V> - struct matrix_detail_traits<boost::numeric::ublas::vector_range<T>, V> + struct matrix_detail_traits<boost::numeric::ublas::vector_range<T>, V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - boost::numeric::ublas::vector_range<T>, - typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + boost::numeric::ublas::vector_range<T>, + typename boost::remove_const<V>::type >::value) ); #endif typedef boost::numeric::ublas::vector_range<T> identifier_type; - typedef V matrix_type; - typedef general_t matrix_structure; - typedef column_major_t ordering_type; + typedef V matrix_type; + typedef general_t matrix_structure; + typedef column_major_t ordering_type; - typedef typename T::value_type value_type; - typedef typename detail::generate_const<V,value_type>::type* pointer; + typedef typename T::value_type value_type; + typedef typename detail::generate_const<V,value_type>::type* pointer; static pointer storage (matrix_type& v) { - return vector_traits<V>::storage (v); + return vector_traits<V>::storage (v); } - static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } + static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } static std::ptrdiff_t num_columns (matrix_type&) { return 1; } static std::ptrdiff_t storage_size (matrix_type& v) { return v.size(); } -// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } +// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } // static std::ptrdiff_t stride2 (matrix_type&) { return 1; } static std::ptrdiff_t leading_dimension (matrix_type& v) { return v.size(); } - }; + }; -#ifndef BOOST_NUMERIC_BINDINGS_FORTRAN +#ifndef BOOST_NUMERIC_BINDINGS_FORTRAN // (undocumented) ublas::c_vector<> template <typename T, std::size_t N, typename V> - struct matrix_detail_traits<boost::numeric::ublas::c_vector<T,N>, V> + struct matrix_detail_traits<boost::numeric::ublas::c_vector<T,N>, V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - boost::numeric::ublas::c_vector<T,N>, - typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + boost::numeric::ublas::c_vector<T,N>, + typename boost::remove_const<V>::type >::value) ); #endif typedef boost::numeric::ublas::c_vector<T,N> identifier_type; - typedef V matrix_type; - typedef general_t matrix_structure; - typedef row_major_t ordering_type; // consistent with c_matrix<> + typedef V matrix_type; + typedef general_t matrix_structure; + typedef row_major_t ordering_type; // consistent with c_matrix<> - typedef T value_type; - typedef typename detail::generate_const<V,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<V,T>::type* pointer; static pointer storage (matrix_type& v) { return v.data(); } - static std::ptrdiff_t num_rows (matrix_type&) { return 1; } + static std::ptrdiff_t num_rows (matrix_type&) { return 1; } static std::ptrdiff_t num_columns (matrix_type& v) { return v.size(); } -// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } +// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } // static std::ptrdiff_t stride2 (matrix_type&) { return 1; } static std::ptrdiff_t storage_size (matrix_type&) { return N; } static std::ptrdiff_t leading_dimension (matrix_type&) { return N; } - }; + }; -#endif // BOOST_NUMERIC_BINDINGS_FORTRAN +#endif // BOOST_NUMERIC_BINDINGS_FORTRAN // ublas::bounded_vector<> treated as matrix (nx1) template <typename T, std::size_t N, typename V> - struct matrix_detail_traits<boost::numeric::ublas::bounded_vector<T, N>, V> + struct matrix_detail_traits<boost::numeric::ublas::bounded_vector<T, N>, V> { #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK - BOOST_STATIC_ASSERT( - (boost::is_same< - boost::numeric::ublas::bounded_vector<T, N>, - typename boost::remove_const<V>::type + BOOST_STATIC_ASSERT( + (boost::is_same< + boost::numeric::ublas::bounded_vector<T, N>, + typename boost::remove_const<V>::type >::value) ); #endif typedef boost::numeric::ublas::bounded_vector<T, N> identifier_type; - typedef V matrix_type; - typedef general_t matrix_structure; - typedef column_major_t ordering_type; + typedef V matrix_type; + typedef general_t matrix_structure; + typedef column_major_t ordering_type; - typedef T value_type; - typedef typename detail::generate_const<V,T>::type* pointer; + typedef T value_type; + typedef typename detail::generate_const<V,T>::type* pointer; static pointer storage (matrix_type& v) { typedef typename detail::generate_const<V,typename identifier_type::array_type>::type array_type; - return vector_traits<array_type>::storage (v.data()); + return vector_traits<array_type>::storage (v.data()); } - static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } + static std::ptrdiff_t num_rows (matrix_type& v) { return v.size(); } static std::ptrdiff_t num_columns (matrix_type&) { return 1; } static std::ptrdiff_t storage_size (matrix_type& v) { return v.size(); } -// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } +// static std::ptrdiff_t stride1 (matrix_type& v) { return vector_traits<V>::stride (v); } // static std::ptrdiff_t stride2 (matrix_type&) { return 1; } static std::ptrdiff_t leading_dimension (matrix_type& v) { return v.size(); } - }; + }; -}}}} +}}}} -#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS +#else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS #error with your compiler ublas::vector<> cannot be used as matrix diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/vector_raw.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/vector_raw.hpp index 2fdeff76c476959ebdcd4776ffb4e2cf6591bda9..d1b6f5cd27dd999171d8cf6f1a612c8cd4fe17de 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/vector_raw.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/vector_raw.hpp @@ -2,21 +2,21 @@ // Copyright (c) 2002,2003,2004 // Toon Knapen, Kresimir Fresl, Joerg Walter, Karl Meerbergen // -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// 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_BINDINGS_TRAITS_VECTOR_RAW_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_VECTOR_RAW_HPP -#include <cstddef> -#include <boost/numeric/ublas/config.hpp> +#include <cstddef> +#include <boost/numeric/ublas/config.hpp> #ifndef BOOST_UBLAS_HAVE_BINDINGS -# include <boost/numeric/ublas/vector.hpp> -#endif -#include <vector> -#include <boost/numeric/bindings/traits/detail/array_impl.hpp> +# include <boost/numeric/ublas/vector.hpp> +#endif +#include <vector> +#include <boost/numeric/bindings/traits/detail/array_impl.hpp> namespace boost { namespace numeric { namespace bindings { namespace traits { @@ -27,25 +27,25 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { } //////////////////////////////////////////////////////////////// - // ublas::vector<> etc. + // ublas::vector<> etc. - namespace ublas = boost::numeric::ublas; + namespace ublas = boost::numeric::ublas; #if 0 - // MSVC seems to dislike overloads if there is `generic' template + // MSVC seems to dislike overloads if there is `generic' template template <typename V> BOOST_UBLAS_INLINE int vector_size (const ublas::vector_reference<V> &v) { return vector_size (v.expression()); } -#endif +#endif #if 0 - // MSVC seems to dislike overloads if there is `generic' template + // MSVC seems to dislike overloads if there is `generic' template template <typename V> BOOST_UBLAS_INLINE int vector_stride (const V &v) { return 1; } -#endif +#endif template <typename T, typename A> BOOST_UBLAS_INLINE int vector_stride (const ublas::vector<T,A> &v) { return 1; } @@ -74,7 +74,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename T, typename A> BOOST_UBLAS_INLINE - typename ublas::vector<T,A>::value_type const* + typename ublas::vector<T,A>::value_type const* vector_storage (const ublas::vector<T,A> &v) { return &v.data().begin()[0]; } @@ -83,19 +83,19 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template <typename T, typename A> BOOST_UBLAS_INLINE - typename ublas::vector<T,A>::value_type const* + typename ublas::vector<T,A>::value_type const* vector_storage_const (const ublas::vector<T,A> &v) { return &v.data().begin()[0]; } template <typename T, typename A> BOOST_UBLAS_INLINE - typename ublas::vector<T,A>::value_type* + typename ublas::vector<T,A>::value_type* vector_storage (ublas::vector<T,A> &v) { return &v.data().begin()[0]; } #if 0 - // MSVC seems to dislike overloads if there is `generic' template + // MSVC seems to dislike overloads if there is `generic' template #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename V> BOOST_UBLAS_INLINE @@ -115,12 +115,12 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { typename V::pointer vector_storage (V &v) { return &v.data().begin()[0]; } -#endif +#endif #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename V> BOOST_UBLAS_INLINE - typename V::value_type const* + typename V::value_type const* vector_storage (const ublas::vector_reference<V> &v) { return vector_storage (v.expression()); } @@ -129,7 +129,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template <typename V> BOOST_UBLAS_INLINE - typename V::value_type const* + typename V::value_type const* vector_storage_const (const ublas::vector_reference<V> &v) { return vector_storage_const (v.expression()); } @@ -142,7 +142,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename T, std::size_t N> BOOST_UBLAS_INLINE - typename ublas::c_vector<T, N>::value_type const* + typename ublas::c_vector<T, N>::value_type const* vector_storage (const ublas::c_vector<T, N> &v) { return v.data(); } @@ -152,13 +152,13 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // But how shall we write portable code otherwise? template <typename T, std::size_t N> BOOST_UBLAS_INLINE - typename ublas::c_vector<T, N>::value_type const* + typename ublas::c_vector<T, N>::value_type const* vector_storage_const (const ublas::c_vector<T, N> &v) { return v.data(); } template <typename T, std::size_t N> BOOST_UBLAS_INLINE - typename ublas::c_vector<T, N>::value_type* + typename ublas::c_vector<T, N>::value_type* vector_storage (ublas::c_vector<T, N> &v) { return v.data(); } @@ -185,11 +185,11 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // We need storage_const() mostly due to MSVC 6.0. // But how shall we write portable code otherwise? template <typename V> - typename V::value_type const* + typename V::value_type const* vector_storage_const (const ublas::vector_slice<V>&); template <typename V> BOOST_UBLAS_INLINE - typename V::value_type const* + typename V::value_type const* vector_storage_const (const ublas::vector_range<V> &v) { typename V::value_type const* ptr = vector_storage_const (v.data()); ptr += v.start() * vector_stride (v.data()); @@ -197,7 +197,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { } template <typename V> BOOST_UBLAS_INLINE - typename V::value_type const* + typename V::value_type const* vector_storage_const (const ublas::vector_slice<V> &v) { typename V::value_type const* ptr = vector_storage_const (v.data()); ptr += v.start() * vector_stride (v.data()); @@ -222,7 +222,7 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { ////////////////////////////////////////////////////////////////// - // std::vector<> + // std::vector<> template <typename T, typename A> BOOST_UBLAS_INLINE @@ -231,14 +231,14 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template <typename T, typename A> BOOST_UBLAS_INLINE - typename std::vector<T, A>::value_type const* + typename std::vector<T, A>::value_type const* vector_storage (const std::vector<T, A> &v) { return &v.front(); } #endif // We need storage_const() mostly due to MSVC 6.0. // But how shall we write portable code otherwise? template <typename T, typename A> BOOST_UBLAS_INLINE - typename std::vector<T, A>::value_type const* + typename std::vector<T, A>::value_type const* vector_storage_const (const std::vector<T, A> &v) { return &v.front(); } template <typename T, typename A> BOOST_UBLAS_INLINE @@ -255,18 +255,18 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { int vector_stride (const detail::array<T> &a) { return 1; } #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - template <typename T> + template <typename T> BOOST_UBLAS_INLINE const T* vector_storage (const detail::array<T> &a) { return a.storage(); } -#endif +#endif // We need storage_const() mostly due to MSVC 6.0. // But how shall we write portable code otherwise? - template <typename T> + template <typename T> BOOST_UBLAS_INLINE - const T* vector_storage_const (const detail::array<T> &a) { - return a.storage(); + const T* vector_storage_const (const detail::array<T> &a) { + return a.storage(); } - template <typename T> + template <typename T> BOOST_UBLAS_INLINE T* vector_storage (detail::array<T> &a) { return a.storage(); } diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/vector_traits.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/vector_traits.hpp index d7a01cec19a59fb95da431071ac674c2f38c7969..d74d72013e3e00fa45dd373887a909b8d61afe22 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/vector_traits.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/traits/vector_traits.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * 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) * - * KF acknowledges the support of the Faculty of Civil Engineering, + * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -14,16 +14,16 @@ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_VECTOR_TRAITS_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_VECTOR_TRAITS_HPP -#include <boost/numeric/bindings/traits/config.hpp> +#include <boost/numeric/bindings/traits/config.hpp> #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS -#include <boost/numeric/bindings/traits/detail/generate_const.hpp> -#include <boost/type_traits/remove_const.hpp> +#include <boost/numeric/bindings/traits/detail/generate_const.hpp> +#include <boost/type_traits/remove_const.hpp> #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK -# include <boost/type_traits/is_same.hpp> -# include <boost/static_assert.hpp> -#endif +# include <boost/type_traits/is_same.hpp> +# include <boost/static_assert.hpp> +#endif namespace boost { namespace numeric { namespace bindings { namespace traits { @@ -33,13 +33,13 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { /// functions. template <typename V, typename T = typename V::value_type > struct default_vector_traits { - typedef T value_type; + typedef T value_type; typedef typename detail::generate_const<V,value_type>::type* pointer; // if V is const, pointer will be a const value_type* static pointer storage (V& v) { return &v[0]; } - static std::ptrdiff_t size (V& v) { return static_cast<std::ptrdiff_t>(v.size()); } - static std::ptrdiff_t stride (V&) { return 1; } - }; + static std::ptrdiff_t size (V& v) { return static_cast<std::ptrdiff_t>(v.size()); } + static std::ptrdiff_t stride (V&) { return 1; } + }; // vector_detail_traits is used to implement specializations of vector_traits. // VIdentifier is the vector_type without const, while VType can have a const. @@ -48,46 +48,46 @@ namespace boost { namespace numeric { namespace bindings { namespace traits { // e.g. vector_detail_traits< std::vector<int>, std::vector<int> > // Note that boost::remove_const<VType>::type == VIdentifier. template <typename VIdentifier, typename VType> - struct vector_detail_traits : default_vector_traits<VType, typename VType::value_type > + struct vector_detail_traits : default_vector_traits<VType, typename VType::value_type > { - typedef VIdentifier identifier_type; - typedef VType vector_type; + typedef VIdentifier identifier_type; + typedef VType vector_type; }; - // vector_traits<> generic version: + // vector_traits<> generic version: template <typename V> - struct vector_traits : vector_detail_traits< typename boost::remove_const<V>::type, V > {}; + struct vector_traits : vector_detail_traits< typename boost::remove_const<V>::type, V > {}; /////////////////////////// // - // free accessor functions: + // free accessor functions: // /////////////////////////// template <typename V> - inline - typename vector_traits<V>::pointer vector_storage (V& v) { - return vector_traits<V>::storage (v); + inline + typename vector_traits<V>::pointer vector_storage (V& v) { + return vector_traits<V>::storage (v); } template <typename V> inline - std::ptrdiff_t vector_size (V& v) { - return vector_traits<V>::size (v); + std::ptrdiff_t vector_size (V& v) { + return vector_traits<V>::size (v); } template <typename V> inline - std::ptrdiff_t vector_stride (V& v) { - return vector_traits<V>::stride (v); + std::ptrdiff_t vector_stride (V& v) { + return vector_traits<V>::stride (v); } }}}} #else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS -#include <boost/numeric/bindings/traits/vector_raw.hpp> +#include <boost/numeric/bindings/traits/vector_raw.hpp> #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack.hpp index ccac1910920630c826653dac32bf59a6b7fb2cd2..68d0c6f91192d116bb281ec9849abd9eac6396cc 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack.hpp @@ -1,24 +1,24 @@ /* - * - * Copyright (c) Kresimir Fresl 2003 + * + * Copyright (c) Kresimir Fresl 2003 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ -/* for UMFPACK Copyright, License and Availability see umfpack_inc.hpp */ +/* for UMFPACK Copyright, License and Availability see umfpack_inc.hpp */ #ifndef BOOST_NUMERIC_BINDINGS_UMFPACK_HPP #define BOOST_NUMERIC_BINDINGS_UMFPACK_HPP -#include <boost/noncopyable.hpp> +#include <boost/noncopyable.hpp> #include <boost/numeric/bindings/traits/traits.hpp> #include <boost/numeric/bindings/traits/sparse_traits.hpp> #include <boost/numeric/bindings/umfpack/umfpack_overloads.hpp> @@ -28,37 +28,37 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { template <typename T = double> - struct symbolic_type : private noncopyable { - void *ptr; + struct symbolic_type : private noncopyable { + void *ptr; symbolic_type():ptr(0){} - ~symbolic_type() { + ~symbolic_type() { if (ptr) - detail::free_symbolic (T(), 0, &ptr); + detail::free_symbolic (T(), 0, &ptr); } void free() { if (ptr) - detail::free_symbolic (T(), 0, &ptr); - ptr = 0; + detail::free_symbolic (T(), 0, &ptr); + ptr = 0; } - }; + }; template <typename T> void free (symbolic_type<T>& s) { s.free(); } template <typename T = double> - struct numeric_type : private noncopyable { - void *ptr; + struct numeric_type : private noncopyable { + void *ptr; numeric_type():ptr(0){} - ~numeric_type() { + ~numeric_type() { if (ptr) - detail::free_numeric (T(), 0, &ptr); + detail::free_numeric (T(), 0, &ptr); } - void free() { + void free() { if (ptr) - detail::free_numeric (T(), 0, &ptr); - ptr = 0; + detail::free_numeric (T(), 0, &ptr); + ptr = 0; } - }; + }; template <typename T> void free (numeric_type<T>& n) { n.free(); } @@ -66,22 +66,22 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { template <typename T = double> struct control_type : private noncopyable { - double ptr[UMFPACK_CONTROL]; + double ptr[UMFPACK_CONTROL]; control_type() { detail::defaults (T(), 0, ptr); } double operator[] (int i) const { return ptr[i]; } double& operator[] (int i) { return ptr[i]; } void defaults() { detail::defaults (T(), 0, ptr); } - }; + }; template <typename T> - void defaults (control_type<T>& c) { c.defaults(); } + void defaults (control_type<T>& c) { c.defaults(); } template <typename T = double> struct info_type : private noncopyable { - double ptr[UMFPACK_INFO]; + double ptr[UMFPACK_INFO]; double operator[] (int i) const { return ptr[i]; } double& operator[] (int i) { return ptr[i]; } - }; + }; ///////////////////////////////////// @@ -89,8 +89,8 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { ///////////////////////////////////// - // symbolic - /* + // symbolic + /* * Given nonzero pattern of a sparse matrix A in column-oriented form, * umfpack_*_symbolic performs a column pre-ordering to reduce fill-in * (using COLAMD or AMD) and a symbolic factorisation. This is required @@ -100,377 +100,377 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { template <typename MatrA> inline - int symbolic (traits::compressed_t, - MatrA const& A, void **Symbolic, - double const* Control = 0, double* Info = 0) + int symbolic (traits::compressed_t, + MatrA const& A, void **Symbolic, + double const* Control = 0, double* Info = 0) { return detail::symbolic (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - Symbolic, Control, Info); + Symbolic, Control, Info); } template <typename MatrA, typename QVec> inline - int symbolic (traits::compressed_t, - MatrA const& A, QVec const& Qinit, void **Symbolic, - double const* Control = 0, double* Info = 0) + int symbolic (traits::compressed_t, + MatrA const& A, QVec const& Qinit, void **Symbolic, + double const* Control = 0, double* Info = 0) { return detail::qsymbolic (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - traits::vector_storage (Qinit), - Symbolic, Control, Info); + traits::vector_storage (Qinit), + Symbolic, Control, Info); } template <typename MatrA> inline - int symbolic (traits::coordinate_t, - MatrA const& A, void **Symbolic, - double const* Control = 0, double* Info = 0) + int symbolic (traits::coordinate_t, + MatrA const& A, void **Symbolic, + double const* Control = 0, double* Info = 0) { - int n_row = traits::spmatrix_size1 (A); - int n_col = traits::spmatrix_size2 (A); - int nnz = traits::spmatrix_num_nonzeros (A); + int n_row = traits::spmatrix_size1 (A); + int n_col = traits::spmatrix_size2 (A); + int nnz = traits::spmatrix_num_nonzeros (A); - typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; + typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); - traits::detail::array<int> Ap (n_col+1); + int const* Tj = traits::spmatrix_index1_storage (A); + traits::detail::array<int> Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<int> Ai (nnz); + traits::detail::array<int> Ai (nnz); if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory; - int status = detail::triplet_to_col (n_row, n_col, nnz, + int status = detail::triplet_to_col (n_row, n_col, nnz, Ti, Tj, static_cast<val_t*> (0), - Ap.storage(), Ai.storage(), - static_cast<val_t*> (0), 0); - if (status != UMFPACK_OK) return status; + Ap.storage(), Ai.storage(), + static_cast<val_t*> (0), 0); + if (status != UMFPACK_OK) return status; - return detail::symbolic (n_row, n_col, + return detail::symbolic (n_row, n_col, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), - Symbolic, Control, Info); + Symbolic, Control, Info); } template <typename MatrA, typename QVec> inline - int symbolic (traits::coordinate_t, - MatrA const& A, QVec const& Qinit, void **Symbolic, - double const* Control = 0, double* Info = 0) + int symbolic (traits::coordinate_t, + MatrA const& A, QVec const& Qinit, void **Symbolic, + double const* Control = 0, double* Info = 0) { - int n_row = traits::spmatrix_size1 (A); - int n_col = traits::spmatrix_size2 (A); - int nnz = traits::spmatrix_num_nonzeros (A); + int n_row = traits::spmatrix_size1 (A); + int n_col = traits::spmatrix_size2 (A); + int nnz = traits::spmatrix_num_nonzeros (A); - typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; + typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); - traits::detail::array<int> Ap (n_col+1); + int const* Tj = traits::spmatrix_index1_storage (A); + traits::detail::array<int> Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<int> Ai (nnz); + traits::detail::array<int> Ai (nnz); if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory; - int status = detail::triplet_to_col (n_row, n_col, nnz, + int status = detail::triplet_to_col (n_row, n_col, nnz, Ti, Tj, static_cast<val_t*> (0), - Ap.storage(), Ai.storage(), - static_cast<val_t*> (0), 0); - if (status != UMFPACK_OK) return status; + Ap.storage(), Ai.storage(), + static_cast<val_t*> (0), 0); + if (status != UMFPACK_OK) return status; - return detail::qsymbolic (n_row, n_col, + return detail::qsymbolic (n_row, n_col, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), - traits::vector_storage (Qinit), - Symbolic, Control, Info); + traits::vector_storage (Qinit), + Symbolic, Control, Info); } - } // detail - + } // detail + template <typename MatrA> inline - int symbolic (MatrA const& A, + int symbolic (MatrA const& A, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Symbolic, - double const* Control = 0, double* Info = 0) + >& Symbolic, + double const* Control = 0, double* Info = 0) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::sparse_matrix_traits<MatrA>::matrix_structure, + typename traits::sparse_matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::sparse_matrix_traits<MatrA>::ordering_type, traits::column_major_t - >::value)); + >::value)); BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0); -#endif +#endif - typedef - typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; + typedef + typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT( (boost::is_same<storage_f, traits::compressed_t>::value - || + || boost::is_same<storage_f, traits::coordinate_t>::value - )); -#endif + )); +#endif - return detail::symbolic (storage_f(), A, &Symbolic.ptr, Control, Info); + return detail::symbolic (storage_f(), A, &Symbolic.ptr, Control, Info); } template <typename MatrA> inline - int symbolic (MatrA const& A, + int symbolic (MatrA const& A, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Symbolic, + >& Symbolic, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Control, + > const& Control, info_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Info) + >& Info) { - return symbolic (A, Symbolic, Control.ptr, Info.ptr); + return symbolic (A, Symbolic, Control.ptr, Info.ptr); } template <typename MatrA> inline - int symbolic (MatrA const& A, + int symbolic (MatrA const& A, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Symbolic, + >& Symbolic, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type > const& Control) { - return symbolic (A, Symbolic, Control.ptr); + return symbolic (A, Symbolic, Control.ptr); } template <typename MatrA, typename QVec> inline - int symbolic (MatrA const& A, QVec const& Qinit, + int symbolic (MatrA const& A, QVec const& Qinit, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Symbolic, - double const* Control = 0, double* Info = 0) + >& Symbolic, + double const* Control = 0, double* Info = 0) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::sparse_matrix_traits<MatrA>::matrix_structure, + typename traits::sparse_matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::sparse_matrix_traits<MatrA>::ordering_type, traits::column_major_t - >::value)); + >::value)); BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0); -#endif +#endif - typedef - typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; + typedef + typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT( (boost::is_same<storage_f, traits::compressed_t>::value - || + || boost::is_same<storage_f, traits::coordinate_t>::value - )); -#endif + )); +#endif - assert (traits::spmatrix_size2 (A) == traits::vector_size (Qinit)); + assert (traits::spmatrix_size2 (A) == traits::vector_size (Qinit)); - return detail::symbolic (storage_f(), A, Qinit, - &Symbolic.ptr, Control, Info); + return detail::symbolic (storage_f(), A, Qinit, + &Symbolic.ptr, Control, Info); } template <typename MatrA, typename QVec> inline - int symbolic (MatrA const& A, QVec const& Qinit, + int symbolic (MatrA const& A, QVec const& Qinit, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Symbolic, + >& Symbolic, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Control, + > const& Control, info_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Info) + >& Info) { - return symbolic (A, Qinit, Symbolic, Control.ptr, Info.ptr); + return symbolic (A, Qinit, Symbolic, Control.ptr, Info.ptr); } template <typename MatrA, typename QVec> inline - int symbolic (MatrA const& A, QVec const& Qinit, + int symbolic (MatrA const& A, QVec const& Qinit, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Symbolic, + >& Symbolic, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type > const& Control) { - return symbolic (A, Qinit, Symbolic, Control.ptr); + return symbolic (A, Qinit, Symbolic, Control.ptr); } - // numeric + // numeric /* * Given a sparse matrix A in column-oriented form, and a symbolic analysis - * computed by umfpack_*_*symbolic, the umfpack_*_numeric routine performs - * the numerical factorisation, PAQ=LU, PRAQ=LU, or P(R\A)Q=LU, where P - * and Q are permutation matrices (represented as permutation vectors), - * R is the row scaling, L is unit-lower triangular, and U is upper - * triangular. This is required before the system Ax=b (or other related - * linear systems) can be solved. + * computed by umfpack_*_*symbolic, the umfpack_*_numeric routine performs + * the numerical factorisation, PAQ=LU, PRAQ=LU, or P(R\A)Q=LU, where P + * and Q are permutation matrices (represented as permutation vectors), + * R is the row scaling, L is unit-lower triangular, and U is upper + * triangular. This is required before the system Ax=b (or other related + * linear systems) can be solved. */ namespace detail { template <typename MatrA> inline - int numeric (traits::compressed_t, MatrA const& A, - void *Symbolic, void** Numeric, - double const* Control = 0, double* Info = 0) + int numeric (traits::compressed_t, MatrA const& A, + void *Symbolic, void** Numeric, + double const* Control = 0, double* Info = 0) { return detail::numeric (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - Symbolic, Numeric, Control, Info); + Symbolic, Numeric, Control, Info); } template <typename MatrA> inline - int numeric (traits::coordinate_t, MatrA const& A, - void *Symbolic, void** Numeric, - double const* Control = 0, double* Info = 0) + int numeric (traits::coordinate_t, MatrA const& A, + void *Symbolic, void** Numeric, + double const* Control = 0, double* Info = 0) { - int n_row = traits::spmatrix_size1 (A); - int n_col = traits::spmatrix_size2 (A); - int nnz = traits::spmatrix_num_nonzeros (A); + int n_row = traits::spmatrix_size1 (A); + int n_col = traits::spmatrix_size2 (A); + int nnz = traits::spmatrix_num_nonzeros (A); - typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; + typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); - traits::detail::array<int> Ap (n_col+1); + int const* Tj = traits::spmatrix_index1_storage (A); + traits::detail::array<int> Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<int> Ai (nnz); + traits::detail::array<int> Ai (nnz); if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory; - int status = detail::triplet_to_col (n_row, n_col, nnz, + int status = detail::triplet_to_col (n_row, n_col, nnz, Ti, Tj, static_cast<val_t*> (0), - Ap.storage(), Ai.storage(), - static_cast<val_t*> (0), 0); - if (status != UMFPACK_OK) return status; + Ap.storage(), Ai.storage(), + static_cast<val_t*> (0), 0); + if (status != UMFPACK_OK) return status; - return detail::numeric (n_row, n_col, + return detail::numeric (n_row, n_col, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), - Symbolic, Numeric, Control, Info); + Symbolic, Numeric, Control, Info); } - } // detail + } // detail template <typename MatrA> inline - int numeric (MatrA const& A, + int numeric (MatrA const& A, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Symbolic, + > const& Symbolic, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Numeric, - double const* Control = 0, double* Info = 0) + >& Numeric, + double const* Control = 0, double* Info = 0) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::sparse_matrix_traits<MatrA>::matrix_structure, + typename traits::sparse_matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::sparse_matrix_traits<MatrA>::ordering_type, traits::column_major_t - >::value)); + >::value)); BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0); -#endif +#endif - typedef - typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; + typedef + typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT( (boost::is_same<storage_f, traits::compressed_t>::value - || + || boost::is_same<storage_f, traits::coordinate_t>::value - )); -#endif + )); +#endif - return detail::numeric (storage_f(), A, - Symbolic.ptr, &Numeric.ptr, Control, Info); + return detail::numeric (storage_f(), A, + Symbolic.ptr, &Numeric.ptr, Control, Info); } template <typename MatrA> inline - int numeric (MatrA const& A, + int numeric (MatrA const& A, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Symbolic, + > const& Symbolic, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Numeric, + >& Numeric, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Control, + > const& Control, info_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Info) + >& Info) { - // g++ (3.2) is unable to distinguish - // function numeric() and namespace boost::numeric ;o) - return umfpack::numeric (A, Symbolic, Numeric, Control.ptr, Info.ptr); + // g++ (3.2) is unable to distinguish + // function numeric() and namespace boost::numeric ;o) + return umfpack::numeric (A, Symbolic, Numeric, Control.ptr, Info.ptr); } - + template <typename MatrA> inline - int numeric (MatrA const& A, + int numeric (MatrA const& A, symbolic_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Symbolic, + > const& Symbolic, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Numeric, + >& Numeric, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type > const& Control) { - return umfpack::numeric (A, Symbolic, Numeric, Control.ptr); + return umfpack::numeric (A, Symbolic, Numeric, Control.ptr); } - - // factor - /* + + // factor + /* * symbolic and numeric */ namespace detail { template <typename MatrA> inline - int factor (traits::compressed_t, MatrA const& A, - void** Numeric, double const* Control = 0, double* Info = 0) + int factor (traits::compressed_t, MatrA const& A, + void** Numeric, double const* Control = 0, double* Info = 0) { symbolic_type<typename traits::sparse_matrix_traits<MatrA>::value_type> - Symbolic; + Symbolic; int status; status = detail::symbolic (traits::spmatrix_size1 (A), @@ -478,135 +478,135 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - &Symbolic.ptr, Control, Info); - if (status != UMFPACK_OK) return status; + &Symbolic.ptr, Control, Info); + if (status != UMFPACK_OK) return status; return detail::numeric (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - Symbolic.ptr, Numeric, Control, Info); + Symbolic.ptr, Numeric, Control, Info); } template <typename MatrA> inline - int factor (traits::coordinate_t, MatrA const& A, - void** Numeric, double const* Control = 0, double* Info = 0) + int factor (traits::coordinate_t, MatrA const& A, + void** Numeric, double const* Control = 0, double* Info = 0) { - int n_row = traits::spmatrix_size1 (A); - int n_col = traits::spmatrix_size2 (A); - int nnz = traits::spmatrix_num_nonzeros (A); + int n_row = traits::spmatrix_size1 (A); + int n_col = traits::spmatrix_size2 (A); + int nnz = traits::spmatrix_num_nonzeros (A); - typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; + typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); - traits::detail::array<int> Ap (n_col+1); + int const* Tj = traits::spmatrix_index1_storage (A); + traits::detail::array<int> Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<int> Ai (nnz); + traits::detail::array<int> Ai (nnz); if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory; - int status = detail::triplet_to_col (n_row, n_col, nnz, + int status = detail::triplet_to_col (n_row, n_col, nnz, Ti, Tj, static_cast<val_t*> (0), - Ap.storage(), Ai.storage(), - static_cast<val_t*> (0), 0); - if (status != UMFPACK_OK) return status; + Ap.storage(), Ai.storage(), + static_cast<val_t*> (0), 0); + if (status != UMFPACK_OK) return status; symbolic_type<typename traits::sparse_matrix_traits<MatrA>::value_type> - Symbolic; + Symbolic; - status = detail::symbolic (n_row, n_col, + status = detail::symbolic (n_row, n_col, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), - &Symbolic.ptr, Control, Info); - if (status != UMFPACK_OK) return status; + &Symbolic.ptr, Control, Info); + if (status != UMFPACK_OK) return status; - return detail::numeric (n_row, n_col, + return detail::numeric (n_row, n_col, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), - Symbolic.ptr, Numeric, Control, Info); + Symbolic.ptr, Numeric, Control, Info); } - } // detail + } // detail template <typename MatrA> inline - int factor (MatrA const& A, + int factor (MatrA const& A, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Numeric, - double const* Control = 0, double* Info = 0) + >& Numeric, + double const* Control = 0, double* Info = 0) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::sparse_matrix_traits<MatrA>::matrix_structure, + typename traits::sparse_matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::sparse_matrix_traits<MatrA>::ordering_type, traits::column_major_t - >::value)); + >::value)); BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0); -#endif +#endif - typedef - typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; + typedef + typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT( (boost::is_same<storage_f, traits::compressed_t>::value - || + || boost::is_same<storage_f, traits::coordinate_t>::value - )); -#endif + )); +#endif - return detail::factor (storage_f(), A, &Numeric.ptr, Control, Info); + return detail::factor (storage_f(), A, &Numeric.ptr, Control, Info); } template <typename MatrA> inline - int factor (MatrA const& A, + int factor (MatrA const& A, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Numeric, + >& Numeric, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Control, + > const& Control, info_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Info) + >& Info) { - return factor (A, Numeric, Control.ptr, Info.ptr); + return factor (A, Numeric, Control.ptr, Info.ptr); } - + template <typename MatrA> inline - int factor (MatrA const& A, + int factor (MatrA const& A, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Numeric, + >& Numeric, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type > const& Control) { - return factor (A, Numeric, Control.ptr); + return factor (A, Numeric, Control.ptr); } - - + + // solve /* - * Given LU factors computed by umfpack_*_numeric and the right-hand-side, - * B, solve a linear system for the solution X. Iterative refinement is - * optionally performed. Only square systems are handled. + * Given LU factors computed by umfpack_*_numeric and the right-hand-side, + * B, solve a linear system for the solution X. Iterative refinement is + * optionally performed. Only square systems are handled. */ namespace detail { - template <typename MatrA, typename VecX, typename VecB> - inline - int solve (traits::compressed_t, int sys, - MatrA const& A, VecX& X, VecB const& B, - void *Numeric, double const* Control = 0, double* Info = 0) + template <typename MatrA, typename VecX, typename VecB> + inline + int solve (traits::compressed_t, int sys, + MatrA const& A, VecX& X, VecB const& B, + void *Numeric, double const* Control = 0, double* Info = 0) { return detail::solve (sys, traits::spmatrix_size1 (A), traits::spmatrix_index1_storage (A), @@ -614,169 +614,169 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { traits::spmatrix_value_storage (A), traits::vector_storage (X), traits::vector_storage (B), - Numeric, Control, Info); + Numeric, Control, Info); } - template <typename MatrA, typename VecX, typename VecB> - inline - int solve (traits::coordinate_t, int sys, - MatrA const& A, VecX& X, VecB const& B, - void *Numeric, double const* Control = 0, double* Info = 0) + template <typename MatrA, typename VecX, typename VecB> + inline + int solve (traits::coordinate_t, int sys, + MatrA const& A, VecX& X, VecB const& B, + void *Numeric, double const* Control = 0, double* Info = 0) { - int n = traits::spmatrix_size1 (A); - int nnz = traits::spmatrix_num_nonzeros (A); + int n = traits::spmatrix_size1 (A); + int nnz = traits::spmatrix_num_nonzeros (A); - typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; + typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); - traits::detail::array<int> Ap (n+1); + int const* Tj = traits::spmatrix_index1_storage (A); + traits::detail::array<int> Ap (n+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<int> Ai (nnz); + traits::detail::array<int> Ai (nnz); if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory; - int status = detail::triplet_to_col (n, n, nnz, + int status = detail::triplet_to_col (n, n, nnz, Ti, Tj, static_cast<val_t*> (0), - Ap.storage(), Ai.storage(), - static_cast<val_t*> (0), 0); - if (status != UMFPACK_OK) return status; - + Ap.storage(), Ai.storage(), + static_cast<val_t*> (0), 0); + if (status != UMFPACK_OK) return status; + return detail::solve (sys, n, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), traits::vector_storage (X), traits::vector_storage (B), - Numeric, Control, Info); + Numeric, Control, Info); } - } // detail + } // detail - template <typename MatrA, typename VecX, typename VecB> - inline - int solve (int sys, MatrA const& A, VecX& X, VecB const& B, + template <typename MatrA, typename VecX, typename VecB> + inline + int solve (int sys, MatrA const& A, VecX& X, VecB const& B, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Numeric, - double const* Control = 0, double* Info = 0) + > const& Numeric, + double const* Control = 0, double* Info = 0) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::sparse_matrix_traits<MatrA>::matrix_structure, + typename traits::sparse_matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::sparse_matrix_traits<MatrA>::ordering_type, traits::column_major_t - >::value)); + >::value)); BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0); -#endif +#endif - typedef - typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; + typedef + typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT( (boost::is_same<storage_f, traits::compressed_t>::value - || + || boost::is_same<storage_f, traits::coordinate_t>::value - )); -#endif + )); +#endif - assert (traits::spmatrix_size1 (A) == traits::spmatrix_size1 (A)); - assert (traits::spmatrix_size2 (A) == traits::vector_size (X)); - assert (traits::spmatrix_size2 (A) == traits::vector_size (B)); + assert (traits::spmatrix_size1 (A) == traits::spmatrix_size1 (A)); + assert (traits::spmatrix_size2 (A) == traits::vector_size (X)); + assert (traits::spmatrix_size2 (A) == traits::vector_size (B)); - return detail::solve (storage_f(), sys, A, X, B, - Numeric.ptr, Control, Info); + return detail::solve (storage_f(), sys, A, X, B, + Numeric.ptr, Control, Info); } - template <typename MatrA, typename VecX, typename VecB> - inline - int solve (int sys, MatrA const& A, VecX& X, VecB const& B, + template <typename MatrA, typename VecX, typename VecB> + inline + int solve (int sys, MatrA const& A, VecX& X, VecB const& B, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Numeric, + > const& Numeric, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Control, + > const& Control, info_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Info) + >& Info) { - return solve (sys, A, X, B, Numeric, Control.ptr, Info.ptr); + return solve (sys, A, X, B, Numeric, Control.ptr, Info.ptr); } - template <typename MatrA, typename VecX, typename VecB> - inline - int solve (int sys, MatrA const& A, VecX& X, VecB const& B, + template <typename MatrA, typename VecX, typename VecB> + inline + int solve (int sys, MatrA const& A, VecX& X, VecB const& B, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Numeric, + > const& Numeric, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type > const& Control) { - return solve (sys, A, X, B, Numeric, Control.ptr); + return solve (sys, A, X, B, Numeric, Control.ptr); } - template <typename MatrA, typename VecX, typename VecB> - inline - int solve (MatrA const& A, VecX& X, VecB const& B, + template <typename MatrA, typename VecX, typename VecB> + inline + int solve (MatrA const& A, VecX& X, VecB const& B, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Numeric, - double const* Control = 0, double* Info = 0) + > const& Numeric, + double const* Control = 0, double* Info = 0) { - return solve (UMFPACK_A, A, X, B, Numeric, Control, Info); + return solve (UMFPACK_A, A, X, B, Numeric, Control, Info); } - template <typename MatrA, typename VecX, typename VecB> - inline - int solve (MatrA const& A, VecX& X, VecB const& B, + template <typename MatrA, typename VecX, typename VecB> + inline + int solve (MatrA const& A, VecX& X, VecB const& B, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Numeric, + > const& Numeric, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Control, + > const& Control, info_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Info) + >& Info) { - return solve (UMFPACK_A, A, X, B, Numeric, - Control.ptr, Info.ptr); + return solve (UMFPACK_A, A, X, B, Numeric, + Control.ptr, Info.ptr); } - template <typename MatrA, typename VecX, typename VecB> - inline - int solve (MatrA const& A, VecX& X, VecB const& B, + template <typename MatrA, typename VecX, typename VecB> + inline + int solve (MatrA const& A, VecX& X, VecB const& B, numeric_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Numeric, + > const& Numeric, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type > const& Control) { - return solve (UMFPACK_A, A, X, B, Numeric, Control.ptr); + return solve (UMFPACK_A, A, X, B, Numeric, Control.ptr); } - // umf_solve - /* - * symbolic, numeric and solve + // umf_solve + /* + * symbolic, numeric and solve */ namespace detail { template <typename MatrA, typename VecX, typename VecB> inline - int umf_solve (traits::compressed_t, - MatrA const& A, VecX& X, VecB const& B, - double const* Control = 0, double* Info = 0) + int umf_solve (traits::compressed_t, + MatrA const& A, VecX& X, VecB const& B, + double const* Control = 0, double* Info = 0) { symbolic_type<typename traits::sparse_matrix_traits<MatrA>::value_type> - Symbolic; + Symbolic; numeric_type<typename traits::sparse_matrix_traits<MatrA>::value_type> - Numeric; + Numeric; int status; status = detail::symbolic (traits::spmatrix_size1 (A), @@ -784,16 +784,16 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - &Symbolic.ptr, Control, Info); - if (status != UMFPACK_OK) return status; + &Symbolic.ptr, Control, Info); + if (status != UMFPACK_OK) return status; status = detail::numeric (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - Symbolic.ptr, &Numeric.ptr, Control, Info); - if (status != UMFPACK_OK) return status; + Symbolic.ptr, &Numeric.ptr, Control, Info); + if (status != UMFPACK_OK) return status; return detail::solve (UMFPACK_A, traits::spmatrix_size1 (A), traits::spmatrix_index1_storage (A), @@ -801,117 +801,117 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { traits::spmatrix_value_storage (A), traits::vector_storage (X), traits::vector_storage (B), - Numeric.ptr, Control, Info); + Numeric.ptr, Control, Info); } template <typename MatrA, typename VecX, typename VecB> inline - int umf_solve (traits::coordinate_t, - MatrA const& A, VecX& X, VecB const& B, - double const* Control = 0, double* Info = 0) + int umf_solve (traits::coordinate_t, + MatrA const& A, VecX& X, VecB const& B, + double const* Control = 0, double* Info = 0) { - int n_row = traits::spmatrix_size1 (A); - int n_col = traits::spmatrix_size2 (A); - int nnz = traits::spmatrix_num_nonzeros (A); + int n_row = traits::spmatrix_size1 (A); + int n_col = traits::spmatrix_size2 (A); + int nnz = traits::spmatrix_num_nonzeros (A); - typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; + typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t; int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); - traits::detail::array<int> Ap (n_col+1); + int const* Tj = traits::spmatrix_index1_storage (A); + traits::detail::array<int> Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<int> Ai (nnz); + traits::detail::array<int> Ai (nnz); if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory; - int status = detail::triplet_to_col (n_row, n_col, nnz, + int status = detail::triplet_to_col (n_row, n_col, nnz, Ti, Tj, static_cast<val_t*> (0), - Ap.storage(), Ai.storage(), - static_cast<val_t*> (0), 0); - if (status != UMFPACK_OK) return status; + Ap.storage(), Ai.storage(), + static_cast<val_t*> (0), 0); + if (status != UMFPACK_OK) return status; symbolic_type<typename traits::sparse_matrix_traits<MatrA>::value_type> - Symbolic; + Symbolic; numeric_type<typename traits::sparse_matrix_traits<MatrA>::value_type> - Numeric; + Numeric; - status = detail::symbolic (n_row, n_col, + status = detail::symbolic (n_row, n_col, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), - &Symbolic.ptr, Control, Info); - if (status != UMFPACK_OK) return status; + &Symbolic.ptr, Control, Info); + if (status != UMFPACK_OK) return status; - status = detail::numeric (n_row, n_col, + status = detail::numeric (n_row, n_col, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), - Symbolic.ptr, &Numeric.ptr, Control, Info); - if (status != UMFPACK_OK) return status; + Symbolic.ptr, &Numeric.ptr, Control, Info); + if (status != UMFPACK_OK) return status; return detail::solve (UMFPACK_A, n_row, Ap.storage(), Ai.storage(), traits::spmatrix_value_storage (A), traits::vector_storage (X), traits::vector_storage (B), - Numeric.ptr, Control, Info); + Numeric.ptr, Control, Info); } - } // detail + } // detail template <typename MatrA, typename VecX, typename VecB> inline - int umf_solve (MatrA const& A, VecX& X, VecB const& B, - double const* Control = 0, double* Info = 0) + int umf_solve (MatrA const& A, VecX& X, VecB const& B, + double const* Control = 0, double* Info = 0) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::sparse_matrix_traits<MatrA>::matrix_structure, + typename traits::sparse_matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::sparse_matrix_traits<MatrA>::ordering_type, traits::column_major_t - >::value)); + >::value)); BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0); -#endif +#endif - typedef - typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; + typedef + typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT( (boost::is_same<storage_f, traits::compressed_t>::value - || + || boost::is_same<storage_f, traits::coordinate_t>::value - )); -#endif + )); +#endif - assert (traits::spmatrix_size1 (A) == traits::spmatrix_size1 (A)); - assert (traits::spmatrix_size2 (A) == traits::vector_size (X)); - assert (traits::spmatrix_size2 (A) == traits::vector_size (B)); + assert (traits::spmatrix_size1 (A) == traits::spmatrix_size1 (A)); + assert (traits::spmatrix_size2 (A) == traits::vector_size (X)); + assert (traits::spmatrix_size2 (A) == traits::vector_size (B)); - return detail::umf_solve (storage_f(), A, X, B, Control, Info); + return detail::umf_solve (storage_f(), A, X, B, Control, Info); } template <typename MatrA, typename VecX, typename VecB> inline - int umf_solve (MatrA const& A, VecX& X, VecB const& B, + int umf_solve (MatrA const& A, VecX& X, VecB const& B, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Control, + > const& Control, info_type< typename traits::sparse_matrix_traits<MatrA>::value_type - >& Info) + >& Info) { - return umf_solve (A, X, B, Control.ptr, Info.ptr); - } + return umf_solve (A, X, B, Control.ptr, Info.ptr); + } template <typename MatrA, typename VecX, typename VecB> inline - int umf_solve (MatrA const& A, VecX& X, VecB const& B, + int umf_solve (MatrA const& A, VecX& X, VecB const& B, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type > const& Control) { - return umf_solve (A, X, B, Control.ptr); - } + return umf_solve (A, X, B, Control.ptr); + } /////////////////////// @@ -919,14 +919,14 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { /////////////////////// - // scale - - template <typename VecX, typename VecB> - inline - int scale (VecX& X, VecB const& B, + // scale + + template <typename VecX, typename VecB> + inline + int scale (VecX& X, VecB const& B, numeric_type< typename traits::vector_traits<VecB>::value_type - > const& Numeric) + > const& Numeric) { return detail::scale (traits::vector_size (B), traits::vector_storage (X), @@ -945,67 +945,67 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { template <typename T> inline void report_status (control_type<T> const& Control, int status) { - detail::report_status (T(), 0, Control.ptr, status); + detail::report_status (T(), 0, Control.ptr, status); } #if 0 template <typename T> inline void report_status (int printing_level, int status) { - control_type<T> Control; - Control[UMFPACK_PRL] = printing_level; - detail::report_status (T(), 0, Control.ptr, status); + control_type<T> Control; + Control[UMFPACK_PRL] = printing_level; + detail::report_status (T(), 0, Control.ptr, status); } template <typename T> inline void report_status (int status) { - control_type<T> Control; - detail::report_status (T(), 0, Control.ptr, status); + control_type<T> Control; + detail::report_status (T(), 0, Control.ptr, status); } -#endif - +#endif + // report control template <typename T> inline void report_control (control_type<T> const& Control) { - detail::report_control (T(), 0, Control.ptr); + detail::report_control (T(), 0, Control.ptr); } - - // report info + + // report info template <typename T> inline void report_info (control_type<T> const& Control, info_type<T> const& Info) { - detail::report_info (T(), 0, Control.ptr, Info.ptr); + detail::report_info (T(), 0, Control.ptr, Info.ptr); } #if 0 template <typename T> inline void report_info (int printing_level, info_type<T> const& Info) { - control_type<T> Control; - Control[UMFPACK_PRL] = printing_level; - detail::report_info (T(), 0, Control.ptr, Info.ptr); + control_type<T> Control; + Control[UMFPACK_PRL] = printing_level; + detail::report_info (T(), 0, Control.ptr, Info.ptr); } template <typename T> inline void report_info (info_type<T> const& Info) { - control_type<T> Control; - detail::report_info (T(), 0, Control.ptr, Info.ptr); + control_type<T> Control; + detail::report_info (T(), 0, Control.ptr, Info.ptr); } -#endif +#endif - // report matrix (compressed column and coordinate) + // report matrix (compressed column and coordinate) namespace detail { template <typename MatrA> inline - int report_matrix (traits::compressed_t, MatrA const& A, + int report_matrix (traits::compressed_t, MatrA const& A, double const* Control) { return detail::report_matrix (traits::spmatrix_size1 (A), @@ -1013,107 +1013,107 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - 1, Control); + 1, Control); } - + template <typename MatrA> inline - int report_matrix (traits::coordinate_t, MatrA const& A, + int report_matrix (traits::coordinate_t, MatrA const& A, double const* Control) { return detail::report_triplet (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), - traits::spmatrix_num_nonzeros (A), + traits::spmatrix_num_nonzeros (A), traits::spmatrix_index1_storage (A), traits::spmatrix_index2_storage (A), traits::spmatrix_value_storage (A), - Control); + Control); } - - } // detail + + } // detail template <typename MatrA> inline - int report_matrix (MatrA const& A, + int report_matrix (MatrA const& A, control_type< typename traits::sparse_matrix_traits<MatrA>::value_type - > const& Control) + > const& Control) { -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< - typename traits::sparse_matrix_traits<MatrA>::matrix_structure, + typename traits::sparse_matrix_traits<MatrA>::matrix_structure, traits::general_t - >::value)); + >::value)); BOOST_STATIC_ASSERT((boost::is_same< typename traits::sparse_matrix_traits<MatrA>::ordering_type, traits::column_major_t - >::value)); + >::value)); BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0); -#endif +#endif - typedef - typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; + typedef + typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f; -#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK +#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT( (boost::is_same<storage_f, traits::compressed_t>::value - || + || boost::is_same<storage_f, traits::coordinate_t>::value - )); -#endif + )); +#endif - return detail::report_matrix (storage_f(), A, Control.ptr); + return detail::report_matrix (storage_f(), A, Control.ptr); } - // report vector + // report vector template <typename VecX> inline - int report_vector (VecX const& X, + int report_vector (VecX const& X, control_type< typename traits::vector_traits<VecX>::value_type - > const& Control) + > const& Control) { - return detail::report_vector (traits::vector_size (X), - traits::vector_storage (X), + return detail::report_vector (traits::vector_size (X), + traits::vector_storage (X), Control.ptr); } - // report numeric + // report numeric - template <typename T> + template <typename T> inline - int report_numeric (numeric_type<T> const& Numeric, + int report_numeric (numeric_type<T> const& Numeric, control_type<T> const& Control) { - return detail::report_numeric (T(), 0, Numeric.ptr, Control.ptr); + return detail::report_numeric (T(), 0, Numeric.ptr, Control.ptr); } - // report symbolic + // report symbolic - template <typename T> + template <typename T> inline - int report_symbolic (symbolic_type<T> const& Symbolic, + int report_symbolic (symbolic_type<T> const& Symbolic, control_type<T> const& Control) { - return detail::report_symbolic (T(), 0, Symbolic.ptr, Control.ptr); + return detail::report_symbolic (T(), 0, Symbolic.ptr, Control.ptr); } - // report permutation vector + // report permutation vector - template <typename VecP, typename T> + template <typename VecP, typename T> inline int report_permutation (VecP const& Perm, control_type<T> const& Control) { - return detail::report_perm (T(), 0, + return detail::report_perm (T(), 0, traits::vector_storage (Perm), - Control.ptr); + Control.ptr); } -}}}} +}}}} #endif // BOOST_NUMERIC_BINDINGS_UMFPACK_HPP diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack_inc.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack_inc.hpp index 01dd0d824374d091e8586617aa5ce126af7c9d5c..6c7f2583038fca5fa7e34007ff7df4352c3c68b8 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack_inc.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack_inc.hpp @@ -1,12 +1,12 @@ /* - * + * * Copyright (c) Kresimir Fresl 2003 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ @@ -46,14 +46,14 @@ */ -/* Used by permission. */ +/* Used by permission. */ #ifndef BOOST_NUMERIC_BINDINGS_UMFPACK_INC_H #define BOOST_NUMERIC_BINDINGS_UMFPACK_INC_H extern "C" { -#include <umfpack.h> +#include <umfpack.h> } -#endif +#endif diff --git a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack_overloads.hpp b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack_overloads.hpp index 4c3a6e6f2f08c392bce210ed1e04e123ae3a911e..5e0ed30b82e829dfac46e9edba329e84725b3834 100644 --- a/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack_overloads.hpp +++ b/moose-core/external/boost-numeric-bindings/boost/numeric/bindings/umfpack/umfpack_overloads.hpp @@ -1,17 +1,17 @@ /* - * - * Copyright (c) Kresimir Fresl 2003 + * + * Copyright (c) Kresimir Fresl 2003 * * 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) * - * Author acknowledges the support of the Faculty of Civil Engineering, + * Author acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ -/* for UMFPACK Copyright, License and Availability see umfpack_inc.hpp */ +/* for UMFPACK Copyright, License and Availability see umfpack_inc.hpp */ #ifndef BOOST_NUMERIC_BINDINGS_UMFPACK_OVERLOADS_HPP @@ -22,7 +22,7 @@ #include <boost/numeric/bindings/traits/detail/array.hpp> #include <boost/numeric/bindings/traits/detail/utils.hpp> -namespace boost { namespace numeric { namespace bindings { +namespace boost { namespace numeric { namespace bindings { namespace umfpack { namespace detail { @@ -30,68 +30,68 @@ namespace boost { namespace numeric { namespace bindings { // UMFPACK primary routines: //////////////////////////// - // symbolic + // symbolic inline - int symbolic (int n_row, int n_col, - int const* Ap, int const* Ai, double const* Ax, - void **Symbolic, double const* Control, double* Info) + int symbolic (int n_row, int n_col, + int const* Ap, int const* Ai, double const* Ax, + void **Symbolic, double const* Control, double* Info) { - return umfpack_di_symbolic (n_row, n_col, Ap, Ai, Ax, - Symbolic, Control, Info); + return umfpack_di_symbolic (n_row, n_col, Ap, Ai, Ax, + Symbolic, Control, Info); } inline int symbolic (int n_row, int n_col, - int const* Ap, int const* Ai, traits::complex_d const* Ax, + int const* Ap, int const* Ai, traits::complex_d const* Ax, void **Symbolic, double const* Control, double* Info) { int nnz = Ap[n_col]; - traits::detail::array<double> Axr (nnz); + traits::detail::array<double> Axr (nnz); if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Axi (nnz); + traits::detail::array<double> Axi (nnz); if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (Ax, Ax+nnz, - Axr.storage(), Axi.storage()); - return umfpack_zi_symbolic (n_row, n_col, Ap, Ai, - Axr.storage(), Axi.storage(), - Symbolic, Control, Info); + traits::detail::disentangle (Ax, Ax+nnz, + Axr.storage(), Axi.storage()); + return umfpack_zi_symbolic (n_row, n_col, Ap, Ai, + Axr.storage(), Axi.storage(), + Symbolic, Control, Info); } - // numeric + // numeric inline - int numeric (int, int, - int const* Ap, int const* Ai, double const* Ax, - void *Symbolic, void **Numeric, - double const* Control, double* Info) + int numeric (int, int, + int const* Ap, int const* Ai, double const* Ax, + void *Symbolic, void **Numeric, + double const* Control, double* Info) { return umfpack_di_numeric (Ap, Ai, Ax, Symbolic, Numeric, Control, Info); } inline - int numeric (int, int n_col, - int const* Ap, int const* Ai, traits::complex_d const* Ax, + int numeric (int, int n_col, + int const* Ap, int const* Ai, traits::complex_d const* Ax, void *Symbolic, void **Numeric, double const* Control, double* Info) { int nnz = Ap[n_col]; - traits::detail::array<double> Axr (nnz); + traits::detail::array<double> Axr (nnz); if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Axi (nnz); + traits::detail::array<double> Axi (nnz); if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (Ax, Ax+nnz, - Axr.storage(), Axi.storage()); - return umfpack_zi_numeric (Ap, Ai, Axr.storage(), Axi.storage(), - Symbolic, Numeric, Control, Info); + traits::detail::disentangle (Ax, Ax+nnz, + Axr.storage(), Axi.storage()); + return umfpack_zi_numeric (Ap, Ai, Axr.storage(), Axi.storage(), + Symbolic, Numeric, Control, Info); } - // solve + // solve inline - int solve (int sys, int, + int solve (int sys, int, int const* Ap, int const* Ai, double const* Ax, double* X, double const* B, void *Numeric, double const* Control, double* Info) @@ -100,50 +100,50 @@ namespace boost { namespace numeric { namespace bindings { } inline - int solve (int sys, int n, - int const* Ap, int const* Ai, traits::complex_d const* Ax, - traits::complex_d* X, traits::complex_d const* B, + int solve (int sys, int n, + int const* Ap, int const* Ai, traits::complex_d const* Ax, + traits::complex_d* X, traits::complex_d const* B, void *Numeric, double const* Control, double* Info) { int nnz = Ap[n]; - traits::detail::array<double> Axr (nnz); + traits::detail::array<double> Axr (nnz); if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Axi (nnz); + traits::detail::array<double> Axi (nnz); if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (Ax, Ax+nnz, - Axr.storage(), Axi.storage()); - traits::detail::array<double> Br (n); + traits::detail::disentangle (Ax, Ax+nnz, + Axr.storage(), Axi.storage()); + traits::detail::array<double> Br (n); if (!Br.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Bi (n); + traits::detail::array<double> Bi (n); if (!Bi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (B, B+n, - Br.storage(), Bi.storage()); - traits::detail::array<double> Xr (n); + traits::detail::disentangle (B, B+n, + Br.storage(), Bi.storage()); + traits::detail::array<double> Xr (n); if (!Xr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Xi (n); + traits::detail::array<double> Xi (n); if (!Xi.valid()) return UMFPACK_ERROR_out_of_memory; - int status = umfpack_zi_solve (sys, Ap, Ai, - Axr.storage(), Axi.storage(), - Xr.storage(), Xi.storage(), - Br.storage(), Bi.storage(), + int status = umfpack_zi_solve (sys, Ap, Ai, + Axr.storage(), Axi.storage(), + Xr.storage(), Xi.storage(), + Br.storage(), Bi.storage(), Numeric, Control, Info); - if (status != UMFPACK_OK) return status; + if (status != UMFPACK_OK) return status; traits::detail::interlace (Xr.storage(), Xr.storage() + n, - Xi.storage(), X); - return status; + Xi.storage(), X); + return status; } - // free_symbolic + // free_symbolic inline void free_symbolic (double, int, void **Symbolic) { - umfpack_di_free_symbolic (Symbolic); + umfpack_di_free_symbolic (Symbolic); } inline void free_symbolic (traits::complex_d const&, int, void **Symbolic) { - umfpack_zi_free_symbolic (Symbolic); + umfpack_zi_free_symbolic (Symbolic); } @@ -151,11 +151,11 @@ namespace boost { namespace numeric { namespace bindings { inline void free_numeric (double, int, void **Numeric) { - umfpack_di_free_numeric (Numeric); + umfpack_di_free_numeric (Numeric); } inline void free_numeric (traits::complex_d const&, int, void **Numeric) { - umfpack_zi_free_numeric (Numeric); + umfpack_zi_free_numeric (Numeric); } @@ -163,46 +163,46 @@ namespace boost { namespace numeric { namespace bindings { // UMFPACK alternative routines: //////////////////////////////// - // default control + // default control inline void defaults (double, int, double* Control) { - umfpack_di_defaults (Control); + umfpack_di_defaults (Control); } inline void defaults (traits::complex_d const&, int, double* Control) { - umfpack_zi_defaults (Control); + umfpack_zi_defaults (Control); } // symbolic with specified column preordering inline - int qsymbolic (int n_row, int n_col, - int const* Ap, int const* Ai, double const* Ax, - int const* Qinit, - void **Symbolic, double const* Control, double* Info) + int qsymbolic (int n_row, int n_col, + int const* Ap, int const* Ai, double const* Ax, + int const* Qinit, + void **Symbolic, double const* Control, double* Info) { - return umfpack_di_qsymbolic (n_row, n_col, Ap, Ai, Ax, Qinit, - Symbolic, Control, Info); + return umfpack_di_qsymbolic (n_row, n_col, Ap, Ai, Ax, Qinit, + Symbolic, Control, Info); } inline int qsymbolic (int n_row, int n_col, - int const* Ap, int const* Ai, traits::complex_d const* Ax, - int const* Qinit, + int const* Ap, int const* Ai, traits::complex_d const* Ax, + int const* Qinit, void **Symbolic, double const* Control, double* Info) { int nnz = Ap[n_col]; - traits::detail::array<double> Axr (nnz); + traits::detail::array<double> Axr (nnz); if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Axi (nnz); + traits::detail::array<double> Axi (nnz); if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (Ax, Ax+nnz, - Axr.storage(), Axi.storage()); - return umfpack_zi_qsymbolic (n_row, n_col, Ap, Ai, - Axr.storage(), Axi.storage(), - Qinit, Symbolic, Control, Info); + traits::detail::disentangle (Ax, Ax+nnz, + Axr.storage(), Axi.storage()); + return umfpack_zi_qsymbolic (n_row, n_col, Ap, Ai, + Axr.storage(), Axi.storage(), + Qinit, Symbolic, Control, Info); } @@ -210,54 +210,54 @@ namespace boost { namespace numeric { namespace bindings { // UMFPACK matrix manipulation routines /////////////////////////////////////// - // triplet (coordinate) to compressed column + // triplet (coordinate) to compressed column inline int triplet_to_col (int n_row, int n_col, int nz, - int const* Ti, int const* Tj, double const* Tx, - int* Ap, int* Ai, double* Ax, int* Map) + int const* Ti, int const* Tj, double const* Tx, + int* Ap, int* Ai, double* Ax, int* Map) { - return umfpack_di_triplet_to_col (n_row, n_col, nz, + return umfpack_di_triplet_to_col (n_row, n_col, nz, Ti, Tj, Tx, Ap, Ai, Ax, Map); } - inline + inline int triplet_to_col (int n_row, int n_col, int nz, - int const* Ti, int const* Tj, - traits::complex_d const* Tx, - int* Ap, int* Ai, traits::complex_d* Ax, + int const* Ti, int const* Tj, + traits::complex_d const* Tx, + int* Ap, int* Ai, traits::complex_d* Ax, int* Map) { - assert (Tx == 0 && Ax == 0 || Tx != 0 && Ax != 0); + assert (Tx == 0 && Ax == 0 || Tx != 0 && Ax != 0); double *Txr = 0, *Txi = 0; if (Tx != 0) { - traits::detail::array<double> ATxr (nz); + traits::detail::array<double> ATxr (nz); if (!ATxr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> ATxi (nz); + traits::detail::array<double> ATxi (nz); if (!ATxi.valid()) return UMFPACK_ERROR_out_of_memory; Txr = ATxr.storage(); - Txi = ATxi.storage(); - traits::detail::disentangle (Tx, Tx+nz, Txr, Txi); + Txi = ATxi.storage(); + traits::detail::disentangle (Tx, Tx+nz, Txr, Txi); } double *Axr = 0, *Axi = 0; if (Ax != 0) { - traits::detail::array<double> AAxr (nz); + traits::detail::array<double> AAxr (nz); if (!AAxr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> AAxi (nz); + traits::detail::array<double> AAxi (nz); if (!AAxi.valid()) return UMFPACK_ERROR_out_of_memory; Axr = AAxr.storage(); - Axi = AAxi.storage(); - } - int status; - status = umfpack_zi_triplet_to_col (n_row, n_col, nz, + Axi = AAxi.storage(); + } + int status; + status = umfpack_zi_triplet_to_col (n_row, n_col, nz, Ti, Tj, Txr, Txi, Ap, Ai, Axr, Axi, Map); if (Ax != 0) { - if (status != UMFPACK_OK) return status; - traits::detail::interlace (Axr, Axr + nz, Axi, Ax); + if (status != UMFPACK_OK) return status; + traits::detail::interlace (Axr, Axr + nz, Axi, Ax); } - return status; + return status; } @@ -265,32 +265,32 @@ namespace boost { namespace numeric { namespace bindings { inline int scale (int, double* X, double const* B, void* Numeric) { - return umfpack_di_scale (X, B, Numeric); - } + return umfpack_di_scale (X, B, Numeric); + } inline - int scale (int n, traits::complex_d* X, - traits::complex_d const* B, void* Numeric) + int scale (int n, traits::complex_d* X, + traits::complex_d const* B, void* Numeric) { - traits::detail::array<double> Br (n); + traits::detail::array<double> Br (n); if (!Br.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Bi (n); + traits::detail::array<double> Bi (n); if (!Bi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (B, B+n, - Br.storage(), Bi.storage()); - traits::detail::array<double> Xr (n); + traits::detail::disentangle (B, B+n, + Br.storage(), Bi.storage()); + traits::detail::array<double> Xr (n); if (!Xr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Xi (n); + traits::detail::array<double> Xi (n); if (!Xi.valid()) return UMFPACK_ERROR_out_of_memory; - int status = umfpack_zi_scale (Xr.storage(), Xi.storage(), - Br.storage(), Bi.storage(), - Numeric); - if (status != UMFPACK_OK) return status; + int status = umfpack_zi_scale (Xr.storage(), Xi.storage(), + Br.storage(), Bi.storage(), + Numeric); + if (status != UMFPACK_OK) return status; traits::detail::interlace (Xr.storage(), Xr.storage() + n, - Xi.storage(), X); - return status; - } + Xi.storage(), X); + return status; + } ////////////////////////////// @@ -301,13 +301,13 @@ namespace boost { namespace numeric { namespace bindings { inline void report_status (double, int, double const* Control, int status) { - umfpack_di_report_status (Control, status); + umfpack_di_report_status (Control, status); } inline - void report_status (traits::complex_d const&, int, - double const* Control, int status) + void report_status (traits::complex_d const&, int, + double const* Control, int status) { - umfpack_zi_report_status (Control, status); + umfpack_zi_report_status (Control, status); } @@ -315,12 +315,12 @@ namespace boost { namespace numeric { namespace bindings { inline void report_control (double, int, double const* Control) { - umfpack_di_report_control (Control); + umfpack_di_report_control (Control); } inline - void + void report_control (traits::complex_d const&, int, double const* Control) { - umfpack_zi_report_control (Control); + umfpack_zi_report_control (Control); } @@ -328,43 +328,43 @@ namespace boost { namespace numeric { namespace bindings { inline void report_info (double, int, double const* Control, double const* Info) { - umfpack_di_report_info (Control, Info); + umfpack_di_report_info (Control, Info); } inline - void report_info (traits::complex_d const&, int, - double const* Control, double const* Info) + void report_info (traits::complex_d const&, int, + double const* Control, double const* Info) { - umfpack_zi_report_info (Control, Info); + umfpack_zi_report_info (Control, Info); } - // report matrix + // report matrix - inline - int report_matrix (int n_row, int n_col, + inline + int report_matrix (int n_row, int n_col, int const* Ap, int const* Ai, double const* Ax, - int col_form, double const* Control) + int col_form, double const* Control) { - return umfpack_di_report_matrix (n_row, n_col, Ap, Ai, Ax, - col_form, Control); + return umfpack_di_report_matrix (n_row, n_col, Ap, Ai, Ax, + col_form, Control); } - inline - int report_matrix (int n_row, int n_col, - int const* Ap, int const* Ai, - traits::complex_d const* Ax, - int col_form, double const* Control) + inline + int report_matrix (int n_row, int n_col, + int const* Ap, int const* Ai, + traits::complex_d const* Ax, + int col_form, double const* Control) { int nnz = Ap[n_col]; - traits::detail::array<double> Axr (nnz); + traits::detail::array<double> Axr (nnz); if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Axi (nnz); + traits::detail::array<double> Axi (nnz); if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (Ax, Ax+nnz, - Axr.storage(), Axi.storage()); - return umfpack_zi_report_matrix (n_row, n_col, Ap, Ai, - Axr.storage(), Axi.storage(), - col_form, Control); + traits::detail::disentangle (Ax, Ax+nnz, + Axr.storage(), Axi.storage()); + return umfpack_zi_report_matrix (n_row, n_col, Ap, Ai, + Axr.storage(), Axi.storage(), + col_form, Control); } @@ -373,30 +373,30 @@ namespace boost { namespace numeric { namespace bindings { inline int report_triplet (int n_row, int n_col, int nz, int const* Ti, int const* Tj, double const* Tx, - double const* Control) + double const* Control) { return umfpack_di_report_triplet (n_row, n_col, nz, Ti, Tj, Tx, Control); } inline int report_triplet (int n_row, int n_col, int nz, - int const* Ti, int const* Tj, - traits::complex_d const* Tx, - double const* Control) + int const* Ti, int const* Tj, + traits::complex_d const* Tx, + double const* Control) { - traits::detail::array<double> Txr (nz); + traits::detail::array<double> Txr (nz); if (!Txr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Txi (nz); + traits::detail::array<double> Txi (nz); if (!Txi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (Tx, Tx+nz, - Txr.storage(), Txi.storage()); - return umfpack_zi_report_triplet (n_row, n_col, nz, Ti, Tj, - Txr.storage(), Txi.storage(), + traits::detail::disentangle (Tx, Tx+nz, + Txr.storage(), Txi.storage()); + return umfpack_zi_report_triplet (n_row, n_col, nz, Ti, Tj, + Txr.storage(), Txi.storage(), Control); } - // report vector + // report vector inline int report_vector (int n, double const* X, double const* Control) { @@ -404,65 +404,65 @@ namespace boost { namespace numeric { namespace bindings { } inline - int report_vector (int n, traits::complex_d const* X, - double const* Control) + int report_vector (int n, traits::complex_d const* X, + double const* Control) { #if 0 // see UMFPACK v 4.1 User Guide - traits::detail::array<double> Xr (n); + traits::detail::array<double> Xr (n); if (!Xr.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::array<double> Xi (n); + traits::detail::array<double> Xi (n); if (!Xi.valid()) return UMFPACK_ERROR_out_of_memory; - traits::detail::disentangle (X, X+n, - Xr.storage(), Xi.storage()); + traits::detail::disentangle (X, X+n, + Xr.storage(), Xi.storage()); return umfpack_zi_report_vector (n, Xr.storage(), Xi.storage(), Control); -#endif - return umfpack_zi_report_vector (n, - reinterpret_cast<double const*> (X), - reinterpret_cast<double const*> (0), +#endif + return umfpack_zi_report_vector (n, + reinterpret_cast<double const*> (X), + reinterpret_cast<double const*> (0), Control); } - // report numeric + // report numeric inline int report_numeric (double, int, void* Numeric, double const* Control) { - return umfpack_di_report_numeric (Numeric, Control); + return umfpack_di_report_numeric (Numeric, Control); } inline - int report_numeric (traits::complex_d const&, int, - void* Numeric, double const* Control) + int report_numeric (traits::complex_d const&, int, + void* Numeric, double const* Control) { - return umfpack_zi_report_numeric (Numeric, Control); + return umfpack_zi_report_numeric (Numeric, Control); } - // report symbolic + // report symbolic inline int report_symbolic (double, int, void* Symbolic, double const* Control) { - return umfpack_di_report_symbolic (Symbolic, Control); + return umfpack_di_report_symbolic (Symbolic, Control); } inline - int report_symbolic (traits::complex_d const&, int, - void* Symbolic, double const* Control) + int report_symbolic (traits::complex_d const&, int, + void* Symbolic, double const* Control) { - return umfpack_zi_report_symbolic (Symbolic, Control); + return umfpack_zi_report_symbolic (Symbolic, Control); } // report permutation vector inline - int report_perm (double, int, int np, + int report_perm (double, int, int np, int const* Perm, double const* Control) { - return umfpack_di_report_perm (np, Perm, Control); + return umfpack_di_report_perm (np, Perm, Control); } inline - int report_perm (traits::complex_d const&, int, int np, + int report_perm (traits::complex_d const&, int, int np, int const* Perm, double const* Control) { - return umfpack_zi_report_perm (np, Perm, Control); + return umfpack_zi_report_perm (np, Perm, Control); } }} diff --git a/moose-core/external/muparser/CMakeLists.txt b/moose-core/external/muparser/CMakeLists.txt index 08ec1aea120fa06405a8583399d0f8ab11e85117..7aa7bafbab5fcaf989091235cd1e233bfe655fbc 100644 --- a/moose-core/external/muparser/CMakeLists.txt +++ b/moose-core/external/muparser/CMakeLists.txt @@ -6,6 +6,6 @@ include_directories(../msg) include_directories(../basecode ./include) add_library(muparser ${files_SRC}) -set_target_properties( muparser - PROPERTIES COMPILE_FLAGS "-Wno-switch -Wno-unknown-pragmas" +set_target_properties( muparser + PROPERTIES COMPILE_FLAGS "-Wno-switch -Wno-unknown-pragmas" ) diff --git a/moose-core/external/muparser/License.txt b/moose-core/external/muparser/License.txt index 64286563696c3eb4d0c55ff572ac5c9aae3aecaa..44b2ae33ce90ea9288165335e30b41cb931d4a19 100644 --- a/moose-core/external/muparser/License.txt +++ b/moose-core/external/muparser/License.txt @@ -18,18 +18,18 @@ ####################################################################### - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/moose-core/external/muparser/Makefile.in b/moose-core/external/muparser/Makefile.in index 157be77de26d4b898838c24c6fed32a9ca2b7f87..8d192bb15d18a6eda7d9abe17b64785f61891372 100644 --- a/moose-core/external/muparser/Makefile.in +++ b/moose-core/external/muparser/Makefile.in @@ -41,7 +41,7 @@ LDFLAGS = @LDFLAGS@ ### Variables: ### -DESTDIR = +DESTDIR = MUPARSER_LIB_CXXFLAGS = $(____DEBUG) $(____SHARED) $(____SHARED_0) \ -I$(srcdir)/include $(CPPFLAGS) $(CXXFLAGS) MUPARSER_LIB_OBJECTS = \ @@ -104,7 +104,7 @@ EXAMPLE1_OBJECTS = \ @COND_DEPS_TRACKING_0@CXXC = $(CXX) @COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX) -@COND_DEBUG_0@DEBUG_BUILD_POSTFIX = +@COND_DEBUG_0@DEBUG_BUILD_POSTFIX = @COND_DEBUG_1@DEBUG_BUILD_POSTFIX = d @COND_SHARED_0@__muParser_lib___depname = \ @COND_SHARED_0@ $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT) @@ -200,12 +200,12 @@ COND_USE_SOTWOSYMLINKS_1___muParser_dll___so_symlinks_uninst_cmd = rm -f \ @COND_PLATFORM_MAC_1@__example1___mac_setfilecmd = \ @COND_PLATFORM_MAC_1@ $(SETFILE) -t APPL \ @COND_PLATFORM_MAC_1@ $(top_builddir)/samples/example1/example1$(EXEEXT) -@COND_SHARED_0@____SHARED = +@COND_SHARED_0@____SHARED = @COND_SHARED_1@____SHARED = -DMUPARSER_DLL -@COND_SHARED_0@____SHARED_0 = +@COND_SHARED_0@____SHARED_0 = @COND_SHARED_1@____SHARED_0 = -DMUPARSERLIB_EXPORTS @COND_DEBUG_0@____DEBUG = -DNDEBUG -@COND_DEBUG_1@____DEBUG = +@COND_DEBUG_1@____DEBUG = ### Targets: ### @@ -220,7 +220,7 @@ uninstall: $(__uninstall_muParser_lib___depname) $(__uninstall_muParser_lib_head install-strip: install $(STRIP) $(DESTDIR)$(libdir)/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) -clean: +clean: rm -rf ./.deps ./.pch rm -f ./*.o rm -f $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT) @@ -242,10 +242,10 @@ distclean: clean @COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(libdir) @COND_SHARED_0@ $(INSTALL_DATA) $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT) $(DESTDIR)$(libdir) -@COND_SHARED_0@uninstall_muParser_lib: +@COND_SHARED_0@uninstall_muParser_lib: @COND_SHARED_0@ rm -f $(DESTDIR)$(libdir)/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT) -@COND_SHARED_0@install_muParser_lib_headers: +@COND_SHARED_0@install_muParser_lib_headers: @COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(prefix) @COND_SHARED_0@ for f in $(MUPARSER_LIB_HEADERS); do \ @COND_SHARED_0@ if test ! -d $(DESTDIR)$(prefix)/`dirname $$f` ; then \ @@ -254,14 +254,14 @@ distclean: clean @COND_SHARED_0@ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(prefix)/$$f; \ @COND_SHARED_0@ done -@COND_SHARED_0@uninstall_muParser_lib_headers: +@COND_SHARED_0@uninstall_muParser_lib_headers: @COND_SHARED_0@ for f in $(MUPARSER_LIB_HEADERS); do \ @COND_SHARED_0@ rm -f $(DESTDIR)$(prefix)/$$f; \ @COND_SHARED_0@ done @COND_SHARED_1@$(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3): $(MUPARSER_DLL_OBJECTS) @COND_SHARED_1@ $(SHARED_LD_CXX) $@ $(MUPARSER_DLL_OBJECTS) $(__muParser_dll___macinstnamecmd) $(__muParser_dll___importlib) $(__muParser_dll___soname_flags) $(__muParser_dll___macver) $(LDFLAGS) $(LIBS) -@COND_SHARED_1@ +@COND_SHARED_1@ @COND_SHARED_1@ $(__muParser_dll___so_symlinks_cmd) @COND_SHARED_1@install_muParser_dll: $(__muParser_dll___depname) @@ -270,12 +270,12 @@ distclean: clean @COND_SHARED_1@ $(INSTALL_PROGRAM) $(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) $(DESTDIR)$(libdir) @COND_SHARED_1@ (cd $(DESTDIR)$(libdir) ; $(__muParser_dll___so_symlinks_inst_cmd)) -@COND_SHARED_1@uninstall_muParser_dll: +@COND_SHARED_1@uninstall_muParser_dll: @COND_SHARED_1@ rm -f $(DESTDIR)$(libdir)/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) @COND_SHARED_1@ rm -f $(DESTDIR)$(libdir)/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) @COND_SHARED_1@ (cd $(DESTDIR)$(libdir) ; $(__muParser_dll___so_symlinks_uninst_cmd)) -@COND_SHARED_1@install_muParser_dll_headers: +@COND_SHARED_1@install_muParser_dll_headers: @COND_SHARED_1@ $(INSTALL_DIR) $(DESTDIR)$(prefix) @COND_SHARED_1@ for f in $(MUPARSER_DLL_HEADERS); do \ @COND_SHARED_1@ if test ! -d $(DESTDIR)$(prefix)/`dirname $$f` ; then \ @@ -284,21 +284,21 @@ distclean: clean @COND_SHARED_1@ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(prefix)/$$f; \ @COND_SHARED_1@ done -@COND_SHARED_1@uninstall_muParser_dll_headers: +@COND_SHARED_1@uninstall_muParser_dll_headers: @COND_SHARED_1@ for f in $(MUPARSER_DLL_HEADERS); do \ @COND_SHARED_1@ rm -f $(DESTDIR)$(prefix)/$$f; \ @COND_SHARED_1@ done @COND_SAMPLES_1@$(top_builddir)/samples/example1/example1$(EXEEXT): $(EXAMPLE1_OBJECTS) $(__muParser_lib___depname) @COND_SAMPLES_1@ $(CXX) -o $@ $(EXAMPLE1_OBJECTS) -L$(top_builddir)/lib -L$(srcdir)/lib $(LDFLAGS) -lmuparser$(DEBUG_BUILD_POSTFIX) $(LIBS) -@COND_SAMPLES_1@ +@COND_SAMPLES_1@ @COND_SAMPLES_1@ $(__example1___mac_setfilecmd) lib: $(__muParser_lib___depname) $(__muParser_dll___depname) samples: $(__example1___depname) -documentation: +documentation: ( cd $(srcdir)/docs && doxygen ) muParser_lib_muParser.o: $(srcdir)/src/muParser.cpp diff --git a/moose-core/external/muparser/include/muParser.h b/moose-core/external/muparser/include/muParser.h index fb0de64c2af24a808064d4f9491537c52b021ad4..a4a678e26e6f6bf8a4ab1addc49cbbd7cd43c446 100644 --- a/moose-core/external/muparser/include/muParser.h +++ b/moose-core/external/muparser/include/muParser.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_H #define MU_PARSER_H @@ -44,8 +44,8 @@ extern moose::RNG<double> rng; namespace mu { /** \brief Mathematical expressions parser. - - Standard implementation of the mathematical expressions parser. + + Standard implementation of the mathematical expressions parser. Can be used as a reference implementation for subclassing the parser. <small> @@ -65,8 +65,8 @@ namespace mu virtual void InitOprt(); virtual void OnDetectVar(string_type *pExpr, int &nStart, int &nEnd); - value_type Diff(value_type *a_Var, - value_type a_fPos, + value_type Diff(value_type *a_Var, + value_type a_fPos, value_type a_fEpsilon = 0) const; protected: @@ -104,10 +104,10 @@ namespace mu static value_type Quot(value_type, value_type); // Random between a and b, with fixed seed. - static value_type Rand2(value_type, value_type, value_type); + 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 ); // Prefix operators // !!! Unary Minus is a MUST if you want to use negative signs !!! diff --git a/moose-core/external/muparser/include/muParserBase.h b/moose-core/external/muparser/include/muParserBase.h index a37927306ebe44c8b55de6f56cfd47edbb6b9349..004fe20e9f1221ba1554fb0b7046f84c2e9f9a3f 100644 --- a/moose-core/external/muparser/include/muParserBase.h +++ b/moose-core/external/muparser/include/muParserBase.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_BASE_H #define MU_PARSER_BASE_H @@ -52,26 +52,26 @@ namespace mu /** \brief Mathematical expressions parser (base parser engine). \author (C) 2013 Ingo Berg - This is the implementation of a bytecode based mathematical expressions parser. - The formula will be parsed from string and converted into a bytecode. + This is the implementation of a bytecode based mathematical expressions parser. + The formula will be parsed from string and converted into a bytecode. Future calculations will be done with the bytecode instead the formula string - resulting in a significant performance increase. - Complementary to a set of internally implemented functions the parser is able to handle - user defined functions and variables. + resulting in a significant performance increase. + Complementary to a set of internally implemented functions the parser is able to handle + user defined functions and variables. */ -class ParserBase +class ParserBase { friend class ParserTokenReader; private: - /** \brief Typedef for the parse functions. - + /** \brief Typedef for the parse functions. + The parse function do the actual work. The parser exchanges - the function pointer to the parser function depending on + the function pointer to the parser function depending on which state it is in. (i.e. bytecode parser vs. string parser) */ - typedef value_type (ParserBase::*ParseFunction)() const; + typedef value_type (ParserBase::*ParseFunction)() const; /** \brief Type used for storing an array of values. */ typedef std::vector<value_type> valbuf_type; @@ -81,7 +81,7 @@ private: /** \brief Typedef for the token reader. */ typedef ParserTokenReader token_reader_type; - + /** \brief Type used for parser tokens. */ typedef ParserToken<value_type, string_type> token_type; @@ -90,20 +90,20 @@ private: public: - /** \brief Type of the error class. - + /** \brief Type of the error class. + Included for backwards compatibility. */ typedef ParserError exception_type; static void EnableDebugDump(bool bDumpCmd, bool bDumpStack); - ParserBase(); + ParserBase(); ParserBase(const ParserBase &a_Parser); ParserBase& operator=(const ParserBase &a_Parser); virtual ~ParserBase(); - + value_type Eval() const; value_type* Eval(int &nStackSize) const; void Eval(value_type *results, int nBulkSize); @@ -123,7 +123,7 @@ private: bool HasBuiltInOprt() const; void AddValIdent(identfun_type a_pCallback); - /** \fn void mu::ParserBase::DefineFun(const string_type &a_strName, fun_type0 a_pFun, bool a_bAllowOpt = true) + /** \fn void mu::ParserBase::DefineFun(const string_type &a_strName, fun_type0 a_pFun, bool a_bAllowOpt = true) \brief Define a parser function without arguments. \param a_strName Name of the function \param a_pFun Pointer to the callback function @@ -135,9 +135,9 @@ private: AddCallback( a_strName, ParserCallback(a_pFun, a_bAllowOpt), m_FunDef, ValidNameChars() ); } - void DefineOprt(const string_type &a_strName, - fun_type2 a_pFun, - unsigned a_iPri=0, + void DefineOprt(const string_type &a_strName, + fun_type2 a_pFun, + unsigned a_iPri=0, EOprtAssociativity a_eAssociativity = oaLEFT, bool a_bAllowOpt = false); void DefineConst(const string_type &a_sName, value_type a_fVal); @@ -153,7 +153,7 @@ private: void ClearInfixOprt(); void ClearPostfixOprt(); void ClearOprt(); - + void RemoveVar(const string_type &a_strVarName); const varmap_type& GetUsedVar() const; const varmap_type& GetVar() const; @@ -173,23 +173,23 @@ private: void SetArgSep(char_type cArgSep); char_type GetArgSep() const; - - void Error(EErrorCodes a_iErrc, - int a_iPos = (int)mu::string_type::npos, + + void Error(EErrorCodes a_iErrc, + int a_iPos = (int)mu::string_type::npos, const string_type &a_strTok = string_type() ) const; protected: - + void Init(); virtual void InitCharSets() = 0; virtual void InitFun() = 0; virtual void InitConst() = 0; - virtual void InitOprt() = 0; + virtual void InitOprt() = 0; virtual void OnDetectVar(string_type *pExpr, int &nStart, int &nEnd); - static const char_type *c_DefaultOprt[]; + static const char_type *c_DefaultOprt[]; static std::locale s_locale; ///< The locale used by the parser static bool g_DbgDumpCmdCode; static bool g_DbgDumpStack; @@ -199,16 +199,16 @@ private: class change_dec_sep : public std::numpunct<TChar> { public: - + explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3) :std::numpunct<TChar>() ,m_nGroup(nGroup) ,m_cDecPoint(cDecSep) ,m_cThousandsSep(cThousandsSep) {} - + protected: - + virtual char_type do_decimal_point() const { return m_cDecPoint; @@ -219,12 +219,12 @@ private: return m_cThousandsSep; } - virtual std::string do_grouping() const - { + virtual std::string do_grouping() const + { // fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4 // courtesy of Jens Bartsch // original code: - // return std::string(1, (char)m_nGroup); + // return std::string(1, (char)m_nGroup); // new code: return std::string(1, (char)(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX)); } @@ -232,7 +232,7 @@ private: private: int m_nGroup; - char_type m_cDecPoint; + char_type m_cDecPoint; char_type m_cThousandsSep; }; @@ -242,8 +242,8 @@ private: void InitTokenReader(); void ReInit() const; - void AddCallback( const string_type &a_strName, - const ParserCallback &a_Callback, + void AddCallback( const string_type &a_strName, + const ParserCallback &a_Callback, funmap_type &a_Storage, const char_type *a_szCharSet ); @@ -256,8 +256,8 @@ private: ParserStack<token_type> &a_stVal) const; void ApplyFunc(ParserStack<token_type> &a_stOpt, - ParserStack<token_type> &a_stVal, - int iArgCount) const; + ParserStack<token_type> &a_stVal, + int iArgCount) const; token_type ApplyStrFunc(const token_type &a_FunTok, const std::vector<token_type> &a_vArg) const; @@ -267,7 +267,7 @@ private: void CreateRPN() const; - value_type ParseString() const; + value_type ParseString() const; value_type ParseCmdCode() const; value_type ParseCmdCodeBulk(int nOffset, int nThreadID) const; @@ -276,11 +276,11 @@ private: const ParserCallback &a_Callback, const string_type &a_szCharSet) const; - void StackDump(const ParserStack<token_type > &a_stVal, + void StackDump(const ParserStack<token_type > &a_stVal, const ParserStack<token_type > &a_stOprt) const; - /** \brief Pointer to the parser function. - + /** \brief Pointer to the parser function. + Eval() calls the function whose address is stored there. */ mutable ParseFunction m_pParseFormula; @@ -303,7 +303,7 @@ private: string_type m_sNameChars; ///< Charset for names string_type m_sOprtChars; ///< Charset for postfix/ binary operator tokens string_type m_sInfixOprtChars; ///< Charset for infix operator tokens - + mutable int m_nIfElseCounter; ///< Internal counter for keeping track of nested if-then-else clauses // items merely used for caching state information diff --git a/moose-core/external/muparser/include/muParserBytecode.h b/moose-core/external/muparser/include/muParserBytecode.h index 33e3c26c0a1cc0dbfb92c751698ae7414b7044d1..6f931f9cfde6cebc724968691a02c5b2c25f828d 100644 --- a/moose-core/external/muparser/include/muParserBytecode.h +++ b/moose-core/external/muparser/include/muParserBytecode.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2004-2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_BYTECODE_H #define MU_PARSER_BYTECODE_H @@ -57,7 +57,7 @@ namespace mu struct //SFunData { - // Note: generic_fun_type is merely a placeholder. The real type could be + // Note: generic_fun_type is merely a placeholder. The real type could be // anything between gun_type1 and fun_type9. I can't use a void // pointer due to constraints in the ANSI standard which allows // data pointers and function pointers to differ in size. @@ -73,16 +73,16 @@ namespace mu } Oprt; }; }; - - + + /** \brief Bytecode implementation of the Math Parser. The bytecode contains the formula converted to revers polish notation stored in a continious - memory area. Associated with this data are operator codes, variable pointers, constant + memory area. Associated with this data are operator codes, variable pointers, constant values and function pointers. Those are necessary in order to calculate the result. All those data items will be casted to the underlying datatype of the bytecode. - \author (C) 2004-2013 Ingo Berg + \author (C) 2004-2013 Ingo Berg */ class ParserByteCode { @@ -99,7 +99,7 @@ private: /** \brief Maximum size needed for the stack. */ std::size_t m_iMaxStackSize; - + /** \brief The actual rpn storage. */ rpn_type m_vRPN; diff --git a/moose-core/external/muparser/include/muParserCallback.h b/moose-core/external/muparser/include/muParserCallback.h index 578bda0410b9030bfcccb069c8344def8c5501bf..9ecd61a6fde61d46de8cf8fe560c8541d0441089 100644 --- a/moose-core/external/muparser/include/muParserCallback.h +++ b/moose-core/external/muparser/include/muParserCallback.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2004-2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_CALLBACK_H @@ -40,10 +40,10 @@ namespace mu Encapsulates the prototyp for numerical parser functions. The class stores the number of arguments for parser functions as well as additional flags indication the function is non optimizeable. - The pointer to the callback function pointer is stored as void* + The pointer to the callback function pointer is stored as void* and needs to be casted according to the argument count. Negative argument counts indicate a parser function with a variable number - of arguments. + of arguments. \author (C) 2004-2011 Ingo Berg */ @@ -81,7 +81,7 @@ public: ParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti); ParserCallback(); ParserCallback(const ParserCallback &a_Fun); - + ParserCallback* Clone() const; bool IsOptimizable() const; @@ -94,23 +94,23 @@ public: private: void *m_pFun; ///< Pointer to the callback function, casted to void - + /** \brief Number of numeric function arguments - + This number is negative for functions with variable number of arguments. in this cases they represent the actual number of arguments found. */ - int m_iArgc; + int m_iArgc; int m_iPri; ///< Valid only for binary and infix operators; Operator precedence. - EOprtAssociativity m_eOprtAsct; ///< Operator associativity; Valid only for binary operators + EOprtAssociativity m_eOprtAsct; ///< Operator associativity; Valid only for binary operators ECmdCode m_iCode; ETypeCode m_iType; - bool m_bAllowOpti; ///< Flag indication optimizeability + bool m_bAllowOpti; ///< Flag indication optimizeability }; //------------------------------------------------------------------------------ /** \brief Container for Callback objects. */ -typedef std::map<string_type, ParserCallback> funmap_type; +typedef std::map<string_type, ParserCallback> funmap_type; } // namespace mu diff --git a/moose-core/external/muparser/include/muParserDLL.h b/moose-core/external/muparser/include/muParserDLL.h index 180b4760ed0018426a22903e0521fa38f5976b9d..dc0709c7bbf455ff803a8684121e8cc4fa9f9181 100644 --- a/moose-core/external/muparser/include/muParserDLL.h +++ b/moose-core/external/muparser/include/muParserDLL.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_DLL_H #define MU_PARSER_DLL_H @@ -41,7 +41,7 @@ extern "C" { #endif -/** \file +/** \file \brief This file contains the DLL interface of muparser. */ @@ -55,34 +55,34 @@ typedef void* muParserHandle_t; // parser handle #endif typedef int muBool_t; // boolean type -typedef int muInt_t; // integer type +typedef int muInt_t; // integer type typedef double muFloat_t; // floating point type // function types for calculation -typedef muFloat_t (*muFun0_t )(); -typedef muFloat_t (*muFun1_t )(muFloat_t); -typedef muFloat_t (*muFun2_t )(muFloat_t, muFloat_t); -typedef muFloat_t (*muFun3_t )(muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muFun4_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muFun5_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muFun6_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muFun7_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muFun8_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muFun9_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muFun10_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muFun0_t )(); +typedef muFloat_t (*muFun1_t )(muFloat_t); +typedef muFloat_t (*muFun2_t )(muFloat_t, muFloat_t); +typedef muFloat_t (*muFun3_t )(muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muFun4_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muFun5_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muFun6_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muFun7_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muFun8_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muFun9_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muFun10_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); // Function prototypes for bulkmode functions -typedef muFloat_t (*muBulkFun0_t )(int, int); -typedef muFloat_t (*muBulkFun1_t )(int, int, muFloat_t); -typedef muFloat_t (*muBulkFun2_t )(int, int, muFloat_t, muFloat_t); -typedef muFloat_t (*muBulkFun3_t )(int, int, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muBulkFun4_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muBulkFun5_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muBulkFun6_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muBulkFun7_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muBulkFun8_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muBulkFun9_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); -typedef muFloat_t (*muBulkFun10_t)(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun0_t )(int, int); +typedef muFloat_t (*muBulkFun1_t )(int, int, muFloat_t); +typedef muFloat_t (*muBulkFun2_t )(int, int, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun3_t )(int, int, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun4_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun5_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun6_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun7_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun8_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun9_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); +typedef muFloat_t (*muBulkFun10_t)(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); typedef muFloat_t (*muMultFun_t)(const muFloat_t*, muInt_t); typedef muFloat_t (*muStrFun1_t)(const muChar_t*); @@ -111,7 +111,7 @@ static const int muBASETYPE_INT = 1; //----------------------------------------------------------------------------------------------------- -// Basic operations / initialization +// Basic operations / initialization API_EXPORT(muParserHandle_t) mupCreate(int nBaseType); API_EXPORT(void) mupRelease(muParserHandle_t a_hParser); API_EXPORT(const muChar_t*) mupGetExpr(muParserHandle_t a_hParser); @@ -153,43 +153,43 @@ API_EXPORT(void) mupDefineStrFun1(muParserHandle_t a_hParser, const muChar_t *a_ API_EXPORT(void) mupDefineStrFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun2_t a_pFun); API_EXPORT(void) mupDefineStrFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun3_t a_pFun); -API_EXPORT(void) mupDefineMultFun( muParserHandle_t a_hParser, - const muChar_t* a_szName, - muMultFun_t a_pFun, +API_EXPORT(void) mupDefineMultFun( muParserHandle_t a_hParser, + const muChar_t* a_szName, + muMultFun_t a_pFun, muBool_t a_bOptimize); -API_EXPORT(void) mupDefineOprt( muParserHandle_t a_hParser, - const muChar_t* a_szName, - muFun2_t a_pFun, - muInt_t a_nPrec, +API_EXPORT(void) mupDefineOprt( muParserHandle_t a_hParser, + const muChar_t* a_szName, + muFun2_t a_pFun, + muInt_t a_nPrec, muInt_t a_nOprtAsct, muBool_t a_bOptimize); -API_EXPORT(void) mupDefineConst( muParserHandle_t a_hParser, - const muChar_t* a_szName, +API_EXPORT(void) mupDefineConst( muParserHandle_t a_hParser, + const muChar_t* a_szName, muFloat_t a_fVal ); -API_EXPORT(void) mupDefineStrConst( muParserHandle_t a_hParser, - const muChar_t* a_szName, +API_EXPORT(void) mupDefineStrConst( muParserHandle_t a_hParser, + const muChar_t* a_szName, const muChar_t *a_sVal ); -API_EXPORT(void) mupDefineVar( muParserHandle_t a_hParser, - const muChar_t* a_szName, +API_EXPORT(void) mupDefineVar( muParserHandle_t a_hParser, + const muChar_t* a_szName, muFloat_t *a_fVar); -API_EXPORT(void) mupDefineBulkVar( muParserHandle_t a_hParser, - const muChar_t* a_szName, +API_EXPORT(void) mupDefineBulkVar( muParserHandle_t a_hParser, + const muChar_t* a_szName, muFloat_t *a_fVar); -API_EXPORT(void) mupDefinePostfixOprt( muParserHandle_t a_hParser, - const muChar_t* a_szName, - muFun1_t a_pOprt, +API_EXPORT(void) mupDefinePostfixOprt( muParserHandle_t a_hParser, + const muChar_t* a_szName, + muFun1_t a_pOprt, muBool_t a_bOptimize); -API_EXPORT(void) mupDefineInfixOprt( muParserHandle_t a_hParser, - const muChar_t* a_szName, - muFun1_t a_pOprt, +API_EXPORT(void) mupDefineInfixOprt( muParserHandle_t a_hParser, + const muChar_t* a_szName, + muFun1_t a_pOprt, muBool_t a_bOptimize); // Define character sets for identifiers diff --git a/moose-core/external/muparser/include/muParserDef.h b/moose-core/external/muparser/include/muParserDef.h index c8e3f930b02311bb40c2b8d382d951387e1be37a..f4427455da2287b57b19a0679d4b9cf4666f6f7c 100644 --- a/moose-core/external/muparser/include/muParserDef.h +++ b/moose-core/external/muparser/include/muParserDef.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2014 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MUP_DEF_H #define MUP_DEF_H @@ -51,9 +51,9 @@ */ #define MUP_BASETYPE double -/** \brief Activate this option in order to compile with OpenMP support. +/** \brief Activate this option in order to compile with OpenMP support. - OpenMP is used only in the bulk mode it may increase the performance a bit. + OpenMP is used only in the bulk mode it may increase the performance a bit. */ //#define MUP_USE_OPENMP @@ -68,7 +68,7 @@ #ifndef _T #define _T(x) x #endif - + /** \brief Definition of the basic parser string type. */ #define MUP_STRING_TYPE std::string #endif @@ -121,8 +121,8 @@ namespace mu #else - /** \brief Encapsulate cout. - + /** \brief Encapsulate cout. + Used for supporting UNICODE more easily. */ inline std::ostream& console() @@ -130,7 +130,7 @@ namespace mu return std::cout; } - /** \brief Encapsulate cin. + /** \brief Encapsulate cin. Used for supporting UNICODE more easily. */ @@ -184,7 +184,7 @@ namespace mu // operators and functions cmFUNC, ///< Code for a generic function item cmFUNC_STR, ///< Code for a function with a string parameter - cmFUNC_BULK, ///< Special callbacks for Bulk mode with an additional parameter for the bulk index + cmFUNC_BULK, ///< Special callbacks for Bulk mode with an additional parameter for the bulk index cmSTRING, ///< Code for a string token cmOPRT_BIN, ///< user defined binary operator cmOPRT_POSTFIX, ///< code for postfix operators @@ -240,20 +240,20 @@ namespace mu //------------------------------------------------------------------------------ // basic types - /** \brief The numeric datatype used by the parser. - + /** \brief The numeric datatype used by the parser. + Normally this is a floating point type either single or double precision. */ typedef MUP_BASETYPE value_type; - /** \brief The stringtype used by the parser. + /** \brief The stringtype used by the parser. Depends on wether UNICODE is used or not. */ typedef MUP_STRING_TYPE string_type; - /** \brief The character type used by the parser. - + /** \brief The character type used by the parser. + Depends on wether UNICODE is used or not. */ typedef string_type::value_type char_type; @@ -267,15 +267,15 @@ namespace mu /** \brief Type used for storing variables. */ typedef std::map<string_type, value_type*> varmap_type; - + /** \brief Type used for storing constants. */ typedef std::map<string_type, value_type> valmap_type; - + /** \brief Type for assigning a string name to an index in the internal string table. */ typedef std::map<string_type, std::size_t> strmap_type; // Parser callbacks - + /** \brief Callback type used for functions without arguments. */ typedef value_type (*generic_fun_type)(); diff --git a/moose-core/external/muparser/include/muParserError.h b/moose-core/external/muparser/include/muParserError.h index 7be257608ca1acaa1fee886fa3c6e409c579ce5b..fe817d87e27130253db015c1d6146a593c2cd6f6 100644 --- a/moose-core/external/muparser/include/muParserError.h +++ b/moose-core/external/muparser/include/muParserError.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2004-2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_ERROR_H @@ -35,7 +35,7 @@ #include "muParserDef.h" -/** \file +/** \file \brief This file defines the error class used by the parser. */ @@ -72,27 +72,27 @@ enum EErrorCodes ecINVALID_POSTFIX_IDENT = 21, ///< Invalid function, variable or constant name. ecBUILTIN_OVERLOAD = 22, ///< Trying to overload builtin operator - ecINVALID_FUN_PTR = 23, ///< Invalid callback function pointer - ecINVALID_VAR_PTR = 24, ///< Invalid variable pointer + ecINVALID_FUN_PTR = 23, ///< Invalid callback function pointer + ecINVALID_VAR_PTR = 24, ///< Invalid variable pointer ecEMPTY_EXPRESSION = 25, ///< The Expression is empty ecNAME_CONFLICT = 26, ///< Name conflict ecOPT_PRI = 27, ///< Invalid operator priority - // + // ecDOMAIN_ERROR = 28, ///< catch division by zero, sqrt(-1), log(0) (currently unused) ecDIV_BY_ZERO = 29, ///< Division by zero (currently unused) ecGENERIC = 30, ///< Generic error ecLOCALE = 31, ///< Conflict with current locale ecUNEXPECTED_CONDITIONAL = 32, - ecMISSING_ELSE_CLAUSE = 33, + ecMISSING_ELSE_CLAUSE = 33, ecMISPLACED_COLON = 34, ecUNREASONABLE_NUMBER_OF_COMPUTATIONS = 35, // internal errors ecINTERNAL_ERROR = 36, ///< Internal error of any kind. - - // The last two are special entries + + // The last two are special entries ecCOUNT, ///< This is no error code, It just stores just the total number of error codes ecUNDEFINED = -1 ///< Undefined message, placeholder to detect unassigned error messages }; @@ -120,7 +120,7 @@ private: }; //--------------------------------------------------------------------------- -/** \brief Error class of the parser. +/** \brief Error class of the parser. \author Ingo Berg Part of the math parser package. @@ -130,7 +130,7 @@ class ParserError private: /** \brief Replace all ocuurences of a substring with another string. */ - void ReplaceSubString( string_type &strSource, + void ReplaceSubString( string_type &strSource, const string_type &strFind, const string_type &strReplaceWith); void Reset(); @@ -144,11 +144,11 @@ public: const string_type &sTok, const string_type &sFormula = string_type(), int a_iPos = -1); - ParserError( EErrorCodes a_iErrc, - int a_iPos, + ParserError( EErrorCodes a_iErrc, + int a_iPos, const string_type &sTok); - ParserError( const char_type *a_szMsg, - int a_iPos = -1, + ParserError( const char_type *a_szMsg, + int a_iPos = -1, const string_type &sTok = string_type()); ParserError(const ParserError &a_Obj); ParserError& operator=(const ParserError &a_Obj); @@ -165,10 +165,10 @@ private: string_type m_strMsg; ///< The message string string_type m_strFormula; ///< Formula string string_type m_strTok; ///< Token related with the error - int m_iPos; ///< Formula position related to the error + int m_iPos; ///< Formula position related to the error EErrorCodes m_iErrc; ///< Error code const ParserErrorMsg &m_ErrMsg; -}; +}; } // namespace mu diff --git a/moose-core/external/muparser/include/muParserFixes.h b/moose-core/external/muparser/include/muParserFixes.h index 0a07237c4c8113f69cf5ffa3d6445fa1fc56d8e0..31d9c1446f17e9aa75494717d13ea0fe0ec89a20 100644 --- a/moose-core/external/muparser/include/muParserFixes.h +++ b/moose-core/external/muparser/include/muParserFixes.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_FIXES_H diff --git a/moose-core/external/muparser/include/muParserInt.h b/moose-core/external/muparser/include/muParserInt.h index 4db2be8b6bd0a70ebdd67b1bc9b8a9519424cba3..8833b995d7c58461970cff0d273ff5c691dc64cf 100644 --- a/moose-core/external/muparser/include/muParserInt.h +++ b/moose-core/external/muparser/include/muParserInt.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2004-2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_INT_H @@ -39,15 +39,15 @@ namespace mu { /** \brief Mathematical expressions parser. - - This version of the parser handles only integer numbers. It disables the built in operators thus it is + + This version of the parser handles only integer numbers. It disables the built in operators thus it is slower than muParser. Integer values are stored in the double value_type and converted if needed. */ class ParserInt : public ParserBase { private: static int Round(value_type v) { return (int)(v + ((v>=0) ? 0.5 : -0.5) ); }; - + static value_type Abs(value_type); static value_type Sign(value_type); static value_type Ite(value_type, value_type, value_type); @@ -88,16 +88,16 @@ private: class change_dec_sep : public std::numpunct<TChar> { public: - + explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3) :std::numpunct<TChar>() ,m_cDecPoint(cDecSep) ,m_cThousandsSep(cThousandsSep) ,m_nGroup(nGroup) {} - + protected: - + virtual char_type do_decimal_point() const { return m_cDecPoint; @@ -108,12 +108,12 @@ private: return m_cThousandsSep; } - virtual std::string do_grouping() const - { + virtual std::string do_grouping() const + { // fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4 // courtesy of Jens Bartsch // original code: - // return std::string(1, (char)m_nGroup); + // return std::string(1, (char)m_nGroup); // new code: return std::string(1, (char)(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX)); } @@ -121,7 +121,7 @@ private: private: int m_nGroup; - char_type m_cDecPoint; + char_type m_cDecPoint; char_type m_cThousandsSep; }; diff --git a/moose-core/external/muparser/include/muParserStack.h b/moose-core/external/muparser/include/muParserStack.h index a4c20a5c8fad254911803a78d7923ac6ebd2da16..40a9908e11ae15bcae8c7a0c1e692a08fe71030f 100644 --- a/moose-core/external/muparser/include/muParserStack.h +++ b/moose-core/external/muparser/include/muParserStack.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2004-2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_STACK_H @@ -34,33 +34,33 @@ #include "muParserError.h" #include "muParserToken.h" -/** \file +/** \file \brief This file defines the stack used by muparser. */ namespace mu { - /** \brief Parser stack implementation. + /** \brief Parser stack implementation. Stack implementation based on a std::stack. The behaviour of pop() had been slightly changed in order to get an error code if the stack is empty. The stack is used within the Parser both as a value stack and as an operator stack. - \author (C) 2004-2011 Ingo Berg + \author (C) 2004-2011 Ingo Berg */ template <typename TValueType> - class ParserStack + class ParserStack { private: /** \brief Type of the underlying stack implementation. */ typedef std::stack<TValueType, std::vector<TValueType> > impl_type; - + impl_type m_Stack; ///< This is the actual stack. - public: - + public: + //--------------------------------------------------------------------------- ParserStack() :m_Stack() @@ -72,7 +72,7 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Pop a value from the stack. - + Unlike the standard implementation this function will return the value that is going to be taken from the stack. @@ -89,35 +89,35 @@ namespace mu return el; } - /** \brief Push an object into the stack. + /** \brief Push an object into the stack. \param a_Val object to push into the stack. \throw nothrow */ - void push(const TValueType& a_Val) - { - m_Stack.push(a_Val); + void push(const TValueType& a_Val) + { + m_Stack.push(a_Val); } /** \brief Return the number of stored elements. */ unsigned size() const - { - return (unsigned)m_Stack.size(); + { + return (unsigned)m_Stack.size(); } /** \brief Returns true if stack is empty false otherwise. */ bool empty() const { - return m_Stack.empty(); + return m_Stack.empty(); } - - /** \brief Return reference to the top object in the stack. - + + /** \brief Return reference to the top object in the stack. + The top object is the one pushed most recently. */ - TValueType& top() - { - return m_Stack.top(); + TValueType& top() + { + return m_Stack.top(); } }; } // namespace MathUtils diff --git a/moose-core/external/muparser/include/muParserTemplateMagic.h b/moose-core/external/muparser/include/muParserTemplateMagic.h index 1caeb4b6de47a3daf5d030deaf671988ca174af1..d212fda231139f8ead5a00eb5250e864ee03825f 100644 --- a/moose-core/external/muparser/include/muParserTemplateMagic.h +++ b/moose-core/external/muparser/include/muParserTemplateMagic.h @@ -13,7 +13,7 @@ namespace mu // //----------------------------------------------------------------------------------------------- - /** \brief A class singling out integer types at compile time using + /** \brief A class singling out integer types at compile time using template meta programming. */ template<typename T> @@ -98,7 +98,7 @@ namespace mu static T ASinh(T v) { return log(v + sqrt(v * v + 1)); } static T ACosh(T v) { return log(v + sqrt(v * v - 1)); } static T ATanh(T v) { return ((T)0.5 * log((1 + v) / (1 - v))); } - static T Log(T v) { return log(v); } + static T Log(T v) { return log(v); } static T Log2(T v) { return log(v)/log((T)2); } // Logarithm base 2 static T Log10(T v) { return log10(v); } // Logarithm base 10 static T Exp(T v) { return exp(v); } diff --git a/moose-core/external/muparser/include/muParserTest.h b/moose-core/external/muparser/include/muParserTest.h index e8da872c557c5f7c2921f1fe7a2bcbc7835885c5..1e2b4d0ba663211ab5138df95757e1d1079ed67e 100644 --- a/moose-core/external/muparser/include/muParserTest.h +++ b/moose-core/external/muparser/include/muParserTest.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_TEST_H @@ -53,14 +53,14 @@ namespace mu // Multiarg callbacks static value_type f1of1(value_type v) { return v;}; - + static value_type f1of2(value_type v, value_type ) {return v;}; static value_type f2of2(value_type , value_type v) {return v;}; static value_type f1of3(value_type v, value_type , value_type ) {return v;}; static value_type f2of3(value_type , value_type v, value_type ) {return v;}; static value_type f3of3(value_type , value_type , value_type v) {return v;}; - + static value_type f1of4(value_type v, value_type, value_type , value_type ) {return v;} static value_type f2of4(value_type , value_type v, value_type , value_type ) {return v;} static value_type f3of4(value_type , value_type, value_type v, value_type ) {return v;} @@ -81,11 +81,11 @@ namespace mu static value_type sign(value_type v) { return -v; } static value_type add(value_type v1, value_type v2) { return v1+v2; } static value_type land(value_type v1, value_type v2) { return (int)v1 & (int)v2; } - + static value_type FirstArg(const value_type* a_afArg, int a_iArgc) { - if (!a_iArgc) + if (!a_iArgc) throw mu::Parser::exception_type( _T("too few arguments for function FirstArg.") ); return a_afArg[0]; @@ -93,15 +93,15 @@ namespace mu static value_type LastArg(const value_type* a_afArg, int a_iArgc) { - if (!a_iArgc) + if (!a_iArgc) throw mu::Parser::exception_type( _T("too few arguments for function LastArg.") ); return a_afArg[a_iArgc-1]; } static value_type Sum(const value_type* a_afArg, int a_iArgc) - { - if (!a_iArgc) + { + if (!a_iArgc) throw mu::Parser::exception_type( _T("too few arguments for function sum.") ); value_type fRes=0; @@ -120,31 +120,31 @@ namespace mu } static value_type Ping() - { - return 10; + { + return 10; } - static value_type ValueOf(const char_type*) - { - return 123; + static value_type ValueOf(const char_type*) + { + return 123; } - static value_type StrFun1(const char_type* v1) - { + static value_type StrFun1(const char_type* v1) + { int val(0); stringstream_type(v1) >> val; return (value_type)val; } - static value_type StrFun2(const char_type* v1, value_type v2) - { + static value_type StrFun2(const char_type* v1, value_type v2) + { int val(0); stringstream_type(v1) >> val; return (value_type)(val + v2); } - - static value_type StrFun3(const char_type* v1, value_type v2, value_type v3) - { + + static value_type StrFun3(const char_type* v1, value_type v2, value_type v3) + { int val(0); stringstream_type(v1) >> val; return val + v2 + v3; @@ -193,10 +193,10 @@ namespace mu // Test Double Parser int EqnTest(const string_type& a_str, double a_fRes, bool a_fPass); - int EqnTestWithVarChange(const string_type& a_str, - double a_fRes1, - double a_fVar1, - double a_fRes2, + int EqnTestWithVarChange(const string_type& a_str, + double a_fRes1, + double a_fVar1, + double a_fRes2, double a_fVar2); int ThrowTest(const string_type& a_str, int a_iErrc, bool a_bFail = true); diff --git a/moose-core/external/muparser/include/muParserToken.h b/moose-core/external/muparser/include/muParserToken.h index ff48bce7fc5c16505507513c00c0f51eba3e66ce..b3a879a7fc1c45379fcb44380781ff5093126d94 100644 --- a/moose-core/external/muparser/include/muParserToken.h +++ b/moose-core/external/muparser/include/muParserToken.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2004-2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_TOKEN_H @@ -41,7 +41,7 @@ namespace mu { - /** \brief Encapsulation of the data for a single formula token. + /** \brief Encapsulation of the data for a single formula token. Formula token implementation. Part of the Math Parser Package. Formula tokens can be either one of the following: @@ -55,7 +55,7 @@ namespace mu <li>binary operator</li> </ul> - \author (C) 2004-2013 Ingo Berg + \author (C) 2004-2013 Ingo Berg */ template<typename TBase, typename TString> class ParserToken @@ -68,14 +68,14 @@ namespace mu int m_iIdx; ///< An otional index to an external buffer storing the token data TString m_strTok; ///< Token string TString m_strVal; ///< Value for string variables - value_type m_fVal; ///< the value + value_type m_fVal; ///< the value std::auto_ptr<ParserCallback> m_pCallback; public: //--------------------------------------------------------------------------- /** \brief Constructor (default). - + Sets token to an neutral state of type cmUNKNOWN. \throw nothrow \sa ECmdCode @@ -93,7 +93,7 @@ namespace mu //------------------------------------------------------------------------------ /** \brief Create token from another one. - + Implemented by calling Assign(...) \throw nothrow \post m_iType==cmUNKNOWN @@ -103,10 +103,10 @@ namespace mu { Assign(a_Tok); } - + //------------------------------------------------------------------------------ - /** \brief Assignement operator. - + /** \brief Assignement operator. + Copy token state from another token and return this. Implemented by calling Assign(...). \throw nothrow @@ -119,7 +119,7 @@ namespace mu //------------------------------------------------------------------------------ /** \brief Copy token information from argument. - + \throw nothrow */ void Assign(const ParserToken &a_Tok) @@ -131,14 +131,14 @@ namespace mu m_strVal = a_Tok.m_strVal; m_iType = a_Tok.m_iType; m_fVal = a_Tok.m_fVal; - // create new callback object if a_Tok has one + // create new callback object if a_Tok has one m_pCallback.reset(a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone() : 0); } //------------------------------------------------------------------------------ - /** \brief Assign a token type. + /** \brief Assign a token type. - Token may not be of type value, variable or function. Those have seperate set functions. + Token may not be of type value, variable or function. Those have seperate set functions. \pre [assert] a_iType!=cmVAR \pre [assert] a_iType!=cmVAL @@ -175,13 +175,13 @@ namespace mu m_pTok = 0; m_iIdx = -1; - + return *this; } //------------------------------------------------------------------------------ - /** \brief Make this token a value token. - + /** \brief Make this token a value token. + Member variables not necessary for value tokens will be invalidated. \throw nothrow */ @@ -192,7 +192,7 @@ namespace mu m_fVal = a_fVal; m_strTok = a_strTok; m_iIdx = -1; - + m_pTok = 0; m_pCallback.reset(0); @@ -200,8 +200,8 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief make this token a variable token. - + /** \brief make this token a variable token. + Member variables not necessary for variable tokens will be invalidated. \throw nothrow */ @@ -217,8 +217,8 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Make this token a variable token. - + /** \brief Make this token a variable token. + Member variables not necessary for variable tokens will be invalidated. \throw nothrow */ @@ -235,8 +235,8 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Set an index associated with the token related data. - + /** \brief Set an index associated with the token related data. + In cmSTRFUNC - This is the index to a string table in the main parser. \param a_iIdx The index the string function result will take in the bytecode parser. \throw exception_type if #a_iIdx<0 or #m_iType!=cmSTRING @@ -245,13 +245,13 @@ namespace mu { if (m_iCode!=cmSTRING || a_iIdx<0) throw ParserError(ecINTERNAL_ERROR); - + m_iIdx = a_iIdx; } //------------------------------------------------------------------------------ - /** \brief Return Index associated with the token related data. - + /** \brief Return Index associated with the token related data. + In cmSTRFUNC - This is the index to a string table in the main parser. \throw exception_type if #m_iIdx<0 or #m_iType!=cmSTRING @@ -267,7 +267,7 @@ namespace mu //------------------------------------------------------------------------------ /** \brief Return the token type. - + \return #m_iType \throw nothrow */ @@ -295,13 +295,13 @@ namespace mu return m_iType; } } - + //------------------------------------------------------------------------------ int GetPri() const { if ( !m_pCallback.get()) throw ParserError(ecINTERNAL_ERROR); - + if ( m_pCallback->GetCode()!=cmOPRT_BIN && m_pCallback->GetCode()!=cmOPRT_INFIX) throw ParserError(ecINTERNAL_ERROR); @@ -339,7 +339,7 @@ namespace mu //------------------------------------------------------------------------------ /** \biref Get value of the token. - + Only applicable to variable and value tokens. \throw exception_type if token is no value/variable token. */ @@ -368,7 +368,7 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Return the number of function arguments. + /** \brief Return the number of function arguments. Valid only if m_iType==CmdFUNC. */ @@ -383,8 +383,8 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Return the token identifier. - + /** \brief Return the token identifier. + If #m_iType is cmSTRING the token identifier is the value of the string argument for a string function. \return #m_strTok diff --git a/moose-core/external/muparser/include/muParserTokenReader.h b/moose-core/external/muparser/include/muParserTokenReader.h index 654b597693a0f106e2eb12631adac486c05e455a..52b3c1ad97832bc9f6d5cd42e2529cc136758ac1 100644 --- a/moose-core/external/muparser/include/muParserTokenReader.h +++ b/moose-core/external/muparser/include/muParserTokenReader.h @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2004-2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MU_PARSER_TOKEN_READER_H @@ -51,7 +51,7 @@ namespace mu /** \brief Token reader for the ParserBase class. */ - class ParserTokenReader + class ParserTokenReader { private: @@ -78,20 +78,20 @@ namespace mu private: - /** \brief Syntax codes. - - The syntax codes control the syntax check done during the first time parsing of + /** \brief Syntax codes. + + The syntax codes control the syntax check done during the first time parsing of the expression string. They are flags that indicate which tokens are allowed next if certain tokens are identified. */ enum ESynCodes { - noBO = 1 << 0, ///< to avoid i.e. "cos(7)(" + noBO = 1 << 0, ///< to avoid i.e. "cos(7)(" noBC = 1 << 1, ///< to avoid i.e. "sin)" or "()" noVAL = 1 << 2, ///< to avoid i.e. "tan 2" or "sin(8)3.14" noVAR = 1 << 3, ///< to avoid i.e. "sin a" or "sin(8)a" noARG_SEP = 1 << 4, ///< to avoid i.e. ",," or "+," ... - noFUN = 1 << 5, ///< to avoid i.e. "sqrt cos" or "(1)sin" + noFUN = 1 << 5, ///< to avoid i.e. "sqrt cos" or "(1)sin" noOPT = 1 << 6, ///< to avoid i.e. "(+)" noPOSTOP = 1 << 7, ///< to avoid i.e. "(5!!)" "sin!" noINFIXOP = 1 << 8, ///< to avoid i.e. "++4" "!!4" @@ -102,15 +102,15 @@ namespace mu noELSE = 1 << 13, sfSTART_OF_LINE = noOPT | noBC | noPOSTOP | noASSIGN | noIF | noELSE | noARG_SEP, noANY = ~0 ///< All of he above flags set - }; + }; ParserTokenReader(const ParserTokenReader &a_Reader); ParserTokenReader& operator=(const ParserTokenReader &a_Reader); void Assign(const ParserTokenReader &a_Reader); void SetParent(ParserBase *a_pParent); - int ExtractToken(const char_type *a_szCharSet, - string_type &a_strTok, + int ExtractToken(const char_type *a_szCharSet, + string_type &a_strTok, int a_iPos) const; int ExtractOperatorToken(string_type &a_sTok, int a_iPos) const; @@ -126,8 +126,8 @@ namespace mu bool IsStrVarTok(token_type &a_Tok); bool IsUndefVarTok(token_type &a_Tok); bool IsString(token_type &a_Tok); - void Error(EErrorCodes a_iErrc, - int a_iPos = -1, + void Error(EErrorCodes a_iErrc, + int a_iPos = -1, const string_type &a_sTok = string_type() ) const; token_type& SaveBeforeReturn(const token_type &tok); diff --git a/moose-core/external/muparser/src/muParser.cpp b/moose-core/external/muparser/src/muParser.cpp index 925e8babd783306cc1e1ae46b83dadf0c0b1bb3a..4d89e6f78ef0e29e392653f7637df9d87a0c963f 100644 --- a/moose-core/external/muparser/src/muParser.cpp +++ b/moose-core/external/muparser/src/muParser.cpp @@ -1,27 +1,27 @@ -/* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ +/* + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "muParser.h" #include "muParserTemplateMagic.h" @@ -73,37 +73,37 @@ namespace mu // Logarithm functions // Logarithm base 2 - value_type Parser::Log2(value_type v) - { + value_type Parser::Log2(value_type v) + { #ifdef MUP_MATH_EXCEPTIONS if (v<=0) throw ParserError(ecDOMAIN_ERROR, _T("Log2")); #endif - return MathImpl<value_type>::Log2(v); - } + return MathImpl<value_type>::Log2(v); + } // Logarithm base 10 - value_type Parser::Log10(value_type v) - { + value_type Parser::Log10(value_type v) + { #ifdef MUP_MATH_EXCEPTIONS if (v<=0) throw ParserError(ecDOMAIN_ERROR, _T("Log10")); #endif - return MathImpl<value_type>::Log10(v); - } + return MathImpl<value_type>::Log10(v); + } // Logarithm base e (natural logarithm) - value_type Parser::Ln(value_type v) - { + value_type Parser::Ln(value_type v) + { #ifdef MUP_MATH_EXCEPTIONS if (v<=0) throw ParserError(ecDOMAIN_ERROR, _T("Ln")); #endif - return MathImpl<value_type>::Log(v); - } + return MathImpl<value_type>::Log(v); + } //--------------------------------------------------------------------------- // misc @@ -112,8 +112,8 @@ 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); } - // If no seed is given, - value_type Parser::Rand( value_type seed ) + // If no seed is given, + value_type Parser::Rand( value_type seed ) { static bool isSeedSet_ = false; if( ! isSeedSet_ ) @@ -133,14 +133,14 @@ namespace mu return mu::rng.uniform( v1, v2 ); /* Between a and b */ } - value_type Parser::Sqrt(value_type v) - { + value_type Parser::Sqrt(value_type v) + { #ifdef MUP_MATH_EXCEPTIONS if (v<0) throw ParserError(ecDOMAIN_ERROR, _T("sqrt")); #endif - return MathImpl<value_type>::Sqrt(v); + return MathImpl<value_type>::Sqrt(v); } value_type Parser::Rint(value_type v) { return MathImpl<value_type>::Rint(v); } value_type Parser::Sign(value_type v) { return MathImpl<value_type>::Sign(v); } @@ -150,9 +150,9 @@ namespace mu \param v The value to negate \return -v */ - value_type Parser::UnaryMinus(value_type v) - { - return -v; + value_type Parser::UnaryMinus(value_type v) + { + return -v; } //--------------------------------------------------------------------------- @@ -160,19 +160,19 @@ namespace mu \param v The value to negate \return -v */ - value_type Parser::UnaryPlus(value_type v) - { - return v; + value_type Parser::UnaryPlus(value_type v) + { + return v; } //--------------------------------------------------------------------------- - /** \brief Callback for adding multiple values. + /** \brief Callback for adding multiple values. \param [in] a_afArg Vector with the function arguments \param [in] a_iArgc The size of a_afArg */ value_type Parser::Sum(const value_type *a_afArg, int a_iArgc) - { - if (!a_iArgc) + { + if (!a_iArgc) throw exception_type(_T("too few arguments for function sum.")); value_type fRes=0; @@ -181,13 +181,13 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Callback for averaging multiple values. + /** \brief Callback for averaging multiple values. \param [in] a_afArg Vector with the function arguments \param [in] a_iArgc The size of a_afArg */ value_type Parser::Avg(const value_type *a_afArg, int a_iArgc) - { - if (!a_iArgc) + { + if (!a_iArgc) throw exception_type(_T("too few arguments for function sum.")); value_type fRes=0; @@ -197,17 +197,17 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Callback for determining the minimum value out of a vector. + /** \brief Callback for determining the minimum value out of a vector. \param [in] a_afArg Vector with the function arguments \param [in] a_iArgc The size of a_afArg */ value_type Parser::Min(const value_type *a_afArg, int a_iArgc) - { - if (!a_iArgc) + { + if (!a_iArgc) throw exception_type(_T("too few arguments for function min.")); value_type fRes=a_afArg[0]; - for (int i=0; i<a_iArgc; ++i) + for (int i=0; i<a_iArgc; ++i) fRes = std::min(fRes, a_afArg[i]); return fRes; @@ -215,13 +215,13 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Callback for determining the maximum value out of a vector. + /** \brief Callback for determining the maximum value out of a vector. \param [in] a_afArg Vector with the function arguments \param [in] a_iArgc The size of a_afArg */ value_type Parser::Max(const value_type *a_afArg, int a_iArgc) - { - if (!a_iArgc) + { + if (!a_iArgc) throw exception_type(_T("too few arguments for function min.")); value_type fRes=a_afArg[0]; @@ -232,7 +232,7 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Default value recognition callback. + /** \brief Default value recognition callback. \param [in] a_szExpr Pointer to the expression \param [in, out] a_iPos Pointer to an index storing the current position within the expression \param [out] a_fVal Pointer where the value should be stored in case one is found. @@ -258,7 +258,7 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Constructor. + /** \brief Constructor. Call ParserBase class constructor and trigger Function, Operator and Constant initialization. */ @@ -274,9 +274,9 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Define the character sets. + /** \brief Define the character sets. \sa DefineNameChars, DefineOprtChars, DefineInfixOprtChars - + This function is used for initializing the default character sets that define the characters to be useable in function and variable names and operators. */ @@ -343,7 +343,7 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Initialize constants. - + By default the parser recognizes two constants. Pi ("pi") and the Eulerian number ("_e"). */ @@ -354,8 +354,8 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Initialize operators. - + /** \brief Initialize operators. + By default only the unary minus operator is added. */ void Parser::InitOprt() @@ -374,7 +374,7 @@ namespace mu string sVar(pExpr->begin()+nStart, pExpr->begin()+nEnd); string sRepl = std::string("_") + sVar + "_"; - + int nOrigVarEnd = nEnd; cout << "variable detected!\n"; cout << " Expr: " << *pExpr << "\n"; @@ -390,23 +390,23 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Numerically differentiate with regard to a variable. + /** \brief Numerically differentiate with regard to a variable. \param [in] a_Var Pointer to the differentiation variable. \param [in] a_fPos Position at which the differentiation should take place. \param [in] a_fEpsilon Epsilon used for the numerical differentiation. - Numerical differentiation uses a 5 point operator yielding a 4th order + Numerical differentiation uses a 5 point operator yielding a 4th order formula. The default value for epsilon is 0.00074 which is numeric_limits<double>::epsilon() ^ (1/5) as suggested in the muparser forum: http://sourceforge.net/forum/forum.php?thread_id=1994611&forum_id=462843 */ - value_type Parser::Diff(value_type *a_Var, - value_type a_fPos, + value_type Parser::Diff(value_type *a_Var, + value_type a_fPos, value_type a_fEpsilon) const { - value_type fRes(0), + value_type fRes(0), fBuf(*a_Var), f[4] = {0,0,0,0}, fEpsilon(a_fEpsilon); diff --git a/moose-core/external/muparser/src/muParserBase.cpp b/moose-core/external/muparser/src/muParserBase.cpp index 8f8b60dd9455b047a69716d97e4d1d1993e58ea5..8b051572358d1ea146bf365bb27cedb49b6c6fca 100644 --- a/moose-core/external/muparser/src/muParserBase.cpp +++ b/moose-core/external/muparser/src/muParserBase.cpp @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "muParserBase.h" @@ -54,19 +54,19 @@ namespace mu bool ParserBase::g_DbgDumpStack = false; //------------------------------------------------------------------------------ - /** \brief Identifiers for built in binary operators. + /** \brief Identifiers for built in binary operators. - When defining custom binary operators with #AddOprt(...) make sure not to choose - names conflicting with these definitions. + When defining custom binary operators with #AddOprt(...) make sure not to choose + names conflicting with these definitions. */ - const char_type* ParserBase::c_DefaultOprt[] = - { - _T("<="), _T(">="), _T("!="), - _T("=="), _T("<"), _T(">"), - _T("+"), _T("-"), _T("*"), - _T("/"), _T("^"), _T("&&"), - _T("||"), _T("="), _T("("), - _T(")"), _T("?"), _T(":"), 0 + const char_type* ParserBase::c_DefaultOprt[] = + { + _T("<="), _T(">="), _T("!="), + _T("=="), _T("<"), _T(">"), + _T("+"), _T("-"), _T("*"), + _T("/"), _T("^"), _T("&&"), + _T("||"), _T("="), _T("("), + _T(")"), _T("?"), _T(":"), 0 }; //------------------------------------------------------------------------------ @@ -98,7 +98,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Copy constructor. + /** \brief Copy constructor. The parser can be safely copy constructed but the bytecode is reset during copy construction. @@ -130,7 +130,7 @@ namespace mu {} //--------------------------------------------------------------------------- - /** \brief Assignment operator. + /** \brief Assignment operator. Implemented by calling Assign(a_Parser). Self assignment is suppressed. \param a_Parser Object to copy to this. @@ -144,7 +144,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Copy state of a parser object to this. + /** \brief Copy state of a parser object to this. Clears Variables and Functions of this parser. Copies the states of all internal variables. @@ -196,9 +196,9 @@ namespace mu char_type cThousandsSep = std::use_facet< change_dec_sep<char_type> >(s_locale).thousands_sep(); s_locale = std::locale(std::locale("C"), new change_dec_sep<char_type>(cDecSep, cThousandsSep)); } - + //--------------------------------------------------------------------------- - /** \brief Sets the thousands operator. + /** \brief Sets the thousands operator. \param cThousandsSep The thousands separator as a character \sa SetDecSep @@ -212,7 +212,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Resets the locale. + /** \brief Resets the locale. The default locale used "." as decimal separator, no thousands separator and "," as function argument separator. @@ -224,7 +224,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Initialize the token reader. + /** \brief Initialize the token reader. Create new token reader object and submit pointers to function, operator, constant and variable definitions. @@ -257,8 +257,8 @@ namespace mu {} //--------------------------------------------------------------------------- - /** \brief Returns the version of muparser. - \param eInfo A flag indicating whether the full version info should be + /** \brief Returns the version of muparser. + \param eInfo A flag indicating whether the full version info should be returned or not. Format is as follows: "MAJOR.MINOR (COMPILER_FLAGS)" The COMPILER_FLAGS @@ -277,7 +277,7 @@ namespace mu #ifdef _DEBUG ss << _T("; DEBUG"); -#else +#else ss << _T("; RELEASE"); #endif @@ -310,11 +310,11 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add a value parsing function. - + /** \brief Add a value parsing function. + When parsing an expression muParser tries to detect values in the expression string using different valident callbacks. Thus it's possible to parse - for hex values, binary values and floating point values. + for hex values, binary values and floating point values. */ void ParserBase::AddValIdent(identfun_type a_pCallback) { @@ -322,19 +322,19 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Set a function that can create variable pointer for unknown expression variables. + /** \brief Set a function that can create variable pointer for unknown expression variables. \param a_pFactory A pointer to the variable factory. \param pUserData A user defined context pointer. */ void ParserBase::SetVarFactory(facfun_type a_pFactory, void *pUserData) { - m_pTokenReader->SetVarCreator(a_pFactory, pUserData); + m_pTokenReader->SetVarCreator(a_pFactory, pUserData); } //--------------------------------------------------------------------------- /** \brief Add a function or operator callback to the parser. */ void ParserBase::AddCallback( const string_type &a_strName, - const ParserCallback &a_Callback, + const ParserCallback &a_Callback, funmap_type &a_Storage, const char_type *a_szCharSet ) { @@ -362,7 +362,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Check if a name contains invalid characters. + /** \brief Check if a name contains invalid characters. \throw ParserException if the name contains invalid characters. */ @@ -384,7 +384,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Check if a name contains invalid characters. + /** \brief Check if a name contains invalid characters. \throw ParserException if the name contains invalid characters. */ @@ -400,7 +400,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Set the formula. + /** \brief Set the formula. \param a_strFormula Formula as string_type \throw ParserException in case of syntax errors. @@ -416,7 +416,7 @@ namespace mu // <ibg> 20060222: Bugfix for Borland-Kylix: // adding a space to the expression will keep Borlands KYLIX from going wild - // when calling tellg on a stringstream created from the expression after + // when calling tellg on a stringstream created from the expression after // reading a value at the end of an expression. (mu::Parser::IsVal function) // (tellg returns -1 otherwise causing the parser to ignore the value) string_type sBuf(a_sExpr + _T(" ") ); @@ -425,7 +425,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Get the default symbols used for the built in operators. + /** \brief Get the default symbols used for the built in operators. \sa c_DefaultOprt */ const char_type** ParserBase::GetOprtDef() const @@ -461,9 +461,9 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Virtual function that defines the characters allowed in name identifiers. + /** \brief Virtual function that defines the characters allowed in name identifiers. \sa #ValidOprtChars, #ValidPrefixOprtChars - */ + */ const char_type* ParserBase::ValidNameChars() const { assert(m_sNameChars.size()); @@ -471,7 +471,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Virtual function that defines the characters allowed in operator definitions. + /** \brief Virtual function that defines the characters allowed in operator definitions. \sa #ValidNameChars, #ValidPrefixOprtChars */ const char_type* ParserBase::ValidOprtChars() const @@ -491,22 +491,22 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add a user defined operator. + /** \brief Add a user defined operator. \post Will reset the Parser to string parsing mode. */ - void ParserBase::DefinePostfixOprt(const string_type &a_sName, + void ParserBase::DefinePostfixOprt(const string_type &a_sName, fun_type1 a_pFun, bool a_bAllowOpt) { - AddCallback(a_sName, + AddCallback(a_sName, ParserCallback(a_pFun, a_bAllowOpt, prPOSTFIX, cmOPRT_POSTFIX), - m_PostOprtDef, + m_PostOprtDef, ValidOprtChars() ); } //--------------------------------------------------------------------------- - /** \brief Initialize user defined functions. - + /** \brief Initialize user defined functions. + Calls the virtual functions InitFun(), InitConst() and InitOprt(). */ void ParserBase::Init() @@ -518,39 +518,39 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add a user defined operator. + /** \brief Add a user defined operator. \post Will reset the Parser to string parsing mode. - \param [in] a_sName operator Identifier + \param [in] a_sName operator Identifier \param [in] a_pFun Operator callback function \param [in] a_iPrec Operator Precedence (default=prSIGN) \param [in] a_bAllowOpt True if operator is volatile (default=false) \sa EPrec */ - void ParserBase::DefineInfixOprt(const string_type &a_sName, - fun_type1 a_pFun, - int a_iPrec, + void ParserBase::DefineInfixOprt(const string_type &a_sName, + fun_type1 a_pFun, + int a_iPrec, bool a_bAllowOpt) { - AddCallback(a_sName, - ParserCallback(a_pFun, a_bAllowOpt, a_iPrec, cmOPRT_INFIX), - m_InfixOprtDef, + AddCallback(a_sName, + ParserCallback(a_pFun, a_bAllowOpt, a_iPrec, cmOPRT_INFIX), + m_InfixOprtDef, ValidInfixOprtChars() ); } //--------------------------------------------------------------------------- - /** \brief Define a binary operator. + /** \brief Define a binary operator. \param [in] a_sName The identifier of the operator. \param [in] a_pFun Pointer to the callback function. \param [in] a_iPrec Precedence of the operator. \param [in] a_eAssociativity The associativity of the operator. \param [in] a_bAllowOpt If this is true the operator may be optimized away. - - Adds a new Binary operator the the parser instance. + + Adds a new Binary operator the the parser instance. */ - void ParserBase::DefineOprt( const string_type &a_sName, - fun_type2 a_pFun, - unsigned a_iPrec, + void ParserBase::DefineOprt( const string_type &a_sName, + fun_type2 a_pFun, + unsigned a_iPrec, EOprtAssociativity a_eAssociativity, bool a_bAllowOpt ) { @@ -559,16 +559,16 @@ namespace mu if (a_sName == string_type(c_DefaultOprt[i])) Error(ecBUILTIN_OVERLOAD, -1, a_sName); - AddCallback(a_sName, - ParserCallback(a_pFun, a_bAllowOpt, a_iPrec, a_eAssociativity), - m_OprtDef, + AddCallback(a_sName, + ParserCallback(a_pFun, a_bAllowOpt, a_iPrec, a_eAssociativity), + m_OprtDef, ValidOprtChars() ); } //--------------------------------------------------------------------------- /** \brief Define a new string constant. \param [in] a_strName The name of the constant. - \param [in] a_strVal the value of the constant. + \param [in] a_strVal the value of the constant. */ void ParserBase::DefineStrConst(const string_type &a_strName, const string_type &a_strVal) { @@ -577,7 +577,7 @@ namespace mu Error(ecNAME_CONFLICT); CheckName(a_strName, ValidNameChars()); - + m_vStringVarBuf.push_back(a_strVal); // Store variable string in internal buffer m_StrVarDef[a_strName] = m_vStringVarBuf.size()-1; // bind buffer index to variable name @@ -585,7 +585,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add a user defined variable. + /** \brief Add a user defined variable. \param [in] a_sName the variable name \param [in] a_pVar A pointer to the variable value. \post Will reset the Parser to string parsing mode. @@ -606,7 +606,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add a user defined constant. + /** \brief Add a user defined constant. \param [in] a_sName The name of the constant. \param [in] a_fVal the value of the constant. \post Will reset the Parser to string parsing mode. @@ -630,7 +630,7 @@ namespace mu // built in operators case cmEND: return -5; case cmARG_SEP: return -4; - case cmASSIGN: return -1; + case cmASSIGN: return -1; case cmELSE: case cmIF: return 0; case cmLAND: return prLAND; @@ -640,7 +640,7 @@ namespace mu case cmLE: case cmGE: case cmNEQ: - case cmEQ: return prCMP; + case cmEQ: return prCMP; case cmADD: case cmSUB: return prADD_SUB; case cmMUL: @@ -648,12 +648,12 @@ namespace mu case cmPOW: return prPOW; // user defined binary operators - case cmOPRT_INFIX: - case cmOPRT_BIN: + case cmOPRT_INFIX: + case cmOPRT_BIN: return a_Tok.GetPri(); default: Error(ecINTERNAL_ERROR, 5); return 999; - } + } } //--------------------------------------------------------------------------- @@ -672,7 +672,7 @@ namespace mu case cmLE: case cmGE: case cmNEQ: - case cmEQ: + case cmEQ: case cmADD: case cmSUB: case cmMUL: @@ -680,7 +680,7 @@ namespace mu case cmPOW: return oaRIGHT; case cmOPRT_BIN: return a_Tok.GetAssociativity(); default: return oaNONE; - } + } } //--------------------------------------------------------------------------- @@ -703,7 +703,7 @@ namespace mu m_pTokenReader->IgnoreUndefVar(false); throw; } - + return m_pTokenReader->GetUsedVar(); } @@ -726,9 +726,9 @@ namespace mu \return #m_FunDef \sa FunProt \throw nothrow - + The return type is a map of the public type #funmap_type containing the prototype - definitions for all numerical parser functions. String functions are not part of + definitions for all numerical parser functions. String functions are not part of this map. The Prototype definition is encapsulated in objects of the class FunProt one per parser function each associated with function names via a map construct. */ @@ -777,22 +777,22 @@ namespace mu // string functions won't be optimized m_vRPN.AddStrFun(pFunc, a_FunTok.GetArgCount(), a_vArg.back().GetIdx()); - + // Push dummy value representing the function result to the stack return valTok; } //--------------------------------------------------------------------------- - /** \brief Apply a function token. + /** \brief Apply a function token. \param iArgCount Number of Arguments actually gathered used only for multiarg functions. \post The result is pushed to the value stack \post The function token is removed from the stack \throw exception_type if Argument count does not match function requirements. */ void ParserBase::ApplyFunc( ParserStack<token_type> &a_stOpt, - ParserStack<token_type> &a_stVal, + ParserStack<token_type> &a_stVal, int a_iArgCount) const - { + { assert(m_pTokenReader.get()); // Operator stack empty or does not contain tokens with callback functions @@ -807,7 +807,7 @@ namespace mu // binary operators do not have commas in their expression int iArgCount = (funTok.GetCode()==cmOPRT_BIN) ? funTok.GetArgCount() : a_iArgCount; - // determine how many parameters the function needs. To remember iArgCount includes the + // determine how many parameters the function needs. To remember iArgCount includes the // string parameter whilst GetArgCount() counts only numeric parameters. int iArgRequired = funTok.GetArgCount() + ((funTok.GetType()==tpSTR) ? 1 : 0); @@ -817,7 +817,7 @@ namespace mu if (funTok.GetCode()==cmFUNC_STR && iArgCount-iArgNumerical>1) Error(ecINTERNAL_ERROR); - if (funTok.GetArgCount()>=0 && iArgCount>iArgRequired) + if (funTok.GetArgCount()>=0 && iArgCount>iArgRequired) Error(ecTOO_MANY_PARAMS, m_pTokenReader->GetPos()-1, funTok.GetAsString()); if (funTok.GetCode()!=cmOPRT_BIN && iArgCount<iArgRequired ) @@ -828,7 +828,7 @@ namespace mu // Collect the numeric function arguments from the value stack and store them // in a vector - std::vector<token_type> stArg; + std::vector<token_type> stArg; for (int i=0; i<iArgNumerical; ++i) { stArg.push_back( a_stVal.pop() ); @@ -838,17 +838,17 @@ namespace mu switch(funTok.GetCode()) { - case cmFUNC_STR: + case cmFUNC_STR: stArg.push_back(a_stVal.pop()); - + if ( stArg.back().GetType()==tpSTR && funTok.GetType()!=tpSTR ) Error(ecVAL_EXPECTED, m_pTokenReader->GetPos(), funTok.GetAsString()); - ApplyStrFunc(funTok, stArg); + ApplyStrFunc(funTok, stArg); break; - case cmFUNC_BULK: - m_vRPN.AddBulkFun(funTok.GetFuncAddr(), (int)stArg.size()); + case cmFUNC_BULK: + m_vRPN.AddBulkFun(funTok.GetFuncAddr(), (int)stArg.size()); break; case cmOPRT_BIN: @@ -864,7 +864,7 @@ namespace mu // Push dummy value representing the function result to the stack token_type token; - token.SetVal(1); + token.SetVal(1); a_stVal.push(token); } @@ -901,7 +901,7 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Performs the necessary steps to write code for - the execution of binary operators into the bytecode. + the execution of binary operators into the bytecode. */ void ParserBase::ApplyBinOprt(ParserStack<token_type> &a_stOpt, ParserStack<token_type> &a_stVal) const @@ -917,9 +917,9 @@ namespace mu token_type valTok1 = a_stVal.pop(), valTok2 = a_stVal.pop(), optTok = a_stOpt.pop(), - resTok; + resTok; - if ( valTok1.GetType()!=valTok2.GetType() || + if ( valTok1.GetType()!=valTok2.GetType() || (valTok1.GetType()==tpSTR && valTok2.GetType()==tpSTR) ) Error(ecOPRT_TYPE_CONFLICT, m_pTokenReader->GetPos(), optTok.GetAsString()); @@ -927,7 +927,7 @@ namespace mu { if (valTok2.GetCode()!=cmVAR) Error(ecUNEXPECTED_OPERATOR, -1, _T("=")); - + m_vRPN.AddAssignOp(valTok2.GetVar()); } else @@ -939,14 +939,14 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Apply a binary operator. + /** \brief Apply a binary operator. \param a_stOpt The operator stack \param a_stVal The value stack */ void ParserBase::ApplyRemainingOprt(ParserStack<token_type> &stOpt, ParserStack<token_type> &stVal) const { - while (stOpt.size() && + while (stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmIF) { @@ -990,7 +990,7 @@ namespace mu \sa ParseString(...) Command code contains precalculated stack positions of the values and the - associated operators. The Stack is filled beginning from index one the + associated operators. The Stack is filled beginning from index one the value at index zero is not used at all. */ value_type ParserBase::ParseCmdCode() const @@ -999,7 +999,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Evaluate the RPN. + /** \brief Evaluate the RPN. \param nOffset The offset added to variable addresses (for bulk mode) \param nThreadID OpenMP Thread id of the calling thread */ @@ -1007,7 +1007,7 @@ namespace mu { assert(nThreadID<=s_MaxNumOpenMPThreads); - // Note: The check for nOffset==0 and nThreadID here is not necessary but + // Note: The check for nOffset==0 and nThreadID here is not necessary but // brings a minor performance gain when not in bulk mode. value_type *Stack = ((nOffset==0) && (nThreadID==0)) ? &m_vStackBuffer[0] : &m_vStackBuffer[nThreadID * (m_vStackBuffer.size() / s_MaxNumOpenMPThreads)]; value_type buf; @@ -1032,17 +1032,17 @@ namespace mu if (Stack[1+sidx]==0) Error(ecDIV_BY_ZERO); #endif - Stack[sidx] /= Stack[1+sidx]; + Stack[sidx] /= Stack[1+sidx]; continue; - case cmPOW: + case cmPOW: --sidx; Stack[sidx] = MathImpl<value_type>::Pow(Stack[sidx], Stack[1+sidx]); continue; case cmLAND: --sidx; Stack[sidx] = Stack[sidx] && Stack[sidx+1]; continue; case cmLOR: --sidx; Stack[sidx] = Stack[sidx] || Stack[sidx+1]; continue; - case cmASSIGN: + case cmASSIGN: // Bugfix for Bulkmode: // for details see: // https://groups.google.com/forum/embed/?place=forum/muparser-dev&showsearch=true&showpopout=true&showtabs=false&parenturl=http://muparser.beltoforion.de/mup_forum.html&afterlogin&pli=1#!topic/muparser-dev/szgatgoHTws @@ -1074,7 +1074,7 @@ namespace mu // value and variable tokens case cmVAR: Stack[++sidx] = *(pTok->Val.ptr + nOffset); continue; case cmVAL: Stack[++sidx] = pTok->Val.data2; continue; - + case cmVARPOW2: buf = *(pTok->Val.ptr + nOffset); Stack[++sidx] = buf*buf; continue; @@ -1086,7 +1086,7 @@ namespace mu case cmVARPOW4: buf = *(pTok->Val.ptr + nOffset); Stack[++sidx] = buf*buf*buf*buf; continue; - + case cmVARMUL: Stack[++sidx] = *(pTok->Val.ptr + nOffset) * pTok->Val.data + pTok->Val.data2; continue; @@ -1096,7 +1096,7 @@ namespace mu int iArgCount = pTok->Fun.argc; // switch according to argument count - switch(iArgCount) + switch(iArgCount) { case 0: sidx += 1; Stack[sidx] = (*(fun_type0)pTok->Fun.ptr)(); continue; case 1: Stack[sidx] = (*(fun_type1)pTok->Fun.ptr)(Stack[sidx]); continue; @@ -1125,7 +1125,7 @@ namespace mu sidx -= pTok->Fun.argc -1; // The index of the string argument in the string table - int iIdxStack = pTok->Fun.idx; + int iIdxStack = pTok->Fun.idx; MUP_ASSERT( iIdxStack>=0 && iIdxStack<(int)m_vStringBuf.size() ); switch(pTok->Fun.argc) // switch according to argument count @@ -1143,7 +1143,7 @@ namespace mu int iArgCount = pTok->Fun.argc; // switch according to argument count - switch(iArgCount) + switch(iArgCount) { case 0: sidx += 1; Stack[sidx] = (*(bulkfun_type0 )pTok->Fun.ptr)(nOffset, nThreadID); continue; case 1: Stack[sidx] = (*(bulkfun_type1 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx]); continue; @@ -1168,7 +1168,7 @@ namespace mu } // switch CmdCode } // for all bytecode tokens - return Stack[m_nFinalResultIdx]; + return Stack[m_nFinalResultIdx]; } //--------------------------------------------------------------------------- @@ -1183,11 +1183,11 @@ namespace mu token_type val, tval; // for storing value ReInit(); - + // The outermost counter counts the number of separated items // such as in "a=10,b=20,c=c+a" stArgCount.push(1); - + for(;;) { opt = m_pTokenReader->ReadNextToken(); @@ -1198,11 +1198,11 @@ namespace mu // Next three are different kind of value entries // case cmSTRING: - opt.SetIdx((int)m_vStringBuf.size()); // Assign buffer index to token + opt.SetIdx((int)m_vStringBuf.size()); // Assign buffer index to token stVal.push(opt); m_vStringBuf.push_back(opt.GetAsString()); // Store string in internal buffer break; - + case cmVAR: stVal.push(opt); m_vRPN.AddVar( static_cast<value_type*>(opt.GetVar()) ); @@ -1243,7 +1243,7 @@ namespace mu // was an opening bracket we know better... if (opta.GetCode()==cmBO) --stArgCount.top(); - + ApplyRemainingOprt(stOpt, stVal); // Check if the bracket content has been evaluated completely @@ -1253,24 +1253,24 @@ namespace mu // if there is either a function or a sign pending // neither the opening nor the closing bracket will be pushed back to // the operator stack - // Check if a function is standing in front of the opening bracket, + // Check if a function is standing in front of the opening bracket, // if yes evaluate it afterwards check for infix operators assert(stArgCount.size()); int iArgCount = stArgCount.pop(); - + stOpt.pop(); // Take opening bracket from stack - if (iArgCount>1 && ( stOpt.size()==0 || - (stOpt.top().GetCode()!=cmFUNC && - stOpt.top().GetCode()!=cmFUNC_BULK && + if (iArgCount>1 && ( stOpt.size()==0 || + (stOpt.top().GetCode()!=cmFUNC && + stOpt.top().GetCode()!=cmFUNC_BULK && stOpt.top().GetCode()!=cmFUNC_STR) ) ) Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos()); - + // The opening bracket was popped from the stack now check if there // was a function before this bracket - if (stOpt.size() && - stOpt.top().GetCode()!=cmOPRT_INFIX && - stOpt.top().GetCode()!=cmOPRT_BIN && + if (stOpt.size() && + stOpt.top().GetCode()!=cmOPRT_INFIX && + stOpt.top().GetCode()!=cmOPRT_BIN && stOpt.top().GetFuncAddr()!=0) { ApplyFunc(stOpt, stVal, iArgCount); @@ -1305,8 +1305,8 @@ namespace mu case cmASSIGN: case cmOPRT_BIN: - // A binary operator (user defined or built in) has been found. - while ( stOpt.size() && + // A binary operator (user defined or built in) has been found. + while ( stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmELSE && stOpt.top().GetCode() != cmIF) @@ -1319,7 +1319,7 @@ namespace mu // Deal with operator associativity EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt); - if ( (eOprtAsct==oaRIGHT && (nPrec1 <= nPrec2)) || + if ( (eOprtAsct==oaRIGHT && (nPrec1 <= nPrec2)) || (eOprtAsct==oaLEFT && (nPrec1 < nPrec2)) ) { break; @@ -1330,7 +1330,7 @@ namespace mu // In case the operators are not equal the precedence decides alone... break; } - + if (stOpt.top().GetCode()==cmOPRT_INFIX) ApplyFunc(stOpt, stVal, 1); else @@ -1355,7 +1355,7 @@ namespace mu case cmOPRT_INFIX: case cmFUNC: case cmFUNC_BULK: - case cmFUNC_STR: + case cmFUNC_STR: stOpt.push(opt); break; @@ -1407,9 +1407,9 @@ namespace mu /** \brief One of the two main parse functions. \sa ParseCmdCode(...) - Parse expression from input string. Perform syntax checking and create - bytecode. After parsing the string and creating the bytecode the function - pointer #m_pParseFormula will be changed to the second parse routine the + Parse expression from input string. Perform syntax checking and create + bytecode. After parsing the string and creating the bytecode the function + pointer #m_pParseFormula will be changed to the second parse routine the uses bytecode instead of string parsing. */ value_type ParserBase::ParseString() const @@ -1418,7 +1418,7 @@ namespace mu { CreateRPN(); m_pParseFormula = &ParserBase::ParseCmdCode; - return (this->*m_pParseFormula)(); + return (this->*m_pParseFormula)(); } catch(ParserError &exc) { @@ -1519,7 +1519,7 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Clear the user defined Prefix operators. + /** \brief Clear the user defined Prefix operators. \post Resets the parser to string parser mode. \throw nothrow */ @@ -1530,7 +1530,7 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Enable or disable the formula optimization feature. + /** \brief Enable or disable the formula optimization feature. \post Resets the parser to string parser mode. \throw nothrow */ @@ -1541,7 +1541,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Enable the dumping of bytecode and stack content on the console. + /** \brief Enable the dumping of bytecode and stack content on the console. \param bDumpCmd Flag to enable dumping of the current bytecode to the console. \param bDumpStack Flag to enable dumping of the stack content is written to the console. @@ -1580,7 +1580,7 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Get the argument separator character. + /** \brief Get the argument separator character. */ char_type ParserBase::GetArgSep() const { @@ -1588,7 +1588,7 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Set argument separator. + /** \brief Set argument separator. \param cArgSep the argument separator character. */ void ParserBase::SetArgSep(char_type cArgSep) @@ -1597,18 +1597,18 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Dump stack content. + /** \brief Dump stack content. This function is used for debugging only. */ - void ParserBase::StackDump(const ParserStack<token_type> &a_stVal, + void ParserBase::StackDump(const ParserStack<token_type> &a_stVal, const ParserStack<token_type> &a_stOprt) const { - ParserStack<token_type> stOprt(a_stOprt), + ParserStack<token_type> stOprt(a_stOprt), stVal(a_stVal); mu::console() << _T("\nValue stack:\n"); - while ( !stVal.empty() ) + while ( !stVal.empty() ) { token_type val = stVal.pop(); if (val.GetType()==tpSTR) @@ -1620,10 +1620,10 @@ namespace mu while ( !stOprt.empty() ) { - if (stOprt.top().GetCode()<=cmASSIGN) + if (stOprt.top().GetCode()<=cmASSIGN) { mu::console() << _T("OPRT_INTRNL \"") - << ParserBase::c_DefaultOprt[stOprt.top().GetCode()] + << ParserBase::c_DefaultOprt[stOprt.top().GetCode()] << _T("\" \n"); } else @@ -1632,17 +1632,17 @@ namespace mu { case cmVAR: mu::console() << _T("VAR\n"); break; case cmVAL: mu::console() << _T("VAL\n"); break; - case cmFUNC: mu::console() << _T("FUNC \"") - << stOprt.top().GetAsString() + case cmFUNC: mu::console() << _T("FUNC \"") + << stOprt.top().GetAsString() << _T("\"\n"); break; - case cmFUNC_BULK: mu::console() << _T("FUNC_BULK \"") - << stOprt.top().GetAsString() + case cmFUNC_BULK: mu::console() << _T("FUNC_BULK \"") + << stOprt.top().GetAsString() << _T("\"\n"); break; case cmOPRT_INFIX: mu::console() << _T("OPRT_INFIX \"") - << stOprt.top().GetAsString() + << stOprt.top().GetAsString() << _T("\"\n"); break; - case cmOPRT_BIN: mu::console() << _T("OPRT_BIN \"") - << stOprt.top().GetAsString() + case cmOPRT_BIN: mu::console() << _T("OPRT_BIN \"") + << stOprt.top().GetAsString() << _T("\"\n"); break; case cmFUNC_STR: mu::console() << _T("FUNC_STR\n"); break; case cmEND: mu::console() << _T("END\n"); break; @@ -1654,7 +1654,7 @@ namespace mu case cmENDIF: mu::console() << _T("ENDIF\n"); break; default: mu::console() << stOprt.top().GetCode() << _T(" "); break; } - } + } stOprt.pop(); } @@ -1662,7 +1662,7 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Evaluate an expression containing comma separated subexpressions + /** \brief Evaluate an expression containing comma separated subexpressions \param [out] nStackSize The total number of results available \return Pointer to the array containing all expression results @@ -1671,7 +1671,7 @@ namespace mu */ value_type* ParserBase::Eval(int &nStackSize) const { - (this->*m_pParseFormula)(); + (this->*m_pParseFormula)(); nStackSize = m_nFinalResultIdx; // (for historic reasons the stack starts at position 1) @@ -1679,10 +1679,10 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Return the number of results on the calculation stack. - - If the expression contains comma separated subexpressions (i.e. "sin(y), x+y"). - There may be more than one return value. This function returns the number of + /** \brief Return the number of results on the calculation stack. + + If the expression contains comma separated subexpressions (i.e. "sin(y), x+y"). + There may be more than one return value. This function returns the number of available results. */ int ParserBase::GetNumResults() const @@ -1693,11 +1693,11 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Calculate the result. - A note on const correctness: + A note on const correctness: I consider it important that Calc is a const function. Due to caching operations Calc changes only the state of internal variables with one exception m_UsedVar this is reset during string parsing and accessible from the outside. Instead of making - Calc non const GetUsedVar is non const because it explicitly calls Eval() forcing this update. + Calc non const GetUsedVar is non const because it explicitly calls Eval() forcing this update. \pre A formula must be set. \pre Variables must have been set (if needed) @@ -1708,7 +1708,7 @@ namespace mu */ value_type ParserBase::Eval() const { - return (this->*m_pParseFormula)(); + return (this->*m_pParseFormula)(); } //--------------------------------------------------------------------------- @@ -1716,9 +1716,9 @@ namespace mu { /* <ibg 2014-09-24/> Commented because it is making a unit test impossible - // Parallelization does not make sense for fewer than 10000 computations + // Parallelization does not make sense for fewer than 10000 computations // due to thread creation overhead. If the bulk size is below 2000 - // computation is refused. + // computation is refused. if (nBulkSize<2000) { throw ParserError(ecUNREASONABLE_NUMBER_OF_COMPUTATIONS); @@ -1748,8 +1748,8 @@ namespace mu #ifdef DEBUG_OMP_STUFF #pragma omp critical { - pThread[ct] = nThreadID; - pIdx[ct] = i; + pThread[ct] = nThreadID; + pIdx[ct] = i; ct++; } #endif @@ -1761,7 +1761,7 @@ namespace mu { fprintf(pFile, "idx: %d thread: %d \n", pIdx[i], pThread[i]); } - + delete [] pIdx; delete [] pThread; diff --git a/moose-core/external/muparser/src/muParserBytecode.cpp b/moose-core/external/muparser/src/muParserBytecode.cpp index 38ae3f933422c779b66807493c8fdd61b2399e95..f2c4deb0ebb92cf333a1a93c4b700d2a31b63996 100644 --- a/moose-core/external/muparser/src/muParserBytecode.cpp +++ b/moose-core/external/muparser/src/muParserBytecode.cpp @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "muParserBytecode.h" @@ -53,8 +53,8 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Copy constructor. - + /** \brief Copy constructor. + Implemented in Terms of Assign(const ParserByteCode &a_ByteCode) */ ParserByteCode::ParserByteCode(const ParserByteCode &a_ByteCode) @@ -64,7 +64,7 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Assignment operator. - + Implemented in Terms of Assign(const ParserByteCode &a_ByteCode) */ ParserByteCode& ParserByteCode::operator=(const ParserByteCode &a_ByteCode) @@ -80,13 +80,13 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Copy state of another object to this. - + /** \brief Copy state of another object to this. + \throw nowthrow */ void ParserByteCode::Assign(const ParserByteCode &a_ByteCode) { - if (this==&a_ByteCode) + if (this==&a_ByteCode) return; m_iStackPos = a_ByteCode.m_iStackPos; @@ -96,7 +96,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add a Variable pointer to bytecode. + /** \brief Add a Variable pointer to bytecode. \param a_pVar Pointer to be added. \throw nothrow */ @@ -115,7 +115,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add a Variable pointer to bytecode. + /** \brief Add a Variable pointer to bytecode. Value entries in byte code consist of: <ul> @@ -160,18 +160,18 @@ namespace mu case cmADD: x = x + y; m_vRPN.pop_back(); break; case cmSUB: x = x - y; m_vRPN.pop_back(); break; case cmMUL: x = x * y; m_vRPN.pop_back(); break; - case cmDIV: + case cmDIV: #if defined(MUP_MATH_EXCEPTIONS) if (y==0) throw ParserError(ecDIV_BY_ZERO, _T("0")); #endif - x = x / y; + x = x / y; m_vRPN.pop_back(); break; - case cmPOW: x = MathImpl<value_type>::Pow(x, y); + case cmPOW: x = MathImpl<value_type>::Pow(x, y); m_vRPN.pop_back(); break; @@ -181,8 +181,8 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add an operator identifier to bytecode. - + /** \brief Add an operator identifier to bytecode. + Operator entries in byte code consist of: <ul> <li>value array position of the result</li> @@ -200,7 +200,7 @@ namespace mu std::size_t sz = m_vRPN.size(); // Check for foldable constants like: - // cmVAL cmVAL cmADD + // cmVAL cmVAL cmADD // where cmADD can stand fopr any binary operator applied to // two constant values. if (sz>=2 && m_vRPN[sz-2].Cmd == cmVAL && m_vRPN[sz-1].Cmd == cmVAL) @@ -235,7 +235,7 @@ namespace mu // Simple optimization based on pattern recognition for a shitload of different // bytecode combinations of addition/subtraction if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) || - (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) || + (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) || (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL) || (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) || (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) || @@ -244,7 +244,7 @@ namespace mu (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVARMUL && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ) { assert( (m_vRPN[sz-2].Val.ptr==NULL && m_vRPN[sz-1].Val.ptr!=NULL) || - (m_vRPN[sz-2].Val.ptr!=NULL && m_vRPN[sz-1].Val.ptr==NULL) || + (m_vRPN[sz-2].Val.ptr!=NULL && m_vRPN[sz-1].Val.ptr==NULL) || (m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ); m_vRPN[sz-2].Cmd = cmVARMUL; @@ -253,12 +253,12 @@ namespace mu m_vRPN[sz-2].Val.data += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data; // multiplicand m_vRPN.pop_back(); bOptimized = true; - } + } break; case cmMUL: if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) || - (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) ) + (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) ) { m_vRPN[sz-2].Cmd = cmVARMUL; m_vRPN[sz-2].Val.ptr = (value_type*)((long long)(m_vRPN[sz-2].Val.ptr) | (long long)(m_vRPN[sz-1].Val.ptr)); @@ -266,7 +266,7 @@ namespace mu m_vRPN[sz-2].Val.data2 = 0; m_vRPN.pop_back(); bOptimized = true; - } + } else if ( (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL) || (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) ) { @@ -306,7 +306,7 @@ namespace mu bOptimized = true; } break; - + } // switch a_Oprt } } @@ -331,7 +331,7 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Add an assignment operator - + Operator entries in byte code consist of: <ul> <li>cmASSIGN code</li> @@ -351,7 +351,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add function to bytecode. + /** \brief Add function to bytecode. \param a_iArgc Number of arguments, negative numbers indicate multiarg functions. \param a_pFun Pointer to function callback. @@ -360,12 +360,12 @@ namespace mu { if (a_iArgc>=0) { - m_iStackPos = m_iStackPos - a_iArgc + 1; + m_iStackPos = m_iStackPos - a_iArgc + 1; } else { // function with unlimited number of arguments - m_iStackPos = m_iStackPos + a_iArgc + 1; + m_iStackPos = m_iStackPos + a_iArgc + 1; } m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos); @@ -377,14 +377,14 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add a bulk function to bytecode. + /** \brief Add a bulk function to bytecode. \param a_iArgc Number of arguments, negative numbers indicate multiarg functions. \param a_pFun Pointer to function callback. */ void ParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc) { - m_iStackPos = m_iStackPos - a_iArgc + 1; + m_iStackPos = m_iStackPos - a_iArgc + 1; m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos); SToken tok; @@ -395,11 +395,11 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Add Strung function entry to the parser bytecode. + /** \brief Add Strung function entry to the parser bytecode. \throw nothrow A string function entry consists of the stack position of the return value, - followed by a cmSTRFUNC code, the function pointer and an index into the + followed by a cmSTRFUNC code, the function pointer and an index into the string buffer maintained by the parser. */ void ParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx) @@ -418,8 +418,8 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Add end marker to bytecode. - - \throw nothrow + + \throw nothrow */ void ParserByteCode::Finalize() { @@ -444,7 +444,7 @@ namespace mu idx = stIf.pop(); m_vRPN[idx].Oprt.offset = i - idx; break; - + case cmENDIF: idx = stElse.pop(); m_vRPN[idx].Oprt.offset = i - idx; @@ -479,12 +479,12 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Delete the bytecode. - + /** \brief Delete the bytecode. + \throw nothrow The name of this function is a violation of my own coding guidelines - but this way it's more in line with the STL functions thus more + but this way it's more in line with the STL functions thus more intuitive. */ void ParserByteCode::clear() @@ -498,7 +498,7 @@ namespace mu /** \brief Dump bytecode (for debugging only!). */ void ParserByteCode::AsciiDump() { - if (!m_vRPN.size()) + if (!m_vRPN.size()) { mu::console() << _T("No bytecode available\n"); return; @@ -515,30 +515,30 @@ namespace mu break; case cmVAR: mu::console() << _T("VAR \t"); - mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); + mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); break; case cmVARPOW2: mu::console() << _T("VARPOW2 \t"); - mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); + mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); break; case cmVARPOW3: mu::console() << _T("VARPOW3 \t"); - mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); + mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); break; case cmVARPOW4: mu::console() << _T("VARPOW4 \t"); - mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); + mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); break; case cmVARMUL: mu::console() << _T("VARMUL \t"); - mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]"); + mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]"); mu::console() << _T(" * [") << m_vRPN[i].Val.data << _T("]"); mu::console() << _T(" + [") << m_vRPN[i].Val.data2 << _T("]\n"); break; case cmFUNC: mu::console() << _T("CALL\t"); - mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]"); - mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Fun.ptr << _T("]"); + mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]"); + mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Fun.ptr << _T("]"); mu::console() << _T("\n"); break; @@ -546,7 +546,7 @@ namespace mu mu::console() << _T("CALL STRFUNC\t"); mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]"); mu::console() << _T("[IDX:") << std::dec << m_vRPN[i].Fun.idx << _T("]"); - mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Fun.ptr << _T("]\n"); + mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Fun.ptr << _T("]\n"); break; case cmLT: mu::console() << _T("LT\n"); break; @@ -573,12 +573,12 @@ namespace mu case cmENDIF: mu::console() << _T("ENDIF\n"); break; - case cmASSIGN: + case cmASSIGN: mu::console() << _T("ASSIGN\t"); - mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Oprt.ptr << _T("]\n"); - break; + mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Oprt.ptr << _T("]\n"); + break; - default: mu::console() << _T("(unknown code: ") << m_vRPN[i].Cmd << _T(")\n"); + default: mu::console() << _T("(unknown code: ") << m_vRPN[i].Cmd << _T(")\n"); break; } // switch cmdCode } // while bytecode diff --git a/moose-core/external/muparser/src/muParserCallback.cpp b/moose-core/external/muparser/src/muParserCallback.cpp index b6aec1ae037823ae519cbe10469162b0b86d0cd9..b05c881403d6df78af87e0b51d98a11093396d3f 100644 --- a/moose-core/external/muparser/src/muParserCallback.cpp +++ b/moose-core/external/muparser/src/muParserCallback.cpp @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2004-2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "muParserCallback.h" @@ -56,7 +56,7 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Constructor for constructing function callbacks taking two arguments. + /** \brief Constructor for constructing function callbacks taking two arguments. \throw nothrow */ ParserCallback::ParserCallback(fun_type2 a_pFun, bool a_bAllowOpti) @@ -70,16 +70,16 @@ namespace mu {} //--------------------------------------------------------------------------- - /** \brief Constructor for constructing binary operator callbacks. + /** \brief Constructor for constructing binary operator callbacks. \param a_pFun Pointer to a static function taking two arguments \param a_bAllowOpti A flag indicating this function can be optimized \param a_iPrec The operator precedence \param a_eOprtAsct The operators associativity \throw nothrow */ - ParserCallback::ParserCallback(fun_type2 a_pFun, - bool a_bAllowOpti, - int a_iPrec, + ParserCallback::ParserCallback(fun_type2 a_pFun, + bool a_bAllowOpti, + int a_iPrec, EOprtAssociativity a_eOprtAsct) :m_pFun((void*)a_pFun) ,m_iArgc(2) @@ -204,7 +204,7 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Constructor for constructing function callbacks taking two arguments. + /** \brief Constructor for constructing function callbacks taking two arguments. \throw nothrow */ ParserCallback::ParserCallback(bulkfun_type2 a_pFun, bool a_bAllowOpti) @@ -357,7 +357,7 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Default constructor. + /** \brief Default constructor. \throw nothrow */ ParserCallback::ParserCallback() @@ -372,7 +372,7 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Copy constructor. + /** \brief Copy constructor. \throw nothrow */ ParserCallback::ParserCallback(const ParserCallback &ref) @@ -399,52 +399,52 @@ namespace mu Conservative functions return always the same result for the same argument. \throw nothrow */ - bool ParserCallback::IsOptimizable() const - { - return m_bAllowOpti; + bool ParserCallback::IsOptimizable() const + { + return m_bAllowOpti; } //--------------------------------------------------------------------------- - /** \brief Get the callback address for the parser function. - + /** \brief Get the callback address for the parser function. + The type of the address is void. It needs to be recasted according to the argument number to the right type. \throw nothrow \return #pFun */ - void* ParserCallback::GetAddr() const - { - return m_pFun; + void* ParserCallback::GetAddr() const + { + return m_pFun; } //--------------------------------------------------------------------------- /** \brief Return the callback code. */ - ECmdCode ParserCallback::GetCode() const - { - return m_iCode; + ECmdCode ParserCallback::GetCode() const + { + return m_iCode; } - + //--------------------------------------------------------------------------- - ETypeCode ParserCallback::GetType() const - { - return m_iType; + ETypeCode ParserCallback::GetType() const + { + return m_iType; } //--------------------------------------------------------------------------- - /** \brief Return the operator precedence. + /** \brief Return the operator precedence. \throw nothrown Only valid if the callback token is an operator token (binary or infix). */ - int ParserCallback::GetPri() const - { - return m_iPri; + int ParserCallback::GetPri() const + { + return m_iPri; } //--------------------------------------------------------------------------- - /** \brief Return the operators associativity. + /** \brief Return the operators associativity. \throw nothrown Only valid if the callback token is a binary operator token. @@ -456,8 +456,8 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Returns the number of function Arguments. */ - int ParserCallback::GetArgc() const - { - return m_iArgc; + int ParserCallback::GetArgc() const + { + return m_iArgc; } } // namespace mu diff --git a/moose-core/external/muparser/src/muParserDLL.cpp b/moose-core/external/muparser/src/muParserDLL.cpp index a05476655614bdf5ac9388a8dd237b49e9ac3694..d91a1582ab09b47424b107365714425f7e8c7cf1 100644 --- a/moose-core/external/muparser/src/muParserDLL.cpp +++ b/moose-core/external/muparser/src/muParserDLL.cpp @@ -22,7 +22,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#if defined(MUPARSER_DLL) +#if defined(MUPARSER_DLL) #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN diff --git a/moose-core/external/muparser/src/muParserError.cpp b/moose-core/external/muparser/src/muParserError.cpp index 30c46484650ea12b1f47e2069d667722fc0f3523..76a05cc40c9dc64d57ada1d19315bd26cfa85914 100644 --- a/moose-core/external/muparser/src/muParserError.cpp +++ b/moose-core/external/muparser/src/muParserError.cpp @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "muParserError.h" @@ -101,7 +101,7 @@ namespace mu m_vErrMsg[ecMISSING_ELSE_CLAUSE] = _T("If-then-else operator is missing an else clause"); m_vErrMsg[ecMISPLACED_COLON] = _T("Misplaced colon at position $POS$"); m_vErrMsg[ecUNREASONABLE_NUMBER_OF_COMPUTATIONS] = _T("Number of computations to small for bulk mode. (Vectorisation overhead too costly)"); - + #if defined(_DEBUG) for (int i=0; i<ecCOUNT; ++i) if (!m_vErrMsg[i].length()) @@ -127,11 +127,11 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief This Constructor is used for internal exceptions only. - + /** \brief This Constructor is used for internal exceptions only. + It does not contain any information but the error code. */ - ParserError::ParserError(EErrorCodes a_iErrc) + ParserError::ParserError(EErrorCodes a_iErrc) :m_strMsg() ,m_strFormula() ,m_strTok() @@ -148,7 +148,7 @@ namespace mu //------------------------------------------------------------------------------ /** \brief Construct an error from a message text. */ - ParserError::ParserError(const string_type &sMsg) + ParserError::ParserError(const string_type &sMsg) :m_ErrMsg(ParserErrorMsg::Instance()) { Reset(); @@ -156,11 +156,11 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Construct an error object. + /** \brief Construct an error object. \param [in] a_iErrc the error code. \param [in] sTok The token string related to this error. \param [in] sExpr The expression related to the error. - \param [in] a_iPos the position in the expression where the error occurred. + \param [in] a_iPos the position in the expression where the error occurred. */ ParserError::ParserError( EErrorCodes iErrc, const string_type &sTok, @@ -181,12 +181,12 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Construct an error object. + /** \brief Construct an error object. \param [in] iErrc the error code. - \param [in] iPos the position in the expression where the error occurred. + \param [in] iPos the position in the expression where the error occurred. \param [in] sTok The token string related to this error. */ - ParserError::ParserError(EErrorCodes iErrc, int iPos, const string_type &sTok) + ParserError::ParserError(EErrorCodes iErrc, int iPos, const string_type &sTok) :m_strMsg() ,m_strFormula() ,m_strTok(sTok) @@ -202,12 +202,12 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Construct an error object. + /** \brief Construct an error object. \param [in] szMsg The error message text. \param [in] iPos the position related to the error. \param [in] sTok The token string related to this error. */ - ParserError::ParserError(const char_type *szMsg, int iPos, const string_type &sTok) + ParserError::ParserError(const char_type *szMsg, int iPos, const string_type &sTok) :m_strMsg(szMsg) ,m_strFormula() ,m_strTok(sTok) @@ -253,7 +253,7 @@ namespace mu {} //------------------------------------------------------------------------------ - /** \brief Replace all occurrences of a substring with another string. + /** \brief Replace all occurrences of a substring with another string. \param strFind The string that shall be replaced. \param strReplaceWith The string that should be inserted instead of strFind */ @@ -274,7 +274,7 @@ namespace mu strResult.append(strReplaceWith); iPos = iNext + strFind.length(); - } + } strSource.swap(strResult); } @@ -289,7 +289,7 @@ namespace mu m_iPos = -1; m_iErrc = ecUNDEFINED; } - + //------------------------------------------------------------------------------ /** \brief Set the expression related to this error. */ void ParserError::SetFormula(const string_type &a_strFormula) @@ -299,7 +299,7 @@ namespace mu //------------------------------------------------------------------------------ /** \brief gets the expression related tp this error.*/ - const string_type& ParserError::GetExpr() const + const string_type& ParserError::GetExpr() const { return m_strFormula; } @@ -312,7 +312,7 @@ namespace mu } //------------------------------------------------------------------------------ - /** \brief Return the formula position related to the error. + /** \brief Return the formula position related to the error. If the error is not related to a distinct position this will return -1 */ diff --git a/moose-core/external/muparser/src/muParserInt.cpp b/moose-core/external/muparser/src/muParserInt.cpp index 64a29ad9414071e580d49bb63c604bc2bd223cc8..c268056ce4c4bc2c7158b9e6671e9bcba117cd3e 100644 --- a/moose-core/external/muparser/src/muParserInt.cpp +++ b/moose-core/external/muparser/src/muParserInt.cpp @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2011 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "muParserInt.h" @@ -40,8 +40,8 @@ namespace mu { value_type ParserInt::Abs(value_type v) { return (value_type)Round(fabs((double)v)); } value_type ParserInt::Sign(value_type v) { return (Round(v)<0) ? -1 : (Round(v)>0) ? 1 : 0; } -value_type ParserInt::Ite(value_type v1, - value_type v2, +value_type ParserInt::Ite(value_type v1, + value_type v2, value_type v3) { return (Round(v1)==1) ? Round(v2) : Round(v3); } value_type ParserInt::Add(value_type v1, value_type v2) { return Round(v1) + Round(v2); } value_type ParserInt::Sub(value_type v1, value_type v2) { return Round(v1) - Round(v2); } @@ -62,26 +62,26 @@ value_type ParserInt::Equal(value_type v1, value_type v2) { return Round(v1) value_type ParserInt::NotEqual(value_type v1, value_type v2) { return Round(v1) != Round(v2); } value_type ParserInt::Not(value_type v) { return !Round(v); } -value_type ParserInt::Pow(value_type v1, value_type v2) -{ - return std::pow((double)Round(v1), (double)Round(v2)); +value_type ParserInt::Pow(value_type v1, value_type v2) +{ + return std::pow((double)Round(v1), (double)Round(v2)); } //--------------------------------------------------------------------------- // Unary operator Callbacks: Infix operators -value_type ParserInt::UnaryMinus(value_type v) -{ - return -Round(v); +value_type ParserInt::UnaryMinus(value_type v) +{ + return -Round(v); } //--------------------------------------------------------------------------- value_type ParserInt::Sum(const value_type* a_afArg, int a_iArgc) -{ - if (!a_iArgc) +{ + if (!a_iArgc) throw ParserError(_T("too few arguments for function sum.")); value_type fRes=0; - for (int i=0; i<a_iArgc; ++i) + for (int i=0; i<a_iArgc; ++i) fRes += a_afArg[i]; return fRes; @@ -89,12 +89,12 @@ value_type ParserInt::Sum(const value_type* a_afArg, int a_iArgc) //--------------------------------------------------------------------------- value_type ParserInt::Min(const value_type* a_afArg, int a_iArgc) -{ - if (!a_iArgc) +{ + if (!a_iArgc) throw ParserError( _T("too few arguments for function min.") ); value_type fRes=a_afArg[0]; - for (int i=0; i<a_iArgc; ++i) + for (int i=0; i<a_iArgc; ++i) fRes = std::min(fRes, a_afArg[i]); return fRes; @@ -102,12 +102,12 @@ value_type ParserInt::Min(const value_type* a_afArg, int a_iArgc) //--------------------------------------------------------------------------- value_type ParserInt::Max(const value_type* a_afArg, int a_iArgc) -{ - if (!a_iArgc) +{ + if (!a_iArgc) throw ParserError(_T("too few arguments for function min.")); value_type fRes=a_afArg[0]; - for (int i=0; i<a_iArgc; ++i) + for (int i=0; i<a_iArgc; ++i) fRes = std::max(fRes, a_afArg[i]); return fRes; @@ -129,10 +129,10 @@ int ParserInt::IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) stream >> iVal; if (stream.fail()) return 0; - + stringstream_type::pos_type iEnd = stream.tellg(); // Position after reading if (stream.fail()) - iEnd = stream.str().length(); + iEnd = stream.str().length(); if (iEnd==(stringstream_type::pos_type)-1) return 0; @@ -143,10 +143,10 @@ int ParserInt::IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) } //--------------------------------------------------------------------------- -/** \brief Check a given position in the expression for the presence of - a hex value. +/** \brief Check a given position in the expression for the presence of + a hex value. \param a_szExpr Pointer to the expression string - \param [in/out] a_iPos Pointer to an integer value holding the current parsing + \param [in/out] a_iPos Pointer to an integer value holding the current parsing position in the expression. \param [out] a_fVal Pointer to the position where the detected value shall be stored. @@ -154,7 +154,7 @@ int ParserInt::IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) */ int ParserInt::IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) { - if (a_szExpr[1]==0 || (a_szExpr[0]!='0' || a_szExpr[1]!='x') ) + if (a_szExpr[1]==0 || (a_szExpr[0]!='0' || a_szExpr[1]!='x') ) return 0; unsigned iVal(0); @@ -176,17 +176,17 @@ int ParserInt::IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fV //--------------------------------------------------------------------------- int ParserInt::IsBinVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) { - if (a_szExpr[0]!='#') + if (a_szExpr[0]!='#') return 0; - unsigned iVal(0), + unsigned iVal(0), iBits(sizeof(iVal)*8), i(0); for (i=0; (a_szExpr[i+1]=='0' || a_szExpr[i+1]=='1') && i<iBits; ++i) iVal |= (int)(a_szExpr[i+1]=='1') << ((iBits-1)-i); - if (i==0) + if (i==0) return 0; if (i==iBits) @@ -199,7 +199,7 @@ int ParserInt::IsBinVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fV } //--------------------------------------------------------------------------- -/** \brief Constructor. +/** \brief Constructor. Call ParserBase class constructor and trigger Function, Operator and Constant initialization. */ diff --git a/moose-core/external/muparser/src/muParserTest.cpp b/moose-core/external/muparser/src/muParserTest.cpp index aa8ef43e855b33b19bd6e957e56184e6775f0ac4..c03624e89de990f43b0f65332ff2bcd7f65d0330 100644 --- a/moose-core/external/muparser/src/muParserTest.cpp +++ b/moose-core/external/muparser/src/muParserTest.cpp @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "muParserTest.h" @@ -69,7 +69,7 @@ namespace mu //--------------------------------------------------------------------------------------------- int ParserTester::IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) { - if (a_szExpr[1]==0 || (a_szExpr[0]!='0' || a_szExpr[1]!='x') ) + if (a_szExpr[1]==0 || (a_szExpr[0]!='0' || a_szExpr[1]!='x') ) return 0; unsigned iVal(0); @@ -93,11 +93,11 @@ namespace mu { int iStat = 0; mu::console() << _T("testing member functions..."); - + // Test RemoveVar value_type afVal[3] = {1,2,3}; Parser p; - + try { p.DefineVar( _T("a"), &afVal[0]); @@ -108,7 +108,7 @@ namespace mu } catch(...) { - iStat += 1; // this is not supposed to happen + iStat += 1; // this is not supposed to happen } try @@ -122,9 +122,9 @@ namespace mu // failure is expected... } - if (iStat==0) + if (iStat==0) mu::console() << _T("passed") << endl; - else + else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; return iStat; @@ -135,7 +135,7 @@ namespace mu { int iStat = 0; mu::console() << _T("testing string arguments..."); - + iStat += EqnTest(_T("valueof(\"\")"), 123, true); // empty string arguments caused a crash iStat += EqnTest(_T("valueof(\"aaa\")+valueof(\"bbb\") "), 246, true); iStat += EqnTest(_T("2*(valueof(\"aaa\")-23)+valueof(\"bbb\")"), 323, true); @@ -151,7 +151,7 @@ namespace mu if (iStat==0) mu::console() << _T("passed") << endl; - else + else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; return iStat; @@ -196,7 +196,7 @@ namespace mu { int iStat = 0; mu::console() << _T("testing binary operators..."); - + // built in operators // xor operator @@ -219,20 +219,20 @@ namespace mu iStat += EqnTest(_T("a>=b"), 0, true); // Test logical operators, especially if user defined "&" and the internal "&&" collide - iStat += EqnTest(_T("1 && 1"), 1, true); - iStat += EqnTest(_T("1 && 0"), 0, true); - iStat += EqnTest(_T("(a<b) && (b>a)"), 1, true); - iStat += EqnTest(_T("(a<b) && (a>b)"), 0, true); - //iStat += EqnTest(_T("12 and 255"), 12, true); - //iStat += EqnTest(_T("12 and 0"), 0, true); - iStat += EqnTest(_T("12 & 255"), 12, true); - iStat += EqnTest(_T("12 & 0"), 0, true); - iStat += EqnTest(_T("12&255"), 12, true); - iStat += EqnTest(_T("12&0"), 0, true); + iStat += EqnTest(_T("1 && 1"), 1, true); + iStat += EqnTest(_T("1 && 0"), 0, true); + iStat += EqnTest(_T("(a<b) && (b>a)"), 1, true); + iStat += EqnTest(_T("(a<b) && (a>b)"), 0, true); + //iStat += EqnTest(_T("12 and 255"), 12, true); + //iStat += EqnTest(_T("12 and 0"), 0, true); + iStat += EqnTest(_T("12 & 255"), 12, true); + iStat += EqnTest(_T("12 & 0"), 0, true); + iStat += EqnTest(_T("12&255"), 12, true); + iStat += EqnTest(_T("12&0"), 0, true); // Assignment operator - iStat += EqnTest(_T("a = b"), 2, true); - iStat += EqnTest(_T("a = sin(b)"), 0.909297, true); + iStat += EqnTest(_T("a = b"), 2, true); + iStat += EqnTest(_T("a = sin(b)"), 0.909297, true); iStat += EqnTest(_T("a = 1+sin(b)"), 1.909297, true); iStat += EqnTest(_T("(a=b)*2"), 4, true); iStat += EqnTest(_T("2*(a=b)"), 4, true); @@ -240,23 +240,23 @@ namespace mu iStat += EqnTest(_T("(a=b+1)*2"), 6, true); iStat += EqnTest(_T("a=c, a*10"), 30, true); - iStat += EqnTest(_T("2^2^3"), 256, true); - iStat += EqnTest(_T("1/2/3"), 1.0/6.0, true); + iStat += EqnTest(_T("2^2^3"), 256, true); + iStat += EqnTest(_T("1/2/3"), 1.0/6.0, true); // reference: http://www.wolframalpha.com/input/?i=3%2B4*2%2F%281-5%29^2^3 - iStat += EqnTest(_T("3+4*2/(1-5)^2^3"), 3.0001220703125, true); + iStat += EqnTest(_T("3+4*2/(1-5)^2^3"), 3.0001220703125, true); // Test user defined binary operators - iStat += EqnTestInt(_T("1 | 2"), 3, true); - iStat += EqnTestInt(_T("1 || 2"), 1, true); - iStat += EqnTestInt(_T("123 & 456"), 72, true); + iStat += EqnTestInt(_T("1 | 2"), 3, true); + iStat += EqnTestInt(_T("1 || 2"), 1, true); + iStat += EqnTestInt(_T("123 & 456"), 72, true); iStat += EqnTestInt(_T("(123 & 456) % 10"), 2, true); - iStat += EqnTestInt(_T("1 && 0"), 0, true); - iStat += EqnTestInt(_T("123 && 456"), 1, true); - iStat += EqnTestInt(_T("1 << 3"), 8, true); - iStat += EqnTestInt(_T("8 >> 3"), 1, true); - iStat += EqnTestInt(_T("9 / 4"), 2, true); - iStat += EqnTestInt(_T("9 % 4"), 1, true); + iStat += EqnTestInt(_T("1 && 0"), 0, true); + iStat += EqnTestInt(_T("123 && 456"), 1, true); + iStat += EqnTestInt(_T("1 << 3"), 8, true); + iStat += EqnTestInt(_T("8 >> 3"), 1, true); + iStat += EqnTestInt(_T("9 / 4"), 2, true); + iStat += EqnTestInt(_T("9 % 4"), 1, true); iStat += EqnTestInt(_T("if(5%2,1,0)"), 1, true); iStat += EqnTestInt(_T("if(4%2,1,0)"), 0, true); iStat += EqnTestInt(_T("-10+1"), -9, true); @@ -303,7 +303,7 @@ namespace mu // incorrect: '^' is yor here, not power // iStat += EqnTestInt("-(1+2)^2", -9, true); -// iStat += EqnTestInt("-1^3", -1, true); +// iStat += EqnTestInt("-1^3", -1, true); // Test precedence // a=1, b=2, c=3 @@ -316,12 +316,12 @@ namespace mu iStat += EqnTestInt(_T("a << b + c"), 7, true); iStat += EqnTestInt(_T("c * b < a"), 0, true); iStat += EqnTestInt(_T("c * b == 6 * a"), 1, true); - iStat += EqnTestInt(_T("2^2^3"), 256, true); + iStat += EqnTestInt(_T("2^2^3"), 256, true); if (iStat==0) mu::console() << _T("passed") << endl; - else + else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; return iStat; @@ -335,7 +335,7 @@ namespace mu iErr = 0; mu::console() << "testing name restriction enforcement..."; - + Parser p; #define PARSER_THROWCHECK(DOMAIN, FAIL, EXPR, ARG) \ @@ -349,8 +349,8 @@ namespace mu { \ iErr = (FAIL==false) ? 0 : 1; \ } \ - iStat += iErr; - + iStat += iErr; + // constant names PARSER_THROWCHECK(Const, false, _T("0a"), 1) PARSER_THROWCHECK(Const, false, _T("9a"), 1) @@ -428,9 +428,9 @@ namespace mu PARSER_THROWCHECK(Oprt, true, _T("||"), f1of2) #undef PARSER_THROWCHECK - if (iStat==0) + if (iStat==0) mu::console() << _T("passed") << endl; - else + else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; return iStat; @@ -455,7 +455,7 @@ namespace mu iStat += EqnTest(_T("sqrt(a+(3))"), 2, true);// Multiple brackets iStat += EqnTest(_T("sqrt((3)+a)"), 2, true);// Multiple brackets iStat += EqnTest(_T("order(1,2)"), 1, true); // May not cause name collision with operator "or" - iStat += EqnTest(_T("(2+"), 0, false); // missing closing bracket + iStat += EqnTest(_T("(2+"), 0, false); // missing closing bracket iStat += EqnTest(_T("2++4"), 0, false); // unexpected operator iStat += EqnTest(_T("2+-4"), 0, false); // unexpected operator iStat += EqnTest(_T("(2+)"), 0, false); // unexpected closing bracket @@ -479,7 +479,7 @@ namespace mu if (iStat==0) mu::console() << _T("passed") << endl; - else + else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; return iStat; @@ -538,10 +538,10 @@ namespace mu p.SetExpr( _T("a+b+c+d") ); mu::varmap_type UsedVar = p.GetUsedVar(); int iCount = (int)UsedVar.size(); - if (iCount!=4) + if (iCount!=4) throw false; - - // the next check will fail if the parser + + // the next check will fail if the parser // erroneously creates new variables internally if (p.GetVar().size()!=5) throw false; @@ -549,7 +549,7 @@ namespace mu mu::varmap_type::const_iterator item = UsedVar.begin(); for (idx=0; item!=UsedVar.end(); ++item) { - if (&vVarVal[idx++]!=item->second) + if (&vVarVal[idx++]!=item->second) throw false; } @@ -557,17 +557,17 @@ namespace mu p.SetExpr( _T("undef1+undef2+undef3") ); UsedVar = p.GetUsedVar(); iCount = (int)UsedVar.size(); - if (iCount!=3) + if (iCount!=3) throw false; - // the next check will fail if the parser + // the next check will fail if the parser // erroneously creates new variables internally if (p.GetVar().size()!=5) throw false; for (item = UsedVar.begin(); item!=UsedVar.end(); ++item) { - if (item->second!=0) + if (item->second!=0) throw false; // all pointers to undefined variables must be null } @@ -586,7 +586,7 @@ namespace mu iStat += 1; } - if (iStat==0) + if (iStat==0) mu::console() << _T("passed") << endl; else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; @@ -599,7 +599,7 @@ namespace mu { int iStat = 0; mu::console() << _T("testing multiarg functions..."); - + // Compound expressions iStat += EqnTest( _T("1,2,3"), 3, true); iStat += EqnTest( _T("a,b,c"), 3, true); @@ -646,7 +646,7 @@ namespace mu iStat += EqnTest( _T("1,2,3"), 0, false); iStat += EqnTest( _T("(1*a,2,3)"), 0, false); iStat += EqnTest( _T("1,2*a,3"), 0, false); - + // correct calculation of arguments iStat += EqnTest( _T("min(a, 1)"), 1, true); iStat += EqnTest( _T("min(3*2, 1)"), 1, true); @@ -680,11 +680,11 @@ namespace mu iStat += EqnTest( _T("sum(1,2,)"), 0, false); iStat += EqnTest( _T("sum(,1,2)"), 0, false); - if (iStat==0) + if (iStat==0) mu::console() << _T("passed") << endl; else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; - + return iStat; } @@ -784,7 +784,7 @@ namespace mu iStat += EqnTest( _T("2+(a*1000){m}"), 3, true); // can postfix operators "m" und "meg" be told apart properly? - iStat += EqnTest( _T("2*3000meg+2"), 2*3e9+2, true); + iStat += EqnTest( _T("2*3000meg+2"), 2*3e9+2, true); // some incorrect results iStat += EqnTest( _T("1000{m}"), 0.1, false); @@ -801,7 +801,7 @@ namespace mu iStat += ThrowTest( _T("-{m}"), ecUNASSIGNABLE_TOKEN); iStat += ThrowTest( _T("2(-{m})"), ecUNEXPECTED_PARENS); iStat += ThrowTest( _T("2({m})"), ecUNEXPECTED_PARENS); - + iStat += ThrowTest( _T("multi*1.0"), ecUNASSIGNABLE_TOKEN); if (iStat==0) @@ -825,7 +825,7 @@ namespace mu iStat += EqnTest( _T("2*b*5 + 4*b"), 28, true); iStat += EqnTest( _T("2*a/3"), 2.0/3.0, true); - // Addition auf cmVARMUL + // Addition auf cmVARMUL iStat += EqnTest( _T("3+b"), b+3, true); iStat += EqnTest( _T("b+3"), b+3, true); iStat += EqnTest( _T("b*3+2"), b*3+2, true); @@ -883,10 +883,10 @@ namespace mu // long formula (Reference: Matlab) iStat += EqnTest( _T("1+2-3*4/5^6*(2*(1-5+(3*7^9)*(4+6*7-3)))+12"), -7995810.09926, true); - - if (iStat==0) - mu::console() << _T("passed") << endl; - else + + if (iStat==0) + mu::console() << _T("passed") << endl; + else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; return iStat; @@ -901,16 +901,16 @@ namespace mu mu::console() << _T("testing if-then-else operator..."); // Test error detection - iStat += ThrowTest(_T(":3"), ecUNEXPECTED_CONDITIONAL); - iStat += ThrowTest(_T("? 1 : 2"), ecUNEXPECTED_CONDITIONAL); - iStat += ThrowTest(_T("(a<b) ? (b<c) ? 1 : 2"), ecMISSING_ELSE_CLAUSE); - iStat += ThrowTest(_T("(a<b) ? 1"), ecMISSING_ELSE_CLAUSE); - iStat += ThrowTest(_T("(a<b) ? a"), ecMISSING_ELSE_CLAUSE); - iStat += ThrowTest(_T("(a<b) ? a+b"), ecMISSING_ELSE_CLAUSE); - iStat += ThrowTest(_T("a : b"), ecMISPLACED_COLON); - iStat += ThrowTest(_T("1 : 2"), ecMISPLACED_COLON); - iStat += ThrowTest(_T("(1) ? 1 : 2 : 3"), ecMISPLACED_COLON); - iStat += ThrowTest(_T("(true) ? 1 : 2 : 3"), ecUNASSIGNABLE_TOKEN); + iStat += ThrowTest(_T(":3"), ecUNEXPECTED_CONDITIONAL); + iStat += ThrowTest(_T("? 1 : 2"), ecUNEXPECTED_CONDITIONAL); + iStat += ThrowTest(_T("(a<b) ? (b<c) ? 1 : 2"), ecMISSING_ELSE_CLAUSE); + iStat += ThrowTest(_T("(a<b) ? 1"), ecMISSING_ELSE_CLAUSE); + iStat += ThrowTest(_T("(a<b) ? a"), ecMISSING_ELSE_CLAUSE); + iStat += ThrowTest(_T("(a<b) ? a+b"), ecMISSING_ELSE_CLAUSE); + iStat += ThrowTest(_T("a : b"), ecMISPLACED_COLON); + iStat += ThrowTest(_T("1 : 2"), ecMISPLACED_COLON); + iStat += ThrowTest(_T("(1) ? 1 : 2 : 3"), ecMISPLACED_COLON); + iStat += ThrowTest(_T("(true) ? 1 : 2 : 3"), ecUNASSIGNABLE_TOKEN); iStat += EqnTest(_T("1 ? 128 : 255"), 128, true); iStat += EqnTest(_T("1<2 ? 128 : 255"), 128, true); @@ -981,7 +981,7 @@ namespace mu iStat += EqnTest(_T("1?a=10:a=20, a"), 10, true); iStat += EqnTest(_T("0?a=10:a=20, a"), 20, true); iStat += EqnTest(_T("0?a=sum(3,4):10, a"), 1, true); // a should not change its value due to lazy calculation - + iStat += EqnTest(_T("a=1?b=1?3:4:5, a"), 3, true); iStat += EqnTest(_T("a=1?b=1?3:4:5, b"), 3, true); iStat += EqnTest(_T("a=0?b=1?3:4:5, a"), 5, true); @@ -992,9 +992,9 @@ namespace mu iStat += EqnTest(_T("a=0?5:b=1?3:4, a"), 3, true); iStat += EqnTest(_T("a=0?5:b=1?3:4, b"), 3, true); - if (iStat==0) - mu::console() << _T("passed") << endl; - else + if (iStat==0) + mu::console() << _T("passed") << endl; + else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; return iStat; @@ -1018,7 +1018,7 @@ namespace mu iStat += ThrowTest(_T("sin(3)cos(3)"), ecUNEXPECTED_FUN); iStat += ThrowTest(_T("a+b+c=10"), ecUNEXPECTED_OPERATOR); iStat += ThrowTest(_T("a=b=3"), ecUNEXPECTED_OPERATOR); - + #if defined(MUP_MATH_EXCEPTIONS) // divide by zero whilst constant folding iStat += ThrowTest(_T("1/0"), ecDIV_BY_ZERO); @@ -1079,16 +1079,16 @@ namespace mu // <ibg 20090529> // this is now legal, for reference see: // https://sourceforge.net/forum/message.php?msg_id=7411373 - // iStat += ThrowTest( _T("sin=9"), ecUNEXPECTED_OPERATOR); + // iStat += ThrowTest( _T("sin=9"), ecUNEXPECTED_OPERATOR); // </ibg> iStat += ThrowTest( _T("(8)=5"), ecUNEXPECTED_OPERATOR); iStat += ThrowTest( _T("(a)=5"), ecUNEXPECTED_OPERATOR); iStat += ThrowTest( _T("a=\"tttt\""), ecOPRT_TYPE_CONFLICT); - if (iStat==0) + if (iStat==0) mu::console() << _T("passed") << endl; - else + else mu::console() << _T("\n failed with ") << iStat << _T(" errors") << endl; return iStat; @@ -1127,14 +1127,14 @@ namespace mu Abort(); } - if (iStat==0) + if (iStat==0) { mu::console() << "Test passed (" << ParserTester::c_iCount << " expressions)" << endl; } - else + else { - mu::console() << "Test failed with " << iStat - << " errors (" << ParserTester::c_iCount + mu::console() << "Test failed with " << iStat + << " errors (" << ParserTester::c_iCount << " expressions)" << endl; } ParserTester::c_iCount = 0; @@ -1169,8 +1169,8 @@ namespace mu // output the formula in case of an failed test if (a_bFail==false || (a_bFail==true && a_iErrc!=e.GetCode()) ) { - mu::console() << _T("\n ") - << _T("Expression: ") << a_str + mu::console() << _T("\n ") + << _T("Expression: ") << a_str << _T(" Code:") << e.GetCode() << _T("(") << e.GetMsg() << _T(")") << _T(" Expected:") << a_iErrc; } @@ -1182,23 +1182,23 @@ namespace mu bool bRet((a_bFail==false) ? 0 : 1); if (bRet==1) { - mu::console() << _T("\n ") - << _T("Expression: ") << a_str + mu::console() << _T("\n ") + << _T("Expression: ") << a_str << _T(" did evaluate; Expected error:") << a_iErrc; } - return bRet; + return bRet; } //--------------------------------------------------------------------------- - /** \brief Evaluate a tet expression. + /** \brief Evaluate a tet expression. \return 1 in case of a failure, 0 otherwise. */ - int ParserTester::EqnTestWithVarChange(const string_type &a_str, - double a_fVar1, - double a_fRes1, - double a_fVar2, + int ParserTester::EqnTestWithVarChange(const string_type &a_str, + double a_fVar1, + double a_fRes1, + double a_fVar2, double a_fRes2) { ParserTester::c_iCount++; @@ -1206,7 +1206,7 @@ namespace mu try { value_type fVal[2] = {-999, -999 }; // should be equal - + Parser p; value_type var = 0; @@ -1219,7 +1219,7 @@ namespace mu var = a_fVar2; fVal[1] = p.Eval(); - + if ( fabs(a_fRes1-fVal[0]) > 0.0000000001) throw std::runtime_error("incorrect result (first pass)"); @@ -1246,7 +1246,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Evaluate a tet expression. + /** \brief Evaluate a tet expression. \return 1 in case of a failure, 0 otherwise. */ @@ -1264,8 +1264,8 @@ namespace mu // p1 is a pointer since i'm going to delete it in order to test if // parsers after copy construction still refer to members of it. // !! If this is the case this function will crash !! - - p1.reset(new mu::Parser()); + + p1.reset(new mu::Parser()); // Add constants p1->DefineConst( _T("pi"), (value_type)PARSER_CONST_PI); p1->DefineConst( _T("e"), (value_type)PARSER_CONST_E); @@ -1282,9 +1282,9 @@ namespace mu p1->DefineVar( _T("b"), &vVarVal[1]); p1->DefineVar( _T("c"), &vVarVal[2]); p1->DefineVar( _T("d"), &vVarVal[3]); - + // custom value ident functions - p1->AddValIdent(&ParserTester::IsHexVal); + p1->AddValIdent(&ParserTester::IsHexVal); // functions p1->DefineFun( _T("ping"), Ping); @@ -1323,7 +1323,7 @@ namespace mu p1->DefineFun( _T("order"), FirstArg); // infix / postfix operator - // Note: Identifiers used here do not have any meaning + // Note: Identifiers used here do not have any meaning // they are mere placeholders to test certain features. p1->DefineInfixOprt( _T("$"), sign, prPOW+1); // sign with high priority p1->DefineInfixOprt( _T("~"), plus2); // high priority @@ -1333,7 +1333,7 @@ namespace mu p1->DefinePostfixOprt( _T("m"), Milli); p1->DefinePostfixOprt( _T("meg"), Mega); p1->DefinePostfixOprt( _T("#"), times3); - p1->DefinePostfixOprt( _T("'"), sqr); + p1->DefinePostfixOprt( _T("'"), sqr); p1->SetExpr(a_str); // Test bytecode integrity @@ -1350,7 +1350,7 @@ namespace mu std::vector<mu::Parser> vParser; vParser.push_back(*(p1.get())); mu::Parser p2 = vParser[0]; // take parser from vector - + // destroy the originals from p2 vParser.clear(); // delete the vector p1.reset(0); @@ -1394,13 +1394,13 @@ namespace mu } iRet = ((bCloseEnough && a_fPass) || (!bCloseEnough && !a_fPass)) ? 0 : 1; - - + + if (iRet==1) { - mu::console() << _T("\n fail: ") << a_str.c_str() + mu::console() << _T("\n fail: ") << a_str.c_str() << _T(" (incorrect result; expected: ") << a_fRes - << _T(" ;calculated: ") << fVal[0] << _T(",") + << _T(" ;calculated: ") << fVal[0] << _T(",") << fVal[1] << _T(",") << fVal[2] << _T(",") << fVal[3] << _T(",") @@ -1457,12 +1457,12 @@ namespace mu if (fVal[0]!=fVal[1]) throw Parser::exception_type( _T("Bytecode corrupt.") ); - iRet = ( (a_fRes==fVal[0] && a_fPass) || + iRet = ( (a_fRes==fVal[0] && a_fPass) || (a_fRes!=fVal[0] && !a_fPass) ) ? 0 : 1; if (iRet==1) { - mu::console() << _T("\n fail: ") << a_str.c_str() - << _T(" (incorrect result; expected: ") << a_fRes + mu::console() << _T("\n fail: ") << a_str.c_str() + << _T(" (incorrect result; expected: ") << a_fRes << _T(" ;calculated: ") << fVal[0]<< _T(")."); } } diff --git a/moose-core/external/muparser/src/muParserTokenReader.cpp b/moose-core/external/muparser/src/muParserTokenReader.cpp index e625261125eaf23bff56397fbcf72a7043b5796f..576c851054274681a09c98f5e6bef0834bceac61 100644 --- a/moose-core/external/muparser/src/muParserTokenReader.cpp +++ b/moose-core/external/muparser/src/muParserTokenReader.cpp @@ -1,26 +1,26 @@ /* - __________ - _____ __ __\______ \_____ _______ ______ ____ _______ + __________ + _____ __ __\______ \_____ _______ ______ ____ _______ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ - |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| - \/ \/ \/ \/ + |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| + \/ \/ \/ \/ Copyright (C) 2013 Ingo Berg - Permission is hereby granted, free of charge, to any person obtaining a copy of this + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <cassert> #include <cstdio> @@ -49,11 +49,11 @@ namespace mu \sa Assign \throw nothrow */ - ParserTokenReader::ParserTokenReader(const ParserTokenReader &a_Reader) - { + ParserTokenReader::ParserTokenReader(const ParserTokenReader &a_Reader) + { Assign(a_Reader); } - + //--------------------------------------------------------------------------- /** \brief Assignment operator. @@ -62,7 +62,7 @@ namespace mu \param a_Reader Object to copy to this token reader. \throw nothrow */ - ParserTokenReader& ParserTokenReader::operator=(const ParserTokenReader &a_Reader) + ParserTokenReader& ParserTokenReader::operator=(const ParserTokenReader &a_Reader) { if (&a_Reader!=this) Assign(a_Reader); @@ -71,8 +71,8 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Assign state of a token reader to this token reader. - + /** \brief Assign state of a token reader to this token reader. + \param a_Reader Object from which the state should be copied. \throw nothrow */ @@ -82,7 +82,7 @@ namespace mu m_strFormula = a_Reader.m_strFormula; m_iPos = a_Reader.m_iPos; m_iSynFlags = a_Reader.m_iSynFlags; - + m_UsedVar = a_Reader.m_UsedVar; m_pFunDef = a_Reader.m_pFunDef; m_pConstDef = a_Reader.m_pConstDef; @@ -102,9 +102,9 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Constructor. - - Create a Token reader and bind it to a parser object. + /** \brief Constructor. + + Create a Token reader and bind it to a parser object. \pre [assert] a_pParser may not be NULL \post #m_pParser==a_pParser @@ -135,10 +135,10 @@ namespace mu assert(m_pParser); SetParent(m_pParser); } - + //--------------------------------------------------------------------------- - /** \brief Create instance of a ParserTokenReader identical with this - and return its pointer. + /** \brief Create instance of a ParserTokenReader identical with this + and return its pointer. This is a factory method the calling function must take care of the object destruction. @@ -174,7 +174,7 @@ namespace mu { // Use push_front is used to give user defined callbacks a higher priority than // the built in ones. Otherwise reading hex numbers would not work - // since the "0" in "0xff" would always be read first making parsing of + // since the "0" in "0xff" would always be read first making parsing of // the rest impossible. // reference: // http://sourceforge.net/projects/muparser/forums/forum/462843/topic/4824956 @@ -189,7 +189,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Return the current position of the token reader in the formula string. + /** \brief Return the current position of the token reader in the formula string. \return #m_iPos \throw nothrow @@ -200,7 +200,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Return a reference to the formula. + /** \brief Return a reference to the formula. \return #m_strFormula \throw nothrow @@ -212,14 +212,14 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Return a map containing the used variables only. */ - varmap_type& ParserTokenReader::GetUsedVar() + varmap_type& ParserTokenReader::GetUsedVar() { return m_UsedVar; } //--------------------------------------------------------------------------- - /** \brief Initialize the token Reader. - + /** \brief Initialize the token Reader. + Sets the formula position index to zero and set Syntax flags to default for initial formula parsing. \pre [assert] triggered if a_szFormula==0 */ @@ -230,12 +230,12 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Set Flag that controls behaviour in case of undefined variables being found. - - If true, the parser does not throw an exception if an undefined variable is found. + /** \brief Set Flag that controls behaviour in case of undefined variables being found. + + If true, the parser does not throw an exception if an undefined variable is found. otherwise it does. This variable is used internally only! - It suppresses a "undefined variable" exception in GetUsedVar(). - Those function should return a complete list of variables including + It suppresses a "undefined variable" exception in GetUsedVar(). + Those function should return a complete list of variables including those the are not defined by the time of it's call. */ void ParserTokenReader::IgnoreUndefVar(bool bIgnore) @@ -244,9 +244,9 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Reset the token reader to the start of the formula. + /** \brief Reset the token reader to the start of the formula. - The syntax flags will be reset to a value appropriate for the + The syntax flags will be reset to a value appropriate for the start of a formula. \post #m_iPos==0, #m_iSynFlags = noOPT | noBC | noPOSTOP | noSTR \throw nothrow @@ -262,7 +262,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Read the next token from the string. */ + /** \brief Read the next token from the string. */ ParserTokenReader::token_type ParserTokenReader::ReadNextToken() { assert(m_pParser); @@ -271,7 +271,7 @@ namespace mu token_type tok; // Ignore all non printable characters when reading the expression - while (szFormula[m_iPos]>0 && szFormula[m_iPos]<=0x20) + while (szFormula[m_iPos]>0 && szFormula[m_iPos]<=0x20) ++m_iPos; if ( IsEOF(tok) ) return SaveBeforeReturn(tok); // Check for end of formula @@ -286,20 +286,20 @@ namespace mu if ( IsInfixOpTok(tok) ) return SaveBeforeReturn(tok); // Check for unary operators if ( IsPostOpTok(tok) ) return SaveBeforeReturn(tok); // Check for unary operators - // Check String for undefined variable token. Done only if a + // Check String for undefined variable token. Done only if a // flag is set indicating to ignore undefined variables. - // This is a way to conditionally avoid an error if - // undefined variables occur. + // This is a way to conditionally avoid an error if + // undefined variables occur. // (The GetUsedVar function must suppress the error for - // undefined variables in order to collect all variable + // undefined variables in order to collect all variable // names including the undefined ones.) - if ( (m_bIgnoreUndefVar || m_pFactory) && IsUndefVarTok(tok) ) + if ( (m_bIgnoreUndefVar || m_pFactory) && IsUndefVarTok(tok) ) return SaveBeforeReturn(tok); // Check for unknown token - // + // // !!! From this point on there is no exit without an exception possible... - // + // string_type strTok; int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos); if (iEnd!=m_iPos) @@ -312,7 +312,7 @@ namespace mu //--------------------------------------------------------------------------- void ParserTokenReader::SetParent(ParserBase *a_pParent) { - m_pParser = a_pParent; + m_pParser = a_pParent; m_pFunDef = &a_pParent->m_FunDef; m_pOprtDef = &a_pParent->m_OprtDef; m_pInfixOprtDef = &a_pParent->m_InfixOprtDef; @@ -325,21 +325,21 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Extract all characters that belong to a certain charset. - \param a_szCharSet [in] Const char array of the characters allowed in the token. + \param a_szCharSet [in] Const char array of the characters allowed in the token. \param a_strTok [out] The string that consists entirely of characters listed in a_szCharSet. \param a_iPos [in] Position in the string from where to start reading. \return The Position of the first character not listed in a_szCharSet. \throw nothrow */ - int ParserTokenReader::ExtractToken(const char_type *a_szCharSet, - string_type &a_sTok, + int ParserTokenReader::ExtractToken(const char_type *a_szCharSet, + string_type &a_sTok, int a_iPos) const { int iEnd = (int)m_strFormula.find_first_not_of(a_szCharSet, a_iPos); if (iEnd==(int)string_type::npos) iEnd = (int)m_strFormula.length(); - + // Assign token string if there was something found if (a_iPos!=iEnd) a_sTok = string_type( m_strFormula.begin()+a_iPos, m_strFormula.begin()+iEnd); @@ -349,13 +349,13 @@ namespace mu //--------------------------------------------------------------------------- /** \brief Check Expression for the presence of a binary operator token. - + Userdefined binary operator "++" gives inconsistent parsing result for the equations "a++b" and "a ++ b" if alphabetic characters are allowed in operator tokens. To avoid this this function checks specifically for operator tokens. */ - int ParserTokenReader::ExtractOperatorToken(string_type &a_sTok, + int ParserTokenReader::ExtractOperatorToken(string_type &a_sTok, int a_iPos) const { // Changed as per Issue 6: https://code.google.com/p/muparser/issues/detail?id=6 @@ -405,7 +405,7 @@ namespace mu case cmGT: case cmLE: case cmGE: - case cmNEQ: + case cmNEQ: case cmEQ: case cmADD: case cmSUB: @@ -421,12 +421,12 @@ namespace mu Error(ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef[i]); if (!m_pParser->HasBuiltInOprt()) continue; - if (m_iSynFlags & noOPT) + if (m_iSynFlags & noOPT) { // Maybe its an infix operator not an operator - // Both operator types can share characters in + // Both operator types can share characters in // their identifiers - if ( IsInfixOpTok(a_Tok) ) + if ( IsInfixOpTok(a_Tok) ) return true; Error(ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef[i]); @@ -438,7 +438,7 @@ namespace mu case cmBO: if (m_iSynFlags & noBO) Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]); - + if (m_lastTok.GetCode()==cmFUNC) m_iSynFlags = noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE; else @@ -480,7 +480,7 @@ namespace mu return true; } // if operator string found } // end of for all operator strings - + return false; } @@ -538,7 +538,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Check if a string position contains a unary infix operator. + /** \brief Check if a string position contains a unary infix operator. \return true if a function token has been found false otherwise. */ bool ParserTokenReader::IsInfixOpTok(token_type &a_Tok) @@ -558,7 +558,7 @@ namespace mu a_Tok.Set(it->second, it->first); m_iPos += (int)it->first.length(); - if (m_iSynFlags & noINFIXOP) + if (m_iSynFlags & noINFIXOP) Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString()); m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN; @@ -571,10 +571,10 @@ namespace mu a_Tok.Set(item->second, sTok); m_iPos = (int)iEnd; - if (m_iSynFlags & noINFIXOP) + if (m_iSynFlags & noINFIXOP) Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString()); - m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN; + m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN; return true; */ } @@ -637,7 +637,7 @@ namespace mu // Note: // All tokens in oprt_bin_maptype are have been sorted by their length // Long operators must come first! Otherwise short names (like: "add") that - // are part of long token names (like: "add123") will be found instead + // are part of long token names (like: "add123") will be found instead // of the long ones. // Length sorting is done with ascending length so we use a reverse iterator here. funmap_type::const_reverse_iterator it = m_pOprtDef->rbegin(); @@ -649,19 +649,19 @@ namespace mu a_Tok.Set(it->second, strTok); // operator was found - if (m_iSynFlags & noOPT) + if (m_iSynFlags & noOPT) { // An operator was found but is not expected to occur at - // this position of the formula, maybe it is an infix + // this position of the formula, maybe it is an infix // operator, not a binary operator. Both operator types // can share characters in their identifiers. - if ( IsInfixOpTok(a_Tok) ) + if ( IsInfixOpTok(a_Tok) ) return true; else { // nope, no infix operator return false; - //Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString()); + //Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString()); } } @@ -682,7 +682,7 @@ namespace mu // <ibg 20110629> Do not check for postfix operators if they are not allowed at // the current expression index. // - // This will fix the bug reported here: + // This will fix the bug reported here: // // http://sourceforge.net/tracker/index.php?func=detail&aid=3343891&group_id=137191&atid=737979 // @@ -691,13 +691,13 @@ namespace mu // </ibg> // Tricky problem with equations like "3m+5": - // m is a postfix operator, + is a valid sign for postfix operators and - // for binary operators parser detects "m+" as operator string and + // m is a postfix operator, + is a valid sign for postfix operators and + // for binary operators parser detects "m+" as operator string and // finds no matching postfix operator. - // + // // This is a special case so this routine slightly differs from the other // token readers. - + // Test if there could be a postfix operator string_type sTok; int iEnd = ExtractToken(m_pParser->ValidOprtChars(), sTok, m_iPos); @@ -737,7 +737,7 @@ namespace mu string_type strTok; value_type fVal(0); int iEnd(0); - + // 2.) Check for user defined constant // Read everything that could be a constant name iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos); @@ -752,7 +752,7 @@ namespace mu if (m_iSynFlags & noVAL) Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok); - m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN; + m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN; return true; } } @@ -781,7 +781,7 @@ namespace mu } //--------------------------------------------------------------------------- - /** \brief Check wheter a token at a given position is a variable token. + /** \brief Check wheter a token at a given position is a variable token. \param a_Tok [out] If a variable token has been found it will be placed here. \return true if a variable token has been found. */ @@ -811,7 +811,7 @@ namespace mu m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR; // Zur Info hier die SynFlags von IsVal(): -// m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN; +// m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN; return true; } @@ -845,7 +845,7 @@ namespace mu //--------------------------------------------------------------------------- - /** \brief Check wheter a token at a given position is an undefined variable. + /** \brief Check wheter a token at a given position is an undefined variable. \param a_Tok [out] If a variable tom_pParser->m_vStringBufken has been found it will be placed here. \return true if a variable token has been found. @@ -860,8 +860,8 @@ namespace mu if (m_iSynFlags & noVAR) { - // <ibg/> 20061021 added token string strTok instead of a_Tok.GetAsString() as the - // token identifier. + // <ibg/> 20061021 added token string strTok instead of a_Tok.GetAsString() as the + // token identifier. // related bug report: // http://sourceforge.net/tracker/index.php?func=detail&aid=1578779&group_id=137191&atid=737979 Error(ecUNEXPECTED_VAR, m_iPos - (int)a_Tok.GetAsString().length(), strTok); @@ -905,7 +905,7 @@ namespace mu */ bool ParserTokenReader::IsString(token_type &a_Tok) { - if (m_strFormula[m_iPos]!='"') + if (m_strFormula[m_iPos]!='"') return false; string_type strBuf(&m_strFormula[m_iPos+1]); @@ -946,8 +946,8 @@ namespace mu \param a_strTok [in] The token string representation associated with the error. \throw ParserException always throws thats the only purpose of this function. */ - void ParserTokenReader::Error( EErrorCodes a_iErrc, - int a_iPos, + void ParserTokenReader::Error( EErrorCodes a_iErrc, + int a_iPos, const string_type &a_sTok) const { m_pParser->Error(a_iErrc, a_iPos, a_sTok); diff --git a/moose-core/external/odeint-v2/fix-copyright.py b/moose-core/external/odeint-v2/fix-copyright.py index 2dea71f5d3bb06ba747b8f4fc06ff7645e45b1d5..753596e6d4b9ec230609fa82b7df7b46af83d9be 100755 --- a/moose-core/external/odeint-v2/fix-copyright.py +++ b/moose-core/external/odeint-v2/fix-copyright.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- from __future__ import print_function from subprocess import check_output as run from datetime import datetime 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 index 88cf159e030388ec6a8cfed80298bd8d009b996a..bcae2d3eacf492f8006f67a7c063524197ff7aa3 100644 --- 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 @@ -35,7 +35,7 @@ namespace boost { namespace numeric { namespace odeint { - + template< class StateType , class Enabler = void > struct algebra_dispatcher_sfinae { @@ -94,7 +94,7 @@ struct algebra_dispatcher< boost::numeric::ublas::matrix< T , L , A > > namespace boost { namespace numeric { namespace odeint { - + // specialize for std::array template< class T , size_t N > struct algebra_dispatcher< std::array< T , N > > 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 index 471e866fe51604e6990491471ea4af769b6c8871..39b79240adfe9a304bd39d67158912a886b89eb4 100644 --- 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 @@ -6,7 +6,7 @@ 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: + parameters: Array<T, N> [end_description] 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 index 0bc476e63149e021fc809a98c562378fb0e1d341..1f8c41b2eac1e3e43c082240c491b90cd7ff077a 100644 --- 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 @@ -121,7 +121,7 @@ struct multi_array_algebra { 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 ) { 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 index faeb5e884d9ab8dd21ae66b7e791482cf28fb697..5a0b21bb81a1d9f13bd516af9ad8a77cbdb3e4f6 100644 --- 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 @@ -22,7 +22,7 @@ namespace boost { namespace numeric { namespace odeint { - + template< class StateType , class Enabler = void > struct operations_dispatcher_sfinae { 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 index 3c5f2d46a0c8ad9259a4482d4d4a54caea409a2f..50ad3192632c453369aba374c3db9d3901192f58 100644 --- 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 @@ -29,8 +29,8 @@ namespace numeric { namespace odeint { template< typename T , bool TF > -struct is_resizeable< blaze::DynamicVector< T , TF > > -{ +struct is_resizeable< blaze::DynamicVector< T , TF > > +{ typedef boost::true_type type; const static bool value = type::value; }; 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 index b4ee5c3b1f666ef0758a6dab622199d6c7e8671f..093154decb0cf321e908bd2bc2205e008a61c432 100644 --- 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 @@ -73,7 +73,7 @@ operator/(const Eigen::MatrixBase<D1> &x1, const Eigen::MatrixBase<D2> &x2) { template< typename D > -inline const +inline const typename Eigen::CwiseUnaryOp< typename Eigen::internal::scalar_abs_op< typename Eigen::internal::traits< D >::Scalar > , 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 index 6c8a3a276ff24b79b699a4e085d1f0533429a987..24a258257b10112888540aae8e37fa651b1656bd 100644 --- 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 @@ -27,7 +27,7 @@ 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; }; @@ -35,7 +35,7 @@ struct algebra_dispatcher_sfinae< Derived , 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; }; 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 index 1989cc36c11322537bfbea8efc47202dc06561d8..4066c866fa97c4736de9010fd34acca847495f7b 100644 --- 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 @@ -37,7 +37,7 @@ 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; }; @@ -46,7 +46,7 @@ struct is_resizeable_sfinae< Derived , 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; }; 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 index a3f03507cd8931f1eb8b6638b923e76f0e3d151e..9950ce1592e53b0f4c478e9c95599ce5749b6b6d 100644 --- 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 @@ -1,6 +1,6 @@ /* [begin_description] -Modification of the implicit Euler method, works with the MTL4 matrix library only. +Modification of the implicit Euler method, works with the MTL4 matrix library only. [end_description] Copyright 2012-2013 Andreas Angelopoulos 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 index 6295c03a6459b3228da19b43622317ed8ea8fc4e..762283550b48039cbd459e5a411aed94b36331cd 100644 --- 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 @@ -1,6 +1,6 @@ /* [begin_description] -Modification of the implicit Euler method, works with the MTL4 matrix library only. +Modification of the implicit Euler method, works with the MTL4 matrix library only. [end_description] Copyright 2012-2013 Andreas Angelopoulos @@ -32,7 +32,7 @@ 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; }; @@ -79,7 +79,7 @@ struct resize_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< 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 , + 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() ) ); @@ -89,7 +89,7 @@ struct same_size_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vec 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 , + 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 ); @@ -102,7 +102,7 @@ struct resize_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector 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 , + 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() ) ); @@ -112,7 +112,7 @@ struct same_size_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dens 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 , + static void resize( mtl::compressed2D< Value , MatrixParameters > &m , const mtl::dense_vector< Value , VectorParameters > &v ) { m.change_dim( mtl::size( v ) , mtl::size( v ) ); 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 index 7a86b32fa6aeb323b184a0bb37ac8cfce2ac00d1..52c04a8e13d5916819e4000b419c77e2c44331f4 100644 --- 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 @@ -82,7 +82,7 @@ size_t integrate_const( 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 ); @@ -112,14 +112,14 @@ size_t integrate_const( 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 ) ) @@ -148,7 +148,7 @@ size_t integrate_const( 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 @@ -157,7 +157,7 @@ size_t integrate_const( st.calc_state( time , start_state ); obs( start_state , time ); } - + return real_step; } 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 index 446656b58a0b2d81b04a914fd17891aed7cbf177..bb380f43b0dbbf07ccb88a965f60e486a99cb3a7 100644 --- 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 @@ -49,7 +49,7 @@ integrate( System system , State &start_state , Time start_time , Time end_time } template< class Value , class System , class State , class Time , class Observer > -size_t +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; @@ -80,17 +80,17 @@ size_t integrate( System system , State &start_state , Time start_time , Time en * \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 + * 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 + * \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. @@ -105,17 +105,17 @@ size_t integrate( System system , State &start_state , Time start_time , Time en * \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 + * 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 + * \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. 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 index 09997142fc5331b3061f4c118deaeb0900328d45..e7d6cf7e861b0a82c834d96ecdb450e523f52aa9 100644 --- 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 @@ -98,12 +98,12 @@ size_t integrate_adaptive( /************* 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 + * 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 @@ -114,7 +114,7 @@ size_t integrate_adaptive( * \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 + * \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. 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 index 5cc8aa0e7b3405b3fc4d83406887763ce25a8bbd..c95e695193047d521d0ab9fafe508f53ad204d74 100644 --- 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 @@ -144,8 +144,8 @@ Time integrate_n_steps( * 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 + * 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 @@ -160,7 +160,7 @@ Time integrate_n_steps( * \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 + * \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. 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 index 79fba4f1b398c12bb954a2bb46a72d81bb23053d..29662257fc973a8aafab6ef215d83a2a2abf6389 100644 --- 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 @@ -184,14 +184,14 @@ size_t integrate_times( * \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 + * 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, + * 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 + * 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 @@ -203,7 +203,7 @@ size_t integrate_times( * \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 + * \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 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 index e8313e76904a603c535b38ad0e42d40c10835172..d57fe72db0fc18cf0e87e59b5de4c19716c3a7c8 100644 --- 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 @@ -59,7 +59,7 @@ namespace odeint { template< class Stepper , class System , class State > adaptive_iterator< Stepper , System , State > make_adaptive_iterator_begin( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t_start , typename traits::time_type< Stepper >::type t_end , @@ -72,7 +72,7 @@ namespace odeint { template< class Stepper , class System , class State > adaptive_iterator< Stepper , System , State > make_adaptive_iterator_end( Stepper stepper , - System system , + System system , State &x ) { return adaptive_iterator< Stepper , System , State >( stepper , system , x ); @@ -83,7 +83,7 @@ namespace odeint { std::pair< adaptive_iterator< Stepper , System , State > , adaptive_iterator< Stepper , System , State > > make_adaptive_range( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t_start , typename traits::time_type< Stepper >::type t_end , 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 index f70d34a6f162424a68f59acbefaa89dfa9e51c9a..b55b7a744307cf8a706a14d51910946133b9feec 100644 --- 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 @@ -59,7 +59,7 @@ namespace odeint { template< class Stepper , class System , class State > adaptive_time_iterator< Stepper , System , State > make_adaptive_time_iterator_begin( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t_start , typename traits::time_type< Stepper >::type t_end , @@ -71,7 +71,7 @@ namespace odeint { template< class Stepper , class System , class State > adaptive_time_iterator< Stepper , System , State > make_adaptive_time_iterator_end( Stepper stepper , - System system , + System system , State &x ) { return adaptive_time_iterator< Stepper , System , State >( stepper , system , x ); @@ -82,7 +82,7 @@ namespace odeint { std::pair< adaptive_time_iterator< Stepper , System , State > , adaptive_time_iterator< Stepper , System , State > > make_adaptive_time_range( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t_start , typename traits::time_type< Stepper >::type t_end , 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 index fb1bbb10096c005e81da9606cec0c8a4fd55d030..f3885b074f205612361db0d94cd23bba60f90c41 100644 --- 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 @@ -60,7 +60,7 @@ namespace odeint { template< class Stepper , class System , class State > const_step_iterator< Stepper , System, State > make_const_step_iterator_begin( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t_start , typename traits::time_type< Stepper >::type t_end , @@ -72,7 +72,7 @@ namespace odeint { template< class Stepper , class System , class State > const_step_iterator< Stepper , System , State > make_const_step_iterator_end( Stepper stepper , - System system , + System system , State &x ) { return const_step_iterator< Stepper , System , State >( stepper , system , x ); @@ -82,7 +82,7 @@ namespace odeint { std::pair< const_step_iterator< Stepper , System , State > , const_step_iterator< Stepper , System , State > > make_const_step_range( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t_start , typename traits::time_type< Stepper >::type t_end , 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 index 94ec5ddb17325433c165c9879433ed33f18e3474..cdc6d56fa120606ce519e6798a07bb951ff6fb02 100644 --- 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 @@ -55,7 +55,7 @@ namespace odeint { template< class Stepper , class System , class State > const_step_time_iterator< Stepper , System , State > make_const_step_time_iterator_begin( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t_start , typename traits::time_type< Stepper >::type t_end , @@ -67,7 +67,7 @@ namespace odeint { template< class Stepper , class System , class State > const_step_time_iterator< Stepper , System , State > make_const_step_time_iterator_end( Stepper stepper , - System system , + System system , State &x ) { return const_step_time_iterator< Stepper , System , State >( stepper , system , x ); @@ -78,7 +78,7 @@ namespace odeint { 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 , + System system , State &x , typename traits::time_type< Stepper >::type t_start , typename traits::time_type< Stepper >::type t_end , 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 index 5960e188b63580ba36dfda9ceeb3ef4fe04f0e7f..fcab45fc17951aa7650445ebb7dc7ebc0c66aa52 100644 --- 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 @@ -56,7 +56,7 @@ namespace detail { 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 ) @@ -73,7 +73,7 @@ namespace detail { return ( //( static_cast<Iterator>(*this).get_state() == // static_cast<Iterator>(iter).get_state ) && - ( m_t == iter.m_t ) && + ( m_t == iter.m_t ) && ( m_dt == iter.m_dt ) && ( m_at_end == iter.m_at_end ) ); 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 index e23474c7afbb74ec3f96af4206760a5cfffdd6f6..54b0727485d378e96c014db01163283de741eb60 100644 --- 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 @@ -52,7 +52,7 @@ namespace odeint { #endif public: - + /** * \brief Constructs a const_step_iterator. This constructor should be used to construct the begin iterator. * 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 index 7dd167f20a44ae2400af6df492f2d7d245a98a1d..6e5b85994e1b3ba090d9895ea8a2b4f0b16b1930 100644 --- 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 @@ -63,7 +63,7 @@ namespace odeint { #endif public: - + /** * \brief Constructs a n_step_iterator. This constructor should be used to construct the begin iterator. * 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 index 10650369c1358218e01cc62a85aa392a6057a3a1..bdafff2e852b2708f22e9bfacee1feccc213d5c1 100644 --- 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 @@ -45,7 +45,7 @@ template< class Stepper , class System , class State , class Time , class Observ size_t integrate_const( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , - Observer observer , stepper_tag + Observer observer , stepper_tag ) { size_t obs_calls = 0; @@ -65,15 +65,15 @@ template< class Stepper , class System , class State , class Time , class Observ size_t integrate_const( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , - Observer observer , controlled_stepper_tag + 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 ); @@ -85,7 +85,7 @@ size_t integrate_const( time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * time_step; } obs( start_state , time ); - + return step; } @@ -94,7 +94,7 @@ template< class Stepper , class System , class State , class Time , class Observ 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 + Observer observer , dense_output_stepper_tag ) { size_t obs_calls = 0; 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 index 9d88ef9ce1199ec16c3395f45fe16289136bce28..5300da2ba159f04d6da84495f5955081825befad 100644 --- 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 @@ -64,14 +64,14 @@ size_t integrate( System system , State &start_state , Time start_time , Time en * \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 + * 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 + * \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. @@ -86,14 +86,14 @@ size_t integrate( System system , State &start_state , Time start_time , Time en * \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 + * 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 + * \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. 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 index 3229a00c6cd72df16faa0f5fb8cbcf1712ed5b64..a8d034d4112d66ed8c196c66fd99d1f72aaab4e9 100644 --- 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 @@ -98,12 +98,12 @@ size_t integrate_adaptive( /************* 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 + * 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 @@ -114,7 +114,7 @@ size_t integrate_adaptive( * \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 + * \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. 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 index ffcea6c193a37671e6ceceb683293e7923908ace..b00024f807aa5ab3b36cbb94ff9a95a7ef105577 100644 --- 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 @@ -55,14 +55,14 @@ size_t integrate_const( } else { - return detail::integrate_const( stepper , system , start_state , + return detail::integrate_const( stepper , system , start_state , start_time , end_time , dt , observer , stepper_category() ); } } /** - * \brief Second version to solve the forwarding problem, + * \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 > @@ -83,7 +83,7 @@ size_t integrate_const( } else { - return detail::integrate_const( stepper , system , start_state , + return detail::integrate_const( stepper , system , start_state , start_time , end_time , dt , observer , stepper_category() ); } @@ -131,8 +131,8 @@ size_t integrate_const( * 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 + * 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 @@ -143,7 +143,7 @@ size_t integrate_const( * \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 + * \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. 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 index 8f30c77969fdc569f2b2af9f806dd7786be7fe00..d75cb306a372d15fd248c571560afccc26de516c 100644 --- 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 @@ -96,8 +96,8 @@ Time integrate_n_steps( * 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 + * 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 @@ -107,7 +107,7 @@ Time integrate_n_steps( * \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 + * \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. 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 index 1bbd8367319fb0122203317106a90452c39fa53a..55101ec9d00b254fbc933d0fba7ac65122188c3b 100644 --- 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 @@ -101,14 +101,14 @@ size_t integrate_times( * \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 + * 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, + * 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 + * 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. @@ -116,7 +116,7 @@ size_t integrate_times( * \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 + * \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. 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 index 195e981d6502f23a24099defcf5516d97234cfdc..c9733107b5e38a4e2d9d2844d3d99970e480bd54 100644 --- 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 @@ -60,7 +60,7 @@ namespace odeint { template< class Stepper , class System , class State > n_step_iterator< Stepper , System, State > make_n_step_iterator_begin( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , @@ -72,7 +72,7 @@ namespace odeint { template< class Stepper , class System , class State > n_step_iterator< Stepper , System , State > make_n_step_iterator_end( Stepper stepper , - System system , + System system , State &x ) { return n_step_iterator< Stepper , System , State >( stepper , system , x ); @@ -82,7 +82,7 @@ namespace odeint { std::pair< n_step_iterator< Stepper , System , State > , n_step_iterator< Stepper , System , State > > make_n_step_range( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , 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 index 8ed17dee433a8746217a84fccdd1ef95fdb32cfc..acede2ca3c7534b5ff40793e5fc6dddc5f97f43b 100644 --- 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 @@ -61,7 +61,7 @@ namespace odeint { template< class Stepper , class System , class State > n_step_time_iterator< Stepper , System, State > make_n_step_time_iterator_begin( Stepper stepper , - System system , + System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , @@ -73,7 +73,7 @@ namespace odeint { template< class Stepper , class System , class State > n_step_time_iterator< Stepper , System , State > make_n_step_time_iterator_end( Stepper stepper , - System system , + System system , State &x ) { return n_step_time_iterator< Stepper , System , State >( stepper , system , x ); @@ -83,7 +83,7 @@ namespace odeint { 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 , + System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , 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 index e6c9b85b78746d98c87ee8e72336a914051b8371..dcf5733269f7d12f88cfe446d3aa9b4c78095325 100644 --- 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 @@ -61,7 +61,7 @@ namespace odeint { template< class Stepper , class System , class State , class TimeIterator > times_iterator< Stepper , System, State , TimeIterator > make_times_iterator_begin( Stepper stepper , - System system , + System system , State &x , TimeIterator t_start , TimeIterator t_end , @@ -74,7 +74,7 @@ namespace odeint { template< class TimeIterator , class Stepper , class System , class State > times_iterator< Stepper , System , State , TimeIterator > make_times_iterator_end( Stepper stepper , - System system , + System system , State &x ) //TimeIterator t_end ) { @@ -86,7 +86,7 @@ namespace odeint { times_iterator< Stepper , System , State , TimeIterator > > make_times_range( Stepper stepper , - System system , + System system , State &x , TimeIterator t_start , TimeIterator t_end , 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 index 94fd9a3f0f364efbc037e858dd1bd8e6bb1c894f..1935d053ffc1c5a8a38ee442d8da443ec6426dc4 100644 --- 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 @@ -62,7 +62,7 @@ namespace odeint { 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 , + System system , State &x , TimeIterator t_start , TimeIterator t_end , @@ -75,7 +75,7 @@ namespace odeint { 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 , + System system , State &x ) //TimeIterator t_end ) { @@ -87,7 +87,7 @@ namespace odeint { times_time_iterator< Stepper , System , State , TimeIterator > > make_times_time_range( Stepper stepper , - System system , + System system , State &x , TimeIterator t_start , TimeIterator t_end , 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 index 5ff1e8358c109ed2080e90ad657a2e916bcddc05..47c3b939ee89cdf378a5e9d620b73534013f3f5f 100644 --- 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 @@ -77,7 +77,7 @@ 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, +class InitializingStepper = extrapolation_stepper< order_helper<Steps>::value, State, Value, Deriv, Time, Algebra, Operations, Resizer > > @@ -118,7 +118,7 @@ public : 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() ) @@ -283,13 +283,13 @@ private: * \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 + * 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. @@ -308,7 +308,7 @@ private: /** * \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. + * constructor if the algebra has a default constructor. * \param algebra A copy of algebra is made and stored. */ 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 index f3edce1989de02dd329d7354b6ad30e6339444ef..c7b487fb13ac0fac27254196f469fb282664abce 100644 --- 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 @@ -91,7 +91,7 @@ public : adams_bashforth_moulton( const algebra_type &algebra ) : m_adams_bashforth( algebra ) , m_adams_moulton( m_adams_bashforth.algebra() ) - , m_x() , m_resizer() + , m_x() , m_resizer() { } order_type order( void ) const { return order_value; } @@ -158,7 +158,7 @@ public : private: - + template< typename System , typename StateInOut > void do_step_impl1( System system , StateInOut &x , time_type t , time_type dt ) { @@ -173,13 +173,13 @@ private: 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_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() ); } @@ -189,7 +189,7 @@ private: } } - + template< class StateIn > bool resize_impl( const StateIn &x ) { @@ -209,15 +209,15 @@ private: * \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. + * 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. @@ -236,7 +236,7 @@ private: /** * \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. + * constructor if the algebra has a default constructor. * \param algebra A copy of algebra is made and stored. */ @@ -290,7 +290,7 @@ private: /** * \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 + * \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. 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 index 3b014f8e182e05582f09d99112d65a9f13667c31..66c2b84a81f26e791664d437b24389625142ff10 100644 --- 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 @@ -57,12 +57,12 @@ protected: * \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 + * 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 + * \tparam Operations The type of the operations. Must fulfill the Operations Concept, at least partially * to work with the stepper. */ 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 index 08009dc16bf7a77667863a3369f9b7044162dd06..bb6ea3d0a716eaa5162b8745adc9e91075657619 100644 --- 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 @@ -154,7 +154,7 @@ public: /* * named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt ) * - * this version is needed when this stepper is used for initializing + * 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. */ @@ -197,11 +197,11 @@ public: { 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 + * 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. */ @@ -334,7 +334,7 @@ protected: /** * \class explicit_error_stepper_base - * \brief Base class for explicit steppers with error estimation. This class can used with + * \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 @@ -342,12 +342,12 @@ protected: * 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 + * 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 )`. + * `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 @@ -382,7 +382,7 @@ protected: * \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 + * \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. @@ -446,7 +446,7 @@ protected: * * 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 @@ -462,7 +462,7 @@ protected: * \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. + * \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. @@ -521,7 +521,7 @@ protected: * * 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 @@ -538,7 +538,7 @@ protected: * \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. + * \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. 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 index b1d751a0ce240af75adf881bea1b234460cfac8d..34381eaf27460414083dbcb1a8eb3bdfeeb9abe5 100644 --- 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 @@ -41,7 +41,7 @@ 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 ) @@ -85,7 +85,7 @@ public: 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 + #endif typedef unsigned short order_type; @@ -153,7 +153,7 @@ public: /* * named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt ) * - * this version is needed when this stepper is used for initializing + * 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. */ @@ -170,7 +170,7 @@ public: * this version does not solve the forwarding problem, boost.range can not * be used. * - * the disable is needed to avoid ambiguous overloads if + * the disable is needed to avoid ambiguous overloads if * state_type = time_type */ template< class System , class StateIn , class StateOut > @@ -371,16 +371,16 @@ protected: * 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 + * 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 )`. + * `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 + * `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 * @@ -424,7 +424,7 @@ protected: * \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 + * \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. @@ -500,7 +500,7 @@ protected: * 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 @@ -519,7 +519,7 @@ protected: * * \note This method uses the internal state of the stepper. * - * \note This method does not solve the forwarding problem. + * \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. @@ -577,7 +577,7 @@ protected: * 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 @@ -597,7 +597,7 @@ protected: * * \note This method uses the internal state of the stepper. * - * \note This method does not solve the forwarding problem. + * \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. @@ -651,7 +651,7 @@ protected: * \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 + * This method is equivalent to * \code * Deriv dxdt; * system( x , dxdt , t ); @@ -665,7 +665,7 @@ protected: /** * \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 + * \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. */ 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 index d81c8c7a7181890b137b01f53e22f93c656c1d5f..4dca52572973871ab20f278cd31192e8c6919a2a 100644 --- 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 @@ -141,7 +141,7 @@ public: /* * named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt ) * - * this version is needed when this stepper is used for initializing + * 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. */ @@ -183,7 +183,7 @@ public: /* * named Version 4: do_step_dxdt_impl( sys , in , dxdt , t , out, dt ) * - * this version is needed when this stepper is used for initializing + * 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. */ @@ -246,9 +246,9 @@ protected: * \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 )`. + * 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 * @@ -257,11 +257,11 @@ protected: * 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 ) * { @@ -278,8 +278,8 @@ protected: * * 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 + * 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 ); @@ -293,7 +293,7 @@ protected: * - `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 + * - `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` @@ -356,7 +356,7 @@ protected: * * 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 @@ -383,7 +383,7 @@ protected: /** * \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. + * Furthermore, the derivative of x at t is passed to the stepper. * It is supposed to be used in the following way: * * \code 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 index eb09aefc8f92be0bc4c9c6b26bf376547ed424b3..e026b068c6610d6200ba655a825a6f27e4754671 100644 --- 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 @@ -77,11 +77,11 @@ public: 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 + #endif typedef unsigned short order_type; static const order_type order_value = Order; @@ -90,7 +90,7 @@ public: 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() + m_dqdt_resizer() , m_dpdt_resizer() , m_dqdt() , m_dpdt() { } @@ -311,14 +311,14 @@ private: * * 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>. + * <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: * @@ -410,7 +410,7 @@ private: * \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 + * \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. 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 index 02c37492b9998762994021878bd867bab5030eb3..0f5553fdd248aed8b883334f16c819f45c428a94 100644 --- 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 @@ -397,7 +397,7 @@ private: 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 + uses the obtained intermediate results to extrapolate to dt->0 */ { static const value_type val1 = static_cast< value_type >( 1.0 ); @@ -518,7 +518,7 @@ private: /** * \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. @@ -534,7 +534,7 @@ private: /** * \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 + * \brief Constructs the bulirsch_stoer class, including initialization of * the error bounds. * * \param eps_abs Absolute tolerance level. @@ -548,15 +548,15 @@ private: * \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 + * 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 + * 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. + * \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 + * \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. @@ -568,15 +568,15 @@ private: * \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 + * 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 + * 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. + * \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 + * \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. @@ -591,13 +591,13 @@ private: * \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 + * 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 + * 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. + * \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. @@ -612,13 +612,13 @@ private: * \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 + * 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 + * 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. + * \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. 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 index 6a1eed15fb26bc312bbe2f421186636fafb32e48..e74a2641c92f892efca674d033645cfe345c5963 100644 --- 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 @@ -169,7 +169,7 @@ public: BOOST_USING_STD_MIN(); BOOST_USING_STD_MAX(); using std::pow; - + static const value_type val1( 1.0 ); bool reject( true ); @@ -472,7 +472,7 @@ private: 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 ) + const StateIn2 & /* x_end */ , const DerivIn2 & /*dxdt_end */ , time_type dt ) /* k is the order to which the result was approximated */ { @@ -620,17 +620,17 @@ private: { 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 ; @@ -640,23 +640,23 @@ private: { 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; @@ -718,7 +718,7 @@ private: /** * \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 @@ -735,14 +735,14 @@ private: /** * \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 + * \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 + * \param control_interpolation Set true to additionally control the error of * the interpolation. */ @@ -751,13 +751,13 @@ private: * \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 + * 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 + * 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. + * \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. @@ -778,7 +778,7 @@ private: /** * \fn bulirsch_stoer_dense_out::do_step( System system ) - * \brief Does one time step. This is the main method that should be used to + * \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. 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 index 8ae627fe1cd99f5bd9c5fbe60ae187f1033baa7d..2c0bef62131316932ec3c4a5c7f6d3e005b12f27 100644 --- 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 @@ -196,10 +196,10 @@ class controlled_runge_kutta ; * try_step( sys , in , dxdt , t , out , dt ) */ /** - * \brief Implements step size control for Runge-Kutta steppers with error + * \brief Implements step size control for Runge-Kutta steppers with error * estimation. * - * This class implements the step size control for standard Runge-Kutta + * 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. @@ -263,15 +263,15 @@ public: * \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 + * 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 + * 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 + * \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. @@ -284,19 +284,19 @@ public: } /** - * \brief Tries to perform one step. Solves the forwarding problem and + * \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 + * 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 + * 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 + * \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. @@ -319,15 +319,15 @@ public: * \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 + * 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 + * 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 + * \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. @@ -359,9 +359,9 @@ public: * \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 + * 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 + * 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. * @@ -393,9 +393,9 @@ public: * \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 + * 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 + * 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. * @@ -528,16 +528,16 @@ private: * explicit stepper fsal version * * the class introduces the following try_step overloads - * try_step( sys , x , t , dt ) + * 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 + * \brief Implements step size control for Runge-Kutta FSAL steppers with * error estimation. * - * This class implements the step size control for FSAL Runge-Kutta + * 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. @@ -597,15 +597,15 @@ public: * \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 + * 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 + * 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 + * \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. @@ -619,19 +619,19 @@ public: /** - * \brief Tries to perform one step. Solves the forwarding problem and + * \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 + * 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 + * 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 + * \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. @@ -649,7 +649,7 @@ public: * 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 */ /** @@ -658,9 +658,9 @@ public: * \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 + * 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 + * 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. * @@ -693,15 +693,15 @@ public: * \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 + * 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 + * 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 + * \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. @@ -732,9 +732,9 @@ public: * \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 + * 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 + * 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. * @@ -925,7 +925,7 @@ private: * \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 + * 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. * @@ -940,7 +940,7 @@ private: * time_type max_dt) * \brief Constructs the error checker. * - * The error is calculated as follows: ???? + * The error is calculated as follows: ???? * * \param eps_abs Absolute tolerance level. * \param eps_rel Relative tolerance level. @@ -948,7 +948,7 @@ private: * \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. 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 index 94abc5af9926273b6d41d78761ae26f9a05ad990..0b69f70370f71fad37e405593e81cdd0bdc80d46 100644 --- 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 @@ -55,8 +55,8 @@ class dense_output_runge_kutta; * 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. - * + * control. + * * * \tparam Stepper The stepper type of the underlying algorithm. */ @@ -90,13 +90,13 @@ public: */ 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_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 + * \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. @@ -132,7 +132,7 @@ public: /* * 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 @@ -224,22 +224,22 @@ private: { 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; @@ -272,8 +272,8 @@ private: * \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 - * + * This class provides dense output functionality based on methods with step size controlled + * * * \tparam Stepper The stepper type of the underlying algorithm. */ @@ -414,17 +414,17 @@ private: { 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 ; @@ -434,23 +434,23 @@ private: { 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; 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 index b6f5f2a40bb1d97ff1a4822ea1b792380a61987b..7ed79d2e15070224b34892dd9cd02088cd67fcbe 100644 --- 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 @@ -18,7 +18,7 @@ #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> +#include <boost/assert.hpp> namespace boost { namespace numeric { 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 index 1c7c126b966f254387d4f4ed04e695aa44287cc6..4941379d6c64de2f8980102e40fc29f6a5f612a1 100644 --- 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 @@ -69,7 +69,7 @@ public : 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 + #endif euler( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra ) @@ -109,7 +109,7 @@ public : * 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 * @@ -128,12 +128,12 @@ public : * 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 + * 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 @@ -148,7 +148,7 @@ public : /** * \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 + * \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`. */ 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 index 3c59810b6925c70a243589b0d534296640ea2378..cf028d8b07fb87d3b86d95acb02765b7caae8a37 100644 --- 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 @@ -180,12 +180,12 @@ private: * 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 + * \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. @@ -229,7 +229,7 @@ private: * \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 + * 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 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 index f8edc201a5cf3654a8e4ab7e3271a947bd847e5b..620c8b733f22be53eefce5abb79f7ee32c31aa70 100644 --- 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 @@ -122,7 +122,7 @@ public: #ifndef DOXYGEN_SKIP typedef explicit_generic_rk< StageCount , Order , State , Value , Deriv ,Time , Algebra , Operations , Resizer > stepper_type; - #endif + #endif typedef detail::generic_rk_algorithm< StageCount , Value , Algebra , Operations > rk_algorithm_type; @@ -195,7 +195,7 @@ private: * 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. @@ -216,12 +216,12 @@ private: * \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 + * 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 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 index f3019889cb9666ebbc569afda6b6d19cae2d300f..24a56e93c383b7e9f6223daf267dc69afcffaafc 100644 --- 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 @@ -66,7 +66,7 @@ public: typedef implicit_euler< ValueType , Resizer > stepper_type; implicit_euler( value_type epsilon = 1E-6 ) - : m_epsilon( epsilon ) + : m_epsilon( epsilon ) { } 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 index 9e34c7da2e9539906daa0afab63deea097cd6533..af0c522ff2df1618760326dd4e202a460f8ae842 100644 --- 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 @@ -291,7 +291,7 @@ private: /** * \class modified_midpoint * - * Implementation of the modified midpoint method with a configurable + * 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. */ @@ -300,10 +300,10 @@ private: /** * \class modified_midpoint_dense_out * - * Implementation of the modified midpoint method with a configurable + * 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 + * \note This stepper is for internal use only and does not meet * any stepper concept. */ 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 index 86136989d829433315f1958cb85e77ae4c401dee..564577c8fc41ccfebdfc329683411b5f500d659d 100644 --- 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 @@ -163,7 +163,7 @@ public: { } - order_type order() const { return stepper_order; } + 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 ) 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 index 61d6e511917dd8506a60409752cfd5bda24748a8..e361a1addf9ae49e76d877afb60123c1235132e3 100644 --- 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 @@ -76,7 +76,7 @@ public: 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 ) 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 index 6695ba6a97a15079e1719f5d9a6785fd0d6ec10a..72ef437476b99b50763b6c12aadf89db2e6c2265 100644 --- 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 @@ -55,7 +55,7 @@ public: rosenbrock4_dense_output( const controlled_stepper_type &stepper = controlled_stepper_type() ) : m_stepper( stepper ) , - m_x1() , m_x2() , + m_x1() , m_x2() , m_current_state_x1( true ) , m_t() , m_t_old() , m_dt() { @@ -150,17 +150,17 @@ private: { 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 ; 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 index 2410774ee1287c60638d600f2799e8829cf03d6d..c0c4e166fe8947daa6af2bf572f3c5710b18751c 100644 --- 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 @@ -152,7 +152,7 @@ public: * <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. 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 index 32bda0bd7f301f3602517e2017c7c54a7999408c..215448c74cbbab61f28925f5f932766481a36d7f 100644 --- 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 @@ -127,13 +127,13 @@ public : 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 ) ); + // 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 ) ); + // 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 ) ); } @@ -178,9 +178,9 @@ private: * 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 + * 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. @@ -197,7 +197,7 @@ private: /** * \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. + * constructor if the algebra has a default constructor. * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. */ @@ -206,7 +206,7 @@ private: * \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 + * 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 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 index beecb3f328ad671266983d95f24f864902929b99..74734e6f193e2d864590ff18f400983c6b284fe3 100644 --- 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 @@ -1,14 +1,14 @@ /* [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) @@ -155,7 +155,7 @@ template< #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 +#else class runge_kutta_cash_karp54 : public explicit_error_generic_rk #endif { @@ -203,7 +203,7 @@ public: * <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. 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 index 80f1a3c030c9cb89a2bad1ef1e93abf2ccc0bd31..7600d6efc8b02b77f5bc3b5a47b279797b600e1b 100644 --- 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 @@ -55,7 +55,7 @@ class runge_kutta_cash_karp54_classic 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > #else class runge_kutta_cash_karp54_classic : public explicit_error_stepper_base -#endif +#endif { @@ -221,7 +221,7 @@ private: * <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. * @@ -248,8 +248,8 @@ private: * \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 + * 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. * @@ -267,7 +267,7 @@ private: * \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 + * 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 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 index 260cd74f40fa665d1feab4bf8c1712ae2ba83f57..5d1b1159093961a2113f354cdd2240d3afd91758 100644 --- 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 @@ -68,7 +68,7 @@ public : #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; @@ -193,7 +193,7 @@ public : //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 ) ); - + } } @@ -276,7 +276,7 @@ public : resize_dxdt_tmp_impl( x ); stepper_base_type::adjust_size( x ); } - + private: @@ -298,7 +298,7 @@ private: { return adjust_size_by_resizeability( m_dxdt_tmp , x , typename is_resizeable<deriv_type>::type() ); } - + wrapped_state_type m_x_tmp; @@ -318,8 +318,8 @@ private: * 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. - * + * 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. @@ -346,8 +346,8 @@ private: * \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 + * `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 @@ -365,8 +365,8 @@ private: * \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 + * `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. * @@ -383,7 +383,7 @@ private: /** * \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 + * \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. 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 index f2f8251f2547901bda40791da39dc123666b9420..956b5b62e18d6ee38431c0073432f157ba84abf5 100644 --- 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 @@ -345,7 +345,7 @@ public: * 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. 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 index d75c53534a883db604fc8e1ff50b97cf9cbf13c4..5a23b3081d354c0964f5008d6261f0ee89442d1c 100644 --- 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 @@ -1,14 +1,14 @@ /* [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) 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 index 3a20fc25c9b05da86d2dd40f2767f77ab0d916f3..6868aad87edd06e18ce8542917d6f7a92cb59aec 100644 --- 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 @@ -96,14 +96,14 @@ public: 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 , @@ -138,7 +138,7 @@ public: m_first_call = true; } - + /** * \fn velocity_verlet::initialize( const AccelerationIn &qin ) * \brief Initializes the internal state of the stepper. @@ -173,7 +173,7 @@ public: private: - + template< class System , class CoorIn , class VelocityIn > void initialize_acc( System system , const CoorIn & qin , const VelocityIn & pin , time_type t ) { @@ -181,14 +181,14 @@ private: 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; @@ -254,7 +254,7 @@ private: * * <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. @@ -270,15 +270,15 @@ private: /** * \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. + * 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; @@ -295,7 +295,7 @@ private: /** * \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; @@ -307,15 +307,15 @@ private: * \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; @@ -331,7 +331,7 @@ private: * \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. @@ -345,13 +345,13 @@ private: * `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 + * This method is equivalent to * \code * Acceleration a; * system( qin , pin , a , t ); @@ -363,16 +363,16 @@ private: * \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 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 index 1201afab8422e3da25b92f0303657ec505fe12f8..ead0fc0e98fa52368be2c85fc69c971f8bbcf621 100644 --- 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 @@ -1,14 +1,14 @@ /* * [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 + * 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) @@ -21,7 +21,7 @@ #include <boost/numeric/odeint/config.hpp> -#if BOOST_NUMERIC_ODEINT_CXX11 +#if BOOST_NUMERIC_ODEINT_CXX11 #include <functional> #else #define BOOST_BIND_NO_PLACEHOLDERS @@ -33,7 +33,7 @@ namespace numeric { namespace odeint { namespace detail { -#if BOOST_NUMERIC_ODEINT_CXX11 +#if BOOST_NUMERIC_ODEINT_CXX11 using ::std::bind; using namespace ::std::placeholders; @@ -78,7 +78,7 @@ namespace numeric { namespace odeint { namespace detail { - + #ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL using ::boost::bind; 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 index ad7332dcade3cf7aa631ceae478a24e2f56c85d2..6db42183227702ba775be13ffc11dc63dbf49c3c 100644 --- 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 @@ -35,7 +35,7 @@ namespace boost { namespace numeric { namespace odeint { - + /* * by default any type is not resizable */ 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 index e2c0a4836d9cff66baf270fade488778898fa10b..a7c35fe2cff3f97968f1443cd65130f69f49d029 100644 --- 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 @@ -32,14 +32,14 @@ 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 { @@ -80,7 +80,7 @@ struct is_resizeable_sfinae< T , typename boost::enable_if< typename is_resizeab template< typename T1 , typename T2 > struct same_size_impl_sfinae< T1 , T2 , typename boost::enable_if< - typename boost::mpl::and_< + typename boost::mpl::and_< is_multi_array< T1 > , is_multi_array< T2 > , boost::mpl::bool_< T1::dimensionality == T2::dimensionality > @@ -119,7 +119,7 @@ struct resize_impl_sfinae< T1 , T2 , x1.reindex( origins ); } }; - + } // namespace odeint 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 index a889ee1925dbfe7ffb264f0e0a459c87b5b2a0bd..0d47b79ac03bc353b6a501dd3cfeae928768266d 100644 --- 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 @@ -24,7 +24,7 @@ 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; @@ -33,7 +33,7 @@ struct same_instance_impl template< class T > struct same_instance_impl< T , T > -{ +{ static bool same_instance( const T &x1 , const T &x2 ) { // check pointers 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 index 8fa6c7a3a00318ab02b28b8eb725dc7558a6f4fc..a11e30abd5bcf9a827ebd5910834b3795d25aca5 100644 --- 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 @@ -34,7 +34,7 @@ namespace boost { namespace numeric { namespace odeint { - + template< typename State1 , typename State2 , class Enabler = void > struct same_size_impl_sfinae { 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 index 736b3e57229daac4830915a744d81cd2038ef908..2e6a38c5c040f0e72d06b2d2d7daabf6d22ee030 100644 --- 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 @@ -43,7 +43,7 @@ namespace detail { } typedef T result_type; }; - + #ifndef __CUDACC__ template<class Unit , class T> struct get_unit_value_impl< boost::units::quantity< Unit , T> > 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 index bc7d423a09e8d4faabcbecd0849c88e08433756e..be93dc0ed2505eb176b5b26c4eb48d1161f07732 100644 --- 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 @@ -87,7 +87,7 @@ using ::boost::ref; /* - * + * * the following is the suggested way, but unfortunately it does not work with all compilers. */ @@ -141,7 +141,7 @@ using ::boost::unwrap_reference; namespace boost { namespace numeric { -namespace odeint { +namespace odeint { namespace detail { diff --git a/moose-core/external/tinyxml/tinyxml2.cpp b/moose-core/external/tinyxml/tinyxml2.cpp index f54a1d501df7500f866b7464625617834c9721a7..df52a91a31f5db29507943d657b05baca53626e4 100644 --- a/moose-core/external/tinyxml/tinyxml2.cpp +++ b/moose-core/external/tinyxml/tinyxml2.cpp @@ -593,7 +593,7 @@ XMLNode::~XMLNode() } } -const char* XMLNode::Value() const +const char* XMLNode::Value() const { return _value.GetStr(); } @@ -1063,12 +1063,12 @@ bool XMLUnknown::Accept( XMLVisitor* visitor ) const // --------- XMLAttribute ---------- // -const char* XMLAttribute::Name() const +const char* XMLAttribute::Name() const { return _name.GetStr(); } -const char* XMLAttribute::Value() const +const char* XMLAttribute::Value() const { return _value.GetStr(); } @@ -1271,7 +1271,7 @@ void XMLElement::SetText( const char* inText ) } -void XMLElement::SetText( int v ) +void XMLElement::SetText( int v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); @@ -1279,7 +1279,7 @@ void XMLElement::SetText( int v ) } -void XMLElement::SetText( unsigned v ) +void XMLElement::SetText( unsigned v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); @@ -1287,7 +1287,7 @@ void XMLElement::SetText( unsigned v ) } -void XMLElement::SetText( bool v ) +void XMLElement::SetText( bool v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); @@ -1295,7 +1295,7 @@ void XMLElement::SetText( bool v ) } -void XMLElement::SetText( float v ) +void XMLElement::SetText( float v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); @@ -1303,7 +1303,7 @@ void XMLElement::SetText( float v ) } -void XMLElement::SetText( double v ) +void XMLElement::SetText( double v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); diff --git a/moose-core/external/tinyxml/tinyxml2.h b/moose-core/external/tinyxml/tinyxml2.h index 0a9ae1cbfe03fbf52704bb65806606622263ee9a..75bf810f60091b13e35ca7c21ec5c640105da4a3 100644 --- a/moose-core/external/tinyxml/tinyxml2.h +++ b/moose-core/external/tinyxml/tinyxml2.h @@ -501,13 +501,13 @@ public: static bool IsWhiteSpace( char p ) { return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) ); } - + inline static bool IsNameStartChar( unsigned char ch ) { return ( ( ch < 128 ) ? isalpha( ch ) : 1 ) || ch == ':' || ch == '_'; } - + inline static bool IsNameChar( unsigned char ch ) { return IsNameStartChar( ch ) || isdigit( ch ) @@ -530,7 +530,7 @@ public: } return false; } - + inline static int IsUTF8Continuation( const char p ) { return p & 0x80; } @@ -1261,14 +1261,14 @@ public: return a->QueryFloatValue( value ); } - + /** Given an attribute name, QueryAttribute() returns XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion can't be performed, or XML_NO_ATTRIBUTE if the attribute doesn't exist. It is overloaded for the primitive types, and is a generally more convenient replacement of QueryIntAttribute() and related functions. - + If successful, the result of the conversion will be written to 'value'. If not successful, nothing will be written to 'value'. This allows you to provide default @@ -1396,7 +1396,7 @@ public: @verbatim <foo>Hullaballoo!<b>This is text</b></foo> @endverbatim - + For this XML: @verbatim <foo /> @@ -1410,13 +1410,13 @@ public: /// Convenience method for setting text inside and element. See SetText() for important limitations. void SetText( int value ); /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( unsigned value ); + void SetText( unsigned value ); /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( bool value ); + void SetText( bool value ); /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( double value ); + void SetText( double value ); /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( float value ); + void SetText( float value ); /** Convenience method to query the value of a child text node. This is probably best @@ -1668,7 +1668,7 @@ public: } /// If there is an error, print it to stdout. void PrintError() const; - + /// Clear the document, resetting it to the initial state. void Clear(); diff --git a/moose-core/external/xgetopt/XGetopt.cpp b/moose-core/external/xgetopt/XGetopt.cpp index c3084504d8fe975849e6f2a42cda42e804946afb..66c59eea690d4eafaebeb32fa481be0594f66fbe 100644 --- a/moose-core/external/xgetopt/XGetopt.cpp +++ b/moose-core/external/xgetopt/XGetopt.cpp @@ -11,7 +11,7 @@ // - Added Unicode support // // Version 1.1 - 2002 March 10 -// - Added example to XGetopt.cpp module header +// - Added example to XGetopt.cpp module header // // This software is released into the public domain. // You are free to use it in any way you like. diff --git a/moose-core/hsolve/CMakeLists.txt b/moose-core/hsolve/CMakeLists.txt index 592d41c4fba2ae689768c0e2b112a543c483400d..427efb30802036d1d5a57baddda81de045fbde33 100644 --- a/moose-core/hsolve/CMakeLists.txt +++ b/moose-core/hsolve/CMakeLists.txt @@ -1,18 +1,18 @@ cmake_minimum_required(VERSION 2.6) include_directories(../basecode ../utility ../kinetics ../external/debug) add_library(hsolve - HSolveStruct.cpp - HinesMatrix.cpp - HSolvePassive.cpp - RateLookup.cpp - HSolveActive.cpp - HSolveActiveSetup.cpp - HSolveInterface.cpp - HSolve.cpp - HSolveUtils.cpp - testHSolve.cpp - ZombieCompartment.cpp - ZombieCaConc.cpp - ZombieHHChannel.cpp + HSolveStruct.cpp + HinesMatrix.cpp + HSolvePassive.cpp + RateLookup.cpp + HSolveActive.cpp + HSolveActiveSetup.cpp + HSolveInterface.cpp + HSolve.cpp + HSolveUtils.cpp + testHSolve.cpp + ZombieCompartment.cpp + ZombieCaConc.cpp + ZombieHHChannel.cpp ) diff --git a/moose-core/hsolve/HSolve.h b/moose-core/hsolve/HSolve.h index 3db7d2ad006ebeec6f92e81e2ace903db1e0e568..9022a1f0dc579f796fcab9928d4c1b27e2477163 100644 --- a/moose-core/hsolve/HSolve.h +++ b/moose-core/hsolve/HSolve.h @@ -17,75 +17,75 @@ class HSolve: public HSolveActive { public: HSolve(); - + void process( const Eref& hsolve, ProcPtr p ); void reinit( const Eref& hsolve, ProcPtr p ); - + void setSeed( Id seed ); Id getSeed() const; /**< For searching for compartments: * seed is the starting compt. */ - + void setPath( const Eref& e, string path ); string getPath( const Eref& e ) const; /**< Path to the compartments */ - + void setDt( double dt ); double getDt() const; - + void setCaAdvance( int caAdvance ); int getCaAdvance() const; - + void setVDiv( int vDiv ); int getVDiv() const; - + void setVMin( double vMin ); double getVMin() const; - + void setVMax( double vMax ); double getVMax() const; - + void setCaDiv( int caDiv ); int getCaDiv() const; - + void setCaMin( double caMin ); double getCaMin() const; - + void setCaMax( double caMax ); double getCaMax() const; - + // Interface functions defined in HSolveInterface.cpp double getInitVm( Id id ) const; void setInitVm( Id id, double value ); - + double getVm( Id id ) const; void setVm( Id id, double value ); - + double getCm( Id id ) const; void setCm( Id id, double value ); - + double getEm( Id id ) const; void setEm( Id id, double value ); - + double getRm( Id id ) const; void setRm( Id id, double value ); - + double getRa( Id id ) const; void setRa( Id id, double value ); - + // Im is read-only double getIm( Id id ) const; - + // Ia is read-only double getIa( Id id ) const; - + double getInject( Id id ) const; void setInject( Id id, double value ); - + void addInject( Id id, double value ); - + /// Interface to compartments //~ const vector< Id >& getCompartments() const; - + void addGkEk( Id id, double v1, double v2 ); void addConc( Id id, double conc ); /// Interface to channels @@ -95,31 +95,31 @@ public: double Xpower, double Ypower, double Zpower ); - + int getInstant( Id id ) const; void setInstant( Id id, int instant ); - + double getHHChannelGbar( Id id ) const; void setHHChannelGbar( Id id, double value ); - + double getEk( Id id ) const; void setEk( Id id, double value ); - + double getGk( Id id ) const; void setGk( Id id, double value ); - + // Ik is read-only double getIk( Id id ) const; - + double getX( Id id ) const; void setX( Id id, double value ); - + double getY( Id id ) const; void setY( Id id, double value ); - + double getZ( Id id ) const; void setZ( Id id, double value ); - + /// Assign scale factor for HH channel conductance. void setHHmodulation( Id id, double value ); @@ -128,21 +128,21 @@ public: double getCa( Id id ) const; void setCa( Id id, double Ca ); void iCa( Id id, double iCa ); // Add incoming calcium current. - + double getCaBasal( Id id ) const; void setCaBasal( Id id, double CaBasal ); - + void setTauB( Id id, double tau, double B ); - + double getCaCeiling( Id id ) const; void setCaCeiling( Id id, double floor ); - + double getCaFloor( Id id ) const; void setCaFloor( Id id, double floor ); - + /// Interface to external channels //~ const vector< vector< Id > >& getExternalChannels() const; - + static const Cinfo* initCinfo(); static const std::set<string>& handledClasses(); @@ -150,20 +150,20 @@ public: static void deleteIncomingMessages( Element * orig, const string finfo); /**< Delete messages coming into this particular * element if its class that is handled by HSolve */ - + private: static vector< Id > children( Id obj ); static Id deepSearchForCompartment( Id base ); - + void setup( Eref hsolve ); void zombify( Eref hsolve ) const; - + // Mapping global Id to local index. Defined in HSolveInterface.cpp. void mapIds(); void mapIds( vector< Id > id ); unsigned int localIndex( Id id ) const; map< Id, unsigned int > localIndex_; - + double dt_; string path_; Id seed_; diff --git a/moose-core/hsolve/HSolveActive.cpp b/moose-core/hsolve/HSolveActive.cpp index 2e80688339e3388b8683678a3860e185b8f4e7c6..9d34c6380024df603ba9e27e0bd34bb2263b046a 100644 --- a/moose-core/hsolve/HSolveActive.cpp +++ b/moose-core/hsolve/HSolveActive.cpp @@ -229,7 +229,7 @@ void HSolveActive::advanceChannels( double dt ) vector< LookupRow >::iterator icarowcompt; vector< LookupRow* >::iterator icarow = caRow_.begin(); vector< double >::iterator iextca = externalCalcium_.begin(); - + LookupRow vRow; LookupRow dRow; double C1, C2; @@ -242,7 +242,7 @@ void HSolveActive::advanceChannels( double dt ) for ( ; ica < caBoundary; ++ica ) { caTable_.row( *ica, *icarowcompt ); - + ++icarowcompt; } @@ -257,9 +257,9 @@ void HSolveActive::advanceChannels( double dt ) chanBoundary = ichan + *ichannelcount; for ( ; ichan < chanBoundary; ++ichan ) { - + caTable_.row( *iextca, dRow ); - + if ( ichan->Xpower_ > 0.0 ) { vTable_.lookup( *icolumn, vRow, C1, C2 ); @@ -287,7 +287,7 @@ void HSolveActive::advanceChannels( double dt ) { double temp = 1.0 + dt / 2.0 * C2; *istate = ( *istate * ( 2.0 - temp ) + dt * C1 ) / temp; - + } ++icolumn, ++istate; } @@ -295,21 +295,21 @@ void HSolveActive::advanceChannels( double dt ) if ( ichan->Zpower_ > 0.0 ) { LookupRow* caRow = *icarow; - + if ( caRow ) { caTable_.lookup( *icolumn, *caRow, C1, C2 ); - + } else if (*iextca >0) - + { caTable_.lookup( *icolumn, dRow, C1, C2 ); } else { vTable_.lookup( *icolumn, vRow, C1, C2 ); - + } //~ *istate = *istate * C1 + C2; @@ -323,7 +323,7 @@ void HSolveActive::advanceChannels( double dt ) } ++icolumn, ++istate, ++icarow; - + } ++iextca; } @@ -365,7 +365,7 @@ void HSolveActive::sendValues( ProcPtr info ) for ( i = outIk_.begin(); i != outIk_.end(); ++i ){ - + unsigned int comptIndex = chan2compt_[ *i ]; assert( comptIndex < V_.size() ); diff --git a/moose-core/hsolve/HSolveActive.h b/moose-core/hsolve/HSolveActive.h index b17741436257b425dd8309e3d400850ad054ebcd..affc85256102626d53b4a5da1bfb7baad578c8df 100644 --- a/moose-core/hsolve/HSolveActive.h +++ b/moose-core/hsolve/HSolveActive.h @@ -132,7 +132,7 @@ protected: * Tells you which compartments have external calcium-dependent * channels so that you can send out Calcium concentrations in only * those compartments. */ - vector< unsigned int > outIk_; + vector< unsigned int > outIk_; private: /** diff --git a/moose-core/hsolve/HSolveActiveSetup.cpp b/moose-core/hsolve/HSolveActiveSetup.cpp index e9a2720788d74a968afd8c772df042d66f77e415..55edc3be10e53dc538cf91cb4951365d00c7b62c 100644 --- a/moose-core/hsolve/HSolveActiveSetup.cpp +++ b/moose-core/hsolve/HSolveActiveSetup.cpp @@ -89,29 +89,29 @@ void HSolveActive::reinitChannels() vector< LookupRow >::iterator icarowcompt; vector< LookupRow* >::iterator icarow = caRow_.begin(); vector< double>::iterator iextca = externalCalcium_.begin(); - + LookupRow vRow; LookupRow dRow; double C1, C2; for ( iv = V_.begin(); iv != V_.end(); ++iv ) { - + vTable_.row( *iv, vRow ); icarowcompt = caRowCompt_.begin(); - + caBoundary = ica + *icacount; for ( ; ica < caBoundary; ++ica ) { caTable_.row( *ica, *icarowcompt ); - + ++icarowcompt; - + } chanBoundary = ichan + *ichannelcount; for ( ; ichan < chanBoundary; ++ichan ) { - + caTable_.row( *iextca, dRow ); if ( ichan->Xpower_ > 0.0 ) @@ -135,7 +135,7 @@ void HSolveActive::reinitChannels() if ( ichan->Zpower_ > 0.0 ) { LookupRow* caRow = *icarow; - + if ( caRow ) { caTable_.lookup( *icolumn, *caRow, C1, C2 ); @@ -260,13 +260,13 @@ void HSolveActive::readCalcium() caCount_.resize( nCompt_ ); unsigned int ichan = 0; - + for ( unsigned int ic = 0; ic < nCompt_; ++ic ) { unsigned int chanBoundary = ichan + channelCount_[ ic ]; unsigned int nCa = caConc_.size(); - + for ( ; ichan < chanBoundary; ++ichan ) { caConcId.clear(); @@ -277,7 +277,7 @@ void HSolveActive::readCalcium() caTargetIndex.push_back( -1 ); nDepend = HSolveUtils::caDepend( channelId_[ ichan ], caConcId ); - + if ( nDepend == 0) // Channel does not depend on calcium. @@ -285,13 +285,13 @@ void HSolveActive::readCalcium() externalCalcium_.push_back(0); - + for ( iconc = caConcId.begin(); iconc != caConcId.end(); ++iconc ) if ( caConcIndex.find( *iconc ) == caConcIndex.end() ) { caConcIndex[ *iconc ] = caCount_[ ic ]; ++caCount_[ ic ]; - + Ca = Field< double >::get( *iconc, "Ca" ); CaBasal = Field< double >::get( *iconc, "CaBasal" ); tau = Field< double >::get( *iconc, "tau" ); @@ -314,13 +314,13 @@ void HSolveActive::readCalcium() caTargetIndex.push_back( caConcIndex[ caConcId.front() ] + nCa ); if ( nDepend != 0 ) caDependIndex_.push_back( caConcIndex[ caConcId.back() ] ); - - + + } } - - - + + + caTarget_.resize( channel_.size() ); ca_.resize( caConc_.size() ); caActivation_.resize( caConc_.size() ); @@ -333,7 +333,7 @@ void HSolveActive::readCalcium() caTarget_[ ichan ] = &caActivation_[ caTargetIndex[ ichan ] ]; } - + } void HSolveActive::createLookupTables() @@ -445,7 +445,7 @@ void HSolveActive::createLookupTables() // *ia = ( 2.0 - dt_ * b ) / ( 2.0 + dt_ * b ); // *ib = dt_ * a / ( 1.0 + dt_ * b / 2.0 ); - // *ia = dt_ * a; + // *ia = dt_ * a; // *ib = 1.0 + dt_ * b / 2.0; ++ia, ++ib; } @@ -462,7 +462,7 @@ void HSolveActive::createLookupTables() //~ for ( int igrid = 0; igrid <= vDiv_; ++igrid ) //~ grid[ igrid ] = vMin_ + igrid * dv; //~ } - + for ( unsigned int ig = 0; ig < vGate.size(); ++ig ) { @@ -495,7 +495,7 @@ void HSolveActive::createLookupTables() for ( unsigned int ig = 0; ig < gateId_.size(); ++ig ) { unsigned int species = gateSpecies[ gateId_[ ig ] ]; - + LookupColumn column; if ( gCaDepend_[ ig ] ) caTable_.column( species, column ); @@ -508,13 +508,13 @@ void HSolveActive::createLookupTables() ///////////////////!!!!!!!!!! unsigned int maxN = *( max_element( caCount_.begin(), caCount_.end() ) ); caRowCompt_.resize( maxN ); - + for ( unsigned int ichan = 0; ichan < channel_.size(); ++ichan ) { if ( channel_[ ichan ].Zpower_ > 0.0 ) { int index = caDependIndex_[ ichan ]; - + if ( index == -1 ) caRow_.push_back( 0 ); else @@ -522,12 +522,12 @@ void HSolveActive::createLookupTables() } } - + } /** * Reads in SynChans and SpikeGens. - * + * * Unlike Compartments, HHChannels, etc., neither of these are zombified. * In other words, their fields are not managed by HSolve, and their "process" * functions are invoked to do their calculations. For SynChans, the process @@ -650,7 +650,7 @@ void HSolveActive::manageOutgoingMessages() filter.clear(); filter.push_back( "CaConc" ); - + for ( unsigned int ik = 0; ik < channelId_.size(); ++ik ) { targets.clear(); @@ -662,14 +662,14 @@ void HSolveActive::manageOutgoingMessages() filter, false // include = false. That is, use filter to exclude. ); - + if ( nTargets ) outIk_.push_back( ik ); - + } - - + + } diff --git a/moose-core/hsolve/HSolvePassive.h b/moose-core/hsolve/HSolvePassive.h index b8d2cd15a9abbd618568726fbdb0f62bca99978c..740b29aee02a2a6a1ab3cb91bc295234457b32fd 100644 --- a/moose-core/hsolve/HSolvePassive.h +++ b/moose-core/hsolve/HSolvePassive.h @@ -22,17 +22,17 @@ class HSolvePassive: public HinesMatrix #ifdef DO_UNIT_TESTS friend void testHSolvePassive(); #endif - + public: void setup( Id seed, double dt ); void solve(); - + protected: // Integration void updateMatrix(); void forwardEliminate(); void backwardSubstitute(); - + vector< CompartmentStruct > compartment_; vector< Id > compartmentId_; vector< double > V_; /**< Compartment Vm. @@ -45,14 +45,14 @@ protected: map< unsigned int, InjectStruct > inject_; /**< inject map. * contains the list of compartments that have current injections into * them. */ - + private: // Setting up of data structures void clear(); void walkTree( Id seed ); void initialize(); void storeTree(); - + // Used for unit tests. double getV( unsigned int row ) const; }; diff --git a/moose-core/hsolve/HSolveStruct.cpp b/moose-core/hsolve/HSolveStruct.cpp index 32e9cef82179975cda030d3391c845213097460e..11daa9e5f0578428606facd6346159cb7c61d6b1 100644 --- a/moose-core/hsolve/HSolveStruct.cpp +++ b/moose-core/hsolve/HSolveStruct.cpp @@ -19,10 +19,10 @@ void ChannelStruct::setPowers( { Xpower_ = Xpower; takeXpower_ = selectPower( Xpower ); - + Ypower_ = Ypower; takeYpower_ = selectPower( Ypower ); - + Zpower_ = Zpower; takeZpower_ = selectPower( Zpower ); } @@ -53,28 +53,28 @@ PFDD ChannelStruct::selectPower( double power ) void ChannelStruct::process( double*& state, CurrentStruct& current ) { double fraction = modulation_; - + if( Xpower_ > 0.0 ) fraction *= takeXpower_( *( state++ ), Xpower_ ); if( Ypower_ > 0.0 ) fraction *= takeYpower_( *( state++ ), Ypower_ ); if( Zpower_ > 0.0 ) fraction *= takeZpower_( *( state++ ), Zpower_ ); - + current.Gk = Gbar_ * fraction; } void SpikeGenStruct::reinit( ProcPtr info ) { SpikeGen* spike = reinterpret_cast< SpikeGen* >( e_.data() ); - + spike->reinit( e_, info ); } void SpikeGenStruct::send( ProcPtr info ) { SpikeGen* spike = reinterpret_cast< SpikeGen* >( e_.data() ); - + spike->handleVm( *Vm_ ); spike->process( e_, info ); } @@ -114,16 +114,16 @@ void CaConcStruct::setCaBasal( double CaBasal ) { * Also updating 'c_' here, so that only 'CaBasal' changes, and 'Ca' * remains the same. This is good because otherwise one has to bother about * the order in which 'setCa()' and 'setCaBasal()' are called. - * + * * 'Ca' is: * Ca = CaBasal_ + c_ - * + * * if: * Ca_new = Ca_old - * + * * then: * CaBasal_new + c_new = CaBasal_old + c_old - * + * * so: * c_new = c_old + CaBasal_old - CaBasal_new */ @@ -138,18 +138,18 @@ void CaConcStruct::setTauB( double tau, double B, double dt ) { double CaConcStruct::process( double activation ) { c_ = factor1_ * c_ + factor2_ * activation; - + double ca = CaBasal_ + c_; - + if ( ceiling_ > 0 && ca > ceiling_ ) { ca = ceiling_; setCa( ca ); } - + if ( ca < floor_ ) { ca = floor_; setCa( ca ); } - + return ca; } diff --git a/moose-core/hsolve/HSolveStruct.h b/moose-core/hsolve/HSolveStruct.h index d7e66b7be1dcadfe24957e3a9d3697703992e15f..8bd361e7e6f8f2e10bc10b6f84640159087500fe 100644 --- a/moose-core/hsolve/HSolveStruct.h +++ b/moose-core/hsolve/HSolveStruct.h @@ -36,13 +36,13 @@ struct InjectStruct injectVarying( 0.0 ), injectBasal( 0.0 ) { ; } - + double injectVarying; double injectBasal; }; /** - * Channel-specific current struct. Used as the structure for the vector + * Channel-specific current struct. Used as the structure for the vector * current_ (in HSolveActive). */ struct CurrentStruct @@ -75,22 +75,22 @@ public: * other multiscale modulation of conductance. */ double modulation_; - + /** * Sets the powers and accordingly sets the takePower_ functions. */ void setPowers( double Xpower, double Ypower, double Zpower ); - + /** * Finds the fraction for each gate by raising the "state" to the * appropriate power. current.Gk is then set to Gbar_ times the * calculated fraction. Note, "current" is a parameter. */ void process( double*& state, CurrentStruct& current ); - + private: static PFDD selectPower( double power ); - + /** The aforementioned clever stuff. */ static double power1( double x, double p ) { return x; @@ -118,10 +118,10 @@ struct SpikeGenStruct Vm_( Vm ), e_( e ) { ; } - + double* Vm_; Eref e_; - + /** Finds the spikegen object using e_ and calls reinit on the spikegen */ void reinit( ProcPtr info ); void send( ProcPtr info ); @@ -142,7 +142,7 @@ struct CaConcStruct double factor2_; double ceiling_; ///> Ceiling and floor for lookup tables double floor_; - + CaConcStruct(); CaConcStruct( double Ca, diff --git a/moose-core/hsolve/HSolveUtils.cpp b/moose-core/hsolve/HSolveUtils.cpp index 777201110890a2573638f992dda3ffeddfbcc2a2..77e0cc108dc882c059c9577c9ec863fd95958a9b 100644 --- a/moose-core/hsolve/HSolveUtils.cpp +++ b/moose-core/hsolve/HSolveUtils.cpp @@ -13,7 +13,7 @@ void HSolveUtils::initialize( Id object ) { //~ ProcInfoBase p; //~ SetConn c( object(), 0 ); - //~ + //~ //~ if ( object()->className() == "Compartment" ) //~ moose::Compartment::reinitFunc( &c, &p ); //~ else if ( object()->className() == "HHChannel" ) @@ -79,13 +79,13 @@ int HSolveUtils::gates( { // dump("HSolveUtils::gates() is not tested with new hsolve api", "FIXME"); unsigned int oldSize = ret.size(); - + static string gateName[] = { string( "gateX[0]" ), string( "gateY[0]" ), string( "gateZ[0]" ) }; - + static string powerField[] = { string( "Xpower" ), string( "Ypower" ), @@ -98,7 +98,7 @@ int HSolveUtils::gates( if ( power > 0.0 ) { // string gatePath = moose::joinPath(channel.path(), gateName[i]); - string gatePath = moose::fixPath( channel.path() ) + + string gatePath = moose::fixPath( channel.path() ) + "/" + gateName[i]; Id gate( gatePath ); @@ -152,7 +152,7 @@ int HSolveUtils::caDepend( Id channel, vector< Id >& ret ) //~ /** //~ * Finds the xmin and xmax for the lookup tables (A and B) belonging to a gate. - //~ * + //~ * //~ * 'min' will be the smaller of the 2 mins. //~ * 'max' will be the greater of the 2 maxs. //~ */ @@ -163,30 +163,30 @@ int HSolveUtils::caDepend( Id channel, vector< Id >& ret ) //~ { //~ Id A; //~ Id B; - //~ + //~ //~ bool success; //~ success = lookupGet< Id, string >( gate(), "lookupChild", A, "A" ); //~ if ( ! success ) { //~ cerr << "Error: Interpol A not found as child of " << gate()->name(); //~ return 0; //~ } - //~ + //~ //~ success = lookupGet< Id, string >( gate(), "lookupChild", B, "B" ); //~ if ( ! success ) { //~ cerr << "Error: Interpol B not found as child of " << gate()->name(); //~ return 0; //~ } - //~ + //~ //~ double Amin, Amax; //~ double Bmin, Bmax; //~ get< double >( A(), "xmin", Amin ); //~ get< double >( A(), "xmax", Amax ); //~ get< double >( B(), "xmin", Bmin ); //~ get< double >( B(), "xmax", Bmax ); - //~ + //~ //~ min = Amin < Bmin ? Amin : Bmin; //~ max = Amax > Bmax ? Amax : Bmax; - //~ + //~ //~ return 1; //~ } @@ -198,7 +198,7 @@ unsigned int HSolveUtils::Grid::size() double HSolveUtils::Grid::entry( unsigned int i ) { assert( i <= divs_ + 1 ); - + return ( min_ + dx_ * i ); } @@ -255,20 +255,20 @@ void HSolveUtils::rates( //~ { //~ Id A; //~ Id B; - //~ + //~ //~ bool success; //~ success = lookupGet< Id, string >( gate(), "lookupChild", A, "A" ); //~ if ( ! success ) { //~ cerr << "Error: Interpol A not found as child of " << gate()->name(); //~ return 0; //~ } - //~ + //~ //~ success = lookupGet< Id, string >( gate(), "lookupChild", B, "B" ); //~ if ( ! success ) { //~ cerr << "Error: Interpol B not found as child of " << gate()->name(); //~ return 0; //~ } - //~ + //~ //~ get< int >( A(), "mode", AMode ); //~ get< int >( B(), "mode", BMode ); //~ return 1; @@ -286,16 +286,16 @@ int HSolveUtils::targets( bool include ) // Default: true { vector< string > filter_v; - + if ( filter != "" ) filter_v.push_back( filter ); - + return targets( object, msg, target, filter_v, include ); } /** - * Appends to 'target' any destination objects of messages of the - * specified name found on the object. + * Appends to 'target' any destination objects of messages of the + * specified name found on the object. * The filter restricts the returns to those objects of the specified class * include is a flag, when false it flips the returns to objects _not_ of * the specified class. @@ -311,14 +311,14 @@ int HSolveUtils::targets( bool include ) // Default: true { unsigned int oldSize = target.size(); - + vector< Id > all; Element* e = object.element(); const Finfo* f = e->cinfo()->findFinfo( msg ); if ( !f ) // Might not find SymCompartment Finfos if it is a Compartment return 0; e->getNeighbors( all, f ); - + vector< Id >::iterator ia; if ( filter.empty() ) target.insert( target.end(), all.begin(), all.end() ); @@ -331,11 +331,11 @@ int HSolveUtils::targets( filter.end(), className ) != filter.end(); - + if ( ( hit && include ) || ( !hit && !include ) ) target.push_back( *ia ); } - + return target.size() - oldSize; } @@ -350,22 +350,22 @@ void testHSolveUtils( ) //TEST_BEGIN; Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); bool success; - + Id n = shell->doCreate( "Neutral", Id(), "n", 1 ); - + /** * First we test the functions which return the compartments linked to a * given compartment: adjacent(), and children(). - * + * * A small tree is created for this: - * + * * c0 * L c1 * L c2 * L c3 * L c4 * L c5 - * + * * (c0 is the parent of c1. c1 is the parent of c2, c3, c4, c5.) */ Id c[ 6 ]; @@ -375,7 +375,7 @@ void testHSolveUtils( ) c[ 3 ] = shell->doCreate( "Compartment", n, "c3", 1 ); c[ 4 ] = shell->doCreate( "Compartment", n, "c4", 1 ); c[ 5 ] = shell->doCreate( "Compartment", n, "c5", 1 ); - + ObjId mid; mid = shell->doAddMsg( "Single", c[ 0 ], "axial", c[ 1 ], "raxial" ); ASSERT( ! mid.bad(), "Linking compartments" ); @@ -387,11 +387,11 @@ void testHSolveUtils( ) ASSERT( ! mid.bad(), "Linking compartments" ); mid = shell->doAddMsg( "Single", c[ 1 ], "axial", c[ 5 ], "raxial" ); ASSERT( ! mid.bad(), "Linking compartments" ); - + vector< Id > found; unsigned int nFound; - - /* + + /* * Testing version 1 of HSolveUtils::adjacent. * It finds all neighbors of given compartment. */ @@ -401,7 +401,7 @@ void testHSolveUtils( ) // c1 is adjacent ASSERT( nFound == 1, "Finding adjacent compartments" ); ASSERT( found[ 0 ] == c[ 1 ], "Finding adjacent compartments" ); - + // Neighbors of c1 found.clear(); nFound = HSolveUtils::adjacent( c[ 1 ], found ); @@ -416,14 +416,14 @@ void testHSolveUtils( ) find( found.begin(), found.end(), c[ i ] ) != found.end(); ASSERT( success, "Finding adjacent compartments" ); } - + // Neighbors of c2 found.clear(); nFound = HSolveUtils::adjacent( c[ 2 ], found ); // c1 is adjacent ASSERT( nFound == 1, "Finding adjacent compartments" ); ASSERT( found[ 0 ] == c[ 1 ], "Finding adjacent compartments" ); - + /* * Testing version 2 of HSolveUtils::adjacent. * It finds all but one neighbors of given compartment. @@ -439,7 +439,7 @@ void testHSolveUtils( ) find( found.begin(), found.end(), c[ i ] ) != found.end(); ASSERT( success, "Finding adjacent compartments" ); } - + // Neighbors of c1 (excluding c2) found.clear(); nFound = HSolveUtils::adjacent( c[ 1 ], c[ 2 ], found ); @@ -454,20 +454,20 @@ void testHSolveUtils( ) find( found.begin(), found.end(), c[ i ] ) != found.end(); ASSERT( success, "Finding adjacent compartments" ); } - + // Neighbors of c2 (excluding c1) found.clear(); nFound = HSolveUtils::adjacent( c[ 2 ], c[ 1 ], found ); // None adjacent, if c1 is excluded ASSERT( nFound == 0, "Finding adjacent compartments" ); - + // Neighbors of c2 (excluding c3) found.clear(); nFound = HSolveUtils::adjacent( c[ 2 ], c[ 3 ], found ); // c1 is adjacent, while c3 is not even connected ASSERT( nFound == 1, "Finding adjacent compartments" ); ASSERT( found[ 0 ] == c[ 1 ], "Finding adjacent compartments" ); - + /* * Testing HSolveUtils::children. * It finds all compartments which are dests for the "axial" message. @@ -478,7 +478,7 @@ void testHSolveUtils( ) ASSERT( nFound == 1, "Finding child compartments" ); // c1 is a child ASSERT( found[ 0 ] == c[ 1 ], "Finding child compartments" ); - + // Children of c1 found.clear(); nFound = HSolveUtils::children( c[ 1 ], found ); @@ -489,13 +489,13 @@ void testHSolveUtils( ) find( found.begin(), found.end(), c[ i ] ) != found.end(); ASSERT( success, "Finding child compartments" ); } - + // Children of c2 found.clear(); nFound = HSolveUtils::children( c[ 2 ], found ); // c2 has no children ASSERT( nFound == 0, "Finding child compartments" ); - + // Clean up shell->doDelete( n ); cout << "." << flush; diff --git a/moose-core/hsolve/RateLookup.cpp b/moose-core/hsolve/RateLookup.cpp index 4845b5b100e14d07b23360a7af926ac7580cef2c..4a72dd3a1544b4b1888957a412cb4fdee1fa0ee3 100644 --- a/moose-core/hsolve/RateLookup.cpp +++ b/moose-core/hsolve/RateLookup.cpp @@ -23,7 +23,7 @@ LookupTable::LookupTable( dx_ = ( max - min ) / nDivs; // Every row has 2 entries for each type of gate nColumns_ = 2 * nSpecies; - + //~ interpolate_.resize( nSpecies ); table_.resize( nPts_ * nColumns_ ); } @@ -42,14 +42,14 @@ void LookupTable::addColumns( for ( unsigned int igrid = 0; igrid < nPts_ - 1 ; ++igrid ) { *( iTable ) = *ic1; *( iTable + 1 ) = *ic2; - + iTable += nColumns_; ++ic1, ++ic2; } // Then duplicate the last point *( iTable ) = C1.back(); *( iTable + 1 ) = C2.back(); - + //~ interpolate_[ species ] = interpolate; } @@ -65,10 +65,10 @@ void LookupTable::row( double x, LookupRow& row ) x = min_; else if ( x > max_ ) x = max_; - + double div = ( x - min_ ) / dx_; unsigned int integer = ( unsigned int )( div ); - + row.fraction = div - integer; row.row = &( table_.front() ) + integer * nColumns_; } @@ -81,22 +81,22 @@ void LookupTable::lookup( { double a, b; double *ap, *bp; - + ap = row.row + column.column; - + //~ if ( ! column.interpolate ) { //~ C1 = *ap; //~ C2 = *( ap + 1 ); - //~ + //~ //~ return; //~ } - + bp = ap + nColumns_; - + a = *ap; b = *bp; C1 = a + ( b - a ) * row.fraction; - + a = *( ap + 1 ); b = *( bp + 1 ); C2 = a + ( b - a ) * row.fraction; diff --git a/moose-core/hsolve/RateLookup.h b/moose-core/hsolve/RateLookup.h index 6b1930b7728e4363c2fe380e9884d96dc3daf8cb..6b9c640bd55d70dd1f9fcb15b133302fde63f0d5 100644 --- a/moose-core/hsolve/RateLookup.h +++ b/moose-core/hsolve/RateLookup.h @@ -28,13 +28,13 @@ class LookupTable { public: LookupTable() { ; } - + LookupTable( double min, ///< min of range double max, ///< max of range unsigned int nDivs, ///< number of divisions (~ no. of rows) unsigned int nSpecies ); ///< number of species (no. of columns / 2) - + /// Adds the columns for a given species. Columns supplied are C1 and C2 void addColumns( int species, @@ -42,11 +42,11 @@ public: const vector< double >& C2 ); //~ const vector< double >& C2, //~ bool interpolate ); - + void column( unsigned int species, LookupColumn& column ); - + /** * Returns the row corresponding to x in the "row" parameter. * i.e., returns the leftover fraction and the row's start address. @@ -54,14 +54,14 @@ public: void row( double x, LookupRow& row ); - + /// Actually performs the lookup and the linear interpolation void lookup( const LookupColumn& column, const LookupRow& row, double& C1, double& C2 ); - + private: //~ vector< bool > interpolate_; vector< double > table_; ///< Flattened table diff --git a/moose-core/hsolve/TestHSolve.h b/moose-core/hsolve/TestHSolve.h index 947a786b531a170f04165e56a4e3418880c6152b..ce96120cb70437cbc8ca0cd041b31c8dfef93b55 100644 --- a/moose-core/hsolve/TestHSolve.h +++ b/moose-core/hsolve/TestHSolve.h @@ -21,12 +21,12 @@ void permute( const vector< unsigned int >& permutation ) { assert( g.size() == permutation.size() ); - + vector< T > copy( g.size() ); - + for ( unsigned int i = 0; i < g.size(); i++ ) copy[ permutation[ i ] ] = g[ i ]; - + for ( unsigned int i = 0; i < g.size(); i++ ) g[ i ] = copy[ i ]; } diff --git a/moose-core/hsolve/ZombieCaConc.cpp b/moose-core/hsolve/ZombieCaConc.cpp index 0e5a8bf94e69a78bfade6bd161fb7f7e2fc4bd9c..e7d18d2c4a35a91f2a4735ce92e50aafd99ad35c 100644 --- a/moose-core/hsolve/ZombieCaConc.cpp +++ b/moose-core/hsolve/ZombieCaConc.cpp @@ -27,7 +27,7 @@ const Cinfo* ZombieCaConc::initCinfo() "Description", "ZombieCaConc: Calcium concentration pool. Takes current from a " "channel and keeps track of calcium buildup and depletion by a " "single exponential process. ", - }; + }; static Dinfo< ZombieCaConc > dinfo; static Cinfo zombieCaConcCinfo( "ZombieCaConc", @@ -38,7 +38,7 @@ const Cinfo* ZombieCaConc::initCinfo() doc, sizeof( doc )/ sizeof( string ) ); - + return &zombieCaConcCinfo; } /////////////////////////////////////////////////// diff --git a/moose-core/hsolve/ZombieHHChannel.h b/moose-core/hsolve/ZombieHHChannel.h index c2d285a35af5bc651bce8510e64b767211038ae6..756a2eaab05b85122d3cfeaa57b4beeb69615b54 100644 --- a/moose-core/hsolve/ZombieHHChannel.h +++ b/moose-core/hsolve/ZombieHHChannel.h @@ -80,7 +80,7 @@ public: */ void vSetUseConcentration( const Eref& e, int value ); // implemented in baseclass: int getUseConcentration() const; - + void vSetModulation( const Eref& e, double value ); ///////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ public: void vReinit( const Eref& e, ProcPtr p ); void vHandleConc( const Eref& e, double value); void vCreateGate(const Eref& e , string name); - + ///////////////////////////////////////////////////////////// // Dummy function, not needed in Zombie. void vHandleVm( double Vm ); diff --git a/moose-core/hsolve/testHSolve.cpp b/moose-core/hsolve/testHSolve.cpp index 98eaace7534605b4c7c6bb66f92f5460c03d8ac5..598d72c6f27d5982dd9a9bc1e84486864c08ead2 100644 --- a/moose-core/hsolve/testHSolve.cpp +++ b/moose-core/hsolve/testHSolve.cpp @@ -40,7 +40,7 @@ void makeFullMatrix( vector< vector< double > >& matrix ) { unsigned int size = tree.size(); - + /* * Some convenience variables */ @@ -50,7 +50,7 @@ void makeFullMatrix( CmByDt.push_back( tree[ i ].Cm / ( dt / 2.0 ) ); Ga.push_back( 2.0 / tree[ i ].Ra ); } - + /* Each entry in 'coupled' is a list of electrically coupled compartments. * These compartments could be linked at junctions, or even in linear segments * of the cell. @@ -61,45 +61,45 @@ void makeFullMatrix( coupled.push_back( tree[ i ].children ); coupled.back().push_back( i ); } - + matrix.clear(); matrix.resize( size ); for ( unsigned int i = 0; i < size; ++i ) matrix[ i ].resize( size ); - + // Setting diagonal elements for ( unsigned int i = 0; i < size; i++ ) matrix[ i ][ i ] = CmByDt[ i ] + 1.0 / tree[ i ].Rm; - + double gi; vector< vector< unsigned int > >::iterator group; vector< unsigned int >::iterator ic; for ( group = coupled.begin(); group != coupled.end(); ++group ) { double gsum = 0.0; - + for ( ic = group->begin(); ic != group->end(); ++ic ) gsum += Ga[ *ic ]; - + for ( ic = group->begin(); ic != group->end(); ++ic ) { gi = Ga[ *ic ]; - + matrix[ *ic ][ *ic ] += gi * ( 1.0 - gi / gsum ); } } - + // Setting off-diagonal elements double gij; vector< unsigned int >::iterator jc; for ( group = coupled.begin(); group != coupled.end(); ++group ) { double gsum = 0.0; - + for ( ic = group->begin(); ic != group->end(); ++ic ) gsum += Ga[ *ic ]; - + for ( ic = group->begin(); ic != group->end() - 1; ++ic ) { for ( jc = ic + 1; jc != group->end(); ++jc ) { gij = Ga[ *ic ] * Ga[ *jc ] / gsum; - + matrix[ *ic ][ *jc ] = -gij; matrix[ *jc ][ *ic ] = -gij; } diff --git a/moose-core/intfire/IntFireBase.cpp b/moose-core/intfire/IntFireBase.cpp index 870a311ad1a8592fd07128b64091b0f10d8fe3c2..a4364db48894e3dbb98105963f8311cb692d025e 100644 --- a/moose-core/intfire/IntFireBase.cpp +++ b/moose-core/intfire/IntFireBase.cpp @@ -15,8 +15,8 @@ using namespace moose; SrcFinfo1< double >* IntFireBase::spikeOut() { - static SrcFinfo1< double > spikeOut( - "spikeOut", + static SrcFinfo1< double > spikeOut( + "spikeOut", "Sends out spike events. The argument is the timestamp of " "the spike. " ); diff --git a/moose-core/intfire/IntFireBase.h b/moose-core/intfire/IntFireBase.h index 1bddef512a14b2ac47b2e7138737350af8319558..c17dbdcabf6f62ae9ccf66565b45b1daa9660aa0 100644 --- a/moose-core/intfire/IntFireBase.h +++ b/moose-core/intfire/IntFireBase.h @@ -49,7 +49,7 @@ class IntFireBase: public Compartment * to the intFire. */ void activation( double val ); - + /// Message src for outgoing spikes. static SrcFinfo1< double >* spikeOut(); diff --git a/moose-core/intfire/QIF.h b/moose-core/intfire/QIF.h index 53c2b26a75e8a235e7e3edf32ae3f317eff3407b..e8bc6917976561b3892414d163cea6b3adf9096f 100644 --- a/moose-core/intfire/QIF.h +++ b/moose-core/intfire/QIF.h @@ -23,7 +23,7 @@ class QIF: public IntFireBase public: QIF(); virtual ~QIF(); - + void setVCritical( const Eref& e, double val ); double getVCritical( const Eref& e ) const; void setA0( const Eref& e, double val ); diff --git a/moose-core/kinetics/BufPool.h b/moose-core/kinetics/BufPool.h index d475c12d0c688e8c9a4d3dcff2d1b87bd244086e..45b401e71bfab50b73d7730c22994b159e1f73eb 100644 --- a/moose-core/kinetics/BufPool.h +++ b/moose-core/kinetics/BufPool.h @@ -12,7 +12,7 @@ class BufPool: public Pool { - public: + public: BufPool(); ~BufPool(); diff --git a/moose-core/kinetics/CMakeLists.txt b/moose-core/kinetics/CMakeLists.txt index c3e979ccfe971cff3000b30e6470e4202ae0d39b..403f360349e71b083dd0d10c3383c4eae0a96945 100644 --- a/moose-core/kinetics/CMakeLists.txt +++ b/moose-core/kinetics/CMakeLists.txt @@ -1,19 +1,19 @@ include_directories(../msg) include_directories(../basecode ../utility) add_library(kinetics - PoolBase.cpp - Pool.cpp - BufPool.cpp - ReacBase.cpp - Reac.cpp - EnzBase.cpp - CplxEnzBase.cpp - Enz.cpp - MMenz.cpp - Species.cpp - ReadKkit.cpp - WriteKkit.cpp - ReadCspace.cpp - lookupVolumeFromMesh.cpp - testKinetics.cpp + PoolBase.cpp + Pool.cpp + BufPool.cpp + ReacBase.cpp + Reac.cpp + EnzBase.cpp + CplxEnzBase.cpp + Enz.cpp + MMenz.cpp + Species.cpp + ReadKkit.cpp + WriteKkit.cpp + ReadCspace.cpp + lookupVolumeFromMesh.cpp + testKinetics.cpp ) diff --git a/moose-core/kinetics/CplxEnzBase.h b/moose-core/kinetics/CplxEnzBase.h index 43b08a4b18e7a8f569d23ee535b7a32d17aae005..1da3f5aa53e751f1a2c3dfd48abc08f3d504f144 100644 --- a/moose-core/kinetics/CplxEnzBase.h +++ b/moose-core/kinetics/CplxEnzBase.h @@ -17,7 +17,7 @@ */ class CplxEnzBase: public EnzBase { - public: + public: CplxEnzBase(); virtual ~CplxEnzBase(); diff --git a/moose-core/kinetics/Enz.h b/moose-core/kinetics/Enz.h index e67aac2e8122fc2e45135417c3337b37bb847290..1efd403109c6e54d6b8d51bacfae899b0a29cd96 100644 --- a/moose-core/kinetics/Enz.h +++ b/moose-core/kinetics/Enz.h @@ -12,7 +12,7 @@ class Enz: public CplxEnzBase { - public: + public: Enz(); ~Enz(); diff --git a/moose-core/kinetics/EnzBase.h b/moose-core/kinetics/EnzBase.h index b5a3f9c219812fc21bbd5b384fe3574959c72953..791e05322e327fb7a1827d755d2dfec720e1323f 100644 --- a/moose-core/kinetics/EnzBase.h +++ b/moose-core/kinetics/EnzBase.h @@ -17,7 +17,7 @@ */ class EnzBase { - public: + public: EnzBase(); virtual ~EnzBase(); @@ -65,7 +65,7 @@ class EnzBase ////////////////////////////////////////////////////////////////// // Zombification functions. ////////////////////////////////////////////////////////////////// - static void zombify( Element* original, const Cinfo* zClass, + static void zombify( Element* original, const Cinfo* zClass, Id solver ); /// Assign solver info virtual void setSolver( Id solver, Id orig ); diff --git a/moose-core/kinetics/MMenz.cpp b/moose-core/kinetics/MMenz.cpp index 9e10f5232bce8ce1cd3e03d9bb9c7a30e570481a..8b396ceb107d74c824ffda06067c97ce3d6ec28c 100644 --- a/moose-core/kinetics/MMenz.cpp +++ b/moose-core/kinetics/MMenz.cpp @@ -42,11 +42,11 @@ const Cinfo* MMenz::initCinfo() static const Cinfo* mmEnzCinfo = MMenz::initCinfo(); -static const SrcFinfo2< double, double >* subOut = +static const SrcFinfo2< double, double >* subOut = dynamic_cast< const SrcFinfo2< double, double >* >( mmEnzCinfo->findFinfo( "subOut" ) ); -static const SrcFinfo2< double, double >* prdOut = +static const SrcFinfo2< double, double >* prdOut = dynamic_cast< const SrcFinfo2< double, double >* >( mmEnzCinfo->findFinfo( "prdOut" ) ); @@ -84,7 +84,7 @@ void MMenz::vProcess( const Eref& e, ProcPtr p ) double rate = kcat_ * enz_ * sub_ / ( numKm_ + sub_ ); subOut->send( e, 0, rate ); prdOut->send( e, rate, 0 ); - + sub_ = 1.0; } diff --git a/moose-core/kinetics/MMenz.h b/moose-core/kinetics/MMenz.h index 52a3879d793f12497ce094e9edb085670c43a68b..bc4ba5a9507f18e040e59b5a0848d016def54718 100644 --- a/moose-core/kinetics/MMenz.h +++ b/moose-core/kinetics/MMenz.h @@ -17,7 +17,7 @@ */ class MMenz: public EnzBase { - public: + public: MMenz(); virtual ~MMenz(); diff --git a/moose-core/kinetics/Pool.h b/moose-core/kinetics/Pool.h index dec4dfa4f136057f79545254448ff89fa2d53227..d55696aae486670b864fe1226693317ddf05470a 100644 --- a/moose-core/kinetics/Pool.h +++ b/moose-core/kinetics/Pool.h @@ -11,14 +11,14 @@ #define _POOL_H #include "PoolBase.h" /** - * The Pool class is a molecular pool. This is a set of molecules of a + * The Pool class is a molecular pool. This is a set of molecules of a * given species, in a uniform chemical context. Note that the same * species might be present in other compartments, or be handled by * other solvers. */ class Pool: public PoolBase { - public: + public: Pool(); ~Pool(); @@ -61,7 +61,7 @@ class Pool: public PoolBase bool getIsBuffered( const Eref& e ) const; ////////////////////////////////////////////////////////////////// - // Dest funcs. These too override virtual funcs in the Pool base + // Dest funcs. These too override virtual funcs in the Pool base // class. ////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ class Pool: public PoolBase * System wide identifier for all mol pools that are chemically * the same species. */ - unsigned int species_; + unsigned int species_; }; #endif // _POOL_H diff --git a/moose-core/kinetics/PoolBase.h b/moose-core/kinetics/PoolBase.h index ace7ae86924b2b0680a837501d6aea5ff2942591..3821569ab7cfa84050472e23034199115a69da08 100644 --- a/moose-core/kinetics/PoolBase.h +++ b/moose-core/kinetics/PoolBase.h @@ -13,17 +13,17 @@ /** * SpeciesId identifies molecular species. This is a unique identifier for * any given molecular species, regardless of which compartment or solver - * is handling it. + * is handling it. */ typedef unsigned int SpeciesId; extern const SpeciesId DefaultSpeciesId; /** - * The PoolBase class is the base class for molecular pools. - * A pool is a set of molecules of a + * The PoolBase class is the base class for molecular pools. + * A pool is a set of molecules of a * given species, in a uniform chemical context. Note that the same * species might be present in other compartments, or be handled by - * other solvers. + * other solvers. * PoolBase is the base class for mass-action, single particle * and other numerical variants of pools. */ @@ -34,7 +34,7 @@ class PoolBase friend void checkVal( double time, const PoolBase* m, unsigned int size ); friend void forceCheckVal( double time, Element* e, unsigned int size ); - public: + public: PoolBase(); virtual ~PoolBase(); @@ -68,9 +68,9 @@ class PoolBase void setSpecies( const Eref& e, SpeciesId v ); SpeciesId getSpecies( const Eref& e ) const; - + ////////////////////////////////////////////////////////////////// - // Here are the inner virtual funcs for fields. + // Here are the inner virtual funcs for fields. // All these are pure virtual ////////////////////////////////////////////////////////////////// @@ -98,13 +98,13 @@ class PoolBase * nothing. */ virtual void vSetSolver( Id ksolve, Id dsolve ); - + ////////////////////////////////////////////////////////////////// /** - * zombify is the base function for conversion between pool - * subclasses. This can be overridden, but should work for most + * zombify is the base function for conversion between pool + * subclasses. This can be overridden, but should work for most * things. This takes the original Element, and without touching - * its messaging, replaces it with a new data object of the + * its messaging, replaces it with a new data object of the * specified zClass. It does the best it can with conversion of * fields. Typically needs to be followed by rescheduling and * possibly a class-specific function for assigning further @@ -116,7 +116,7 @@ class PoolBase * carried out to strip an object of independent function, and * replace it with a solver-controlled facsimile. */ - static void zombify( Element* original, const Cinfo* zClass, + static void zombify( Element* original, const Cinfo* zClass, Id ksolve, Id dsolve ); ////////////////////////////////////////////////////////////////// @@ -141,7 +141,7 @@ class PoolBase static const Cinfo* initCinfo(); private: double concInit_; /// Initial concentration. - // We don't store the conc here as this is computed on the fly + // We don't store the conc here as this is computed on the fly // by derived classes. But the PoolBase::concInit is authoritative. }; diff --git a/moose-core/kinetics/Reac.cpp b/moose-core/kinetics/Reac.cpp index 0f680cd536bf346b2d05440fd6df91831c36cb54..7e3bc72dc68b069990837650019cc34b88f8c0a0 100644 --- a/moose-core/kinetics/Reac.cpp +++ b/moose-core/kinetics/Reac.cpp @@ -40,11 +40,11 @@ const Cinfo* Reac::initCinfo() static const Cinfo* reacCinfo = Reac::initCinfo(); -static const SrcFinfo2< double, double >* subOut = +static const SrcFinfo2< double, double >* subOut = dynamic_cast< const SrcFinfo2< double, double >* >( reacCinfo->findFinfo( "subOut" ) ); -static const SrcFinfo2< double, double >* prdOut = +static const SrcFinfo2< double, double >* prdOut = dynamic_cast< const SrcFinfo2< double, double >* >( reacCinfo->findFinfo( "prdOut" ) ); @@ -86,7 +86,7 @@ void Reac::vProcess( const Eref& e, ProcPtr p ) { prdOut->send( e, sub_, prd_ ); subOut->send( e, prd_, sub_ ); - + sub_ = kf_; prd_ = kb_; } @@ -95,7 +95,7 @@ void Reac::vReinit( const Eref& e, ProcPtr p ) { sub_ = kf_ = concKf_ / convertConcToNumRateUsingMesh( e, subOut, 0 ); - prd_ = kb_ = concKb_ / + prd_ = kb_ = concKb_ / convertConcToNumRateUsingMesh( e, prdOut, 0 ); } diff --git a/moose-core/kinetics/Reac.h b/moose-core/kinetics/Reac.h index b45ea13f7b2b633d4b333ed8461357a6b8e91182..52ccff14b2045fe64a15d53e8562543d23e1f8c2 100644 --- a/moose-core/kinetics/Reac.h +++ b/moose-core/kinetics/Reac.h @@ -12,7 +12,7 @@ class Reac: public ReacBase { - public: + public: Reac(); // Reac( double kf, double kb ); diff --git a/moose-core/kinetics/ReacBase.cpp b/moose-core/kinetics/ReacBase.cpp index ff311b2f52c7d78cf3b800d24614d2d7c5e11221..0d3273d12d0d729f558a6bdbed39c4428418146a 100644 --- a/moose-core/kinetics/ReacBase.cpp +++ b/moose-core/kinetics/ReacBase.cpp @@ -15,16 +15,16 @@ #define EPSILON 1e-15 static SrcFinfo2< double, double > *subOut() { - static SrcFinfo2< double, double > subOut( - "subOut", + static SrcFinfo2< double, double > subOut( + "subOut", "Sends out increment of molecules on product each timestep" ); return &subOut; } static SrcFinfo2< double, double > *prdOut() { - static SrcFinfo2< double, double > prdOut( - "prdOut", + static SrcFinfo2< double, double > prdOut( + "prdOut", "Sends out increment of molecules on product each timestep" ); return &prdOut; @@ -130,7 +130,7 @@ const Cinfo* ReacBase::initCinfo() &proc, // SharedFinfo }; - static string doc[] = + static string doc[] = { "Name", "ReacBase", "Author", "Upinder S. Bhalla, 2012, NCBS", @@ -277,7 +277,7 @@ double ReacBase::getConcKb( const Eref& e ) const unsigned int ReacBase::getNumSub( const Eref& e ) const { - const vector< MsgFuncBinding >* mfb = + const vector< MsgFuncBinding >* mfb = e.element()->getMsgAndFunc( subOut()->getBindIndex() ); assert( mfb ); return ( mfb->size() ); @@ -285,7 +285,7 @@ unsigned int ReacBase::getNumSub( const Eref& e ) const unsigned int ReacBase::getNumPrd( const Eref& e ) const { - const vector< MsgFuncBinding >* mfb = + const vector< MsgFuncBinding >* mfb = e.element()->getMsgAndFunc( prdOut()->getBindIndex() ); assert( mfb ); return ( mfb->size() ); @@ -308,7 +308,7 @@ void ReacBase::zombify( Element* orig, const Cinfo* zClass, Id solver ) vector< double > concKb( num, 0.0 ); for ( unsigned int i = 0; i < num; ++i ) { Eref er( orig, i + start ); - const ReacBase* rb = + const ReacBase* rb = reinterpret_cast< const ReacBase* >( er.data() ); concKf[ i ] = rb->getConcKf( er ); concKb[ i ] = rb->getConcKb( er ); diff --git a/moose-core/kinetics/ReacBase.h b/moose-core/kinetics/ReacBase.h index 619c1b137165d75fda8238b3abb289b2a0209413..28dabfeffcc0fbeda0cdd3df7cf0091eeeb73a32 100644 --- a/moose-core/kinetics/ReacBase.h +++ b/moose-core/kinetics/ReacBase.h @@ -12,7 +12,7 @@ class ReacBase { - public: + public: ReacBase(); virtual ~ReacBase(); @@ -58,7 +58,7 @@ class ReacBase /** * Zombification functions. */ - static void zombify( Element* original, const Cinfo* zClass, + static void zombify( Element* original, const Cinfo* zClass, Id solver ); /// Assign solver info virtual void setSolver( Id solver, Id orig ); diff --git a/moose-core/kinetics/ReadCspace.h b/moose-core/kinetics/ReadCspace.h index dc96b018025516d7d528bebe2a9c64939e1f103a..35fbe5af99e66f0f2fac067304d5b039a150fcb8 100644 --- a/moose-core/kinetics/ReadCspace.h +++ b/moose-core/kinetics/ReadCspace.h @@ -10,7 +10,7 @@ #ifndef _READCSPACE_H #define _READCSPACE_H -class CspaceMolInfo +class CspaceMolInfo { public: CspaceMolInfo( char name, double conc ) @@ -37,18 +37,18 @@ class CspaceMolInfo double conc_; }; -class CspaceReacInfo +class CspaceReacInfo { public: CspaceReacInfo( const string& name, double r1, double r2 ) : name_( name ), r1_( r1 ), r2_( r2 ) { - ; + ; } CspaceReacInfo( ) : name_( "" ), r1_( 0.1 ), r2_( 0.1 ) { - ; + ; } bool operator<( const CspaceReacInfo& other ) const @@ -78,7 +78,7 @@ class ReadCspace void printHeader(); void printFooter(); - + void printMol(Id id, double conc, double concinit, double vol); @@ -92,15 +92,15 @@ class ReadCspace void makePlots( double plotdt ); void build( const char* name ); - void expandEnzyme( + void expandEnzyme( const char* name, int e, int s, int p, int p2 = 0); void expandReaction( const char* name, int nm1 ); void deployParameters(); void testReadModel( ); - void makeMolecule( char name ); - + void makeMolecule( char name ); + private: static const double SCALE; static const double DEFAULT_CONC; diff --git a/moose-core/kinetics/ReadKkit.h b/moose-core/kinetics/ReadKkit.h index ade1bec3d65794d862aaf4eace3a1ed81f9b775d..8e171fc64fa9de30df7781227abf4cdd2fa141b4 100644 --- a/moose-core/kinetics/ReadKkit.h +++ b/moose-core/kinetics/ReadKkit.h @@ -27,7 +27,7 @@ */ class ReadKkit { - public: + public: enum ParseMode { DATA, INIT, @@ -51,10 +51,10 @@ class ReadKkit ////////////////////////////////////////////////////////////////// // Undump operations ////////////////////////////////////////////////////////////////// - + void innerRead( ifstream& fin ); ParseMode readInit( const string& line ); - Id read( const string& filename, const string& cellname, + Id read( const string& filename, const string& cellname, Id parent, const string& solverClass = "Stoich" ); void readData( const string& line ); void undump( const vector< string >& args ); @@ -62,7 +62,7 @@ class ReadKkit /** * This function sets up the kkit model for a run using the GSL, * which means numerical integration using the GSL, all the plots - * specified by the kkit file, and the timestep for plots as + * specified by the kkit file, and the timestep for plots as * specified by the kkit file. */ // void setupGslRun(); @@ -86,7 +86,7 @@ class ReadKkit Id buildGeometry( const vector< string >& args ); Id buildStim( const vector< string >& args ); Id buildChan( const vector< string >& args ); - Id buildInfo( Id parent, map< string, int >& m, + Id buildInfo( Id parent, map< string, int >& m, const vector< string >& args ); void buildSumTotal( const string& src, const string& dest ); /** @@ -100,10 +100,10 @@ class ReadKkit ////////////////////////////////////////////////////////////////// void addmsg( const vector< string >& args ); void setupSlaveMsg( const string& src, const string& dest ); - void innerAddMsg( - const string& src, const map< string, Id >& m1, + void innerAddMsg( + const string& src, const map< string, Id >& m1, const string& srcMsg, - const string& dest, const map< string, Id >& m2, + const string& dest, const map< string, Id >& m2, const string& destMsg, bool isBackward = 0 ); void call( const vector< string >& args ); @@ -117,7 +117,7 @@ class ReadKkit * compartments in which one or more of their reactants resides. * Thus, if any of these compartments changes volume, the Reac will * be informed. - */ + */ void assignReacCompartments(); void assignEnzCompartments(); void assignMMenzCompartments(); @@ -148,7 +148,7 @@ class ReadKkit void convertMMenzRatesToConcUnits(); /** - * Convert regular Enz rates. Binding step k1 has similar issues + * Convert regular Enz rates. Binding step k1 has similar issues * as reac rates. k2 and k3 are both in units of 1/time, so OK. */ void convertEnzRatesToConcUnits(); @@ -156,9 +156,9 @@ class ReadKkit ////////////////////////////////////////////////////////////////// // Utility functions ////////////////////////////////////////////////////////////////// - + /** - * Splits up kkit path into head and tail portions, + * Splits up kkit path into head and tail portions, * tail is returned. * Note that this prepends the basePath to the head. */ @@ -168,7 +168,7 @@ class ReadKkit * Utility function. Cleans up path strings. In most cases, it * replaces things with underscores. * Replaces square braces with underscores. - * Replaces '*' with 'p' + * Replaces '*' with 'p' * as it is usually there to indicate phosphorylation * Replaces '-' with underscore * Replaces '@' with underscore @@ -198,7 +198,7 @@ class ReadKkit * just go onto same compt as substrate. * Defaults to false. */ - bool moveOntoCompartment_; + bool moveOntoCompartment_; unsigned int numCompartments_; unsigned int numPools_; diff --git a/moose-core/kinetics/Species.cpp b/moose-core/kinetics/Species.cpp index 44c5754846f9c66ef99e957fadc193e74e681c3f..1d579f9f7222ba4658b296254cb1966bd6d9c990 100644 --- a/moose-core/kinetics/Species.cpp +++ b/moose-core/kinetics/Species.cpp @@ -11,8 +11,8 @@ #include "Species.h" static SrcFinfo1< double > *molWtOut() { - static SrcFinfo1< double > molWtOut( - "molWtOut", + static SrcFinfo1< double > molWtOut( + "molWtOut", "returns molWt." ); return &molWtOut; diff --git a/moose-core/kinetics/Species.h b/moose-core/kinetics/Species.h index 7f63c7d1c901bffa796afdfc0b594b3bcc6c3a04..cb35031afcc3fca5d3bed9f77f6f7660fae6a3c0 100644 --- a/moose-core/kinetics/Species.h +++ b/moose-core/kinetics/Species.h @@ -18,7 +18,7 @@ */ class Species { - public: + public: Species(); ////////////////////////////////////////////////////////////////// // Field assignment stuff diff --git a/moose-core/kinetics/lookupVolumeFromMesh.h b/moose-core/kinetics/lookupVolumeFromMesh.h index ce250523223336ff3a0be07df39a866e3f8fa3fd..b06213e202730675e7729306427c9d716b43a4bf 100644 --- a/moose-core/kinetics/lookupVolumeFromMesh.h +++ b/moose-core/kinetics/lookupVolumeFromMesh.h @@ -26,7 +26,7 @@ double lookupVolumeFromMesh( const Eref& e ); * products) of Reacs or Enzymes. Does NOT get volumes for the Enzyme * itself. */ -unsigned int getReactantVols( const Eref& reac, const SrcFinfo* pools, +unsigned int getReactantVols( const Eref& reac, const SrcFinfo* pools, vector< double >& vols ); /** @@ -46,7 +46,7 @@ unsigned int getReactantVols( const Eref& reac, const SrcFinfo* pools, * substrates not in the 'pools' list, and so it should compute the * conversion for all pools, not n-1. This flag defaults to 0. */ -double convertConcToNumRateUsingMesh( const Eref& e, const SrcFinfo* pools, +double convertConcToNumRateUsingMesh( const Eref& e, const SrcFinfo* pools, bool doPartialConversion ); /** @@ -61,7 +61,7 @@ double convertConcToNumRateUsingMesh( const Eref& e, const SrcFinfo* pools, * substrates not in the 'pools' list, and so it should compute the * conversion for all pools, not n-1. This flag defaults to 0. */ -double convertConcToNumRateUsingVol( const Eref& e, const SrcFinfo* pools, +double convertConcToNumRateUsingVol( const Eref& e, const SrcFinfo* pools, double volume, double scale, bool doPartialConversion ); /** @@ -77,7 +77,7 @@ double convertConcToNumRateUsingVol( const Eref& e, const SrcFinfo* pools, * equal to moles per cubic metre, which is equal to millimolar. * The scale term is 1e-3 for micromolar, uM. */ -double convertConcToNumRateInTwoCompts( double v1, unsigned int n1, +double convertConcToNumRateInTwoCompts( double v1, unsigned int n1, double v2, unsigned int n2, double scale ); /** diff --git a/moose-core/kinetics/testKinetics.cpp b/moose-core/kinetics/testKinetics.cpp index ca011ed19d2ac9c6b45087bf9a8c347acce46b83..b63e099c80be968979708a733e550dda6ebf54d0 100644 --- a/moose-core/kinetics/testKinetics.cpp +++ b/moose-core/kinetics/testKinetics.cpp @@ -44,7 +44,7 @@ void testPoolVolumeScaling() Id meshId( comptId.value() + 1 ); Id poolId = shell->doCreate( "Pool", comptId, "pool", 1 ); - ObjId mid = shell->doAddMsg( "OneToOne", + ObjId mid = shell->doAddMsg( "OneToOne", ObjId( poolId, 0 ), "requestVolume", ObjId( meshId, 0 ), "get_volume" ); @@ -95,10 +95,10 @@ void testReacVolumeScaling() double vol1 = 1e-15; - ObjId mid = shell->doAddMsg( "OneToOne", + ObjId mid = shell->doAddMsg( "OneToOne", subId, "requestVolume", meshId, "get_volume" ); assert( mid != ObjId() ); - mid = shell->doAddMsg( "OneToOne", + mid = shell->doAddMsg( "OneToOne", prdId, "requestVolume", meshId, "get_volume" ); assert( mid != ObjId() ); @@ -121,7 +121,7 @@ void testReacVolumeScaling() assert( doubleEq( x, 2 ) ); x = Field< double >::get( reacId, "kb" ); assert( doubleEq( x, 3 ) ); - + ret = shell->doAddMsg( "Single", reacId, "sub", subId, "reac" ); assert( ret != ObjId() ); double conv = 1.0 / ( NA * vol1 ); @@ -153,10 +153,10 @@ void testTwoReacGetNeighbors() Id prdId = shell->doCreate( "Pool", comptId, "prd", 1 ); Id reacId = shell->doCreate( "Reac", comptId, "reac", 1 ); - ObjId mid = shell->doAddMsg( "OneToOne", + ObjId mid = shell->doAddMsg( "OneToOne", subId, "requestVolume", meshId, "get_volume" ); assert( mid != ObjId() ); - mid = shell->doAddMsg( "OneToOne", + mid = shell->doAddMsg( "OneToOne", prdId, "requestVolume", meshId, "get_volume" ); assert( mid != ObjId() ); @@ -169,14 +169,14 @@ void testTwoReacGetNeighbors() assert( ret != ObjId() ); vector< Id > pools; - unsigned int num = reacId.element()->getNeighbors( pools, + unsigned int num = reacId.element()->getNeighbors( pools, Reac::initCinfo()->findFinfo( "toSub" ) ); assert( num == 2 ); assert( pools[0] == subId ); assert( pools[1] == subId ); pools.clear(); - num = reacId.element()->getNeighbors( pools, + num = reacId.element()->getNeighbors( pools, Reac::initCinfo()->findFinfo( "sub" ) ); assert( num == 2 ); assert( pools[0] == subId ); @@ -262,7 +262,7 @@ void testMMenzProcess() shell->doSetClock( 1, 0.01 ); shell->doUseClock( "/n/mm,/n/tab2", "process", 0 ); shell->doUseClock( "/n/#[ISA=Pool]", "process", 1 ); - + ////////////////////////////////////////////////////////////////////// // Now run models and compare outputs ////////////////////////////////////////////////////////////////////// @@ -338,7 +338,7 @@ void testKinetics() testVolSort(); // This is now handled with real models in the regression tests. - // testWriteKkit( Id() ); + // testWriteKkit( Id() ); } void testMpiKinetics( ) diff --git a/moose-core/ksolve/BoostSys.h b/moose-core/ksolve/BoostSys.h index 7e72bd7746bf583bc7f27a3f4da66cad7eb5a2ce..8714b3d4541cdbf5a80cfb74d3fb734aa839afc3 100644 --- a/moose-core/ksolve/BoostSys.h +++ b/moose-core/ksolve/BoostSys.h @@ -39,7 +39,7 @@ class BoostSys ~BoostSys(); /* Operator is called by boost ode-solver */ - void operator()( const vector_type_ y , vector_type_& dydt, const double t ); + void operator()( const vector_type_ y , vector_type_& dydt, const double t ); /* Pointer to the arbitrary parameters of the system */ VoxelPools* vp; diff --git a/moose-core/ksolve/CMakeLists.txt b/moose-core/ksolve/CMakeLists.txt index 1953692b3a5d282ee43f1e470f3c39e382f7a6d6..c26bbcecedbd48da80fbb8f88831c1f2fd8dbdf8 100644 --- a/moose-core/ksolve/CMakeLists.txt +++ b/moose-core/ksolve/CMakeLists.txt @@ -18,21 +18,27 @@ elseif(WITH_GSL) include_directories( ${GSL_INCLUDE_DIRS} ) endif(WITH_BOOST) +if(PARALLELIZED_SOLVERS) + message( STATUS "Parallel version of KSolve and Gsolve" ) + add_definitions( -DPARALLELIZE_KSOLVE_WITH_CPP11_ASYNC ) + add_definitions( -DPARALLELIZE_GSOLVE_WITH_CPP11_ASYNC ) +endif(PARALLELIZED_SOLVERS) + set(KSOLVE_SRCS - KinSparseMatrix.cpp - ZombiePool.cpp + KinSparseMatrix.cpp + ZombiePool.cpp ZombieFunction.cpp - ZombieBufPool.cpp - ZombieReac.cpp - ZombieEnz.cpp - ZombieMMenz.cpp + ZombieBufPool.cpp + ZombieReac.cpp + ZombieEnz.cpp + ZombieMMenz.cpp VoxelPoolsBase.cpp - VoxelPools.cpp + VoxelPools.cpp GssaVoxelPools.cpp - RateTerm.cpp + RateTerm.cpp FuncTerm.cpp - Stoich.cpp - Ksolve.cpp + Stoich.cpp + Ksolve.cpp Gsolve.cpp ZombiePoolInterface.cpp testKsolve.cpp diff --git a/moose-core/ksolve/FuncRateTerm.h b/moose-core/ksolve/FuncRateTerm.h index af481f5963f0c6066c5b630d6fb2da902c9c402b..9dad58098ca5a32d161e3c0c4cb38f3e91114006 100644 --- a/moose-core/ksolve/FuncRateTerm.h +++ b/moose-core/ksolve/FuncRateTerm.h @@ -9,7 +9,7 @@ **********************************************************************/ /** - * This FuncRate manages a one-way reaction whose rate is + * This FuncRate manages a one-way reaction whose rate is * determined by a Function. It has no substrates, just controls the * rate of change of a target molecule. * @@ -17,7 +17,7 @@ * * The values x0, x1, x2.. are numbers at this point. So is the rate * output of this function. There may be a problem - * if there is a volume change. + * if there is a volume change. */ class FuncRate: public ExternReac { @@ -38,7 +38,7 @@ class FuncRate: public ExternReac molIndex[0] = func_.getTarget(); // This is the number of substrates to the reac. It is zero. - return 0; + return 0; // The target molecule is handled as a product. } @@ -55,7 +55,7 @@ class FuncRate: public ExternReac void setFuncArgIndex( const vector< unsigned int >& mol ) { func_.setReactantIndex( mol ); } - + void setExpr( const string& s ) { func_.setExpr( s ); } @@ -78,20 +78,20 @@ class FuncRate: public ExternReac FuncTerm func_; double k_; double funcVolPower_; - + }; /** * This FuncReac manages a one-way NOrder reaction whose rate is determined - * by a Function, but which also has regular substrates and products. + * by a Function, but which also has regular substrates and products. * * * dproduct/dt = func( x0, x1, x2..., t ) * [sub0] * [sub1] * .... * * The values x0, x1, x2 are expected to be concentrations so that they * do not depend on volume. - * The substrates sub0, sub1, ... are # of molecules. + * The substrates sub0, sub1, ... are # of molecules. * The term k_ is scaled so that it is unity at vol = 1/NA m^3. * k_ = (NA * vol)^(numSub-1) * The copyWithVolScaling operation scales it up and down from there. @@ -124,7 +124,7 @@ class FuncReac: public FuncRate v_ = molIndex; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { for ( unsigned int i = 1; i < v_.size(); ++i ) { @@ -138,7 +138,7 @@ class FuncReac: public FuncRate double vol, double sub, double prd ) const { assert( v_.size() > 0 ); - double ratio = sub * pow( NA * vol, + double ratio = sub * pow( NA * vol, funcVolPower_ + (int)( v_.size() ) - 1 ); FuncReac* ret = new FuncReac( k_ / ratio, v_ ); ret->func_ = func_; diff --git a/moose-core/ksolve/FuncTerm.cpp b/moose-core/ksolve/FuncTerm.cpp index f0f7977a36924cf8350369cedf76eac8c72c51a3..b7a8ec1cfa4496fe7aa6a8e7342430ac2265b3ca 100644 --- a/moose-core/ksolve/FuncTerm.cpp +++ b/moose-core/ksolve/FuncTerm.cpp @@ -9,14 +9,14 @@ **********************************************************************/ /** - * This little class sets up a muParser to execute on entries in the + * This little class sets up a muParser to execute on entries in the * molecule 'n' vector, and possibly on the time t. * * The user must first set the arg indices (FuncTerm::setArgIndex), before * specifying the function string. - * + * * The arguments are named x0, x1, x2 ..., t ) - * + * */ #include <vector> @@ -72,7 +72,7 @@ const vector< unsigned int >& FuncTerm::getReactantIndex() const void showError(mu::Parser::exception_type &e) { - cout << "Error occurred in parser.\n" + cout << "Error occurred in parser.\n" << "Message: " << e.GetMsg() << "\n" << "Formula: " << e.GetExpr() << "\n" << "Token: " << e.GetToken() << "\n" @@ -140,7 +140,7 @@ double FuncTerm::operator() ( const double* S, double t ) const for ( i = 0; i < reactantIndex_.size(); ++i ) args_[i] = S[reactantIndex_[i]]; args_[i] = t; - try + try { double result = parser_.Eval() * volScale_; return result; @@ -161,7 +161,7 @@ void FuncTerm::evalPool( double* S, double t ) const for ( i = 0; i < reactantIndex_.size(); ++i ) args_[i] = S[reactantIndex_[i]]; args_[i] = t; - try + try { S[ target_] = parser_.Eval() * volScale_; } diff --git a/moose-core/ksolve/FuncTerm.h b/moose-core/ksolve/FuncTerm.h index a5cf6c5c2132533861ec534e622eab8228dee04e..05779b7919559a7012684b4de2763456726ead8e 100644 --- a/moose-core/ksolve/FuncTerm.h +++ b/moose-core/ksolve/FuncTerm.h @@ -39,18 +39,18 @@ class FuncTerm void setTarget( unsigned int tgt ); void setVolScale( double vs ); double getVolScale() const; - private: + private: double* args_; // Look up reactants in the S vec. - vector< unsigned int > reactantIndex_; + vector< unsigned int > reactantIndex_; mu::Parser parser_; string expr_; /** * Scale factor to account for pool volume if we are assigning conc - * rather than N. Note that this conc will not be further updated + * rather than N. Note that this conc will not be further updated * so this is an undesirable option. */ - double volScale_; + double volScale_; unsigned int target_; /// Index of the entity to be updated by Func }; diff --git a/moose-core/ksolve/Gsolve.cpp b/moose-core/ksolve/Gsolve.cpp index a1c576ac18c65fe39c7570050a2f6456fa6f7123..42bee6f72bf4d4de08e0d8724388eb0ce7a56764 100644 --- a/moose-core/ksolve/Gsolve.cpp +++ b/moose-core/ksolve/Gsolve.cpp @@ -23,6 +23,10 @@ #include "GssaVoxelPools.h" #include "../randnum/randnum.h" +#include <future> +#include <atomic> +#include <thread> + #include "Gsolve.h" #define SIMPLE_ROUNDING 0 @@ -30,195 +34,199 @@ const unsigned int OFFNODE = ~0; // static function -SrcFinfo2< Id, vector< double > >* Gsolve::xComptOut() { - static SrcFinfo2< Id, vector< double > > xComptOut( "xComptOut", - "Sends 'n' of all molecules participating in cross-compartment " - "reactions between any juxtaposed voxels between current compt " - "and another compartment. This includes molecules local to this " - "compartment, as well as proxy molecules belonging elsewhere. " - "A(t+1) = (Alocal(t+1) + AremoteProxy(t+1)) - Alocal(t) " - "A(t+1) = (Aremote(t+1) + Aproxy(t+1)) - Aproxy(t) " - "Then we update A on the respective solvers with: " - "Alocal(t+1) = Aproxy(t+1) = A(t+1) " - "This is equivalent to sending dA over on each timestep. " - ); - return &xComptOut; +SrcFinfo2< Id, vector< double > >* Gsolve::xComptOut() +{ + static SrcFinfo2< Id, vector< double > > xComptOut( "xComptOut", + "Sends 'n' of all molecules participating in cross-compartment " + "reactions between any juxtaposed voxels between current compt " + "and another compartment. This includes molecules local to this " + "compartment, as well as proxy molecules belonging elsewhere. " + "A(t+1) = (Alocal(t+1) + AremoteProxy(t+1)) - Alocal(t) " + "A(t+1) = (Aremote(t+1) + Aproxy(t+1)) - Aproxy(t) " + "Then we update A on the respective solvers with: " + "Alocal(t+1) = Aproxy(t+1) = A(t+1) " + "This is equivalent to sending dA over on each timestep. " + ); + return &xComptOut; } const Cinfo* Gsolve::initCinfo() { - /////////////////////////////////////////////////////// - // Field definitions - /////////////////////////////////////////////////////// - - static ValueFinfo< Gsolve, Id > stoich ( - "stoich", - "Stoichiometry object for handling this reaction system.", - &Gsolve::setStoich, - &Gsolve::getStoich - ); - - static ValueFinfo< Gsolve, Id > compartment ( - "compartment", - "Compartment that contains this reaction system.", - &Gsolve::setCompartment, - &Gsolve::getCompartment - ); - - static ReadOnlyValueFinfo< Gsolve, unsigned int > numLocalVoxels( - "numLocalVoxels", - "Number of voxels in the core reac-diff system, on the " - "current solver. ", - &Gsolve::getNumLocalVoxels - ); - static LookupValueFinfo< - Gsolve, unsigned int, vector< double > > nVec( - "nVec", - "vector of pool counts", - &Gsolve::setNvec, - &Gsolve::getNvec - ); - static ValueFinfo< Gsolve, unsigned int > numAllVoxels( - "numAllVoxels", - "Number of voxels in the entire reac-diff system, " - "including proxy voxels to represent abutting compartments.", - &Gsolve::setNumAllVoxels, - &Gsolve::getNumAllVoxels - ); - - static ValueFinfo< Gsolve, unsigned int > numPools( - "numPools", - "Number of molecular pools in the entire reac-diff system, " - "including variable, function and buffered.", - &Gsolve::setNumPools, - &Gsolve::getNumPools - ); - - static ValueFinfo< Gsolve, bool > useRandInit( - "useRandInit", - "Flag: True when using probabilistic (random) rounding.\n " - "Default: True.\n " - "When initializing the mol# from floating-point Sinit values, " - "we have two options. One is to look at each Sinit, and round " - "to the nearest integer. The other is to look at each Sinit, " - "and probabilistically round up or down depending on the " - "value. For example, if we had a Sinit value of 1.49, " - "this would always be rounded to 1.0 if the flag is false, " - "and would be rounded to 1.0 and 2.0 in the ratio 51:49 if " - "the flag is true. ", - &Gsolve::setRandInit, - &Gsolve::getRandInit - ); - - static ValueFinfo< Gsolve, bool > useClockedUpdate( - "useClockedUpdate", - "Flag: True to cause all reaction propensities to be updated " - "on every clock tick.\n" - "Default: False.\n" - "This flag should be set when the reaction system " - "includes a function with a dependency on time or on external " - "events. It has a significant speed penalty so the flag " - "should not be set unless there are such functions. " , - &Gsolve::setClockedUpdate, - &Gsolve::getClockedUpdate - ); - static ReadOnlyLookupValueFinfo< - Gsolve, unsigned int, vector< unsigned int > > numFire( - "numFire", - "Vector of the number of times each reaction has fired." - "Indexed by the voxel number." - "Zeroed out at reinit.", - &Gsolve::getNumFire - ); - - /////////////////////////////////////////////////////// - // DestFinfo definitions - /////////////////////////////////////////////////////// - - static DestFinfo process( "process", - "Handles process call", - new ProcOpFunc< Gsolve >( &Gsolve::process ) ); - static DestFinfo reinit( "reinit", - "Handles reinit call", - new ProcOpFunc< Gsolve >( &Gsolve::reinit ) ); - - static DestFinfo voxelVol( "voxelVol", - "Handles updates to all voxels. Comes from parent " - "ChemCompt object.", - new OpFunc1< Gsolve, vector< double > >( - &Gsolve::updateVoxelVol ) - ); - - static DestFinfo initProc( "initProc", - "Handles initProc call from Clock", - new ProcOpFunc< Gsolve >( &Gsolve::initProc ) ); - static DestFinfo initReinit( "initReinit", - "Handles initReinit call from Clock", - new ProcOpFunc< Gsolve >( &Gsolve::initReinit ) ); - - static DestFinfo xComptIn( "xComptIn", - "Handles arriving pool 'n' values used in cross-compartment " - "reactions.", - new EpFunc2< Gsolve, Id, vector< double > >( &Gsolve::xComptIn ) - ); - /////////////////////////////////////////////////////// - // Shared definitions - /////////////////////////////////////////////////////// - static Finfo* procShared[] = { - &process, &reinit - }; - static SharedFinfo proc( "proc", - "Shared message for process and reinit", - procShared, sizeof( procShared ) / sizeof( const Finfo* ) - ); - - static Finfo* initShared[] = { - &initProc, &initReinit - }; - 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* ) - ); - - static Finfo* xComptShared[] = { - xComptOut(), &xComptIn - }; - static SharedFinfo xCompt( "xCompt", - "Shared message for pool exchange for cross-compartment " - "reactions. Exchanges latest values of all pools that " - "participate in such reactions.", - xComptShared, sizeof( xComptShared ) / sizeof( const Finfo* ) - ); - /////////////////////////////////////////////////////// - - static Finfo* gsolveFinfos[] = - { - &stoich, // Value - &numLocalVoxels, // ReadOnlyValue - &nVec, // LookupValue - &numAllVoxels, // ReadOnlyValue - &numPools, // Value - &voxelVol, // DestFinfo - &proc, // SharedFinfo - &init, // SharedFinfo - &xCompt, // SharedFinfo - // Here we put new fields that were not there in the Ksolve. - &useRandInit, // Value - &useClockedUpdate, // Value - &numFire, // ReadOnlyLookupValue - }; - - static Dinfo< Gsolve > dinfo; - static Cinfo gsolveCinfo( - "Gsolve", - Neutral::initCinfo(), - gsolveFinfos, - sizeof(gsolveFinfos)/sizeof(Finfo *), - &dinfo - ); - - return &gsolveCinfo; + /////////////////////////////////////////////////////// + // Field definitions + /////////////////////////////////////////////////////// + + static ValueFinfo< Gsolve, Id > stoich ( + "stoich", + "Stoichiometry object for handling this reaction system.", + &Gsolve::setStoich, + &Gsolve::getStoich + ); + + static ValueFinfo< Gsolve, Id > compartment ( + "compartment", + "Compartment that contains this reaction system.", + &Gsolve::setCompartment, + &Gsolve::getCompartment + ); + + static ReadOnlyValueFinfo< Gsolve, unsigned int > numLocalVoxels( + "numLocalVoxels", + "Number of voxels in the core reac-diff system, on the " + "current solver. ", + &Gsolve::getNumLocalVoxels + ); + static LookupValueFinfo< + Gsolve, unsigned int, vector< double > > nVec( + "nVec", + "vector of pool counts", + &Gsolve::setNvec, + &Gsolve::getNvec + ); + static ValueFinfo< Gsolve, unsigned int > numAllVoxels( + "numAllVoxels", + "Number of voxels in the entire reac-diff system, " + "including proxy voxels to represent abutting compartments.", + &Gsolve::setNumAllVoxels, + &Gsolve::getNumAllVoxels + ); + + static ValueFinfo< Gsolve, unsigned int > numPools( + "numPools", + "Number of molecular pools in the entire reac-diff system, " + "including variable, function and buffered.", + &Gsolve::setNumPools, + &Gsolve::getNumPools + ); + + static ValueFinfo< Gsolve, bool > useRandInit( + "useRandInit", + "Flag: True when using probabilistic (random) rounding.\n " + "Default: True.\n " + "When initializing the mol# from floating-point Sinit values, " + "we have two options. One is to look at each Sinit, and round " + "to the nearest integer. The other is to look at each Sinit, " + "and probabilistically round up or down depending on the " + "value. For example, if we had a Sinit value of 1.49, " + "this would always be rounded to 1.0 if the flag is false, " + "and would be rounded to 1.0 and 2.0 in the ratio 51:49 if " + "the flag is true. ", + &Gsolve::setRandInit, + &Gsolve::getRandInit + ); + + static ValueFinfo< Gsolve, bool > useClockedUpdate( + "useClockedUpdate", + "Flag: True to cause all reaction propensities to be updated " + "on every clock tick.\n" + "Default: False.\n" + "This flag should be set when the reaction system " + "includes a function with a dependency on time or on external " + "events. It has a significant speed penalty so the flag " + "should not be set unless there are such functions. " , + &Gsolve::setClockedUpdate, + &Gsolve::getClockedUpdate + ); + static ReadOnlyLookupValueFinfo< + Gsolve, unsigned int, vector< unsigned int > > numFire( + "numFire", + "Vector of the number of times each reaction has fired." + "Indexed by the voxel number." + "Zeroed out at reinit.", + &Gsolve::getNumFire + ); + + /////////////////////////////////////////////////////// + // DestFinfo definitions + /////////////////////////////////////////////////////// + + static DestFinfo process( "process", + "Handles process call", + new ProcOpFunc< Gsolve >( &Gsolve::process ) ); + static DestFinfo reinit( "reinit", + "Handles reinit call", + new ProcOpFunc< Gsolve >( &Gsolve::reinit ) ); + + static DestFinfo voxelVol( "voxelVol", + "Handles updates to all voxels. Comes from parent " + "ChemCompt object.", + new OpFunc1< Gsolve, vector< double > >( + &Gsolve::updateVoxelVol ) + ); + + static DestFinfo initProc( "initProc", + "Handles initProc call from Clock", + new ProcOpFunc< Gsolve >( &Gsolve::initProc ) ); + static DestFinfo initReinit( "initReinit", + "Handles initReinit call from Clock", + new ProcOpFunc< Gsolve >( &Gsolve::initReinit ) ); + + static DestFinfo xComptIn( "xComptIn", + "Handles arriving pool 'n' values used in cross-compartment " + "reactions.", + new EpFunc2< Gsolve, Id, vector< double > >( &Gsolve::xComptIn ) + ); + /////////////////////////////////////////////////////// + // Shared definitions + /////////////////////////////////////////////////////// + static Finfo* procShared[] = + { + &process, &reinit + }; + static SharedFinfo proc( "proc", + "Shared message for process and reinit", + procShared, sizeof( procShared ) / sizeof( const Finfo* ) + ); + + static Finfo* initShared[] = + { + &initProc, &initReinit + }; + 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* ) + ); + + static Finfo* xComptShared[] = + { + xComptOut(), &xComptIn + }; + static SharedFinfo xCompt( "xCompt", + "Shared message for pool exchange for cross-compartment " + "reactions. Exchanges latest values of all pools that " + "participate in such reactions.", + xComptShared, sizeof( xComptShared ) / sizeof( const Finfo* ) + ); + /////////////////////////////////////////////////////// + + static Finfo* gsolveFinfos[] = + { + &stoich, // Value + &numLocalVoxels, // ReadOnlyValue + &nVec, // LookupValue + &numAllVoxels, // ReadOnlyValue + &numPools, // Value + &voxelVol, // DestFinfo + &proc, // SharedFinfo + &init, // SharedFinfo + &xCompt, // SharedFinfo + // Here we put new fields that were not there in the Ksolve. + &useRandInit, // Value + &useClockedUpdate, // Value + &numFire, // ReadOnlyLookupValue + }; + + static Dinfo< Gsolve > dinfo; + static Cinfo gsolveCinfo( + "Gsolve", + Neutral::initCinfo(), + gsolveFinfos, + sizeof(gsolveFinfos)/sizeof(Finfo *), + &dinfo + ); + + return &gsolveCinfo; } static const Cinfo* gsolveCinfo = Gsolve::initCinfo(); @@ -227,17 +235,23 @@ static const Cinfo* gsolveCinfo = Gsolve::initCinfo(); // Class definitions ////////////////////////////////////////////////////////////// -Gsolve::Gsolve() - : - pools_( 1 ), - startVoxel_( 0 ), - dsolve_(), - dsolvePtr_( 0 ), - useClockedUpdate_( false ) -{;} +Gsolve::Gsolve() : +#if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC + numThreads_ ( 2 ), +#endif + pools_( 1 ), + startVoxel_( 0 ), + dsolve_(), + dsolvePtr_( 0 ), + useClockedUpdate_( false ) +{ + ; +} Gsolve::~Gsolve() -{;} +{ + ; +} ////////////////////////////////////////////////////////////// // Field Access functions @@ -245,244 +259,334 @@ Gsolve::~Gsolve() Id Gsolve::getStoich() const { - return stoich_; + return stoich_; } void Gsolve::setCompartment( Id compt ) { - if ( ( compt.element()->cinfo()->isA( "ChemCompt" ) ) ) { - compartment_ = compt; - vector< double > vols = - Field< vector< double > >::get( compt, "voxelVolume" ); - if ( vols.size() > 0 ) { - pools_.resize( vols.size() ); - for ( unsigned int i = 0; i < vols.size(); ++i ) { - pools_[i].setVolume( vols[i] ); - } - } - } + if ( ( compt.element()->cinfo()->isA( "ChemCompt" ) ) ) + { + compartment_ = compt; + vector< double > vols = + Field< vector< double > >::get( compt, "voxelVolume" ); + if ( vols.size() > 0 ) + { + pools_.resize( vols.size() ); + for ( unsigned int i = 0; i < vols.size(); ++i ) + { + pools_[i].setVolume( vols[i] ); + } + } + } } Id Gsolve::getCompartment() const { - return compartment_; + return compartment_; } void Gsolve::setStoich( Id stoich ) { - // This call is done _before_ setting the path on stoich - assert( stoich.element()->cinfo()->isA( "Stoich" ) ); - stoich_ = stoich; - stoichPtr_ = reinterpret_cast< Stoich* >( stoich.eref().data() ); - if ( stoichPtr_->getNumAllPools() == 0 ) { - stoichPtr_ = 0; - return; - } - sys_.stoich = stoichPtr_; - sys_.isReady = false; - for ( unsigned int i = 0; i < pools_.size(); ++i ) - pools_[i].setStoich( stoichPtr_ ); + // This call is done _before_ setting the path on stoich + assert( stoich.element()->cinfo()->isA( "Stoich" ) ); + stoich_ = stoich; + stoichPtr_ = reinterpret_cast< Stoich* >( stoich.eref().data() ); + if ( stoichPtr_->getNumAllPools() == 0 ) + { + stoichPtr_ = 0; + return; + } + sys_.stoich = stoichPtr_; + sys_.isReady = false; + for ( unsigned int i = 0; i < pools_.size(); ++i ) + pools_[i].setStoich( stoichPtr_ ); } unsigned int Gsolve::getNumLocalVoxels() const { - return pools_.size(); + return pools_.size(); } unsigned int Gsolve::getNumAllVoxels() const { - return pools_.size(); // Need to redo. + return pools_.size(); // Need to redo. } // If we're going to do this, should be done before the zombification. void Gsolve::setNumAllVoxels( unsigned int numVoxels ) { - if ( numVoxels == 0 ) { - return; - } - pools_.resize( numVoxels ); - sys_.isReady = false; + if ( numVoxels == 0 ) + { + return; + } + pools_.resize( numVoxels ); + sys_.isReady = false; } vector< double > Gsolve::getNvec( unsigned int voxel) const { - static vector< double > dummy; - if ( voxel < pools_.size() ) { - return const_cast< GssaVoxelPools* >( &( pools_[ voxel ]) )->Svec(); - } - return dummy; + static vector< double > dummy; + if ( voxel < pools_.size() ) + { + return const_cast< GssaVoxelPools* >( &( pools_[ voxel ]) )->Svec(); + } + return dummy; } void Gsolve::setNvec( unsigned int voxel, vector< double > nVec ) { - if ( voxel < pools_.size() ) { - if ( nVec.size() != pools_[voxel].size() ) { - cout << "Warning: Gsolve::setNvec: size mismatch ( " << - nVec.size() << ", " << pools_[voxel].size() << ")\n"; - return; - } - double* s = pools_[voxel].varS(); - for ( unsigned int i = 0; i < nVec.size(); ++i ) { - s[i] = round( nVec[i] ); - if ( s[i] < 0.0 ) - s[i] = 0.0; - } - if ( sys_.isReady ) - pools_[voxel].refreshAtot( &sys_ ); - } + if ( voxel < pools_.size() ) + { + if ( nVec.size() != pools_[voxel].size() ) + { + cout << "Warning: Gsolve::setNvec: size mismatch ( " << + nVec.size() << ", " << pools_[voxel].size() << ")\n"; + return; + } + double* s = pools_[voxel].varS(); + for ( unsigned int i = 0; i < nVec.size(); ++i ) + { + s[i] = round( nVec[i] ); + if ( s[i] < 0.0 ) + s[i] = 0.0; + } + if ( sys_.isReady ) + pools_[voxel].refreshAtot( &sys_ ); + } } vector< unsigned int > Gsolve::getNumFire( unsigned int voxel) const { - static vector< unsigned int > dummy; - if ( voxel < pools_.size() ) { - return const_cast< GssaVoxelPools* >( &( pools_[ voxel ]) )->numFire(); - } - return dummy; + static vector< unsigned int > dummy; + if ( voxel < pools_.size() ) + { + return const_cast< GssaVoxelPools* >( &( pools_[ voxel ]) )->numFire(); + } + return dummy; } bool Gsolve::getRandInit() const { - return sys_.useRandInit; + return sys_.useRandInit; } void Gsolve::setRandInit( bool val ) { - sys_.useRandInit = val; + sys_.useRandInit = val; } bool Gsolve::getClockedUpdate() const { - return useClockedUpdate_; + return useClockedUpdate_; } void Gsolve::setClockedUpdate( bool val ) { - useClockedUpdate_ = val; + useClockedUpdate_ = val; +} + + +#if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC +/** + * @brief Advance voxels pools but concurrently. + * + * @param begin + * @param end + * @param p + */ +void Gsolve::parallel_advance(int begin, int end, size_t nWorkers, const ProcPtr p + , const GssaSystem* sys + ) +{ + std::atomic<int> idx( begin ); + for (size_t cpu = 0; cpu != nWorkers; ++cpu) + { + std::async( std::launch::async, + [this, &idx, end, p, sys]() + { + for (;;) + { + int i = idx++; + if (i >= end) + break; + pools_[i].advance( p, sys); + } + } + ); + } } +#endif + ////////////////////////////////////////////////////////////// // Process operations. ////////////////////////////////////////////////////////////// void Gsolve::process( const Eref& e, ProcPtr p ) { - // cout << stoichPtr_ << " dsolve = " << dsolvePtr_ << endl; - if ( !stoichPtr_ ) - return; - // First, handle incoming diffusion values. Note potential for - // issues with roundoff if diffusion is not integral. - if ( dsolvePtr_ ) { - vector< double > dvalues( 4 ); - dvalues[0] = 0; - dvalues[1] = getNumLocalVoxels(); - dvalues[2] = 0; - dvalues[3] = stoichPtr_->getNumVarPools(); - dsolvePtr_->getBlock( dvalues ); - // Here we need to convert to integers, just in case. Normally - // 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 ) << " "; + // cout << stoichPtr_ << " dsolve = " << dsolvePtr_ << endl; + if ( !stoichPtr_ ) + return; + + // First, handle incoming diffusion values. Note potential for + // issues with roundoff if diffusion is not integral. + if ( dsolvePtr_ ) + { + vector< double > dvalues( 4 ); + dvalues[0] = 0; + dvalues[1] = getNumLocalVoxels(); + dvalues[2] = 0; + dvalues[3] = stoichPtr_->getNumVarPools(); + dsolvePtr_->getBlock( dvalues ); + + // Here we need to convert to integers, just in case. Normally + // 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 = round( *i ); #else - double base = floor( *i ); - if ( mtrand() > *i - base ) - *i = base; - else - *i = base + 1.0; + double base = floor( *i ); + if ( mtrand() >= (*i - base) ) + *i = base; + else + *i = base + 1.0; +#endif + } + setBlock( dvalues ); + } + // Second, take the arrived xCompt reac values and update S with them. + // Here the roundoff issues are handled by the GssaVoxelPools functions + for ( unsigned int i = 0; i < xfer_.size(); ++i ) + { + XferInfo& xf = xfer_[i]; + // cout << xfer_.size() << " " << xf.xferVoxel.size() << endl; + for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) + { + pools_[xf.xferVoxel[j]].xferIn( xf, j, &sys_ ); + } + } + // Third, record the current value of pools as the reference for the + // next cycle. + for ( unsigned int i = 0; i < xfer_.size(); ++i ) + { + XferInfo& xf = xfer_[i]; + for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) + { + pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx ); + } + } + + // Fourth: Fix the rates if we have had any diffusion or xreacs + // happening. This is very inefficient at this point, need to fix. + if ( dsolvePtr_ || xfer_.size() > 0 ) + { + for ( vector< GssaVoxelPools >::iterator + i = pools_.begin(); i != pools_.end(); ++i ) + { + i->refreshAtot( &sys_ ); + } + } + // Fifth, update the mol #s. + // First we advance the simulation. + size_t nvPools = pools_.size( ); + +#if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC + // If there is only one voxel-pool or one thread is specified by user then + // there is no point in using std::async there. + if( 1 == getNumThreads( ) || 1 == nvPools ) + { + for ( size_t i = 0; i < nvPools; i++ ) + pools_[i].advance( p, &sys_ ); + } + else + { + /*----------------------------------------------------------------------------- + * Somewhat complicated computation to compute the number of threads. 1 + * thread per (at least) voxel pool is ideal situation. + *-----------------------------------------------------------------------------*/ + size_t grainSize = min( nvPools, 1 + (nvPools / numThreads_ ) ); + size_t nWorkers = nvPools / grainSize; + + for (size_t i = 0; i < nWorkers; i++) + parallel_advance( i * grainSize, (i+1) * grainSize, nWorkers, p, &sys_ ); + + } +#else + for ( size_t i = 0; i < nvPools; i++ ) + pools_[i].advance( p, &sys_ ); #endif - } - setBlock( dvalues ); - } - // Second, take the arrived xCompt reac values and update S with them. - // Here the roundoff issues are handled by the GssaVoxelPools functions - for ( unsigned int i = 0; i < xfer_.size(); ++i ) { - XferInfo& xf = xfer_[i]; - // cout << xfer_.size() << " " << xf.xferVoxel.size() << endl; - for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) { - pools_[xf.xferVoxel[j]].xferIn( xf, j, &sys_ ); - } - } - // Third, record the current value of pools as the reference for the - // next cycle. - for ( unsigned int i = 0; i < xfer_.size(); ++i ) { - XferInfo& xf = xfer_[i]; - for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) { - pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx ); - } - } - // Fourth: Fix the rates if we have had any diffusion or xreacs - // happening. This is very inefficient at this point, need to fix. - if ( dsolvePtr_ || xfer_.size() > 0 ) { - for ( vector< GssaVoxelPools >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) { - i->refreshAtot( &sys_ ); - } - } - // Fifth, update the mol #s. - // First we advance the simulation. - for ( vector< GssaVoxelPools >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) { - i->advance( p, &sys_ ); - } - if ( useClockedUpdate_ ) { // Check if a clocked stim is to be updated - for ( vector< GssaVoxelPools >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) { - i->recalcTime( &sys_, p->currTime ); - } - } - - // Finally, assemble and send the integrated values off for the Dsolve. - if ( dsolvePtr_ ) { - vector< double > kvalues( 4 ); - kvalues[0] = 0; - kvalues[1] = getNumLocalVoxels(); - kvalues[2] = 0; - kvalues[3] = stoichPtr_->getNumVarPools(); - getBlock( kvalues ); - dsolvePtr_->setBlock( kvalues ); - } + if ( useClockedUpdate_ ) // Check if a clocked stim is to be updated + { + for ( auto &v : pools_ ) + v.recalcTime( &sys_, p->currTime ); + } + + // Finally, assemble and send the integrated values off for the Dsolve. + if ( dsolvePtr_ ) + { + vector< double > kvalues( 4 ); + kvalues[0] = 0; + kvalues[1] = getNumLocalVoxels(); + kvalues[2] = 0; + kvalues[3] = stoichPtr_->getNumVarPools(); + getBlock( kvalues ); + dsolvePtr_->setBlock( kvalues ); + } } 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 ) { - i->reinit( &sys_ ); - } - - // Second, take the arrived xCompt reac values and update S with them. - // Here the roundoff issues are handled by the GssaVoxelPools functions - for ( unsigned int i = 0; i < xfer_.size(); ++i ) { - const XferInfo& xf = xfer_[i]; - for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) { - pools_[xf.xferVoxel[j]].xferInOnlyProxies( - xf.xferPoolIdx, xf.values, - stoichPtr_->getNumProxyPools(), j ); - } - } - // Third, record the current value of pools as the reference for the - // next cycle. - for ( unsigned int i = 0; i < xfer_.size(); ++i ) { - XferInfo& xf = xfer_[i]; - for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) { - pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx ); - } - } - // Fourth, update the atots. - for ( vector< GssaVoxelPools >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) { - i->refreshAtot( &sys_ ); - } + if ( !stoichPtr_ ) + return; + if ( !sys_.isReady ) + rebuildGssaSystem(); + // First reinit concs. + for ( vector< GssaVoxelPools >::iterator + i = pools_.begin(); i != pools_.end(); ++i ) + { + i->reinit( &sys_ ); + } + + // Second, take the arrived xCompt reac values and update S with them. + // Here the roundoff issues are handled by the GssaVoxelPools functions + for ( unsigned int i = 0; i < xfer_.size(); ++i ) + { + const XferInfo& xf = xfer_[i]; + for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) + { + pools_[xf.xferVoxel[j]].xferInOnlyProxies( + xf.xferPoolIdx, xf.values, + stoichPtr_->getNumProxyPools(), j ); + } + } + // Third, record the current value of pools as the reference for the + // next cycle. + for ( unsigned int i = 0; i < xfer_.size(); ++i ) + { + XferInfo& xf = xfer_[i]; + for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) + { + pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx ); + } + } + // Fourth, update the atots. + for ( vector< GssaVoxelPools >::iterator + i = pools_.begin(); i != pools_.end(); ++i ) + { + i->refreshAtot( &sys_ ); + } + +#if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC + if( 1 < getNumThreads( ) ) + cout << "Info: Using threaded gsolve: " << getNumThreads( ) + << " threads. " << endl; +#endif } ////////////////////////////////////////////////////////////// @@ -490,41 +594,46 @@ void Gsolve::reinit( const Eref& e, ProcPtr p ) ////////////////////////////////////////////////////////////// void Gsolve::initProc( const Eref& e, ProcPtr p ) { - if ( !stoichPtr_ ) - return; - // vector< vector< double > > values( xfer_.size() ); - for ( unsigned int i = 0; i < xfer_.size(); ++i ) { - XferInfo& xf = xfer_[i]; - unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size(); - // values[i].resize( size, 0.0 ); - vector< double > values( size, 0.0 ); - for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) { - unsigned int vox = xf.xferVoxel[j]; - pools_[vox].xferOut( j, values, xf.xferPoolIdx ); - } - xComptOut()->sendTo( e, xf.ksolve, e.id(), values ); - } + if ( !stoichPtr_ ) + return; + // vector< vector< double > > values( xfer_.size() ); + for ( unsigned int i = 0; i < xfer_.size(); ++i ) + { + XferInfo& xf = xfer_[i]; + unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size(); + // values[i].resize( size, 0.0 ); + vector< double > values( size, 0.0 ); + for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) + { + unsigned int vox = xf.xferVoxel[j]; + pools_[vox].xferOut( j, values, xf.xferPoolIdx ); + } + xComptOut()->sendTo( e, xf.ksolve, e.id(), values ); + } } void Gsolve::initReinit( const Eref& e, ProcPtr p ) { - if ( !stoichPtr_ ) - return; - for ( unsigned int i = 0 ; i < pools_.size(); ++i ) { - pools_[i].reinit( &sys_ ); - } - // vector< vector< double > > values( xfer_.size() ); - for ( unsigned int i = 0; i < xfer_.size(); ++i ) { - XferInfo& xf = xfer_[i]; - unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size(); - xf.lastValues.assign( size, 0.0 ); - for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) { - unsigned int vox = xf.xferVoxel[j]; - pools_[ vox ].xferOut( j, xf.lastValues, xf.xferPoolIdx ); - // values[i] = xf.lastValues; - } - xComptOut()->sendTo( e, xf.ksolve, e.id(), xf.lastValues ); - } + if ( !stoichPtr_ ) + return; + for ( unsigned int i = 0 ; i < pools_.size(); ++i ) + { + pools_[i].reinit( &sys_ ); + } + // vector< vector< double > > values( xfer_.size() ); + for ( unsigned int i = 0; i < xfer_.size(); ++i ) + { + XferInfo& xf = xfer_[i]; + unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size(); + xf.lastValues.assign( size, 0.0 ); + for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) + { + unsigned int vox = xf.xferVoxel[j]; + pools_[ vox ].xferOut( j, xf.lastValues, xf.xferPoolIdx ); + // values[i] = xf.lastValues; + } + xComptOut()->sendTo( e, xf.ksolve, e.id(), xf.lastValues ); + } } ////////////////////////////////////////////////////////////// // Solver setup @@ -532,26 +641,28 @@ void Gsolve::initReinit( const Eref& e, ProcPtr p ) void Gsolve::rebuildGssaSystem() { - stoichPtr_->convertRatesToStochasticForm(); - sys_.transposeN = stoichPtr_->getStoichiometryMatrix(); - sys_.transposeN.transpose(); - sys_.transposeN.truncateRow( stoichPtr_->getNumVarPools() + stoichPtr_->getNumProxyPools() ); - vector< vector< unsigned int > > & dep = sys_.dependency; - dep.resize( stoichPtr_->getNumRates() ); - for ( unsigned int i = 0; i < stoichPtr_->getNumRates(); ++i ) { - sys_.transposeN.getGillespieDependence( i, dep[i] ); - } - fillMmEnzDep(); - fillPoolFuncDep(); - fillIncrementFuncDep(); - makeReacDepsUnique(); - for ( vector< GssaVoxelPools >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) { - i->setNumReac( stoichPtr_->getNumRates() ); - i->updateAllRateTerms( stoichPtr_->getRateTerms(), - stoichPtr_->getNumCoreRates() ); - } - sys_.isReady = true; + stoichPtr_->convertRatesToStochasticForm(); + sys_.transposeN = stoichPtr_->getStoichiometryMatrix(); + sys_.transposeN.transpose(); + sys_.transposeN.truncateRow( stoichPtr_->getNumVarPools() + stoichPtr_->getNumProxyPools() ); + vector< vector< unsigned int > > & dep = sys_.dependency; + dep.resize( stoichPtr_->getNumRates() ); + for ( unsigned int i = 0; i < stoichPtr_->getNumRates(); ++i ) + { + sys_.transposeN.getGillespieDependence( i, dep[i] ); + } + fillMmEnzDep(); + fillPoolFuncDep(); + fillIncrementFuncDep(); + makeReacDepsUnique(); + for ( vector< GssaVoxelPools >::iterator + i = pools_.begin(); i != pools_.end(); ++i ) + { + i->setNumReac( stoichPtr_->getNumRates() ); + i->updateAllRateTerms( stoichPtr_->getRateTerms(), + stoichPtr_->getNumCoreRates() ); + } + sys_.isReady = true; } /** @@ -562,44 +673,48 @@ void Gsolve::rebuildGssaSystem() */ void Gsolve::fillMmEnzDep() { - unsigned int numRates = stoichPtr_->getNumRates(); - vector< unsigned int > indices; - - // Make a map to look up enzyme RateTerm using - // the key of the enzyme molecule. - map< unsigned int, unsigned int > enzMolMap; - for ( unsigned int i = 0; i < numRates; ++i ) { - const MMEnzymeBase* mme = dynamic_cast< const MMEnzymeBase* >( - stoichPtr_->rates( i ) ); - if ( mme ) { - vector< unsigned int > reactants; - mme->getReactants( reactants ); - if ( reactants.size() > 1 ) - enzMolMap[ reactants.front() ] = i; // front is enzyme. - } - } - - // Use the map to fill in deps. - for ( unsigned int i = 0; i < numRates; ++i ) { - // Extract the row of all molecules that depend on the reac. - const int* entry; - const unsigned int* colIndex; - - unsigned int numInRow = - sys_.transposeN.getRow( i, &entry, &colIndex ); - for( unsigned int j = 0; j < numInRow; ++j ) { - map< unsigned int, unsigned int >::iterator pos = - enzMolMap.find( colIndex[j] ); - if ( pos != enzMolMap.end() ) - sys_.dependency[i].push_back( pos->second ); - } - } + unsigned int numRates = stoichPtr_->getNumRates(); + vector< unsigned int > indices; + + // Make a map to look up enzyme RateTerm using + // the key of the enzyme molecule. + map< unsigned int, unsigned int > enzMolMap; + for ( unsigned int i = 0; i < numRates; ++i ) + { + const MMEnzymeBase* mme = dynamic_cast< const MMEnzymeBase* >( + stoichPtr_->rates( i ) ); + if ( mme ) + { + vector< unsigned int > reactants; + mme->getReactants( reactants ); + if ( reactants.size() > 1 ) + enzMolMap[ reactants.front() ] = i; // front is enzyme. + } + } + + // Use the map to fill in deps. + for ( unsigned int i = 0; i < numRates; ++i ) + { + // Extract the row of all molecules that depend on the reac. + const int* entry; + const unsigned int* colIndex; + + unsigned int numInRow = + sys_.transposeN.getRow( i, &entry, &colIndex ); + for( unsigned int j = 0; j < numInRow; ++j ) + { + map< unsigned int, unsigned int >::iterator pos = + enzMolMap.find( colIndex[j] ); + if ( pos != enzMolMap.end() ) + sys_.dependency[i].push_back( pos->second ); + } + } } /** * Here we fill in the dependencies involving poolFuncs. These are * the functions that evaluate an expression and assign directly to the - * # of a target molecule. + * # of a target molecule. * There are two dependencies: * 1. When a reaction fires, all the Functions that depend on the reactants * must update their target molecule. This is in sys_.dependentMathExpn[]. @@ -609,55 +724,59 @@ void Gsolve::fillMmEnzDep() */ void Gsolve::fillPoolFuncDep() { - // create map of funcs that depend on specified molecule. - vector< vector< unsigned int > > funcMap( - stoichPtr_->getNumAllPools() ); - unsigned int numFuncs = stoichPtr_->getNumFuncs(); - for ( unsigned int i = 0; i < numFuncs; ++i ) { - const FuncTerm *f = stoichPtr_->funcs( i ); - vector< unsigned int > molIndex = f->getReactantIndex(); - for ( unsigned int j = 0; j < molIndex.size(); ++j ) - funcMap[ molIndex[j] ].push_back( i ); - } - // The output of each func is a mol indexed as - // numVarMols + numBufMols + i - unsigned int numRates = stoichPtr_->getNumRates(); - sys_.dependentMathExpn.resize( numRates ); - vector< unsigned int > indices; - for ( unsigned int i = 0; i < numRates; ++i ) { - vector< unsigned int >& dep = sys_.dependentMathExpn[ i ]; - dep.resize( 0 ); - // Extract the row of all molecules that depend on the reac. - const int* entry; - const unsigned int* colIndex; - unsigned int numInRow = - sys_.transposeN.getRow( i, &entry, &colIndex ); - for ( unsigned int j = 0; j < numInRow; ++j ) { - unsigned int molIndex = colIndex[j]; - vector< unsigned int >& funcs = funcMap[ molIndex ]; - dep.insert( dep.end(), funcs.begin(), funcs.end() ); - for ( unsigned int k = 0; k < funcs.size(); ++k ) { - // unsigned int outputMol = funcs[k] + funcOffset; - unsigned int outputMol = stoichPtr_->funcs( funcs[k] )->getTarget(); - // Insert reac deps here. Columns are reactions. - vector< int > e; // Entries: we don't need. - vector< unsigned int > c; // Column index: the reactions. - stoichPtr_->getStoichiometryMatrix(). - getRow( outputMol, e, c ); - // Each of the reacs (col entries) depend on this func. - vector< unsigned int > rdep = sys_.dependency[i]; - rdep.insert( rdep.end(), c.begin(), c.end() ); - } - } - } + // create map of funcs that depend on specified molecule. + vector< vector< unsigned int > > funcMap( + stoichPtr_->getNumAllPools() ); + unsigned int numFuncs = stoichPtr_->getNumFuncs(); + for ( unsigned int i = 0; i < numFuncs; ++i ) + { + const FuncTerm *f = stoichPtr_->funcs( i ); + vector< unsigned int > molIndex = f->getReactantIndex(); + for ( unsigned int j = 0; j < molIndex.size(); ++j ) + funcMap[ molIndex[j] ].push_back( i ); + } + // The output of each func is a mol indexed as + // numVarMols + numBufMols + i + unsigned int numRates = stoichPtr_->getNumRates(); + sys_.dependentMathExpn.resize( numRates ); + vector< unsigned int > indices; + for ( unsigned int i = 0; i < numRates; ++i ) + { + vector< unsigned int >& dep = sys_.dependentMathExpn[ i ]; + dep.resize( 0 ); + // Extract the row of all molecules that depend on the reac. + const int* entry; + const unsigned int* colIndex; + unsigned int numInRow = + sys_.transposeN.getRow( i, &entry, &colIndex ); + for ( unsigned int j = 0; j < numInRow; ++j ) + { + unsigned int molIndex = colIndex[j]; + vector< unsigned int >& funcs = funcMap[ molIndex ]; + dep.insert( dep.end(), funcs.begin(), funcs.end() ); + for ( unsigned int k = 0; k < funcs.size(); ++k ) + { + // unsigned int outputMol = funcs[k] + funcOffset; + unsigned int outputMol = stoichPtr_->funcs( funcs[k] )->getTarget(); + // Insert reac deps here. Columns are reactions. + vector< int > e; // Entries: we don't need. + vector< unsigned int > c; // Column index: the reactions. + stoichPtr_->getStoichiometryMatrix(). + getRow( outputMol, e, c ); + // Each of the reacs (col entries) depend on this func. + vector< unsigned int > rdep = sys_.dependency[i]; + rdep.insert( rdep.end(), c.begin(), c.end() ); + } + } + } } /** * Here we fill in the dependencies involving incrementFuncs. These are * the functions that evaluate an expression that specifies rate of change - * of # of a target molecule. + * of # of a target molecule. * There are two dependencies: - * 1. When a reaction fires, all the incrementFuncs that depend on the + * 1. When a reaction fires, all the incrementFuncs that depend on the * reactants must update their rates. This is added to sys_.dependency[] * which is the usual handler for reac dependencies. Note that the inputs * to the incrementFuncs are NOT present in the stoichiometry matrix, so @@ -668,62 +787,67 @@ void Gsolve::fillPoolFuncDep() */ void Gsolve::fillIncrementFuncDep() { - // create map of funcs that depend on specified molecule. - vector< vector< unsigned int > > funcMap( - stoichPtr_->getNumAllPools() ); - const vector< RateTerm* >& rates = stoichPtr_->getRateTerms(); - vector< FuncRate* > incrementRates; - vector< unsigned int > incrementRateIndex; - const vector< RateTerm* >::const_iterator q; - for ( unsigned int i = 0; i < rates.size(); ++i ) { - FuncRate *term = - dynamic_cast< FuncRate* >( rates[i] ); - if (term) { - incrementRates.push_back( term ); - incrementRateIndex.push_back( i ); - } - } - - for ( unsigned int k = 0; k < incrementRates.size(); ++k ) { - const vector< unsigned int >& molIndex = - incrementRates[k]->getFuncArgIndex(); - for ( unsigned int j = 0; j < molIndex.size(); ++j ) - funcMap[ molIndex[j] ].push_back( incrementRateIndex[k] ); - } - - unsigned int numRates = stoichPtr_->getNumRates(); - sys_.dependentMathExpn.resize( numRates ); - vector< unsigned int > indices; - for ( unsigned int i = 0; i < numRates; ++i ) { - // Algorithm: - // 1.Go through stoich matrix finding all the poolIndices affected - // by each Rate Term. - // 2.Use funcMap to look up FuncRateTerms affected by these indices - // 3. Add the rateTerm->FuncRateTerm mapping to the dependencies. - - const int* entry; - const unsigned int* colIndex; - unsigned int numInRow = - sys_.transposeN.getRow( i, &entry, &colIndex ); - // 1.Go through stoich matrix finding all the poolIndices affected - // by each Rate Term. - for ( unsigned int j = 0; j < numInRow; ++j ) { - unsigned int molIndex = colIndex[j]; // Affected poolIndex - - // 2.Use funcMap to look up FuncRateTerms affected by these indices - vector< unsigned int >& funcs = funcMap[ molIndex ]; - // 3. Add the rateTerm->FuncRateTerm mapping to the dependencies. - vector< unsigned int >& rdep = sys_.dependency[i]; - rdep.insert( rdep.end(), funcs.begin(), funcs.end() ); - } - } + // create map of funcs that depend on specified molecule. + vector< vector< unsigned int > > funcMap( + stoichPtr_->getNumAllPools() ); + const vector< RateTerm* >& rates = stoichPtr_->getRateTerms(); + vector< FuncRate* > incrementRates; + vector< unsigned int > incrementRateIndex; + const vector< RateTerm* >::const_iterator q; + for ( unsigned int i = 0; i < rates.size(); ++i ) + { + FuncRate *term = + dynamic_cast< FuncRate* >( rates[i] ); + if (term) + { + incrementRates.push_back( term ); + incrementRateIndex.push_back( i ); + } + } + + for ( unsigned int k = 0; k < incrementRates.size(); ++k ) + { + const vector< unsigned int >& molIndex = + incrementRates[k]->getFuncArgIndex(); + for ( unsigned int j = 0; j < molIndex.size(); ++j ) + funcMap[ molIndex[j] ].push_back( incrementRateIndex[k] ); + } + + unsigned int numRates = stoichPtr_->getNumRates(); + sys_.dependentMathExpn.resize( numRates ); + vector< unsigned int > indices; + for ( unsigned int i = 0; i < numRates; ++i ) + { + // Algorithm: + // 1.Go through stoich matrix finding all the poolIndices affected + // by each Rate Term. + // 2.Use funcMap to look up FuncRateTerms affected by these indices + // 3. Add the rateTerm->FuncRateTerm mapping to the dependencies. + + const int* entry; + const unsigned int* colIndex; + unsigned int numInRow = + sys_.transposeN.getRow( i, &entry, &colIndex ); + // 1.Go through stoich matrix finding all the poolIndices affected + // by each Rate Term. + for ( unsigned int j = 0; j < numInRow; ++j ) + { + unsigned int molIndex = colIndex[j]; // Affected poolIndex + + // 2.Use funcMap to look up FuncRateTerms affected by these indices + vector< unsigned int >& funcs = funcMap[ molIndex ]; + // 3. Add the rateTerm->FuncRateTerm mapping to the dependencies. + vector< unsigned int >& rdep = sys_.dependency[i]; + rdep.insert( rdep.end(), funcs.begin(), funcs.end() ); + } + } } /* void Gsolve::fillMathDep() { // create map of funcs that depend on specified molecule. - vector< vector< unsigned int > > funcMap( + vector< vector< unsigned int > > funcMap( stoichPtr_->getNumAllPools() ); unsigned int numFuncs = stoichPtr_->getNumFuncs(); for ( unsigned int i = 0; i < numFuncs; ++i ) { @@ -732,9 +856,9 @@ void Gsolve::fillMathDep() for ( unsigned int j = 0; j < molIndex.size(); ++j ) funcMap[ molIndex[j] ].push_back( i ); } - // The output of each func is a mol indexed as + // The output of each func is a mol indexed as // numVarMols + numBufMols + i - unsigned int funcOffset = + unsigned int funcOffset = stoichPtr_->getNumVarPools() + stoichPtr_->getNumProxyPools() + stoichPtr_->getNumBufPools(); unsigned int numRates = stoichPtr_->getNumRates(); sys_.dependentMathExpn.resize( numRates ); @@ -745,7 +869,7 @@ void Gsolve::fillMathDep() // Extract the row of all molecules that depend on the reac. const int* entry; const unsigned int* colIndex; - unsigned int numInRow = + unsigned int numInRow = sys_.transposeN.getRow( i, &entry, &colIndex ); for ( unsigned int j = 0; j < numInRow; ++j ) { unsigned int molIndex = colIndex[j]; @@ -773,38 +897,39 @@ void Gsolve::fillMathDep() * Later. */ void Gsolve::insertMathDepReacs( unsigned int mathDepIndex, - unsigned int firedReac ) + unsigned int firedReac ) { - /* - unsigned int molIndex = sumTotals_[ mathDepIndex ].target( S_ ); - vector< unsigned int > reacIndices; - - // Extract the row of all reacs that depend on the target molecule - if ( N_.getRowIndices( molIndex, reacIndices ) > 0 ) { - vector< unsigned int >& dep = dependency_[ firedReac ]; - dep.insert( dep.end(), reacIndices.begin(), reacIndices.end() ); - } - */ + /* + unsigned int molIndex = sumTotals_[ mathDepIndex ].target( S_ ); + vector< unsigned int > reacIndices; + + // Extract the row of all reacs that depend on the target molecule + if ( N_.getRowIndices( molIndex, reacIndices ) > 0 ) { + vector< unsigned int >& dep = dependency_[ firedReac ]; + dep.insert( dep.end(), reacIndices.begin(), reacIndices.end() ); + } + */ } // Clean up dependency lists: Ensure only unique entries. // Also a reac cannot depend on itself. void Gsolve::makeReacDepsUnique() { - unsigned int numRates = stoichPtr_->getNumRates(); - for ( unsigned int i = 0; i < numRates; ++i ) { - vector< unsigned int >& dep = sys_.dependency[ i ]; - // Here we want to remove self-entries as well as duplicates. - sort( dep.begin(), dep.end() ); - vector< unsigned int >::iterator k = dep.begin(); - - /// STL stuff follows, with the usual weirdness. - vector< unsigned int >::iterator pos = - unique( dep.begin(), dep.end() ); - dep.resize( pos - dep.begin() ); - /* - */ - } + unsigned int numRates = stoichPtr_->getNumRates(); + for ( unsigned int i = 0; i < numRates; ++i ) + { + vector< unsigned int >& dep = sys_.dependency[ i ]; + // Here we want to remove self-entries as well as duplicates. + sort( dep.begin(), dep.end() ); + vector< unsigned int >::iterator k = dep.begin(); + + /// STL stuff follows, with the usual weirdness. + vector< unsigned int >::iterator pos = + unique( dep.begin(), dep.end() ); + dep.resize( pos - dep.begin() ); + /* + */ + } } ////////////////////////////////////////////////////////////// @@ -812,31 +937,36 @@ void Gsolve::makeReacDepsUnique() ////////////////////////////////////////////////////////////// unsigned int Gsolve::getPoolIndex( const Eref& e ) const { - return stoichPtr_->convertIdToPoolIndex( e.id() ); + return stoichPtr_->convertIdToPoolIndex( e.id() ); } unsigned int Gsolve::getVoxelIndex( const Eref& e ) const { - unsigned int ret = e.dataIndex(); - if ( ret < startVoxel_ || ret >= startVoxel_ + pools_.size() ) - return OFFNODE; - return ret - startVoxel_; + unsigned int ret = e.dataIndex(); + if ( ret < startVoxel_ || ret >= startVoxel_ + pools_.size() ) + return OFFNODE; + return ret - startVoxel_; } void Gsolve::setDsolve( Id dsolve ) { - if ( dsolve == Id () ) { - dsolvePtr_ = 0; - dsolve_ = Id(); - } else if ( dsolve.element()->cinfo()->isA( "Dsolve" ) ) { - dsolve_ = dsolve; - dsolvePtr_ = reinterpret_cast< ZombiePoolInterface* >( - dsolve.eref().data() ); - } else { - cout << "Warning: Gsolve::setDsolve: Object '" << dsolve.path() << - "' should be class Dsolve, is: " << - dsolve.element()->cinfo()->name() << endl; - } + if ( dsolve == Id () ) + { + dsolvePtr_ = 0; + dsolve_ = Id(); + } + else if ( dsolve.element()->cinfo()->isA( "Dsolve" ) ) + { + dsolve_ = dsolve; + dsolvePtr_ = reinterpret_cast< ZombiePoolInterface* >( + dsolve.eref().data() ); + } + else + { + cout << "Warning: Gsolve::setDsolve: Object '" << dsolve.path() << + "' should be class Dsolve, is: " << + dsolve.element()->cinfo()->name() << endl; + } } @@ -846,166 +976,197 @@ void Gsolve::setDsolve( Id dsolve ) void Gsolve::setN( const Eref& e, double v ) { - unsigned int vox = getVoxelIndex( e ); - if ( vox != OFFNODE ) { - if ( e.element()->cinfo()->isA( "ZombieBufPool" ) ) { - // Do NOT round it here, it is folded into rate term. - pools_[vox].setN( getPoolIndex( e ), v ); - // refresh rates because nInit controls ongoing value of n. - if ( sys_.isReady ) - pools_[vox].refreshAtot( &sys_ ); - } else { - pools_[vox].setN( getPoolIndex( e ), round( v ) ); - } - } + unsigned int vox = getVoxelIndex( e ); + if ( vox != OFFNODE ) + { + if ( e.element()->cinfo()->isA( "ZombieBufPool" ) ) + { + // Do NOT round it here, it is folded into rate term. + pools_[vox].setN( getPoolIndex( e ), v ); + // refresh rates because nInit controls ongoing value of n. + if ( sys_.isReady ) + pools_[vox].refreshAtot( &sys_ ); + } + else + { + pools_[vox].setN( getPoolIndex( e ), round( v ) ); + } + } } double Gsolve::getN( const Eref& e ) const { - unsigned int vox = getVoxelIndex( e ); - if ( vox != OFFNODE ) - return pools_[vox].getN( getPoolIndex( e ) ); - return 0.0; + unsigned int vox = getVoxelIndex( e ); + if ( vox != OFFNODE ) + return pools_[vox].getN( getPoolIndex( e ) ); + return 0.0; } void Gsolve::setNinit( const Eref& e, double v ) { - unsigned int vox = getVoxelIndex( e ); - if ( vox != OFFNODE ) { - if ( e.element()->cinfo()->isA( "ZombieBufPool" ) ) { - // Do NOT round it here, it is folded into rate term. - pools_[vox].setNinit( getPoolIndex( e ), v ); - // refresh rates because nInit controls ongoing value of n. - if ( sys_.isReady ) - pools_[vox].refreshAtot( &sys_ ); - } else { - // I now do the rounding at reinit time. It is better there as - // it can give a distinct value each cycle. It is also better - // to keep the full resolution of Ninit for volume scaling. - // pools_[vox].setNinit( getPoolIndex( e ), round( v ) ); - pools_[vox].setNinit( getPoolIndex( e ), v ); - } - } + unsigned int vox = getVoxelIndex( e ); + if ( vox != OFFNODE ) + { + if ( e.element()->cinfo()->isA( "ZombieBufPool" ) ) + { + // Do NOT round it here, it is folded into rate term. + pools_[vox].setNinit( getPoolIndex( e ), v ); + // refresh rates because nInit controls ongoing value of n. + if ( sys_.isReady ) + pools_[vox].refreshAtot( &sys_ ); + } + else + { + // I now do the rounding at reinit time. It is better there as + // it can give a distinct value each cycle. It is also better + // to keep the full resolution of Ninit for volume scaling. + // pools_[vox].setNinit( getPoolIndex( e ), round( v ) ); + pools_[vox].setNinit( getPoolIndex( e ), v ); + } + } } double Gsolve::getNinit( const Eref& e ) const { - unsigned int vox = getVoxelIndex( e ); - if ( vox != OFFNODE ) - return pools_[vox].getNinit( getPoolIndex( e ) ); - return 0.0; + unsigned int vox = getVoxelIndex( e ); + if ( vox != OFFNODE ) + return pools_[vox].getNinit( getPoolIndex( e ) ); + return 0.0; } void Gsolve::setDiffConst( const Eref& e, double v ) { - ; // Do nothing. + ; // Do nothing. } double Gsolve::getDiffConst( const Eref& e ) const { - return 0; + return 0; } void Gsolve::setNumPools( unsigned int numPoolSpecies ) { - sys_.isReady = false; - unsigned int numVoxels = pools_.size(); - for ( unsigned int i = 0 ; i < numVoxels; ++i ) { - pools_[i].resizeArrays( numPoolSpecies ); - } + sys_.isReady = false; + unsigned int numVoxels = pools_.size(); + for ( unsigned int i = 0 ; i < numVoxels; ++i ) + { + pools_[i].resizeArrays( numPoolSpecies ); + } } unsigned int Gsolve::getNumPools() const { - if ( pools_.size() > 0 ) - return pools_[0].size(); - return 0; + if ( pools_.size() > 0 ) + return pools_[0].size(); + return 0; } void Gsolve::getBlock( vector< double >& values ) const { - unsigned int startVoxel = values[0]; - unsigned int numVoxels = values[1]; - unsigned int startPool = values[2]; - unsigned int numPools = values[3]; - - assert( startVoxel >= startVoxel_ ); - assert( numVoxels <= pools_.size() ); - assert( pools_.size() > 0 ); - assert( numPools + startPool <= pools_[0].size() ); - values.resize( 4 + numVoxels * numPools ); - - for ( unsigned int i = 0; i < numVoxels; ++i ) { - const double* v = pools_[ startVoxel + i ].S(); - for ( unsigned int j = 0; j < numPools; ++j ) { - values[ 4 + j * numVoxels + i] = v[ j + startPool ]; - } - } + unsigned int startVoxel = values[0]; + unsigned int numVoxels = values[1]; + unsigned int startPool = values[2]; + unsigned int numPools = values[3]; + + assert( startVoxel >= startVoxel_ ); + assert( numVoxels <= pools_.size() ); + assert( pools_.size() > 0 ); + assert( numPools + startPool <= pools_[0].size() ); + values.resize( 4 + numVoxels * numPools ); + + for ( unsigned int i = 0; i < numVoxels; ++i ) + { + const double* v = pools_[ startVoxel + i ].S(); + for ( unsigned int j = 0; j < numPools; ++j ) + { + values[ 4 + j * numVoxels + i] = v[ j + startPool ]; + } + } } void Gsolve::setBlock( const vector< double >& values ) { - unsigned int startVoxel = values[0]; - unsigned int numVoxels = values[1]; - unsigned int startPool = values[2]; - unsigned int numPools = values[3]; - - assert( startVoxel >= startVoxel_ ); - assert( numVoxels <= pools_.size() ); - assert( pools_.size() > 0 ); - assert( numPools + startPool <= pools_[0].size() ); - - for ( unsigned int i = 0; i < numVoxels; ++i ) { - double* v = pools_[ startVoxel + i ].varS(); - for ( unsigned int j = 0; j < numPools; ++j ) { - v[ j + startPool ] = values[ 4 + j * numVoxels + i ]; - } - } + unsigned int startVoxel = values[0]; + unsigned int numVoxels = values[1]; + unsigned int startPool = values[2]; + unsigned int numPools = values[3]; + + assert( startVoxel >= startVoxel_ ); + assert( numVoxels <= pools_.size() ); + assert( pools_.size() > 0 ); + assert( numPools + startPool <= pools_[0].size() ); + + for ( unsigned int i = 0; i < numVoxels; ++i ) + { + double* v = pools_[ startVoxel + i ].varS(); + for ( unsigned int j = 0; j < numPools; ++j ) + { + v[ j + startPool ] = values[ 4 + j * numVoxels + i ]; + } + } } ////////////////////////////////////////////////////////////////////////// void Gsolve::updateVoxelVol( vector< double > vols ) { - // For now we assume identical numbers of voxels. Also assume - // identical voxel junctions. But it should not be too hard to - // update those too. - if ( vols.size() == pools_.size() ) { - for ( unsigned int i = 0; i < vols.size(); ++i ) { - pools_[i].setVolumeAndDependencies( vols[i] ); - } - stoichPtr_->setupCrossSolverReacVols(); - updateRateTerms( ~0U ); - } + // For now we assume identical numbers of voxels. Also assume + // identical voxel junctions. But it should not be too hard to + // update those too. + if ( vols.size() == pools_.size() ) + { + for ( unsigned int i = 0; i < vols.size(); ++i ) + { + pools_[i].setVolumeAndDependencies( vols[i] ); + } + stoichPtr_->setupCrossSolverReacVols(); + updateRateTerms( ~0U ); + } } void Gsolve::updateRateTerms( unsigned int index ) { - if ( index == ~0U ) { - // unsigned int numCrossRates = stoichPtr_->getNumRates() - stoichPtr_->getNumCoreRates(); - for ( unsigned int i = 0 ; i < pools_.size(); ++i ) { - // pools_[i].resetXreacScale( numCrossRates ); - pools_[i].updateAllRateTerms( stoichPtr_->getRateTerms(), - stoichPtr_->getNumCoreRates() ); - } - } else if ( index < stoichPtr_->getNumRates() ) { - for ( unsigned int i = 0 ; i < pools_.size(); ++i ) - pools_[i].updateRateTerms( stoichPtr_->getRateTerms(), - stoichPtr_->getNumCoreRates(), index ); - } + if ( index == ~0U ) + { + // unsigned int numCrossRates = stoichPtr_->getNumRates() - stoichPtr_->getNumCoreRates(); + for ( unsigned int i = 0 ; i < pools_.size(); ++i ) + { + // pools_[i].resetXreacScale( numCrossRates ); + pools_[i].updateAllRateTerms( stoichPtr_->getRateTerms(), + stoichPtr_->getNumCoreRates() ); + } + } + else if ( index < stoichPtr_->getNumRates() ) + { + for ( unsigned int i = 0 ; i < pools_.size(); ++i ) + pools_[i].updateRateTerms( stoichPtr_->getRateTerms(), + stoichPtr_->getNumCoreRates(), index ); + } } ////////////////////////////////////////////////////////////////////////// VoxelPoolsBase* Gsolve::pools( unsigned int i ) { - if ( pools_.size() > i ) - return &pools_[i]; - return 0; + if ( pools_.size() > i ) + return &pools_[i]; + return 0; } double Gsolve::volume( unsigned int i ) const { - if ( pools_.size() > i ) - return pools_[i].getVolume(); - return 0.0; + if ( pools_.size() > i ) + return pools_[i].getVolume(); + return 0.0; +} + +#if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC +unsigned int Gsolve::getNumThreads( ) const +{ + return numThreads_; } + +void Gsolve::setNumThreads( unsigned int x ) +{ + numThreads_ = x; +} +#endif diff --git a/moose-core/ksolve/Gsolve.h b/moose-core/ksolve/Gsolve.h index 0e35eab89f6efa7a6cea1cf40edfb2b9420039e2..9cf59a008d9c9159b8470ce5f6ac859900d628c4 100644 --- a/moose-core/ksolve/Gsolve.h +++ b/moose-core/ksolve/Gsolve.h @@ -13,140 +13,160 @@ class Stoich; class Gsolve: public ZombiePoolInterface { - public: - Gsolve(); - ~Gsolve(); - - ////////////////////////////////////////////////////////////////// - // Field assignment stuff - ////////////////////////////////////////////////////////////////// - Id getStoich() const; - void setStoich( Id stoich ); /// Inherited from ZombiePoolInterface. - Id getCompartment() const; - void setCompartment( Id compt ); - - 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. - */ - void setNumAllVoxels( unsigned int num ); - - /** - * Assigns number of different pools (chemical species) present in - * each voxel. - */ - void setNumPools( unsigned int num ); /// Inherited. - unsigned int getNumPools() const; /// Inherited. - VoxelPoolsBase* pools( unsigned int i ); /// Inherited. - double volume( unsigned int i ) const; - - /// Returns the vector of pool Num at the specified voxel. - vector< double > getNvec( unsigned int voxel) const; - void setNvec( unsigned int voxel, vector< double > vec ); - ////////////////////////////////////////////////////////////////// - // Dest Finfos - ////////////////////////////////////////////////////////////////// - void process( const Eref& e, ProcPtr p ); - 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 ); - - ////////////////////////////////////////////////////////////////// - // Solver setup functions - ////////////////////////////////////////////////////////////////// - void rebuildGssaSystem(); - void fillMmEnzDep(); - void fillPoolFuncDep(); - void fillIncrementFuncDep(); - void insertMathDepReacs( unsigned int mathDepIndex, - unsigned int firedReac ); - void makeReacDepsUnique(); - - ////////////////////////////////////////////////////////////////// - // Solver interface functions - ////////////////////////////////////////////////////////////////// - unsigned int getPoolIndex( const Eref& e ) const; - unsigned int getVoxelIndex( const Eref& e ) const; - vector< unsigned int > getNumFire( unsigned int voxel) const; - - /** - * Inherited. Needed for reac-diff calculations so the Gsolve can - * orchestrate the data transfer between the itself and the - * diffusion solver. - */ - void setDsolve( Id dsolve ); - - ////////////////////////////////////////////////////////////////// - // 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; - - void getBlock( vector< double >& values ) const; - void setBlock( const vector< double >& values ); - - /** - * Rescale specified voxel rate term following rate constant change - * or volume change. If index == ~0U then does all terms. - */ - void updateRateTerms( unsigned int index ); - - - ////////////////////////////////////////////////////////////////// - /// Flag: returns true if randomized round to integers is done. - bool getRandInit() const; - /// Flag: set true if randomized round to integers is to be done. - void setRandInit( bool val ); - - /// Flag: returns true if randomized round to integers is done. - bool getClockedUpdate() const; - /// Flag: set true if randomized round to integers is to be done. - void setClockedUpdate( bool val ); - - ////////////////////////////////////////////////////////////////// - static SrcFinfo2< Id, vector< double > >* xComptOut(); - static const Cinfo* initCinfo(); - private: - GssaSystem sys_; - /** - * Each VoxelPools entry handles all the pools in a single voxel. - * Each entry knows how to update itself in order to complete - * the kinetic calculations for that voxel. The ksolver does - * multinode management by indexing only the subset of entries - * present on this node. - */ - vector< GssaVoxelPools > pools_; - - /// First voxel indexed on the current node. - unsigned int startVoxel_; - - /// Utility ptr used to help Pool Id lookups by the Ksolve. - Stoich* stoichPtr_; - - /** - * Id of diffusion solver, needed for coordinating numerics. - */ - Id dsolve_; - - /// Pointer to diffusion solver - ZombiePoolInterface* dsolvePtr_; - - /// Flag: True if atot should be updated every clock tick - bool useClockedUpdate_; +public: + Gsolve(); + ~Gsolve(); + + ////////////////////////////////////////////////////////////////// + // Field assignment stuff + ////////////////////////////////////////////////////////////////// + Id getStoich() const; + void setStoich( Id stoich ); /// Inherited from ZombiePoolInterface. + Id getCompartment() const; + void setCompartment( Id compt ); + + 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. + */ + void setNumAllVoxels( unsigned int num ); + + /** + * Assigns number of different pools (chemical species) present in + * each voxel. + */ + void setNumPools( unsigned int num ); /// Inherited. + unsigned int getNumPools() const; /// Inherited. + VoxelPoolsBase* pools( unsigned int i ); /// Inherited. + double volume( unsigned int i ) const; + + /// Returns the vector of pool Num at the specified voxel. + vector< double > getNvec( unsigned int voxel) const; + void setNvec( unsigned int voxel, vector< double > vec ); + ////////////////////////////////////////////////////////////////// + // Dest Finfos + ////////////////////////////////////////////////////////////////// + void process( const Eref& e, ProcPtr p ); + 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 ); + + ////////////////////////////////////////////////////////////////// + // Solver setup functions + ////////////////////////////////////////////////////////////////// + void rebuildGssaSystem(); + void fillMmEnzDep(); + void fillPoolFuncDep(); + void fillIncrementFuncDep(); + void insertMathDepReacs( unsigned int mathDepIndex, + unsigned int firedReac ); + void makeReacDepsUnique(); + + ////////////////////////////////////////////////////////////////// + // Solver interface functions + ////////////////////////////////////////////////////////////////// + unsigned int getPoolIndex( const Eref& e ) const; + unsigned int getVoxelIndex( const Eref& e ) const; + vector< unsigned int > getNumFire( unsigned int voxel) const; + + /** + * Inherited. Needed for reac-diff calculations so the Gsolve can + * orchestrate the data transfer between the itself and the + * diffusion solver. + */ + void setDsolve( Id dsolve ); + + ////////////////////////////////////////////////////////////////// + // 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; + + void getBlock( vector< double >& values ) const; + void setBlock( const vector< double >& values ); + + /** + * Rescale specified voxel rate term following rate constant change + * or volume change. If index == ~0U then does all terms. + */ + void updateRateTerms( unsigned int index ); + + + // A wrapper to call advance function of GssaVoxelPool + // concurrently. + void parallel_advance(int begin, int end, size_t nWorkers + , ProcPtr p , const GssaSystem* sys + ); + + ////////////////////////////////////////////////////////////////// + /// Flag: returns true if randomized round to integers is done. + bool getRandInit() const; + /// Flag: set true if randomized round to integers is to be done. + void setRandInit( bool val ); + + /// Flag: returns true if randomized round to integers is done. + bool getClockedUpdate() const; + /// Flag: set true if randomized round to integers is to be done. + void setClockedUpdate( bool val ); + +#if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC + unsigned int getNumThreads( ) const; + void setNumThreads( unsigned int x ); +#endif + + ////////////////////////////////////////////////////////////////// + static SrcFinfo2< Id, vector< double > >* xComptOut(); + static const Cinfo* initCinfo(); +private: + +#if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC + /** + * @brief Number of threads to use when parallel version of Gsolve is + * used. + */ + unsigned int numThreads_; +#endif + + GssaSystem sys_; + /** + * Each VoxelPools entry handles all the pools in a single voxel. + * Each entry knows how to update itself in order to complete + * the kinetic calculations for that voxel. The ksolver does + * multinode management by indexing only the subset of entries + * present on this node. + */ + vector< GssaVoxelPools > pools_; + + /// First voxel indexed on the current node. + unsigned int startVoxel_; + + /// Utility ptr used to help Pool Id lookups by the Ksolve. + Stoich* stoichPtr_; + + /** + * Id of diffusion solver, needed for coordinating numerics. + */ + Id dsolve_; + + /// Pointer to diffusion solver + ZombiePoolInterface* dsolvePtr_; + + /// Flag: True if atot should be updated every clock tick + bool useClockedUpdate_; }; #endif // _GSOLVE_H diff --git a/moose-core/ksolve/GssaSystem.h b/moose-core/ksolve/GssaSystem.h index 6f9aa001c8297d2b7d53d5642236854f05af3efd..6c81c5139f1efd24c1271957e099dacd5b16e7d0 100644 --- a/moose-core/ksolve/GssaSystem.h +++ b/moose-core/ksolve/GssaSystem.h @@ -18,7 +18,7 @@ class Stoich; class GssaSystem { - public: + public: GssaSystem() : stoich( 0 ), useRandInit( true ), isReady( false ) {;} @@ -35,8 +35,8 @@ class GssaSystem * When initializing the mol# from floating-point Sinit values, * we have two options. One is to look at each Sinit, and round * to the nearest integer. The other is to look at each Sinit, - * and probabilistically round up or down depending on the - * value. For example, if we had a Sinit value of 1.49, + * and probabilistically round up or down depending on the + * value. For example, if we had a Sinit value of 1.49, * this would always be rounded to 1.0 if the flag is false, * and would be rounded to 1.0 and 2.0 in the ratio 51:49 if * the flag is true. diff --git a/moose-core/ksolve/GssaVoxelPools.cpp b/moose-core/ksolve/GssaVoxelPools.cpp index b74900aa7bf9183474b51e4144c234bb4eaf183a..0b09a418712f143bba241b6c7dc780abed4779f6 100644 --- a/moose-core/ksolve/GssaVoxelPools.cpp +++ b/moose-core/ksolve/GssaVoxelPools.cpp @@ -97,7 +97,7 @@ void GssaVoxelPools::updateDependentRates( } } -unsigned int GssaVoxelPools::pickReac() +unsigned int GssaVoxelPools::pickReac() { double r = rng_.uniform( ) * atot_; double sum = 0.0; @@ -203,7 +203,7 @@ void GssaVoxelPools::advance( const ProcInfo* p, const GssaSystem* g ) double sign = double(v_[rindex] >= 0) - double(0 > v_[rindex] ); g->transposeN.fireReac( rindex, Svec(), sign ); numFire_[rindex]++; - + double r = rng_.uniform(); while ( r <= 0.0 ) { diff --git a/moose-core/ksolve/GssaVoxelPools.h b/moose-core/ksolve/GssaVoxelPools.h index fc638d4541b13bb18342201dea596d30d7020f77..1d3a3dbac7d18c341ddc3e64002c307753758121 100644 --- a/moose-core/ksolve/GssaVoxelPools.h +++ b/moose-core/ksolve/GssaVoxelPools.h @@ -98,7 +98,7 @@ private: */ vector< double > v_; // Possibly we should put independent RNGS, so save one here. - + // Count how many times each reaction has fired. vector< unsigned int > numFire_; diff --git a/moose-core/ksolve/KinSparseMatrix.cpp b/moose-core/ksolve/KinSparseMatrix.cpp index a83e12ae75c6624ee0eb5b988b73c313350cf483..59783b29269fa71c24fdabdd397af606da799b79 100644 --- a/moose-core/ksolve/KinSparseMatrix.cpp +++ b/moose-core/ksolve/KinSparseMatrix.cpp @@ -13,19 +13,19 @@ #include <vector> #include <iostream> #include <cassert> -#include <cmath> +#include <cmath> #include "SparseMatrix.h" #include "utility/numutil.h" #include "KinSparseMatrix.h" using namespace std; -/** +/** * Returns the dot product of the specified row with the * vector v. v corresponds to the vector of reaction rates. * v must have nColumns entries. */ -double KinSparseMatrix::computeRowRate( +double KinSparseMatrix::computeRowRate( unsigned int row, const vector< double >& v ) const { @@ -51,7 +51,7 @@ double KinSparseMatrix::computeRowRate( unsigned int rs = rowStart_[ row ]; vector< unsigned int >::const_iterator j = colIndex_.begin() + rs; vector< int >::const_iterator end = N_.begin() + rowStart_[ row + 1 ]; - + double ret = 0.0; for ( i = N_.begin() + rs; i != end; i++ ) ret += *i * v[ *j++ ]; @@ -70,7 +70,7 @@ double KinSparseMatrix::computeRowRate( * Fills up 'deps' with reac#s that depend on the row argument. * Does NOT ensure that list is unique. */ -void KinSparseMatrix::getGillespieDependence( +void KinSparseMatrix::getGillespieDependence( unsigned int row, vector< unsigned int >& deps ) const { @@ -82,7 +82,7 @@ void KinSparseMatrix::getGillespieDependence( unsigned int jend = rowStart_[ row + 1 ]; unsigned int k = rowStart_[ i ]; unsigned int kend = rowStart_[ i + 1 ]; - + while ( j < jend && k < kend ) { if ( colIndex_[ j ] == colIndex_[ k ] ) { /* Pre 28 Nov 2015. Why below zero? Shouldn't it be any? @@ -110,17 +110,17 @@ void KinSparseMatrix::getGillespieDependence( * the molecules for a given reac: a column in the original N matrix. * Direction [-1,+1] specifies whether the reaction is forward or backward. */ -void KinSparseMatrix::fireReac( unsigned int reacIndex, vector< double >& S, double direction ) +void KinSparseMatrix::fireReac( unsigned int reacIndex, vector< double >& S, double direction ) const { assert( ncolumns_ == S.size() && reacIndex < nrows_ ); unsigned int rowBeginIndex = rowStart_[ reacIndex ]; // vector< int >::const_iterator rowEnd = N_.begin() + rowStart_[ reacIndex + 1]; - vector< int >::const_iterator rowBegin = + vector< int >::const_iterator rowBegin = N_.begin() + rowBeginIndex; - vector< int >::const_iterator rowEnd = + vector< int >::const_iterator rowEnd = N_.begin() + rowTruncated_[ reacIndex ]; - vector< unsigned int >::const_iterator molIndex = + vector< unsigned int >::const_iterator molIndex = colIndex_.begin() + rowBeginIndex; for ( vector< int >::const_iterator i = rowBegin; i != rowEnd; ++i ) { @@ -135,7 +135,7 @@ void KinSparseMatrix::fireReac( unsigned int reacIndex, vector< double >& S, dou /** * This function generates a new internal list of rowEnds, such that * they are all less than the maxColumnIndex. - * It is used because in fireReac we don't want to update all the + * It is used because in fireReac we don't want to update all the * molecules, only those that are variable. */ void KinSparseMatrix::truncateRow( unsigned int maxColumnIndex ) @@ -145,7 +145,7 @@ void KinSparseMatrix::truncateRow( unsigned int maxColumnIndex ) return; for ( unsigned int i = 0; i < nrows_; ++i ) { unsigned int endCol = rowStart_[ i ]; - for ( unsigned int j = rowStart_[ i ]; + for ( unsigned int j = rowStart_[ i ]; j < rowStart_[ i + 1 ]; ++j ) { if ( colIndex_[ j ] < maxColumnIndex ) { endCol = j + 1; @@ -164,7 +164,7 @@ void makeVecUnique( vector< unsigned int >& v ) v.resize( pos - v.begin() ); } -vector< int > KinSparseMatrix::matrixEntry() const +vector< int > KinSparseMatrix::matrixEntry() const { return N_; } @@ -195,7 +195,7 @@ void testKinSparseMatrix() // // When halfreac 0 fires, it affects 0, 1, 2, 4, 6. // and so on. - static int transposon[][ 8 ] = { + static int transposon[][ 8 ] = { { -1, 1, 0, 0, -1, 1, -1, 1 }, { -1, 1, 0, 0, 0, 0, 0, 0 }, { 1, -1, -1, 1, 0, 0, 0, 0 }, @@ -257,7 +257,7 @@ void testKinSparseMatrix() //////////////////////////////////////////////////////////////// // Checking generation of dependency graphs. //////////////////////////////////////////////////////////////// - + KinSparseMatrix trans; vector< unsigned int > deps; trans.getGillespieDependence( 0, deps ); diff --git a/moose-core/ksolve/KinSparseMatrix.h b/moose-core/ksolve/KinSparseMatrix.h index 9d18c262d32f8ff147e20ab0d04fd0b79fcec787..4cc48aecd31e37a6b06b0a7e690a4557336fce99 100644 --- a/moose-core/ksolve/KinSparseMatrix.h +++ b/moose-core/ksolve/KinSparseMatrix.h @@ -12,20 +12,20 @@ class KinSparseMatrix: public SparseMatrix< int > { - public: + public: // KinSparseMatrix(); // KinSparseMatrix( unsigned int nrows, unsigned int ncolumns ); - /** - * Returns all non-zero column indices, for the specified row. - * This gives reac #s in orig matrix, and molecule #s in the + /** + * Returns all non-zero column indices, for the specified row. + * This gives reac #s in orig matrix, and molecule #s in the * transposed matrix * Not needed. The getRow function does all this, more efficiently. int getRowIndices( unsigned int row, vector< unsigned int >& indices ); */ - - /** + + /** * Returns the dot product of the specified row with the * vector v. v corresponds to the vector of reaction rates. * v must have nColumns entries. @@ -35,25 +35,25 @@ class KinSparseMatrix: public SparseMatrix< int > ) const; - /** + /** * Does a special self-product of the specified row. Output * is the set of nonzero indices in the product * abs( Rij ) * neg( Rjk ) for the specified index i, where * neg( val ) is true only if val < 0. */ - void getGillespieDependence( + void getGillespieDependence( unsigned int row, vector< unsigned int >& cols ) const; - /** + /** * Fires a stochastic reaction: It undergoes a single transition * This operation updates the mol concs due to the reacn. * Direction is +1 or -1, specifies direction of reaction */ - void fireReac( unsigned int reacIndex, vector< double >& S, + void fireReac( unsigned int reacIndex, vector< double >& S, double direction ) const; - - /** + + /** * This function generates a new internal list of rowEnds, such * that they are all less than the maxColumnIndex. * It is used because in fireReac we don't want to update all the diff --git a/moose-core/ksolve/Ksolve.cpp b/moose-core/ksolve/Ksolve.cpp index 56a85c4abece0d6ea4a90dd70b21b0c5e03d908e..a7ee4c7adb45109227d2262613ec202426dcba6d 100644 --- a/moose-core/ksolve/Ksolve.cpp +++ b/moose-core/ksolve/Ksolve.cpp @@ -32,6 +32,10 @@ #include "../mesh/ChemCompt.h" #include "Ksolve.h" +#include <future> +#include <atomic> +#include <thread> + const unsigned int OFFNODE = ~0; // static function @@ -84,6 +88,7 @@ const Cinfo* Ksolve::initCinfo() &Ksolve::getEpsRel ); + static ValueFinfo< Ksolve, Id > compartment( "compartment", "Compartment in which the Ksolve reaction system lives.", @@ -112,6 +117,15 @@ const Cinfo* Ksolve::initCinfo() &Ksolve::getNumAllVoxels ); +#if PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC + static ValueFinfo< Ksolve, unsigned int > numThreads ( + "numThreads", + "Number of threads to use (applicable in deterministic case)", + &Ksolve::setNumThreads, + &Ksolve::getNumThreads + ); +#endif + static ValueFinfo< Ksolve, unsigned int > numPools( "numPools", "Number of molecular pools in the entire reac-diff system, " @@ -199,7 +213,10 @@ const Cinfo* Ksolve::initCinfo() { &method, // Value &epsAbs, // Value - &epsRel, // Value + &epsRel , // Value +#if PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC + &numThreads, // Value +#endif &compartment, // Value &numLocalVoxels, // ReadOnlyValue &nVec, // LookupValue @@ -240,6 +257,9 @@ Ksolve::Ksolve() #endif epsAbs_( 1e-7 ), epsRel_( 1e-7 ), +#if PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC + numThreads_( 3 ), +#endif pools_( 1 ), startVoxel_( 0 ), dsolve_(), @@ -317,6 +337,18 @@ void Ksolve::setEpsRel( double epsRel ) } } +#if PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC +void Ksolve::setNumThreads( unsigned int x ) +{ + numThreads_ = x; +} + +unsigned int Ksolve::getNumThreads( ) const +{ + return numThreads_; +} +#endif + Id Ksolve::getStoich() const { return stoich_; @@ -501,6 +533,7 @@ void Ksolve::process( const Eref& e, ProcPtr p ) { if ( isBuilt_ == false ) return; + // First, handle incoming diffusion values, update S with those. if ( dsolvePtr_ ) { @@ -524,6 +557,7 @@ void Ksolve::process( const Eref& e, ProcPtr p ) */ setBlock( dvalues ); } + // Second, take the arrived xCompt reac values and update S with them. for ( unsigned int i = 0; i < xfer_.size(); ++i ) { @@ -535,23 +569,52 @@ void Ksolve::process( const Eref& e, ProcPtr p ) xf.xferPoolIdx, xf.values, xf.lastValues, j ); } } + // Third, record the current value of pools as the reference for the // next cycle. for ( unsigned int i = 0; i < xfer_.size(); ++i ) { XferInfo& xf = xfer_[i]; for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) - { pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx ); - } } + size_t nvPools = pools_.size( ); + +#ifdef PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC // Fourth, do the numerical integration for all reactions. - for ( vector< VoxelPools >::iterator - i = pools_.begin(); i != pools_.end(); ++i ) + size_t grainSize = min( nvPools, 1 + (nvPools / numThreads_ ) ); + size_t nWorkers = nvPools / grainSize; + + if( 1 == nWorkers || 1 == nvPools ) { - i->advance( p ); + if( numThreads_ > 1 ) + { +#ifndef NDEBUG + cout << "Debug: Reset to 1 threads " << endl; +#endif + numThreads_ = 1; + } + + for ( size_t i = 0; i < nvPools; i++ ) + pools_[i].advance( p ); } + else + { + /*----------------------------------------------------------------------------- + * Somewhat complicated computation to compute the number of threads. 1 + * thread per (at least) voxel pool is ideal situation. + *-----------------------------------------------------------------------------*/ + //cout << "Grain size " << grainSize << " Workers : " << nWorkers << endl; + for (size_t i = 0; i < nWorkers; i++) + parallel_advance( i * grainSize, (i+1) * grainSize, nWorkers, p ); + } +#else + for ( size_t i = 0; i < nvPools; i++ ) + pools_[i].advance( p ); +#endif + + // Finally, assemble and send the integrated values off for the Dsolve. if ( dsolvePtr_ ) { @@ -565,10 +628,41 @@ void Ksolve::process( const Eref& e, ProcPtr p ) } } + +#if PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC +/** + * @brief Advance voxels pools using parallel Ksolve. + * + * @param begin + * @param end + * @param p + */ +void Ksolve::parallel_advance(int begin, int end, size_t nWorkers, ProcPtr p) +{ + std::atomic<int> idx( begin ); + for (size_t cpu = 0; cpu != nWorkers; ++cpu) + { + std::async( std::launch::async + , [this, &idx, end, p]() { + for (;;) + { + int i = idx++; + if (i >= end) + break; + pools_[i].advance( p ); + } + } + ); + } +} +#endif + + void Ksolve::reinit( const Eref& e, ProcPtr p ) { if ( !stoichPtr_ ) - return; + return; + if ( isBuilt_ ) { for ( unsigned int i = 0 ; i < pools_.size(); ++i ) @@ -579,6 +673,7 @@ void Ksolve::reinit( const Eref& e, ProcPtr p ) cout << "Warning:Ksolve::reinit: Reaction system not initialized\n"; return; } + // cout << "************************* path = " << e.id().path() << endl; for ( unsigned int i = 0; i < xfer_.size(); ++i ) { @@ -600,7 +695,14 @@ void Ksolve::reinit( const Eref& e, ProcPtr p ) j, xf.lastValues, xf.xferPoolIdx ); } } + +#if PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC + if( 1 < getNumThreads( ) ) + cout << "Debug: User wants Ksolve with " << numThreads_ << " threads" << endl; +#endif + } + ////////////////////////////////////////////////////////////// // init operations. ////////////////////////////////////////////////////////////// @@ -626,25 +728,20 @@ void Ksolve::initProc( const Eref& e, ProcPtr p ) void Ksolve::initReinit( const Eref& e, ProcPtr p ) { for ( unsigned int i = 0 ; i < pools_.size(); ++i ) - { pools_[i].reinit( p->dt ); - } - // vector< vector< double > > values( xfer_.size() ); + for ( unsigned int i = 0; i < xfer_.size(); ++i ) { XferInfo& xf = xfer_[i]; unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size(); -// xf.values.assign( size, 0.0 ); xf.lastValues.assign( size, 0.0 ); for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) { unsigned int vox = xf.xferVoxel[j]; pools_[ vox ].xferOut( j, xf.lastValues, xf.xferPoolIdx ); - // values[i] = xf.lastValues; } xComptOut()->sendTo( e, xf.ksolve, e.id(), xf.lastValues ); } - // xComptOut()->sendVec( e, values ); } /** diff --git a/moose-core/ksolve/Ksolve.h b/moose-core/ksolve/Ksolve.h index a1435c17d2bd887d85fde6c4369913df1325ea57..5e2153bee804a5fa10e812ff0c6bcfd4561b14f5 100644 --- a/moose-core/ksolve/Ksolve.h +++ b/moose-core/ksolve/Ksolve.h @@ -41,6 +41,7 @@ public: Id getDsolve() const; void setDsolve( Id dsolve ); /// Inherited from ZombiePoolInterface. + unsigned int getNumLocalVoxels() const; unsigned int getNumAllVoxels() const; /** @@ -53,6 +54,15 @@ public: vector< double > getNvec( unsigned int voxel) const; void setNvec( unsigned int voxel, vector< double > vec ); +#if PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC + // Set number of threads to use (for deterministic case only). + unsigned int getNumThreads( ) const; + void setNumThreads( unsigned int x ); + + // Parallel advance(). + void parallel_advance(int begin, int end, size_t nWorkers, ProcPtr p); +#endif + /** * This does a quick and dirty estimate of the timestep suitable * for this sytem @@ -100,6 +110,7 @@ public: */ void setNumPools( unsigned int num ); unsigned int getNumPools() const; + VoxelPoolsBase* pools( unsigned int i ); double volume( unsigned int i ) const; @@ -146,6 +157,14 @@ private: string method_; double epsAbs_; double epsRel_; + +#if PARALLELIZE_KSOLVE_WITH_CPP11_ASYNC + /** + * @brief Number of threads to use. Only applicable for deterministic case. + */ + unsigned int numThreads_; +#endif + /** * Each VoxelPools entry handles all the pools in a single voxel. * Each entry knows how to update itself in order to complete @@ -168,6 +187,7 @@ private: /// Pointer to diffusion solver ZombiePoolInterface* dsolvePtr_; + }; #endif // _KSOLVE_H diff --git a/moose-core/ksolve/NonlinearSystem.h b/moose-core/ksolve/NonlinearSystem.h index 71c893ddfeabc3906f185cb63608c87ce4bab247..5792f28773388b0796aefe980cc065d21d7586b6 100644 --- a/moose-core/ksolve/NonlinearSystem.h +++ b/moose-core/ksolve/NonlinearSystem.h @@ -62,7 +62,7 @@ class ReacInfo /* Matrix inversion routine. Uses lu_factorize and lu_substitute in uBLAS to invert a matrix */ template<class T> -bool inverse(const ublas::matrix<T>& input, ublas::matrix<T>& inverse) +bool inverse(const ublas::matrix<T>& input, ublas::matrix<T>& inverse) { using namespace boost::numeric::ublas; typedef permutation_matrix<std::size_t> pmatrix; @@ -103,7 +103,7 @@ public: x1.resize( size_, 0); ri.nVec.resize( size_ ); - dx_ = sqrt( numeric_limits<double>::epsilon() ); + dx_ = sqrt( numeric_limits<double>::epsilon() ); } vector_type compute_at(const vector_type& x) diff --git a/moose-core/ksolve/OdeSystem.h b/moose-core/ksolve/OdeSystem.h index 9a18191cce9aebd6f032c36ce52f85314b2ca5fd..0f7e37a64c5eae9f54b5055641528bf98edb24c5 100644 --- a/moose-core/ksolve/OdeSystem.h +++ b/moose-core/ksolve/OdeSystem.h @@ -27,7 +27,7 @@ class OdeSystem { std::string method; // GSL stuff - + #ifdef USE_GSL gsl_odeiv2_system gslSys; const gsl_odeiv2_step_type* gslStep; diff --git a/moose-core/ksolve/RateTerm.h b/moose-core/ksolve/RateTerm.h index ae5847b361941040079714f2d17d3138ab958dfd..9212c9a93fd14120eed8d4394693ff46ed141136 100644 --- a/moose-core/ksolve/RateTerm.h +++ b/moose-core/ksolve/RateTerm.h @@ -47,12 +47,12 @@ class RateTerm * Note that it does NOT find products for unidirectional * reactions, which is a bit of a problem. */ - virtual unsigned int getReactants( + virtual unsigned int getReactants( vector< unsigned int >& molIndex ) const = 0; static const double EPSILON; /** - * This is used to rescale the RateTerm kinetics when the + * This is used to rescale the RateTerm kinetics when the * compartment volume changes. This is needed because the kinetics * are in extensive units, that is, mol numbers, rather than in * intensive units like concentration. So when the volume changes @@ -60,19 +60,19 @@ class RateTerm * reactant molecules are affected, and if so, rescales. * Ratio is newVol / oldVol */ - virtual void rescaleVolume( short comptIndex, + virtual void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) = 0; /** * Duplicates rate term and then applies volume scaling. - * Arguments are volume of reference voxel, + * Arguments are volume of reference voxel, * product of vol/refVol for all substrates: applied to R1 * product of vol/refVol for all products: applied to R2 * - * Note that unless the reaction is cross-compartment, the + * Note that unless the reaction is cross-compartment, the * vol/refVol will be one. */ - virtual RateTerm* copyWithVolScaling( + virtual RateTerm* copyWithVolScaling( double vol, double sub, double prd ) const = 0; }; @@ -118,7 +118,7 @@ class MMEnzymeBase: public RateTerm return kcat_; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { Km_ *= ratio; @@ -139,7 +139,7 @@ class MMEnzymeBase: public RateTerm class MMEnzyme1: public MMEnzymeBase { public: - MMEnzyme1( double Km, double kcat, + MMEnzyme1( double Km, double kcat, unsigned int enz, unsigned int sub ) : MMEnzymeBase( Km, kcat, enz ), sub_( sub ) { @@ -158,7 +158,7 @@ class MMEnzyme1: public MMEnzymeBase return 2; } - RateTerm* copyWithVolScaling( + RateTerm* copyWithVolScaling( double vol, double sub, double prd ) const { double ratio = vol * sub * NA; @@ -172,7 +172,7 @@ class MMEnzyme1: public MMEnzymeBase class MMEnzyme: public MMEnzymeBase { public: - MMEnzyme( double Km, double kcat, + MMEnzyme( double Km, double kcat, unsigned int enz, RateTerm* sub ) : MMEnzymeBase( Km, kcat, enz ), substrates_( sub ) { @@ -236,7 +236,7 @@ class ExternReac: public RateTerm return 0; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { return; // Need to figure out what to do here. @@ -290,13 +290,13 @@ class ZeroOrder: public RateTerm double getR2() const { return 0.0; } - + unsigned int getReactants( vector< unsigned int >& molIndex ) const{ molIndex.resize( 0 ); return 0; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { return; // Nothing needs to be scaled. @@ -334,7 +334,7 @@ class Flux: public ZeroOrder return 0; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { return; // Nothing needs to be scaled. @@ -368,7 +368,7 @@ class FirstOrder: public ZeroOrder return 1; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { return; // Nothing needs to be scaled. @@ -404,10 +404,10 @@ class SecondOrder: public ZeroOrder return 2; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { - if ( comptIndex == compartmentLookup[ y1_ ] || + if ( comptIndex == compartmentLookup[ y1_ ] || comptIndex == compartmentLookup[ y2_ ] ) k_ /= ratio; } @@ -451,7 +451,7 @@ class StochSecondOrderSingleSubstrate: public ZeroOrder return 2; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { if ( comptIndex == compartmentLookup[ y_ ] ) @@ -491,7 +491,7 @@ class NOrder: public ZeroOrder return v_.size(); } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { for ( unsigned int i = 1; i < v_.size(); ++i ) { @@ -516,7 +516,7 @@ class NOrder: public ZeroOrder * This is an unpleasant case, like the StochSecondOrderSingleSubstrate. * Here we deal with the possibility that one or more of the substrates * may be of order greater than one. If so, we need to diminish the N - * of each substrate by one for each time the substrate is factored + * of each substrate by one for each time the substrate is factored * into the rate. */ class StochNOrder: public NOrder @@ -535,14 +535,14 @@ class StochNOrder: public NOrder } }; -extern class ZeroOrder* +extern class ZeroOrder* makeHalfReaction( double k, vector< unsigned int > v ); class BidirectionalReaction: public RateTerm { public: BidirectionalReaction( - ZeroOrder* forward, ZeroOrder* backward) + ZeroOrder* forward, ZeroOrder* backward) : forward_( forward ), backward_( backward ) { // Here we allocate internal forward and backward terms // with the correct number of args. @@ -588,7 +588,7 @@ class BidirectionalReaction: public RateTerm return ret; } - void rescaleVolume( short comptIndex, + void rescaleVolume( short comptIndex, const vector< short >& compartmentLookup, double ratio ) { forward_->rescaleVolume( comptIndex, compartmentLookup, ratio ); @@ -597,9 +597,9 @@ class BidirectionalReaction: public RateTerm RateTerm* copyWithVolScaling( double vol, double sub, double prd ) const { - ZeroOrder* f = static_cast< ZeroOrder* >( + ZeroOrder* f = static_cast< ZeroOrder* >( forward_->copyWithVolScaling( vol, sub, 1 ) ); - ZeroOrder* b = static_cast< ZeroOrder* >( + ZeroOrder* b = static_cast< ZeroOrder* >( backward_->copyWithVolScaling( vol, prd, 1 ) ); return new BidirectionalReaction( f, b ); } diff --git a/moose-core/ksolve/SteadyStateBoost.cpp b/moose-core/ksolve/SteadyStateBoost.cpp index 00ea1a4427f6376b6f2b60a8ddca957fbd8c9436..98e5b210d3141f89f64c7aaa5aee323872371879 100644 --- a/moose-core/ksolve/SteadyStateBoost.cpp +++ b/moose-core/ksolve/SteadyStateBoost.cpp @@ -36,7 +36,7 @@ #include "../randnum/RNG.h" /* Root finding algorithm is implemented here */ -#include "NonlinearSystem.h" +#include "NonlinearSystem.h" /* * Bindings to lapack. These headers are not part of standard boost @@ -665,7 +665,7 @@ void SteadyState::classifyState( const double* T ) vl = NULL; vr = NULL; /*----------------------------------------------------------------------------- - * INFO: Calling lapack routine geev to compute eigen vector of matrix J. + * INFO: Calling lapack routine geev to compute eigen vector of matrix J. * * Argument 3 and 4 are left- and right-eigenvectors. Since we do not need * them, they are set to NULL. Argument 2 holds eigen-vector and result is @@ -712,7 +712,7 @@ void SteadyState::classifyState( const double* T ) static bool isSolutionValid( const vector< double >& x ) { - for( size_t i = 0; i < x.size(); i++ ) + for( size_t i = 0; i < x.size(); i++ ) { double v = x[i]; if ( std::isnan( v ) or std::isinf( v ) ) @@ -762,14 +762,14 @@ void SteadyState::settle( bool forceSetup ) ss->ri.gamma = gamma_; ss->ri.pool = &pool_; ss->ri.nVec = LookupField< unsigned int, vector< double > >::get( - ksolve,"nVec", 0 + ksolve,"nVec", 0 ); ss->ri.convergenceCriterion = convergenceCriterion_; // This gives the starting point for finding the solution. vector<double> init( numVarPools_ ); - // Instead of starting at sqrt( x ), + // Instead of starting at sqrt( x ), for( size_t i = 0; i < numVarPools_; ++i ) init[i] = max( 0.0, sqrt(ss->ri.nVec[i]) ); @@ -807,11 +807,11 @@ void SteadyState::settle( bool forceSetup ) solutionStatus_ = 0; // Good solution LookupField< unsigned int, vector< double > >::set( - ksolve, "nVec", 0, ss->ri.nVec + ksolve, "nVec", 0, ss->ri.nVec ); // Check what we set vector<double> t = LookupField< unsigned int, vector< double > >::get( - ksolve,"nVec", 0 + ksolve,"nVec", 0 ); //classifyState( T ); @@ -826,7 +826,7 @@ void SteadyState::settle( bool forceSetup ) solutionStatus_ = 1; // Steady state failed. LookupField< unsigned int, vector< double > >::set( - ksolve, "nVec", 0, ss->ri.nVec + ksolve, "nVec", 0, ss->ri.nVec ); } @@ -850,14 +850,14 @@ void SteadyState::settle( bool forceSetup ) void swapRows( ublas::matrix< double >& mat, unsigned int r1, unsigned int r2) { ublas::vector<value_type> temp( mat.size2() ); - for (size_t i = 0; i < mat.size2(); i++) + for (size_t i = 0; i < mat.size2(); i++) { temp[i] = mat(r1, i ); mat(r1, i ) = mat(r2, i ); } - for (size_t i = 0; i < mat.size2(); i++) - mat(r2, i) = temp[i]; + for (size_t i = 0; i < mat.size2(); i++) + mat(r2, i) = temp[i]; } @@ -953,7 +953,7 @@ static bool checkAboveZero( const vector< double >& y ) void recalcTotal( vector< double >& tot, ublas::matrix<double>& g, const double* S ) { assert( g.size1() == tot.size() ); - for ( size_t i = 0; i < g.size1(); ++i ) + for ( size_t i = 0; i < g.size1(); ++i ) { double t = 0.0; for ( unsigned int j = 0; j < g.size2(); ++j ) diff --git a/moose-core/ksolve/SteadyStateBoost.h b/moose-core/ksolve/SteadyStateBoost.h index b44d743f455029c2ea322b09fb9c2a7c3ce5284b..66303a18165037a9ea5cf5869aaa40f4355ca922 100644 --- a/moose-core/ksolve/SteadyStateBoost.h +++ b/moose-core/ksolve/SteadyStateBoost.h @@ -129,7 +129,7 @@ private: #if USE_BOOST NonlinearSystem* ss; -#endif +#endif }; diff --git a/moose-core/ksolve/SteadyStateGsl.cpp b/moose-core/ksolve/SteadyStateGsl.cpp index e10d4616a3c783e6743c2130747a6f16498555d8..e8d805d7a4d78de23cb1dcb81740715308bf0b4f 100644 --- a/moose-core/ksolve/SteadyStateGsl.cpp +++ b/moose-core/ksolve/SteadyStateGsl.cpp @@ -109,78 +109,78 @@ const Cinfo* SteadyState::initCinfo() /////////////////////////////////////////////////////// // Field definitions /////////////////////////////////////////////////////// - static ValueFinfo< SteadyState, Id > stoich( - "stoich", + static ValueFinfo< SteadyState, Id > stoich( + "stoich", "Specify the Id of the stoichiometry system to use", &SteadyState::setStoich, &SteadyState::getStoich ); - static ReadOnlyValueFinfo< SteadyState, bool > badStoichiometry( - "badStoichiometry", + static ReadOnlyValueFinfo< SteadyState, bool > badStoichiometry( + "badStoichiometry", "Bool: True if there is a problem with the stoichiometry", &SteadyState::badStoichiometry ); - static ReadOnlyValueFinfo< SteadyState, bool > isInitialized( - "isInitialized", + static ReadOnlyValueFinfo< SteadyState, bool > isInitialized( + "isInitialized", "True if the model has been initialized successfully", &SteadyState::isInitialized ); - static ReadOnlyValueFinfo< SteadyState, unsigned int > nIter( - "nIter", + static ReadOnlyValueFinfo< SteadyState, unsigned int > nIter( + "nIter", "Number of iterations done by steady state solver", &SteadyState::getNiter ); - static ReadOnlyValueFinfo< SteadyState, string > status( - "status", + static ReadOnlyValueFinfo< SteadyState, string > status( + "status", "Status of solver", &SteadyState::getStatus ); - static ValueFinfo< SteadyState, unsigned int > maxIter( - "maxIter", + static ValueFinfo< SteadyState, unsigned int > maxIter( + "maxIter", "Max permissible number of iterations to try before giving up", &SteadyState::setMaxIter, &SteadyState::getMaxIter ); - static ValueFinfo< SteadyState, double> convergenceCriterion( - "convergenceCriterion", + static ValueFinfo< SteadyState, double> convergenceCriterion( + "convergenceCriterion", "Fractional accuracy required to accept convergence", &SteadyState::setConvergenceCriterion, &SteadyState::getConvergenceCriterion ); static ReadOnlyValueFinfo< SteadyState, unsigned int > numVarPools( - "numVarPools", + "numVarPools", "Number of variable molecules in reaction system.", &SteadyState::getNumVarPools ); - static ReadOnlyValueFinfo< SteadyState, unsigned int > rank( - "rank", + static ReadOnlyValueFinfo< SteadyState, unsigned int > rank( + "rank", "Number of independent molecules in reaction system", &SteadyState::getRank ); - static ReadOnlyValueFinfo< SteadyState, unsigned int > stateType( - "stateType", + static ReadOnlyValueFinfo< SteadyState, unsigned int > stateType( + "stateType", "0: stable; 1: unstable; 2: saddle; 3: osc?; 4: one near-zero eigenvalue; 5: other", &SteadyState::getStateType ); - static ReadOnlyValueFinfo< SteadyState, unsigned int > + static ReadOnlyValueFinfo< SteadyState, unsigned int > nNegEigenvalues ( - "nNegEigenvalues", + "nNegEigenvalues", "Number of negative eigenvalues: indicates type of solution", &SteadyState::getNnegEigenvalues ); - static ReadOnlyValueFinfo< SteadyState, unsigned int > - nPosEigenvalues( - "nPosEigenvalues", + static ReadOnlyValueFinfo< SteadyState, unsigned int > + nPosEigenvalues( + "nPosEigenvalues", "Number of positive eigenvalues: indicates type of solution", &SteadyState::getNposEigenvalues ); static ReadOnlyValueFinfo< SteadyState, unsigned int > solutionStatus( - "solutionStatus", + "solutionStatus", "0: Good; 1: Failed to find steady states; " "2: Failed to find eigenvalues", &SteadyState::getSolutionStatus ); - static LookupValueFinfo< SteadyState, unsigned int, double > total( + static LookupValueFinfo< SteadyState, unsigned int, double > total( "total", "Totals table for conservation laws. The exact mapping of" "this to various sums of molecules is given by the " @@ -194,8 +194,8 @@ const Cinfo* SteadyState::initCinfo() &SteadyState::setTotal, &SteadyState::getTotal ); - static ReadOnlyLookupValueFinfo< - SteadyState, unsigned int, double > eigenvalues( + static ReadOnlyLookupValueFinfo< + SteadyState, unsigned int, double > eigenvalues( "eigenvalues", "Eigenvalues computed for steady state", &SteadyState::getEigenvalue @@ -203,32 +203,32 @@ const Cinfo* SteadyState::initCinfo() /////////////////////////////////////////////////////// // MsgDest definitions /////////////////////////////////////////////////////// - static DestFinfo setupMatrix( "setupMatrix", + static DestFinfo setupMatrix( "setupMatrix", "This function initializes and rebuilds the matrices used " "in the calculation.", - new OpFunc0< SteadyState >(&SteadyState::setupMatrix) + new OpFunc0< SteadyState >(&SteadyState::setupMatrix) ); - static DestFinfo settle( "settle", + static DestFinfo settle( "settle", "Finds the nearest steady state to the current initial " "conditions. This function rebuilds the entire calculation " "only if the object has not yet been initialized.", new OpFunc0< SteadyState >( &SteadyState::settleFunc ) ); - static DestFinfo resettle( "resettle", + static DestFinfo resettle( "resettle", "Finds the nearest steady state to the current initial " "conditions. This function rebuilds the entire calculation ", new OpFunc0< SteadyState >( &SteadyState::resettleFunc ) ); - static DestFinfo showMatrices( "showMatrices", + static DestFinfo showMatrices( "showMatrices", "Utility function to show the matrices derived for the calculations on the reaction system. Shows the Nr, gamma, and total matrices", new OpFunc0< SteadyState >( &SteadyState::showMatrices ) ); - static DestFinfo randomInit( "randomInit", + static DestFinfo randomInit( "randomInit", "Generate random initial conditions consistent with the mass" "conservation rules. Typically invoked in order to scan" "states", - new EpFunc0< SteadyState >( + new EpFunc0< SteadyState >( &SteadyState::randomizeInitialCondition ) ); /////////////////////////////////////////////////////// @@ -259,7 +259,7 @@ const Cinfo* SteadyState::initCinfo() }; - + static string doc[] = { "Name", "SteadyState", @@ -295,7 +295,7 @@ const Cinfo* SteadyState::initCinfo() "time (typically under 1 second) before asking it to find the " "fixed point. " }; - + static Dinfo< SteadyState > dinfo; static Cinfo steadyStateCinfo( "SteadyState", @@ -317,8 +317,8 @@ static const Cinfo* steadyStateCinfo = SteadyState::initCinfo(); SteadyState::SteadyState() : - nIter_( 0 ), - maxIter_( 100 ), + nIter_( 0 ), + maxIter_( 100 ), badStoichiometry_( 0 ), status_( "OK" ), isInitialized_( 0 ), @@ -354,7 +354,7 @@ SteadyState::~SteadyState() gsl_matrix_free( gamma_ ); #endif } - + /////////////////////////////////////////////////// // Field function definitions /////////////////////////////////////////////////// @@ -374,7 +374,7 @@ void SteadyState::setStoich( Id value ) { numVarPools_ = Field< unsigned int >::get( stoich_, "numVarPools" ); nReacs_ = Field< unsigned int >::get( stoich_, "numRates" ); setupSSmatrix(); - double vol = LookupField< unsigned int, double >::get( + double vol = LookupField< unsigned int, double >::get( stoichPtr->getCompartment(), "oneVoxelVolume", 0 ); pool_.setVolume( vol ); pool_.setStoich( stoichPtr, 0 ); @@ -435,8 +435,8 @@ void SteadyState::setConvergenceCriterion( double value ) { if ( value > 1e-10 ) convergenceCriterion_ = value; else - cout << "Warning: Convergence criterion " << value << - " too small. Old value " << + cout << "Warning: Convergence criterion " << value << + " too small. Old value " << convergenceCriterion_ << " retained\n"; } @@ -512,9 +512,9 @@ void print_gsl_mat( gsl_matrix* m, const char* name ) if ( fabs( x ) < 1e-9 ) x = 0; printf( "%6g", x ); } - + printf( "\n"); - } + } } #endif @@ -541,14 +541,14 @@ void SteadyState::setupSSmatrix() #ifdef USE_GSL if ( numVarPools_ == 0 || nReacs_ == 0 ) return; - + int nTot = numVarPools_ + nReacs_; gsl_matrix* N = gsl_matrix_calloc (numVarPools_, nReacs_); if ( LU_ ) { // Clear out old one. gsl_matrix_free( LU_ ); } LU_ = gsl_matrix_calloc (numVarPools_, nTot); - vector< int > entry = Field< vector< int > >::get( + vector< int > entry = Field< vector< int > >::get( stoich_, "matrixEntry" ); vector< unsigned int > colIndex = Field< vector< unsigned int > >::get( stoich_, "columnIndex" ); @@ -579,7 +579,7 @@ void SteadyState::setupSSmatrix() cout << "SteadyState::setupSSmatrix(): Number of conserved species == 0. Aborting\n"; return; } - + if ( Nr_ ) { // Clear out old one. gsl_matrix_free( Nr_ ); } @@ -593,11 +593,11 @@ void SteadyState::setupSSmatrix() gsl_matrix_free( gamma_ ); } gamma_ = gsl_matrix_calloc (nConsv, numVarPools_ ); - + // Fill up gamma for ( unsigned int i = rank_; i < numVarPools_; ++i ) for ( unsigned int j = 0; j < numVarPools_; ++j ) - gsl_matrix_set( gamma_, i - rank_, j, + gsl_matrix_set( gamma_, i - rank_, j, gsl_matrix_get( LU_, i, j + nReacs_ ) ); // Fill up boundary condition values @@ -614,7 +614,7 @@ void SteadyState::setupSSmatrix() cout << ")\n"; */ Id ksolve = Field< Id >::get( stoich_, "ksolve" ); - vector< double > nVec = + vector< double > nVec = LookupField< unsigned int, vector< double > >::get( ksolve,"nVec", 0 ); @@ -658,7 +658,7 @@ int iterate( const gsl_multiroot_fsolver_type* st, struct reac_info *ri, { int status = 0; gsl_vector* x = gsl_vector_calloc( ri->num_mols ); - gsl_multiroot_fsolver *solver = + gsl_multiroot_fsolver *solver = gsl_multiroot_fsolver_alloc( st, ri->num_mols ); gsl_multiroot_function func = {&ss_func, ri->num_mols, ri}; @@ -673,7 +673,7 @@ int iterate( const gsl_multiroot_fsolver_type* st, struct reac_info *ri, ri->nIter++; status = gsl_multiroot_fsolver_iterate( solver ); if (status ) break; - status = gsl_multiroot_test_residual( + status = gsl_multiroot_test_residual( solver->f, ri->convergenceCriterion); } while (status == GSL_CONTINUE && ri->nIter < maxIter ); @@ -691,12 +691,12 @@ void SteadyState::classifyState( const double* T ) // double* yprime = new double[ numVarPools_ ]; // vector< double > yprime( numVarPools_, 0.0 ); // Generate an approximation to the Jacobean by generating small - // increments to each of the molecules in the steady state, one + // increments to each of the molecules in the steady state, one // at a time, and putting the resultant rate vector into a column // of the J matrix. // This needs a bit of heuristic to decide what is a 'small' increment. // Use the CoInits for this. Stoichiometry shouldn't matter too much. - // I used the totals from consv rules earlier, but that can have + // I used the totals from consv rules earlier, but that can have // negative values. double tot = 0.0; Stoich* s = reinterpret_cast< Stoich* >( stoich_.eref().data() ); @@ -706,7 +706,7 @@ void SteadyState::classifyState( const double* T ) tot += nVec[i]; } tot *= DELTA; - + vector< double > yprime( nVec.size(), 0.0 ); // Fill up Jacobian for ( unsigned int i = 0; i < numVarPools_; ++i ) { @@ -758,7 +758,7 @@ void SteadyState::classifyState( const double* T ) // This means we have several zero eigenvalues. } - if ( nNegEigenvalues_ == rank_ ) + if ( nNegEigenvalues_ == rank_ ) stateType_ = 0; // Stable else if ( nPosEigenvalues_ == rank_ ) // Never see it. stateType_ = 1; // Unstable @@ -780,7 +780,7 @@ void SteadyState::classifyState( const double* T ) static bool isSolutionPositive( const vector< double >& x ) { - for ( vector< double >::const_iterator + for ( vector< double >::const_iterator i = x.begin(); i != x.end(); ++i ) { if ( *i < 0.0 ) { cout << "Warning: SteadyState iteration gave negative concs\n"; @@ -798,7 +798,7 @@ void SteadyState::settle( bool forceSetup ) { #ifdef USE_GSL gsl_set_error_handler_off(); - + if ( !isInitialized_ ) { cout << "Error: SteadyState object has not been initialized. No calculations done\n"; return; @@ -823,7 +823,7 @@ void SteadyState::settle( bool forceSetup ) ri.Nr = Nr_; ri.gamma = gamma_; ri.pool = &pool_; - ri.nVec = + ri.nVec = LookupField< unsigned int, vector< double > >::get( ksolve,"nVec", 0 ); ri.convergenceCriterion = convergenceCriterion_; @@ -880,7 +880,7 @@ int ss_func( const gsl_vector* x, void* params, gsl_vector* f ) for ( unsigned int i = 0; i < ri->num_mols; ++i ) { double temp = op( gsl_vector_get( x, i ) ); - if ( isNaN( temp ) || isInfinity( temp ) ) { + if ( isNaN( temp ) || isInfinity( temp ) ) { return GSL_ERANGE; } else { ri->nVec[i] = temp; @@ -903,7 +903,7 @@ int ss_func( const gsl_vector* x, void* params, gsl_vector* f ) for ( int i = 0; i < num_consv; ++i ) { double dT = - ri->T[i]; for ( unsigned int j = 0; j < ri->num_mols; ++j ) - dT += gsl_matrix_get( ri->gamma, i, j) * + dT += gsl_matrix_get( ri->gamma, i, j) * op( gsl_vector_get( x, j ) ); gsl_vector_set( f, i + ri->rank, dT ); @@ -947,7 +947,7 @@ void eliminateRowsBelow( gsl_matrix* U, int start, int leftCol ) * reorderRows: * Finds the leftmost row beginning from start, ignoring everything to the * left of leftCol. Puts this row at 'start', swapping with the original. - * Assumes that the matrix is set up as [N I]. + * Assumes that the matrix is set up as [N I]. * Returns the new value of leftCol * If there are no appropriate rows, returns numReacs. */ @@ -976,7 +976,7 @@ int reorderRows( gsl_matrix* U, int start, int leftCol ) /** * Does a simple gaussian decomposition. Assumes U has nice clean numbers * so I can apply a generous EPSILON to zero things out. - * Assumes that the U matrix is the N matrix padded out by an identity + * Assumes that the U matrix is the N matrix padded out by an identity * matrix on the right. * Returns rank. */ @@ -1031,7 +1031,7 @@ void SteadyState::randomizeInitialCondition( const Eref& me ) { #ifdef USE_GSL Id ksolve = Field< Id >::get( stoich_, "ksolve" ); - vector< double > nVec = + vector< double > nVec = LookupField< unsigned int, vector< double > >::get( ksolve,"nVec", 0 ); int numConsv = total_.size(); @@ -1086,7 +1086,7 @@ void SteadyState::randomizeInitialCondition( const Eref& me ) * making sure they fit. */ #ifdef USE_GSL -void SteadyState::fitConservationRules( +void SteadyState::fitConservationRules( gsl_matrix* U, const vector< double >& eliminatedTotal, vector< double >&y ) diff --git a/moose-core/ksolve/SteadyStateGsl.h b/moose-core/ksolve/SteadyStateGsl.h index 565622a1cf1a3df31ba93f4333e763d3fddc5541..0982f4a258dd48ddde8d229c0ba82d2d2ac99d43 100644 --- a/moose-core/ksolve/SteadyStateGsl.h +++ b/moose-core/ksolve/SteadyStateGsl.h @@ -18,7 +18,7 @@ class SteadyState public: SteadyState(); ~SteadyState(); - + /////////////////////////////////////////////////// // Field function definitions /////////////////////////////////////////////////// @@ -65,13 +65,13 @@ class SteadyState vector< double >& y, vector< double >& tot ); */ #ifdef USE_GSL - void fitConservationRules( - gsl_matrix* U, + void fitConservationRules( + gsl_matrix* U, const vector< double >& eliminatedTotal, vector< double >&yi ); #endif - + //////////////////////////////////////////////////// // funcs to handle externally imposed changes in mol N //////////////////////////////////////////////////// @@ -87,7 +87,7 @@ class SteadyState private: void setupSSmatrix(); - + /////////////////////////////////////////////////// // Internal fields. /////////////////////////////////////////////////// diff --git a/moose-core/ksolve/Stoich.cpp b/moose-core/ksolve/Stoich.cpp index db6e2d779c4f942fbea8e28cdae2eb7f3966090d..425c19ddbd0b0a07b71a39b3b5843c6a316927b7 100644 --- a/moose-core/ksolve/Stoich.cpp +++ b/moose-core/ksolve/Stoich.cpp @@ -1494,7 +1494,7 @@ void Stoich::unZombifyModel() unZombifyPools(); - vector< Id > temp = reacVec_; temp.insert( temp.end(), + vector< Id > temp = reacVec_; temp.insert( temp.end(), offSolverReacVec_.begin(), offSolverReacVec_.end() ); for ( vector< Id >::iterator i = temp.begin(); i != temp.end(); ++i ) { @@ -1503,7 +1503,7 @@ void Stoich::unZombifyModel() ReacBase::zombify( e, reacCinfo, Id() ); } - temp = mmEnzVec_; temp.insert( temp.end(), + temp = mmEnzVec_; temp.insert( temp.end(), offSolverMMenzVec_.begin(), offSolverMMenzVec_.end() ); for ( vector< Id >::iterator i = temp.begin(); i != temp.end(); ++i ) { @@ -1512,7 +1512,7 @@ void Stoich::unZombifyModel() EnzBase::zombify( e, mmEnzCinfo, Id() ); } - temp = enzVec_; temp.insert( temp.end(), + temp = enzVec_; temp.insert( temp.end(), offSolverEnzVec_.begin(), offSolverEnzVec_.end() ); for ( vector< Id >::iterator i = temp.begin(); i != temp.end(); ++i ) { @@ -1521,7 +1521,7 @@ void Stoich::unZombifyModel() CplxEnzBase::zombify( e, enzCinfo, Id() ); } - temp = poolFuncVec_; temp.insert( temp.end(), + temp = poolFuncVec_; temp.insert( temp.end(), incrementFuncVec_.begin(), incrementFuncVec_.end() ); for ( vector< Id >::iterator i = temp.begin(); i != temp.end(); ++i ) { diff --git a/moose-core/ksolve/Stoich.h b/moose-core/ksolve/Stoich.h index 7986cfca152005870351e4253cf002c4604c2d9a..2951e3655b2f50accd2c25bed97b040867fdef27 100644 --- a/moose-core/ksolve/Stoich.h +++ b/moose-core/ksolve/Stoich.h @@ -12,8 +12,8 @@ /** * Stoich is the class that handles the stoichiometry matrix for a - * reaction system, and also setting up the computations for reaction - * rates. It has to coordinate the operation of a number of model + * reaction system, and also setting up the computations for reaction + * rates. It has to coordinate the operation of a number of model * definition classes, most importantly: Pools, Reacs and Enz(yme)s. * It also coordinates the setup of a large number of numerical solution * engines, or solvers: Ksolve, Gsolve, Dsolve, and SteadyState. @@ -23,21 +23,21 @@ * data structures for the other objects that do the crunching. * * 1. Compartment is set up to a cell (neuroMesh) or volume (other meshes) - * 2. Compartment assigned to Stoich. Here it assigns unique vols. + * 2. Compartment assigned to Stoich. Here it assigns unique vols. * 3. Dsolve and Ksolve assigned to Stoich using setKsolve and setDsolve. * 3.1 At this point the Stoich::useOneWay_ flag is set if it is a Gsolve. * 4. Call Stoich::setPath. All the rest happens internally, done by Stoich: * 4.1 assign compartment to Dsolve and Ksolve. - * 4.2 assign numPools and compts to Dsolve and Ksolve. - * 4.3 During Zombification, zeroth vector< RateTerm* > is built. + * 4.2 assign numPools and compts to Dsolve and Ksolve. + * 4.3 During Zombification, zeroth vector< RateTerm* > is built. * 4.4 afterZombification, stoich builds rateTerm vector for all vols. - * 4.5 Stoich assigns itself to Dsolve and Ksolve. - * - Ksolve sets up volIndex on each VoxelPool + * 4.5 Stoich assigns itself to Dsolve and Ksolve. + * - Ksolve sets up volIndex on each VoxelPool * - Dsolve gets vector of pools, extracts DiffConst and MotorConst * 4.6 Dsolve assigned to Ksolve::dsolve_ field by the Stoich. - * 5. Reinit, - * 5.1 Dsolve builds matrix, provided dt has changed. It needs dt. - * 5.2 Ksolve builds solvers if not done already, assigning initDt + * 5. Reinit, + * 5.1 Dsolve builds matrix, provided dt has changed. It needs dt. + * 5.2 Ksolve builds solvers if not done already, assigning initDt * * As seen by the user, this reduces to just 4 stages: * - Make the objects. @@ -48,7 +48,7 @@ class Stoich { - public: + public: Stoich(); ~Stoich(); @@ -78,12 +78,12 @@ class Stoich */ 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. + /** + * 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; @@ -95,15 +95,15 @@ class Stoich string getPath( const Eref& e ) const; /// assigns kinetic solver: Ksovle or GSSAsolve. - void setKsolve( Id v ); + void setKsolve( Id v ); Id getKsolve() const; /// assigns diffusion solver: Dsovle or a Gillespie voxel stepper - void setDsolve( Id v ); + void setDsolve( Id v ); Id getDsolve() const; /// assigns compartment occupied by Stoich. - void setCompartment( Id v ); + void setCompartment( Id v ); Id getCompartment() const; /** @@ -156,13 +156,13 @@ class Stoich /** * 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 + * 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 + * 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. @@ -182,18 +182,18 @@ class Stoich void buildFuncLookup(); /** - * This function is used when the stoich class is employed by a + * 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 + * 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(); /** - * Builds cross-reaction terms between current stoich and + * Builds cross-reaction terms between current stoich and * otherStoich. The function scans the voxels at which there * are jucntions between different compartments, and orchestrates * setup of interfaces between the Ksolves that implement the @@ -222,7 +222,7 @@ class Stoich /** * Finds all the input molecules contributing to any of the * Function cases: poolFunc, incrementFunc or reacFunc - void inputsToPoolFuncs( + void inputsToPoolFuncs( vector< pair< Id, vector< unsigned int > > >& ret ) const; */ ////////////////////////////////////////////////////////////////// @@ -230,7 +230,7 @@ class Stoich ////////////////////////////////////////////////////////////////// /** - * zombifyModel marches through the specified id list and + * zombifyModel marches through the specified id list and * converts all entries into zombies. The first arg e is the * Eref of the Stoich itself. */ @@ -248,7 +248,7 @@ class Stoich /** * Utility function to find if incoming message assigns N or conc, - * and to appropriately zombify the function and set up its + * and to appropriately zombify the function and set up its * parameters including volume scaling. */ Id zombifyPoolFuncWithScaling( Id pool ); @@ -258,13 +258,13 @@ class Stoich unsigned int convertIdToFuncIndex( Id id ) const; /// Utility function to make a half reac and return the rate term. - ZeroOrder* makeHalfReaction( + 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 + * vectors to store which compartment each substrate/product * belongs to, needed for cross-reaction computations. * This is the high-level interface function. */ @@ -275,7 +275,7 @@ class Stoich * to the specified Reac, and builds them into the Stoich. * It is a low-level function used internally. */ - unsigned int innerInstallReaction( Id reacId, + unsigned int innerInstallReaction( Id reacId, const vector< Id >& subs, const vector< Id >& prds ); /** @@ -316,14 +316,14 @@ class Stoich /** * This installs a FuncRate, which evaluates a function to specify - * the rate of change of conc of the specific pool. + * 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. + * the rate (Kf) of the specified reaction. */ void installAndUnschedFuncReac( Id func, Id reac ); @@ -342,7 +342,7 @@ class Stoich /** * 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 + * reaction lives. Internally the stoich uses #/voxel units so this * involves querying the volume subsystem about volumes for each * voxel, and scaling accordingly. */ @@ -351,7 +351,7 @@ class Stoich /** * 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 + * reaction lives. Internally the stoich uses #/voxel units so this * involves querying the volume subsystem about volumes for each * voxel, and scaling accordingly. */ @@ -376,7 +376,7 @@ class Stoich * 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 + * enzyme lives. Internally the stoich uses #/voxel units so this * involves querying the volume subsystem about volumes for each * voxel, and scaling accordingly. */ @@ -399,14 +399,14 @@ class Stoich */ double getR1( const Eref& e ) const; /** - * Returns internal rate R1 in #/voxel, for the rate term + * 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 + * 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. @@ -449,7 +449,7 @@ class Stoich 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 @@ -467,8 +467,8 @@ class Stoich const vector< unsigned int >& reacTerms, double* yprime ); */ - /** - * Get the rate for a single reaction specified by r, as per all + /** + * 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; @@ -498,13 +498,13 @@ class Stoich * 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 + * 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_; @@ -537,8 +537,8 @@ class Stoich * 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 + * The RateTerms vector also includes reactions that have + * off-compartment products. These need special volume scaling * involving all the interactiong compartments. */ vector< RateTerm* > rates_; @@ -591,7 +591,7 @@ class Stoich vector< Id > bufPoolVec_; /** - * These are pools that were not in the original scope of the + * 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. */ @@ -619,7 +619,7 @@ class Stoich * Vector of funcs controlling pool number, that is N. */ vector< Id > poolFuncVec_; - + /** * Vector of funcs controlling pool increment, that is dN/dt * This is handled as a rateTerm. @@ -662,7 +662,7 @@ class Stoich * 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. @@ -670,7 +670,7 @@ class Stoich */ /** - * Number of reactions in the solver model. This includes + * 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 ) @@ -694,13 +694,13 @@ class Stoich ////////////////////////////////////////////////////////////////// /** - * Map of vectors of Ids of offSolver pools. - * Each map entry contains the vector of Ids of proxy pools + * 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 + * In use, the junction will copy the pool indices over for * data transfer. */ - map< Id, vector< Id > > offSolverPoolMap_; + map< Id, vector< Id > > offSolverPoolMap_; /** * Tracks the reactions that go off the current solver. @@ -717,14 +717,14 @@ class Stoich /** * subComptVec_[rateTermIndex][substrate#]: Identifies compts - * for each substrate for each cross-compartment RateTerm in + * 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 + * for each product for each cross-compartment RateTerm in * the rates_vector. */ vector< vector< Id > > prdComptVec_; diff --git a/moose-core/ksolve/VoxelPools.cpp b/moose-core/ksolve/VoxelPools.cpp index 3c933b0a235ee74e991d17e5f51c6cc34207d0a3..c71dc797e5298022bf61a1d3ee99f37b494ff2e7 100644 --- a/moose-core/ksolve/VoxelPools.cpp +++ b/moose-core/ksolve/VoxelPools.cpp @@ -72,8 +72,8 @@ void VoxelPools::setStoich( Stoich* s, const OdeSystem* ode ) sys_ = ode->gslSys; if ( driver_ ) gsl_odeiv2_driver_free( driver_ ); - driver_ = gsl_odeiv2_driver_alloc_y_new( - &sys_, ode->gslStep, ode->initStepSize, + driver_ = gsl_odeiv2_driver_alloc_y_new( + &sys_, ode->gslStep, ode->initStepSize, ode->epsAbs, ode->epsRel ); } #elif USE_BOOST @@ -91,22 +91,22 @@ void VoxelPools::advance( const ProcInfo* p ) if ( status != GSL_SUCCESS ) { cout << "Error: VoxelPools::advance: GSL integration error at time " << t << "\n"; - cout << "Error info: " << status << ", " << + cout << "Error info: " << status << ", " << gsl_strerror( status ) << endl; - if ( status == GSL_EMAXITER ) + if ( status == GSL_EMAXITER ) cout << "Max number of steps exceeded\n"; - else if ( status == GSL_ENOPROG ) + else if ( status == GSL_ENOPROG ) cout << "Timestep has gotten too small\n"; - else if ( status == GSL_EBADFUNC ) + else if ( status == GSL_EBADFUNC ) cout << "Internal error\n"; assert( 0 ); } - + #elif USE_BOOST // NOTE: Make sure to assing vp to BoostSys vp. In next call, it will be used by - // updateRates func. Unlike gsl call, we can't pass extra void* to gslFunc. + // updateRates func. Unlike gsl call, we can't pass extra void* to gslFunc. VoxelPools* vp = reinterpret_cast< VoxelPools* >( sys_.params ); sys_.vp = vp; /*----------------------------------------------------------------------------- @@ -123,9 +123,9 @@ void VoxelPools::advance( const ProcInfo* p ) /*----------------------------------------------------------------------------- * Using integrate function works with with default stepper type. * - * NOTICE to developer: + * NOTICE to developer: * If you are planning your own custom typdedef of stepper_type_ (see - * file BoostSystem.h), the you may run into troble. Have a look at this + * file BoostSystem.h), the you may run into troble. Have a look at this * http://boostw.boost.org/doc/libs/1_56_0/boost/numeric/odeint/integrate/integrate.hpp *----------------------------------------------------------------------------- */ @@ -135,7 +135,7 @@ void VoxelPools::advance( const ProcInfo* p ) /** - * @brief Default step size for fixed size iterator. + * @brief Default step size for fixed size iterator. * FIXME/TODO: I am not sure if this is a right value to pick by default. May be * user should provide the stepping size when using fixed dt. This feature * can be incredibly useful on large system. @@ -158,13 +158,13 @@ void VoxelPools::advance( const ProcInfo* p ) , p->currTime - p->dt, p->currTime, std::min( p->dt, fixedDt ) ); else if( sys_.method == "rk5a") - odeint::integrate_adaptive( + odeint::integrate_adaptive( odeint::make_controlled<rk_karp_stepper_type_>( absTol, relTol) , sys_ , Svec() - , p->currTime - p->dt + , p->currTime - p->dt , p->currTime - , p->dt + , p->dt ); else if ("rk54" == sys_.method ) odeint::integrate_const( rk_karp_stepper_type_() @@ -172,12 +172,12 @@ void VoxelPools::advance( const ProcInfo* p ) , p->currTime - p->dt, p->currTime, std::min( p->dt, fixedDt ) ); else if ("rk54a" == sys_.method ) - odeint::integrate_adaptive( + odeint::integrate_adaptive( odeint::make_controlled<rk_karp_stepper_type_>( absTol, relTol ) , sys_, Svec() - , p->currTime - p->dt + , p->currTime - p->dt , p->currTime - , p->dt + , p->dt ); else if ("rk5" == sys_.method ) odeint::integrate_const( rk_dopri_stepper_type_() @@ -185,34 +185,34 @@ void VoxelPools::advance( const ProcInfo* p ) , p->currTime - p->dt, p->currTime, std::min( p->dt, fixedDt ) ); else if ("rk5a" == sys_.method ) - odeint::integrate_adaptive( + odeint::integrate_adaptive( odeint::make_controlled<rk_dopri_stepper_type_>( absTol, relTol ) , sys_, Svec() - , p->currTime - p->dt + , p->currTime - p->dt , p->currTime - , p->dt + , p->dt ); - else if( sys_.method == "rk8" ) + else if( sys_.method == "rk8" ) odeint::integrate_const( rk_felhberg_stepper_type_() , sys_ , Svec() , p->currTime - p->dt, p->currTime, std::min( p->dt, fixedDt ) ); - else if( sys_.method == "rk8a" ) + else if( sys_.method == "rk8a" ) odeint::integrate_adaptive( odeint::make_controlled<rk_felhberg_stepper_type_>( absTol, relTol ) , sys_, Svec() - , p->currTime - p->dt + , p->currTime - p->dt , p->currTime - , p->dt + , p->dt ); else - odeint::integrate_adaptive( + odeint::integrate_adaptive( odeint::make_controlled<rk_karp_stepper_type_>( absTol, relTol ) , sys_, Svec() - , p->currTime - p->dt + , p->currTime - p->dt , p->currTime - , p->dt + , p->dt ); #endif } @@ -226,7 +226,7 @@ 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, +int VoxelPools::gslFunc( double t, const double* y, double *dydt, void* params ) { VoxelPools* vp = reinterpret_cast< VoxelPools* >( params ); @@ -253,7 +253,7 @@ int VoxelPools::gslFunc( double t, const double* y, double *dydt, } #elif USE_BOOST -void VoxelPools::evalRates( +void VoxelPools::evalRates( const vector_type_& y, vector_type_& dydt, const double t, VoxelPools* vp ) { @@ -276,7 +276,7 @@ void VoxelPools::updateAllRateTerms( const vector< RateTerm* >& rates, for ( unsigned int i = 0; i < numCoreRates; ++i ) rates_[i] = rates[i]->copyWithVolScaling( getVolume(), 1, 1 ); for ( unsigned int i = numCoreRates; i < rates.size(); ++i ) { - rates_[i] = rates[i]->copyWithVolScaling( getVolume(), + rates_[i] = rates[i]->copyWithVolScaling( getVolume(), getXreacScaleSubstrates(i - numCoreRates), getXreacScaleProducts(i - numCoreRates ) ); } @@ -292,11 +292,11 @@ void VoxelPools::updateRateTerms( const vector< RateTerm* >& rates, delete( rates_[index] ); if ( index >= numCoreRates ) rates_[index] = rates[index]->copyWithVolScaling( - getVolume(), + getVolume(), getXreacScaleSubstrates(index - numCoreRates), getXreacScaleProducts(index - numCoreRates ) ); else - rates_[index] = rates[index]->copyWithVolScaling( + rates_[index] = rates[index]->copyWithVolScaling( getVolume(), 1.0, 1.0 ); } @@ -306,11 +306,11 @@ void VoxelPools::updateRates( const double* s, double* yprime ) const vector< double > v( N.nColumns(), 0.0 ); vector< double >::iterator j = v.begin(); // totVar should include proxyPools only if this voxel uses them - unsigned int totVar = stoichPtr_->getNumVarPools() + + unsigned int totVar = stoichPtr_->getNumVarPools() + stoichPtr_->getNumProxyPools(); // totVar should include proxyPools if this voxel does not use them unsigned int totInvar = stoichPtr_->getNumBufPools(); - assert( N.nColumns() == 0 || + assert( N.nColumns() == 0 || N.nRows() == stoichPtr_->getNumAllPools() ); assert( N.nColumns() == rates_.size() ); @@ -331,7 +331,7 @@ void VoxelPools::updateRates( const double* s, double* yprime ) const * This is a utility function for programs like SteadyState that need * to analyze velocity. */ -void VoxelPools::updateReacVelocities( +void VoxelPools::updateReacVelocities( const double* s, vector< double >& v ) const { const KinSparseMatrix& N = stoichPtr_->getStoichiometryMatrix(); @@ -351,20 +351,20 @@ void VoxelPools::updateReacVelocities( /// For debugging: Print contents of voxel pool void VoxelPools::print() const { - cout << "numAllRates = " << rates_.size() << + cout << "numAllRates = " << rates_.size() << ", numLocalRates= " << stoichPtr_->getNumCoreRates() << endl; VoxelPoolsBase::print(); } //////////////////////////////////////////////////////////// -/** +/** * Handle volume updates. Inherited Virtual func. */ void VoxelPools::setVolumeAndDependencies( double vol ) { VoxelPoolsBase::setVolumeAndDependencies( vol ); stoichPtr_->setupCrossSolverReacVols(); - updateAllRateTerms( stoichPtr_->getRateTerms(), + updateAllRateTerms( stoichPtr_->getRateTerms(), stoichPtr_->getNumCoreRates() ); } @@ -372,11 +372,11 @@ void VoxelPools::setVolumeAndDependencies( double vol ) //////////////////////////////////////////////////////////// #if 0 /** - * Zeroes out rate terms that are involved in cross-reactions that + * Zeroes out rate terms that are involved in cross-reactions that * are not present on current voxel. */ void VoxelPools::filterCrossRateTerms( - const vector< pair< Id, Id > >& + const vector< pair< Id, Id > >& offSolverReacCompts ) { /* @@ -384,11 +384,11 @@ From VoxelPoolsBase:proxyPoolVoxels[comptIndex][#] we know if specified compt has local proxies. Note that compt is identified by an index, and actually looks up the Ksolve. -From Ksolve::compartment_ we know which compartment a given ksolve belongs +From Ksolve::compartment_ we know which compartment a given ksolve belongs in From Ksolve::xfer_[otherKsolveIndex].ksolve we have the id of the other Ksolves. -From Stoich::offSolverReacCompts_ which is pair< Id, Id > we have the +From Stoich::offSolverReacCompts_ which is pair< Id, Id > we have the ids of the _compartments_ feeding into the specified rateTerms. Somewhere I need to make a map of compts to comptIndex. diff --git a/moose-core/ksolve/VoxelPools.h b/moose-core/ksolve/VoxelPools.h index d78f5d2c0cc6bc7a8772fcd6b14972a359f98d34..05129e361ddcecc1a6e3b4b1db56fc6699f2721b 100644 --- a/moose-core/ksolve/VoxelPools.h +++ b/moose-core/ksolve/VoxelPools.h @@ -55,9 +55,9 @@ public: #ifdef USE_GSL /* ----- not USE_BOOST ----- */ static int gslFunc( double t, const double* y, double *dydt, void* params); #elif USE_BOOST - static void evalRates( const vector_type_& y + static void evalRates( const vector_type_& y , vector_type_& dydt - , const double t + , const double t , VoxelPools* vp ); #endif /* ----- not USE_BOOST ----- */ diff --git a/moose-core/ksolve/VoxelPoolsBase.cpp b/moose-core/ksolve/VoxelPoolsBase.cpp index ecc0bab62fb8c8e9d1218d91353cd7ca1f16c88f..b9e4e3065bc03ae6288fee36dc2a39b47ed11864 100644 --- a/moose-core/ksolve/VoxelPoolsBase.cpp +++ b/moose-core/ksolve/VoxelPoolsBase.cpp @@ -23,7 +23,7 @@ ////////////////////////////////////////////////////////////// VoxelPoolsBase::VoxelPoolsBase() - : + : stoichPtr_( 0 ), S_(1), Sinit_(1), @@ -95,7 +95,7 @@ void VoxelPoolsBase::setVolumeAndDependencies( double vol ) { double ratio = vol / volume_; volume_ = vol; - for ( vector< double >::iterator + for ( vector< double >::iterator i = Sinit_.begin(); i != Sinit_.end(); ++i ) *i *= ratio; @@ -107,11 +107,11 @@ void VoxelPoolsBase::setVolumeAndDependencies( double vol ) // a subsequent call via Ksolve or Stoich. } -void VoxelPoolsBase::scaleVolsBufsRates( +void VoxelPoolsBase::scaleVolsBufsRates( double ratio, const Stoich* stoichPtr ) { volume_ *= ratio; // Scale vol - for ( vector< double >::iterator + for ( vector< double >::iterator i = Sinit_.begin(); i != Sinit_.end(); ++i ) *i *= ratio; // Scale Bufs // Here we also need to set the Ns for the buffered pools. @@ -131,7 +131,7 @@ void VoxelPoolsBase::scaleVolsBufsRates( for ( unsigned int i = 0; i < numCoreRates; ++i ) rates_[i] = rates[i]->copyWithVolScaling( getVolume(), 1, 1 ); for ( unsigned int i = numCoreRates; i < rates.size(); ++i ) { - rates_[i] = rates[i]->copyWithVolScaling( getVolume(), + rates_[i] = rates[i]->copyWithVolScaling( getVolume(), getXreacScaleSubstrates(i - numCoreRates), getXreacScaleProducts(i - numCoreRates ) ); } @@ -144,7 +144,7 @@ void VoxelPoolsBase::scaleVolsBufsRates( void VoxelPoolsBase::setN( unsigned int i, double v ) { S_[i] = v; - if ( S_[i] < 0.0 ) + if ( S_[i] < 0.0 ) S_[i] = 0.0; } @@ -156,7 +156,7 @@ double VoxelPoolsBase::getN( unsigned int i ) const void VoxelPoolsBase::setNinit( unsigned int i, double v ) { Sinit_[i] = v; - if ( Sinit_[i] < 0.0 ) + if ( Sinit_[i] < 0.0 ) Sinit_[i] = 0.0; } @@ -180,14 +180,14 @@ double VoxelPoolsBase::getDiffConst( unsigned int i ) const ////////////////////////////////////////////////////////////// void VoxelPoolsBase::xferIn( const vector< unsigned int >& poolIndex, - const vector< double >& values, + const vector< double >& values, const vector< double >& lastValues, unsigned int voxelIndex ) { unsigned int offset = voxelIndex * poolIndex.size(); vector< double >::const_iterator i = values.begin() + offset; vector< double >::const_iterator j = lastValues.begin() + offset; - for ( vector< unsigned int >::const_iterator + for ( vector< unsigned int >::const_iterator k = poolIndex.begin(); k != poolIndex.end(); ++k ) { S_[*k] += *i++ - *j++; } @@ -195,15 +195,15 @@ void VoxelPoolsBase::xferIn( void VoxelPoolsBase::xferInOnlyProxies( const vector< unsigned int >& poolIndex, - const vector< double >& values, + const vector< double >& values, unsigned int numProxyPools, unsigned int voxelIndex ) { unsigned int offset = voxelIndex * poolIndex.size(); vector< double >::const_iterator i = values.begin() + offset; - unsigned int proxyEndIndex = stoichPtr_->getNumVarPools() + + unsigned int proxyEndIndex = stoichPtr_->getNumVarPools() + stoichPtr_->getNumProxyPools(); - for ( vector< unsigned int >::const_iterator + for ( vector< unsigned int >::const_iterator k = poolIndex.begin(); k != poolIndex.end(); ++k ) { // if ( *k >= S_.size() - numProxyPools ) if ( *k >= stoichPtr_->getNumVarPools() && *k < proxyEndIndex ) { @@ -215,20 +215,20 @@ void VoxelPoolsBase::xferInOnlyProxies( } } -void VoxelPoolsBase::xferOut( - unsigned int voxelIndex, +void VoxelPoolsBase::xferOut( + unsigned int voxelIndex, vector< double >& values, const vector< unsigned int >& poolIndex) { unsigned int offset = voxelIndex * poolIndex.size(); vector< double >::iterator i = values.begin() + offset; - for ( vector< unsigned int >::const_iterator + for ( vector< unsigned int >::const_iterator k = poolIndex.begin(); k != poolIndex.end(); ++k ) { *i++ = S_[*k]; } } -void VoxelPoolsBase::addProxyVoxy( +void VoxelPoolsBase::addProxyVoxy( unsigned int comptIndex, Id otherComptId, unsigned int voxel ) { if ( comptIndex >= proxyPoolVoxels_.size() ) { @@ -239,7 +239,7 @@ void VoxelPoolsBase::addProxyVoxy( proxyComptMap_[otherComptId] = comptIndex; } -void VoxelPoolsBase::addProxyTransferIndex( +void VoxelPoolsBase::addProxyTransferIndex( unsigned int comptIndex, unsigned int transferIndex ) { if ( comptIndex >= proxyTransferIndex_.size() ) @@ -303,7 +303,7 @@ double VoxelPoolsBase::getXreacScaleProducts( unsigned int i ) const } /** - * Zeroes out rate terms that are involved in cross-reactions that + * Zeroes out rate terms that are involved in cross-reactions that * are not present on current voxel. */ void VoxelPoolsBase::filterCrossRateTerms( @@ -358,7 +358,7 @@ void VoxelPoolsBase::print() const { cout << "S_.size=" << S_.size() << ", volume = " << volume_ << endl; cout << "proxyPoolsVoxels.size()=" << proxyPoolVoxels_.size() << - ", proxyTransferIndex.size()=" << proxyTransferIndex_.size() << + ", proxyTransferIndex.size()=" << proxyTransferIndex_.size() << endl; assert( proxyPoolVoxels_.size() == proxyTransferIndex_.size() ); for ( unsigned int i = 0; i < proxyPoolVoxels_.size(); ++i ) { @@ -377,7 +377,7 @@ void VoxelPoolsBase::print() const } cout << endl; } - cout << + cout << "xReacScaleSubstrates.size()=" << xReacScaleSubstrates_.size() << ", xReacScaleProducts.size()=" << xReacScaleProducts_.size() << endl; @@ -388,7 +388,7 @@ void VoxelPoolsBase::print() const } cout << "############## RATES ######################\n"; for ( unsigned int i = 0; i < rates_.size(); ++i ) { - cout << i << " : " << rates_[i]->getR1() << ", " << + cout << i << " : " << rates_[i]->getR1() << ", " << rates_[i]->getR2() << endl; } } diff --git a/moose-core/ksolve/XferInfo.h b/moose-core/ksolve/XferInfo.h index f19c8878e64a2957bc6aef22becfb7be0ea0bf45..2f229bb32078c710a59c3ea2ba02e0821f1aab97 100644 --- a/moose-core/ksolve/XferInfo.h +++ b/moose-core/ksolve/XferInfo.h @@ -10,7 +10,7 @@ #ifndef _XFER_INFO_H #define _XFER_INFO_H -/** +/** * Utility class holding the information required for setting up the * data transfers needed on each timestep for the cross-solver reactions. */ @@ -33,7 +33,7 @@ class XferInfo { /** * Vector of cases where last transfer in led to a negative - * concentration. Track the negative value for correction in + * concentration. Track the negative value for correction in * the next cycle should the remainder become positive. */ vector< double > subzero; @@ -45,14 +45,14 @@ class XferInfo { vector< unsigned int > xferPoolIdx; /** - * Vector of voxels that particpate in junctions with the + * Vector of voxels that particpate in junctions with the * communicating ksolve. This is a subset of the * total number of voxels. */ vector< unsigned int > xferVoxel; /** - * Id of Ksolve that particpates in this set of + * Id of Ksolve that particpates in this set of * cross-compartment reactions with self. * This is used to identify with XferInfo to use for a given * incoming message. diff --git a/moose-core/ksolve/ZombieBufPool.h b/moose-core/ksolve/ZombieBufPool.h index 72d0a2006e671badde6e67bd0d0eef8e51f1c693..8fda4df18c82e4d82656f2ab5695766bbbab142f 100644 --- a/moose-core/ksolve/ZombieBufPool.h +++ b/moose-core/ksolve/ZombieBufPool.h @@ -12,7 +12,7 @@ class ZombieBufPool: public ZombiePool { - public: + public: ZombieBufPool(); ~ZombieBufPool(); diff --git a/moose-core/ksolve/ZombieEnz.cpp b/moose-core/ksolve/ZombieEnz.cpp index 65c17a36c17851477271c5b2ec1e75d5f4310cad..8e56b9c7a67c0a7489664d5d73477878073a610b 100644 --- a/moose-core/ksolve/ZombieEnz.cpp +++ b/moose-core/ksolve/ZombieEnz.cpp @@ -59,7 +59,7 @@ static const SrcFinfo2< double, double >* subOut = ////////////////////////////////////////////////////////////// ZombieEnz::ZombieEnz( ) - : + : stoich_( 0 ), concK1_( 1.0 ) { ; } @@ -73,9 +73,9 @@ ZombieEnz::~ZombieEnz( ) /* void ZombieEnz::vRemesh( const Eref& e ) -{ +{ stoich_->setEnzK1( e, concK1_ ); -} +} */ @@ -86,7 +86,7 @@ void ZombieEnz::vRemesh( const Eref& e ) // v is in number units. void ZombieEnz::vSetK1( const Eref& e, double v ) { - double volScale = + double volScale = convertConcToNumRateUsingMesh( e, subOut, true ); concK1_ = v * volScale; @@ -97,7 +97,7 @@ void ZombieEnz::vSetK1( const Eref& e, double v ) double ZombieEnz::vGetK1( const Eref& e ) const { // return stoich_->getEnzNumK1( e ); - double volScale = + double volScale = convertConcToNumRateUsingMesh( e, subOut, true ); return concK1_ / volScale; @@ -154,7 +154,7 @@ void ZombieEnz::vSetNumKm( const Eref& e, double v ) { double k2 = getK2( e ); double k3 = getKcat( e ); - double volScale = + double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 ); concK1_ = ( k2 + k3 ) / ( v * volScale ); @@ -165,7 +165,7 @@ double ZombieEnz::vGetNumKm( const Eref& e ) const { double k2 = vGetK2( e ); double k3 = vGetKcat( e ); - double volScale = + double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 ); return volScale * ( k2 + k3 ) / concK1_; @@ -223,15 +223,15 @@ void ZombieEnz::setSolver( Id stoich, Id enz ) vector< Id > cplxMols; bool isOK = true; unsigned int numReactants; - numReactants = enz.element()->getNeighbors( enzMols, enzFinfo ); + numReactants = enz.element()->getNeighbors( enzMols, enzFinfo ); isOK &= ( numReactants == 1 ); vector< Id > subs; - numReactants = enz.element()->getNeighbors( subs, subFinfo ); + numReactants = enz.element()->getNeighbors( subs, subFinfo ); isOK &= ( numReactants > 0 ); - numReactants = enz.element()->getNeighbors( cplxMols, cplxFinfo ); + numReactants = enz.element()->getNeighbors( cplxMols, cplxFinfo ); isOK &= ( numReactants == 1 ); vector< Id > prds; - numReactants = enz.element()->getNeighbors( prds, prdFinfo ); + numReactants = enz.element()->getNeighbors( prds, prdFinfo ); isOK &= ( numReactants > 0 ); assert( stoich.element()->cinfo()->isA( "Stoich" ) ); stoich_ = reinterpret_cast< Stoich* >( stoich.eref().data() ); @@ -240,6 +240,6 @@ void ZombieEnz::setSolver( Id stoich, Id enz ) stoich_->installEnzyme( enz, enzMols[0], cplxMols[0], subs, prds ); } else { stoich_->installDummyEnzyme( enz, Id() ); - cout << "Warning: ZombieEnz:setSolver: Dangling Enz, missing a substrate or product\n"; + cout << "Warning: ZombieEnz:setSolver: Dangling Enz, missing a substrate or product\n"; } } diff --git a/moose-core/ksolve/ZombieEnz.h b/moose-core/ksolve/ZombieEnz.h index 3065a74f1c145df73ad96d6396939e7d436fbf04..22d28c5a016ceff59b2d77933d4839b917cb8207 100644 --- a/moose-core/ksolve/ZombieEnz.h +++ b/moose-core/ksolve/ZombieEnz.h @@ -12,7 +12,7 @@ class ZombieEnz: public CplxEnzBase { - public: + public: ZombieEnz(); ~ZombieEnz(); @@ -52,7 +52,7 @@ class ZombieEnz: public CplxEnzBase // Utility funcs ////////////////////////////////////////////////////////////////// /* - ZeroOrder* makeHalfReaction( + ZeroOrder* makeHalfReaction( Element* orig, double rate, const SrcFinfo* finfo, Id enz ) const; */ diff --git a/moose-core/ksolve/ZombieFunction.cpp b/moose-core/ksolve/ZombieFunction.cpp index d430573f9d25b332334292ead98e668367189945..9e184961801f2945272346a2121e930ea46b7526 100644 --- a/moose-core/ksolve/ZombieFunction.cpp +++ b/moose-core/ksolve/ZombieFunction.cpp @@ -31,7 +31,7 @@ const Cinfo* ZombieFunction::initCinfo() ////////////////////////////////////////////////////////////// // Field Definitions: mostly inherited from Function ////////////////////////////////////////////////////////////// - + ////////////////////////////////////////////////////////////// // MsgDest Definitions: All inherited from Function ////////////////////////////////////////////////////////////// @@ -51,7 +51,7 @@ const Cinfo* ZombieFunction::initCinfo() { &process, &reinit }; - + static SharedFinfo proc( "proc", "This is a shared message to receive Process messages " "from the scheduler objects." @@ -153,20 +153,20 @@ void ZombieFunction::setSolver( Id ksolve, Id dsolve ) } else if ( ksolve == Id() ) { _stoich = 0; } else { - cout << "Warning:ZombieFunction::setSolver: solver class " << - ksolve.element()->cinfo()->name() << + cout << "Warning:ZombieFunction::setSolver: solver class " << + ksolve.element()->cinfo()->name() << " not known.\nShould be Ksolve or Gsolve\n"; _stoich = 0; } - + /* if ( dsolve.element()->cinfo()->isA( "Dsolve" ) ) { dsolve_= ObjId( dsolve, 0 ).data(); } else if ( dsolve == Id() ) { dsolve_ = 0; } else { - cout << "Warning:ZombieFunction::vSetSolver: solver class " << - dsolve.element()->cinfo()->name() << + cout << "Warning:ZombieFunction::vSetSolver: solver class " << + dsolve.element()->cinfo()->name() << " not known.\nShould be Dsolve\n"; dsolve_ = 0; } @@ -196,13 +196,13 @@ void ZombieFunction::zombify( Element* orig, const Cinfo* zClass, *zf = *static_cast< ZombieFunction* >(&temp); zf->setSolver( ksolve, dsolve ); } else { - Function* nf = + Function* nf = reinterpret_cast< Function *>(Eref( orig, 0 ).data()); *nf = temp; } /* - // We can swap the class because the class data is identical, just + // We can swap the class because the class data is identical, just // the moose expr and process handlers are different. if ( orig->cinfo() == ZombieFunction::initCinfo() ) { // unzombify orig->replaceCinfo( Function::initCinfo() ); diff --git a/moose-core/ksolve/ZombieFunction.h b/moose-core/ksolve/ZombieFunction.h index 01ceb42a1dbd6b9bb5422096a07bd2142af31c98..bd1546a55341d380da0e13f5ebe997d6642a6fc8 100644 --- a/moose-core/ksolve/ZombieFunction.h +++ b/moose-core/ksolve/ZombieFunction.h @@ -12,7 +12,7 @@ class ZombieFunction: public Function { - public: + public: ZombieFunction(); ~ZombieFunction(); diff --git a/moose-core/ksolve/ZombieMMenz.cpp b/moose-core/ksolve/ZombieMMenz.cpp index f422fafc173d83ece446337fc9be99b6bb3ebdf7..95f163a0f7db6115b543bc6b05c0e06bf2d7fc8d 100644 --- a/moose-core/ksolve/ZombieMMenz.cpp +++ b/moose-core/ksolve/ZombieMMenz.cpp @@ -57,11 +57,11 @@ const Cinfo* ZombieMMenz::initCinfo() static const Cinfo* zombieMMenzCinfo = ZombieMMenz::initCinfo(); -static const SrcFinfo2< double, double >* subOut = +static const SrcFinfo2< double, double >* subOut = dynamic_cast< const SrcFinfo2< double, double >* >( zombieMMenzCinfo->findFinfo( "subOut" ) ); -static const SrcFinfo2< double, double >* prdOut = +static const SrcFinfo2< double, double >* prdOut = dynamic_cast< const SrcFinfo2< double, double >* >( zombieMMenzCinfo->findFinfo( "prdOut" ) ); diff --git a/moose-core/ksolve/ZombieMMenz.h b/moose-core/ksolve/ZombieMMenz.h index 8b297aa318bc6b8c2fef854123bdec2c2a5b3bf0..faee54375ed072e7fbf67f9cb496063556c42fcd 100644 --- a/moose-core/ksolve/ZombieMMenz.h +++ b/moose-core/ksolve/ZombieMMenz.h @@ -17,7 +17,7 @@ */ class ZombieMMenz: public EnzBase { - public: + public: ZombieMMenz(); ////////////////////////////////////////////////////////////////// diff --git a/moose-core/ksolve/ZombiePool.cpp b/moose-core/ksolve/ZombiePool.cpp index af4a26326c4237f33e60b53d6879debc9927e98a..b87beb6e61e8416e8c1159dbf611cb5d12932176 100644 --- a/moose-core/ksolve/ZombiePool.cpp +++ b/moose-core/ksolve/ZombiePool.cpp @@ -128,7 +128,7 @@ void ZombiePool::vSetConcInit( const Eref& e, double conc ) // Do not get concInit from ZombiePool, the PoolBase handles it. // Reconsider this, since for arrays of ZombiePools we end up with problems -// in that there is just a single PoolBase so all the concInits are +// in that there is just a single PoolBase so all the concInits are // the same. Here is a reimplementation. double ZombiePool::vGetConcInit( const Eref& e ) const { @@ -185,7 +185,7 @@ double ZombiePool::vGetVolume( const Eref& e ) const void ZombiePool::vSetSolver( Id ksolve, Id dsolve ) { - // Nasty unsafe typecast. I would have preferred to pass in a + // Nasty unsafe typecast. I would have preferred to pass in a // safely typed pointer but that would have exposed a low-level // class for the ZombiePoolInterface. if ( ksolve.element()->cinfo()->isA( "Ksolve" ) || @@ -195,20 +195,20 @@ void ZombiePool::vSetSolver( Id ksolve, Id dsolve ) } else if ( ksolve == Id() ) { ksolve_ = 0; } else { - cout << "Warning:ZombiePool::vSetSolver: solver class " << - ksolve.element()->cinfo()->name() << + cout << "Warning:ZombiePool::vSetSolver: solver class " << + ksolve.element()->cinfo()->name() << " not known.\nShould be Ksolve or Gsolve\n"; ksolve_ = 0; } - + if ( dsolve.element()->cinfo()->isA( "Dsolve" ) ) { dsolve_= reinterpret_cast< ZombiePoolInterface *>( ObjId( dsolve, 0 ).data() ); } else if ( dsolve == Id() ) { dsolve_ = 0; } else { - cout << "Warning:ZombiePool::vSetSolver: solver class " << - dsolve.element()->cinfo()->name() << + cout << "Warning:ZombiePool::vSetSolver: solver class " << + dsolve.element()->cinfo()->name() << " not known.\nShould be Dsolve\n"; dsolve_ = 0; } diff --git a/moose-core/ksolve/ZombiePool.h b/moose-core/ksolve/ZombiePool.h index 6771b2cebdddc8cf88f4608fe72692f69d5d4267..d0cefe8fd467fe4733c319fca0fc47af1608165f 100644 --- a/moose-core/ksolve/ZombiePool.h +++ b/moose-core/ksolve/ZombiePool.h @@ -11,12 +11,12 @@ #define _ZOMBIE_POOL_H /** - * This class is used by the Dsolve and Ksolve to take over from + * This class is used by the Dsolve and Ksolve to take over from * regular pools. Possibly other solver classes will eventually use it too. */ class ZombiePool: public PoolBase { - public: + public: ZombiePool(); ~ZombiePool(); @@ -56,15 +56,15 @@ class ZombiePool: public PoolBase static const Cinfo* initCinfo(); protected: - /** - * The ZombiePoolInterface pointers hold the solvers for the + /** + * The ZombiePoolInterface pointers hold the solvers for the * ZombiePool. At least one must be assigned. Field assignments - * propagate from the pool to whichever is assigned. Field + * propagate from the pool to whichever is assigned. Field * lookups first check the dsolve, then the ksolve. * The ZombiePool may be managed by the diffusion solver without - * the involvement of the Stoich class at all. So instead of + * the involvement of the Stoich class at all. So instead of * routing the zombie operations through the Stoich, we have - * pointers directly into the Dsolve and Ksolve. + * pointers directly into the Dsolve and Ksolve. */ ZombiePoolInterface* dsolve_; ZombiePoolInterface* ksolve_; diff --git a/moose-core/ksolve/ZombiePoolInterface.cpp b/moose-core/ksolve/ZombiePoolInterface.cpp index d6a54074b0ef1f5f634373325947aabb967396de..20fb4895bdc290fbc59187445218166e93a28688 100644 --- a/moose-core/ksolve/ZombiePoolInterface.cpp +++ b/moose-core/ksolve/ZombiePoolInterface.cpp @@ -37,7 +37,7 @@ ZombiePoolInterface::ZombiePoolInterface() ////////////////////////////////////////////////////////////////////////// // cross-compartment reaction stuff. ////////////////////////////////////////////////////////////////////////// -// void ZombiePoolInterface::xComptIn( const Eref& e, const ObjId& src, +// void ZombiePoolInterface::xComptIn( const Eref& e, const ObjId& src, // vector< double > values ) void ZombiePoolInterface::xComptIn( const Eref& e, Id srcZombiePoolInterface, vector< double > values ) @@ -79,7 +79,7 @@ void ZombiePoolInterface::assignXferVoxels( unsigned int xferCompt ) * Figures out indexing of the array of transferred pool n's used to fill * out proxies on each timestep. */ -void ZombiePoolInterface::assignXferIndex( unsigned int numProxyMols, +void ZombiePoolInterface::assignXferIndex( unsigned int numProxyMols, unsigned int xferCompt, const vector< vector< unsigned int > >& voxy ) { @@ -99,7 +99,7 @@ void ZombiePoolInterface::assignXferIndex( unsigned int numProxyMols, /** * This function sets up the information about the pool transfer for * cross-compartment reactions. It consolidates the transfer into a - * distinct vector for each direction of the transfer between each coupled + * distinct vector for each direction of the transfer between each coupled * pair of ZombiePoolInterfaces. * This one call sets up the information about transfer on both sides * of the junction(s) between current ZombiePoolInterface and otherZombiePoolInterface. @@ -109,13 +109,13 @@ void ZombiePoolInterface::assignXferIndex( unsigned int numProxyMols, * first, second: VoxelIndex for the first and second compartments. * firstVol, secondVol: VoxelVolume for the first and second compartments. */ -void ZombiePoolInterface::setupXfer( Id myZombiePoolInterface, Id otherZombiePoolInterface, +void ZombiePoolInterface::setupXfer( Id myZombiePoolInterface, Id otherZombiePoolInterface, unsigned int numProxyMols, const vector< VoxelJunction >& vj ) { const ChemCompt *myCompt = reinterpret_cast< const ChemCompt* >( compartment_.eref().data() ); - ZombiePoolInterface* otherZombiePoolInterfacePtr = - reinterpret_cast< ZombiePoolInterface* >( + ZombiePoolInterface* otherZombiePoolInterfacePtr = + reinterpret_cast< ZombiePoolInterface* >( otherZombiePoolInterface.eref().data() ); const ChemCompt *otherCompt = reinterpret_cast< const ChemCompt* >( otherZombiePoolInterfacePtr->compartment_.eref().data() ); @@ -129,18 +129,18 @@ void ZombiePoolInterface::setupXfer( Id myZombiePoolInterface, Id otherZombiePoo unsigned int j = vj[i].first; assert( j < getNumLocalVoxels() ); // Check voxel indices. proxyVoxy[j].push_back( vj[i].second ); - pools(j)->addProxyVoxy( myZombiePoolInterfaceIndex, + pools(j)->addProxyVoxy( myZombiePoolInterfaceIndex, otherZombiePoolInterfacePtr->compartment_, vj[i].second); unsigned int k = vj[i].second; assert( k < otherCompt->getNumEntries() ); reverseProxyVoxy[k].push_back( vj[i].first ); - otherZombiePoolInterfacePtr->pools(k)->addProxyVoxy( + otherZombiePoolInterfacePtr->pools(k)->addProxyVoxy( otherZombiePoolInterfaceIndex, compartment_, vj[i].first ); } // Build the indexing for the data values to transfer on each timestep assignXferIndex( numProxyMols, myZombiePoolInterfaceIndex, reverseProxyVoxy ); - otherZombiePoolInterfacePtr->assignXferIndex( + otherZombiePoolInterfacePtr->assignXferIndex( numProxyMols, otherZombiePoolInterfaceIndex, proxyVoxy ); // Figure out which voxels participate in data transfer. assignXferVoxels( myZombiePoolInterfaceIndex ); @@ -157,16 +157,16 @@ unsigned int ZombiePoolInterface::assignProxyPools( const map< Id, vector< Id > { map< Id, vector< Id > >::const_iterator i = xr.find( otherComptId ); vector< Id > proxyMols; - if ( i != xr.end() ) + if ( i != xr.end() ) proxyMols = i->second; - ZombiePoolInterface* otherZombiePoolInterfacePtr = - reinterpret_cast< ZombiePoolInterface* >( + ZombiePoolInterface* otherZombiePoolInterfacePtr = + reinterpret_cast< ZombiePoolInterface* >( otherZombiePoolInterface.eref().data() ); - - vector< Id > otherProxies = LookupField< Id, vector< Id > >::get( + + vector< Id > otherProxies = LookupField< Id, vector< Id > >::get( otherZombiePoolInterfacePtr->stoich_, "proxyPools", stoich_ ); - proxyMols.insert( proxyMols.end(), + proxyMols.insert( proxyMols.end(), otherProxies.begin(), otherProxies.end() ); // if ( proxyMols.size() == 0 ) // return 0; @@ -180,14 +180,14 @@ unsigned int ZombiePoolInterface::assignProxyPools( const map< Id, vector< Id > oxfi.resize( proxyMols.size() ); for ( unsigned int i = 0; i < xfi.size(); ++i ) { xfi[i] = getPoolIndex( proxyMols[i].eref() ); - oxfi[i] = otherZombiePoolInterfacePtr->getPoolIndex( + oxfi[i] = otherZombiePoolInterfacePtr->getPoolIndex( proxyMols[i].eref() ); } return proxyMols.size(); } -// This function cleans out the RateTerms of cross reactions that +// This function cleans out the RateTerms of cross reactions that // don't have anything to connect to. // It should be called after all cross reacs have been assigned. void ZombiePoolInterface::filterCrossRateTerms( const vector< Id >& xreacs, @@ -199,7 +199,7 @@ void ZombiePoolInterface::filterCrossRateTerms( const vector< Id >& xreacs, } /** - * This function builds cross-solver reaction calculations. For the + * This function builds cross-solver reaction calculations. For the * specified pair of stoichs (this->stoich_, otherStoich) it identifies * interacting molecules, finds where the junctions are, sets up the * info to build the data transfer vector, and sets up the transfer @@ -215,18 +215,18 @@ void ZombiePoolInterface::setupCrossSolverReacs( const map< Id, vector< Id > >& if ( myZombiePoolInterface == Id() ) return; Id otherZombiePoolInterface = Field< Id >::get( otherStoich, "ksolve" ); - if ( otherZombiePoolInterface == Id() ) + if ( otherZombiePoolInterface == Id() ) return; // Establish which molecules will be exchanged. - unsigned int numPools = assignProxyPools( xr, myZombiePoolInterface, otherZombiePoolInterface, + unsigned int numPools = assignProxyPools( xr, myZombiePoolInterface, otherZombiePoolInterface, otherComptId ); if ( numPools == 0 ) return; // Then, figure out which voxels do the exchange. - // Note that vj has a list of pairs of voxels on either side of a + // Note that vj has a list of pairs of voxels on either side of a // junction. If one voxel on self touches 5 voxels on other, then - // there will be five entries in vj for this contact. + // there will be five entries in vj for this contact. // If one voxel on self touches two different compartments, then // a distinct vj vector must be built for those contacts. const ChemCompt *otherCompt = reinterpret_cast< const ChemCompt* >( @@ -241,7 +241,7 @@ void ZombiePoolInterface::setupCrossSolverReacs( const map< Id, vector< Id > >& setupXfer( myZombiePoolInterface, otherZombiePoolInterface, numPools, vj ); /// This sets up the volume scaling from cross reac terms - // Deprecated. Handled by setupCrossSolverReacVols. + // Deprecated. Handled by setupCrossSolverReacVols. // buildCrossReacVolScaling( otherZombiePoolInterface, vj ); // Here we set up the messaging. @@ -249,13 +249,13 @@ void ZombiePoolInterface::setupCrossSolverReacs( const map< Id, vector< Id > >& shell->doAddMsg( "Single", myZombiePoolInterface, "xCompt", otherZombiePoolInterface, "xCompt" ); } -/** - * This fills the vols vector with the volume of the abutting +/** + * This fills the vols vector with the volume of the abutting * voxel on compt. If there are no abutting voxels on a given * voxel then that entry of the vols vector is filled with a zero. * There is exactly one vols entry for each voxel of the local compt. */ -void ZombiePoolInterface::matchJunctionVols( vector< double >& vols, Id otherComptId ) +void ZombiePoolInterface::matchJunctionVols( vector< double >& vols, Id otherComptId ) const { vols.resize( getNumLocalVoxels() ); @@ -275,7 +275,7 @@ void ZombiePoolInterface::matchJunctionVols( vector< double >& vols, Id otherCom myCompt->matchMeshEntries( otherCompt, vj ); if ( vj.size() == 0 ) return; - for ( vector< VoxelJunction >::const_iterator + for ( vector< VoxelJunction >::const_iterator i = vj.begin(); i != vj.end(); ++i ) { assert( i->first < vols.size() ); /* @@ -287,16 +287,16 @@ void ZombiePoolInterface::matchJunctionVols( vector< double >& vols, Id otherCom } /** - * This function builds cross-solver reaction volume scaling. + * This function builds cross-solver reaction volume scaling. */ -void ZombiePoolInterface::setupCrossSolverReacVols( - const vector< vector< Id > >& subCompts, +void ZombiePoolInterface::setupCrossSolverReacVols( + const vector< vector< Id > >& subCompts, const vector< vector< Id > >& prdCompts ) { map< Id, vector< double > > comptVolMap; - const Stoich* stoichPtr = reinterpret_cast< const Stoich* >( + const Stoich* stoichPtr = reinterpret_cast< const Stoich* >( stoich_.eref().data() ); - unsigned int numOffSolverReacs = + unsigned int numOffSolverReacs = stoichPtr->getNumRates() - stoichPtr->getNumCoreRates(); assert( subCompts.size() == numOffSolverReacs ); assert( prdCompts.size() == numOffSolverReacs ); @@ -345,7 +345,7 @@ void ZombiePoolInterface::setCompartment( Id compt ) isBuilt_ = false; // We will have to now rebuild the whole thing. if ( compt.element()->cinfo()->isA( "ChemCompt" ) ) { compartment_ = compt; - vector< double > vols = + vector< double > vols = Field< vector < double > >::get( compt, "voxelVolume" ); if ( vols.size() > 0 ) { setNumAllVoxels( vols.size() ); diff --git a/moose-core/ksolve/ZombiePoolInterface.h b/moose-core/ksolve/ZombiePoolInterface.h index 1829f025024f3b84cf959adc0d7ed0734f00d66d..10104fd2f5a54edde76928326d6e2215f6a23e58 100644 --- a/moose-core/ksolve/ZombiePoolInterface.h +++ b/moose-core/ksolve/ZombiePoolInterface.h @@ -12,7 +12,7 @@ /** * This pure virtual base class is for solvers that want to talk to - * the zombie pool. + * the zombie pool. * The Eref specifies both the pool identity and the voxel number within * the pool. */ @@ -57,26 +57,26 @@ class ZombiePoolInterface virtual double volume( unsigned int i ) const = 0; /** - * Gets block of data. The first 4 entries are passed in - * on the 'values' vector: the start voxel, numVoxels, + * Gets block of data. The first 4 entries are passed in + * on the 'values' vector: the start voxel, numVoxels, * start pool#, numPools. * These are followed by numVoxels * numPools of data values * which are filled in by the function. - * We assert that the entire requested block is present in + * We assert that the entire requested block is present in * this ZombiePoolInterface. * The block is organized as an array of arrays of voxels; * values[pool#][voxel#] * * Note that numVoxels and numPools are the number in the current - * block, not the upper limit of the block. So + * block, not the upper limit of the block. So * values.size() == 4 + numPools * numVoxels. */ virtual void getBlock( vector< double >& values ) const = 0; /** - * Sets block of data. The first 4 entries - * on the 'values' vector are the start voxel, numVoxels, - * start pool#, numPools. These are + * Sets block of data. The first 4 entries + * on the 'values' vector are the start voxel, numVoxels, + * start pool#, numPools. These are * followed by numVoxels * numPools of data values. */ virtual void setBlock( const vector< double >& values ) = 0; @@ -97,11 +97,11 @@ class ZombiePoolInterface Id getCompartment() const; /// Sets up cross-solver reactions. - void setupCrossSolverReacs( - const map< Id, vector< Id > >& xr, + void setupCrossSolverReacs( + const map< Id, vector< Id > >& xr, Id otherStoich ); - void setupCrossSolverReacVols( - const vector< vector< Id > >& subCompts, + void setupCrossSolverReacVols( + const vector< vector< Id > >& subCompts, const vector< vector< Id > >& prdCompts ); void filterCrossRateTerms( const vector< Id >& xreacs, @@ -126,15 +126,15 @@ class ZombiePoolInterface void assignXferIndex( unsigned int numProxyMols, unsigned int xferCompt, const vector< vector< unsigned int > >& voxy ); - void setupXfer( Id myZombiePoolInterface, + void setupXfer( Id myZombiePoolInterface, Id otherZombiePoolInterface, unsigned int numProxyMols, const vector< VoxelJunction >& vj ); unsigned int assignProxyPools( const map< Id, vector< Id > >& xr, - Id myZombiePoolInterface, Id otherZombiePoolInterface, + Id myZombiePoolInterface, Id otherZombiePoolInterface, Id otherComptId ); void matchJunctionVols( vector< double >& vols, Id otherComptId ) const; - + ////////////////////////////////////////////////////////////// protected: /** @@ -146,7 +146,7 @@ class ZombiePoolInterface /// Id of Chem compartment used to figure out volumes of voxels. Id compartment_; - /** + /** * All the data transfer information from current to other solvers. * xfer_[otherKsolveIndex] */ diff --git a/moose-core/ksolve/ZombieReac.cpp b/moose-core/ksolve/ZombieReac.cpp index 371b02327c04f6edc4df3d0c354189d9fa821b95..c12f30b89aa3a535084e0e4b50ae6da4fd76ba74 100644 --- a/moose-core/ksolve/ZombieReac.cpp +++ b/moose-core/ksolve/ZombieReac.cpp @@ -54,11 +54,11 @@ const Cinfo* ZombieReac::initCinfo() ////////////////////////////////////////////////////////////// static const Cinfo* zombieReacCinfo = ZombieReac::initCinfo(); -static const SrcFinfo2< double, double >* subOut = +static const SrcFinfo2< double, double >* subOut = dynamic_cast< const SrcFinfo2< double, double >* >( zombieReacCinfo->findFinfo( "subOut" ) ); -static const SrcFinfo2< double, double >* prdOut = +static const SrcFinfo2< double, double >* prdOut = dynamic_cast< const SrcFinfo2< double, double >* >( zombieReacCinfo->findFinfo( "prdOut" ) ); diff --git a/moose-core/ksolve/ZombieReac.h b/moose-core/ksolve/ZombieReac.h index bc34f55a8df6f69b5e373a74bbfeecc893766f25..0ab7fc5ec8a30ab24cf1d92687e7cfb5d8b68218 100644 --- a/moose-core/ksolve/ZombieReac.h +++ b/moose-core/ksolve/ZombieReac.h @@ -12,7 +12,7 @@ class ZombieReac: public ReacBase { - public: + public: ZombieReac(); ~ZombieReac(); @@ -38,7 +38,7 @@ class ZombieReac: public ReacBase // utility funcs ////////////////////////////////////////////////////////////////// /* - ZeroOrder* makeHalfReaction( + ZeroOrder* makeHalfReaction( Element* orig, double rate, const SrcFinfo* finfo ) const; */ diff --git a/moose-core/ksolve/testKsolve.cpp b/moose-core/ksolve/testKsolve.cpp index 52c6a2e20c15c1d226bc681b9959e83ec79a4950..6f0275ffa6d6ba4bfeec2fea5afec784a7e646d2 100644 --- a/moose-core/ksolve/testKsolve.cpp +++ b/moose-core/ksolve/testKsolve.cpp @@ -24,7 +24,7 @@ * A + Tab <===> B * A + B -sumtot--> tot1 * 2B <===> C - * + * * C ---e1Pool ---> D * D ---e2Pool ----> E * @@ -49,7 +49,7 @@ Id makeReacTest() Id D = pools[i++] = s->doCreate( "Pool", kin, "D", 1 ); Id E = pools[i++] = s->doCreate( "Pool", kin, "E", 1 ); Id tot1 = pools[i++] = s->doCreate( "BufPool", kin, "tot1", 1 ); - Id sum = s->doCreate( "Function", tot1, "func", 1 ); // Silly that it has to have this name. + Id sum = s->doCreate( "Function", tot1, "func", 1 ); // Silly that it has to have this name. Id sumInput( sum.value() + 1 ); Id e1Pool = s->doCreate( "Pool", kin, "e1Pool", 1 ); Id e2Pool = s->doCreate( "Pool", kin, "e2Pool", 1 ); @@ -109,11 +109,11 @@ Id makeReacTest() Field< double >::set( tab, "stopTime", 10.0 ); Field< double >::set( tab, "loopTime", 10.0 ); Field< bool >::set( tab, "doLoop", true ); - + // Connect outputs for ( unsigned int i = 0; i < 7; ++i ) - s->doAddMsg( "Single", ObjId( plots,i), + s->doAddMsg( "Single", ObjId( plots,i), "requestOut", pools[i], "getConc" ); // Schedule it. @@ -124,9 +124,9 @@ Id makeReacTest() s->doUseClock( "/kinetics/##[ISA=Reac],/kinetics/##[ISA=EnzBase],/kinetics/##[ISA=SumFunc]", "process", 4 ); s->doUseClock( "/kinetics/##[ISA=PoolBase]", "process", 5 ); - s->doUseClock( "/kinetics/##[ISA=StimulusTable]", + s->doUseClock( "/kinetics/##[ISA=StimulusTable]", "process", 4 ); - s->doUseClock( "/kinetics/##[ISA=Table]", "process", 8 ); + s->doUseClock( "/kinetics/##[ISA=Table]", "process", 8 ); s->doSetClock( 4, simDt ); s->doSetClock( 5, simDt ); s->doSetClock( 8, plotDt ); @@ -145,7 +145,7 @@ void testSetupReac() for ( unsigned int i = 0; i < 7; ++i ) { stringstream ss; ss << "plot." << i; - SetGet2< string, string >::set( ObjId( plots, i ), "xplot", + SetGet2< string, string >::set( ObjId( plots, i ), "xplot", "tsr.plot", ss.str() ); } */ @@ -159,7 +159,7 @@ void testBuildStoich() // Id number, modulo varPools then bufPOols. // Matrix looks like: // Reac Name R1 R2 e1a e1b e2 - // MolName + // MolName // D -1 0 0 0 0 // A -1 0 0 0 0 // B +1 -2 0 0 0 @@ -196,7 +196,7 @@ void testBuildStoich() #ifndef NDEBUG Stoich* stoichPtr = reinterpret_cast< Stoich* >( stoich.eref().data() ); #endif - + Field< string >::set( stoich, "path", "/kinetics/##" ); unsigned int n = Field< unsigned int >::get( stoich, "numAllPools" ); @@ -243,7 +243,7 @@ void testRunKsolve() Field< Id >::set( stoich, "compartment", kin ); Field< Id >::set( stoich, "ksolve", ksolve ); Field< string >::set( stoich, "path", "/kinetics/##" ); - s->doUseClock( "/kinetics/ksolve", "process", 4 ); + s->doUseClock( "/kinetics/ksolve", "process", 4 ); s->doSetClock( 4, simDt ); s->doReinit(); @@ -252,7 +252,7 @@ void testRunKsolve() for ( unsigned int i = 0; i < 7; ++i ) { stringstream ss; ss << "plot." << i; - SetGet2< string, string >::set( ObjId( plots, i ), "xplot", + SetGet2< string, string >::set( ObjId( plots, i ), "xplot", "tsr2.plot", ss.str() ); } s->doDelete( kin ); @@ -284,9 +284,9 @@ void testRunGsolve() Id stoich = s->doCreate( "Stoich", gsolve, "stoich", 1 ); Field< Id >::set( stoich, "compartment", kin ); Field< Id >::set( stoich, "ksolve", gsolve ); - + Field< string >::set( stoich, "path", "/kinetics/##" ); - s->doUseClock( "/kinetics/gsolve", "process", 4 ); + s->doUseClock( "/kinetics/gsolve", "process", 4 ); s->doSetClock( 4, simDt ); s->doReinit(); @@ -295,7 +295,7 @@ void testRunGsolve() for ( unsigned int i = 0; i < 7; ++i ) { stringstream ss; ss << "plot." << i; - SetGet2< string, string >::set( ObjId( plots, i ), "xplot", + SetGet2< string, string >::set( ObjId( plots, i ), "xplot", "tsr3.plot", ss.str() ); } s->doDelete( kin ); diff --git a/moose-core/mesh/Boundary.h b/moose-core/mesh/Boundary.h index 8b793ffd3a346ff71b278f5a0ac3199e94f87c6c..2d1d3361d51591a206bd2e33bbdcfca8d0efb50a 100644 --- a/moose-core/mesh/Boundary.h +++ b/moose-core/mesh/Boundary.h @@ -16,7 +16,7 @@ */ class Boundary { - public: + public: Boundary(); void setReflectivity( const double v ); diff --git a/moose-core/mesh/CMakeLists.txt b/moose-core/mesh/CMakeLists.txt index 70cf30da5e804463ed9b0482981c41987dbaac38..6046fc568dd566e42da372e50e3338ac999157b8 100644 --- a/moose-core/mesh/CMakeLists.txt +++ b/moose-core/mesh/CMakeLists.txt @@ -1,17 +1,17 @@ include_directories(../msg) include_directories(../basecode) include_directories(../utility) -add_library(mesh - ChemCompt.cpp - MeshCompt.cpp - MeshEntry.cpp - CubeMesh.cpp - CylBase.cpp +add_library(mesh + ChemCompt.cpp + MeshCompt.cpp + MeshEntry.cpp + CubeMesh.cpp + CylBase.cpp CylMesh.cpp - NeuroNode.cpp - NeuroMesh.cpp + NeuroNode.cpp + NeuroMesh.cpp SpineEntry.cpp SpineMesh.cpp PsdMesh.cpp - testMesh.cpp + testMesh.cpp ) diff --git a/moose-core/mesh/ChemCompt.cpp b/moose-core/mesh/ChemCompt.cpp index f5de5b1a222e803e9823ed2f4b81790c1a92324f..32ae58e2432ca26bcb67fb99636639a14ba3ca3a 100644 --- a/moose-core/mesh/ChemCompt.cpp +++ b/moose-core/mesh/ChemCompt.cpp @@ -40,14 +40,14 @@ const Cinfo* ChemCompt::initCinfo() &ChemCompt::getEntireVolume ); - static ReadOnlyValueFinfo< ChemCompt, vector< double > > + static ReadOnlyValueFinfo< ChemCompt, vector< double > > voxelVolume( "voxelVolume", "Vector of volumes of each of the voxels.", &ChemCompt::getVoxelVolume ); - static ReadOnlyValueFinfo< ChemCompt, vector< double > > + static ReadOnlyValueFinfo< ChemCompt, vector< double > > voxelMidpoint( "voxelMidpoint", "Vector of midpoint coordinates of each of the voxels. The " @@ -56,8 +56,8 @@ const Cinfo* ChemCompt::initCinfo() &ChemCompt::getVoxelMidpoint ); - static LookupElementValueFinfo< - ChemCompt, unsigned int, double > + static LookupElementValueFinfo< + ChemCompt, unsigned int, double > oneVoxelVolume( "oneVoxelVolume", "Volume of specified voxel.", @@ -86,7 +86,7 @@ const Cinfo* ChemCompt::initCinfo() "The diffusion rates into the coupled voxels is given by the " "partner field 'stencilRate'." "Returns an empty vector for non-voxelized compartments.", - &ChemCompt::getStencilIndex + &ChemCompt::getStencilIndex ); ////////////////////////////////////////////////////////////// @@ -96,7 +96,7 @@ const Cinfo* ChemCompt::initCinfo() 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 >( + new EpFunc2< ChemCompt, double, unsigned int >( &ChemCompt::buildDefaultMesh ) ); @@ -106,7 +106,7 @@ const Cinfo* ChemCompt::initCinfo() "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 >( + new OpFunc1< ChemCompt, double >( &ChemCompt::setVolumeNotRates ) ); @@ -130,8 +130,8 @@ const Cinfo* ChemCompt::initCinfo() // Field Elements ////////////////////////////////////////////////////////////// - static FieldElementFinfo< ChemCompt, MeshEntry > entryFinfo( - "mesh", + static FieldElementFinfo< ChemCompt, MeshEntry > entryFinfo( + "mesh", "Field Element for mesh entries", MeshEntry::initCinfo(), &ChemCompt::lookupEntry, @@ -183,14 +183,14 @@ const Cinfo* ChemCompt::initCinfo() static const Cinfo* chemMeshCinfo = ChemCompt::initCinfo(); ChemCompt::ChemCompt() - : + : entry_( this ) { ; } ChemCompt::~ChemCompt() -{ +{ /* for ( unsigned int i = 0; i < stencil_.size(); ++i ) { if ( stencil_[i] ) @@ -228,7 +228,7 @@ 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 = + vector< ObjId > tgtVec = e.element()->getMsgTargets( e.dataIndex(), voxelVolOut() ); if ( tgtVec.size() == 0 ) { vector< double > childConcs; @@ -271,7 +271,7 @@ void ChemCompt::getChildConcs( const Eref& e, vector< double >& childConcs ) } } -unsigned int ChemCompt::setChildConcs( const Eref& e, +unsigned int ChemCompt::setChildConcs( const Eref& e, const vector< double >& conc, unsigned int start ) const { vector< Id > kids; @@ -311,8 +311,8 @@ double ChemCompt::getOneVoxelVolume( const Eref& e, unsigned int dataIndex ) con 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 ); } @@ -395,7 +395,7 @@ void ChemCompt::flipRet( vector< VoxelJunction >& ret ) const //////////////////////////////////////////////////////////////////////// // Utility function -double ChemCompt::distance( double x, double y, double z ) +double ChemCompt::distance( double x, double y, double z ) { return sqrt( x * x + y * y + z * z ); } diff --git a/moose-core/mesh/ChemCompt.h b/moose-core/mesh/ChemCompt.h index 4ff0953e48450c1d556b2bc1de568bff4fcbb365..eb77b965fc883bb585ff2f412ea1ae2646c80cb5 100644 --- a/moose-core/mesh/ChemCompt.h +++ b/moose-core/mesh/ChemCompt.h @@ -16,13 +16,13 @@ * The ChemCompt represents a chemically identified compartment. * This may be spatially extended, and may even be discontinuous. * The same set of reactions and molecules populates any given compartment. - * Examples of compartments might be: nucleus, cell membrane, + * Examples of compartments might be: nucleus, cell membrane, * early endosomes, spine heads. * Connects to one or more 'Geometry' elements to define its boundaries. */ class ChemCompt { - public: + public: ChemCompt(); virtual ~ChemCompt(); ////////////////////////////////////////////////////////////////// @@ -39,7 +39,7 @@ class ChemCompt virtual double vGetEntireVolume() const = 0; /** - * This is a little nasty. It calls buildDefaultMesh with the + * This is a little nasty. It calls buildDefaultMesh with the * current numEntries. Should not be used if the mesh has been * changed to something more interesting. * Perhaps I need to do something like changeVolOfExistingMesh. @@ -50,12 +50,12 @@ class ChemCompt * Returns volume of specified voxel */ double getOneVoxelVolume( const Eref& e, unsigned int voxel ) const; - void setOneVoxelVolume( const Eref& e, unsigned int voxel, + void setOneVoxelVolume( const Eref& e, unsigned int voxel, double volume ); /** - * Returns # of dimensions of mesh. - * This is 3 for cube, and 1 for cylinder or neurons. + * Returns # of dimensions of mesh. + * This is 3 for cube, and 1 for cylinder or neurons. */ unsigned int getDimensions() const; virtual unsigned int innerGetDimensions() const = 0; @@ -98,14 +98,14 @@ class ChemCompt ////////////////////////////////////////////////////////////////// // Dest Finfo ////////////////////////////////////////////////////////////////// - + /** * Returns true on success. * Changes volume but does not notify any child objects. - * For some classes, this only works if the ChemCompt has + * For some classes, this only works if the ChemCompt has * just one voxel. It will return false if it can't handle it. - * This function will invalidate any concentration term in - * the model. If you don't know why you would want to do this, + * 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.", */ void setVolumeNotRates( double volume); @@ -114,7 +114,7 @@ class ChemCompt virtual bool vSetVolumeNotRates( double volume) = 0; /** - * buildDefaultMesh tells the ChemCompt to make a standard mesh + * buildDefaultMesh tells the ChemCompt to make a standard mesh * partitioning with the specified total volume * and the specified number of subdivisions. For example, a * CubeMesh of volume 8 and subdivisions 8 would make a 2x2x2 mesh. @@ -135,10 +135,10 @@ class ChemCompt ) = 0; */ - void handleNodeInfo( const Eref& e, + void handleNodeInfo( const Eref& e, unsigned int numNodes, unsigned int numThreads ); virtual void innerHandleNodeInfo( - const Eref& e, + const Eref& e, unsigned int numNodes, unsigned int numThreads ) = 0; /** @@ -168,7 +168,7 @@ class ChemCompt * Returns the matched lookupEntry */ MeshEntry* lookupEntry( unsigned int index ); - + ////////////////////////////////////////////////////////////////// // Generic utility function ////////////////////////////////////////////////////////////////// @@ -178,25 +178,25 @@ class ChemCompt // Utility function for volume rescaling ////////////////////////////////////////////////////////////////// /** - * Recursively traverses all children, depth_first, scooping up - * concentration terms: + * Recursively traverses all children, depth_first, scooping up + * concentration terms: * conc and concInit for pools, Kf and Kb for Reacs, and * Km for enzymes. These are inserted in order into the vector * of childConcs. Does not traverse into children of other * ChemCompts */ - void getChildConcs( const Eref& e, vector< double >& childConcs ) + void getChildConcs( const Eref& e, vector< double >& childConcs ) const; /** * Recursively traverses all children, depth_first, restoring - * concentration terms as scooped up by getChildConcs. Does + * concentration terms as scooped up by getChildConcs. Does * conc and concInit for pools, Kf and Kb for Reacs, and * Km for enzymes. These are restored in order into the vector * of childConcs. Does not traverse into children of other - * ChemCompts. + * ChemCompts. */ - unsigned int setChildConcs( const Eref& e, + unsigned int setChildConcs( const Eref& e, const vector< double >& childConcs, unsigned int start ) const; ////////////////////////////////////////////////////////////////// @@ -222,31 +222,31 @@ class ChemCompt * of pools. * spatialIndices are (iz * ny + iy) * nx + ix, that is, a linear * conversion of cartesian spatial indices. - * So, for two touching cubes, the return vector is the paired + * So, for two touching cubes, the return vector is the paired * meshIndices on either side of the plane of contact. If one mesh * has a finer mesh than the other, or if there are more than one * contact points from self to other (for example, at a corner), * then we just have multiple pairs using the same meshIndex of * the repeated voxel. */ - virtual void matchMeshEntries( const ChemCompt* other, + virtual void matchMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const = 0; /** * Returns distance and index of nearest mesh entry. Computes - * each mesh entry position as its geometric centre. - * If the current location is not inside a valid mesh entry, + * each mesh entry position as its geometric centre. + * If the current location is not inside a valid mesh entry, * distance returned is negative. */ - virtual double nearest( double x, double y, double z, + virtual double nearest( double x, double y, double z, unsigned int& index ) const = 0; - + /** * Converts specified index to xyz coords of middle of voxel * Values out of range return original xyz */ - virtual void indexToSpace( unsigned int index, + virtual void indexToSpace( unsigned int index, double& x, double& y, double& z ) const = 0; /// Utility function for swapping first and second in VoxelJunctions @@ -262,7 +262,7 @@ class ChemCompt virtual unsigned int getMeshDimensions( unsigned int fid ) const = 0; /// Virtual function to return volume of mesh Entry. - virtual double getMeshEntryVolume( unsigned int fid ) + virtual double getMeshEntryVolume( unsigned int fid ) const = 0; // /// Virtual function to assign volume of mesh Entry. Does nothing @@ -270,20 +270,20 @@ class ChemCompt virtual void setMeshEntryVolume( unsigned int fid, double volume ); /// Virtual function to return coords of mesh Entry. - virtual vector< double > getCoordinates( unsigned int fid ) + virtual vector< double > getCoordinates( unsigned int fid ) const = 0; /// Virtual function to return info on Entries connected to this one - virtual vector< unsigned int > getNeighbors( unsigned int fid ) + virtual vector< unsigned int > getNeighbors( unsigned int fid ) const = 0; /// Virtual function to return diffusion X-section area per neighbor virtual vector< double > getDiffusionArea( unsigned int fid ) const = 0; /// Virtual function to return scale factor for diffusion. 1 here. - virtual vector< double > getDiffusionScaling( unsigned int fid ) + virtual vector< double > getDiffusionScaling( unsigned int fid ) const = 0; /// Volume of mesh Entry including abutting diff-coupled voxels - virtual double extendedMeshEntryVolume( unsigned int fid ) + virtual double extendedMeshEntryVolume( unsigned int fid ) const = 0; /// clear out extended mesh entries for rebuilding. @@ -292,7 +292,7 @@ class ChemCompt /** * Function to look up scale factor derived from area and length * of compartment junction, for all the mesh entries connected to - * the specified one. + * the specified one. * Modeled on equivalent function in SparseMatrix. * meshIndex: index of reference mesh entry * entry: array of values of scale factor @@ -318,7 +318,7 @@ class ChemCompt * It uses these to stitch together the computations that span * multiple solvers and compartments. */ - virtual void extendStencil( + virtual void extendStencil( const ChemCompt* other, const vector< VoxelJunction >& vj ) = 0; ////////////////////////////////////////////////////////////////// @@ -338,7 +338,7 @@ class ChemCompt * different compartments can talk to each other. * All boundaries have a message to a Geometry. The Geometries * may be shared, which is why the boundary isn't a Geometry itself. - * If it is an interface (diffusive or other) then the boundary + * If it is an interface (diffusive or other) then the boundary * also contains a message to the adjacent compartment. */ vector< Boundary > boundaries_; @@ -351,11 +351,11 @@ class ChemCompt string method_; }; -extern SrcFinfo5< +extern SrcFinfo5< double, - vector< double >, - vector< unsigned int>, - vector< vector< unsigned int > >, + vector< double >, + vector< unsigned int>, + vector< vector< unsigned int > >, vector< vector< unsigned int > > >* meshSplit(); diff --git a/moose-core/mesh/CubeMesh.cpp b/moose-core/mesh/CubeMesh.cpp index db36f0504fe67154f3507338da70086fb3215cfd..da90d72b5afef9776b522e50cad676be8bc2b8f5 100644 --- a/moose-core/mesh/CubeMesh.cpp +++ b/moose-core/mesh/CubeMesh.cpp @@ -319,7 +319,7 @@ void CubeMesh::fillTwoDimSurface() } // Ah, C++ STL. Look on my works, ye mighty, and despair. sort( surface_.begin(), surface_.end() ); - surface_.erase( unique( surface_.begin(), surface_.end() ), + surface_.erase( unique( surface_.begin(), surface_.end() ), surface_.end() ); } @@ -357,12 +357,12 @@ void CubeMesh::fillThreeDimSurface() // Need to fix duplicate points. surface_.push_back( offset + ( i * ny_ + j ) * nx_ ); sort( surface_.begin(), surface_.end() ); - surface_.erase( unique( surface_.begin(), surface_.end() ), + surface_.erase( unique( surface_.begin(), surface_.end() ), surface_.end() ); } /** - * This assumes that dx, dy, dz are the quantities to preserve, over + * This assumes that dx, dy, dz are the quantities to preserve, over * numEntries. * So when the compartment changes volume, so does numEntries. dx, dy, dz * do not change, some of the sub-cuboids will partially be outside. @@ -380,7 +380,7 @@ void CubeMesh::updateCoords() 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; @@ -699,7 +699,7 @@ void CubeMesh::innerBuildDefaultMesh( const Eref& e, unsigned int bigger = ceil( approxN ); unsigned int numSide; if ( smaller != bigger ) { - numSide = smaller; + numSide = smaller; } else { unsigned int smallerVol = smaller * smaller * smaller; unsigned int biggerVol = bigger * bigger * bigger; @@ -724,7 +724,7 @@ void CubeMesh::innerHandleRequestMeshStats( const Eref& e, meshStatsFinfo->send( e, nx_ * ny_ * nz_, meshVolumes); } -/// Generate node decomposition of mesh, send it out along +/// Generate node decomposition of mesh, send it out along /// meshSplitFinfo msg void CubeMesh::innerHandleNodeInfo( const Eref& e, @@ -737,7 +737,7 @@ void CubeMesh::innerHandleNodeInfo( vector< vector< unsigned int > > outgoingEntries; vector< vector< unsigned int > > incomingEntries; double oldvol = getMeshEntryVolume( 0 ); - meshSplit()->send( e, + meshSplit()->send( e, oldvol, vols, localEntries, outgoingEntries, incomingEntries ); @@ -805,7 +805,7 @@ vector< double > CubeMesh::getCoordinates( unsigned int fid ) const return ret; } -unsigned int CubeMesh::neighbor( unsigned int spaceIndex, +unsigned int CubeMesh::neighbor( unsigned int spaceIndex, int dx, int dy, int dz ) const { int ix = spaceIndex % nx_; @@ -837,27 +837,27 @@ vector< double > CubeMesh::getDiffusionArea( unsigned int fid ) const unsigned int spaceIndex = m2s_[fid]; unsigned int nIndex = neighbor( spaceIndex, 0, 0, 1 ); - if ( nIndex != EMPTY ) + if ( nIndex != EMPTY ) ret.push_back( dx_ * dy_ ); nIndex = neighbor( spaceIndex, 0, 0, -1 ); - if ( nIndex != EMPTY ) + if ( nIndex != EMPTY ) ret.push_back( dx_ * dy_ ); nIndex = neighbor( spaceIndex, 0, 1, 0 ); - if ( nIndex != EMPTY ) + if ( nIndex != EMPTY ) ret.push_back( dz_ * dx_ ); nIndex = neighbor( spaceIndex, 0, -1, 0 ); - if ( nIndex != EMPTY ) + if ( nIndex != EMPTY ) ret.push_back( dz_ * dx_ ); nIndex = neighbor( spaceIndex, 1, 0, 0 ); - if ( nIndex != EMPTY ) + if ( nIndex != EMPTY ) ret.push_back( dy_ * dz_ ); nIndex = neighbor( spaceIndex, -1, 0, 0 ); - if ( nIndex != EMPTY ) + if ( nIndex != EMPTY ) ret.push_back( dy_ * dz_ ); return ret; @@ -932,7 +932,7 @@ const vector< double >& CubeMesh::getVoxelLength() const return length; } -bool CubeMesh::vSetVolumeNotRates( double vol ) +bool CubeMesh::vSetVolumeNotRates( double vol ) { // Leave x0,y0.z0 and nx,ny,nz the same. Do NOT update any rates. double oldvol = vGetEntireVolume(); @@ -951,8 +951,8 @@ bool CubeMesh::vSetVolumeNotRates( double vol ) 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 @@ -1112,7 +1112,7 @@ unsigned int CubeMesh::numDims() const 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_ ); @@ -1142,7 +1142,7 @@ unsigned int CubeMesh::spaceToIndex( double x, double y, double z ) const return EMPTY; } -double CubeMesh::nearest( double x, double y, double z, +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_ ) @@ -1160,7 +1160,7 @@ double CubeMesh::nearest( double x, double y, double z, 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 + for ( vector< unsigned int >::const_iterator i = surface_.begin(); i != surface_.end(); ++i ) { double tx, ty, tz; @@ -1186,8 +1186,8 @@ int CubeMesh::compareMeshSpacing( const CubeMesh* other ) const doubleApprox( dz_, other->dz_ ) ) return 0; // equal - if ( dx_ >= other->dx_ && - dy_ >= other->dy_ && + if ( dx_ >= other->dx_ && + dy_ >= other->dy_ && dz_ >= other->dz_ ) return 1; // bigger @@ -1208,12 +1208,12 @@ void CubeMesh::defineIntersection( const CubeMesh* other, 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_; + 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 ) @@ -1238,8 +1238,8 @@ void CubeMesh::defineIntersection( const CubeMesh* other, } /** - * The intersect pairs are always meshIndex in first, and a flag in - * the second. The flag can be: + * The intersect pairs are always meshIndex in first, and a flag in + * the second. The flag can be: * EMPTY: empty * SURFACE: on the surface * ABUT[X,Y,Z]: One place removed from the surface, only one entry @@ -1261,8 +1261,8 @@ void setAbut( PII& voxel, unsigned int meshIndex, unsigned int axis ) voxel.second = CubeMesh::MULTI; } -void setIntersectVoxel( - vector< PII >& intersect, +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 ) @@ -1272,10 +1272,10 @@ void setIntersectVoxel( assert( index < intersect.size() ); intersect[index] = PII( meshIndex, CubeMesh::SURFACE ); if ( ix > 0 ) - setAbut( intersect[ (iz*ny + iy) * nx + ix-1 ], meshIndex, + setAbut( intersect[ (iz*ny + iy) * nx + ix-1 ], meshIndex, CubeMesh::ABUTX ); if ( ix + 1 < nx ) - setAbut( intersect[ (iz*ny + iy) * nx + ix+1 ], meshIndex, + setAbut( intersect[ (iz*ny + iy) * nx + ix+1 ], meshIndex, CubeMesh::ABUTX ); if ( iy > 0 ) @@ -1295,7 +1295,7 @@ void setIntersectVoxel( /** - * checkAbut checks the intersect vector for the current position + * checkAbut checks the intersect vector for the current position * ix, iy, iz, to determine how many diffusion terms to extract. It * then puts each of the extracted terms into the ret vector. There is * a minor efficiency for one and two diffusion terms as they are @@ -1305,12 +1305,12 @@ void setIntersectVoxel( * into the diffScale * field of the VoxelJunction. 0 = x; 1 = y; 2 = z. */ -void checkAbut( - const vector< PII >& intersect, +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 + vector< VoxelJunction >& ret ) { unsigned int index = ( iz * ny + iy ) * nx + ix; @@ -1319,57 +1319,57 @@ void checkAbut( if ( localFlag == CubeMesh::EMPTY || localFlag == CubeMesh::SURFACE ) return; // Nothing to put into the ret vector if ( localFlag == CubeMesh::ABUTX ) { - ret.push_back( + ret.push_back( VoxelJunction( intersect[index].first, meshIndex, 0 )); } else if ( localFlag == CubeMesh::ABUTY ) { - ret.push_back( + ret.push_back( VoxelJunction( intersect[index].first, meshIndex, 1 )); } else if ( localFlag == CubeMesh::ABUTZ ) { - ret.push_back( + 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( + 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( + 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( + 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( + 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( + 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( + ret.push_back( VoxelJunction( intersect[index].first, meshIndex, 2 )); } } } void CubeMesh::assignVoxels( vector< PII >& intersect, - double xmin, double xmax, - double ymin, double ymax, + double xmin, double xmax, + double ymin, double ymax, double zmin, double zmax ) const { @@ -1382,14 +1382,14 @@ void CubeMesh::assignVoxels( vector< PII >& intersect, 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 && + if ( x >= xmin && x <= xmax && y >= ymin && y <= ymax && z >= zmin && z <= zmax ) { int ix = index % nx_ - ox; assert( ix >= 0 ); @@ -1404,7 +1404,7 @@ void CubeMesh::assignVoxels( vector< PII >& intersect, unsigned int uiz = iz; unsigned int meshIndex = s2m_[ *i ]; - setIntersectVoxel( intersect, uix, uiy, uiz, nx, ny, nz, + setIntersectVoxel( intersect, uix, uiy, uiz, nx, ny, nz, meshIndex ); } } @@ -1432,14 +1432,14 @@ void CubeMesh::matchCubeMeshEntries( const CubeMesh* other, 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 = + 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 && + 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_; @@ -1508,7 +1508,7 @@ void CubeMesh::setDiffScale( const CubeMesh* other, i->diffScale = 2 * selfXA / ( dz_ + other->dz_ ); else i->diffScale = 2 * otherXA / ( dz_ + other->dz_ ); - } else { + } else { assert( 0 ); } } diff --git a/moose-core/mesh/CubeMesh.h b/moose-core/mesh/CubeMesh.h index 651906cc931ab9f9eab561e7d9aa7d3d9e68db3d..c261b6e9a23c3458239cd461ce74f341d88e14fa 100644 --- a/moose-core/mesh/CubeMesh.h +++ b/moose-core/mesh/CubeMesh.h @@ -18,7 +18,7 @@ */ class CubeMesh: public MeshCompt { - public: + public: CubeMesh(); ~CubeMesh(); @@ -109,7 +109,7 @@ class CubeMesh: public MeshCompt unsigned int innerGetNumEntries() const; /// Inherited virtual func. void innerSetNumEntries( unsigned int n ); - + void innerHandleRequestMeshStats( const Eref& e, const SrcFinfo2< unsigned int, vector< double > >* @@ -117,7 +117,7 @@ class CubeMesh: public MeshCompt ); void innerHandleNodeInfo( - const Eref& e, + const Eref& e, unsigned int numNodes, unsigned int numThreads ); /// Virtual func to get volume of entire compartment. @@ -147,7 +147,7 @@ class CubeMesh: public MeshCompt */ void updateCoords(); - unsigned int neighbor( unsigned int spaceIndex, + unsigned int neighbor( unsigned int spaceIndex, int dx, int dy, int dz ) const; void transmitChange( const Eref& e, double oldvol ); @@ -193,9 +193,9 @@ class CubeMesh: public MeshCompt /// Utility function for returning # of dimensions in mesh unsigned int numDims() const; - + /// Converts the integer meshIndex to spatial coords. - void indexToSpace( unsigned int index, + void indexToSpace( unsigned int index, double& x, double& y, double& z ) const; /// Converts the 3-D coords to an index. EMPTY if out of range. @@ -207,7 +207,7 @@ class CubeMesh: public MeshCompt */ double nearest( double x, double y, double z, unsigned int& index ) const; - + /// Return 0 if spacing same, -1 if self smaller, +1 if self bigger int compareMeshSpacing( const CubeMesh* other ) const; @@ -216,7 +216,7 @@ class CubeMesh: public MeshCompt double& xmin, double &xmax, double& ymin, double &ymax, double& zmin, double &zmax ) const; - + /// Fills surface_ vector with spatial meshIndices for a rectangle void fillTwoDimSurface(); @@ -251,27 +251,27 @@ class CubeMesh: public MeshCompt void buildStencil(); void fillSpaceToMeshLookup(); - /** - * Updates the m2s_ vector after s2m_ has been changed, + /** + * Updates the m2s_ vector after s2m_ has been changed, * and rebuilds the Stencil too. Any earlier junction information * is lost. */ void deriveM2sFromS2m(); - /** - * Updates the s2m_ vector after m2s_ has been changed, + /** + * Updates the s2m_ vector after m2s_ has been changed, * and rebuilds the Stencil too. Any earlier junction information * is lost. */ void deriveS2mFromM2s(); - void assignVoxels( + void assignVoxels( vector< pair< unsigned int, unsigned int > >& intersect, - double xmin, double xmax, - double ymin, double ymax, + double xmin, double xmax, + double ymin, double ymax, double zmin, double zmax ) const; - + /// Assigns diffusion scaling info for the voxel junctions. void setDiffScale( const CubeMesh* other, vector< VoxelJunction >& ret ) const; @@ -322,7 +322,7 @@ class CubeMesh: public MeshCompt /** * Mesh to Space lookup. Indexed by linear mesh index, from 0 to - * number of actual mesh entries (occupied cuboids). Returns + * number of actual mesh entries (occupied cuboids). Returns * spatial index, from 0 to nx * ny * nz - 1. * Needed whenever the cuboid mesh is not filling the entire volume * of the cube, that is, in most cases. @@ -333,13 +333,13 @@ class CubeMesh: public MeshCompt * Space to Mesh lookup. Indexed by spatial index, from * 0 to nx * ny * nz - 1. Specifically, point x y z is indexed as * ( z * ny + y ) * nx + x. Returns mesh index to look up molecules - * etc in the specific volume. In case the spatial location is + * etc in the specific volume. In case the spatial location is * outside the included volume of the mesh, returns ~0. */ vector< unsigned int > s2m_; /** - * Vector of spatial meshIndices comprising surface of volume in + * Vector of spatial meshIndices comprising surface of volume in * CubeMesh. */ vector< unsigned int > surface_; diff --git a/moose-core/mesh/CylBase.cpp b/moose-core/mesh/CylBase.cpp index 75ec35af1518e5a9c021da3a7f08c30b8f11be3a..a4d8d6bb8b8d7a37387dad35c2ddddfc45bd5c4c 100644 --- a/moose-core/mesh/CylBase.cpp +++ b/moose-core/mesh/CylBase.cpp @@ -23,7 +23,7 @@ extern const double PI; // defined in consts.cpp -CylBase::CylBase( double x, double y, double z, +CylBase::CylBase( double x, double y, double z, double dia, double length, unsigned int numDivs ) : x_( x ), @@ -155,9 +155,9 @@ double CylBase::voxelVolume( const CylBase& parent, unsigned int fid ) const if ( isCylinder_ ) return length_ * dia_ * dia_ * PI / ( 4.0 * numDivs_ ); - double frac0 = ( static_cast< double >( fid ) ) / + double frac0 = ( static_cast< double >( fid ) ) / static_cast< double >( numDivs_ ); - double frac1 = ( static_cast< double >( fid + 1 ) ) / + double frac1 = ( static_cast< double >( fid + 1 ) ) / static_cast< double >( numDivs_ ); double r0 = 0.5 * ( parent.dia_ * ( 1.0 - frac0 ) + dia_ * frac0 ); double r1 = 0.5 * ( parent.dia_ * ( 1.0 - frac1 ) + dia_ * frac1 ); @@ -169,13 +169,13 @@ double CylBase::voxelVolume( const CylBase& parent, unsigned int fid ) const /// Virtual function to return coords of mesh Entry. /// For Cylindrical mesh, coords are x1y1z1 x2y2z2 r0 r1 phi0 phi1 -vector< double > CylBase::getCoordinates( +vector< double > CylBase::getCoordinates( const CylBase& parent, unsigned int fid ) const { assert( numDivs_ > fid ); - double frac0 = ( static_cast< double >( fid ) ) / + double frac0 = ( static_cast< double >( fid ) ) / static_cast< double >( numDivs_ ); - double frac1 = ( static_cast< double >( fid + 1 ) ) / + double frac1 = ( static_cast< double >( fid + 1 ) ) / static_cast< double >( numDivs_ ); double r0 = 0.5 * ( parent.dia_ * ( 1.0 - frac0 ) + dia_ * frac0 ); @@ -193,7 +193,7 @@ vector< double > CylBase::getCoordinates( ret[7] = r1; ret[8] = 0; ret[9] = 0; - + return ret; } @@ -207,39 +207,39 @@ vector< double > CylBase::getCoordinates( * to be computed external to the CylBase, typically by calling the * getDiffusionArea for the child CylBase. */ -double CylBase::getDiffusionArea( +double CylBase::getDiffusionArea( const CylBase& parent, unsigned int fid ) const { assert( fid < numDivs_ + 1 ); if ( isCylinder_ ) return PI * dia_ * dia_ / 4.0; - double frac0 = ( static_cast< double >( fid ) ) / + double frac0 = ( static_cast< double >( fid ) ) / static_cast< double >( numDivs_ ); double r0 = 0.5 * ( parent.dia_ * ( 1.0 - frac0 ) + dia_ * frac0 ); return PI * r0 * r0; } /// Return the cross section area of the middle of the specified voxel. -double CylBase::getMiddleArea( +double CylBase::getMiddleArea( const CylBase& parent, unsigned int fid ) const { assert( fid < numDivs_ ); if ( isCylinder_ ) return PI * dia_ * dia_ / 4.0; - double frac0 = ( 0.5 + static_cast< double >( fid ) ) / + double frac0 = ( 0.5 + static_cast< double >( fid ) ) / static_cast< double >( numDivs_ ); double r0 = 0.5 * ( parent.dia_ * ( 1.0 - frac0 ) + dia_ * frac0 ); return PI * r0 * r0; } -double CylBase::getVoxelLength() const +double CylBase::getVoxelLength() const { return length_ / numDivs_; } // Select grid size. Ideally the meshes should be comparable. -double CylBase::selectGridSize( double h, double dia1, +double CylBase::selectGridSize( double h, double dia1, double granularity ) const { if ( length_ < 1e-7 && numDivs_ == 1 ) { // It is a disc, not a cylinder @@ -260,7 +260,7 @@ double CylBase::selectGridSize( double h, double dia1, return h; } -static void fillPointsOnCircle( +static void fillPointsOnCircle( const Vec& u, const Vec& v, const Vec& q, double h, double r, vector< double >& area, const CubeMesh* other @@ -288,7 +288,7 @@ static void fillPointsOnCircle( } } -static void fillPointsOnDisc( +static void fillPointsOnDisc( const Vec& u, const Vec& v, const Vec& q, double h, double r, vector< double >& area, const CubeMesh* other @@ -321,7 +321,7 @@ void CylBase::matchCubeMeshEntries( const ChemCompt* compt, const CylBase& parent, unsigned int startIndex, double granularity, - vector< VoxelJunction >& ret, + vector< VoxelJunction >& ret, bool useCylinderCurve, bool useCylinderCap ) const { const CubeMesh* other = dynamic_cast< const CubeMesh* >( compt ); @@ -357,11 +357,11 @@ void CylBase::matchCubeMeshEntries( const ChemCompt* compt, } } if ( useCylinderCap && i == numDivs_ - 1 ) { - fillPointsOnDisc( u, v, Vec( x_, y_, z_ ), + fillPointsOnDisc( u, v, Vec( x_, y_, z_ ), h, dia_/2.0, area, other ); } - // Go through all cubeMesh entries and compute diffusion - // cross-section. Assume this is through a membrane, so the + // 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. for ( unsigned int k = 0; k < area.size(); ++k ) { if ( area[k] > EPSILON ) { @@ -373,9 +373,9 @@ void CylBase::matchCubeMeshEntries( const ChemCompt* compt, // this is the function that does the actual calculation. // Returns radial distance from self to axis formed from parent to self. -// also sends back linePos, the fraction along the line, and r, the +// also sends back linePos, the fraction along the line, and r, the // radius of the parent tapering cylinder at the point of linePos. -double CylBase::nearest( double x, double y, double z, +double CylBase::nearest( double x, double y, double z, const CylBase& parent, double& linePos, double& r ) const { @@ -389,12 +389,12 @@ double CylBase::nearest( double x, double y, double z, // // So distance from c to p is what we want. // - // If k is + // If k is // Vec a( parent.x_, parent.y_, parent.z_ ); Vec b( x_, y_, z_ ); Vec c( x, y, z ); - + double dist = b.distance( a ); assert( dist > EPSILON ); double k = ( b - a ).dotProduct( c - a ); @@ -411,7 +411,7 @@ double CylBase::nearest( double x, double y, double z, } // This function returns the index. -double CylBase::nearest( double x, double y, double z, +double CylBase::nearest( double x, double y, double z, const CylBase& parent, unsigned int& index ) const { diff --git a/moose-core/mesh/CylBase.h b/moose-core/mesh/CylBase.h index cd4920d947a95a6da6b767340b268bc6e25efede..7543bf526de4f6a15b2bb19a5afae02ee72e85c7 100644 --- a/moose-core/mesh/CylBase.h +++ b/moose-core/mesh/CylBase.h @@ -17,7 +17,7 @@ class CylBase { public: - CylBase( double x, double y, double z, + CylBase( double x, double y, double z, double dia, double length, unsigned int numDivs ); CylBase(); @@ -66,11 +66,11 @@ class CylBase * to be computed external to the CylBase, typically by calling the * getDiffusionArea for the child CylBase. */ - double getDiffusionArea( + double getDiffusionArea( const CylBase& parent, unsigned int index ) const; /// Return cross-section area of middle of specified voxel. - double getMiddleArea( + double getMiddleArea( const CylBase& parent, unsigned int index ) const; /// Return length of voxel. All are equal. @@ -100,7 +100,7 @@ class CylBase private: /// end of the node. The start is given by parent coords. - double x_; + double x_; double y_; double z_; diff --git a/moose-core/mesh/CylMesh.cpp b/moose-core/mesh/CylMesh.cpp index e86db2b1656cd994b7741707275f414b534f51bf..ed2c6c4372832ed0ee1033ccaa2c03612f2c14a5 100644 --- a/moose-core/mesh/CylMesh.cpp +++ b/moose-core/mesh/CylMesh.cpp @@ -190,9 +190,9 @@ CylMesh::~CylMesh() */ void CylMesh::updateCoords( const Eref& e, const vector< double >& concs ) { - double temp = sqrt( - ( x1_ - x0_ ) * ( x1_ - x0_ ) + - ( y1_ - y0_ ) * ( y1_ - y0_ ) + + double temp = sqrt( + ( x1_ - x0_ ) * ( x1_ - x0_ ) + + ( y1_ - y0_ ) * ( y1_ - y0_ ) + ( z1_ - z0_ ) * ( z1_ - z0_ ) ); @@ -442,7 +442,7 @@ unsigned int CylMesh::getMeshDimensions( unsigned int fid ) const * => k/3 * ( r1^3 - r0^3) = totLen * => k = 3 * totLen / (r1^3 - r0^3); * This is bad if r1 == r0, and is generally unpleasant. - * + * * Simple definition of rSlope: * rSlope is measured per meshEntry, not per length: * rSlope = ( r1 - r0 ) / numEntries; @@ -456,7 +456,7 @@ unsigned int CylMesh::getMeshDimensions( unsigned int fid ) const * // To linearize, let 2r = r0 + r1. * // so dlen/dx = ( (r1-r0)/len ) * k * ( r0 + r1 ) * // len(i) = len0 + i * dlen/dx - * // len0 = totLen/numEntries - ( numEntries/2 ) * dlen/dx + * // len0 = totLen/numEntries - ( numEntries/2 ) * dlen/dx */ /// Virtual function to return volume of mesh Entry. @@ -481,7 +481,7 @@ vector< double > CylMesh::getCoordinates( unsigned int fid ) const double axialStart = fid * lenStart + ( ( fid * (fid - 1 ) )/2 ) * lenSlope_; // fid * totLen_/numEntries_ + (fid - frac ) * lenSlope_; - double axialEnd = + double axialEnd = (fid + 1) * lenStart + ( ( fid * (fid + 1 ) )/2 ) * lenSlope_; // (fid + 1) * totLen_/numEntries_ + (fid - frac + 1.0) * lenSlope_; @@ -498,7 +498,7 @@ vector< double > CylMesh::getCoordinates( unsigned int fid ) const ret[8] = 0; ret[9] = 0; - + return ret; } @@ -628,7 +628,7 @@ void CylMesh::innerBuildDefaultMesh( const Eref& e, double volume, unsigned int numEntries ) { /// Single voxel cylinder with diameter = length. - /// vol = volume = pi.r^2.len. + /// vol = volume = pi.r^2.len. /// So len = 2r, volume = pi*r^2*2r = 2pi*r^3 so r = (volume/2pi)^(1/3) double r = pow( ( volume / ( PI * 2 ) ), 1.0 / 3 ); vector< double > coords( 9, 0 ); @@ -682,7 +682,7 @@ const vector< double >& CylMesh::getVoxelArea() const static vector< double > area; area.resize( numEntries_ ); for ( unsigned int i = 0; i < numEntries_; ++i ) { - double frac = ( 0.5 + static_cast< double >( i ) ) / + double frac = ( 0.5 + static_cast< double >( i ) ) / static_cast< double >( numEntries_ ); double r = r0_ * ( 1.0 - frac ) + r1_ * frac; area[i] = r * r * PI; @@ -716,7 +716,7 @@ bool CylMesh::vSetVolumeNotRates( double volume ) r1_ *= linScale; totLen_ *= linScale; // Have to scale this so numEntries remains the same. - diffLength_ = totLen_ / numEntries_; + diffLength_ = totLen_ / numEntries_; return true; } @@ -728,7 +728,7 @@ void CylMesh::transmitChange( const Eref& e ) { /* Id meshEntry( e.id().value() + 1 ); - assert( + assert( meshEntry.eref().data() == reinterpret_cast< char* >( lookupEntry( 0 ) ) ); double oldvol = getMeshEntryVolume( 0 ); @@ -742,7 +742,7 @@ void CylMesh::transmitChange( const Eref& e ) vector< vector< unsigned int > > outgoingEntries; // [node#][Entry#] vector< vector< unsigned int > > incomingEntries; // [node#][Entry#] - // This function updates the size of the FieldDataHandler for the + // This function updates the size of the FieldDataHandler for the // MeshEntries. DataHandler* dh = meshEntry.element()->dataHandler(); FieldDataHandlerBase* fdh = dynamic_cast< FieldDataHandlerBase* >( dh ); @@ -755,12 +755,12 @@ void CylMesh::transmitChange( const Eref& e ) // how it communicates with other nodes. meshSplit()->fastSend( e, oldvol, - vols, localIndices, + 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(), + lookupEntry( 0 )->triggerRemesh( meshEntry.eref(), oldvol, startEntry, localIndices, vols ); */ } @@ -842,7 +842,7 @@ vector< VoxelJunction >& ret ) const { const double EPSILON = 1e-3; ret.clear(); - // Should really estimate the distance from the centre of the smaller + // Should really estimate the distance from the centre of the smaller // cylinder cap disk to the plane of the larger disk, provided it is // within the radius of the disk. The subsequent calculations are the // same though. @@ -860,8 +860,8 @@ vector< VoxelJunction >& ret ) const double xda; if ( r0_ < other->r0_ ) xda = 2 * r0_ * r0_ * PI / ( diffLength_ + other->diffLength_ ); - else - xda = 2 * other->r0_ * other->r0_ * PI / + else + xda = 2 * other->r0_ * other->r0_ * PI / ( diffLength_ + other->diffLength_ ); ret.push_back( VoxelJunction( 0, 0, xda ) ); ret.back().first = 0; @@ -874,10 +874,10 @@ vector< VoxelJunction >& ret ) const double xda; if ( r1_ < other->r1_ ) xda = 2 * r1_ * r1_ * PI / ( diffLength_ + other->diffLength_ ); - else - xda = 2 * other->r1_ * other->r1_ * PI / + else + xda = 2 * other->r1_ * other->r1_ * PI / ( diffLength_ + other->diffLength_ ); - ret.push_back( VoxelJunction( numEntries_ - 1, + ret.push_back( VoxelJunction( numEntries_ - 1, other->numEntries_ - 1, xda ) ); ret.back().first = numEntries_; ret.back().second = other->numEntries_ - 1; @@ -889,8 +889,8 @@ vector< VoxelJunction >& ret ) const double xda; if ( r1_ < other->r0_ ) xda = 2 * r1_ * r1_ * PI / ( diffLength_ + other->diffLength_ ); - else - xda = 2 * other->r0_ * other->r0_ * PI / + else + xda = 2 * other->r0_ * other->r0_ * PI / ( diffLength_ + other->diffLength_ ); ret.push_back( VoxelJunction( numEntries_ - 1, 0, xda ) ); ret.back().first = numEntries_ - 1; @@ -903,8 +903,8 @@ vector< VoxelJunction >& ret ) const double xda; if ( r0_ < other->r1_ ) xda = 2 * r0_ * r0_ * PI / ( diffLength_ + other->diffLength_ ); - else - xda = 2 * other->r1_ * other->r1_ * PI / + else + xda = 2 * other->r1_ * other->r1_ * PI / ( diffLength_ + other->diffLength_ ); ret.push_back( VoxelJunction( 0, other->numEntries_ - 1, xda )); ret.back().first = 0; @@ -931,7 +931,7 @@ double CylMesh::selectGridVolume( double h ) const return h; } -void fillPointsOnCircle( +void fillPointsOnCircle( const Vec& u, const Vec& v, const Vec& q, double h, double r, vector< double >& area, const CubeMesh* other @@ -986,8 +986,8 @@ vector< VoxelJunction >& ret ) const fillPointsOnCircle( u, v, Vec( q0, q1, q2 ), h, r, area, other ); } - // Go through all cubeMesh entries and compute diffusion - // cross-section. Assume this is through a membrane, so the + // 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. for ( unsigned int k = 0; k < area.size(); ++k ) { if ( area[k] > EPSILON ) { @@ -1003,9 +1003,9 @@ 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_ ) { + if ( index < numEntries_ ) { double k = ( index + 0.5 ) / static_cast< double >( numEntries_ ); x = ( x1_ - x0_ ) * k + x0_; y = ( y1_ - y0_ ) * k + y0_; @@ -1013,7 +1013,7 @@ void CylMesh::indexToSpace( unsigned int index, } } -static double dotprd ( double x0, double y0, double z0, +static double dotprd ( double x0, double y0, double z0, double x1, double y1, double z1 ) { return x0 * x1 + y0 * y1 + z0 * z1; @@ -1021,7 +1021,7 @@ static double dotprd ( double x0, double y0, double z0, // this is the function that does the actual calculation. -double CylMesh::nearest( double x, double y, double z, +double CylMesh::nearest( double x, double y, double z, double& linePos, double& r ) const { // Consider r0 = x0,y0,z0 and r1 = x1, y1, z1, and r = x,y,z. @@ -1033,9 +1033,9 @@ double CylMesh::nearest( double x, double y, double z, // Solving, // k = (r0 - r1).(r - r1) / (|r0-r1|^2) // - + double dist = distance( x1_ - x0_, y1_ - y0_, z1_ - z0_ ); - double k = dotprd( + double k = dotprd( x1_ - x0_, y1_ - y0_, z1_ - z0_, x - x0_, y - y0_, z - z0_ ) / ( dist * dist ); @@ -1051,7 +1051,7 @@ double CylMesh::nearest( double x, double y, double z, } // This function returns the index. -double CylMesh::nearest( double x, double y, double z, +double CylMesh::nearest( double x, double y, double z, unsigned int& index ) const { double k = 0.0; @@ -1079,7 +1079,7 @@ bool isOnSurface( double x, double y, double z, unsigned int &index, double& adx ) { double len = distance( x1_ - x0_, y1_ - y0_, z1_ - z0_ ); - double k = dotprd( + double k = dotprd( x1_ - x0_, y1_ - y0_, z1_ - z0_, x - x0_, y - y0_, z - z0_ ) / len; @@ -1104,7 +1104,7 @@ bool isOnSurface( double x, double y, double z, // 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 + // 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 a33392b607bf0a274d988e57b478a6b627793ef6..7014e643eabc6674cd8f7aca44ee08b4f7f16a40 100644 --- a/moose-core/mesh/CylMesh.h +++ b/moose-core/mesh/CylMesh.h @@ -18,7 +18,7 @@ */ class CylMesh: public MeshCompt { - public: + public: CylMesh(); ~CylMesh(); ////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ class CylMesh: public MeshCompt 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; @@ -119,29 +119,29 @@ class CylMesh: public MeshCompt ); void innerHandleNodeInfo( - const Eref& e, + 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, + + void matchMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - double nearest( double x, double y, double z, + double nearest( double x, double y, double z, unsigned int& index ) const; - - double nearest( double x, double y, double z, + + double nearest( double x, double y, double z, double& linePos, double& r ) const; - - void indexToSpace( unsigned int index, + + void indexToSpace( unsigned int index, double& x, double& y, double& z ) const; - + ////////////////////////////////////////////////////////////////// // Inner specific functions needed by matchMeshEntries. ////////////////////////////////////////////////////////////////// @@ -178,11 +178,11 @@ class CylMesh: public MeshCompt double diffLength_; /// Length constant for diffusion. Equal to dx. /** - * surfaceGranularity_ decides how finely to subdivide DiffLength + * 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 surfaceGranularity_; double totLen_; /// Utility value: Total length of cylinder double rSlope_; /// Utility value: dr/dx diff --git a/moose-core/mesh/MeshCompt.cpp b/moose-core/mesh/MeshCompt.cpp index 54a1ebd7f6c29f1fc9206b9f8de12e13ab028f7b..5b46bd6aee2f7864d1f433bebca6d133a0af8841 100644 --- a/moose-core/mesh/MeshCompt.cpp +++ b/moose-core/mesh/MeshCompt.cpp @@ -95,7 +95,7 @@ vector< double > MeshCompt::innerGetStencilRate( unsigned int row ) const return ret; } -void MeshCompt::addRow( unsigned int index, +void MeshCompt::addRow( unsigned int index, const vector< double >& entry, const vector< unsigned int >& colIndex ) @@ -111,20 +111,20 @@ void MeshCompt::setStencilSize( unsigned int numRows, unsigned int numCols ) /** - * extendStencil adds voxels to the current stencil m_, to build up a - * monolithic stencil that also handles the entries just past all the + * extendStencil adds voxels to the current stencil m_, to build up a + * monolithic stencil that also handles the entries just past all the * boundaries. * This function may be called many times to deal with the addition of * multiple junctions. Before the first of these calls, the m_ matrix * should be set to the coreStencil_. */ -void MeshCompt::extendStencil( - const ChemCompt* other, const vector< VoxelJunction >& vj ) +void MeshCompt::extendStencil( + const ChemCompt* other, const vector< VoxelJunction >& vj ) { // Maps from remote meshIndex (in vj) to local index of proxy voxel. map< unsigned int, unsigned int > meshMap; map< unsigned int, unsigned int >::iterator mmi; - + // Maps from local index of proxy voxel back to remote meshIndex. vector< unsigned int > meshBackMap; @@ -136,7 +136,7 @@ void MeshCompt::extendStencil( /// Organizes vj by voxel, that is, by row. vector< vector< VoxelJunction > > vvj( coreSize ); - for ( vector< VoxelJunction >::const_iterator + for ( vector< VoxelJunction >::const_iterator i = vj.begin(); i != vj.end(); ++i ) { mmi = meshMap.find( i->second ); if ( mmi == meshMap.end() ) { @@ -170,7 +170,7 @@ void MeshCompt::extendStencil( assert( row == i ); unsigned int col = meshMap[j->second]; assert( col >= oldSize ); - temp.push_back( + temp.push_back( VoxelJunction( col, EMPTY, j->diffScale ) ); vvjCol[col].push_back( VoxelJunction( row, EMPTY, j->diffScale ) ); @@ -195,7 +195,7 @@ void MeshCompt::extendStencil( } // Fill in the volumes of the external mesh entries - for ( vector< unsigned int>::const_iterator + for ( vector< unsigned int>::const_iterator i = meshBackMap.begin(); i != meshBackMap.end(); ++i ) { extendedMeshEntryVolume_.push_back( other->getMeshEntryVolume( *i ) ); } diff --git a/moose-core/mesh/MeshCompt.h b/moose-core/mesh/MeshCompt.h index be374525e846315496c4e6a6f015807f8576a72a..12f1f431508c5e8e8b6afb89ffd1fa23e103a03a 100644 --- a/moose-core/mesh/MeshCompt.h +++ b/moose-core/mesh/MeshCompt.h @@ -19,7 +19,7 @@ */ class MeshCompt: public ChemCompt { - public: + public: MeshCompt(); ~MeshCompt(); @@ -37,7 +37,7 @@ class MeshCompt: public ChemCompt void innerResetStencil(); /// Derived function to return SparseMatrix-style row info for - /// specified mesh entry. + /// specified mesh entry. unsigned int getStencilRow( unsigned int meshIndex, const double** entry, const unsigned int** colIndex ) const; @@ -48,7 +48,7 @@ class MeshCompt: public ChemCompt vector< unsigned int > getNeighbors( unsigned int fid ) const; /** - * Looks up stencil to return vector of diffusion coupling to + * Looks up stencil to return vector of diffusion coupling to * neighbor voxels. */ vector< double > innerGetStencilRate( unsigned int row ) const; @@ -71,13 +71,13 @@ class MeshCompt: public ChemCompt private: /// Handles the core stencil for own vol - SparseMatrix< double > coreStencil_; + SparseMatrix< double > coreStencil_; /// Handles stencil for core + abutting voxels - SparseMatrix< double > m_; + SparseMatrix< double > m_; /** - * vector of meshEntryVolumes for abutting surfaces, + * vector of meshEntryVolumes for abutting surfaces, * needed to compute * diffusion rates across junctions. * Indexed from zero. @@ -85,9 +85,9 @@ class MeshCompt: public ChemCompt vector< double > extendedMeshEntryVolume_; }; -// Helper class for setting up and sorting rows of matrix entries. +// Helper class for setting up and sorting rows of matrix entries. class Ecol { - public: + public: Ecol( double e, unsigned int col ) : e_( e ), col_( col ) {;} @@ -95,7 +95,7 @@ class Ecol { Ecol() : e_( 0 ), col_( 0 ) {;} - + bool operator<( const Ecol& other ) const { return col_ < other.col_; diff --git a/moose-core/mesh/MeshEntry.cpp b/moose-core/mesh/MeshEntry.cpp index e1b369e6fcdeda4401df52e99437f1e5df8fe967..88d95b7518d7f91cc2e777bf0c05a59a9e3aca23 100644 --- a/moose-core/mesh/MeshEntry.cpp +++ b/moose-core/mesh/MeshEntry.cpp @@ -23,7 +23,7 @@ static SrcFinfo5< double, unsigned int, unsigned int, vector< unsigned int>, vec "memory allocation accordingly." "Arguments are: oldvol, numTotalEntries, startEntry, localIndices, vols" "The vols specifies volumes of each local mesh entry. It also specifies" - "how many meshEntries are present on the local node." + "how many meshEntries are present on the local node." "The localIndices vector is used for general load balancing only." "It has a list of the all meshEntries on current node." "If it is empty, we assume block load balancing. In this second" @@ -55,14 +55,14 @@ const Cinfo* MeshEntry::initCinfo() &MeshEntry::getVolume ); - static ReadOnlyElementValueFinfo< MeshEntry, unsigned int > + static ReadOnlyElementValueFinfo< MeshEntry, unsigned int > dimensions ( "dimensions", "number of dimensions of this MeshEntry", &MeshEntry::getDimensions ); - static ReadOnlyElementValueFinfo< MeshEntry, unsigned int > + static ReadOnlyElementValueFinfo< MeshEntry, unsigned int > meshType( "meshType", " The MeshType defines the shape of the mesh entry." @@ -154,7 +154,7 @@ const Cinfo* MeshEntry::initCinfo() remeshReacsOut(), // SrcFinfo }; - static string doc[] = + static string doc[] = { "Name", "MeshEntry", "Author", "Upi Bhalla", @@ -265,12 +265,12 @@ vector< double >MeshEntry::getDiffusionScaling( const Eref& e ) const // Utility function to pass on mesh changes ////////////////////////////////////////////////////////////// void MeshEntry::triggerRemesh( const Eref& e, - double oldvol, + double oldvol, unsigned int startEntry, const vector< unsigned int >& localIndices, const vector< double >& vols ) { // cout << "MeshEntry::triggerRemesh on " << e.element()->getName() << endl; - remeshOut()->send( e, oldvol, parent_->getNumEntries(), + remeshOut()->send( e, oldvol, parent_->getNumEntries(), startEntry, localIndices, vols ); remeshReacsOut()->send( e ); } diff --git a/moose-core/mesh/MeshEntry.h b/moose-core/mesh/MeshEntry.h index 85f469e305ddae293e58c7651184d4a07ccea6e5..9737ead2d72e9a5b6b9c5a382bd68ae232d88ad9 100644 --- a/moose-core/mesh/MeshEntry.h +++ b/moose-core/mesh/MeshEntry.h @@ -15,8 +15,8 @@ * the system */ enum MeshType { - BAD, - CUBOID, + BAD, + CUBOID, CYL, CYL_SHELL, CYL_SHELL_SEG, SPHERE, SPHERE_SHELL, SPHERE_SHELL_SEG, TETRAHEDRON, DISK @@ -32,7 +32,7 @@ class ChemCompt; */ class MeshEntry { - public: + public: MeshEntry(); MeshEntry( const ChemCompt* parent ); ////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ class MeshEntry ////////////////////////////////////////////////////////////////// // volume of this MeshEntry - double getVolume( const Eref& e ) const; + double getVolume( const Eref& e ) const; /** * returns number of dimension @@ -62,7 +62,7 @@ class MeshEntry unsigned int getMeshType( const Eref& e ) const; /** - * Coords that define current MeshEntry. Usually generated on + * Coords that define current MeshEntry. Usually generated on * the fly by passing the current Field Index to the parent * ChemCompt subclass, which will figure it out. */ @@ -84,11 +84,11 @@ class MeshEntry vector< double > getDiffusionScaling( const Eref& e) const; /* - /// Coords that define current MeshEntry. Usually generated on + /// Coords that define current MeshEntry. Usually generated on /// the fly. vector< double > coordinates() const; - /// Indices of other Entries that this one connects to, for + /// Indices of other Entries that this one connects to, for /// diffusion vector< unsigned int > connected() const; @@ -112,7 +112,7 @@ class MeshEntry ////////////////////////////////////////////////////////////////// void triggerRemesh( const Eref& e, double oldvol, - unsigned int startEntry, + unsigned int startEntry, const vector< unsigned int >& localIndices, const vector< double >& vols ); diff --git a/moose-core/mesh/NeuroMesh.h b/moose-core/mesh/NeuroMesh.h index 630a5a507d88b1d73db724597b9bc772473b2b5e..f46b34787da57537d9a70ab48bab9b6ca26672f7 100644 --- a/moose-core/mesh/NeuroMesh.h +++ b/moose-core/mesh/NeuroMesh.h @@ -25,12 +25,12 @@ * which duplicate the same reactions, but does not diffuse to other * spine heads. * Instead it has an effective diffusion constant to the parent - * dendrite compartment, obtained by treating the spine neck as a + * dendrite compartment, obtained by treating the spine neck as a * diffusion barrier with zero volume. */ class NeuroMesh: public MeshCompt { - public: + public: NeuroMesh(); NeuroMesh( const NeuroMesh& other ); ~NeuroMesh(); @@ -49,13 +49,13 @@ class NeuroMesh: public MeshCompt // Field assignment stuff ////////////////////////////////////////////////////////////////// - /** + /** * This overloaded function sets up a presumed contiguous set of - * compartments, complains if they are not contiguous due to the + * compartments, complains if they are not contiguous due to the * check in NeuroNode::traverse. - * - * The 'path' argument specifies a wildcard list of compartments, - * which can be also a comma-separated explicit list. Does not + * + * The 'path' argument specifies a wildcard list of compartments, + * which can be also a comma-separated explicit list. Does not * have to be in any particular order. */ void setSubTreePath( const Eref& e, string path ); @@ -138,7 +138,7 @@ class NeuroMesh: public MeshCompt void innerSetNumEntries( unsigned int n ); /** - * Inherited virtual func. Returns volume of soma and whole + * Inherited virtual func. Returns volume of soma and whole * dendritic tree of neuron, excluding spines. Any axonal * compartments are also included. */ @@ -150,11 +150,11 @@ class NeuroMesh: public MeshCompt * The length and diameter of each compartment are scaled by * the same factor = volscale^(1/3) * The rescaling carries through to the spines and PSDs, which - * are also updated. They are not permitted to + * are also updated. They are not permitted to * change their own volumes. */ bool vSetVolumeNotRates( double volume ); - + ////////////////////////////////////////////////////////////////// // Dest funcs ////////////////////////////////////////////////////////////////// @@ -170,7 +170,7 @@ class NeuroMesh: public MeshCompt ); void innerHandleNodeInfo( - const Eref& e, + const Eref& e, unsigned int numNodes, unsigned int numThreads ); // void transmitChange( const Eref& e, double oldVol ); @@ -188,14 +188,14 @@ class NeuroMesh: public MeshCompt ////////////////////////////////////////////////////////////////// // inherited virtual funcs for Boundary ////////////////////////////////////////////////////////////////// - - void matchMeshEntries( const ChemCompt* other, + + void matchMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - void matchCubeMeshEntries( const ChemCompt* other, + void matchCubeMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - void matchNeuroMeshEntries( const ChemCompt* other, + void matchNeuroMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; /** @@ -206,12 +206,12 @@ class NeuroMesh: public MeshCompt * Doesn't worry about whether this distance is inside or outside * cell. */ - double nearest( double x, double y, double z, + double nearest( double x, double y, double z, unsigned int& index ) const; - - void indexToSpace( unsigned int index, + + void indexToSpace( unsigned int index, double& x, double& y, double& z ) const; - + ////////////////////////////////////////////////////////////////// // Utility functions for building tree. @@ -246,8 +246,8 @@ class NeuroMesh: public MeshCompt * The first two are classified into the shaft_ vector. */ bool filterSpines( Id compt ); - /** - * converts the parents_ vector from identifying the parent + /** + * converts the parents_ vector from identifying the parent * NeuroNode to identifying the parent voxel, for each shaft entry. */ void updateShaftParents(); @@ -287,7 +287,7 @@ class NeuroMesh: public MeshCompt vector< unsigned int > nodeIndex_; /** - * Volscale pre-calculations for each MeshEntry. + * Volscale pre-calculations for each MeshEntry. * vs = #molecules / vol * where vol is expressed in m^3. */ @@ -298,7 +298,7 @@ class NeuroMesh: public MeshCompt * This is the cross-section area of the middle of each voxel. */ vector< double > area_; - + /// Pre-calculation of length of each MeshEntry vector< double > length_; @@ -311,13 +311,13 @@ class NeuroMesh: public MeshCompt * been created, and a spineList message sent from the NeuroMesh * to the SpineMesh. */ - bool separateSpines_; + bool separateSpines_; string geometryPolicy_; /** * Decides how finely to subdivide diffLength_ or radius or cubic - * mesh side when computing surfacearea of intersections with + * mesh side when computing surfacearea of intersections with * CubeMesh. Defaults to 0.1. */ double surfaceGranularity_; @@ -330,10 +330,10 @@ class NeuroMesh: public MeshCompt vector< Id > head_; /// Id of head compartment vector< unsigned int > parent_; /// Index of parent voxel of spines /** - * Index of parent voxel of each voxel. The root voxel has a + * Index of parent voxel of each voxel. The root voxel has a * parent of -1. */ - vector< unsigned int > parentVoxel_; + vector< unsigned int > parentVoxel_; }; diff --git a/moose-core/mesh/NeuroNode.cpp b/moose-core/mesh/NeuroNode.cpp index eb07154e0de804d80cb5ed12c74814b938f94247..6afac30e72f6d9ee32f9dc000c3f3a6a94db4e04 100644 --- a/moose-core/mesh/NeuroNode.cpp +++ b/moose-core/mesh/NeuroNode.cpp @@ -25,12 +25,12 @@ * neuron. */ -NeuroNode::NeuroNode( const CylBase& cb, +NeuroNode::NeuroNode( const CylBase& cb, unsigned int parent, const vector< unsigned int >& children, unsigned int startFid, Id elecCompt, bool isSphere ) : - CylBase( cb ), + CylBase( cb ), parent_( parent ), children_( children ), startFid_( startFid ), @@ -136,7 +136,7 @@ static void bruteForceFind( const vector< NeuroNode >& nodes, Id id ) { for ( unsigned int i = 0; i < nodes.size(); ++i ) { if ( nodes[i].elecCompt() == id ) { - cout << "bruteForceFind: nodes[" << i << "] has " << + cout << "bruteForceFind: nodes[" << i << "] has " << id.path() << endl; } } @@ -195,7 +195,7 @@ static vector< Id > findAllConnectedCompartments( Id compt ) * the 'children' vector even if they may be 'parent' by the messaging. * This is because this function has to be robust enough to sort this out */ -void NeuroNode::findConnectedCompartments( +void NeuroNode::findConnectedCompartments( const map< Id, unsigned int >& nodeMap, const vector< NeuroNode >& nodes ) { @@ -224,7 +224,7 @@ void NeuroNode::findConnectedCompartments( * * static func */ -unsigned int NeuroNode::removeDisconnectedNodes( +unsigned int NeuroNode::removeDisconnectedNodes( vector< NeuroNode >& nodes ) { vector< NeuroNode > temp; @@ -242,7 +242,7 @@ unsigned int NeuroNode::removeDisconnectedNodes( } for ( unsigned int i = 0; i < temp.size(); ++i ) { vector< unsigned int >& c = temp[i].children_; - for ( vector< unsigned int >::iterator + for ( vector< unsigned int >::iterator j = c.begin(); j != c.end(); ++j ) { assert( nodeMap[ *j ] != ~0U ); *j = nodeMap[ *j ]; @@ -292,10 +292,10 @@ unsigned int NeuroNode::findStartNode( const vector< NeuroNode >& nodes ) return somaIndex; } -/** +/** * static func */ -void diagnoseTree( const vector< NeuroNode >& tree, +void diagnoseTree( const vector< NeuroNode >& tree, const vector< NeuroNode >& nodes ) { map< Id , const NeuroNode* > m; @@ -310,7 +310,7 @@ void diagnoseTree( const vector< NeuroNode >& tree, Id pa; if ( i->parent() != ~0U && i->parent() < nodes.size() ) pa = nodes[ i->parent() ].elecCompt(); - cout << "diagnoseTree:" << j++ << " " << i->elecCompt().path() << + cout << "diagnoseTree:" << j++ << " " << i->elecCompt().path() << ", pa = " << i->parent() << ", " << pa.path() << endl; } } @@ -318,7 +318,7 @@ void diagnoseTree( const vector< NeuroNode >& tree, /** * Traverses the nodes list starting from the 'start' node, and sets up - * correct parent-child information. This involves removing the + * correct parent-child information. This involves removing the * identified 'parent' node from the 'children_' vector and assigning it * to the parent_ field. * Then it redoes the entire nodes vector (with due care for indexing of @@ -348,16 +348,16 @@ void NeuroNode::traverse( vector< NeuroNode >& nodes, unsigned int start ) nodes = tree; } -void NeuroNode::innerTraverse( - vector< NeuroNode >& tree, +void NeuroNode::innerTraverse( + vector< NeuroNode >& tree, const vector< NeuroNode >& nodes, - vector< unsigned int >& seen + vector< unsigned int >& seen ) const { unsigned int pa = tree.size() - 1; tree.back().children_.clear(); - for ( vector< unsigned int >::const_iterator i = + for ( vector< unsigned int >::const_iterator i = children_.begin(); i != children_.end(); ++i ) { assert( *i < nodes.size() ); @@ -378,7 +378,7 @@ bool isPartOfDend( ObjId i ) if ( i.element()->cinfo()->isA( "CompartmentBase" ) ) { string name = i.element()->getName(); if ( name.find( "shaft" ) == string::npos && - name.find( "neck" ) == string::npos && + name.find( "neck" ) == string::npos && name.find( "spine" ) == string::npos && name.find( "head" ) == string::npos ) { @@ -399,7 +399,7 @@ static bool checkForSpine( unsigned int dendIndex, Id compt, shaftId.push_back( compt ); vector< Id > conn = findAllConnectedCompartments( compt ); bool foundHead = false; - for ( vector< Id >::iterator i = + for ( vector< Id >::iterator i = conn.begin(); i != conn.end(); ++i ) { const string& n2 = i->element()->getName(); if ( n2.find( "spine" ) != string::npos || @@ -418,7 +418,7 @@ static bool checkForSpine( unsigned int dendIndex, Id compt, } /** - * spinyTraverse goes takes current dend entry and finds everything + * spinyTraverse goes takes current dend entry and finds everything * connected to it, recursively. Paints the 'seen' entries with the * latest index for the number seen so we keep track of which subgroup * the dend set belongs to. @@ -426,7 +426,7 @@ static bool checkForSpine( unsigned int dendIndex, Id compt, * on every dend compt found. * */ -static void spinyTraverse( unsigned int dendIndex, +static void spinyTraverse( unsigned int dendIndex, vector< Id >& dend, const map< Id, unsigned int >& dendMap, vector< int >& seen, unsigned int numSeen, vector< Id >& shaftId, vector< Id >& headId, @@ -436,12 +436,12 @@ static void spinyTraverse( unsigned int dendIndex, vector< Id > conn = findAllConnectedCompartments( dend[dendIndex] ); seen[ dendIndex ] = numSeen; for ( vector< Id >::iterator i = conn.begin(); i != conn.end(); ++i ) { - map< Id, unsigned int >::const_iterator idLookup = + map< Id, unsigned int >::const_iterator idLookup = dendMap.find( *i ); if ( idLookup != dendMap.end() ) { if ( !seen[ idLookup->second ] ) { dendParent[ idLookup->second ] = dendIndex; - spinyTraverse( idLookup->second, dend, dendMap, + spinyTraverse( idLookup->second, dend, dendMap, seen, numSeen, shaftId, headId, dendParent, spineParent ); } @@ -453,17 +453,17 @@ static void spinyTraverse( unsigned int dendIndex, /** * This function takes a list of elements and builds a tree. - * Info on any attached spines are placed in the + * Info on any attached spines are placed in the * shaft_, head_, and parent_ vectors. * The list of elements can be discontiguous. * This is meant to be insensitive to vagaries - * in how the user has set up the compartment messaging, provided that + * in how the user has set up the compartment messaging, provided that * there is at least one recognized message between connected compartments. * * static function. */ -void NeuroNode::buildSpinyTree( - vector< ObjId >& elist, vector< NeuroNode >& nodes, +void NeuroNode::buildSpinyTree( + vector< ObjId >& elist, vector< NeuroNode >& nodes, vector< Id >& shaftId, vector< Id >& headId, vector< unsigned int >& spineParent ) { @@ -471,7 +471,7 @@ void NeuroNode::buildSpinyTree( sort( elist.begin(), elist.end() ); map< Id, unsigned int > dendMap; vector< Id > dend; - for ( vector< ObjId >::iterator + for ( vector< ObjId >::iterator i = elist.begin(); i != elist.end(); ++i ) { if ( isPartOfDend( *i ) ) { dendMap[ *i ] = dend.size(); @@ -483,8 +483,8 @@ void NeuroNode::buildSpinyTree( int numSeen = 0; for ( unsigned int i = 0; i < dend.size(); ++i ) { if ( !seen[i] ) - spinyTraverse( i, dend, dendMap, seen, ++numSeen, - shaftId, headId, + spinyTraverse( i, dend, dendMap, seen, ++numSeen, + shaftId, headId, dendParent, spineParent ); } if ( numSeen == 0 ) @@ -515,20 +515,20 @@ void NeuroNode::setParentAndChildren( unsigned int index, int dendParent, /** * This function takes a list of elements that include connected - * compartments, and constructs a tree of nodes out of them. The + * compartments, and constructs a tree of nodes out of them. The * generated nodes vector starts with the soma, and is a depth-first * sequence of nodes. This is meant to be insensitive to vagaries - * in how the user has set up the compartment messaging, provided that + * in how the user has set up the compartment messaging, provided that * there is at least one recognized message between connected compartments. * * static function. */ -void NeuroNode::buildTree( +void NeuroNode::buildTree( vector< NeuroNode >& nodes, vector< ObjId > elist ) { nodes.clear(); map< Id, unsigned int > nodeMap; - for ( vector< ObjId >::iterator + for ( vector< ObjId >::iterator i = elist.begin(); i != elist.end(); ++i ) { if ( i->element()->cinfo()->isA( "CompartmentBase" ) ) nodes.push_back( NeuroNode( *i ) ); @@ -556,10 +556,10 @@ void NeuroNode::buildTree( } // Utility function to clean up node indices for parents and children. -void reassignNodeIndices( vector< NeuroNode >& temp, +void reassignNodeIndices( vector< NeuroNode >& temp, const vector< unsigned int >& nodeToTempMap ) { - for ( vector< NeuroNode >::iterator + for ( vector< NeuroNode >::iterator i = temp.begin(); i != temp.end(); ++i ) { unsigned int pa = i->parent(); if ( pa != ~0U ) { @@ -580,12 +580,12 @@ void reassignNodeIndices( vector< NeuroNode >& temp, /** * Trims off all spines from tree. Does so by identifying a set of * reasonable names: shaft, head, spine, and variants in capitals. - * Having done this it builds two matching vectors of vector of shafts + * Having done this it builds two matching vectors of vector of shafts * and heads, which is a hack that assumes that there are no sub-branches * in spines. Then there is an index for parent NeuroNode entry. * Static function */ -void NeuroNode::filterSpines( vector< NeuroNode >& nodes, +void NeuroNode::filterSpines( vector< NeuroNode >& nodes, vector< Id >& shaftId, vector< Id >& headId, vector< unsigned int >& parent ) { diff --git a/moose-core/mesh/NeuroNode.h b/moose-core/mesh/NeuroNode.h index a2ab62d1fd15aa78d8f186b5bdd970d2f2268810..bb6b5aace1df1c705203947577433e5115be34e6 100644 --- a/moose-core/mesh/NeuroNode.h +++ b/moose-core/mesh/NeuroNode.h @@ -21,7 +21,7 @@ class NeuroNode: public CylBase /** * This function explicitly fills in all fields of the NeuroNode */ - NeuroNode( const CylBase& cb, + NeuroNode( const CylBase& cb, unsigned int parent, const vector< unsigned int >& children, unsigned int startFid_, Id elecCompt, bool isSphere ); @@ -43,8 +43,8 @@ class NeuroNode: public CylBase /** * True when this is a dummy node to represent the coordinates * of the start end of a compartment. For example, the start coords - * of a compartment - * sitting on a spherical soma, or the start coords of a spine neck + * of a compartment + * sitting on a spherical soma, or the start coords of a spine neck * along a longer dendritic compartment. * In all other cases the start coordinates are just those of the * end of the parent compartment. @@ -90,12 +90,12 @@ class NeuroNode: public CylBase // when given a badly set up neuron. ////////////////////////////////////////////////////////////// /** - * Finds all the compartments connected to current node, put them + * Finds all the compartments connected to current node, put them * all into the 'children' vector even if they may be 'parent' by * the messaging. This is because this function has to be robust * enough to sort this out */ - void findConnectedCompartments( + void findConnectedCompartments( const map< Id, unsigned int >& nodeMap, const vector< NeuroNode >& nodes ); @@ -104,97 +104,97 @@ class NeuroNode: public CylBase * children, that is, are not connected to any others. * Need to clean up 'children_' list after this is called. */ - static unsigned int removeDisconnectedNodes( + static unsigned int removeDisconnectedNodes( vector< NeuroNode >& nodes ); /** * Find the start node, typically the soma, of a model. In terms of * the solution, this should be the node at the root of the tree. * Returns index in nodes vector. - * Technically the matrix solution could begin from any terminal + * Technically the matrix solution could begin from any terminal * branch, but it helps to keep the soma identical to the root of * the tree. * - * Uses two heuristics to locate the start node: Looks for the - * node with the largest diameter, and also looks for node(s) - * with 'soma' in their name. If these disagree then it goes + * Uses two heuristics to locate the start node: Looks for the + * node with the largest diameter, and also looks for node(s) + * with 'soma' in their name. If these disagree then it goes * with the 'soma' node. If there are * many of the soma nodes, it goes with the fattest. */ - static unsigned int findStartNode( + static unsigned int findStartNode( const vector< NeuroNode >& nodes ); /** - * Traverses the nodes list starting from the 'start' node, and + * Traverses the nodes list starting from the 'start' node, and * sets up correct parent-child information. This involves removing - * the identified 'parent' node from the 'children_' vector and + * the identified 'parent' node from the 'children_' vector and * assigning it to the parent_ field. - * Then it redoes the entire nodes vector (with due care for + * Then it redoes the entire nodes vector (with due care for * indexing of children and parents) * so that it is in the correct order for a depth-first traversal. - * This means that you can take any entry in the list, and the - * immediately following entries will be all the descendants, + * This means that you can take any entry in the list, and the + * immediately following entries will be all the descendants, * if any. */ - static void traverse( + static void traverse( vector< NeuroNode >& nodes, unsigned int start ); /** * Helper recursive function for traversing nodes to build tree. */ - void innerTraverse( - vector< NeuroNode >& tree, + void innerTraverse( + vector< NeuroNode >& tree, const vector< NeuroNode >& nodes, vector< unsigned int >& seen ) const; /** * This function takes a list of elements that include connected - * compartments, and constructs a tree of nodes out of them. The + * compartments, and constructs a tree of nodes out of them. The * generated nodes vector starts with the soma, and is a depth-first * sequence of nodes. This is meant to be insensitive to vagaries - * in how the user has set up the compartment messaging, provided - * that there is at least one recognized message between connected + * in how the user has set up the compartment messaging, provided + * that there is at least one recognized message between connected * compartments. */ - static void buildTree( vector< NeuroNode >& nodes, + static void buildTree( vector< NeuroNode >& nodes, vector< ObjId > elist ); - static void buildSpinyTree( + static void buildSpinyTree( vector< ObjId >& elist, vector< NeuroNode >& nodes, vector< Id >& shaftId, vector< Id >& headId, vector< unsigned int >& spineParent ); void setParentAndChildren( unsigned int index, int dendParent, - vector< NeuroNode >& nodes, + vector< NeuroNode >& nodes, const map< Id, unsigned int >& dendMap ); /** * Trims off all spines from tree. Does so by identifying a set of * reasonable names: shaft, head, spine, and variants in capitals. - * Having done this it builds two matching vectors of vector of - * shafts and heads, which is a hack that assumes that there are + * Having done this it builds two matching vectors of vector of + * shafts and heads, which is a hack that assumes that there are * no sub-branches in spines. * The returned nodes vector has non spine/shaft compartments only. * The returned shaftId vector has all the shaft compartments. * The returned headId vector has all the shaft compartments. * The returned parent vector has the indices of the parent * node for each shaft. - * There should be exactly the same number of entries in the + * There should be exactly the same number of entries in the * shaftId, headId and parent vectors. */ - static void filterSpines( vector< NeuroNode >& nodes, + static void filterSpines( vector< NeuroNode >& nodes, vector< Id >& shaftId, vector< Id >& headId, vector< unsigned int >& parent ); private: /** - * Index of parent NeuroNode, typically a diffusive compartment. - * In the special case where the junction to the parent electrical + * Index of parent NeuroNode, typically a diffusive compartment. + * In the special case where the junction to the parent electrical * compartment is NOT at the end of the parent compartment, this * refers instead to a dummy NeuroNode which has the coordinates. * * One of the nodes, typically the soma, will have no parent. * This is indicated by the value ~0U. */ - unsigned int parent_; + unsigned int parent_; /** * Index of children of this NeuroNode. @@ -209,7 +209,7 @@ class NeuroNode: public CylBase /// Id of electrical compartment in which this diffusive compt lives - Id elecCompt_; + Id elecCompt_; /** * Special case for soma, perhaps for spine heads. @@ -218,7 +218,7 @@ class NeuroNode: public CylBase bool isSphere_; // For spines we will also need a double to indicate position along - // parent dendrite. + // parent dendrite. // }; diff --git a/moose-core/mesh/PsdMesh.cpp b/moose-core/mesh/PsdMesh.cpp index 95ead8fdd5ea2fcda86c3cf9f0488bb2e5d18754..da23aebbf6f3a23a930077aff6f8175a767ea2f1 100644 --- a/moose-core/mesh/PsdMesh.cpp +++ b/moose-core/mesh/PsdMesh.cpp @@ -40,7 +40,7 @@ const Cinfo* PsdMesh::initCinfo() ); static ReadOnlyValueFinfo< PsdMesh, vector< unsigned int > > - neuronVoxel + neuronVoxel ( "neuronVoxel", "Vector of indices of voxels on parent NeuroMesh, from which " @@ -153,7 +153,7 @@ PsdMesh::PsdMesh() } PsdMesh::PsdMesh( const PsdMesh& other ) - : + : psd_( other.psd_ ), surfaceGranularity_( other.surfaceGranularity_ ) {;} @@ -195,7 +195,7 @@ vector< Id > PsdMesh::getElecComptMap() const vector< unsigned int > PsdMesh::getStartVoxelInCompt() const { vector< unsigned int > ret( elecCompt_.size() ); - for ( unsigned int i = 0; i < ret.size(); ++i ) + for ( unsigned int i = 0; i < ret.size(); ++i ) ret[i] = i; return ret; } @@ -203,7 +203,7 @@ vector< unsigned int > PsdMesh::getStartVoxelInCompt() const vector< unsigned int > PsdMesh::getEndVoxelInCompt() const { vector< unsigned int > ret( elecCompt_.size() ); - for ( unsigned int i = 0; i < ret.size(); ++i ) + for ( unsigned int i = 0; i < ret.size(); ++i ) ret[i] = i+1; return ret; } @@ -224,7 +224,7 @@ unsigned int PsdMesh::innerGetDimensions() const } // Here we set up the psds. -void PsdMesh::handlePsdList( +void PsdMesh::handlePsdList( const Eref& e, vector< double > diskCoords, //ctr(xyz), dir(xyz), dia, diffDist // The elecCompt refers to the spine head elec compartment. @@ -260,7 +260,7 @@ void PsdMesh::handlePsdList( psd_.back().setIsCylinder( true ); // This is an entirely nominal // length, so that the effective vol != 0. - psd_.back().setLength( thickness_ ); + psd_.back().setLength( thickness_ ); parentDist_.push_back( *x++ ); vs_[i] = psd_.back().volume( psd_.back() ); @@ -272,7 +272,7 @@ void PsdMesh::handlePsdList( updateCoords(); Id meshEntry( e.id().value() + 1 ); - + vector< unsigned int > localIndices( psd_.size() ); vector< double > vols( psd_.size() ); for ( unsigned int i = 0; i < psd_.size(); ++i ) { @@ -462,7 +462,7 @@ void PsdMesh::matchMeshEntries( const ChemCompt* other, } void PsdMesh::indexToSpace( unsigned int index, - double& x, double& y, double& z ) const + double& x, double& y, double& z ) const { if ( index >= innerGetNumEntries() ) return; @@ -471,7 +471,7 @@ void PsdMesh::indexToSpace( unsigned int index, z = psd_[index].getZ(); } -double PsdMesh::nearest( double x, double y, double z, +double PsdMesh::nearest( double x, double y, double z, unsigned int& index ) const { double best = 1e12; @@ -555,7 +555,7 @@ const vector< double >& PsdMesh::vGetVoxelVolume() const * The order of coords sent in is * centre xyz * direction xyz - * dia, + * dia, * diffusion distance to middle of spine Head. */ const vector< double >& PsdMesh::vGetVoxelMidpoint() const @@ -564,7 +564,7 @@ const vector< double >& PsdMesh::vGetVoxelMidpoint() const midpoint.resize( psd_.size() * 3 ); vector< double >::iterator k = midpoint.begin(); for ( unsigned int i = 0; i < psd_.size(); ++i ) { - vector< double > coords = + vector< double > coords = psd_[i].getCoordinates( pa_[i], 0 ); *k = ( coords[0] + coords[3] ) / 2.0; *(k + psd_.size() ) = ( coords[1] + coords[4] ) / 2.0; @@ -588,7 +588,7 @@ const vector< double >& PsdMesh::getVoxelLength() const double PsdMesh::vGetEntireVolume() const { double ret = 0.0; - for ( vector< double >::const_iterator i = + for ( vector< double >::const_iterator i = vs_.begin(); i != vs_.end(); ++i ) ret += *i; return ret; diff --git a/moose-core/mesh/PsdMesh.h b/moose-core/mesh/PsdMesh.h index 82c11e34b5e6cd53b5863c3d496e79608e4b1069..78a0bcbd99709266a73355300987c1b0e51a7f05 100644 --- a/moose-core/mesh/PsdMesh.h +++ b/moose-core/mesh/PsdMesh.h @@ -19,14 +19,14 @@ * do for now. Later can fine-tune the cap geometry. * * In either case, the PsdMesh is filled by a message that contains - * information about the matching voxel index (either on spineMesh or + * information about the matching voxel index (either on spineMesh or * NeuroMesh), the coordinates, the radial vector, and the diameter. * The PsdMesh does not have any internal diffusion, and it * expects to pass only N to the parent dendrite or spine. */ class PsdMesh: public MeshCompt { - public: + public: PsdMesh(); PsdMesh( const PsdMesh& other ); ~PsdMesh(); @@ -48,9 +48,9 @@ class PsdMesh: public MeshCompt ////////////////////////////////////////////////////////////////// // Field assignment stuff ////////////////////////////////////////////////////////////////// - /** + /** * An assumed thickness for PSD. The volume is computed as the - * PSD area passed in to each PSD, times this value. + * PSD area passed in to each PSD, times this value. * Defaults to 50 nanometres. For reference, membranes are 5 nm. */ double getThickness() const; @@ -95,7 +95,7 @@ class PsdMesh: public MeshCompt /// Returns # of dimensions, always 3 here. Inherited pure virt func unsigned int innerGetDimensions() const; - + vector< unsigned int > getParentVoxel() const; const vector< double >& vGetVoxelVolume() const; const vector< double >& vGetVoxelMidpoint() const; @@ -122,7 +122,7 @@ class PsdMesh: public MeshCompt ); void innerHandleNodeInfo( - const Eref& e, + const Eref& e, unsigned int numNodes, unsigned int numThreads ); void handlePsdList( @@ -138,17 +138,17 @@ class PsdMesh: public MeshCompt ////////////////////////////////////////////////////////////////// // inherited virtual funcs for Boundary ////////////////////////////////////////////////////////////////// - - void matchMeshEntries( const ChemCompt* other, + + void matchMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - void matchNeuroMeshEntries( const ChemCompt* other, + void matchNeuroMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - void matchCubeMeshEntries( const ChemCompt* other, + void matchCubeMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - void matchSpineMeshEntries( const ChemCompt* other, + void matchSpineMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; /** @@ -159,12 +159,12 @@ class PsdMesh: public MeshCompt * Doesn't worry about whether this distance is inside or outside * cell. */ - double nearest( double x, double y, double z, + double nearest( double x, double y, double z, unsigned int& index ) const; - - void indexToSpace( unsigned int index, + + void indexToSpace( unsigned int index, double& x, double& y, double& z ) const; - + ////////////////////////////////////////////////////////////////// static const Cinfo* initCinfo(); @@ -183,7 +183,7 @@ class PsdMesh: public MeshCompt /** * Decides how finely to subdivide diffLength_ or radius or cubic - * mesh side when computing surfacearea of intersections with + * mesh side when computing surfacearea of intersections with * CubeMesh. Defaults to 0.1. */ double surfaceGranularity_; diff --git a/moose-core/mesh/SpineEntry.cpp b/moose-core/mesh/SpineEntry.cpp index dbc663bab3ca12fa10dfaded0a5b1a3a8f5221ed..c2d01652a737dfd5ea4d923cf31902081cab710a 100644 --- a/moose-core/mesh/SpineEntry.cpp +++ b/moose-core/mesh/SpineEntry.cpp @@ -143,7 +143,7 @@ double SpineEntry::volume() const } void SpineEntry::matchCubeMeshEntriesToHead( const ChemCompt* compt, - unsigned int myIndex, + unsigned int myIndex, double granularity, vector< VoxelJunction >& ret ) const { head_.matchCubeMeshEntries( compt, shaft_, myIndex, @@ -160,11 +160,11 @@ void SpineEntry::matchCubeMeshEntriesToPSD( const ChemCompt* compt, } /** - * Find the matching NeuroMesh entry index to the + * Find the matching NeuroMesh entry index to the * root of the shaft of this spine. Also compute the area and * diffusion length of the shaft. */ -unsigned int SpineEntry::matchNeuroMeshEntriesToShaft( +unsigned int SpineEntry::matchNeuroMeshEntriesToShaft( const ChemCompt* compt, unsigned int myIndex, double& area, double& length ) const { diff --git a/moose-core/mesh/SpineEntry.h b/moose-core/mesh/SpineEntry.h index b1d77e8fed0f0aac7af667ff0297b5a7f0db069a..82dc3e334515f88e29fb79baefc7e6484d5a2481 100644 --- a/moose-core/mesh/SpineEntry.h +++ b/moose-core/mesh/SpineEntry.h @@ -53,7 +53,7 @@ class SpineEntry double granularity, vector< VoxelJunction >& ret ) const; /** - * Find the matching matching NeuroMesh entry index to the + * Find the matching matching NeuroMesh entry index to the * root of the shaft of this spine. Also compute the area and * diffusion length of the shaft. */ @@ -70,7 +70,7 @@ class SpineEntry /// Return coords of middle of PSD. void apex( double& x, double& y, double& z ) const; - void matchCubeMeshEntries( const ChemCompt* other, + void matchCubeMeshEntries( const ChemCompt* other, unsigned int myIndex, double granularity, vector< VoxelJunction >& ret ); @@ -82,7 +82,7 @@ class SpineEntry * Resizes SpineEntry. Takes original shaft base and scales up * from there. Retains original shaft dimensions, only the * head is scaled. - */ + */ void setVolume( double volume ); /** @@ -92,10 +92,10 @@ class SpineEntry /** * psdCoords is used to build the PsdMesh. The function returns 8 - * coords to define the psd: + * coords to define the psd: * centre xyz * direction xyz - * dia, + * dia, * diffusion distance to middle of spine Head. */ vector< double > psdCoords() const; @@ -107,11 +107,11 @@ class SpineEntry /** * Index of parent entry on NeuroMesh. */ - unsigned int parent_; + unsigned int parent_; /// Id of electrical compartment in which this diffusive compt lives - Id shaftId_; - Id headId_; + Id shaftId_; + Id headId_; }; #endif // _SPINE_ENTRY_H diff --git a/moose-core/mesh/SpineMesh.cpp b/moose-core/mesh/SpineMesh.cpp index 71f4f8f0ed2f08fd9c05a407d680b375f81571b3..a09c3ccde82a1c4121a65edafc3a58bc1c443695 100644 --- a/moose-core/mesh/SpineMesh.cpp +++ b/moose-core/mesh/SpineMesh.cpp @@ -27,7 +27,7 @@ #include "../utility/numutil.h" /* -static SrcFinfo3< Id, vector< double >, vector< unsigned int > >* +static SrcFinfo3< Id, vector< double >, vector< unsigned int > >* psdListOut() { static SrcFinfo3< Id, vector< double >, vector< unsigned int > > @@ -51,7 +51,7 @@ const Cinfo* SpineMesh::initCinfo() // Field Definitions ////////////////////////////////////////////////////////////// static ReadOnlyValueFinfo< SpineMesh, vector< unsigned int > > - parentVoxel + parentVoxel ( "parentVoxel", "Vector of indices of proximal voxels within this mesh." @@ -61,7 +61,7 @@ const Cinfo* SpineMesh::initCinfo() ); static ReadOnlyValueFinfo< SpineMesh, vector< unsigned int > > - neuronVoxel + neuronVoxel ( "neuronVoxel", "Vector of indices of voxels on parent NeuroMesh, from which " @@ -161,7 +161,7 @@ SpineMesh::SpineMesh() {;} SpineMesh::SpineMesh( const SpineMesh& other ) - : + : spines_( other.spines_ ), surfaceGranularity_( other.surfaceGranularity_ ) {;} @@ -185,7 +185,7 @@ SpineMesh::~SpineMesh() vector< unsigned int > SpineMesh::getParentVoxel() const { vector< unsigned int > ret( spines_.size(), -1U ); - // for ( unsigned int i = 0; i < spines_.size(); ++i ) + // for ( unsigned int i = 0; i < spines_.size(); ++i ) // ret[i] = spines_[i].parent(); // Wrong, returns voxel on NeuroMesh return ret; } @@ -196,7 +196,7 @@ vector< unsigned int > SpineMesh::getParentVoxel() const vector< unsigned int > SpineMesh::getNeuronVoxel() const { vector< unsigned int > ret( spines_.size(), -1U ); - for ( unsigned int i = 0; i < spines_.size(); ++i ) + for ( unsigned int i = 0; i < spines_.size(); ++i ) ret[i] = spines_[i].parent(); return ret; } @@ -204,7 +204,7 @@ vector< unsigned int > SpineMesh::getNeuronVoxel() const vector< Id > SpineMesh::getElecComptMap() const { vector< Id > ret( spines_.size() ); - for ( unsigned int i = 0; i < spines_.size(); ++i ) + for ( unsigned int i = 0; i < spines_.size(); ++i ) ret[i] = spines_[i].headId(); return ret; } @@ -212,7 +212,7 @@ vector< Id > SpineMesh::getElecComptMap() const vector< unsigned int > SpineMesh::getStartVoxelInCompt() const { vector< unsigned int > ret( spines_.size() ); - for ( unsigned int i = 0; i < ret.size(); ++i ) + for ( unsigned int i = 0; i < ret.size(); ++i ) ret[i] = i; return ret; } @@ -220,7 +220,7 @@ vector< unsigned int > SpineMesh::getStartVoxelInCompt() const vector< unsigned int > SpineMesh::getEndVoxelInCompt() const { vector< unsigned int > ret( spines_.size() ); - for ( unsigned int i = 0; i < ret.size(); ++i ) + for ( unsigned int i = 0; i < ret.size(); ++i ) ret[i] = i+1; return ret; } @@ -243,8 +243,8 @@ unsigned int SpineMesh::innerGetDimensions() const } // Here we set up the spines. We don't permit heads without shafts. -void SpineMesh::handleSpineList( - const Eref& e, vector< Id > shaft, vector< Id > head, +void SpineMesh::handleSpineList( + const Eref& e, vector< Id > shaft, vector< Id > head, vector< unsigned int > parentVoxel ) { double oldVol = getMeshEntryVolume( 0 ); @@ -271,7 +271,7 @@ void SpineMesh::handleSpineList( updateCoords(); Id meshEntry( e.id().value() + 1 ); - + vector< unsigned int > localIndices( head.size() ); vector< double > vols( head.size() ); for ( unsigned int i = 0; i < head.size(); ++i ) { @@ -311,7 +311,7 @@ double SpineMesh::getMeshEntryVolume( unsigned int fid ) const return spines_[ fid % spines_.size() ].volume(); } /// Virtual function to assign volume of mesh Entry. -void SpineMesh::setMeshEntryVolume( unsigned int fid, double volume ) +void SpineMesh::setMeshEntryVolume( unsigned int fid, double volume ) { if ( spines_.size() == 0 ) return; @@ -391,10 +391,10 @@ const vector< double >& SpineMesh::vGetVoxelMidpoint() const static vector< double > midpoint; midpoint.resize( spines_.size() * 3 ); for ( unsigned int i = 0; i < spines_.size(); ++i ) { - spines_[i].mid( midpoint[i], - midpoint[i + spines_.size() ], - midpoint[i + 2 * spines_.size() ] - ); + spines_[i].mid( midpoint[i], + midpoint[i + spines_.size() ], + midpoint[i + 2 * spines_.size() ] + ); } return midpoint; } @@ -412,7 +412,7 @@ const vector< double >& SpineMesh::getVoxelLength() const double SpineMesh::vGetEntireVolume() const { double ret = 0.0; - for ( vector< double >::const_iterator i = + for ( vector< double >::const_iterator i = vs_.begin(); i != vs_.end(); ++i ) ret += *i; return ret; @@ -505,14 +505,14 @@ void SpineMesh::matchMeshEntries( const ChemCompt* other, } void SpineMesh::indexToSpace( unsigned int index, - double& x, double& y, double& z ) const + double& x, double& y, double& z ) const { if ( index >= innerGetNumEntries() ) return; spines_[ index ].mid( x, y, z ); } -double SpineMesh::nearest( double x, double y, double z, +double SpineMesh::nearest( double x, double y, double z, unsigned int& index ) const { double best = 1e12; @@ -548,7 +548,7 @@ void SpineMesh::matchNeuroMeshEntries( const ChemCompt* other, double xda = spines_[i].rootArea() / spines_[i].diffusionLength(); ret.push_back( VoxelJunction( i, spines_[i].parent(), xda ) ); ret.back().firstVol = spines_[i].volume(); - ret.back().secondVol = + ret.back().secondVol = nm->getMeshEntryVolume( spines_[i].parent() ); } } diff --git a/moose-core/mesh/SpineMesh.h b/moose-core/mesh/SpineMesh.h index a89b8dd0e0929a27ad418ff80a298b3714c122b4..254e0276fa734ff5fdc3aa479bb09f0b6c6be59a 100644 --- a/moose-core/mesh/SpineMesh.h +++ b/moose-core/mesh/SpineMesh.h @@ -18,14 +18,14 @@ * The SpineMesh can further generate a PSD mesh with the info for the * PSD geometries. * This assumes that the each spine is a single voxel: single diffusive - * compartment, well-stirred. The shaft is treated as zero volume + * compartment, well-stirred. The shaft is treated as zero volume * diffusion barrier to the dendrite. * The PSD is a separate compt with its own diffusion coupling to the * spine head. */ class SpineMesh: public MeshCompt { - public: + public: SpineMesh(); SpineMesh( const SpineMesh& other ); ~SpineMesh(); @@ -44,22 +44,22 @@ class SpineMesh: public MeshCompt // Field assignment stuff ////////////////////////////////////////////////////////////////// /** - * This function returns the diffusively connected parent voxel - * within the current (spine) mesh. Since each spine is treated - * as an independed voxel, there is no such voxel, so we return - * -1U for each spine. Note that there is a separate function - * that returns the parentVoxel referred to the NeuroMesh that + * This function returns the diffusively connected parent voxel + * within the current (spine) mesh. Since each spine is treated + * as an independed voxel, there is no such voxel, so we return + * -1U for each spine. Note that there is a separate function + * that returns the parentVoxel referred to the NeuroMesh that * this spine sits on. */ vector< unsigned int > getParentVoxel() const; /** - * Returns index of voxel on NeuroMesh to which this spine is + * Returns index of voxel on NeuroMesh to which this spine is * connected. */ vector< unsigned int > getNeuronVoxel() const; /** - * Returns vector of Ids of electrical compts that map to + * Returns vector of Ids of electrical compts that map to * respective voxels in SpineMesh */ vector< Id > getElecComptMap() const; @@ -106,7 +106,7 @@ class SpineMesh: public MeshCompt /// Inherited virtual func bool vSetVolumeNotRates( double volume ); - + ////////////////////////////////////////////////////////////////// // Dest funcs ////////////////////////////////////////////////////////////////// @@ -124,12 +124,12 @@ class SpineMesh: public MeshCompt */ void innerHandleNodeInfo( - const Eref& e, + const Eref& e, unsigned int numNodes, unsigned int numThreads ); void handleSpineList( const Eref& e, - vector< Id > shaft, vector< Id > head, + vector< Id > shaft, vector< Id > head, vector< unsigned int > parentVoxel ); void transmitChange( const Eref& e ); @@ -139,17 +139,17 @@ class SpineMesh: public MeshCompt ////////////////////////////////////////////////////////////////// // inherited virtual funcs for Boundary ////////////////////////////////////////////////////////////////// - - void matchMeshEntries( const ChemCompt* other, + + void matchMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - void matchNeuroMeshEntries( const ChemCompt* other, + void matchNeuroMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - void matchCubeMeshEntries( const ChemCompt* other, + void matchCubeMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; - void matchSpineMeshEntries( const ChemCompt* other, + void matchSpineMeshEntries( const ChemCompt* other, vector< VoxelJunction > & ret ) const; /** @@ -160,12 +160,12 @@ class SpineMesh: public MeshCompt * Doesn't worry about whether this distance is inside or outside * cell. */ - double nearest( double x, double y, double z, + double nearest( double x, double y, double z, unsigned int& index ) const; - - void indexToSpace( unsigned int index, + + void indexToSpace( unsigned int index, double& x, double& y, double& z ) const; - + const vector< double >& vGetVoxelVolume() const; const vector< double >& vGetVoxelMidpoint() const; const vector< double >& getVoxelArea() const; @@ -184,13 +184,13 @@ class SpineMesh: public MeshCompt /** * Decides how finely to subdivide diffLength_ or radius or cubic - * mesh side when computing surfacearea of intersections with + * mesh side when computing surfacearea of intersections with * CubeMesh. Defaults to 0.1. */ double surfaceGranularity_; /** - * Volscale pre-calculations for each MeshEntry. + * Volscale pre-calculations for each MeshEntry. * vs = #molecules / vol * where vol is expressed in m^3. */ @@ -201,7 +201,7 @@ class SpineMesh: public MeshCompt * This is the cross-section area of the middle of each voxel. */ vector< double > area_; - + /// Pre-calculation of length of each MeshEntry vector< double > length_; }; diff --git a/moose-core/mesh/Stencil.cpp b/moose-core/mesh/Stencil.cpp index 156e6ea00abd9d38a024ab61f6ef1dbf79f789e7..fbddfb3b15e53f55775507a4e18fa8e1eac70044 100644 --- a/moose-core/mesh/Stencil.cpp +++ b/moose-core/mesh/Stencil.cpp @@ -15,9 +15,9 @@ using namespace std; /////////////////////////////////////////////////////////////////////////// // utility funcs /////////////////////////////////////////////////////////////////////////// -void stencil1( vector< double >& f, int index, unsigned int n, - double invSq, - const vector< vector< double > >& S, +void stencil1( vector< double >& f, int index, unsigned int n, + double invSq, + const vector< vector< double > >& S, const vector< double >& diffConst ) { const vector< double >& t0 = S[ index ]; @@ -53,7 +53,7 @@ void stencil1( vector< double >& f, int index, unsigned int n, * diffConst is the vector of [pools] */ void stencilN( vector< double >& f, int index, unsigned int n, int offset, - double invSq, const vector< vector< double > >& S, + double invSq, const vector< vector< double > >& S, const vector< double >& diffConst ) { const vector< double >& t0 = S[ index ]; @@ -96,8 +96,8 @@ DummyStencil::DummyStencil() DummyStencil::~DummyStencil() {;} -void DummyStencil::addFlux( unsigned int meshIndex, vector< double >& f, - const vector< vector< double > >& S, +void DummyStencil::addFlux( unsigned int meshIndex, vector< double >& f, + const vector< vector< double > >& S, const vector< double >& diffConst ) const {;} @@ -177,7 +177,7 @@ void RectangleStencil::addFlux( unsigned int meshIndex, // 3-D stencil. /////////////////////////////////////////////////////////////////////////// -CuboidStencil::CuboidStencil( double dx, double dy, double dz, +CuboidStencil::CuboidStencil( double dx, double dy, double dz, unsigned int nx, unsigned int ny ) : dx_( dx ), dy_( dy ), nx_( nx ), ny_( ny ) { diff --git a/moose-core/mesh/Stencil.h b/moose-core/mesh/Stencil.h index 00d9b143cf07459d3d99cd0c3ed7b57ab09f3ebc..594029eb37fbbf1e9f680fac7e68c49af5895bd2 100644 --- a/moose-core/mesh/Stencil.h +++ b/moose-core/mesh/Stencil.h @@ -10,7 +10,7 @@ #ifndef _STENCIL_H #define _STENCIL_H -class Stencil +class Stencil { public: Stencil(); @@ -19,11 +19,11 @@ class Stencil /** * computes the Flux f in the voxel on meshIndex. Takes the - * matrix of molNumber[meshIndex][pool] and + * matrix of molNumber[meshIndex][pool] and * the vector of diffusionConst[pool] as arguments. */ - virtual void addFlux( unsigned int meshIndex, - vector< double >& f, const vector< vector< double > >& S, + virtual void addFlux( unsigned int meshIndex, + vector< double >& f, const vector< vector< double > >& S, const vector< double >& diffConst ) const = 0; private: @@ -37,8 +37,8 @@ class DummyStencil: public Stencil public: DummyStencil(); ~DummyStencil(); - void addFlux( unsigned int meshIndex, vector< double >& f, - const vector< vector< double > >& S, + void addFlux( unsigned int meshIndex, vector< double >& f, + const vector< vector< double > >& S, const vector< double >& diffConst ) const; private: }; @@ -52,8 +52,8 @@ class LineStencil: public Stencil public: LineStencil( double h ); ~LineStencil(); - void addFlux( unsigned int meshIndex, vector< double >& f, - const vector< vector< double > >& S, + void addFlux( unsigned int meshIndex, vector< double >& f, + const vector< vector< double > >& S, const vector< double >& diffConst ) const; private: double h_; @@ -69,8 +69,8 @@ class RectangleStencil: public Stencil public: RectangleStencil( double dx, double dy, unsigned int nx ); ~RectangleStencil(); - void addFlux( unsigned int meshIndex, vector< double >& f, - const vector< vector< double > >& S, + void addFlux( unsigned int meshIndex, vector< double >& f, + const vector< vector< double > >& S, const vector< double >& diffConst ) const; private: double dx_; @@ -86,11 +86,11 @@ class RectangleStencil: public Stencil class CuboidStencil: public Stencil { public: - CuboidStencil( double dx, double dy, double dz, + CuboidStencil( double dx, double dy, double dz, unsigned int nx, unsigned int ny ); ~CuboidStencil(); - void addFlux( unsigned int meshIndex, vector< double >& f, - const vector< vector< double > >& S, + void addFlux( unsigned int meshIndex, vector< double >& f, + const vector< vector< double > >& S, const vector< double >& diffConst ) const; private: double dx_; diff --git a/moose-core/mesh/VoxelJunction.h b/moose-core/mesh/VoxelJunction.h index e3f15c4fe8ed7958f168f6fb43adabb9786292a9..4c92a3e95da34c3d58c572a8574cab06f691b855 100644 --- a/moose-core/mesh/VoxelJunction.h +++ b/moose-core/mesh/VoxelJunction.h @@ -19,7 +19,7 @@ class VoxelJunction { public: VoxelJunction( unsigned int f, unsigned int s, double d = 1.0 ) - : first( f ), second( s ), + : first( f ), second( s ), firstVol( 0 ), secondVol( 0 ), diffScale( d ) {;} diff --git a/moose-core/mesh/testMesh.cpp b/moose-core/mesh/testMesh.cpp index 60198cd4f34d15b6c4047a146f95f89fd85ae334..2ab6f067201d11d79a6548035aa53b68e4510cb3 100644 --- a/moose-core/mesh/testMesh.cpp +++ b/moose-core/mesh/testMesh.cpp @@ -229,10 +229,10 @@ void zebraConcPattern( vector< vector< double > >& S ) /// Set up uniform concentrations in each voxel. Only the end voxels /// should see a nonzero flux. -void uniformConcPattern( vector< vector< double > >& S, +void uniformConcPattern( vector< vector< double > >& S, vector< double >& vs ) { - // Set up uniform concs throughout. This means to scale each # by + // Set up uniform concs throughout. This means to scale each # by // voxel size. assert( S.size() == 44 ); for ( unsigned int i = 0; i < S.size(); ++i ) @@ -241,7 +241,7 @@ void uniformConcPattern( vector< vector< double > >& S, /** * Low-level test for NeuroStencil, no MOOSE calls - * This outlines the policy for how nodes and dummies are + * This outlines the policy for how nodes and dummies are * organized. * The set of nodes represents a neuron like this: * @@ -258,9 +258,9 @@ void uniformConcPattern( vector< vector< double > >& S, * 10 microns diameter. * Level 3 has 10 voxels. 3 micron at soma, 2 microns at tip * Level 4 has 10 voxels. 1 micron at tip. - * We have a total of 8 full nodes, plus 3 dummy nodes for + * We have a total of 8 full nodes, plus 3 dummy nodes for * the segments at 2 and 3, since they plug into a sphere. - Order is depth first: + Order is depth first: 0: soma 1: basal dummy 2: basal segment at level 3 @@ -273,8 +273,8 @@ void uniformConcPattern( vector< vector< double > >& S, 9: right segment at level 2, apicalR1 10: right segment at level 1, apicalR2 */ -unsigned int buildNode( vector< NeuroNode >& nodes, unsigned int parent, - double x, double y, double z, double dia, +unsigned int buildNode( vector< NeuroNode >& nodes, unsigned int parent, + double x, double y, double z, double dia, unsigned int numDivs, bool isDummy, unsigned int startFid ) { x *= 1e-6; @@ -387,7 +387,7 @@ void testCylMesh() // Can't check on the last coord as it is DiffLength, it changes. for ( unsigned int i = 0; i < temp.size() - 1; ++i ) assert( doubleEq( temp[i], coords[i] + 1 ) ); - + double totLen = sqrt( 29.0 ); assert( doubleEq( cm.getTotLength() , totLen ) ); @@ -399,7 +399,7 @@ void testCylMesh() assert( doubleEq( cm.getMeshEntryVolume( 2 ), 2.5 * 2.5 * PI * totLen / 5 ) ); /////////////////////////////////////////////////////////////// - // LenSlope/totLen = 0.016 = + // LenSlope/totLen = 0.016 = // 1/numEntries * (r1-r0)/numEntries * 2/(r0+r1) = 1/25 * 1 * 2/5 // Here are the fractional positions // part0 = 1/5 - 0.032: end= 0.2 - 0.032 @@ -469,7 +469,7 @@ void testCylMesh() /////////////////////////////////////////////////////////////// dist = cm.selectGridVolume( 10.0 ); - assert( doubleEq( dist, 0.1 * cm.getDiffLength() ) ); + assert( doubleEq( dist, 0.1 * cm.getDiffLength() ) ); dist = cm.selectGridVolume( 0.1 ); assert( dist <= 0.01 ); @@ -494,15 +494,15 @@ void testCylMesh() for ( unsigned int i = 0; i < ret.size(); ++i ) { assert( ret[i].first == i ); assert( ret[i].second == 0 ); // Only one cube entry - double r = cm.getR0() + - ( cm.getR1() - cm.getR0() ) * - cm.getDiffLength() * ( 0.5 + i ) / cm.getTotLength(); + double r = cm.getR0() + + ( cm.getR1() - cm.getR0() ) * + cm.getDiffLength() * ( 0.5 + i ) / cm.getTotLength(); double a = r * cm.getDiffLength() * 2 * PI; //assert( doubleApprox( ret[i].diffScale, a ) ); // cout << i << ". mesh: " << ret[i].diffScale << ", calc: " << a << endl; assert( fabs( ret[i].diffScale - a ) < 0.5 ); } - + /////////////////////////////////////////////////////////////// // We're going to set up a new cylinder to abut the old one. The // coords of x1 of the new cylinder are the same x0 of the old one, but @@ -582,7 +582,7 @@ void testMidLevelCylMesh() assert( doubleEq( Field< double >::get( oid, "volume" ), 1.5 * 1.5 * PI * totLen / 5 ) ); - vector< unsigned int > neighbors = + vector< unsigned int > neighbors = Field< vector< unsigned int > >::get( oid, "neighbors" ); assert( neighbors.size() == 2 ); assert( neighbors[0] = 1 ); @@ -795,7 +795,7 @@ void testReMesh() Id base = s->doCreate( "Neutral", Id(), "base", 1 ); Id cube = s->doCreate( "CubeMesh", base, "cube", 1 ); - bool ret = SetGet2< double, unsigned int >::set( + bool ret = SetGet2< double, unsigned int >::set( cube, "buildDefaultMesh", 1.0, 1 ); assert( ret ); unsigned int vol = Field< double >::get( cube, "volume" ); @@ -814,7 +814,7 @@ void testReMesh() double n = Field< double >::get( pool, "n" ); assert( doubleEq( n, NA ) ); - ret = SetGet2< double, unsigned int >::set( + ret = SetGet2< double, unsigned int >::set( cube, "buildDefaultMesh", 1.0e-3, 1 ); Field< double >::set( pool, "conc", 1 ); n = Field< double >::get( pool, "n" ); @@ -824,7 +824,7 @@ void testReMesh() // Next we do the remeshing. double x = 1.234; Field< double >::set( pool, "concInit", x ); - ret = SetGet2< double, unsigned int >::set( + ret = SetGet2< double, unsigned int >::set( cube, "buildDefaultMesh", 1, 8 ); // This is nasty, needs the change to propagate through messages. linsize = Field< double >::get( pool, "volume" ); @@ -852,7 +852,7 @@ void testReMesh() * theta in degrees * len and dia in metres as usual */ -Id makeCompt( Id parentCompt, Id parentObj, +Id makeCompt( Id parentCompt, Id parentObj, string name, double len, double dia, double theta ) { Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); @@ -903,7 +903,7 @@ Id makeSpine( Id parentCompt, Id parentObj, unsigned int index, string hname = ss2.str(); Id shaft = shell->doCreate( "Compartment", parentObj, sname, 1 ); - ObjId mid = + ObjId mid = shell->doAddMsg( "Single", parentCompt, "raxial", shaft, "axial" ); assert( !mid.bad() ); double x = pax0 + frac * ( pax1 - pax0 ); @@ -951,17 +951,17 @@ Id makeSpine( Id parentCompt, Id parentObj, unsigned int index, * soma---->d1---->d1a---->d11---->d111 * | | +----->d112 * | | - * | +----->d12---->d121 + * | +----->d12---->d121 * | +----->d122 * | * +------>d2----->d2a---->d21---->d211 * | +----->d212 * | - * +------>d22---->d221 + * +------>d22---->d221 * +----->d222 * */ -pair< unsigned int, unsigned int > buildBranchingCell( +pair< unsigned int, unsigned int > buildBranchingCell( Id cell, double len, double dia ) { Id soma = makeCompt( Id(), cell, "soma", dia, dia, 90 ); @@ -988,7 +988,7 @@ pair< unsigned int, unsigned int > buildBranchingCell( return pair< unsigned int, unsigned int >( 17, 161 ); } - // y = initConc * dx * (0.5 / sqrt( PI * DiffConst * runtime ) ) * + // y = initConc * dx * (0.5 / sqrt( PI * DiffConst * runtime ) ) * // exp( -x * x / ( 4 * DiffConst * runtime ) ) double diffusionFunction( double D, double dx, double x, double t ) { @@ -1019,18 +1019,18 @@ void testNeuroMeshLinear() assert( ns == 1 ); unsigned int ndc = Field< unsigned int >::get( nm, "numDiffCompts" ); assert( ndc == numCompts ); - const vector< NeuroNode >& nodes = + const vector< NeuroNode >& nodes = reinterpret_cast< NeuroMesh* >( nm.eref().data() )-> getNodes(); assert( nodes.size() == 2 ); // Self plus dummy parent. assert( nodes[0].children().size() == 0 ); - // Insert a molecule at first subdivision of soma. I use a dummy + // Insert a molecule at first subdivision of soma. I use a dummy // matrix S rather than the one in the system. // Field< double >::set( ObjId( soma, 0 ), "nInit", 1.0e6 ); vector< double > molNum( 1, 0 ); // We only have one pool // S[meshIndex][poolIndex] - vector< vector< double > > S( ndc, molNum ); + vector< vector< double > > S( ndc, molNum ); S[0][0] = totNum; vector< double > diffConst( 1, D ); vector< double > temp( 1, 0.0 ); @@ -1040,8 +1040,8 @@ void testNeuroMeshLinear() assert( mc->getNumEntries() == numCompts ); const double adx = dia * dia * PI * 0.25 / diffLength; for ( unsigned int i = 0; i < numCompts; ++i ) { - const double* entry; - const unsigned int* colIndex; + const double* entry; + const unsigned int* colIndex; unsigned int numAbut = mc->getStencilRow( i, &entry, &colIndex ); if ( i == 0 ) { assert( numAbut == 1 ); @@ -1077,7 +1077,7 @@ void testNeuroMeshLinear() assert( doubleEq( x, diffLength * 27.5 ) ); assert( doubleEq( y, 0.0 ) ); assert( doubleEq( z, 0.0 ) ); - + /////////////////////////////////////////////////////////////////// shell->doDelete( cell ); shell->doDelete( nm ); @@ -1097,7 +1097,7 @@ void testNeuroMeshBranching() double maxt = 10.0; double dt = 0.001; - pair< unsigned int, unsigned int > ret = + pair< unsigned int, unsigned int > ret = buildBranchingCell( cell, len, dia ); // Scan it with neuroMesh and check outcome. @@ -1117,13 +1117,13 @@ void testNeuroMeshBranching() * soma---->d1---->d1a---->d11---->d111 * | | +----->d112 * | | - * | +----->d12---->d121 + * | +----->d12---->d121 * | +----->d122 * | * +------>d2----->d2a---->d21---->d211 * | +----->d212 * | - * +------>d22---->d221 + * +------>d22---->d221 * +----->d222 * */ @@ -1149,7 +1149,7 @@ void testNeuroMeshBranching() // Insert a molecule at soma vector< double > molNum( 1, 0 ); // We only have one pool // S[meshIndex][poolIndex] - vector< double > S( ndc, 0.0 ); + vector< double > S( ndc, 0.0 ); S[0] = totNum; vector< double > flux( ndc, 0.0 ); vector< double > vol( ndc, 0.0 ); @@ -1158,15 +1158,15 @@ void testNeuroMeshBranching() assert( doubleEq( vol[0], dia * dia * 0.25 * PI * diffLength ) ); assert( doubleEq( vol[1], dia * dia * 0.125 * PI * diffLength ) ); - // Watch diffusion using stencil and direct calls to the flux + // Watch diffusion using stencil and direct calls to the flux // calculations rather than going through the ksolve. for ( double t = 0; t < maxt; t += dt ) { flux.assign( ndc, 0.0 ); - + for ( unsigned int i = 0; i < ndc; ++i ) { const double* entry; const unsigned int* colIndex; - unsigned int numEntries = + unsigned int numEntries = neuro->getStencilRow( i, &entry, &colIndex); for ( unsigned int j = 0; j < numEntries; ++j ) { unsigned int k = colIndex[j]; @@ -1223,10 +1223,10 @@ void testNeuroMeshBranching() /* for ( unsigned int i = 0; i < nn.size(); ++i ) { if ( !nn[i].isDummyNode() ) { - cout << i << " (" << - nn[i].getX() << ", " << nn[i].getY() << ", " << + cout << i << " (" << + nn[i].getX() << ", " << nn[i].getY() << ", " << nn[i].getZ() << ") on " << - nn[i].elecCompt().element()->getName() << + nn[i].elecCompt().element()->getName() << "\n"; } } @@ -1246,7 +1246,7 @@ void testNeuroMeshBranching() /////////////////////////////////////////////////////////////////// // Test the area calculation - + CubeMesh cube; cube.setPreserveNumEntries( 0 ); vector< double > coords( 9, 0.0 ); @@ -1270,16 +1270,16 @@ void testNeuroMeshBranching() assert( vj[i].second == 0 ); // Only one cube entry area += vj[i].diffScale; /* - double r = cm.getR0() + - ( cm.getR1() - cm.getR0() ) * - cm.getDiffLength() * ( 0.5 + i ) / cm.getTotLength(); + double r = cm.getR0() + + ( cm.getR1() - cm.getR0() ) * + cm.getDiffLength() * ( 0.5 + i ) / cm.getTotLength(); double a = r * cm.getDiffLength() * 2 * PI; //assert( doubleApprox( vj[i].diffScale, a ) ); // cout << i << ". mesh: " << vj[i].diffScale << ", calc: " << a << endl; assert( fabs( vj[i].diffScale - a ) < 0.5 ); */ } - double a2 = dia * dia * PI + + double a2 = dia * dia * PI + 4 * len * dia * PI / sqrt( 2.0 ) + 4 * len * dia * PI / 2.0 + 8 * len * dia * PI / (2.0 * sqrt( 2.0 ) ); @@ -1289,7 +1289,7 @@ void testNeuroMeshBranching() /////////////////////////////////////////////////////////////////// - + shell->doDelete( cell ); shell->doDelete( nm ); cout << "." << flush; @@ -1302,14 +1302,14 @@ static const unsigned int SURFACE = ~1; static const unsigned int ABUT = ~2; static const unsigned int MULTI = ~3; typedef pair< unsigned int, unsigned int > PII; -extern void setIntersectVoxel( - vector< PII >& intersect, +extern 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 ); -extern void checkAbut( - const vector< PII >& intersect, +extern 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, @@ -1341,7 +1341,7 @@ void testIntersectVoxel() unsigned int nx = 5; unsigned int ny = 3; unsigned int nz = 1; - vector< PII > intersect( nx * ny * nz, PII( + vector< PII > intersect( nx * ny * nz, PII( CubeMesh::EMPTY, CubeMesh::EMPTY ) ); unsigned int meshIndex = 0; setIntersectVoxel( intersect, 1, 0, 0, nx, ny, nz, meshIndex++ ); @@ -1352,37 +1352,37 @@ void testIntersectVoxel() setIntersectVoxel( intersect, 2, 2, 0, nx, ny, nz, meshIndex++ ); setIntersectVoxel( intersect, 3, 2, 0, nx, ny, nz, meshIndex++ ); - assert( intersect[0].first == 0 && + assert( intersect[0].first == 0 && intersect[0].second == CubeMesh::ABUTX ); - assert( intersect[1].first == 0 && + assert( intersect[1].first == 0 && intersect[1].second == CubeMesh::SURFACE ); - assert( intersect[2].first == 1 && + assert( intersect[2].first == 1 && intersect[2].second == CubeMesh::SURFACE ); - assert( intersect[3].first == 2 && + assert( intersect[3].first == 2 && intersect[3].second == CubeMesh::SURFACE ); - assert( intersect[4].first == 2 && + assert( intersect[4].first == 2 && intersect[4].second == CubeMesh::ABUTX ); - assert( intersect[5].first == 3 && + assert( intersect[5].first == 3 && intersect[5].second == CubeMesh::ABUTX ); - assert( intersect[6].first == 3 && + assert( intersect[6].first == 3 && intersect[6].second == CubeMesh::SURFACE ); - assert( intersect[7].first == 1 && + assert( intersect[7].first == 1 && intersect[7].second == CubeMesh::MULTI ); - assert( intersect[8].first == 2 && + assert( intersect[8].first == 2 && intersect[8].second == CubeMesh::MULTI ); - assert( intersect[9].first == EMPTY && + assert( intersect[9].first == EMPTY && intersect[9].second == CubeMesh::EMPTY ); - assert( intersect[10].first == 4 && + assert( intersect[10].first == 4 && intersect[10].second == CubeMesh::ABUTX ); - assert( intersect[11].first == 4 && + assert( intersect[11].first == 4 && intersect[11].second == CubeMesh::SURFACE ); - assert( intersect[12].first == 5 && + assert( intersect[12].first == 5 && intersect[12].second == CubeMesh::SURFACE ); - assert( intersect[13].first == 6 && + assert( intersect[13].first == 6 && intersect[13].second == CubeMesh::SURFACE ); - assert( intersect[14].first == 6 && + assert( intersect[14].first == 6 && intersect[14].second == CubeMesh::ABUTX ); // Next: test out checkAbut. @@ -1421,7 +1421,7 @@ void testIntersectVoxel() assert( ret[1].first == 3 && ret[1].second == 6666 ); assert( ret[2].first == 4 && ret[2].second == 5555 ); assert( ret[3].first == 6 && ret[3].second == 4444 ); - + cout << "." << flush; } @@ -1451,7 +1451,7 @@ void testCubeMeshFillThreeDimSurface() void testCubeMeshJunctionTwoDimSurface() { - /** + /** * 8 9 * 10 11 12 13 14 6 7 * 5 6 7 8 9 4 5 @@ -1486,7 +1486,7 @@ void testCubeMeshJunctionTwoDimSurface() vector< VoxelJunction > ret; cm1.matchCubeMeshEntries( &cm2, ret ); - assert( ret.size() == 3 ); + assert( ret.size() == 3 ); assert( ret[0].first == 4 ); assert( ret[0].second == 2 ); @@ -1506,7 +1506,7 @@ void testCubeMeshJunctionTwoDimSurface() * * So, junction should be (9,2) only. */ - + // Trimming cm1. At this point we don't assume automatic updates of // the m2s, s2m and surface vectors when any of them is changed. vector< unsigned int > m2s = cm1.getMeshToSpace(); @@ -1517,7 +1517,7 @@ void testCubeMeshJunctionTwoDimSurface() assert( s2m.size() == 15 ); s2m[14] = ~0; cm1.setSpaceToMesh( s2m ); - surface.resize( 4 ); + surface.resize( 4 ); // As a shortcut, just assign the places near the junction // Note that the indices are spaceIndices. surface[0] = 3; @@ -1525,7 +1525,7 @@ void testCubeMeshJunctionTwoDimSurface() surface[2] = 9; surface[3] = 13; cm1.setSurface( surface ); - + // Trimming cm2. m2s = cm2.getMeshToSpace(); assert( m2s.size() == 10 ); @@ -1550,7 +1550,7 @@ void testCubeMeshJunctionTwoDimSurface() // Now test it out. ret.resize( 0 ); cm1.matchCubeMeshEntries( &cm2, ret ); - assert( ret.size() == 1 ); + assert( ret.size() == 1 ); assert( ret[0].first == 9 ); assert( ret[0].second == 2 ); @@ -1559,7 +1559,7 @@ void testCubeMeshJunctionTwoDimSurface() void testCubeMeshJunctionDiffSizeMesh() { - /** + /** * 14 15 * 12 13 * 10 11 12 13 14 10 11 @@ -1599,7 +1599,7 @@ void testCubeMeshJunctionDiffSizeMesh() vector< VoxelJunction > ret; cm1.matchCubeMeshEntries( &cm2, ret ); - assert( ret.size() == 6 ); + assert( ret.size() == 6 ); assert( ret[0].first == 4 ); assert( ret[0].second == 2 ); @@ -1790,11 +1790,11 @@ void testSpineAndPsdMesh() Field< double >::set( nm, "diffLength", diffLength ); Field< string >::set( nm, "geometryPolicy", "cylinder" ); Id sm = shell->doCreate( "SpineMesh", Id(), "spinemesh", 1 ); - ObjId mid = shell->doAddMsg( + ObjId mid = shell->doAddMsg( "OneToOne", nm, "spineListOut", sm, "spineList" ); assert( !mid.bad() ); Id pm = shell->doCreate( "PsdMesh", Id(), "psdmesh", 1 ); - mid = shell->doAddMsg( + mid = shell->doAddMsg( "OneToOne", nm, "psdListOut", pm, "psdList" ); assert( !mid.bad() ); Field< Id >::set( nm, "cell", cell ); @@ -1802,7 +1802,7 @@ void testSpineAndPsdMesh() assert( ns == 2 ); // soma and dend unsigned int ndc = Field< unsigned int >::get( nm, "numDiffCompts" ); assert( ndc == numCompts + floor( dia / diffLength + 0.5 ) ); - + unsigned int sdc = Field< unsigned int >::get( sm, "num_mesh" ); assert( sdc == numSpines ); @@ -1853,7 +1853,7 @@ void testSpineAndPsdMesh() assert( ret[i].second == cubeIndex ); assert( doubleApprox( ret[i].diffScale * 1e10, PI * 1e-12 * 1e10 ) ); /* - cout << i << " cubeIndex=" << cubeIndex << ", (" << + cout << i << " cubeIndex=" << cubeIndex << ", (" << ret[i].first << ", " << ret[i].second << ") : " << ret[i].diffScale << "\n"; */ @@ -1882,7 +1882,7 @@ void testSpineAndPsdMesh() for ( unsigned int i = 0; i < ret.size(); ++i ) { assert( ret[i].first == i ); assert( ret[i].second == i ); - assert( doubleApprox( ret[i].diffScale * 1e10, + assert( doubleApprox( ret[i].diffScale * 1e10, 1e10 * 0.25 * PI * 1e-12 / 0.5e-6 ) ); } ret.clear(); @@ -1894,7 +1894,7 @@ void testSpineAndPsdMesh() assert( ret[i].second == cubeIndex ); assert( doubleApprox( ret[i].diffScale * 1e10, 0.25 * PI * 1e-12 * 1e10 ) ); } - + shell->doDelete( cell ); shell->doDelete( nm ); @@ -1949,7 +1949,7 @@ void testNeuroNodeTree() } */ ////////////////////////////////////////////////////////////////////// - // Now to make a totally random cell, with a complete mash of + // Now to make a totally random cell, with a complete mash of // messaging, having circular linkage even. ////////////////////////////////////////////////////////////////////// shell->doDelete( cell ); @@ -2039,11 +2039,11 @@ void testNeuroNodeTree() for ( unsigned int i = 0; i < neck.size(); ++i ) { // Just to make things interesting, add the messages staggered. if ( i > 0 ) - shell->doAddMsg( "Single", dend[i], "proximal", + shell->doAddMsg( "Single", dend[i], "proximal", dend[ (i-1)], "distal" ); - shell->doAddMsg( "Single", neck[i], "proximalOnly", + shell->doAddMsg( "Single", neck[i], "proximalOnly", dend[ (i+7) % head.size()], "cylinder" ); - shell->doAddMsg( "Single", neck[i], "distal", + shell->doAddMsg( "Single", neck[i], "distal", head[ (i+4) % neck.size() ], "proximal" ); } nodes.clear(); @@ -2060,11 +2060,11 @@ void testNeuroNodeTree() /* cout << endl; for ( unsigned int i = 0; i < 10; ++i ) { - cout << "nodes[" << i << "].pa = " << nodes[i].parent() << + cout << "nodes[" << i << "].pa = " << nodes[i].parent() << ", Id = " << nodes[i].elecCompt() << endl; } for ( unsigned int i = 0; i < 30; ++i ) { - cout << "orig[" << i << "].pa = " << orig[i].parent() << + cout << "orig[" << i << "].pa = " << orig[i].parent() << ", Id = " << orig[i].elecCompt() << endl; } */ @@ -2113,11 +2113,11 @@ void testCellPortion() Field< double >::set( nm, "diffLength", diffLength ); Field< string >::set( nm, "geometryPolicy", "cylinder" ); Id sm = shell->doCreate( "SpineMesh", Id(), "spinemesh", 1 ); - ObjId mid = shell->doAddMsg( + ObjId mid = shell->doAddMsg( "OneToOne", nm, "spineListOut", sm, "spineList" ); assert( !mid.bad() ); Id pm = shell->doCreate( "PsdMesh", Id(), "psdmesh", 1 ); - mid = shell->doAddMsg( + mid = shell->doAddMsg( "OneToOne", nm, "psdListOut", pm, "psdList" ); assert( !mid.bad() ); // SetGet2< Id, string >::set( nm, "cellPortion", cell, "/cell/dend2,/cell/shaft#,/cell/head#" ); @@ -2126,7 +2126,7 @@ void testCellPortion() assert( ns == 2 ); // dend1 + dend2 only unsigned int ndc = Field< unsigned int >::get( nm, "numDiffCompts" ); assert( ndc == numCompts * 2 ); - + unsigned int sdc = Field< unsigned int >::get( sm, "num_mesh" ); assert( sdc == 11 ); // I've selected only those in the teens plus #3 diff --git a/moose-core/mpi/CMakeLists.txt b/moose-core/mpi/CMakeLists.txt index 46c1004395b9d1833d3fce5ddacbb9da4e6af5c9..a3617266891346eb3c2ecaefd67d39fffaec2bad 100644 --- a/moose-core/mpi/CMakeLists.txt +++ b/moose-core/mpi/CMakeLists.txt @@ -1,12 +1,12 @@ include_directories(../msg ../basecode) -IF(USE_MPI) +IF(USE_MPI) find_package(MPI REQUIRED) include_directories(MPI_INCLUDE_PATH) ADD_DEFINITIONS(-DUSE_MPI) ENDIF(USE_MPI) -add_library(moose_mpi - PostMaster.cpp - testMpi.cpp +add_library(moose_mpi + PostMaster.cpp + testMpi.cpp ) diff --git a/moose-core/mpi/PostMaster.cpp b/moose-core/mpi/PostMaster.cpp index ef42910456e4a06ecbb88acad4ae0b4b030f635f..194fdfd4f45968228ae9317ba292dcf607a96ea6 100644 --- a/moose-core/mpi/PostMaster.cpp +++ b/moose-core/mpi/PostMaster.cpp @@ -11,7 +11,7 @@ #include "PostMaster.h" #include "../shell/Shell.h" -const unsigned int TgtInfo::headerSize = +const unsigned int TgtInfo::headerSize = 1 + ( sizeof( TgtInfo ) - 1 )/sizeof( double ); const unsigned int PostMaster::reserveBufSize = 1048576; @@ -23,7 +23,7 @@ const int PostMaster::RETURNTAG = 4; const int PostMaster::CONTROLTAG = 5; const int PostMaster::DIETAG = 100; PostMaster::PostMaster() - : + : recvBufSize_( reserveBufSize ), setSendBuf_( setRecvBufSize, 0 ), setRecvBuf_( setRecvBufSize, 0 ), @@ -67,8 +67,8 @@ PostMaster::PostMaster() recvBuf_[i].resize( recvBufSize_, 0 ); MPI_Irecv( &recvBuf_[i][0], recvBufSize_, MPI_DOUBLE, i, MSGTAG, MPI_COMM_WORLD, - &recvReq_[k++] - // Need to be careful about contiguous indexing for + &recvReq_[k++] + // Need to be careful about contiguous indexing for // the MPI_request array. ); } @@ -171,7 +171,7 @@ void PostMaster::reinit( const Eref& e, ProcPtr p ) if ( i == Shell::myNode() ) continue; // MPI_scatter would have been better but it doesn't allow // one to post larger recvs than the actual data sent. - MPI_Isend( + MPI_Isend( &sendBuf_[i][0], sendSize_[i], MPI_DOUBLE, i, // Where to send to. MSGTAG, MPI_COMM_WORLD, @@ -196,7 +196,7 @@ void PostMaster::process( const Eref& e, ProcPtr p ) if ( i == Shell::myNode() ) continue; // MPI_scatter would have been better but it doesn't allow // one to post larger recvs than the actual data sent. - MPI_Isend( + MPI_Isend( &sendBuf_[i][0], sendSize_[i], MPI_DOUBLE, i, // Where to send to. MSGTAG, MPI_COMM_WORLD, @@ -220,7 +220,7 @@ void PostMaster::clearPending() clearPendingRecv(); } -void PostMaster::handleRemoteGet( +void PostMaster::handleRemoteGet( const Eref& e, const OpFunc* op, int requestingNode ) { #ifdef USE_MPI @@ -228,7 +228,7 @@ void PostMaster::handleRemoteGet( op->opBuffer( e, &getReturnBuf[0] ); // stuff return value into buf. // Send out the data. Blocking. Don't want any other gets till done int size = getReturnBuf[0]; - MPI_Send( + MPI_Send( &getReturnBuf[1], size, MPI_DOUBLE, requestingNode, // Where to send to. RETURNTAG, MPI_COMM_WORLD @@ -241,12 +241,12 @@ void PostMaster::handleRemoteGet( * Returns size of all contents of getReturnBuf, in doubles. * Puts number of returned values in getReturnBuf[0]. Note that these * are likely to differ if the values returned are not doubles. - * Examines the eref to decide if this is a DataElement or a + * Examines the eref to decide if this is a DataElement or a * FieldElement. If a DataElement, scans through all data entries to fill * the returnBuf. If a FieldElement, fills in field entries only of the * one specified DataId on this eref. */ -int innerGetVec( const Eref& e, const OpFunc* op, +int innerGetVec( const Eref& e, const OpFunc* op, double* getReturnBuf ) { static double buf[PostMaster::reserveBufSize]; @@ -261,7 +261,7 @@ int innerGetVec( const Eref& e, const OpFunc* op, for ( unsigned int j = 0; j < numField; ++j ) { Eref er( elm, di, j ); // stuff return value into buf. - op->opBuffer( er, buf ); + op->opBuffer( er, buf ); unsigned int size = buf[0]; memcpy( &getReturnBuf[k], &buf[1], size * sizeof( double ) ); k += size; @@ -272,7 +272,7 @@ int innerGetVec( const Eref& e, const OpFunc* op, for ( unsigned int i = start; i < end; ++i ) { Eref er( elm, i, 0 ); // stuff return value into buf. - op->opBuffer( er, buf ); + op->opBuffer( er, buf ); unsigned int size = buf[0]; memcpy( &getReturnBuf[k], &buf[1], size * sizeof( double ) ); k += size; @@ -281,14 +281,14 @@ int innerGetVec( const Eref& e, const OpFunc* op, return k; } -void PostMaster::handleRemoteGetVec( +void PostMaster::handleRemoteGetVec( const Eref& e, const OpFunc* op, int requestingNode ) { #ifdef USE_MPI static double getReturnBuf[reserveBufSize]; int k = innerGetVec( e, op, getReturnBuf ); // Send out the data. Blocking. Don't want any other gets till done - MPI_Send( + MPI_Send( &getReturnBuf[0], k, MPI_DOUBLE, requestingNode, // Where to send to. RETURNTAG, MPI_COMM_WORLD @@ -314,9 +314,9 @@ void PostMaster::clearPendingSetGet() int count = 0; MPI_Get_count( &setRecvStatus_, MPI_DOUBLE, &count ); // Immediately post another Recv. Needed because we may call - // the clearPendingSetGet() function recursively. So copy + // the clearPendingSetGet() function recursively. So copy // data to another buffer first. - vector< double > temp( setRecvBuf_.begin(), + vector< double > temp( setRecvBuf_.begin(), setRecvBuf_.begin() + count ); MPI_Irecv( &setRecvBuf_[0], setRecvBufSize, MPI_DOUBLE, MPI_ANY_SOURCE, @@ -370,7 +370,7 @@ void PostMaster::clearPendingGet() // Send out the data. Blocking. Don't want any other gets till done int size = getReturnBuf[0]; - MPI_Send( + MPI_Send( &getReturnBuf[1], size, MPI_DOUBLE, requestingNode, // Where to send to. RETURNTAG, MPI_COMM_WORLD @@ -385,7 +385,7 @@ void PostMaster::clearPendingRecv() #ifdef USE_MPI int done = 0; bool report = false; // for debugging - MPI_Testsome( Shell::numNodes() -1, &recvReq_[0], &done, + MPI_Testsome( Shell::numNodes() -1, &recvReq_[0], &done, &doneIndices_[0], &doneStatus_[0] ); if ( done == MPI_UNDEFINED ) return; @@ -409,7 +409,7 @@ void PostMaster::clearPendingRecv() while ( j < recvSize ) { const TgtInfo* tgt = reinterpret_cast< const TgtInfo * >( buf ); const Eref& e = tgt->eref(); - const Finfo *f = + const Finfo *f = e.element()->cinfo()->getSrcFinfo( tgt->bindIndex() ); buf += TgtInfo::headerSize; const SrcFinfo* sf = dynamic_cast< const SrcFinfo* >( f ); @@ -421,13 +421,13 @@ void PostMaster::clearPendingRecv() } // Post the next Irecv. unsigned int k = recvNode; - if ( recvNode > Shell::myNode() ) + if ( recvNode > Shell::myNode() ) k--; MPI_Irecv( &recvBuf_[recvNode][0], - recvBufSize_, MPI_DOUBLE, + recvBufSize_, MPI_DOUBLE, recvNode, MSGTAG, MPI_COMM_WORLD, - &recvReq_[ k ] + &recvReq_[ k ] // Ensure we have contiguous entries in recvReq_ ); } @@ -448,8 +448,8 @@ double* PostMaster::addToSendBuf( const Eref& e, unsigned int bindIndex, // Here we need to activate the fallback second send which will // deal with the big block. Also various routines for tracking // send size so we don't get too big or small. - cerr << "Error: PostMaster::addToSendBuf on node " << - Shell::myNode() << + cerr << "Error: PostMaster::addToSendBuf on node " << + Shell::myNode() << ": Data size (" << size << ") goes past end of buffer\n"; assert( 0 ); } @@ -460,15 +460,15 @@ double* PostMaster::addToSendBuf( const Eref& e, unsigned int bindIndex, return &sendBuf_[node][end]; } -double* PostMaster::addToSetBuf( const Eref& e, unsigned int opIndex, +double* PostMaster::addToSetBuf( const Eref& e, unsigned int opIndex, unsigned int size, unsigned int hopType ) { if ( TgtInfo::headerSize + size > setRecvBufSize ) { // Here we need to activate the fallback second send which will // deal with the big block. Also various routines for tracking // send size so we don't get too big or small. - cerr << "Error: PostMaster::addToSetBuf on node " << - Shell::myNode() << + cerr << "Error: PostMaster::addToSetBuf on node " << + Shell::myNode() << ": Data size (" << size << ") goes past end of buffer\n"; assert( 0 ); } @@ -494,18 +494,18 @@ void PostMaster::dispatchSetBuf( const Eref& e ) // A bcast would be marginally more efficient, but would need // us to inform all target nodes to expect one. So just do // multiple sends. - MPI_Isend( + MPI_Isend( &setSendBuf_[0], setSendSize_, MPI_DOUBLE, i, // Where to send to. SETTAG, MPI_COMM_WORLD, &setSendReq_ - // Need to monitor all the sends to make sure they all complete + // Need to monitor all the sends to make sure they all complete // before permitting another 'set' ); } } } else { - MPI_Isend( + MPI_Isend( &setSendBuf_[0], setSendSize_, MPI_DOUBLE, e.getNode(), // Where to send to. SETTAG, MPI_COMM_WORLD, @@ -526,8 +526,8 @@ double* PostMaster::remoteGet( const Eref& e, unsigned int bindIndex ) static MPI_Request getRecvReq; static MPI_Status getSendStatus; - while ( isSetSent_ == 0 ) { - // Can't request a 'get' while old set is + while ( isSetSent_ == 0 ) { + // Can't request a 'get' while old set is // pending, lest the 'get' depend on the 'set'. clearPending(); } @@ -536,13 +536,13 @@ double* PostMaster::remoteGet( const Eref& e, unsigned int bindIndex ) assert ( !e.element()->isGlobal() && e.getNode() != Shell::myNode() ); // Post receive for return value. MPI_Irecv( &getRecvBuf[0], - setRecvBufSize, MPI_DOUBLE, + setRecvBufSize, MPI_DOUBLE, e.getNode(), RETURNTAG, MPI_COMM_WORLD, - &getRecvReq + &getRecvReq ); // Now post send to request the data - MPI_Isend( + MPI_Isend( &getSendBuf[0], TgtInfo::headerSize, MPI_DOUBLE, e.getNode(), // Where to send to. SETTAG, MPI_COMM_WORLD, @@ -561,12 +561,12 @@ double* PostMaster::remoteGet( const Eref& e, unsigned int bindIndex ) return &getRecvBuf[0]; } -/// This is a blocking call. However, it must still handle other +/// This is a blocking call. However, it must still handle other //requests that come into the current node. // Here we request data only from the one node that holds the data, // since all field data is on a single DataEntry. void PostMaster::remoteFieldGetVec( const Eref& e, unsigned int bindIndex, - vector< double >& getRecvBuf ) + vector< double >& getRecvBuf ) { #ifdef USE_MPI static double getSendBuf[TgtInfo::headerSize]; @@ -580,8 +580,8 @@ void PostMaster::remoteFieldGetVec( const Eref& e, unsigned int bindIndex, getRecvBuf.resize( reserveBufSize ); #ifdef USE_MPI - while ( isSetSent_ == 0 ) { - // Can't request a 'get' while old set is + while ( isSetSent_ == 0 ) { + // Can't request a 'get' while old set is // pending, lest the 'get' depend on the 'set'. clearPending(); } @@ -591,13 +591,13 @@ void PostMaster::remoteFieldGetVec( const Eref& e, unsigned int bindIndex, // Post receive for return value. MPI_Irecv( &getRecvBuf[0], - reserveBufSize, MPI_DOUBLE, + reserveBufSize, MPI_DOUBLE, targetNode, RETURNTAG, MPI_COMM_WORLD, - &getRecvReq + &getRecvReq ); // Now post send to request the data - MPI_Isend( + MPI_Isend( &getSendBuf[0], TgtInfo::headerSize, MPI_DOUBLE, targetNode, // Where to send to. SETTAG, MPI_COMM_WORLD, @@ -616,12 +616,12 @@ void PostMaster::remoteFieldGetVec( const Eref& e, unsigned int bindIndex, #endif } -/// This is a blocking call. However, it must still handle other +/// This is a blocking call. However, it must still handle other //requests that come into the current node. // getRecvBuf and size are already sized at numNodes. // But getRecvBuf individual entries need to be sized. void PostMaster::remoteGetVec( const Eref& e, unsigned int bindIndex, - vector< vector< double > >& getRecvBuf, + vector< vector< double > >& getRecvBuf, vector< unsigned int >& numOnNode ) { #ifdef USE_MPI @@ -637,8 +637,8 @@ void PostMaster::remoteGetVec( const Eref& e, unsigned int bindIndex, getRecvBuf.resize( Shell::numNodes(), temp ); #ifdef USE_MPI - while ( isSetSent_ == 0 ) { - // Can't request a 'get' while old set is + while ( isSetSent_ == 0 ) { + // Can't request a 'get' while old set is // pending, lest the 'get' depend on the 'set'. clearPending(); } @@ -651,13 +651,13 @@ void PostMaster::remoteGetVec( const Eref& e, unsigned int bindIndex, if ( i != Shell::myNode() ) { // Post receive for return value. MPI_Irecv( &getRecvBuf[i][0], - reserveBufSize, MPI_DOUBLE, + reserveBufSize, MPI_DOUBLE, i, RETURNTAG, MPI_COMM_WORLD, - &getRecvReq[k] + &getRecvReq[k] ); // Now post send to request the data - MPI_Isend( + MPI_Isend( &getSendBuf[0], TgtInfo::headerSize, MPI_DOUBLE, i, // Where to send to. SETTAG, MPI_COMM_WORLD, @@ -673,7 +673,7 @@ void PostMaster::remoteGetVec( const Eref& e, unsigned int bindIndex, unsigned int received = 0; vector< int > getDoneIndices( Shell::numNodes(), 0 ); while( received < Shell::numNodes() - 1 ) { - MPI_Testsome( Shell::numNodes() -1, &getRecvReq[0], &done, + MPI_Testsome( Shell::numNodes() -1, &getRecvReq[0], &done, &getDoneIndices[0], &doneStatus[0] ); if ( done == MPI_UNDEFINED ) continue; @@ -685,7 +685,7 @@ void PostMaster::remoteGetVec( const Eref& e, unsigned int bindIndex, recvNode += 1; // Skip myNode /* int recvSize = 0; - MPI_Get_count( &doneStatus[doneIndex], + MPI_Get_count( &doneStatus[doneIndex], MPI_DOUBLE, &recvSize ); size[recvNode] = recvSize; */ diff --git a/moose-core/mpi/PostMaster.h b/moose-core/mpi/PostMaster.h index 0e610ca3a912622a00d09e83884047249cd0460b..ccac9d211980d7616454b15a621467743f8d2e87 100644 --- a/moose-core/mpi/PostMaster.h +++ b/moose-core/mpi/PostMaster.h @@ -35,22 +35,22 @@ * The sendBuffer call converts the arguments * back from the bufer to their native form and despatches using the * regular messaging. Note that the MsgDigest will have done the right - * thing here to set up the regular messaging even for off-node + * thing here to set up the regular messaging even for off-node * DataIndices on this element. * 9. Messages reach their targets. * * Level 2. Setup. - * 1. Objects and messages set up the regular way. Objects may have + * 1. Objects and messages set up the regular way. Objects may have * subsets of their Data arrays placed on different nodes. Messages * are globals, their contents are replicated on every node. - * 2. When a SrcFinfo::send call is about to execute for the first time, + * 2. When a SrcFinfo::send call is about to execute for the first time, * it is digested: Element::digestMessages. During this step each of the * messages is expanded by putTargetsInDigeest into target Erefs. * 3. The target Erefs are inspected in filterOffNodeTargets. Off-node * targets are removed, and we record each pair of Source DataId and node. * 4. We now call putOffNodeTargetsInDigest. This generates the * HopFunc by calling OpFunc::makeHopFunc with the fid of the SrcFinfo. - * 5. putOffNodeTargetsInDigest then examines the Source/Node pairs and + * 5. putOffNodeTargetsInDigest then examines the Source/Node pairs and * creates HopFunc/Eref pairs which are stuffed into the msgDigest. * Note that these Erefs are the hacked version where the Eref specifies * the originating object, plus using its FieldIndex to specify the target @@ -70,7 +70,7 @@ #endif class TgtInfo { - public: + public: TgtInfo() : id_(), bindIndex_( 0 ), dataSize_( 0 ) @@ -121,17 +121,17 @@ class PostMaster { void finalizeSends(); /// Handles 'get' calls from another node, to an object on mynode. - void handleRemoteGet( const Eref& e, + void handleRemoteGet( const Eref& e, const OpFunc* op, int requestingNode ); - void handleRemoteGetVec( const Eref& e, + void handleRemoteGetVec( const Eref& e, const OpFunc* op, int requestingNode ); /// Returns pointer to Send buffer for filling in arguments. - double* addToSendBuf( const Eref& e, + double* addToSendBuf( const Eref& e, unsigned int bindIndex, unsigned int size ); /// Returns pointer to Set buffer for filling in arguments. - double* addToSetBuf( const Eref& e, + double* addToSetBuf( const Eref& e, unsigned int opIndex, unsigned int size, unsigned int hopType ); /// Sends off contets of Set buffer. void dispatchSetBuf( const Eref& e ); @@ -139,10 +139,10 @@ class PostMaster { /// Blocking call to get a value from a remote node. double* remoteGet( const Eref& e, unsigned int bindIndex ); void remoteGetVec( const Eref& e, unsigned int bindIndex, - vector< vector< double > >& getRecvBuf, + vector< vector< double > >& getRecvBuf, vector< unsigned int >& size ); void remoteFieldGetVec( const Eref& e, unsigned int bindIndex, - vector< double >& getRecvBuf ); + vector< double >& getRecvBuf ); static const unsigned int reserveBufSize; static const unsigned int setRecvBufSize; @@ -156,8 +156,8 @@ class PostMaster { private: unsigned int recvBufSize_; // Used on master for sending, on others for receiving. - vector< double > setSendBuf_; - vector< double > setRecvBuf_; + vector< double > setSendBuf_; + vector< double > setRecvBuf_; vector< vector< double > > sendBuf_; vector< vector< double > > recvBuf_; vector< unsigned int > sendSize_; diff --git a/moose-core/mpi/proc.cpp b/moose-core/mpi/proc.cpp index a2970aa8d20f9baeaeb55bb1a39ae97fed6b454f..e4ee71438182ac33c080ccb99acab483a7273431 100644 --- a/moose-core/mpi/proc.cpp +++ b/moose-core/mpi/proc.cpp @@ -16,7 +16,7 @@ vector< vector< double > > inBuf_;// inbuf[srcnode][data] // Things to monitor: -// - The send happens with a standard buf size, and if the contents +// - The send happens with a standard buf size, and if the contents // exceed it there is a signal to this effect and the rest of it is sent // right away as a big block. // - The Recv likewise @@ -26,7 +26,7 @@ vector< vector< double > > inBuf_;// inbuf[srcnode][data] // // Assumes we already have an irecv out for all the nodes. -// +// void checkIncoming() { MPI_request* array_of_requests; @@ -36,9 +36,9 @@ void checkIncoming() int MPI_Testsome(int incount, MPI_Request array_of_requests[], int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]) - for ( unsigned int + for ( unsigned int - MPI_Irecv (&buf,count,datatype,source,tag,comm,&request) + MPI_Irecv (&buf,count,datatype,source,tag,comm,&request) } @@ -62,7 +62,7 @@ static void master(void); static void slave(void); static double* get_next_work_item() { - + static vector< double > ret( numEntries ); static unsigned int numCalls = 0; for ( unsigned int i = 0; i < numEntries; ++i ) @@ -183,7 +183,7 @@ master(void) } -static void +static void slave(void) { double work[numEntries]; diff --git a/moose-core/mpi/proc1.cpp b/moose-core/mpi/proc1.cpp index 75a9c5f1b2e807f022bb9c7fcbc92404860dd88f..68c982dc0587f9a156da8cff01861989bb945114 100644 --- a/moose-core/mpi/proc1.cpp +++ b/moose-core/mpi/proc1.cpp @@ -16,7 +16,7 @@ vector< vector< double > > inBuf_;// inbuf[srcnode][data] // Things to monitor: -// - The send happens with a standard buf size, and if the contents +// - The send happens with a standard buf size, and if the contents // exceed it there is a signal to this effect and the rest of it is sent // right away as a big block. // - The Recv likewise @@ -26,7 +26,7 @@ vector< vector< double > > inBuf_;// inbuf[srcnode][data] // // Assumes we already have an irecv out for all the nodes. -// +// void checkIncoming() { MPI_request* array_of_requests; @@ -36,9 +36,9 @@ void checkIncoming() int MPI_Testsome(int incount, MPI_Request array_of_requests[], int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]) - for ( unsigned int + for ( unsigned int - MPI_Irecv (&buf,count,datatype,source,tag,comm,&request) + MPI_Irecv (&buf,count,datatype,source,tag,comm,&request) } @@ -63,7 +63,7 @@ static void master(void); static void slave(void); static double* get_next_work_item() { - + static vector< double > ret( numEntries ); static unsigned int numCalls = 0; for ( unsigned int i = 0; i < numEntries; ++i ) @@ -112,8 +112,8 @@ master(void) double tot = 0.0; double tc = totCalls; double ne = numEntries; - double expectedTot = - tc * ( ( ne * (ne - 1.0) )/2.0 ) + + double expectedTot = + tc * ( ( ne * (ne - 1.0) )/2.0 ) + ne * ( tc * (tc - 1.0) )/2.0; /* Find out how many processes there are in the default @@ -189,7 +189,7 @@ master(void) } -static void +static void slave(void) { double work[numEntries]; diff --git a/moose-core/mpi/proc2.cpp b/moose-core/mpi/proc2.cpp index 380899724652875cd6c85d1f6f908cf83b7278f6..341186d7d465eb7d0d41b8d2311bb40b539db5d3 100644 --- a/moose-core/mpi/proc2.cpp +++ b/moose-core/mpi/proc2.cpp @@ -32,8 +32,8 @@ int main(int argc, char **argv) double tot = 0.0; double tc = totCalls; double ne = numEntries; - double expectedTot = - tc * ( ( ne * (ne - 1.0) )/2.0 ) + + double expectedTot = + tc * ( ( ne * (ne - 1.0) )/2.0 ) + ne * ( tc * (tc - 1.0) )/2.0; int myrank; int numNodes; @@ -80,7 +80,7 @@ int main(int argc, char **argv) tot += doWork( work ); } else { // Ship it out to work; and handle shipments that come in. /* - MPI_Send(work, // message buffer + MPI_Send(work, // message buffer numEntries, // one data item MPI_DOUBLE, // data item is an integer targetNode, // Where to send to @@ -88,7 +88,7 @@ int main(int argc, char **argv) MPI_COMM_WORLD // default communicator ); */ - MPI_Isend(work, // message buffer + MPI_Isend(work, // message buffer numEntries, // one data item MPI_DOUBLE, // data item is an integer targetNode, // Where to send to @@ -100,7 +100,7 @@ int main(int argc, char **argv) if ( targetNode == numNodes - 1 ) { int numDone = 1; while ( numDone < numNodes ) // Ensure we clear all once a cycle - numDone += clearPending( numNodes, myrank, recvReq, tot ); + numDone += clearPending( numNodes, myrank, recvReq, tot ); } } // One last send with the consolidated result. Irecvs should have @@ -109,7 +109,7 @@ int main(int argc, char **argv) work[0] = tot; for ( int i = 0; i < numNodes; ++i ) { if ( i == myrank ) continue; - MPI_Send(&work[0], // message buffer + MPI_Send(&work[0], // message buffer numEntries, // one data item MPI_DOUBLE, // data item is an integer i, // Where to send to @@ -120,10 +120,10 @@ int main(int argc, char **argv) int numDone = 1; while ( numDone < numNodes ) // Ensure we clear all once a cycle - numDone += clearPending( numNodes, myrank, recvReq, tot ); + numDone += clearPending( numNodes, myrank, recvReq, tot ); - cout << myrank << ": Tot = " << tot << - ", expected = " << expectedTot << + cout << myrank << ": Tot = " << tot << + ", expected = " << expectedTot << ", subtot = " << work[0] << endl; /* Shut down MPI */ @@ -145,7 +145,7 @@ int clearPending( int numNodes, int myrank, MPI_Request *recvReq, double& tot ) ds.MPI_SOURCE = ds.MPI_TAG = ds.MPI_ERROR = ds._count = ds._cancelled = 0; } - int numDone = MPI_Testsome( numNodes - 1, recvReq, &done, + int numDone = MPI_Testsome( numNodes - 1, recvReq, &done, doneIndices, doneStatus ); // cout << "numDone = " << numDone << ", " << done << ", numNodes = " << numNodes << ", myrank = " << myrank << endl << flush; if ( done == MPI_UNDEFINED ) @@ -166,7 +166,7 @@ int clearPending( int numNodes, int myrank, MPI_Request *recvReq, double& tot ) MPI_COMM_WORLD, /* default communicator */ &recvReq[doneIndices[i]]); /* info about the received message */ } - return done; + return done; } diff --git a/moose-core/mpi/proc3.cpp b/moose-core/mpi/proc3.cpp index 956158427b6d1601f3292c4113981c7e3c6d202b..6c13c79dc343fdb6627519acadff0a95b81e6ddf 100644 --- a/moose-core/mpi/proc3.cpp +++ b/moose-core/mpi/proc3.cpp @@ -35,8 +35,8 @@ int main(int argc, char **argv) double tot = 0.0; double tc = totCalls; double ne = numEntries; - double expectedTot = - tc * ( ( ne * (ne - 1.0) )/2.0 ) + + double expectedTot = + tc * ( ( ne * (ne - 1.0) )/2.0 ) + ne * ( tc * (tc - 1.0) )/2.0; int myrank; int numNodes; @@ -71,15 +71,15 @@ int main(int argc, char **argv) MPI_Scatter( sendBuf, numEntries, MPI_DOUBLE, recvBuf, numEntries, MPI_DOUBLE, j, MPI_COMM_WORLD - ); + ); tot += doWork( recvBuf ); } } } // Final pass to consolidate all the data double totBuf[ numNodes ]; - MPI_Allgather( &tot, 1, MPI_DOUBLE, - totBuf, 1, MPI_DOUBLE, + MPI_Allgather( &tot, 1, MPI_DOUBLE, + totBuf, 1, MPI_DOUBLE, MPI_COMM_WORLD ); double subtot = tot; @@ -89,8 +89,8 @@ int main(int argc, char **argv) tot += totBuf[i]; } - cout << myrank << ": Tot = " << tot << - ", expected = " << expectedTot << + cout << myrank << ": Tot = " << tot << + ", expected = " << expectedTot << ", subtot = " << subtot << endl; /* Shut down MPI */ diff --git a/moose-core/mpi/proc4.cpp b/moose-core/mpi/proc4.cpp index 81ddd62c915ea8fc30addc49f833fd6674ea6aef..fe48ba6f9b0b486014962781a0f89f745cf37a1d 100644 --- a/moose-core/mpi/proc4.cpp +++ b/moose-core/mpi/proc4.cpp @@ -35,8 +35,8 @@ int main(int argc, char **argv) double tot = 0.0; double tc = totCalls; double ne = numEntries; - double expectedTot = - tc * ( ( ne * (ne - 1.0) )/2.0 ) + + double expectedTot = + tc * ( ( ne * (ne - 1.0) )/2.0 ) + ne * ( tc * (tc - 1.0) )/2.0; int myrank; int numNodes; @@ -71,15 +71,15 @@ int main(int argc, char **argv) MPI_Scatter( sendBuf, numEntries, MPI_DOUBLE, recvBuf, numEntries * (1 + j ), MPI_DOUBLE, j, MPI_COMM_WORLD - ); + ); tot += doWork( recvBuf ); } } } // Final pass to consolidate all the data double totBuf[ numNodes ]; - MPI_Allgather( &tot, 1, MPI_DOUBLE, - totBuf, 1, MPI_DOUBLE, + MPI_Allgather( &tot, 1, MPI_DOUBLE, + totBuf, 1, MPI_DOUBLE, MPI_COMM_WORLD ); double subtot = tot; @@ -89,8 +89,8 @@ int main(int argc, char **argv) tot += totBuf[i]; } - cout << myrank << ": Tot = " << tot << - ", expected = " << expectedTot << + cout << myrank << ": Tot = " << tot << + ", expected = " << expectedTot << ", subtot = " << subtot << endl; /* Shut down MPI */ diff --git a/moose-core/mpi/proc5.cpp b/moose-core/mpi/proc5.cpp index 28ad414fd1db9e9d3f818ef3ff73fa91f03d0f4a..504b1facae1d018490d8585a8bc5151d795f2a61 100644 --- a/moose-core/mpi/proc5.cpp +++ b/moose-core/mpi/proc5.cpp @@ -34,8 +34,8 @@ int main(int argc, char **argv) double tot = 0.0; double tc = totCalls; double ne = numEntries; - double expectedTot = - tc * ( ( ne * (ne - 1.0) )/2.0 ) + + double expectedTot = + tc * ( ( ne * (ne - 1.0) )/2.0 ) + ne * ( tc * (tc - 1.0) )/2.0; int myrank; int numNodes; @@ -82,7 +82,7 @@ int main(int argc, char **argv) tot += doWork( work ); } else { // Ship it out to work; and handle shipments that come in. /* - MPI_Send(work, // message buffer + MPI_Send(work, // message buffer numEntries, // one data item MPI_DOUBLE, // data item is an integer targetNode, // Where to send to @@ -90,7 +90,7 @@ int main(int argc, char **argv) MPI_COMM_WORLD // default communicator ); */ - MPI_Isend(work, // message buffer + MPI_Isend(work, // message buffer numEntries, // one data item MPI_DOUBLE, // data item is an integer targetNode, // Where to send to @@ -102,7 +102,7 @@ int main(int argc, char **argv) if ( targetNode == numNodes - 1 ) { int numDone = 1; while ( numDone < numNodes ) // Ensure we clear all once a cycle - numDone += clearPending( numNodes, myrank, recvReq, tot ); + numDone += clearPending( numNodes, myrank, recvReq, tot ); } } // One last send with the consolidated result. Irecvs should have @@ -111,7 +111,7 @@ int main(int argc, char **argv) work[0] = tot; for ( int i = 0; i < numNodes; ++i ) { if ( i == myrank ) continue; - MPI_Send(&work[0], // message buffer + MPI_Send(&work[0], // message buffer numEntries, // one data item MPI_DOUBLE, // data item is an integer i, // Where to send to @@ -122,10 +122,10 @@ int main(int argc, char **argv) int numDone = 1; while ( numDone < numNodes ) // Ensure we clear all once a cycle - numDone += clearPending( numNodes, myrank, recvReq, tot ); + numDone += clearPending( numNodes, myrank, recvReq, tot ); - cout << myrank << ": Tot = " << tot << - ", expected = " << expectedTot << + cout << myrank << ": Tot = " << tot << + ", expected = " << expectedTot << ", subtot = " << work[0] << endl; /* Shut down MPI */ @@ -147,7 +147,7 @@ int clearPending( int numNodes, int myrank, MPI_Request *recvReq, double& tot ) ds.MPI_SOURCE = ds.MPI_TAG = ds.MPI_ERROR = ds._count = ds._cancelled = 0; } - int numDone = MPI_Testsome( numNodes - 1, recvReq, &done, + int numDone = MPI_Testsome( numNodes - 1, recvReq, &done, doneIndices, doneStatus ); // cout << "numDone = " << numDone << ", " << done << ", numNodes = " << numNodes << ", myrank = " << myrank << endl << flush; if ( done == MPI_UNDEFINED ) @@ -168,7 +168,7 @@ int clearPending( int numNodes, int myrank, MPI_Request *recvReq, double& tot ) MPI_COMM_WORLD, /* default communicator */ &recvReq[doneIndices[i]]); /* info about the received message */ } - return done; + return done; } diff --git a/moose-core/msg/CMakeLists.txt b/moose-core/msg/CMakeLists.txt index 797e41bec73f742c5da40a0010ec8a85e471f558..9b5d6bc3720122870e46ed714f578db2635a0878 100644 --- a/moose-core/msg/CMakeLists.txt +++ b/moose-core/msg/CMakeLists.txt @@ -1,11 +1,11 @@ include_directories(../basecode) -add_library(msg +add_library(msg Msg.cpp DiagonalMsg.cpp - OneToAllMsg.cpp + OneToAllMsg.cpp OneToOneMsg.cpp - SingleMsg.cpp - SparseMsg.cpp - OneToOneDataIndexMsg.cpp + SingleMsg.cpp + SparseMsg.cpp + OneToOneDataIndexMsg.cpp testMsg.cpp ) diff --git a/moose-core/msg/DiagonalMsg.cpp b/moose-core/msg/DiagonalMsg.cpp index 3fed6a3b40d68e87c2e493324d58b3687c969cfc..cc1fa5426c7948ac78a6d4790a139eacbda805ee 100644 --- a/moose-core/msg/DiagonalMsg.cpp +++ b/moose-core/msg/DiagonalMsg.cpp @@ -16,7 +16,7 @@ vector< DiagonalMsg* > DiagonalMsg::msg_; DiagonalMsg::DiagonalMsg( Element* e1, Element* e2, unsigned int msgIndex ) : Msg( ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ), - e1, e2 ), + e1, e2 ), stride_( 1 ) { if ( msgIndex == 0 ) { @@ -34,7 +34,7 @@ DiagonalMsg::~DiagonalMsg() msg_[ mid_.dataIndex ] = 0; // ensure deleted ptr isn't reused. } -Eref DiagonalMsg::firstTgt( const Eref& src ) const +Eref DiagonalMsg::firstTgt( const Eref& src ) const { if ( src.element() == e1_ ) { unsigned int nextData = src.dataIndex() + stride_; diff --git a/moose-core/msg/Msg.cpp b/moose-core/msg/Msg.cpp index ec584bacafeedc04bfc6054e180da6c547ef21f4..5d5a3a793ded3a9e3da5816eeb54f65d7d78db7e 100644 --- a/moose-core/msg/Msg.cpp +++ b/moose-core/msg/Msg.cpp @@ -239,11 +239,11 @@ unsigned int Msg::initMsgManagers() // This is to be the parent of all the msg managers. msgManagerId_ = Id::nextId(); - new GlobalDataElement( + new GlobalDataElement( msgManagerId_, Neutral::initCinfo(), "Msgs", 1 ); SingleMsg::managerId_ = Id::nextId(); - new MsgElement( SingleMsg::managerId_, SingleMsg::initCinfo(), + new MsgElement( SingleMsg::managerId_, SingleMsg::initCinfo(), "singleMsg", &SingleMsg::numMsg, &SingleMsg::lookupMsg ); OneToOneMsg::managerId_ = Id::nextId(); @@ -255,18 +255,18 @@ unsigned int Msg::initMsgManagers() "oneToAllMsg", &OneToAllMsg::numMsg, &OneToAllMsg::lookupMsg ); DiagonalMsg::managerId_ = Id::nextId(); - new MsgElement( DiagonalMsg::managerId_, DiagonalMsg::initCinfo(), + new MsgElement( DiagonalMsg::managerId_, DiagonalMsg::initCinfo(), "diagonalMsg", &DiagonalMsg::numMsg, &DiagonalMsg::lookupMsg ); SparseMsg::managerId_ = Id::nextId(); - new MsgElement( SparseMsg::managerId_, SparseMsg::initCinfo(), + new MsgElement( SparseMsg::managerId_, SparseMsg::initCinfo(), "sparseMsg", &SparseMsg::numMsg, &SparseMsg::lookupMsg ); OneToOneDataIndexMsg::managerId_ = Id::nextId(); - new MsgElement( OneToOneDataIndexMsg::managerId_, + new MsgElement( OneToOneDataIndexMsg::managerId_, OneToOneDataIndexMsg::initCinfo(), - "oneToOneDataIndexMsg", - &OneToOneDataIndexMsg::numMsg, + "oneToOneDataIndexMsg", + &OneToOneDataIndexMsg::numMsg, &OneToOneDataIndexMsg::lookupMsg ); // Do the 'adopt' only after all the message managers exist - we need diff --git a/moose-core/msg/Msg.h b/moose-core/msg/Msg.h index 49498e15b36bfca01baa42930ab9fcaf20b8b6e7..cd9cda4fb2b8a3908e0837e71cc0d4bbbbea0e4c 100644 --- a/moose-core/msg/Msg.h +++ b/moose-core/msg/Msg.h @@ -31,14 +31,14 @@ class Msg /** * Obtain the first target Eref for the specified Src Eref - * It is really meant only to work with messages with a + * It is really meant only to work with messages with a * single target ObjId for each given src, typically OneToOne. */ virtual Eref firstTgt( const Eref& src ) const = 0; /** * Return all the sources of e2 from e1, that is, all the msgs - * coming into specified entries on e2 from e1. + * coming into specified entries on e2 from e1. * * ALLDATA used when the * sources include all data entries on a source. @@ -48,8 +48,8 @@ class Msg /** * Return all the targets of e1 on e2, that is, all the msgs - * going from specified entries on e1 to e2. - * ALLDATA used when the + * going from specified entries on e1 to e2. + * ALLDATA used when the * targets include all data entries on a target. * Indexing is v[dataId in range e1.numData][tgt list] */ @@ -108,13 +108,13 @@ class Msg } /** - * Find the other end of this Msg. In most cases this is a + * Find the other end of this Msg. In most cases this is a * straightforward return of e1 or e2, plus perhaps a DataId. * But in some complex msgs we need to figure out * DataIds that match with the target. * In many-to-one cases we just return the first entry. * If no Element match, return ObjId( Id(), DataId::bad() ) - * If Element e matches but not DataId, return + * If Element e matches but not DataId, return * ObjId( e.id(), DataId::bad() ) */ virtual ObjId findOtherEnd( ObjId ) const = 0; @@ -124,7 +124,7 @@ class Msg * Wrapper for findOtherEnd - to expose it as a LookupFinfo. */ ObjId getAdjacent( ObjId ) const; - + /** * Make a copy of this Msg. The original msg was on * origSrc. The new Msg should go from newSrc to newTgt, diff --git a/moose-core/msg/OneToAllMsg.cpp b/moose-core/msg/OneToAllMsg.cpp index 47644cbf4e5f9b8f6afb0f7452a5314d7fca30c4..262e0494a4caa080632a7850ba2399900a7c9267 100644 --- a/moose-core/msg/OneToAllMsg.cpp +++ b/moose-core/msg/OneToAllMsg.cpp @@ -15,9 +15,9 @@ Id OneToAllMsg::managerId_; vector< OneToAllMsg* > OneToAllMsg::msg_; OneToAllMsg::OneToAllMsg( Eref e1, Element* e2, unsigned int msgIndex ) - : - Msg( - ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ), + : + Msg( + ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ), e1.element(), e2 ), i1_( e1.dataIndex() ) @@ -37,7 +37,7 @@ OneToAllMsg::~OneToAllMsg() msg_[ mid_.dataIndex ] = 0; // ensure deleted ptr isn't reused. } -Eref OneToAllMsg::firstTgt( const Eref& src ) const +Eref OneToAllMsg::firstTgt( const Eref& src ) const { if ( src.element() == e1_ ) return Eref( e2_, 0 ); @@ -74,7 +74,7 @@ ObjId OneToAllMsg::findOtherEnd( ObjId f ) const } else if ( f.element() == e2() ) { return ObjId( e1()->id(), i1_ ); } - + return ObjId( 0, BADINDEX ); } diff --git a/moose-core/msg/OneToAllMsg.h b/moose-core/msg/OneToAllMsg.h index 02f5ad79cbafea2720a945a8970699fc98eb8058..1416d38573055bfc9cd1281d97168fa91ecc6843 100644 --- a/moose-core/msg/OneToAllMsg.h +++ b/moose-core/msg/OneToAllMsg.h @@ -11,7 +11,7 @@ #define _ONE_TO_ALL_MSG_H /** - * Manages projection from a single entry in e1 to all + * Manages projection from a single entry in e1 to all * array entries in e2. */ diff --git a/moose-core/msg/OneToOneDataIndexMsg.cpp b/moose-core/msg/OneToOneDataIndexMsg.cpp index 08f637f460d07de42435f66b48c051e625676422..d26f82e953bc2156ab669c16a3423c4893932129 100644 --- a/moose-core/msg/OneToOneDataIndexMsg.cpp +++ b/moose-core/msg/OneToOneDataIndexMsg.cpp @@ -14,8 +14,8 @@ Id OneToOneDataIndexMsg::managerId_; vector< OneToOneDataIndexMsg* > OneToOneDataIndexMsg::msg_; -OneToOneDataIndexMsg::OneToOneDataIndexMsg( - const Eref& e1, const Eref& e2, +OneToOneDataIndexMsg::OneToOneDataIndexMsg( + const Eref& e1, const Eref& e2, unsigned int msgIndex ) : Msg( ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ), e1.element(), e2.element() ) @@ -42,7 +42,7 @@ OneToOneDataIndexMsg::~OneToOneDataIndexMsg() * At this point, the effect of trying to go between regular * data entries and field entries is undefined. */ -Eref OneToOneDataIndexMsg::firstTgt( const Eref& src ) const +Eref OneToOneDataIndexMsg::firstTgt( const Eref& src ) const { if ( src.element() == e1_ ) { return Eref( e2_, src.dataIndex(), 0 ); @@ -87,7 +87,7 @@ ObjId OneToOneDataIndexMsg::findOtherEnd( ObjId f ) const return ObjId( e2()->id(), f.dataIndex ); else if ( f.element() == e2() ) return ObjId( e1()->id(), f.dataIndex ); - + return ObjId( 0, BADINDEX ); } diff --git a/moose-core/msg/OneToOneMsg.cpp b/moose-core/msg/OneToOneMsg.cpp index 9b07d0702760b870f803b8f5a159e41b60112787..e1625eae02cf8882a39aba35a8865a796600bc57 100644 --- a/moose-core/msg/OneToOneMsg.cpp +++ b/moose-core/msg/OneToOneMsg.cpp @@ -14,7 +14,7 @@ Id OneToOneMsg::managerId_; vector< OneToOneMsg* > OneToOneMsg::msg_; -OneToOneMsg::OneToOneMsg( const Eref& e1, const Eref& e2, +OneToOneMsg::OneToOneMsg( const Eref& e1, const Eref& e2, unsigned int msgIndex ) : Msg( ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ), e1.element(), e2.element() ), @@ -43,12 +43,12 @@ OneToOneMsg::~OneToOneMsg() * At this point, the effect of trying to go between regular * data entries and field entries is undefined. */ -Eref OneToOneMsg::firstTgt( const Eref& src ) const +Eref OneToOneMsg::firstTgt( const Eref& src ) const { if ( src.element() == e1_ ) { if ( e2_->hasFields() ) return Eref( e2_, i2_, src.dataIndex() ); - else + else return Eref( e2_, src.dataIndex(), 0 ); } else if ( src.element() == e2_ ) { return Eref( e1_, src.dataIndex() ); @@ -64,7 +64,7 @@ void OneToOneMsg::sources( vector< vector< Eref > > & v) const if ( e2_->hasFields() ) { if ( Eref( e2_, i2_ ).isDataHere() ) { assert( i2_ > e2_->localDataStart() ); - unsigned int nf = e2_->numField( i2_ - e2_->localDataStart() ); + unsigned int nf = e2_->numField( i2_ - e2_->localDataStart() ); if ( n > nf ) n = nf; v.resize( n ); @@ -89,7 +89,7 @@ void OneToOneMsg::targets( vector< vector< Eref > > & v) const if ( e2_->hasFields() ) { if ( Eref( e2_, i2_ ).isDataHere() ) { assert( i2_ > e2_->localDataStart() ); - unsigned int nf = e2_->numField( i2_ - e2_->localDataStart() ); + unsigned int nf = e2_->numField( i2_ - e2_->localDataStart() ); if ( n > nf ) n = nf; for ( unsigned int i = 0; i < n; ++i ) @@ -121,7 +121,7 @@ ObjId OneToOneMsg::findOtherEnd( ObjId f ) const return ObjId( e2()->id(), f.dataIndex ); else if ( f.element() == e2() ) return ObjId( e1()->id(), f.dataIndex ); - + return ObjId( 0, BADINDEX ); } diff --git a/moose-core/msg/OneToOneMsg.h b/moose-core/msg/OneToOneMsg.h index b337495d279f668d8a0e80f76b0f7b310fbd8e90..6a42807050546ed6b48c17ec7dd56c6f6616cc2e 100644 --- a/moose-core/msg/OneToOneMsg.h +++ b/moose-core/msg/OneToOneMsg.h @@ -16,7 +16,7 @@ * in dest array. * If there is a mismatch in number of entries, the overhang is ignored. * If the dest array is a FieldElement, then it uses its internal DataId - * i2_ to fill in the DataIndex for the dest. The OneToOne matching is + * i2_ to fill in the DataIndex for the dest. The OneToOne matching is * assumed to be between DataIndex on e1 and FieldIndex on e2. */ class OneToOneMsg: public Msg diff --git a/moose-core/msg/SingleMsg.cpp b/moose-core/msg/SingleMsg.cpp index e98128e5b248be1f08432df87f37ae7aa8f2c27f..8286e2e75414928e73192aed52c4bb328e4eab9c 100644 --- a/moose-core/msg/SingleMsg.cpp +++ b/moose-core/msg/SingleMsg.cpp @@ -19,9 +19,9 @@ vector< SingleMsg* > SingleMsg::msg_; ///////////////////////////////////////////////////////////////////// SingleMsg::SingleMsg( const Eref& e1, const Eref& e2, unsigned int msgIndex) - : Msg( ObjId( managerId_, (msgIndex != 0 ) ? msgIndex: msg_.size() ), + : Msg( ObjId( managerId_, (msgIndex != 0 ) ? msgIndex: msg_.size() ), e1.element(), e2.element() ), - i1_( e1.dataIndex() ), + i1_( e1.dataIndex() ), i2_( e2.dataIndex() ), f2_( e2.fieldIndex() ) { @@ -40,7 +40,7 @@ SingleMsg::~SingleMsg() msg_[ mid_.dataIndex ] = 0; // ensure deleted ptr isn't reused. } -Eref SingleMsg::firstTgt( const Eref& src ) const +Eref SingleMsg::firstTgt( const Eref& src ) const { if ( src.element() == e1_ ) return Eref( e2_, i2_, f2_ ); @@ -85,7 +85,7 @@ DataId SingleMsg::i2() const return i2_; } -Id SingleMsg::managerId() const +Id SingleMsg::managerId() const { return SingleMsg::managerId_; } @@ -109,11 +109,11 @@ Msg* SingleMsg::copy( Id origSrc, Id newSrc, Id newTgt, if ( n <= 1 ) { SingleMsg* ret = 0; if ( orig == e1() ) { - ret = new SingleMsg( Eref( newSrc.element(), i1_ ), + ret = new SingleMsg( Eref( newSrc.element(), i1_ ), Eref( newTgt.element(), i2_, f2_ ), 0 ); ret->e1()->addMsgAndFunc( ret->mid(), fid, b ); } else if ( orig == e2() ) { - ret = new SingleMsg( Eref( newTgt.element(), i1_ ), + ret = new SingleMsg( Eref( newTgt.element(), i1_ ), Eref( newSrc.element(), i2_, f2_ ), 0 ); ret->e2()->addMsgAndFunc( ret->mid(), fid, b ); } else { diff --git a/moose-core/msg/SingleMsg.h b/moose-core/msg/SingleMsg.h index 598e46abb06ab160d0009fbf1734aeadf72cc981..88e6a5316afa35270918a3cfd60cb82c787049b1 100644 --- a/moose-core/msg/SingleMsg.h +++ b/moose-core/msg/SingleMsg.h @@ -11,7 +11,7 @@ #define _SINGLE_MSG_H /** - * This is a message from a single source object to a single target + * This is a message from a single source object to a single target * object. The source object must be a DataEntry. The target object * may be on a FieldElement, and the target specification includes the * index of the field object. @@ -39,7 +39,7 @@ class SingleMsg: public Msg Msg* copy( Id origSrc, Id newSrc, Id newTgt, FuncId fid, unsigned int b, unsigned int n ) const; - + void setI1( DataId di ); DataId getI1() const; diff --git a/moose-core/msg/SparseMsg.cpp b/moose-core/msg/SparseMsg.cpp index 44f79d135eac65ea8109b40d370e3d816af26c8e..7511aa0f50a3bd437011e33bf60d66576d7e974b 100644 --- a/moose-core/msg/SparseMsg.cpp +++ b/moose-core/msg/SparseMsg.cpp @@ -42,6 +42,40 @@ const Cinfo* SparseMsg::initCinfo() &SparseMsg::getNumEntries ); + static ValueFinfo< SparseMsg, vector< unsigned int > > connectionList( + "connectionList", + "Pairwise specification of connection matrix where each x,y value " + "represents a connection from src[x] to dest[y]. " + "The (x,y) entries are ordered in a single vector as \n" + "(x0, x1,... x_n-1, y0, y1,... y_n-1)\n", + &SparseMsg::setEntryPairs, + &SparseMsg::getEntryPairs + ); + + /// Connection matrix entries to manipulate in Python. + static ReadOnlyValueFinfo< SparseMsg, vector< unsigned int > > + matrixEntry( + "matrixEntry", + "The non-zero matrix entries in the sparse matrix. Their" + "column indices are in a separate vector and the row" + "informatino in a third", + &SparseMsg::getMatrixEntry + ); + /// connection matrix column indices to manipulate in Python. + static ReadOnlyValueFinfo< SparseMsg, vector< unsigned int > > + columnIndex( + "columnIndex", + "Column Index of each matrix entry", + &SparseMsg::getColIndex + ); + /// connection matrix rowStart to manipulate in Python. + static ReadOnlyValueFinfo< SparseMsg, vector< unsigned int > > + rowStart( + "rowStart", + "Row start for each block of entries and column indices", + &SparseMsg::getRowStart + ); + static ValueFinfo< SparseMsg, double > probability( "probability", "connection probability for random connectivity.", @@ -62,45 +96,52 @@ const Cinfo* SparseMsg::initCinfo() static DestFinfo setRandomConnectivity( "setRandomConnectivity", "Assigns connectivity with specified probability and seed", - new OpFunc2< SparseMsg, double, long >( + 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 >( + 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 >( + new OpFunc2< SparseMsg, unsigned int, unsigned int >( &SparseMsg::unsetEntry ) ); static DestFinfo clear( "clear", "Clears out the entire matrix", - new OpFunc0< SparseMsg >( + new OpFunc0< SparseMsg >( &SparseMsg::clear ) ); static DestFinfo transpose( "transpose", "Transposes the sparse matrix", - new OpFunc0< SparseMsg >( + 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> >( + 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, + new OpFunc3< SparseMsg, vector< unsigned int >, 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 ) ); + //////////////////////////////////////////////////////////////////////// // Assemble it all. //////////////////////////////////////////////////////////////////////// @@ -109,6 +150,10 @@ const Cinfo* SparseMsg::initCinfo() &numRows, // readonly value &numColumns, // readonly value &numEntries, // readonly value + &connectionList, // value + &matrixEntry, // ReadOnlyValue + &columnIndex, // ReadOnlyValue + &rowStart, // ReadOnlyValue &probability, // value &seed, // value &setRandomConnectivity, // dest @@ -118,6 +163,7 @@ const Cinfo* SparseMsg::initCinfo() &transpose, //dest &pairFill, //dest &tripletFill, //dest + &tripletFill1, //dest }; static Dinfo< short > dinfo; @@ -176,6 +222,43 @@ unsigned int SparseMsg::getNumEntries() const return matrix_.nEntries(); } +vector< unsigned int > SparseMsg::getMatrixEntry() const +{ + return matrix_.matrixEntry(); +} + +vector< unsigned int > SparseMsg::getColIndex() const +{ + return matrix_.colIndex(); +} + +vector< unsigned int > SparseMsg::getRowStart() const +{ + return matrix_.rowStart(); +} + +void SparseMsg::setEntryPairs( vector< unsigned int > v ) +{ + vector< unsigned int > src( v.begin(), v.begin() + v.size()/2 ); + vector< unsigned int > dest( v.begin() + v.size()/2, v.end() ); + pairFill( src, dest ); +} + +vector< unsigned int > SparseMsg::getEntryPairs() const +{ + vector< unsigned int > cols = matrix_.colIndex(); + vector< unsigned int > y; + for ( unsigned int row = 0; row < matrix_.nRows(); ++row ) { + unsigned int begin = matrix_.rowStart()[row]; + unsigned int end = matrix_.rowStart()[row+1]; + for ( unsigned int j = begin; j < end; ++j ) + y.push_back( row ); + } + assert( cols.size() == y.size() ); + y.insert( y.end(), cols.begin(), cols.end() ); + return y; +} + ////////////////////////////////////////////////////////////////// // DestFields ////////////////////////////////////////////////////////////////// @@ -215,21 +298,57 @@ void SparseMsg::updateAfterFill() { unsigned int startData = e2_->localDataStart(); unsigned int endData = startData + e2_->numLocalData(); - for ( unsigned int i = 0; i < matrix_.nRows(); ++ i ) { + SparseMatrix< unsigned int > temp( matrix_); + temp.transpose(); + for ( unsigned int i = 0; i < temp.nRows(); ++ i ) { const unsigned int* colIndex; const unsigned int* entry; - unsigned int num = matrix_.getRow( i, &entry, &colIndex ); + unsigned int num = temp.getRow( i, &entry, &colIndex ); if ( i >= startData && i < endData ) { - e2_->resizeField( i - startData, num ); + // Inefficient. Better to do it in one pass after getting + // the max num + e2_->resizeField( i - startData, num + 1 ); } } e1()->markRewired(); e2()->markRewired(); } + void SparseMsg::pairFill( vector< unsigned int > src, vector< unsigned int> dest ) { - matrix_.pairFill( src, dest, 0 ); + // Sanity check + vector< unsigned int >::const_iterator i; + for ( i = src.begin(); i != src.end(); ++i ) { + if (*i >= e1()->numData() ) { + cout << "Warning: SparseMsg::pairFill: Src index " << *i << + " exceeds Src array size " << e1()->numData() << + ". Aborting\n"; + return; + } + } + for ( i = dest.begin(); i != dest.end(); ++i ) { + if (*i >= e2()->numData() ) { + cout << "Warning: SparseMsg::pairFill: Dest index " << *i << + " exceeds Dest array size " << e2()->numData() << + ". Aborting\n"; + return; + } + } + + vector< unsigned int > numAtDest( dest.size(), 0 ); + vector< unsigned int > fieldIndex( dest.size(), 0 ); + for ( unsigned int i = 0; i < dest.size(); ++i ) { + fieldIndex[i] = numAtDest[ dest[i] ]; + // Could do on previous line, but clarity + ++numAtDest[ dest[i] ]; + } + + /** + * We set retainSize flag to true since the # of src/dest objects + * doesn't change. We can explicitly assign it elsewhere if needed. + */ + matrix_.tripletFill( src, dest, fieldIndex, true ); updateAfterFill(); } @@ -237,10 +356,20 @@ void SparseMsg::tripletFill( vector< unsigned int > src, vector< unsigned int> destDataIndex, vector< unsigned int> destFieldIndex ) { - matrix_.tripletFill( src, destDataIndex, destFieldIndex ); + // We set retainSize flag to true + matrix_.tripletFill( src, destDataIndex, destFieldIndex, true ); updateAfterFill(); } +void SparseMsg::tripletFill1( vector< unsigned int > v ) +{ + unsigned int s3 = v.size() / 3; + vector< unsigned int > src( v.begin(), v.begin() + s3 ); + vector< unsigned int > dest( v.begin() + s3, v.begin() + 2 * s3 ); + vector< unsigned int > fieldIndex( v.begin() + 2 * s3, v.end() ); + tripletFill( src, dest, fieldIndex ); +} + ////////////////////////////////////////////////////////////////// // Here are the actual class functions ////////////////////////////////////////////////////////////////// @@ -248,7 +377,10 @@ void SparseMsg::tripletFill( vector< unsigned int > src, SparseMsg::SparseMsg( Element* e1, Element* e2, unsigned int msgIndex ) : Msg( ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ), - e1, e2 ) + e1, e2 ), + numThreads_( 1 ), + nrows_( 0 ), + p_( 0.0 ), seed_( 0 ) { unsigned int nrows = 0; unsigned int ncolumns = 0; @@ -280,7 +412,7 @@ unsigned int rowIndex( const Element* e, const DataId& d ) } -Eref SparseMsg::firstTgt( const Eref& src ) const +Eref SparseMsg::firstTgt( const Eref& src ) const { if ( matrix_.nEntries() == 0 ) return Eref( 0, 0 ); @@ -301,7 +433,7 @@ Eref SparseMsg::firstTgt( const Eref& src ) const /** * Returns number of synapses formed. - * Fills it in transpose form, because we need to count and index the + * Fills it in transpose form, because we need to count and index the * number of synapses on the target, so we need to iterate over the sources * in the inner loop. Once full, does the transpose. * Should really have a seed argument for the random number. @@ -338,7 +470,7 @@ unsigned int SparseMsg::randomConnect( double probability ) synIndex.push_back( ~0 ); } } - + if ( i >= startData && i < endData ) { e2_->resizeField( i - startData, synNum ); } @@ -427,8 +559,8 @@ Msg* SparseMsg::copy( Id origSrc, Id newSrc, Id newTgt, } } -void fillErefsFromMatrix( - const SparseMatrix< unsigned int >& matrix, +void fillErefsFromMatrix( + const SparseMatrix< unsigned int >& matrix, vector< vector < Eref > >& v, Element* e1, Element* e2 ) { v.clear(); diff --git a/moose-core/msg/SparseMsg.h b/moose-core/msg/SparseMsg.h index 2dffb9af75d8e2e756ebc6308d0c66dde84d4ec8..7df5e26f736cc69f1bf2804e3be6ee4c88a8cf79 100644 --- a/moose-core/msg/SparseMsg.h +++ b/moose-core/msg/SparseMsg.h @@ -23,7 +23,7 @@ * equivalent of the original sparse matrix, but using only the appropriate * RNG seed. * - * A typical case is from an array of IntFire objects to an array of + * A typical case is from an array of IntFire objects to an array of * Synapses, which are array fields of IntFire objects. * The sparse connectivity maps between the source IntFire and target * Synapses. @@ -35,7 +35,7 @@ * any two IntFire objects. * * It is optimized for input coming on Element e1, and going to Element e2. - * If you expect any significant backward data flow, please use + * If you expect any significant backward data flow, please use * BiSparseMsg. * It can be modified after creation to add or remove message entries. */ @@ -50,7 +50,7 @@ class SparseMsg: public Msg void sources( vector< vector< Eref > >& v ) const; void targets( vector< vector< Eref > >& v ) const; - + unsigned int randomConnect( double probability ); Id managerId() const; @@ -82,7 +82,10 @@ class SparseMsg: public Msg long getSeed() const; void setSeed( long value ); - void setEntry( unsigned int row, unsigned int column, + vector< unsigned int > getEntryPairs() const; + void setEntryPairs( vector< unsigned int > entries ); + + void setEntry( unsigned int row, unsigned int column, unsigned int value ); void unsetEntry( unsigned int row, unsigned int column ); @@ -99,17 +102,25 @@ class SparseMsg: public Msg * Fills up the entire message based on pairs of src,dest (i.e., * row,column) values. All filled entries are set to zero. */ - void pairFill( vector< unsigned int > src, + void pairFill( vector< unsigned int > src, vector< unsigned int> dest ); /** - * Fills up the entire message based on triplets of + * Fills up the entire message based on triplets of * src,destDataIndex,destFieldIndex */ - void tripletFill( vector< unsigned int > src, + void tripletFill( vector< unsigned int > src, vector< unsigned int> dest, vector< unsigned int > field ); - + + /** + * Fills up the entire message based on triplets of + * src,destDataIndex,destFieldIndex, but catenates them all into + * a single long vector since PyMoose doesn't know how to handle + * multiple vectors. + */ + void tripletFill1( vector< unsigned int > entries ); + /** * Utility function to update all sorts of values after we've * rebuilt the matrix. diff --git a/moose-core/msg/testMsg.cpp b/moose-core/msg/testMsg.cpp index 1b8e0cce4a2ad96a14c52e3dad44c8adaa11b071..90d7fae58bebf6026f32efbc3b2aecbc9bcb670a 100644 --- a/moose-core/msg/testMsg.cpp +++ b/moose-core/msg/testMsg.cpp @@ -60,27 +60,27 @@ void testAssortedMsg() // Set up messaging /////////////////////////////////////////////////////////// // Should give 04000 - ObjId m1 = shell->doAddMsg( "Single", + ObjId m1 = shell->doAddMsg( "Single", ObjId( a1, 3 ), "output", ObjId( a2, 1 ), "arg1" ); assert( !m1.bad() ); // Should give 33333 - ObjId m2 = shell->doAddMsg( "OneToAll", + ObjId m2 = shell->doAddMsg( "OneToAll", ObjId( b1, 2 ), "output", ObjId( b2, 0 ), "arg1" ); assert( !m2.bad() ); // Should give 12345 - ObjId m3 = shell->doAddMsg( "OneToOne", + ObjId m3 = shell->doAddMsg( "OneToOne", ObjId( c1, 0 ), "output", ObjId( c2, 0 ), "arg1" ); assert( !m3.bad() ); // Should give 01234 - ObjId m4 = shell->doAddMsg( "Diagonal", + ObjId m4 = shell->doAddMsg( "Diagonal", ObjId( d1, 0 ), "output", ObjId( d2, 0 ), "arg1" ); assert( !m4.bad() ); // Should give 54321 - ObjId m5 = shell->doAddMsg( "Sparse", + ObjId m5 = shell->doAddMsg( "Sparse", ObjId( e1, 0 ), "output", ObjId( e2, 0 ), "arg1" ); assert( !m5.bad() ); @@ -236,19 +236,19 @@ void testMsgElementListing() /////////////////////////////////////////////////////////// // Set up messaging /////////////////////////////////////////////////////////// - ObjId m1 = shell->doAddMsg( "Single", + ObjId m1 = shell->doAddMsg( "Single", ObjId( a1, 3 ), "output", ObjId( a2, 1 ), "arg1" ); assert( !m1.bad() ); - ObjId m2 = shell->doAddMsg( "OneToAll", + ObjId m2 = shell->doAddMsg( "OneToAll", ObjId( b1, 2 ), "output", ObjId( b2, 0 ), "arg1" ); assert( !m2.bad() ); - ObjId m3 = shell->doAddMsg( "OneToOne", + ObjId m3 = shell->doAddMsg( "OneToOne", ObjId( c1, 0 ), "output", ObjId( c2, 0 ), "arg1" ); assert( !m3.bad() ); - ObjId m4 = shell->doAddMsg( "Diagonal", + ObjId m4 = shell->doAddMsg( "Diagonal", ObjId( d1, 0 ), "output", ObjId( d2, 0 ), "arg1" ); assert( !m4.bad() ); - ObjId m5 = shell->doAddMsg( "Sparse", + ObjId m5 = shell->doAddMsg( "Sparse", ObjId( e1, 0 ), "output", ObjId( e2, 0 ), "arg1" ); assert( !m5.bad() ); @@ -257,7 +257,7 @@ void testMsgElementListing() /////////////////////////////////////////////////////////// Id manager( "/Msgs" ); assert( manager != Id() ); - vector< Id > children = + vector< Id > children = Field< vector< Id > >::get( manager, "children" ); assert( children.size() == 5 ); assert( children[0].element()->getName() == "singleMsg" ); @@ -271,13 +271,13 @@ void testMsgElementListing() // OneToAll which are used by parent-child messages. I thought they // were cleaned out as the tests proceed. for ( unsigned int i = 0; i < children.size(); ++i ) { - cout << "\nlocalEntries[" << i << "] = " << + cout << "\nlocalEntries[" << i << "] = " << children[i].element()->dataHandler()->localEntries() << endl; } */ /* string path = children[0].path(); - cout << "\nlocalEntries = " << + cout << "\nlocalEntries = " << children[0].element()->dataHandler()->localEntries() << endl; assert( path == "/Msgs/singleMsg[0]" ); */ @@ -315,36 +315,36 @@ void benchmarkMsg( unsigned int n, string msgType ) if ( msgType == "Single" ) { for ( unsigned int i = 0; i < n; ++i ) { for ( unsigned int j = 0; j < n; ++j ) { - ObjId m1 = shell->doAddMsg( "Single", + ObjId m1 = shell->doAddMsg( "Single", ObjId( a1, i ), "output", ObjId( a1, j ), "arg3" ); assert( !m1.bad() ); } } } else if ( msgType == "OneToAll" ) { for ( unsigned int i = 0; i < n; ++i ) { - ObjId m1 = shell->doAddMsg( "OneToAll", + ObjId m1 = shell->doAddMsg( "OneToAll", ObjId( a1, i ), "output", ObjId( a1, 0 ), "arg3" ); assert( !m1.bad() ); } } else if ( msgType == "OneToOne" ) { for ( unsigned int i = 0; i < n; ++i ) { // just repeat it n times - ObjId m1 = shell->doAddMsg( "OneToOne", + ObjId m1 = shell->doAddMsg( "OneToOne", ObjId( a1, 0 ), "output", ObjId( a1, 0 ), "arg3" ); assert( !m1.bad() ); } } else if ( msgType == "Diagonal" ) { for ( unsigned int i = 0; i < 2 * n; ++i ) { // Set up all offsets - ObjId m1 = shell->doAddMsg( "Diagonal", + ObjId m1 = shell->doAddMsg( "Diagonal", ObjId( a1, 0 ), "output", ObjId( a1, 0 ), "arg3" ); Field< int >::set( m1, "stride", n - i ); } } else if ( msgType == "Sparse" ) { - ObjId m1 = shell->doAddMsg( "Sparse", + ObjId m1 = shell->doAddMsg( "Sparse", ObjId( a1, 0 ), "output", ObjId( a1, 0 ), "arg3" ); - - SetGet2< double, long >::set( m1, + + SetGet2< double, long >::set( m1, "setRandomConnectivity", 1.0, 1234 ); - } + } shell->doUseClock( "/a1", "proc", 0 ); for ( unsigned int i = 0; i < 10; ++i ) diff --git a/moose-core/pymoose/CMakeLists.txt b/moose-core/pymoose/CMakeLists.txt index b2887ee7b3b78b8810df4e9b9e98d796ba52eda8..4ccdf49556df08c67344e7819aab6820b5653603 100644 --- a/moose-core/pymoose/CMakeLists.txt +++ b/moose-core/pymoose/CMakeLists.txt @@ -1,13 +1,13 @@ add_definitions(-DPYMOOSE) include_directories(../basecode ../msg) -set(PYMOOSE_SRCS +set(PYMOOSE_SRCS moosemodule.cpp vec.cpp mfield.cpp pymooseinit.cpp melement.cpp - test_moosemodule.cpp + test_moosemodule.cpp PyRun.cpp ) add_library( _moose MODULE ${PYMOOSE_SRCS} ) @@ -35,7 +35,7 @@ execute_process( COMMAND ${PYTHON_EXECUTABLE}-config --libs OUTPUT_STRIP_TRAILING_WHITESPACE ) message( STATUS "Python include flags: ${PYTHON_INCLUDE_FLAGS}" ) -set_target_properties(_moose PROPERTIES +set_target_properties(_moose PROPERTIES COMPILE_DEFINITIONS "PYMOOSE" COMPILE_FLAGS "${PYTHON_INCLUDE_FLAGS}" LIBRARY_OUTPUT_DIRECTORY ${PYMOOSE_OUTPUT_DIRECTORY} @@ -60,7 +60,7 @@ if(MACOSX) endif(MACOSX) if(MACOSX) - target_link_libraries( _moose + target_link_libraries( _moose "-Wl,-all_load" ${MOOSE_LIBRARIES} ${STATIC_LIBRARIES} @@ -69,7 +69,7 @@ if(MACOSX) ${SYSTEM_SHARED_LIBS} ) ELSE(MACOSX) - target_link_libraries(_moose + target_link_libraries(_moose "-Wl,--whole-archive" ${MOOSE_LIBRARIES} ${STATIC_LIBRARIES} @@ -83,8 +83,8 @@ endif(MACOSX) add_custom_target(copy_python_files ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/python ${CMAKE_BINARY_DIR}/python - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/VERSION ${CMAKE_BINARY_DIR}/VERSION + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/VERSION ${CMAKE_BINARY_DIR}/VERSION COMMENT "Copying required python files and other files to build directory" VERBATIM ) diff --git a/moose-core/pymoose/PyRun.h b/moose-core/pymoose/PyRun.h index 0efbed90cdf74e45417e92b98064d65fcdfb26a7..8f8d061236b84cb7d788be5dd71f966420b6264e 100644 --- a/moose-core/pymoose/PyRun.h +++ b/moose-core/pymoose/PyRun.h @@ -1,47 +1,47 @@ -// PyRun.h --- -// +// PyRun.h --- +// // Filename: PyRun.h -// Description: +// Description: // Author: subha -// Maintainer: +// Maintainer: // Created: Sat Oct 11 14:40:45 2014 (+0530) -// Version: +// Version: // Last-Updated: Fri Jun 19 18:54:49 2015 (-0400) // By: Subhasis Ray // Update #: 31 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// // Class to call Python functions from MOOSE -// -// +// +// // 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: @@ -70,7 +70,7 @@ string get_program_name() return string(progname); } #endif - + /** PyRun allows caling Python functions from moose. */ @@ -80,10 +80,10 @@ public: static const int RUNPROC; // only process call static const int RUNTRIG; // only trigger call static const int RUNBOTH; // both - + PyRun(); ~PyRun(); - + void setInitString(string str); string getInitString() const; @@ -92,7 +92,7 @@ public: void setGlobals(PyObject *globals); PyObject * getGlobals() const; - + void setLocals(PyObject *locals); PyObject * getLocals() const; @@ -101,17 +101,17 @@ public: void setInputVar(string name); string getInputVar() const; - + void setOutputVar(string name); string getOutputVar() const; - + void run(const Eref& e, string statement); void trigger(const Eref& e, double input); // this is a way to trigger execution via incoming message - can be useful for debugging - + void process(const Eref& e, ProcPtr p); void reinit(const Eref& e, ProcPtr p); - + static const Cinfo * initCinfo(); protected: @@ -130,5 +130,5 @@ protected: -// +// // PyRun.h ends here diff --git a/moose-core/pymoose/moosemodule.cpp b/moose-core/pymoose/moosemodule.cpp index 70295a156cc325bf1a3c2d7dd3e1ff900b98b9eb..54ed633eb331dfef8d2b5938782b5e48d8f2fc0f 100644 --- a/moose-core/pymoose/moosemodule.cpp +++ b/moose-core/pymoose/moosemodule.cpp @@ -1073,12 +1073,15 @@ void finalize() // free(classObject->tp_name); // skipping this as not sure whether this is useful - all gets deallocated at exit anyways. // } // get_moose_classes().clear(); + SHELLPTR->doQuit(); Msg::clearAllMsgs(); Id::clearAllElements(); + #ifdef USE_MPI MPI_Finalize(); #endif + } //! finalize() @@ -3122,8 +3125,10 @@ static struct PyModuleDef MooseModuleDef = PyMODINIT_FUNC MODINIT(_moose) { clock_t modinit_start = clock(); - PyGILState_STATE gstate; - gstate = PyGILState_Ensure(); + + //PyGILState_STATE gstate; + //gstate = PyGILState_Ensure(); + // First of all create the Shell. We convert the environment // variables into c-like argv array vector<string> args = setup_runtime_env(); @@ -3134,6 +3139,7 @@ PyMODINIT_FUNC MODINIT(_moose) argv[ii] = (char*)(calloc(args[ii].length()+1, sizeof(char))); strncpy(argv[ii], args[ii].c_str(), args[ii].length()+1); } + // Should not call. No pthreads now. PyEval_InitThreads(); Id shellId = getShell(argc, argv); for (int ii = 1; ii < argc; ++ii) @@ -3249,7 +3255,7 @@ PyMODINIT_FUNC MODINIT(_moose) << (defclasses_end - defclasses_start) * 1.0 /CLOCKS_PER_SEC ); - PyGILState_Release(gstate); + //PyGILState_Release(gstate); clock_t modinit_end = clock(); LOG( moose::info, "`Time to initialize module:" diff --git a/moose-core/pymoose/test_moosemodule.cpp b/moose-core/pymoose/test_moosemodule.cpp index 5eedaec268b3b4893acc559a491ecd69e5606be0..06a032158f78f221b20fb1988ee32794fcda15f9 100644 --- a/moose-core/pymoose/test_moosemodule.cpp +++ b/moose-core/pymoose/test_moosemodule.cpp @@ -1,4 +1,4 @@ -// test_moosemodule.cpp --- +// test_moosemodule.cpp --- // // Filename: test_moosemodule.cpp // Description: diff --git a/moose-core/python/moose/SBML/__init__.py b/moose-core/python/moose/SBML/__init__.py index a3b90826a4285f33c761e90ceffd00e3f389ee25..a0f18632489c2ab6e4fb05368f30f5909129dd09 100755 --- a/moose-core/python/moose/SBML/__init__.py +++ b/moose-core/python/moose/SBML/__init__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from .writeSBML import mooseWriteSBML from .readSBML import mooseReadSBML diff --git a/moose-core/python/moose/SBML/readSBML.py b/moose-core/python/moose/SBML/readSBML.py index 5747765be0fa07ee7de5ca40547e1ad4b162590a..aa3216526126dc6c1a63ff97f4e4a778dfef178e 100644 --- a/moose-core/python/moose/SBML/readSBML.py +++ b/moose-core/python/moose/SBML/readSBML.py @@ -1,22 +1,45 @@ +# -*- coding: utf-8 -*- + ''' ******************************************************************* - * File: readSBML.py - * Description: - * Author: HarshaRani - * E-mail: hrani@ncbs.res.in - ********************************************************************/ - -/********************************************************************** -** This program is part of 'MOOSE', the -** Messaging Object Oriented Simulation Environment, -** also known as GENESIS 3 base code. -** copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS -Created : Thu May 12 10:19:00 2016(+0530) -Version -Last-Updated: Wed Jan 11 2017 - By: +* File: readSBML.py +* Description: +* Author: HarshaRani +* E-mail: hrani@ncbs.res.in +* This program is part of 'MOOSE', the +* Messaging Object Oriented Simulation Environment, +* also known as GENESIS 3 base code. +* copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS +* +* Created : Thu May 12 10:19:00 2016(+0530) +* Version +* Last-Updated: Wed Jan 11 2017 +* By: **********************************************************************/ +TODO in +- Compartment + --Need to add group + --Need to deal with compartment outside +- Molecule + -- Need to add group + -- mathML only AssisgmentRule is taken partly I have checked addition and multiplication, + --, need to do for other calculation. + -- In Assisgment rule one of the variable is a function, in moose since assignment is done using function, + function can't get input from another function (model 000740 in l3v1) +- Loading Model from SBML + --Tested 1-30 testcase example model provided by l3v1 and l2v4 std. + ---These are the models that worked (sbml testcase)1-6,10,14-15,17-21,23-25,34,35,58 +- Need to check + ----what to do when boundarycondition is true i.e., + differential equation derived from the reaction definitions + should not be calculated for the species(7-9,11-13,16) + ----kineticsLaw, Math fun has fraction,ceiling,reminder,power 28etc. + ----Events to be added 26 + ----initial Assisgment for compartment 27 + ----when stoichiometry is rational number 22 + ---- For Michaelis Menten kinetics km is not defined which is most of the case need to calculate + ''' import sys @@ -25,31 +48,6 @@ import collections import moose from .validation import validateModel -''' - TODO in - -Compartment - --Need to add group - --Need to deal with compartment outside - -Molecule - -- Need to add group - -- mathML only AssisgmentRule is taken partly I have checked addition and multiplication, - --, need to do for other calculation. - -- In Assisgment rule one of the variable is a function, in moose since assignment is done using function, - function can't get input from another function (model 000740 in l3v1) - -Loading Model from SBML - --Tested 1-30 testcase example model provided by l3v1 and l2v4 std. - ---These are the models that worked (sbml testcase)1-6,10,14-15,17-21,23-25,34,35,58 - ---Need to check - ----what to do when boundarycondition is true i.e., - differential equation derived from the reaction definitions - should not be calculated for the species(7-9,11-13,16) - ----kineticsLaw, Math fun has fraction,ceiling,reminder,power 28etc. - ----Events to be added 26 - ----initial Assisgment for compartment 27 - ----when stoichiometry is rational number 22 - ---- For Michaelis Menten kinetics km is not defined which is most of the case need to calculate -''' - foundLibSBML_ = False try: import libsbml @@ -60,7 +58,7 @@ except ImportError: def mooseReadSBML(filepath, loadpath, solver="ee"): global foundLibSBML_ if not foundLibSBML_: - print('No python-libsbml found.' + print('No python-libsbml found.' '\nThis module can be installed by following command in terminal:' '\n\t easy_install python-libsbl' ) @@ -1121,7 +1119,7 @@ if __name__ == "__main__": filepath = sys.argv[1] if not os.path.exists(filepath): print("Filename or path does not exist",filepath) - + else: try: sys.argv[2] diff --git a/moose-core/python/moose/SBML/validation.py b/moose-core/python/moose/SBML/validation.py index 41ab4140b6a1a1ae659d2738fd0471e793756fcb..8b6569229483931e0a7c57ab05883c704610570f 100644 --- a/moose-core/python/moose/SBML/validation.py +++ b/moose-core/python/moose/SBML/validation.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- foundLibSBML_ = False try: from libsbml import * @@ -10,7 +11,7 @@ def validateModel(sbmlDoc): tobecontinued = False for i in range(0,sbmlDoc.getNumErrors()): print (sbmlDoc.getError(i).getMessage()) - return False + return False if (not sbmlDoc): print("validateModel: given a null SBML Document") @@ -39,11 +40,11 @@ def validateModel(sbmlDoc): constStr = sbmlDoc.printErrors() if sbmlDoc.printErrors(): consistencyMessages = constStr - + # If the internal checks fail, it makes little sense to attempt # further validation, because the model may be too compromised to # be properly interpreted. - + if (numConsistencyErrors > 0): consistencyMessages += "Further validation aborted." else: @@ -63,7 +64,7 @@ def validateModel(sbmlDoc): warning = sbmlDoc.getErrorLog().toString() oss = sbmlDoc.printErrors() validationMessages = oss - + if (noProblems): return True else: diff --git a/moose-core/python/moose/SBML/writeSBML.py b/moose-core/python/moose/SBML/writeSBML.py index 7bf1727e3d0533fb0f69b6c1ef72fbdcdc4248c6..82ce209f38c1a08272c2d154980e22ebd0fcf094 100644 --- a/moose-core/python/moose/SBML/writeSBML.py +++ b/moose-core/python/moose/SBML/writeSBML.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ''' ******************************************************************* * File: writeSBML.py @@ -42,10 +43,10 @@ except Exception as e: pass def mooseWriteSBML(modelpath, filename, sceneitems={}): - global foundLibSBML_ + global foundLibSBML_ msg = " " if not foundLibSBML_: - print('No python-libsbml found.' + print('No python-libsbml found.' '\nThis module can be installed by following command in terminal:' '\n\t easy_install python-libsbml' ) @@ -96,7 +97,7 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}): setupItem(modelpath,srcdesConnection) if not positionInfoexist: autoCoordinates(meshEntry,srcdesConnection) - + writeUnits(cremodel_) modelAnno = writeSimulationAnnotation(modelpath) if modelAnno: @@ -921,7 +922,7 @@ if __name__ == "__main__": modelpath = filepath[filepath.rfind('/'):filepath.find('.')] else: modelpath = sys.argv[2] - + moose.loadModel(filepath, modelpath, "gsl") written, c, writtentofile = mooseWriteSBML(modelpath, filepath) diff --git a/moose-core/python/moose/__init__.py b/moose-core/python/moose/__init__.py index af90c3724da68668e4388cb096cb2010603dbc5b..ceec0ffd1925bac30f0d3222c36bef78d7bccefb 100644 --- a/moose-core/python/moose/__init__.py +++ b/moose-core/python/moose/__init__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function # Bring moose.py functions into global namespace. diff --git a/moose-core/python/moose/alternate.py b/moose-core/python/moose/alternate.py index 66866a6a0496afc2776060774eb38d4b660e5f91..a03f97a6bc9e4c1b932a3a0a3f3d0e373d92d56d 100644 --- a/moose-core/python/moose/alternate.py +++ b/moose-core/python/moose/alternate.py @@ -1,34 +1,35 @@ -# moose.py --- -# +# -*- coding: utf-8 -*- +# moose.py --- +# # Filename: moose.py # Description: THIS IS OUTDATED CODE AND KEPT FOR HISTORICAL REFERENCE -# moose.py in this directory is the replacement for this +# moose.py in this directory is the replacement for this # script. -# +# # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Copyright (C) 2010 Subhasis Ray, all rights reserved. # Created: Sat Mar 12 14:02:40 2011 (+0530) -# Version: +# Version: # Last-Updated: Mon Apr 9 03:32:28 2012 (+0530) # By: Subhasis Ray # Update #: 1672 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# # THIS IS OUTDATED CODE AND KEPT FOR HISTORICAL REFERENCE -# -# +# +# # Change log: -# -# -# +# +# +# # Code: @@ -210,7 +211,7 @@ getFieldNames() - return a list of the available field names on this object getFieldType(fieldName) - return the data type of the specified field. -getSources(fieldName) - return a list of (source_element, source_field) for all +getSources(fieldName) - return a list of (source_element, source_field) for all messages coming in to fieldName of this object. getDestinations(fieldName) - return a list of (destination_elemnt, destination_field) @@ -324,7 +325,7 @@ _moose_classes = dict([(child[0].name, True) for child in Id('/classes')[0].getF # def __set__(self, obj, value): # obj.oid_.setField(self.name, value) - + # def __delete__(self, obj): # raise AttributeError('ValueFinfos cannot be deleted.') @@ -333,7 +334,7 @@ class _LFDescriptor(object): self.name = name def __get__(self, obj, objtype=None): return _LookupField(obj.oid_, self.name) - + class _LookupField(object): def __init__(self, obj, name): self.name = name @@ -352,13 +353,13 @@ class _LookupField(object): self.obj.oid_.setLookupField(self.name, key, value) else: raise TypeError('obj is neither an ObjId nor a Neutral or subclass instance.') - + class NeutralArray(object): """ The base class. Each NeutralArray object has an unique Id (field id_) and that is the only data directly visible under Python. All operation are done on the objects by calling functions on the Id. - + A NeutralArray object is actually an array. The individual elements in a NeutralArray are of class Neutral. To access these individual elements, you can index the NeutralArray object. @@ -388,7 +389,7 @@ class NeutralArray(object): will create a duplicate reference to the existing intfire object. They will share the same Id and any changes made via the MOOSE API to one will be effective on the other. - + """ path = None dims = None @@ -452,7 +453,7 @@ class NeutralArray(object): while _class_name not in _moose_classes: _base_class = self.__base__ if _base_class == object: - raise TypeError('Class %s does not inherit any MOOSE class.' % (self.__class__.__name__)) + raise TypeError('Class %s does not inherit any MOOSE class.' % (self.__class__.__name__)) _class_name = _base_class.__name__ if _class_name.endswith('Array'): _class_name = _class_name[:-len('Array')] @@ -480,7 +481,7 @@ class NeutralArray(object): If empty string or not specified, returns names of fields from all categories. """ - + return self.id_[0].getFieldNames(ftype) def getFieldType(self, field, ftype=''): @@ -511,9 +512,9 @@ class NeutralArray(object): fieldNames = property(lambda self: self.id_[0].getFieldNames('valueFinfo')) name = property(lambda self: self.id_[0].name) shape = property(lambda self: self.id_.getShape()) - - + + class Neutral(object): """Corresponds to a single entry in a NeutralArray. Base class for all other MOOSE classes for single entries in Array elements. @@ -549,8 +550,8 @@ class Neutral(object): Arguments: arg1 : A path or an existing ObjId or an Id or a NeutralArray - or another Neutral object. - + or another Neutral object. + path -- a string specifying the path for the Neutral object. If there is already a Neutral object with the given path, a reference to that object is created. Otherwise, a new @@ -603,8 +604,8 @@ class Neutral(object): # A non-existing path has been provided. Try to # construct a singleton array element and create # reference to the first element. - self_class = self.__class__ - while (self_class.__name__ not in _moose_classes) and (self_class != object): # Handle class extension in Python. + self_class = self.__class__ + while (self_class.__name__ not in _moose_classes) and (self_class != object): # Handle class extension in Python. self_class = self_class.__base__ if self_class == object: raise TypeError('Class %s does not inherit any MOOSE class.' % (self.__class__.__name__)) @@ -645,7 +646,7 @@ class Neutral(object): else: self.oid_ = _moose.ObjId(id_, dindex, findex, numFieldBits) # Check for conversion from instance of incompatible MOOSE - # class. + # class. orig_classname = self.oid_.getField('class') if self.__class__.__name__ != orig_classname: orig_class = eval(orig_classname) @@ -672,7 +673,7 @@ class Neutral(object): if fieldName in getFieldDict(self.className): return [eval('%s("%s")' % (id_[0].getField('class'), id_.getPath())) for id_ in self.oid_.getNeighbors(fieldName)] raise ValueError('%s: no such field on %s' % (fieldName, self.path)) - + def connect(self, srcField, dest, destField, msgType='Single'): return self.oid_.connect(srcField, dest.oid_, destField, msgType) @@ -699,7 +700,7 @@ class Neutral(object): for (f1, f2) in zip(msg.getField('srcFieldsOnE1'), msg.getField('destFieldsOnE2')): msg_dict.append((element(e2), f2)) return msg_dict - + def inMessages(self): msg_list = [] for msg in self.msgIn: @@ -720,8 +721,8 @@ class Neutral(object): msg_list.append(msg_str) return msg_list - - + + className = property(lambda self: self.oid_.getField('class')) fieldNames = property(lambda self: self.oid_.getFieldNames()) name = property(lambda self: self.oid_.getField('name')) @@ -740,8 +741,8 @@ class Neutral(object): tmp = self.oid_.getNeighbors(field) neighbors[field] += [eval('%s("%s")' % (nid[0].getField('class'), nid.getPath())) for nid in tmp] return neighbors - - + + childList = property(lambda self: [eval('%s("%s")' % (ch[0].getField('class'), ch.getPath())) for ch in self.oid_.getField('children')]) ################################################################ @@ -778,11 +779,11 @@ def arrayelement(path, className='Neutral'): oid = _moose.ObjId(path) className = oid.getField('class') return eval('%sArray("%s")' % (className, path)) - + ################################################################ # Wrappers for global functions -################################################################ +################################################################ def copy(src, dest, name, n=1, toGlobal=False, copyExtMsg=False): if isinstance(src, NeutralArray): @@ -808,7 +809,7 @@ def delete(target): if not isinstance(target, Id): raise TypeError('Only Id or Array objects can be deleted: received %s' % (target.__class__.__name__)) _moose.delete(target) - + def setCwe(element): """Set present working element""" if isinstance(element, NeutralArray): @@ -827,7 +828,7 @@ def pwe(): """Print present working element. Convenience function for GENESIS users.""" print(_moose.getCwe().getPath()) - + def connect(src, srcMsg, dest, destMsg, msgType='Single'): """Connect src object's source field specified by srcMsg to destMsg field of target object.""" @@ -883,11 +884,11 @@ def showfield(element, field='*', showtype=False): if not isinstance(element, ObjId): raise TypeError('Expected argument of type ObjId or Neutral or a path to an existing object. Found %s' % (type(element))) element = Neutral(element) - if field == '*': + if field == '*': value_field_dict = getFieldDict(element.className, 'valueFinfo') max_type_len = max(len(dtype) for dtype in value_field_dict.values()) max_field_len = max(len(dtype) for dtype in value_field_dict.keys()) - print() + print() print('[', element.path, ']') for key, dtype in list(value_field_dict.items()): if dtype == 'bad' or key == 'this' or key == 'dummy' or key == 'me' or dtype.startswith('vector') or 'ObjId' in dtype: @@ -906,11 +907,11 @@ def showfields(element, showtype=False): """Convenience function. Should be deprecated if nobody uses it.""" warnings.warn('Deprecated. Use showfield(element, field="*", showtype=True) instead.', DeprecationWarning) showfield(element, field='*', showtype=showtype) - + def wildcardFind(cond): """Search for objects that match condition cond.""" return [eval('%s("%s")' % (id_[0].getField('class'), id_.getPath())) for id_ in _wildcardFind(cond)] - + ####################################################### # This is to generate class definitions automatically ####################################################### @@ -936,7 +937,7 @@ def update_class(cls, class_id): # in non-interactive mode. __main__.__file__ is not # defined in interactive mode and that is when we create # the documentation. - if not hasattr(main, '__file__'): + if not hasattr(main, '__file__'): doc = field.docs setattr(cls, fieldName, property(fget=fget, fset=fset, doc=doc)) @@ -949,7 +950,7 @@ def update_class(cls, class_id): # defined in interactive mode and that is when we create # the documentation. doc = None - if not hasattr(main, '__file__'): + if not hasattr(main, '__file__'): doc = field.docs setattr(cls, fieldName, property(fget=fget, doc=doc)) @@ -1025,12 +1026,12 @@ def define_class(class_id): base_class = object array_class_obj = type(array_class_name, (base_class,), {}) globals()[array_class_name] = array_class_obj - + classes_Id = Id('/classes') for child in classes_Id[0].children: define_class(child) -# +# # moose.py ends here diff --git a/moose-core/python/moose/chemUtil/__init__.py b/moose-core/python/moose/chemUtil/__init__.py index dce7080f0a0f57a421c2428821689fe824ff50a5..b42e8c3ac28027f567b26d0d6208aeae8ec5fe83 100644 --- a/moose-core/python/moose/chemUtil/__init__.py +++ b/moose-core/python/moose/chemUtil/__init__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from .add_Delete_ChemicalSolver import * from .chemConnectUtil import * from .graphUtils import autoCoordinates diff --git a/moose-core/python/moose/chemUtil/add_Delete_ChemicalSolver.py b/moose-core/python/moose/chemUtil/add_Delete_ChemicalSolver.py index af9437b92dd886e39e4644a60f15579f3f76d525..05bd4a0a233f792f177bcc833beed7292efe3dc6 100644 --- a/moose-core/python/moose/chemUtil/add_Delete_ChemicalSolver.py +++ b/moose-core/python/moose/chemUtil/add_Delete_ChemicalSolver.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import moose def moosedeleteChemSolver(modelRoot): diff --git a/moose-core/python/moose/chemUtil/chemConnectUtil.py b/moose-core/python/moose/chemUtil/chemConnectUtil.py index 93d8be9d1442970c5ac748184f6743ba6810fc6b..be0c4ba6f36fd8d60aaaa3c2a75864f9601cdd2f 100644 --- a/moose-core/python/moose/chemUtil/chemConnectUtil.py +++ b/moose-core/python/moose/chemUtil/chemConnectUtil.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import moose import numpy as np from collections import Counter @@ -9,8 +10,8 @@ def xyPosition(objInfo,xory): return (float(0)) def setupMeshObj(modelRoot): - ''' Setup compartment and its members pool,reaction,enz cplx under self.meshEntry dictionaries \ - self.meshEntry with "key" as compartment, + ''' Setup compartment and its members pool,reaction,enz cplx under self.meshEntry dictionaries \ + self.meshEntry with "key" as compartment, value is key2:list where key2 represents moose object type,list of objects of a perticular type e.g self.meshEntry[meshEnt] = { 'reaction': reaction_list,'enzyme':enzyme_list,'pool':poollist,'cplx': cplxlist } ''' @@ -53,9 +54,9 @@ def setupMeshObj(modelRoot): objInfo =m.path+'/info' if moose.exists(objInfo): listOfitems[moose.element(moose.element(objInfo).parent)]={'x':xyPosition(objInfo,'x'),'y':xyPosition(objInfo,'y')} - + xcord.append(xyPosition(objInfo,'x')) - ycord.append(xyPosition(objInfo,'y')) + ycord.append(xyPosition(objInfo,'y')) getxyCord(xcord,ycord,funclist,listOfitems) getxyCord(xcord,ycord,enzlist,listOfitems) @@ -112,22 +113,22 @@ def setupItem(modelPath,cntDict): prdlist = [] uniqItem,countuniqItem = countitems(items,'subOut') subNo = uniqItem - for sub in uniqItem: + for sub in uniqItem: sublist.append((moose.element(sub),'s',countuniqItem[sub])) uniqItem,countuniqItem = countitems(items,'prd') prdNo = uniqItem if (len(subNo) == 0 or len(prdNo) == 0): print ("Substrate Product is empty ",path, " ",items) - + for prd in uniqItem: prdlist.append((moose.element(prd),'p',countuniqItem[prd])) - + if (baseObj == 'CplxEnzBase') : uniqItem,countuniqItem = countitems(items,'toEnz') for enzpar in uniqItem: sublist.append((moose.element(enzpar),'t',countuniqItem[enzpar])) - + uniqItem,countuniqItem = countitems(items,'cplxDest') for cplx in uniqItem: prdlist.append((moose.element(cplx),'cplx',countuniqItem[cplx])) @@ -145,7 +146,7 @@ def setupItem(modelPath,cntDict): uniqItem,countuniqItem = countitems(item,'input') for funcpar in uniqItem: sublist.append((moose.element(funcpar),'sts',countuniqItem[funcpar])) - + uniqItem,countuniqItem = countitems(items,'valueOut') for funcpar in uniqItem: prdlist.append((moose.element(funcpar),'stp',countuniqItem[funcpar])) @@ -178,4 +179,4 @@ def countitems(mitems,objtype): items = moose.element(mitems).neighbors[objtype] uniqItems = set(items) countuniqItems = Counter(items) - return(uniqItems,countuniqItems) \ No newline at end of file + return(uniqItems,countuniqItems) diff --git a/moose-core/python/moose/chemUtil/graphUtils.py b/moose-core/python/moose/chemUtil/graphUtils.py index 5bf05f54ace749c62ded010dc3c05f11efda52c9..061b8ea0111ae46ec6b5b22ce80b72352c0f5af4 100644 --- a/moose-core/python/moose/chemUtil/graphUtils.py +++ b/moose-core/python/moose/chemUtil/graphUtils.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import moose pygraphvizFound_ = True @@ -7,7 +8,7 @@ except Exception as e: pygraphvizFound_ = False def autoCoordinates(meshEntry,srcdesConnection): - global pygraphvizFound_ + global pygraphvizFound_ positionInfo = {} if not pygraphvizFound_: @@ -34,7 +35,7 @@ def autoCoordinates(meshEntry,srcdesConnection): for reaObj in find_index(memb,'reaction'): #G.add_node(reaObj.path) G.add_node(reaObj.path,label='',shape='circle',color='') - + for inn,out in list(srcdesConnection.items()): if (inn.className =='ZombieReac'): arrowcolor = 'green' elif(inn.className =='ZombieEnz'): arrowcolor = 'red' @@ -56,18 +57,18 @@ def autoCoordinates(meshEntry,srcdesConnection): else: for items in (items for items in out ): G.add_edge(moose.element(items[0]).path,inn.path) - + # if int( nx.__version__.split( '.' )[-1] ) >= 11: # position = nx.spring_layout( G ) # else: - # position = nx.graphviz_layout(G, prog = 'dot') + # position = nx.graphviz_layout(G, prog = 'dot') # for item in position.items(): # xy = item[1] # ann = moose.Annotator(item[0]+'/info') # ann.x = xy[0] # ann.y = xy[1] # positioninfo[(moose.element(item[0]))] ={'x':float(xy[0]),'y':float(xy[1])} - + G.layout() for n in G.nodes(): value = str(n.attr['pos']) diff --git a/moose-core/python/moose/genesis/__init__.py b/moose-core/python/moose/genesis/__init__.py index 2d73bdb1b74df92071100aa9344565734b642089..ffb62215d866761adf692897adb6cad2aaf993b9 100644 --- a/moose-core/python/moose/genesis/__init__.py +++ b/moose-core/python/moose/genesis/__init__.py @@ -1 +1,2 @@ +# -*- coding: utf-8 -*- from .writeKkit import mooseWriteKkit diff --git a/moose-core/python/moose/genesis/writeKkit.py b/moose-core/python/moose/genesis/writeKkit.py index 4f2ea99a5b674235f2b7bf715c339e8b7e186435..2e25bc7ed974242abfe42a9d978315a57a39d973 100644 --- a/moose-core/python/moose/genesis/writeKkit.py +++ b/moose-core/python/moose/genesis/writeKkit.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Chemical Signalling model loaded into moose can be save into Genesis-Kkit format """ __author__ = "Harsha Rani" @@ -49,7 +50,7 @@ def mooseWriteKkit( modelpath, filename, sceneitems={}): global cmin,cmax,xmin,xmax,ymin,ymax cmin, xmin, ymin = 0, 0, 0 cmax, xmax, ymax = 1, 1, 1 - + compt = moose.wildcardFind(modelpath+'/##[ISA=ChemCompt]') maxVol = estimateDefaultVol(compt) positionInfoExist = True @@ -64,7 +65,7 @@ def mooseWriteKkit( modelpath, filename, sceneitems={}): #cmin,cmax,sceneitems = autoCoordinates(meshEntry,srcdesConnection) sceneitems = autoCoordinates(meshEntry,srcdesConnection) - if not positionInfoExist: + if not positionInfoExist: # if position are not from kkit, then zoom factor is applied while # writing to genesis. Like if position is from pyqtSceneItem or auto-coordinates cmin,cmax,xmin1,xmax1,ymin1,ymax1 = findMinMax(sceneitems) @@ -290,7 +291,7 @@ def writeReac(modelpath,f,sceneitems): textcolor = moose.Annotator(rinfo).getField('textColor') textcolor = getColorCheck(textcolor,GENESIS_COLOR_SEQUENCE) - + if color == "" or color == " ": color = getRandColor() if textcolor == "" or textcolor == " ": @@ -298,7 +299,7 @@ def writeReac(modelpath,f,sceneitems): f.write("simundump kreac /kinetics/" + trimPath(reac) + " " +str(0) +" "+ str(kf) + " " + str(kb) + " \"\" " + str(color) + " " + str(textcolor) + " " + str(int(x)) + " " + str(int(y)) + " 0\n") return reacList - + def trimPath(mobj): original = mobj mobj = moose.element(mobj) @@ -342,7 +343,7 @@ def storePlotMsgs( tgraphs,f): if slash > -1: foundConc = True if not ( (graph.path.find('conc1') > -1 ) or - (graph.path.find('conc2') > -1 ) or + (graph.path.find('conc2') > -1 ) or (graph.path.find('conc3') > -1 ) or (graph.path.find('conc4') > -1) ): foundConc = False @@ -381,7 +382,7 @@ def writeplot( tgraphs,f ): if slash > -1: foundConc = True if not ( (graphs.path.find('conc1') > -1 ) or - (graphs.path.find('conc2') > -1 ) or + (graphs.path.find('conc2') > -1 ) or (graphs.path.find('conc3') > -1 ) or (graphs.path.find('conc4') > -1) ): foundConc = False @@ -390,7 +391,7 @@ def writeplot( tgraphs,f ): else: slash1 = graphs.path.find('/',slash) tabPath = "/graphs/conc1" +graphs.path[slash1:len(graphs.path)] - + if len(moose.element(graphs).msgOut): poolPath = (moose.element(graphs).msgOut)[0].e2.path @@ -429,14 +430,14 @@ def writePool(modelpath,f,volIndex,sceneitems): # value = sceneitems[p] # x = calPrime(value['x']) # y = calPrime(value['y']) - + pinfo = p.path+'/info' if moose.exists(pinfo): color = moose.Annotator(pinfo).getField('color') color = getColorCheck(color,GENESIS_COLOR_SEQUENCE) textcolor = moose.Annotator(pinfo).getField('textColor') textcolor = getColorCheck(textcolor,GENESIS_COLOR_SEQUENCE) - + geometryName = volIndex[p.volume] volume = p.volume * NA * 1e-3 if color == "" or color == " ": @@ -455,7 +456,7 @@ def writePool(modelpath,f,volIndex,sceneitems): str(slave_enable) + " /kinetics"+ geometryName + " " + str(color) +" " + str(textcolor) + " " + str(int(x)) + " " + str(int(y)) + " "+ str(0)+"\n") - + def getColorCheck(color,GENESIS_COLOR_SEQUENCE): if isinstance(color, str): if color.startswith("#"): diff --git a/moose-core/python/moose/graph_utils.py b/moose-core/python/moose/graph_utils.py index 3e3dfa8982b600b23925c852fcd0b3e319a1f274..bec44a74a5fb35a1db4cdc5d4b2fb4a3225a4405 100644 --- a/moose-core/python/moose/graph_utils.py +++ b/moose-core/python/moose/graph_utils.py @@ -1,10 +1,11 @@ +# -*- coding: utf-8 -*- """graph_utils.py: Graph related utilties. It does not require networkx library. It writes files to be used with graphviz. Last modified: Sat Jan 18, 2014 05:01PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -43,7 +44,7 @@ def writeGraphviz(filename=None, pat='/##[TYPE=Compartment]'): path = path + '[0]' return path - + pathList = getMoosePaths(pat) compList = _moose.wildcardFind(pat) if not compList: diff --git a/moose-core/python/moose/graphutil.py b/moose-core/python/moose/graphutil.py index e8a0f8addc7b81744a497ac98bd5c8904cd77fb8..ed9e9060ed99be219e9c086b1e11c4fad777dfed 100644 --- a/moose-core/python/moose/graphutil.py +++ b/moose-core/python/moose/graphutil.py @@ -1,29 +1,30 @@ -# graphutil.py --- -# +# -*- coding: utf-8 -*- +# graphutil.py --- +# # Filename: graphutil.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Sun Mar 18 13:42:28 2012 (+0530) -# Version: +# Version: # Last-Updated: Wed Mar 28 18:27:26 2012 (+0530) # By: subha # Update #: 103 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# -# -# -# +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# +# +# +# # Change log: -# -# +# +# # Code: @@ -31,13 +32,13 @@ from collections import defaultdict import re import networkx as nx import numpy as np -from . import moose +from . import moose def moosegraph(element, ies=['childMsg'], ied=['parentMsg'], iv=[], keep_solitary=False): """Create a graph out of all objects under teh element specified. Ignore edges going outside the subtree rooted at element. - + If element is a string, it can be a wildcard path in MOOSE ies is a list of sourcefields to be ignored when constructing edges. @@ -103,7 +104,7 @@ def moosegraph(element, ies=['childMsg'], ied=['parentMsg'], iv=[], keep_solitar src.add(fname) except KeyError: graph.add_edge(vv, nn, src=set([fname])) - + for fname in vv[0].getFieldNames('destFinfo'): matches = [True for regex in ied_re if regex.search(fname)] if matches: @@ -116,7 +117,7 @@ def moosegraph(element, ies=['childMsg'], ied=['parentMsg'], iv=[], keep_solitar dest.add(fname) except KeyError: graph.add_edge(nn, vv, dest=set([fname])) - + for fname in vv[0].getFieldNames('sharedFinfo'): nlist = vv[0].getNeighbors(fname) for nn in nlist: @@ -154,7 +155,7 @@ def draw_moosegraph(graph, pos=None, label_edges=True): edge_labels[ee] = label nx.draw(graph, pos) nx.draw_networkx_edge_labels(graph, pos, edge_labels) - + import unittest import pylab @@ -188,5 +189,5 @@ if '__main__' == __name__: -# +# # graphutil.py ends here diff --git a/moose-core/python/moose/hdfutil.py b/moose-core/python/moose/hdfutil.py index 70ea3b1cc964aa69816b6633f29f54f1c7a0c8ad..3d1fd80adf6ffa766e5e03f056c6d929f256978c 100644 --- a/moose-core/python/moose/hdfutil.py +++ b/moose-core/python/moose/hdfutil.py @@ -1,24 +1,25 @@ -# hdfutil.py --- -# +# -*- coding: utf-8 -*- +# hdfutil.py --- +# # Filename: hdfutil.py -# Description: -# Author: -# Maintainer: +# Description: +# Author: +# Maintainer: # Created: Thu Aug 23 17:34:55 2012 (+0530) -# Version: +# Version: # Last-Updated: Mon Sep 3 17:55:03 2012 (+0530) # By: subha # Update #: 618 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# +# Commentary: +# # Utility function to save data in hdf5 format. -# +# # In this utility we are trying to address a serialization # problem. The ultimate goal is to be able to save a snapshot of # complete simulator state in a portable format so that it can be @@ -34,7 +35,7 @@ # # TODO: How do we translate MOOSE tree to HDF5? MOOSE has vec and # elements. vec is a container and each element belongs to an -# vec. +# vec. # # em-0 # el-00 el-01 el-02 @@ -61,26 +62,26 @@ # 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: from __future__ import print_function @@ -118,7 +119,7 @@ em_dtype = np.dtype([('path', 'S1024'), ('class', 'S64'), ('dims', 'i4', (3,))]) def get_rec_dtype(em): bad_fields = [] # Check if already have data type information for this class. - # Create it otherwise. + # Create it otherwise. if em.className in dtype_table: dtype = dtype_table[em.className] else: @@ -138,7 +139,7 @@ def get_rec_dtype(em): if ftype in cpptonp] dtype_table[obj.className] = np.dtype(fields) return dtype_table[obj.className] - + def save_dataset(classname, rec, dtype, hdfnode): """Saves the data from rec into dataset""" # Check if there is a dataset for this class. Create it @@ -151,13 +152,13 @@ def save_dataset(classname, rec, dtype, hdfnode): newlen = oldlen + len(rec) ds.resize(newlen) else: - ds = hdfnode.create_dataset(classname, + ds = hdfnode.create_dataset(classname, shape=(len(rec),), - dtype=dtype, - compression='gzip', + dtype=dtype, + compression='gzip', compression_opts=6) ds[oldlen:newlen] = np.rec.array(rec, dtype=dtype) - + def savetree(moosenode, hdfnode): """Dump the MOOSE element tree rooted at moosenode as datasets under hdfnode.""" @@ -169,10 +170,10 @@ def savetree(moosenode, hdfnode): em_rec = [] hdfnode.attr['path'] = moosenode.path elements = hdfnode.create_group('elements') - for em in moose.wildcardFind(moosenode.path+'/##'): + for em in moose.wildcardFind(moosenode.path+'/##'): em_rec.append((em.path, em.className, em.shape)) dtype = get_rec_dtype(em) - for obj in em: + for obj in em: fields = [] for fname in dtype.names: f = obj.getField(fname) @@ -192,8 +193,8 @@ def savetree(moosenode, hdfnode): vec[:] = em_rec def loadtree(hdfnode, moosenode): - """Load the element tree saved under the group `hdfnode` into `moosenode`""" - pathclass = {} + """Load the element tree saved under the group `hdfnode` into `moosenode`""" + pathclass = {} basepath = hdfnode.attr['path'] if basepath != '/': basepath = basepath + '/' @@ -212,7 +213,7 @@ def loadtree(hdfnode, moosenode): wfields = {} for cinfo in moose__.element('/classes').children: cname = cinfo[0].name - wfields[cname] = [f[len('set_'):] for f in moose__.getFieldNames(cname, 'destFinfo') + wfields[cname] = [f[len('set_'):] for f in moose__.getFieldNames(cname, 'destFinfo') if f.startswith('set_') and f not in ['set_this', 'set_name', 'set_lastDimension', 'set_runTime'] and not f.startswith('set_num_')] for key in hdfnode['/elements']: dset = hdfnode['/elements/'][key][:] @@ -221,17 +222,17 @@ def loadtree(hdfnode, moosenode): obj = moose__.element(dset['path'][ii][len(basepath):]) for f in wfields[obj.className]: obj.setField(f, dset[f][ii]) - - - + + + def savestate(filename=None): """Dump the state of MOOSE in an hdf5 file. - + The file will have a data set for each class. Each such dataset will be a column of field values. This function needs more work on moose serialization. - """ + """ if filename is None: filename = 'moose_session_' + time.strftime('%Y%m%d_%H%M%S') + '.hdf5' with h5.File(filename, 'w') as fd: @@ -302,11 +303,11 @@ def savestate(filename=None): typeinfo_dataset.resize((objcount,)) typeinfo_dataset[objcount-len(typeinfo): objcount] = np.rec.array(typeinfo, dtype=typeinfo_dataset.dtype) -def restorestate(filename): +def restorestate(filename): wfields = {} for cinfo in moose__.element('/classes').children: cname = cinfo[0].name - wfields[cname] = [f[len('set_'):] for f in moose__.getFieldNames(cname, 'destFinfo') + wfields[cname] = [f[len('set_'):] for f in moose__.getFieldNames(cname, 'destFinfo') if f.startswith('set_') and f not in ['set_this', 'set_name', 'set_lastDimension', 'set_runTime'] and not f.startswith('set_num_')] with h5.File(filename, 'r') as fd: typeinfo = fd['/metadata/typeinfo'][:] @@ -326,5 +327,5 @@ def restorestate(filename): for f in wfields[obj.className]: obj.setField(f, dset[f][ii]) -# +# # hdfutil.py ends here diff --git a/moose-core/python/moose/merge/merge.py b/moose-core/python/moose/merge/merge.py index f76ca494b3daffccc1fa6318dd9783564c3a09d1..cb1ab62d7ecbeb4c1b8b648100fa5dc07d8a4cb0 100644 --- a/moose-core/python/moose/merge/merge.py +++ b/moose-core/python/moose/merge/merge.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- #******************************************************************* # * File: merge.py # * Description: @@ -10,7 +11,7 @@ #** also known as GENESIS 3 base code. #** copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS #Created : Friday Dec 16 23:19:00 2016(+0530) -#Version +#Version #Last-Updated: Thursday Jan 12 17:30:33 2017(+0530) # By: Harsha #**********************************************************************/ @@ -25,7 +26,7 @@ import sys import os #from . import _moose as moose -import moose +import moose import mtypes from moose.chemUtil.chemConnectUtil import * @@ -40,7 +41,7 @@ def mergeChemModel(A,B): if not loadedA: modelB = moose.Shell('/') if not loadedB: - modelA = moose.Shell('/') + modelA = moose.Shell('/') else: directory, bfname = os.path.split(B) global grpNotcopiedyet,poolListina @@ -55,7 +56,7 @@ def mergeChemModel(A,B): if key not in dictComptA: # if compartmentname from modelB does not exist in modelA, then copy copy = moose.copy(dictComptB[key],moose.element(modelA)) - else: + else: #if compartmentname from modelB exist in modelA, #volume is not same, then change volume of ModelB same as ModelA if abs(dictComptA[key].volume - dictComptB[key].volume): @@ -83,15 +84,15 @@ def mergeChemModel(A,B): for key in list(dictComptB.keys()): funcNotallowed = [] funcNotallowed = functionMerge(dictComptA,dictComptB,key) - + poolListina = updatePoolList(dictComptA) R_Duplicated,R_Notcopiedyet,R_Daggling = reacMerge(dictComptA,dictComptB,key,poolListina) poolListina = updatePoolList(dictComptA) E_Duplicated,E_Notcopiedyet,E_Daggling = enzymeMerge(dictComptA,dictComptB,key,poolListina) - + print("\n Model is merged to %s" %modelA) - + if funcNotallowed: print( "\nPool already connected to a function, this function is not to connect to same pool, since no two function are allowed to connect to same pool:") for fl in list(funcNotallowed): @@ -106,7 +107,7 @@ def mergeChemModel(A,B): print("Reaction: ") for rd in list(R_Duplicated): print ("%s " %str(rd.name)) - + if E_Duplicated: print ("Enzyme:") for ed in list(E_Duplicated): @@ -123,7 +124,7 @@ def mergeChemModel(A,B): print ("Enzyme:") for ed in list(E_Notcopiedyet): print ("%s " %str(ed.name)) - + if R_Daggling or E_Daggling: print ("\n Daggling reaction/enzyme are not not allowed in moose, these are not merged") if R_Daggling: @@ -133,13 +134,13 @@ def mergeChemModel(A,B): if E_Daggling: print ("Enzyme:") for ed in list(E_Daggling): - print ("%s " %str(ed.name)) + print ("%s " %str(ed.name)) def functionMerge(comptA,comptB,key): funcNotallowed = [] comptApath = moose.element(comptA[key]).path comptBpath = moose.element(comptB[key]).path - funcListina = moose.wildcardFind(comptApath+'/##[ISA=PoolBase]') + funcListina = moose.wildcardFind(comptApath+'/##[ISA=PoolBase]') funcListinb = moose.wildcardFind(comptBpath+'/##[ISA=Function]') objA = moose.element(comptApath).parent.name objB = moose.element(comptBpath).parent.name @@ -220,7 +221,7 @@ def comptList(modelpath): return comptdict def loadModels(filename): - """ load models into moose if file, if moosepath itself it passes back the path and + """ load models into moose if file, if moosepath itself it passes back the path and delete solver if exist """ modelpath = '/' @@ -234,8 +235,8 @@ def loadModels(filename): subtype = mtypes.getSubtype(filename, modeltype) if subtype == 'kkit' or modeltype == "cspace": moose.loadModel(filename,modelpath) - loaded = True - + loaded = True + elif subtype == 'sbml': #moose.ReadSBML() pass @@ -246,9 +247,9 @@ def loadModels(filename): modelpath = filename loaded = True ## default is 'ee' solver while loading the model using moose.loadModel, - ## yet deleteSolver is called just to be assured + ## yet deleteSolver is called just to be assured if loaded: - deleteSolver(modelpath) + deleteSolver(modelpath) return modelpath,loaded @@ -263,7 +264,7 @@ def deleteSolver(modelRoot): moose.delete(st_ksolve) def poolMerge(comptA,comptB,poolNotcopiedyet): - + aCmptGrp = moose.wildcardFind(comptA.path+'/#[TYPE=Neutral]') aCmptGrp = aCmptGrp +(moose.element(comptA.path),) @@ -278,12 +279,12 @@ def poolMerge(comptA,comptB,poolNotcopiedyet): if moose.element(grp_cmpt).className != bpath.className: grp_cmpt = grp_cmpt+'_grp' bpath.name = bpath.name+"_grp" - l = moose.Neutral(grp_cmpt) + l = moose.Neutral(grp_cmpt) else: moose.Neutral(grp_cmpt) - + apath = moose.element(bpath.path.replace(objB,objA)) - + bpoollist = moose.wildcardFind(bpath.path+'/#[ISA=PoolBase]') apoollist = moose.wildcardFind(apath.path+'/#[ISA=PoolBase]') for bpool in bpoollist: @@ -292,10 +293,10 @@ def poolMerge(comptA,comptB,poolNotcopiedyet): if copied == False: #hold it for later, this pool may be under enzyme, as cplx poolNotcopiedyet.append(bpool) - + def copy_deleteUnlyingPoolObj(pool,path): # check if this pool is under compartement or under enzyme?(which is enzyme_cplx) - # if enzyme_cplx then don't copy untill this perticular enzyme is copied + # if enzyme_cplx then don't copy untill this perticular enzyme is copied # case: This enzyme_cplx might exist in modelA if enzyme exist # which will automatically copie's the pool copied = False @@ -329,7 +330,7 @@ def enzymeMerge(comptA,comptB,key,poolListina): comptBpath = moose.element(comptB[key]).path objA = moose.element(comptApath).parent.name objB = moose.element(comptBpath).parent.name - enzyListina = moose.wildcardFind(comptApath+'/##[ISA=EnzBase]') + enzyListina = moose.wildcardFind(comptApath+'/##[ISA=EnzBase]') enzyListinb = moose.wildcardFind(comptBpath+'/##[ISA=EnzBase]') for eb in enzyListinb: eBsubname, eBprdname = [],[] @@ -337,15 +338,15 @@ def enzymeMerge(comptA,comptB,key,poolListina): eBprdname = subprdList(eb,"prd") allexists, allexistp = False, False allclean = False - + poolinAlist = poolListina[findCompartment(eb).name] for pA in poolinAlist: if eb.parent.name == pA.name: eapath = eb.parent.path.replace(objB,objA) if not moose.exists(eapath+'/'+eb.name): - #This will take care - # -- If same enzparent name but different enzyme name + #This will take care + # -- If same enzparent name but different enzyme name # -- or different parent/enzyme name if eBsubname and eBprdname: allexists = checkexist(eBsubname,objB,objA) @@ -372,7 +373,7 @@ def enzymeMerge(comptA,comptB,key,poolListina): #print ("This reaction \""+eb.path+"\" has no substrate/product daggling reaction are not copied") #war_msg = war_msg+"\nThis reaction \""+eb.path+"\" has no substrate/product daggling reaction are not copied" else: - #Same Enzyme name + #Same Enzyme name # -- Same substrate and product including same volume then don't copy # -- different substrate/product or if sub/prd's volume is different then DUPLICATE the Enzyme allclean = False @@ -382,7 +383,7 @@ def enzymeMerge(comptA,comptB,key,poolListina): eAsubname = subprdList(ea,"sub") eBsubname = subprdList(eb,"sub") hasSamenoofsublen,hasSameS,hasSamevols = same_len_name_vol(eAsubname,eBsubname) - + eAprdname = subprdList(ea,"prd") eBprdname = subprdList(eb,"prd") hasSamenoofprdlen,hasSameP,hasSamevolp = same_len_name_vol(eAprdname,eBprdname) @@ -399,7 +400,7 @@ def enzymeMerge(comptA,comptB,key,poolListina): eapath = eb.parent.path.replace(objB,objA) enz = moose.copy(eb,moose.element(eapath)) moose.connect(enz, 'enz', eapath, 'reac' ) - + if eb.className in ["ZombieMMenz","MMenz"]: eapath = eb.parent.path.replace(objB,objA) enz = moose.copy(eb.name,moose.element(eapath)) @@ -437,7 +438,7 @@ def reacMerge(comptA,comptB,key,poolListina): comptBpath = moose.element(comptB[key]).path objA = moose.element(comptApath).parent.name objB = moose.element(comptBpath).parent.name - reacListina = moose.wildcardFind(comptApath+'/##[ISA=ReacBase]') + reacListina = moose.wildcardFind(comptApath+'/##[ISA=ReacBase]') reacListinb = moose.wildcardFind(comptBpath+'/##[ISA=ReacBase]') for rb in reacListinb: rBsubname, rBprdname = [],[] @@ -470,21 +471,21 @@ def reacMerge(comptA,comptB,key,poolListina): RE_Daggling.append(rb) #print ("This reaction \""+rb.path+"\" has no substrate/product daggling reaction are not copied") #war_msg = war_msg+"\nThis reaction \""+rb.path+"\" has no substrate/product daggling reaction are not copied" - + else: - #Same reaction name + #Same reaction name # -- Same substrate and product including same volume then don't copy # -- different substrate/product or if sub/prd's volume is different then DUPLICATE the reaction allclean = False for ra in reacListina: if rb.name == ra.name: rAsubname = subprdList(ra,"sub") - rBsubname = subprdList(rb,"sub") + rBsubname = subprdList(rb,"sub") hasSamenoofsublen,hasSameS,hasSamevols = same_len_name_vol(rAsubname,rBsubname) rAprdname = subprdList(ra,"prd") rBprdname = subprdList(rb,"prd") - hasSamenoofprdlen,hasSameP,hasSamevolp = same_len_name_vol(rAprdname,rBprdname) + hasSamenoofprdlen,hasSameP,hasSamevolp = same_len_name_vol(rAprdname,rBprdname) if not all((hasSamenoofsublen,hasSameS,hasSamevols,hasSamenoofprdlen,hasSameP,hasSamevolp)): # May be different substrate or product or volume of Sub/prd may be different, # Duplicating the reaction @@ -505,7 +506,7 @@ def reacMerge(comptA,comptB,key,poolListina): allclean = False else: allclean = True - + if not allclean: # didn't find sub or prd for this reaction # -- it may be connected Enzyme cplx @@ -516,8 +517,8 @@ def reacMerge(comptA,comptB,key,poolListina): else: RE_Daggling.append(rb) #print ("This reaction \""+rb.path+"\" has no substrate/product daggling reaction are not copied") - #war_msg = war_msg+"\nThis reaction \""+rb.path+"\" has no substrate/product daggling reaction are not copied" - + #war_msg = war_msg+"\nThis reaction \""+rb.path+"\" has no substrate/product daggling reaction are not copied" + return RE_Duplicated,RE_Notcopiedyet,RE_Daggling def subprdList(reac,subprd): @@ -545,7 +546,7 @@ def same_len_name_vol(rA,rB): if rB and rA: rAdict = dict( [ (i.name,i) for i in (rA) ] ) rBdict = dict( [ (i.name,i) for i in (rB) ] ) - + for key,bpath in rBdict.items(): apath = rAdict[key] comptA = moose.element(findCompartment(apath)) @@ -558,7 +559,7 @@ def same_len_name_vol(rA,rB): if len(set(hassamevollist))==1: for x in set(hassamevollist): hassamevol = x - + return ( hassameLen,hassameSP,hassamevol) def connectObj(reac,spList,spType,comptA,war_msg): @@ -567,7 +568,7 @@ def connectObj(reac,spList,spType,comptA,war_msg): for rsp in spList: for akey in list(poolListina[findCompartment(rsp).name]): if rsp.name == akey.name: - if moose.exists(akey.path): + if moose.exists(akey.path): moose.connect(moose.element(reac), spType, moose.element(akey), 'reac', 'OneToOne') allclean = True else: diff --git a/moose-core/python/moose/merge/mtypes.py b/moose-core/python/moose/merge/mtypes.py index 9d04c5a2456ada2275dad39ed5fb2574d26abce4..da1ea0b06570df134eafde7b559790c601f52462 100644 --- a/moose-core/python/moose/merge/mtypes.py +++ b/moose-core/python/moose/merge/mtypes.py @@ -1,47 +1,48 @@ -# mtypes.py --- -# +# -*- coding: utf-8 -*- +# mtypes.py --- +# # Filename: mtypes.py -# Description: -# Author: -# Maintainer: +# Description: +# Author: +# Maintainer: # Created: Fri Feb 8 11:29:36 2013 (+0530) -# Version: +# Version: # Last-Updated: Tue Mar 1 02:52:35 2016 (-0500) # By: subha # Update #: 182 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# # Utility to detect the model type in a file -# -# +# +# # 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: @@ -99,7 +100,7 @@ def getType(filename, mode='t'): mode: 'b' for binary, 't' for text. Not used currently. - """ + """ mtype = None msubtype = None if mode == 't': @@ -117,7 +118,7 @@ def getSubtype(filename, typename): if subtypeFunc(filename): return subtype return '' - + # Dictionary of model description types and functions to detect them. # # Fri Feb 8 11:07:41 IST 2013 - as of now we only recognize GENESIS .g @@ -163,9 +164,9 @@ def isSBML(filename): def isKKIT(filename): """Check if `filename` is a GENESIS/KINETIKIT file. - - """ - pattern = re.compile('include\s+kkit') # KKIT files must have "include kkit" statement somewhere + + """ + pattern = re.compile('include\s+kkit') # KKIT files must have "include kkit" statement somewhere with open(filename, 'r') as infile: while True: sentence = '' @@ -188,7 +189,7 @@ def isKKIT(filename): comment_end = line.find('*/') if comment_end >= 0: comment_start = -1; - line = line[comment_end+2:] # keep the rest of the line + line = line[comment_end+2:] # keep the rest of the line break line = infile.readline() if line: @@ -200,13 +201,13 @@ def isKKIT(filename): while line and contd: sentence += ' ' + line[:-1] line = infile.readline() - if line: + if line: line = line.strip() contd = line.endswith('\\') # if contd turned false, the last line came out of the # while loop unprocessed if line: - sentence += ' ' + line + sentence += ' ' + line # print '>', sentence if re.search(pattern, sentence): return True @@ -229,7 +230,7 @@ subtypeChecks = { 'genesis/kkit': isKKIT, 'genesis/proto': isProto, 'xml/neuroml': isNeuroML, - 'xml/sbml': isSBML, + 'xml/sbml': isSBML, } # Mapping types to list of subtypes. @@ -241,5 +242,5 @@ subtypes = { -# +# # mtypes.py ends here diff --git a/moose-core/python/moose/methods_utils.py b/moose-core/python/moose/methods_utils.py index 91e49dccd0275c60e9133dc7457910ae12eea99e..1a8cd31ded8b3aa8bc161fcf31bb86427cb6dfe3 100644 --- a/moose-core/python/moose/methods_utils.py +++ b/moose-core/python/moose/methods_utils.py @@ -1,7 +1,8 @@ +# -*- coding: utf-8 -*- -"""methods_utils.py: - Some non-standard functions generic to moose. +"""methods_utils.py: + Some non-standard functions generic to moose. This library may not be exposed to end-users. Intended for development by the maintainer of this file. @@ -9,7 +10,7 @@ Last modified: Sat Jan 18, 2014 05:01PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -26,7 +27,7 @@ objPathPat = re.compile(r'(\/\w+\[\d+\])+?$') def idPathToObjPath( idPath ): """ Append a [0] if missing from idPath. - + Id-paths do not have [0] at their end. This does not allow one to do algebra properly. """ diff --git a/moose-core/python/moose/moose.py b/moose-core/python/moose/moose.py index 9257a5cde162273a945af677b9c9f2eef88ab6c9..3fa32f5c371d8b81f8dd34211f00625d5ad6ac59 100644 --- a/moose-core/python/moose/moose.py +++ b/moose-core/python/moose/moose.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import # Author: Subhasis Ray @@ -5,9 +6,7 @@ from __future__ import print_function, division, absolute_import from contextlib import closing import warnings -import platform import pydoc -import os from io import StringIO import moose.SBML.readSBML as _readSBML @@ -19,7 +18,7 @@ try: import moose.genesis.writeKkit as _writeKkit except ImportError as e: kkitImport_ = False - kkitImport_err_ = '%s' % e + kkitImport_err_ = '%s' % e # Import function from C++ module into moose namespace. from moose._moose import * diff --git a/moose-core/python/moose/moose_config.py b/moose-core/python/moose/moose_config.py index f11343eb76fce6ba4d98aee7891b43f35ca63890..5b996c64344755715e094f950f83adb3196176f2 100644 --- a/moose-core/python/moose/moose_config.py +++ b/moose-core/python/moose/moose_config.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # This file is part of MOOSE simulator: http://moose.ncbs.res.in. # MOOSE is free software: you can redistribute it and/or modify @@ -13,12 +14,12 @@ # along with Foobar. If not, see <http://www.gnu.org/licenses/>. -"""multiscale_config.py: +"""multiscale_config.py: Last modified: Sat Jan 18, 2014 05:01PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -33,7 +34,7 @@ import datetime import time import os -# Universal paths +# Universal paths nmlPath = '/neuroml' nmlCellPath = os.path.join(nmlPath, 'cells') libraryPath = os.path.join(nmlPath, 'cells') diff --git a/moose-core/python/moose/moose_constants.py b/moose-core/python/moose/moose_constants.py index c2f44621249b4754dbc9c70dfe6cc90869d5c07e..804bc7ec2103f31ae22c38114f99dd50961493c1 100644 --- a/moose-core/python/moose/moose_constants.py +++ b/moose-core/python/moose/moose_constants.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # This file is part of MOOSE simulator: http://moose.ncbs.res.in. # MOOSE is free software: you can redistribute it and/or modify @@ -13,12 +14,12 @@ # along with MOOSE. If not, see <http://www.gnu.org/licenses/>. -"""moose_constants.py: +"""moose_constants.py: Last modified: Sat Jan 18, 2014 05:01PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, Dilawar Singh, NCBS Bangalore" __credits__ = ["NCBS Bangalore"] @@ -29,23 +30,23 @@ __email__ = "dilawars@ncbs.res.in" __status__ = "Development" ## for Ca Pool -# FARADAY = 96154.0 -# Coulombs +# FARADAY = 96154.0 +# Coulombs # from cadecay.mod : 1/(2*96154.0) = 5.2e-6 which is the Book of Genesis / readcell value FARADAY = 96485.3415 # Coulombs/mol # from Wikipedia ## Table step_mode # table acts as lookup - default mode -TAB_IO = 0 +TAB_IO = 0 # table outputs value until it reaches the end and then stays at the last value -TAB_ONCE = 2 +TAB_ONCE = 2 # table acts as a buffer: succesive entries at each time step -TAB_BUF = 3 +TAB_BUF = 3 # table acts as a buffer for spike times. Threshold stored in the pymoose 'stepSize' field. -TAB_SPIKE = 4 +TAB_SPIKE = 4 ## Table fill modes BSplineFill = 0 # B-spline fill (default) diff --git a/moose-core/python/moose/moose_test.py b/moose-core/python/moose/moose_test.py index e5f908bcfd8e05191510946f056bfc53dbda11ee..9cda2b80d81b4ffc20ff77bf0dae656c47763e7c 100644 --- a/moose-core/python/moose/moose_test.py +++ b/moose-core/python/moose/moose_test.py @@ -1,10 +1,11 @@ +# -*- coding: utf-8 -*- """ Test MOOSE installation with moose-examples. """ from __future__ import print_function - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2016, Dilawar Singh" __credits__ = ["NCBS Bangalore"] @@ -40,7 +41,7 @@ _logger = logging.getLogger('moose.test') _logger.addHandler(console) test_data_url_ = 'https://github.com/BhallaLab/moose-examples/archive/master.zip' -test_repo_url_ = 'https://github.com/BhallaLab/moose-examples' +test_repo_url_ = 'https://github.com/BhallaLab/moose-examples' test_dir_ = os.path.join( tempfile.gettempdir( ), 'moose-examples' ) ignored_dict_ = defaultdict( list ) @@ -73,7 +74,7 @@ class Command(object): def run(self, timeout): def target(): _logger.info( "Running %s" % self ) - self.process = subprocess.Popen( + self.process = subprocess.Popen( self.cmd, shell=False , stdout = self.fnull, stderr = subprocess.STDOUT ) @@ -94,7 +95,7 @@ def init_test_dir( ): if( not os.path.exists( test_dir_ ) ): os.makedirs( test_dir_ ) _logger.info( "Donwloading test repository" ) - subprocess.call( + subprocess.call( [ 'git', 'clone', '--depth=10', test_repo_url_, test_dir_ ] ) os.chdir( test_dir_ ) @@ -157,7 +158,7 @@ def print_test_stat( ): print( 'Total %d tests %s' % (len( test_status_[status] ), status ) ) def test_all( timeout, **kwargs ): - global test_dir_ + global test_dir_ global total_ scripts = [ ] for d, ds, fs in os.walk( test_dir_ ): diff --git a/moose-core/python/moose/neuroml/ChannelML.py b/moose-core/python/moose/neuroml/ChannelML.py index 78f09b211f48eba13d7de12073b0c19b38501b6b..d658bddf5b27578572d1a2de35bb89a4d1f87e37 100644 --- a/moose-core/python/moose/neuroml/ChannelML.py +++ b/moose-core/python/moose/neuroml/ChannelML.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ## Description: class ChannelML for loading ChannelML from file or xml element into MOOSE ## Version 1.0 by Aditya Gilra, NCBS, Bangalore, India, 2011 for serial MOOSE ## Version 1.5 by Niraj Dudani, NCBS, Bangalore, India, 2012, ported to parallel MOOSE @@ -51,7 +52,7 @@ class ChannelML(): if 'Physiological Units' in units: # see pg 219 (sec 13.2) of Book of Genesis Vfactor = 1e-3 # V from mV Tfactor = 1e-3 # s from ms - Gfactor = 1e-3 # S from mS + Gfactor = 1e-3 # S from mS elif 'SI Units' in units: Vfactor = 1.0 Tfactor = 1.0 @@ -61,7 +62,7 @@ class ChannelML(): sys.exit(1) moose.Neutral('/library') # creates /library in MOOSE tree; elif present, wraps synname = synapseElement.attrib['name'] - if utils.neuroml_debug: + if utils.neuroml_debug: pu.info("Loading synapse : %s into /library" % synname) moosesynapse = moose.SynChan('/library/'+synname) doub_exp_syn = synapseElement.find('./{'+self.cml+'}doub_exp_syn') @@ -92,7 +93,7 @@ class ChannelML(): moosesynhandler.weightMin = 0.0 ## connect the SimpleSynHandler or the STDPSynHandler to the SynChan (double exp) moose.connect( moosesynhandler, 'activationOut', moosesynapse, 'activation' ) - + def readChannelML(self,channelElement,params={},units="SI units"): ## I first calculate all functions assuming a consistent system of units. ## While filling in the A and B tables, I just convert to SI. @@ -100,8 +101,8 @@ class ChannelML(): if 'Physiological Units' in units: # see pg 219 (sec 13.2) of Book of Genesis Vfactor = 1e-3 # V from mV Tfactor = 1e-3 # s from ms - Gfactor = 1e1 # S/m^2 from mS/cm^2 - concfactor = 1e6 # Mol = mol/m^-3 from mol/cm^-3 + Gfactor = 1e1 # S/m^2 from mS/cm^2 + concfactor = 1e6 # Mol = mol/m^-3 from mol/cm^-3 elif 'SI Units' in units: Vfactor = 1.0 Tfactor = 1.0 @@ -112,7 +113,7 @@ class ChannelML(): sys.exit(1) moose.Neutral('/library') # creates /library in MOOSE tree; elif present, wraps channel_name = channelElement.attrib['name'] - if utils.neuroml_debug: + if utils.neuroml_debug: pu.info("Loading channel %s into /library" % channel_name) IVrelation = channelElement.find('./{'+self.cml+'}current_voltage_relation') @@ -142,7 +143,7 @@ class ChannelML(): moosechannel = moose.HHChannel('/library/'+channel_name) else: moosechannel = moose.HHChannel2D('/library/'+channel_name) - + if IVrelation.attrib['cond_law']=="ohmic": moosechannel.Gbar = float(IVrelation.attrib['default_gmax']) * Gfactor moosechannel.Ek = float(IVrelation.attrib['default_erev']) * Vfactor @@ -160,7 +161,7 @@ class ChannelML(): nernstMstring = moose.Mstring(moosechannel.path+'/nernst_str') nernstMstring.value = str( float(nernst_params[1].split('=')[1]) * concfactor ) + \ ',' + str( int(nernst_params[2].split('=')[1]) ) - + gates = IVrelation.findall('./{'+self.cml+'}gate') if len(gates)>3: pu.fatal("Sorry! Maximum x, y, and z (three) gates are possible in MOOSE/Genesis") @@ -189,7 +190,7 @@ class ChannelML(): self.parameters = [] for parameter in channelElement.findall('.//{'+self.cml+'}parameter'): self.parameters.append( (parameter.attrib['name'],float(parameter.attrib['value'])) ) - + for num,gate in enumerate(gates): # if no q10settings tag, the q10factor remains 1.0 # if present but no gate attribute, then set q10factor @@ -221,7 +222,7 @@ class ChannelML(): elif num == 2: moosechannel.Zpower = gate_power if concdep is not None: moosechannel.Zindex = "VOLT_C1_INDEX" - + ## Getting handle to gate using the gate's path. gate_path = moosechannel.path + '/' + gate_full_name[ num ] if concdep is None: @@ -235,7 +236,7 @@ class ChannelML(): moosegate.useInterpolation = True else: moosegate = moose.HHGate2D( gate_path ) - + ##### If alpha and beta functions exist, make them here for transition in gate.findall('./{'+self.cml+'}transition'): ## make python functions with names of transitions... @@ -247,7 +248,7 @@ class ChannelML(): else: pu.fatal("Unsupported transition %s" % fn_name) sys.exit() - + time_course = gate.find('./{'+self.cml+'}time_course') ## tau is divided by self.q10factor in make_function() ## thus, it gets divided irrespective of <time_course> tag present or not. @@ -259,13 +260,13 @@ class ChannelML(): if concdep is None: ca_name = '' # no Ca dependence else: ca_name = ','+concdep.attrib['variable_name'] # Ca dependence - + ## Create tau() and inf() if not present, from alpha() and beta() for fn_element,fn_name,fn_expr in [(time_course,'tau',"1/(alpha+beta)"),\ (steady_state,'inf',"alpha/(alpha+beta)")]: ## put in args for alpha and beta, could be v and Ca dep. expr_string = fn_expr.replace('alpha', 'self.alpha(v'+ca_name+')') - expr_string = expr_string.replace('beta', 'self.beta(v'+ca_name+')') + expr_string = expr_string.replace('beta', 'self.beta(v'+ca_name+')') ## if time_course/steady_state are not present, ## then alpha annd beta transition elements should be present, and fns created. if fn_element is None: @@ -281,17 +282,17 @@ class ChannelML(): tableB = [ 0.0 ] * n_entries for i in range(n_entries): v = v0 + i * dv_here - + inf = self.inf(v) - tau = self.tau(v) + tau = self.tau(v) ## convert to SI before writing to table ## qfactor is already in inf and tau tableA[i] = inf/tau / Tfactor tableB[i] = 1.0/tau / Tfactor - + moosegate.tableA = tableA moosegate.tableB = tableB - + ## Ca dependent channel else: ## UNITS: while calculating, use the units used in xml defn, @@ -390,7 +391,7 @@ class ChannelML(): caPool.thick = float(volInfo.attrib['shell_thickness']) * Lfactor fixedPoolInfo = poolModel.find('./{'+self.cml+'}fixed_pool_info') if fixedPoolInfo is not None: - ## Put in phi under the caPool, so that it can + ## Put in phi under the caPool, so that it can ## be used instead of thickness to set B (see section 19.2 in Book of Genesis) caPool_phi = moose.Mstring(caPool.path+'/phi') caPool_phi.value = str( float(fixedPoolInfo.attrib['phi']) * concfactor/Ifactor/Tfactor ) @@ -413,12 +414,12 @@ class ChannelML(): if concdep is None: ca_name = '' # no Ca dependence else: ca_name = ','+concdep.attrib['variable_name'] # Ca dependence expr_string = expr_string.replace( 'alpha', 'self.alpha(v'+ca_name+')') - expr_string = expr_string.replace( 'beta', 'self.beta(v'+ca_name+')') + expr_string = expr_string.replace( 'beta', 'self.beta(v'+ca_name+')') fn = self.make_function( fn_name, fn_type, expr_string=expr_string, concdep=concdep ) else: pu.fatal("Unsupported function type %s "% fn_type) sys.exit() - + def make_function(self, fn_name, fn_type, **kwargs): """ This dynamically creates a function called fn_name If fn_type is exponential, sigmoid or exp_linear, diff --git a/moose-core/python/moose/neuroml/MorphML.py b/moose-core/python/moose/neuroml/MorphML.py index 6b66346bfce93588a39bd0568256aba67f12caf7..b89f76e9aa99f696327794f01c74f691cd9ff84c 100644 --- a/moose-core/python/moose/neuroml/MorphML.py +++ b/moose-core/python/moose/neuroml/MorphML.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ## Description: class MorphML for loading MorphML from file or xml element into MOOSE ## Version 1.0 by Aditya Gilra, NCBS, Bangalore, India, 2011 for serial MOOSE ## Version 1.5 by Niraj Dudani, NCBS, Bangalore, India, 2012, ported to parallel MOOSE @@ -127,7 +128,7 @@ class MorphML(): self.cablegroupsInhomoparamsDict[cablegroupname] = [] for cable in cablegroup.findall(".//{"+self.mml+"}cable"): cableid = cable.attrib['id'] - self.cablegroupsDict[cablegroupname].append(cableid) + self.cablegroupsDict[cablegroupname].append(cableid) # parse inhomogenous_params for inhomogeneous_param in cablegroup.findall(".//{"+self.mml+"}inhomogeneous_param"): metric = inhomogeneous_param.find(".//{"+self.mml+"}metric") @@ -140,7 +141,7 @@ class MorphML(): _logger.warning('Only "Path Length from root" metric is ' ' supported currently, ignoring %s ' % metric.text ) - + ## <cable>s with list of <meta:group>s cables = cell.findall(".//{"+self.mml+"}cable") for cable in cables: @@ -164,7 +165,7 @@ class MorphML(): if "passive_conductance" in mechanism.attrib: if mechanism.attrib['passive_conductance'] in ["true",'True','TRUE']: passive = True - if not passive: + if not passive: ## if channel does not exist in library load it from xml file if not moose.exists("/library/"+mechanismname): _logger.info("Loading mechanism %s into library." % mechanismname) @@ -178,7 +179,7 @@ class MorphML(): 'For mechanism {0}: files {1} not found under {2}.'.format( mechanismname, model_filename, self.model_dir) ) - + ## set those compartments to be LIF for which ## any integrate_and_fire parameter is set if not moose.exists( "/library/"+mechanismname): @@ -205,7 +206,7 @@ class MorphML(): self.intFireCableIds[cableid] = mechanismname if 'all' in self.intFireCableIds: break - + ############################################################ #### load morphology and connections between compartments ## Many neurons exported from NEURON have multiple segments in a section @@ -340,13 +341,13 @@ class MorphML(): if running_comp.length == 0.0: running_comp.length = running_comp.diameter ## Set the segDict - ## the empty list at the end below will get populated + ## the empty list at the end below will get populated ## with the potential synapses on this segment, in function set_compartment_param(..) self.segDict[running_segid] = [running_comp.name,\ (running_comp.x0,running_comp.y0,running_comp.z0),\ (running_comp.x,running_comp.y,running_comp.z),\ running_comp.diameter,running_comp.length,[]] - if neuroml_utils.neuroml_debug: + if neuroml_utils.neuroml_debug: _logger.info('Set up compartment/section %s' % running_comp.name) ############################################### @@ -404,7 +405,7 @@ class MorphML(): if len(mech_params) == 0: for compartment_list in self.cellDictByCableId[cellname][1].values(): for compartment in compartment_list: - self.set_compartment_param(compartment,None,'default',mechanismname) + self.set_compartment_param(compartment,None,'default',mechanismname) ## if params are present, apply params to specified cable/compartment groups for parameter in mech_params: parametername = parameter.attrib['name'] @@ -420,8 +421,8 @@ class MorphML(): 'inject', Ifactor*float(parameter.attrib["value"]), self.bio) else: _logger.warning(["Yo programmer of MorphML! You didn't" - , " implement parameter %s " % parametername - , " in mechanism %s " % mechanismname + , " implement parameter %s " % parametername + , " in mechanism %s " % mechanismname ] ) else: @@ -453,10 +454,10 @@ class MorphML(): , " implement parameter %s " % parametername , " in mechanism %s " % mechanismname ] ) - + ## variable parameters: ## varying with: - ## p, g, L, len, dia + ## p, g, L, len, dia ## p: path distance from soma, measured along dendrite, in metres. ## g: geometrical distance from soma, in metres. ## L: electrotonic distance (# of lambdas) from soma, along dend. No units. @@ -505,7 +506,7 @@ class MorphML(): for compartment_list in self.cellDictByCableId[cellname][1].values(): moose_utils.connect_CaConc(compartment_list,\ self.temperature+neuroml_utils.ZeroCKelvin) # temperature should be in Kelvin for Nernst - + ########################################################## #### load connectivity / synapses into the compartments connectivity = cell.find(".//{"+self.neuroml+"}connectivity") @@ -571,7 +572,7 @@ class MorphML(): compartment.initVm = value elif name == 'inject': # this reader converts to SI - _logger.info("Comparment %s inject %s A." % (compartment.name, value)) + _logger.info("Comparment %s inject %s A." % (compartment.name, value)) compartment.inject = value elif name == 'v_reset': compartment.vReset = value # compartment is a moose.LIF instance (intfire) @@ -662,5 +663,5 @@ class MorphML(): ## Later, when calling connect_CaConc, ## B is set for caconc based on thickness of Ca shell and compartment l and dia. ## OR based on the Mstring phi under CaConc path. - if neuroml_utils.neuroml_debug: + if neuroml_utils.neuroml_debug: _logger.info("Setting %s for comparment %s to %s" % (name, compartment.path, value)) diff --git a/moose-core/python/moose/neuroml/NetworkML.py b/moose-core/python/moose/neuroml/NetworkML.py index b96eeec884f13d3b2b2c4aa5aa541e13c666ce54..f85a6f76eb1ad7961e6f11ced574de5fc4715a6f 100644 --- a/moose-core/python/moose/neuroml/NetworkML.py +++ b/moose-core/python/moose/neuroml/NetworkML.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ## Description: class NetworkML for loading NetworkML from file or xml element into MOOSE ## Version 1.0 by Aditya Gilra, NCBS, Bangalore, India, 2011 for serial MOOSE ## Version 1.5 by Niraj Dudani, NCBS, Bangalore, India, 2012, ported to parallel MOOSE @@ -42,7 +43,7 @@ class NetworkML(): self.model_dir = nml_params['model_dir'] def readNetworkMLFromFile(self,filename,cellSegmentDict,params={}): - """ + """ specify tweak params = {'excludePopulations':[popname1,...], 'excludeProjections':[projname1,...], \ 'onlyInclude':{'includePopulation':(popname,[id1,...]),'includeProjections':(projname1,...)} } If excludePopulations is present, then excludeProjections must also be present: @@ -88,7 +89,7 @@ class NetworkML(): self.params = params self.populationDict = {} - [ self.createPopulation(pop) for pop in + [ self.createPopulation(pop) for pop in self.network.findall(".//{"+nml_ns+"}population") ] @@ -96,7 +97,7 @@ class NetworkML(): projections = self.network.find(".//{"+nml_ns+"}projections") if projections: # see pg 219 (sec 13.2) of Book of Genesis - if projections.attrib["units"] == 'Physiological Units': + if projections.attrib["units"] == 'Physiological Units': Efactor = 1e-3 # V from mV Tfactor = 1e-3 # s from ms else: @@ -109,12 +110,12 @@ class NetworkML(): _logger.info("Creating input under /elec ") units = inputs.attrib['units'] # see pg 219 (sec 13.2) of Book of Genesis - if units == 'Physiological Units': - Vfactor, Tfactor, Ifactor = 1e-3, 1e-3, 1e-6 + if units == 'Physiological Units': + Vfactor, Tfactor, Ifactor = 1e-3, 1e-3, 1e-6 else: Vfactor, Tfactor, Ifactor = 1.0, 1.0, 1.0 [ self.createInput(inputelem, Vfactor, Tfactor, Ifactor) for - inputelem in self.network.findall(".//{"+nml_ns+"}input") + inputelem in self.network.findall(".//{"+nml_ns+"}input") ] return (self.populationDict,self.projectionDict) @@ -160,7 +161,7 @@ class NetworkML(): _logger.debug("Adding pulse at {0}: {1}".format( segment_path, pulsegen.firstLevel ) ) - + _logger.debug("Connecting {0}:output to {1}:injectMst".format( iclamp, compartment) ) @@ -218,7 +219,7 @@ class NetworkML(): y = float(location.attrib['y'])*self.length_factor z = float(location.attrib['z'])*self.length_factor self.translate_rotate(cell,x,y,z,zrotation) - + def translate_rotate(self,obj,x,y,z,ztheta): # recursively translate all compartments under obj for childId in obj.children: try: @@ -394,7 +395,7 @@ class NetworkML(): ## wrap Synapse element by moose.Synapse(synhandler.path+'/synapse') or synhandler.synapse ## Synpase is an array element, first add to it, to addSpike-s, get/set weights, etc. synhandler.numSynapses += 1 - ## see Demos/snippets/synapse.py for an example of + ## see Demos/snippets/synapse.py for an example of ## how to connect multiple SpikeGens to the same SynChan m = moose.connect(spikegen, 'spikeOut', synhandler.synapse[-1], 'addSpike', 'Single') diff --git a/moose-core/python/moose/neuroml/NeuroML.py b/moose-core/python/moose/neuroml/NeuroML.py index 7358baee4cfc1c549885854b798c25dfecab4d3b..e558f443002774ff2704b282a65f552871738574 100644 --- a/moose-core/python/moose/neuroml/NeuroML.py +++ b/moose-core/python/moose/neuroml/NeuroML.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ## Description: class NeuroML for loading NeuroML from single file into MOOSE ## Version 1.0 by Aditya Gilra, NCBS, Bangalore, India, 2011 for serial MOOSE ## Version 1.5 by Niraj Dudani, NCBS, Bangalore, India, 2012, ported to parallel MOOSE @@ -86,7 +87,7 @@ class NeuroML(): self.lengthUnits = root_element.attrib['lengthUnits'] else: self.lengthUnits = 'micrometer' - + ## lots of gymnastics to check if temperature meta tag is present self.temperature = CELSIUS_default # gets replaced below if tag for temperature is present self.temperature_default = True @@ -101,7 +102,7 @@ class NeuroML(): tag = meta_property.find('.//{'+meta_ns+'}tag') tagname = tag.text if 'temperature' in tagname: - ## value can be a tag or an element + ## value can be a tag or an element if 'value' in list(tag.attrib.keys()): # value is an attrib self.temperature = float(tag.attrib['value']) self.temperature_default = False diff --git a/moose-core/python/moose/neuroml/__init__.py b/moose-core/python/moose/neuroml/__init__.py index 7c911ae41023ec72a11ea1f50399b5c00f5a4a54..9dd74d554fe8ddd44e289858656cc58ac637667c 100644 --- a/moose-core/python/moose/neuroml/__init__.py +++ b/moose-core/python/moose/neuroml/__init__.py @@ -1,9 +1,10 @@ +# -*- coding: utf-8 -*- from .NeuroML import NeuroML, loadNeuroML_L123 from .NetworkML import NetworkML from .MorphML import MorphML from .ChannelML import ChannelML -import tempfile +import tempfile import logging debug_ = False diff --git a/moose-core/python/moose/neuroml/utils.py b/moose-core/python/moose/neuroml/utils.py index 9ca8d226f8222ba2a3250e941e24301f05fd7529..95d3569407853140983a290fb5b755ad41079870 100644 --- a/moose-core/python/moose/neuroml/utils.py +++ b/moose-core/python/moose/neuroml/utils.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ## Description: utility functions used while loading NeuroML L1,2,3 files. ## Version 1.0 by Aditya Gilra, NCBS, Bangalore, India, 2011 for serial MOOSE ## Version 1.5 by Niraj Dudani, NCBS, Bangalore, India, 2012, modified for parallel MOOSE @@ -189,7 +190,7 @@ def keepOnlyInclude(network, onlyInclude): ## to have only unique cell_ids and save time below. for key in includeCellsDict: includeCellsDict[key] = set(includeCellsDict[key]) - + print("removing extra cells ... ") ### remove the cells that are not in includeCellsDict populations = network.find(".//{"+nml_ns+"}populations") diff --git a/moose-core/python/moose/neuroml2/__init__.py b/moose-core/python/moose/neuroml2/__init__.py index d792d417a55f99212694fac38a4e36bc77011305..b7f2f2943bdac10c5f55e744f49e838c6807712b 100644 --- a/moose-core/python/moose/neuroml2/__init__.py +++ b/moose-core/python/moose/neuroml2/__init__.py @@ -1,47 +1,48 @@ -# __init__.py --- -# +# -*- coding: utf-8 -*- +# __init__.py --- +# # Filename: __init__.py -# Description: +# Description: # Author: subha -# Maintainer: +# Maintainer: # Created: Sun Apr 17 13:55:30 2016 (-0400) -# Version: +# Version: # Last-Updated: Sun Apr 17 14:59:06 2016 (-0400) # By: subha # Update #: 20 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: """neuroml2 submodule handles NeuroML2 models in MOOSE. @@ -49,7 +50,7 @@ NML2Reader class allows reading of NeuroML2 cell models with Hodgkin-Huxley type ion channels. -The [Ca2+] dependent channel reading may be incomplete. +The [Ca2+] dependent channel reading may be incomplete. Some functions for converting in-memory MOOSE models into NeuroML2 are available in converter.py. But the complete cell-model writing is not @@ -62,5 +63,5 @@ from reader import NML2Reader __all__ = ['NML2Reader'] -# +# # __init__.py ends here diff --git a/moose-core/python/moose/neuroml2/converter.py b/moose-core/python/moose/neuroml2/converter.py index d85f1c99c35e8916ef15c8ae6a05ce0a44023bd6..37dc7307faf57a4d8f8b6d5b0811b8ab51149e13 100644 --- a/moose-core/python/moose/neuroml2/converter.py +++ b/moose-core/python/moose/neuroml2/converter.py @@ -1,50 +1,51 @@ -# converter.py --- -# +# -*- coding: utf-8 -*- +# converter.py --- +# # Filename: mtoneuroml.py -# Description: -# Author: -# Maintainer: +# Description: +# Author: +# Maintainer: # Created: Mon Apr 22 12:15:23 2013 (+0530) -# Version: +# Version: # Last-Updated: Wed Jul 10 16:36:14 2013 (+0530) # By: subha # Update #: 819 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# # Utility for converting a MOOSE model into NeuroML2. This uses Python # libNeuroML. -# -# +# +# # Change log: -# +# # Tue May 21 16:58:03 IST 2013 - Subha moved the code for function # fitting to hhfit.py. -# -# +# +# # 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: @@ -63,7 +64,7 @@ from matplotlib import pyplot as plt import moose from moose.utils import autoposition -import neuroml +import neuroml import hhfit @@ -77,15 +78,15 @@ def convert_morphology(root, positions='auto'): Parameters ---------- root : a moose element containing a single cell model. - + positions : string flag to indicate if the positions of the end points of the compartments are explicitly available in the compartments or should be automatically generated. Possible values: - + `auto` - automatically generate z coordinates using length of the compartments. - + `explicit` - model has explicit coordinates for all compartments. Return @@ -96,7 +97,7 @@ def convert_morphology(root, positions='auto'): if positions == 'auto': queue = deque([autoposition(root)]) elif positions == 'explicit': - compartments = moose.wildcardFind('%s/##[TYPE=Compartment]' % (root.path)) + compartments = moose.wildcardFind('%s/##[TYPE=Compartment]' % (root.path)) queue = deque([compartment for compartment in map(moose.element, compartments) if len(compartment.neighbours['axial']) == 0]) if len(queue) != 1: @@ -108,22 +109,22 @@ def convert_morphology(root, positions='auto'): while len(queue) > 0: compartment = queue.popleft() proximal = neuroml.Point3DWithDiam(x=compartment.x0, - y=compartment.y0, + y=compartment.y0, z=compartment.z0, diameter=compartment.diameter) distal = neuroml.Point3DWithDiam(x=compartment.x, y=compartment.y, - z=compartment.z, + z=compartment.z, diameter=compartment.diameter) plist = list(map(moose.element, compartment.neighbours['axial'])) - try: + try: parent = neuroml.SegmentParent(segments=comp_seg[moose.element(plist[0])].id) except (KeyError, IndexError) as e: parent = None segment = neuroml.Segment(id=compartment.id_.value, - proximal=proximal, - distal=distal, - parent=parent) + proximal=proximal, + distal=distal, + parent=parent) # TODO: For the time being using numerical value of the moose # id for neuroml id.This needs to be updated for handling # array elements @@ -142,9 +143,9 @@ def define_vdep_rate(fn, name): """ ctype = neuroml.ComponentType(name) # This is going to be ugly ... - - - + + + def convert_hhgate(gate): """Convert a MOOSE gate into GateHHRates in NeuroML""" hh_rates = neuroml.GateHHRates(id=gate.id_.value, name=gate.name) @@ -161,7 +162,7 @@ def convert_hhgate(gate): afn_component_type = None if afn_type is None: afn_type, afn_component_type = define_component_type(afn) - hh_rates.forward_rate = neuroml.HHRate(type=afn_type, + hh_rates.forward_rate = neuroml.HHRate(type=afn_type, midpoint='%gmV' % (ap[2]), scale='%gmV' % (ap[1]), rate='%gper_ms' % (ap[0])) @@ -169,13 +170,13 @@ def convert_hhgate(gate): bfn_component_type = None if bfn_type is None: bfn_type, bfn_component_type = define_component_type(bfn) - hh_rates.reverse_rate = neuroml.HHRate(type=bfn_type, + hh_rates.reverse_rate = neuroml.HHRate(type=bfn_type, midpoint='%gmV' % (bp[2]), scale='%gmV' % (bp[1]), rate='%gper_ms' % (bp[0])) return hh_rates, afn_component_type, bfn_component_type - - + + def convert_hhchannel(channel): """Convert a moose HHChannel object into a neuroml element. @@ -202,5 +203,5 @@ def convert_hhchannel(channel): return nml_channel -# +# # converter.py ends here diff --git a/moose-core/python/moose/neuroml2/generated_neuroml.py b/moose-core/python/moose/neuroml2/generated_neuroml.py index 0cbf3ffd2c854147cd5d8819fc15e37b9f3581b4..a7f07c270c357d431a5982ccf69127b0dc06b18d 100644 --- a/moose-core/python/moose/neuroml2/generated_neuroml.py +++ b/moose-core/python/moose/neuroml2/generated_neuroml.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # -*- coding: utf-8 -*- diff --git a/moose-core/python/moose/neuroml2/generated_neuromlsub.py b/moose-core/python/moose/neuroml2/generated_neuromlsub.py index 55e2300a6eda802370e3f03b5d675272d75dd70c..662fd4485ff818c701d77d92015dc430c8c29233 100644 --- a/moose-core/python/moose/neuroml2/generated_neuromlsub.py +++ b/moose-core/python/moose/neuroml2/generated_neuromlsub.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # @@ -20,7 +21,7 @@ import sys from lxml import etree as etree_ -# FIXME: Comment it out +# FIXME: Comment it out # import ??? as supermod def parsexml_(infile, parser=None, **kwargs): diff --git a/moose-core/python/moose/neuroml2/hhfit.py b/moose-core/python/moose/neuroml2/hhfit.py index 764d1c88c6ac37e1a7c7c44ba79f2ffcb28bf5a8..dc64618268bc63996a3a40b89d7645d893f69230 100644 --- a/moose-core/python/moose/neuroml2/hhfit.py +++ b/moose-core/python/moose/neuroml2/hhfit.py @@ -1,52 +1,53 @@ -# hhfit.py --- -# +# -*- coding: utf-8 -*- +# hhfit.py --- +# # Filename: hhfit.py -# Description: -# Author: -# Maintainer: +# Description: +# Author: +# Maintainer: # Created: Tue May 21 16:31:56 2013 (+0530) -# Version: +# Version: # Last-Updated: Tue Jun 11 16:57:30 2013 (+0530) # By: subha # Update #: 34 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# # Functions for fitting common equations for Hodgkin-Huxley type gate # equations. -# -# +# +# # Change log: -# +# # Tue May 21 16:33:59 IST 2013 - Subha refactored the code from # converter.py to hhfit.py. -# +# -# -# +# +# # 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: @@ -64,7 +65,7 @@ def sigmoid(x, a, k, x0, y0=0): return a / (np.exp(k * (x - x0)) + 1.0) + y0 def linoid(x, a, k, x0, y0=0): - """The so called linoid function. Called explinear in neurml.""" + """The so called linoid function. Called explinear in neurml.""" denominator = np.exp(k * (x - x0)) - 1.0 # Linoid often includes a zero denominator - we need to fill those # points with interpolated values (interpolation is simpler than @@ -99,7 +100,7 @@ fn_rate_map = { exponential: 'HHExpRate', sigmoid: 'HHSigmoidRate', linoid: 'HHExpLinearRate', - double_exp: None, + double_exp: None, } # These are default starting parameter values @@ -198,8 +199,8 @@ def find_ratefn(x, y, **kwargs): y: 1D array function values. - - **kwargs: keyword arguments + + **kwargs: keyword arguments passed to randomized_curve_fit. Returns @@ -219,7 +220,7 @@ def find_ratefn(x, y, **kwargs): if p is None: continue popt = p[0] - pcov = p[1] + pcov = p[1] error = y - fn(x, *popt) erms = np.sqrt(np.mean(error**2)) # Ideally I want a fuzzy selection criterion here - a @@ -241,5 +242,5 @@ def find_ratefn(x, y, **kwargs): -# +# # hhfit.py ends here diff --git a/moose-core/python/moose/neuroml2/reader.py b/moose-core/python/moose/neuroml2/reader.py index ec2e266a54ecf5837afb86694a9723b05946b42d..eb33f1fb546f4f070b60bc701df21f00cc3c53a2 100644 --- a/moose-core/python/moose/neuroml2/reader.py +++ b/moose-core/python/moose/neuroml2/reader.py @@ -1,47 +1,48 @@ -# reader.py --- -# +# -*- coding: utf-8 -*- +# reader.py --- +# # Filename: reader.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Wed Jul 24 15:55:54 2013 (+0530) -# Version: +# Version: # Last-Updated: Sun Apr 17 16:32:59 2016 (-0400) # By: subha # Update #: 455 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# -# -# -# +# 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: """Implementation of reader for NeuroML 2 models. @@ -87,8 +88,8 @@ def sarea(comp): Returns ------- s : float - surface area of `comp`. - + surface area of `comp`. + """ if comp.length > 0: return comp.length * comp.diameter * np.pi @@ -111,7 +112,7 @@ def setRa(comp, resistivity): def setRm(comp, resistivity): """Set membrane resistance""" comp.Rm = resistivity / sarea(comp) - + def getSegments(nmlcell, component, sg_to_segments): """Get the list of segments the `component` is applied to""" @@ -132,7 +133,7 @@ rate_fn_map = { 'HHExpRate': hhfit.exponential, 'HHSigmoidRate': hhfit.sigmoid, 'HHExpLinearRate': hhfit.linoid } - + def calculateRateFn(ratefn, vmin, vmax, tablen=3000): """Returns A / B table from ngate.""" midpoint, rate, scale = map(SI, (ratefn.midpoint, ratefn.rate, ratefn.scale)) @@ -140,7 +141,7 @@ def calculateRateFn(ratefn, vmin, vmax, tablen=3000): return rate_fn_map[ratefn.type_](tab, rate, scale, midpoint) class NML2Reader(object): - """Reads NeuroML2 and creates MOOSE model. + """Reads NeuroML2 and creates MOOSE model. NML2Reader.read(filename) reads an NML2 model under `/library` with the toplevel name defined in the NML2 file. @@ -150,14 +151,14 @@ class NML2Reader(object): >>> from moose import neuroml2 as nml >>> reader = nml.NML2Reader() >>> reader.read('moose/neuroml2/test_files/Purk2M9s.nml') - + creates a passive neuronal morphology `/library/Purk2M9s`. """ def __init__(self, verbose=False): self.lunit = 1e-6 # micron is the default length unit self.verbose = verbose self.doc = None - self.filename = None + self.filename = None self.nml_to_moose = {} # NeuroML object to MOOSE object self.moose_to_nml = {} # Moose object to NeuroML object self.proto_cells = {} # map id to prototype cell in moose @@ -167,7 +168,7 @@ class NML2Reader(object): self.lib = moose.Neutral('/library') self.id_to_ionChannel = {} self._cell_to_sg = {} # nml cell to dict - the dict maps segment groups to segments - + def read(self, filename): self.doc = nml.parse(filename, silence=True) if self.verbose: @@ -188,7 +189,7 @@ class NML2Reader(object): self.createMorphology(cell, nrn, symmetric=symmetric) self.importBiophysics(cell, nrn) return cell, nrn - + def createMorphology(self, nmlcell, moosecell, symmetric=False): """Create the MOOSE compartmental morphology in `moosecell` using the segments in NeuroML2 cell `nmlcell`. Create symmetric @@ -197,7 +198,7 @@ class NML2Reader(object): """ morphology = nmlcell.morphology segments = morphology.segment - id_to_segment = dict([(seg.id, seg) for seg in segments]) + id_to_segment = dict([(seg.id, seg) for seg in segments]) if symmetric: compclass = moose.SymCompartment else: @@ -223,8 +224,8 @@ class NML2Reader(object): except AttributeError: parent = None self.moose_to_nml[comp] = segment - self.nml_to_moose[segment] = comp - p0 = segment.proximal + self.nml_to_moose[segment] = comp + p0 = segment.proximal if p0 is None: if parent: p0 = parent.distal @@ -243,12 +244,12 @@ class NML2Reader(object): if parent: pcomp = id_to_comp[parent.id] moose.connect(comp, src, pcomp, dst) - sg_to_segments = {} + sg_to_segments = {} for sg in morphology.segmentGroup: sg_to_segments[sg.id] = [id_to_segment[str(m.segment)] for m in sg.member] self._cell_to_sg[nmlcell] = sg_to_segments return id_to_comp, id_to_segment, sg_to_segments - + def importBiophysics(self, nmlcell, moosecell): """Create the biophysical components in moose Neuron `moosecell` according to NeuroML2 cell `nmlcell`.""" @@ -272,7 +273,7 @@ class NML2Reader(object): cm = SI(specific_cm.value) for seg in sg_to_segments[specific_cm.segmentGroup]: comp = self.nml_to_moose[seg] - comp.Cm = np.pi * sarea(comp) + comp.Cm = np.pi * sarea(comp) def importIntracellularProperties(self, nmlcell, moosecell, properties): self.importAxialResistance(nmlcell, properties) @@ -286,7 +287,7 @@ class NML2Reader(object): continue segments = getSegments(nmlcell, species, sg_to_segments) for seg in segments: - comp = self.nml_to_moose[seg] + comp = self.nml_to_moose[seg] self.copySpecies(species, comp) def copySpecies(self, species, compartment): @@ -304,16 +305,16 @@ class NML2Reader(object): raise Exception('No prototype pool for %s referred to by %s' % (species.concentrationModel, species.id)) pool_id = moose.copy(proto_pool, comp, species.id) pool = moose.element(pool_id) - pool.B = pool.B / (np.pi * compartment.length * (0.5 * compartment.diameter + pool.thickness) * (0.5 * compartment.diameter - pool.thickness)) + pool.B = pool.B / (np.pi * compartment.length * (0.5 * compartment.diameter + pool.thickness) * (0.5 * compartment.diameter - pool.thickness)) return pool - + def importAxialResistance(self, nmlcell, intracellularProperties): sg_to_segments = self._cell_to_sg[nmlcell] for r in intracellularProperties.resistivity: segments = getSegments(nmlcell, r, sg_to_segments) for seg in segments: comp = self.nml_to_moose[seg] - setRa(comp, SI(r.value)) + setRa(comp, SI(r.value)) def importChannelsToCell(self, nmlcell, moosecell, membraneProperties): sg_to_segments = self._cell_to_sg[nmlcell] @@ -323,7 +324,7 @@ class NML2Reader(object): try: ionChannel = self.id_to_ionChannel[chdens.ionChannel] except KeyError: - print('No channel with id', chdens.ionChannel) + print('No channel with id', chdens.ionChannel) continue if ionChannel.type_ == 'ionChannelPassive': for seg in segments: @@ -331,7 +332,7 @@ class NML2Reader(object): else: for seg in segments: self.copyChannel(chdens, self.nml_to_moose[seg], condDensity) - + def copyChannel(self, chdens, comp, condDensity): """Copy moose prototype for `chdens` condutcance density to `comp` compartment. @@ -351,9 +352,9 @@ class NML2Reader(object): chan = moose.element(chid) chan.Gbar = sarea(comp) * condDensity moose.connect(chan, 'channel', comp, 'channel') - return chan + return chan - def importIncludes(self, doc): + def importIncludes(self, doc): for include in doc.include: if self.verbose: print(self.filename, 'Loading include', include) @@ -362,7 +363,7 @@ class NML2Reader(object): paths = [include.href, os.path.join(os.path.dirname(self.filename), include.href)] for path in paths: try: - inner.read(path) + inner.read(path) if self.verbose: print(self.filename, 'Loaded', path, '... OK') except IOError as e: @@ -448,7 +449,7 @@ class NML2Reader(object): proto = self.createDecayingPoolConcentrationModel(concModel) def createDecayingPoolConcentrationModel(self, concModel): - """Create prototype for concentration model""" + """Create prototype for concentration model""" if concModel.name is not None: name = concModel.name else: @@ -466,9 +467,9 @@ class NML2Reader(object): self.nml_to_moose[concModel.id] = ca self.moose_to_nml[ca] = concModel logger.debug('Created moose element: %s for nml conc %s' % (ca.path, concModel.id)) - - - -# + + + +# # reader.py ends here diff --git a/moose-core/python/moose/neuroml2/test_converter.py b/moose-core/python/moose/neuroml2/test_converter.py index 314555186b09ec0a92b5e86efb731e85d481423a..20108b82840c251d64c45edcae60473756414d41 100644 --- a/moose-core/python/moose/neuroml2/test_converter.py +++ b/moose-core/python/moose/neuroml2/test_converter.py @@ -1,49 +1,50 @@ -# test_converter.py --- -# +# -*- coding: utf-8 -*- +# test_converter.py --- +# # Filename: test_converter.py -# Description: -# Author: -# Maintainer: +# Description: +# Author: +# Maintainer: # Created: Tue Apr 23 18:51:58 2013 (+0530) -# Version: +# Version: # Last-Updated: Tue May 21 16:59:09 2013 (+0530) # By: subha # Update #: 327 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# Commentary: +# +# +# +# # Change log: -# +# # Tue May 21 16:58:53 IST 2013 - Subha moved code for testing curve # fitting to test_hhfit.py. -# -# +# +# # 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: @@ -80,7 +81,7 @@ class TestConvertMorphology(unittest.TestCase): moose.connect(parent, 'raxial', comp, 'axial') comps.append(comp) parent = comp - + def test_convert_morphology(self): morph = converter.convert_morphology(self.neuron, positions='auto') cell = neuroml.Cell() @@ -90,14 +91,14 @@ class TestConvertMorphology(unittest.TestCase): doc = neuroml.NeuroMLDocument() doc.cells.append(cell) doc.id = 'TestNeuroMLDocument' - fname = os.path.join(outdir, 'test_morphology_conversion.nml') + fname = os.path.join(outdir, 'test_morphology_conversion.nml') NeuroMLWriter.write(doc, fname) print('Wrote', fname) if __name__ == '__main__': unittest.main() - -# + +# # test_converter.py ends here diff --git a/moose-core/python/moose/neuroml2/test_hhfit.py b/moose-core/python/moose/neuroml2/test_hhfit.py index 31156ff3997067e10f9b0d4ac419e42bb48f0d1c..b97109f37e920a8a59a6ec9527859b3e3f65f9b6 100644 --- a/moose-core/python/moose/neuroml2/test_hhfit.py +++ b/moose-core/python/moose/neuroml2/test_hhfit.py @@ -1,49 +1,50 @@ -# test_hhfit.py --- -# +# -*- coding: utf-8 -*- +# test_hhfit.py --- +# # Filename: test_hhfit.py -# Description: -# Author: -# Maintainer: +# Description: +# Author: +# Maintainer: # Created: Tue May 21 16:34:45 2013 (+0530) -# Version: +# Version: # Last-Updated: Tue May 21 16:37:28 2013 (+0530) # By: subha # Update #: 9 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# Commentary: +# +# +# +# # Change log: -# +# # Tue May 21 16:34:53 IST 2013 - Subha moved code from # test_converter.py to test_hhfit.py. -# -# +# +# # 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: @@ -78,7 +79,7 @@ class TestFindRateFn(unittest.TestCase): # 1992.; #1e-3 * (0.612 + 1 / (np.exp((self.v_array*1e3 + 132)/-16.7) + np.exp((self.v_array*1e3 + 16.8)/18.2))) p_dblexp = (1e-3, -1/16.7e-3, -132e-3, 1/18.2e-3, -16.8e-3, 0.612e-3) - self.dblexp = p_dblexp[5] + p_dblexp[0] / (np.exp(p_dblexp[1] * (self.v_array - p_dblexp[2])) + + self.dblexp = p_dblexp[5] + p_dblexp[0] / (np.exp(p_dblexp[1] * (self.v_array - p_dblexp[2])) + np.exp(p_dblexp[3] * (self.v_array - p_dblexp[4]))) self.p_dblexp = p_dblexp @@ -86,8 +87,8 @@ class TestFindRateFn(unittest.TestCase): print('Testing sigmoid') fn, params = hhfit.find_ratefn(self.v_array, self.sigmoid) print('Sigmoid params original:', self.p_sigmoid, 'detected:', params) - pylab.plot(self.v_array, self.sigmoid, 'y-', - self.v_array, hhfit.sigmoid(self.v_array, *self.p_sigmoid), 'b--', + pylab.plot(self.v_array, self.sigmoid, 'y-', + self.v_array, hhfit.sigmoid(self.v_array, *self.p_sigmoid), 'b--', self.v_array, fn(self.v_array, *params), 'r-.') pylab.legend(('original sigmoid', 'computed', 'fitted %s' % (fn))) pylab.show() @@ -111,7 +112,7 @@ class TestFindRateFn(unittest.TestCase): # but only the fit rms_error = np.sqrt(np.sum((self.exp - fnval)**2)) # pylab.plot(self.v_array, self.exp, 'b-') - # pylab.plot(self.v_array, fnval, 'r-.') + # pylab.plot(self.v_array, fnval, 'r-.') # pylab.show() print(rms_error, rms_error/max(self.exp)) self.assertAlmostEqual(rms_error/max(self.exp), 0.0, places=3) @@ -120,7 +121,7 @@ class TestFindRateFn(unittest.TestCase): print('Testing linoid') fn, params = hhfit.find_ratefn(self.v_array, self.linoid) print('Linoid params original:', self.p_linoid, 'detected:', params) - pylab.plot(self.v_array, self.linoid, 'y-', + pylab.plot(self.v_array, self.linoid, 'y-', self.v_array, hhfit.linoid(self.v_array, *self.p_linoid), 'b--', self.v_array, fn(self.v_array, *params), 'r-.') pylab.legend(('original linoid', 'computed', 'fitted %s' % (fn))) @@ -137,7 +138,7 @@ class TestFindRateFn(unittest.TestCase): print('Testing double exponential') fn, params = hhfit.find_ratefn(self.v_array, self.dblexp) fnval = fn(self.v_array, *params) - pylab.plot(self.v_array, self.dblexp, 'y-', + pylab.plot(self.v_array, self.dblexp, 'y-', self.v_array, hhfit.double_exp(self.v_array, *self.p_dblexp), 'b--', self.v_array, fnval, 'r-.') pylab.legend(('original dblexp', 'computed', 'fitted %s' % (fn))) @@ -150,7 +151,7 @@ class TestFindRateFn(unittest.TestCase): if __name__ == '__main__': unittest.main() - -# + +# # test_hhfit.py ends here diff --git a/moose-core/python/moose/neuroml2/test_reader.py b/moose-core/python/moose/neuroml2/test_reader.py index 2a1ef0fb8103599e3489e020ab062dde0af2dd97..4482eb6b7c698db9bd1b1994e5d84e882a51e25c 100644 --- a/moose-core/python/moose/neuroml2/test_reader.py +++ b/moose-core/python/moose/neuroml2/test_reader.py @@ -1,47 +1,48 @@ -# test_reader.py --- -# +# -*- coding: utf-8 -*- +# test_reader.py --- +# # Filename: test_reader.py -# Description: -# Author: -# Maintainer: +# Description: +# Author: +# Maintainer: # Created: Wed Jul 24 16:02:21 2013 (+0530) -# Version: +# Version: # Last-Updated: Sun Apr 17 16:13:01 2016 (-0400) # By: subha # Update #: 112 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# -# -# -# +# 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: @@ -55,7 +56,7 @@ from reader import NML2Reader class TestFullCell(unittest.TestCase): def setUp(self): self.reader = NML2Reader(verbose=True) - + self.lib = moose.Neutral('/library') self.filename = 'test_files/NML2_FullCell.nml' self.reader.read(self.filename) @@ -113,7 +114,7 @@ class TestFullCell(unittest.TestCase): """TODO: verify the prototype cahnnel.""" for chan_id in moose.wildcardFind('/library/##[ISA=HHChannel]'): print(moose.element(chan_id)) - + def test_HHChannels(self): """Verify copied channel in membrane properties.""" self.assertTrue(moose.exists(self.soma.path + '/naChansSoma')) @@ -137,9 +138,9 @@ class TestGran98(unittest.TestCase): def test_CaPool(self): pass - + if __name__ == '__main__': unittest.main() -# +# # test_reader.py ends here diff --git a/moose-core/python/moose/neuroml2/units.py b/moose-core/python/moose/neuroml2/units.py index df9e92fa377296feabb17b872c92dc35a900934e..69839872ffbdc22b9d9eacd817dc2ba106234abc 100644 --- a/moose-core/python/moose/neuroml2/units.py +++ b/moose-core/python/moose/neuroml2/units.py @@ -1,47 +1,48 @@ -# units.py --- -# +# -*- coding: utf-8 -*- +# units.py --- +# # Filename: units.py -# Description: -# Author: -# Maintainer: +# Description: +# Author: +# Maintainer: # Created: Thu Jul 25 16:30:14 2013 (+0530) -# Version: +# Version: # Last-Updated: Sat Mar 5 14:56:35 2016 (-0500) # By: subha # Update #: 57 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: @@ -79,6 +80,6 @@ def SI(expression): return magnitude * np.power(10, int(unit.power)) except AttributeError: # degC has offset in stead of magnitude return magnitude + float(unit.offset) - -# + +# # units.py ends here diff --git a/moose-core/python/moose/optimizer_interface.py b/moose-core/python/moose/optimizer_interface.py index 6542902739d215528ccbbceb66fa4d496a90ba9b..b42ff1f229cd3d1f1b5d9179557465a5e7a3f071 100644 --- a/moose-core/python/moose/optimizer_interface.py +++ b/moose-core/python/moose/optimizer_interface.py @@ -1,18 +1,19 @@ -# optimizer_interface.py --- -# +# -*- coding: utf-8 -*- +# optimizer_interface.py --- +# # Filename: optimizer_interface.py # Description: Provides an interface between Optimizer and MOOSE # Author: Viktor Toth -# Maintainer: +# Maintainer: # Copyright (C) 2014 Viktor Toth, all rights reserved. # Created: 7 Aug 14:45:30 2014 (+0530) # Version: 1.0 -# Last-Updated: -# URL: -# Keywords: -# Compatibility: -# -# +# Last-Updated: +# URL: +# Keywords: +# Compatibility: +# +# # Code: @@ -22,7 +23,7 @@ from . import moose class OptimizerInterface: """ Establish connection between MOOSE and Optimzer, parameter fitting tool. - + Usage: create an OptimizerInterface object at the beginning of the script running the MOOSE simulation. Call getParams() to retrieve the parameters advised by Optimizer, then run the simulation using @@ -30,7 +31,7 @@ class OptimizerInterface: passing every trace as a moose.Table or list of floats. When all the traces are added, call writeTraces() so when your script finished Optimizer is able to read these traces from traceFile. - + On the second 'layer' of the Optimizer GUI select external (as type of simulator) and type into the command text box: 'python /path_to_your_model_script/script.py 3' if the number of @@ -47,18 +48,18 @@ class OptimizerInterface: """ self.paramFile = paramFile self.traceFile = traceFile - + # parameter file if os.path.isfile(self.paramFile): with open(self.paramFile) as f: self.params = [float(line) for line in f] else: open(self.paramFile, 'a').close() # create file - + # trace file if not os.path.isfile(self.traceFile): open(self.traceFile, 'a').close() # create file - + def addTrace(self, trace): """ A trace can be a moose.Table object or a list of float numbers. @@ -67,7 +68,7 @@ class OptimizerInterface: self.traces.append(trace.vec) else: self.traces.append(trace) - + def writeTraces(self): """ Writes the content of traces to traceFile. Every column is a @@ -78,12 +79,12 @@ class OptimizerInterface: assert len(self.traces) > 0 and len(self.traces[0]) > 0, 'No traces or empty trace found!' for i in range(1, len(self.traces)): assert len(self.traces[i - 1]) == len(self.traces[i]), 'All traces should have the same length! Use identical sampling frequency!' - + with open(self.traceFile, 'w') as f: for i in range(len(self.traces[0])): row = [str(trace[i]) for trace in self.traces] f.write('\t'.join(row) + '\n') - + def getParams(self): """ Returns the list of parameters read from paramFile. diff --git a/moose-core/python/moose/plot_utils.py b/moose-core/python/moose/plot_utils.py index 556e2487b20b2117701db6e7289bf6c8a4583175..d3f10c92b7e4241f08ef47700966159efafe6d77 100644 --- a/moose-core/python/moose/plot_utils.py +++ b/moose-core/python/moose/plot_utils.py @@ -1,9 +1,10 @@ +# -*- coding: utf-8 -*- """plot_utils.py: Some utility function for plotting data in moose. Last modified: Sun Jan 10, 2016 04:04PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -46,7 +47,7 @@ def plotInTerminal(yvec, xvec = None, file=None): g.stdin.flush() def xyToString( yvec, xvec, sepby = ' '): - """ Given two list-like objects, returns a text string. + """ Given two list-like objects, returns a text string. """ textLines = [] for y, x in zip( yvec, xvec ): @@ -56,7 +57,7 @@ def xyToString( yvec, xvec, sepby = ' '): def saveNumpyVec( yvec, xvec, file): """save the numpy vectors to a data-file - + """ if file is None: return @@ -99,7 +100,7 @@ def reformatTable(table, kwargs): """ Given a table return x and y vectors with proper scaling """ clock = moose.Clock('/clock') if type(table) == moose.Table: - vecY = table.vector + vecY = table.vector vecX = np.arange(0, clock.currentTime, len(vecY)) elif type(table) == tuple: vecX, vecY = table @@ -109,10 +110,10 @@ def plotTable(table, **kwargs): """Plot a given table. It plots table.vector This function can scale the x-axis. By default, y-axis and x-axis scaling is - done by a factor of 1. + done by a factor of 1. Pass 'xscale' and/or 'yscale' argument to function to modify scales. - + """ if not type(table) == moose.Table: msg = "Expected moose.Table, got {}".format( type(table) ) @@ -135,7 +136,7 @@ def plotTables(tables, outfile=None, **kwargs): for i, tname in enumerate(tables): if subplot: plt.subplot(len(tables), 1, i+1) - yvec = tables[tname].vector + yvec = tables[tname].vector xvec = np.linspace(0, moose.Clock('/clock').currentTime, len(yvec)) plt.plot(xvec, yvec, label=tname) @@ -144,7 +145,7 @@ def plotTables(tables, outfile=None, **kwargs): plt.legend(loc='best', framealpha=0.4) except: plt.legend(loc = 'best') - + plt.tight_layout() if outfile: pu.dump("PLOT", "Saving plots to file {}".format(outfile)) @@ -188,7 +189,7 @@ def plotVector(vec, xvec = None, **options): plt.xlabel('Time (sec)') else: plt.xlabel(options.get('xlabel', '')) - + plt.ylabel = options.get('ylabel', '') plt.title(options.get('title', '')) @@ -200,7 +201,7 @@ def plotVector(vec, xvec = None, **options): def saveRecords(records, xvec = None, **kwargs): - """saveRecords + """saveRecords Given a dictionary of data with (key, numpy array) pair, it saves them to a file 'outfile' @@ -253,12 +254,12 @@ def plotRecords(records, xvec = None, **kwargs): plotThis = False if not filters: plotThis = True for accept in filters: - if accept in k.lower(): + if accept in k.lower(): plotThis = True break - + if plotThis: - if not subplot: + if not subplot: yvec = dataDict[k].vector plotVector(yvec, xvec, label=k, **kwargs) else: diff --git a/moose-core/python/moose/print_utils.py b/moose-core/python/moose/print_utils.py index 53e8087f50fb6fbbf1741b1fc53a6c7a648e2ae7..b3acd81bcd9b8dba28f95b842897107aa3b1a2f6 100644 --- a/moose-core/python/moose/print_utils.py +++ b/moose-core/python/moose/print_utils.py @@ -1,10 +1,11 @@ +# -*- coding: utf-8 -*- """print_utils.py: A library with some print functions. Very useful during development. Last modified: Sat Jan 18, 2014 05:01PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -50,7 +51,7 @@ def colored(msg, label="INFO") : Return a colored string. Formatting is optional. At each ` we toggle the color. - + """ global prefixDict if label in prefixDict : @@ -78,7 +79,7 @@ def dump(label, msg, frame=None, exception=None): prefix = '[{0}] '.format(label) - ''' Enable it if you want indented messages + ''' Enable it if you want indented messages stackLength = len(inspect.stack()) - 1 if stackLength == 1: prefix = '\n[{}] '.format(label) @@ -88,7 +89,7 @@ def dump(label, msg, frame=None, exception=None): if type(msg) == list: if len(msg) > 1: - msg = [msg[0]] + ["`|- {0}`".format(x) for x in msg[1:]] + msg = [msg[0]] + ["`|- {0}`".format(x) for x in msg[1:]] msg ="\n\t".join(msg) @@ -104,7 +105,7 @@ def dump(label, msg, frame=None, exception=None): def info(msg): dump("INFO", msg) def warn(msg): dump("WARN", msg) -def error(msg): +def error(msg): dump("ERROR", msg) def fatal(msg): diff --git a/moose-core/python/moose/recording.py b/moose-core/python/moose/recording.py index b3774c8242187264e00dc51db14fda018e7fcdc1..3f08f3fa251aca7ea5bb56e0326cf1243022b2fc 100644 --- a/moose-core/python/moose/recording.py +++ b/moose-core/python/moose/recording.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import print_function try: from future_builtins import zip @@ -16,25 +17,25 @@ _moose.Neutral( _base ) _defaultFields = { _moose.Compartment : 'Vm', _moose.ZombieCompartment : 'Vm', - + _moose.HHChannel: 'Gk', _moose.ZombieHHChannel: 'Gk', - + _moose.HHChannel2D: 'Gk', - + _moose.SynChan: 'Gk', - + _moose.CaConc: 'Ca', _moose.ZombieCaConc: 'Ca', - + _moose.Pool: 'conc', _moose.ZombiePool: 'conc', _moose.ZPool: 'conc', - + _moose.BufPool: 'conc', _moose.ZombieBufPool: 'conc', _moose.ZBufPool: 'conc', - + _moose.FuncPool: 'conc', _moose.ZombieFuncPool: 'conc', _moose.ZFuncPool: 'conc', @@ -48,12 +49,12 @@ def setDt( dt ): Description ----------- Sets time-step for recording values. - + --------- Arguments --------- dt: Time-step for recording values. - + ------- Returns ------- @@ -65,7 +66,7 @@ class SetupError( Exception ): def _time( npoints = None ): import numpy - + if npoints is None: try: npoints = len( _plots[ 0 ].vec ) @@ -74,34 +75,34 @@ def _time( npoints = None ): 'List of time-points cannot be constructed because ' 'no plots have been set up yet.' ) - + begin = 0.0 end = _moose.Clock( '/clock' ).currentTime - + return numpy.linspace( begin, end, npoints ) class _Plot( _moose.Table ): def __init__( self, path, obj, field, label ): _moose.Table.__init__( self, path ) - + self._table = _moose.Table( path ) - + self.obj = obj self.field = field self.label = label - + @property def values( self ): return self._table.vec - + @property def size( self ): return len( self.values ) - + @property def time( self ): return _time( self.size ) - + def __iter__( self ): return iter( self.values ) @@ -109,37 +110,37 @@ def record( obj, field = None, label = None ): ''' ''' global _counter - + # Checking if object is an iterable like list or a tuple, but not a string. if hasattr( obj, '__iter__' ): return [ record( o, field, label ) for o in obj ] - + if isinstance( obj, str ): obj = _moose.element( obj ) - + if field is None: field = _defaultField( obj ) - + path = _path.format( _counter ) _counter += 1 - + p = _Plot( path, obj, field, label ) _plots.append( p ) - + _moose.connect( p, "requestData", obj, 'get_' + field ) _moose.useClock( _tick, path, "process" ) - + return p def _label( plot, labelFormat = '{path}.{field}' ): # Over-ride label format if label has been given explicitly. if plot.label: labelFormat = plot.label - + return labelFormat.format( path = plot.obj.path, name = plot.obj.name, - field = plot.field + field = plot.field ) def _selectedPlots( selected ): @@ -166,27 +167,27 @@ def saveCSV( ''' import csv plots = _selectedPlots( selected ) - + if header: header = [] - + if timeCol: header.append( timeHeader ) - + for plot in plots: header.append( _label( plot, labelFormat ) ) - + header[ 0 ] = headerCommentCharacter + header[ 0 ] - + if timeCol: plots.insert( 0, _time() ) - + with open( fileName, fileMode ) as fout: writer = csv.writer( fout, delimiter = delimiter ) - + if header: writer.writerow( header ) - + writer.writerows( list(zip( *plots )) ) def saveXPLOT( @@ -197,18 +198,18 @@ def saveXPLOT( ''' ''' plots = _selectedPlots( selected ) - + with open( fileName, fileMode ) as fout: write = lambda line: fout.write( line + '\n' ) - + for ( i, plot ) in enumerate( plots ): label = '/plotname ' + _label( plot, labelFormat ) - + if i > 0: write( '' ) write( '/newplot' ) write( label ) - + for value in plot: write( str( value ) ) @@ -225,19 +226,19 @@ def show( except ImportError: print("Warning: recording.show(): Cannot find 'matplotlib'. Not showing plots.") return - + plots = _selectedPlots( selected ) - + if combine: plt.figure() - + for plot in plots: if not combine: plt.figure() - + print(_label(plot)) plt.plot( plot.time, plot.values, label = _label( plot ) ) - + plt.legend() plt.show() diff --git a/moose-core/python/moose/utils.py b/moose-core/python/moose/utils.py index 917761936000a2cce6197b1258fc2822a93cd64a..5a288cc04f90b52e477e5e7eb7f2dcc9e14cf48b 100644 --- a/moose-core/python/moose/utils.py +++ b/moose-core/python/moose/utils.py @@ -1,6 +1,4 @@ -from __future__ import print_function, division -from __future__ import absolute_import - +# -*- coding: utf-8 -*- """ utils.py: @@ -10,6 +8,9 @@ NOTE: Some function might break because unicode is default string in python3. """ +from __future__ import print_function, division +from __future__ import absolute_import + __author__ = 'Subhasis Ray, Aditya Gilra, Dilawar Singh' __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -78,7 +79,7 @@ def create_table(tablePath, element, field,tableType): table = moose.element(tablePath) else: if tableType == "Table2": - table = moose.Table2(tablePath) + table = moose.Table2(tablePath) elif tableType == "Table": table = moose.Table(tablePath) moose.connect(table, 'requestOut', element, 'get%s' % (field)) diff --git a/moose-core/python/rdesigneur/__init__.py b/moose-core/python/rdesigneur/__init__.py index 185814b037de3422a203f00ad2e2d3bccf75a21f..5f50f095337268b66d6ab731acb68013df524db7 100644 --- a/moose-core/python/rdesigneur/__init__.py +++ b/moose-core/python/rdesigneur/__init__.py @@ -1 +1,4 @@ -from rdesigneur import * +# -*- coding: utf-8 -*- +from __future__ import print_function, absolute_import + +from rdesigneur.rdesigneur import * diff --git a/moose-core/python/rdesigneur/rdesigneur.py b/moose-core/python/rdesigneur/rdesigneur.py index e267921c404d9c2954ab5503601778ea4818fae0..e5704f2a04e0d0787224e18b2075e92c793e161d 100644 --- a/moose-core/python/rdesigneur/rdesigneur.py +++ b/moose-core/python/rdesigneur/rdesigneur.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ######################################################################### ## rdesigneur0_5.py --- ## This program is part of 'MOOSE', the @@ -16,15 +17,18 @@ ## channel conductances, between them. ########################################################################## from __future__ import print_function +from __future__ import absolute_import + import imp import os import moose import numpy as np import pylab import math -import rmoogli -#import rdesigneurProtos -from rdesigneurProtos import * +import rdesigneur.rmoogli + +from rdesigneur.rdesigneurProtos import * + from moose.neuroml.NeuroML import NeuroML from moose.neuroml.ChannelML import ChannelML @@ -137,7 +141,7 @@ class rdesigneur: self.adaptorList = adaptorList self.stimList = stimList self.plotList = plotList - self.saveList = plotList #ADDED BY Sarthak + self.saveList = plotList #ADDED BY Sarthak self.saveAs = [] self.moogList = moogList self.plotNames = [] @@ -157,7 +161,7 @@ class rdesigneur: except BuildError as msg: print("Error: rdesigneur: Prototype build failed:", msg) quit() - + ################################################################ @@ -187,7 +191,7 @@ class rdesigneur: self.model = moose.Neutral( modelPath ) self.modelPath = modelPath try: - # Protos made in the init phase. Now install the elec and + # Protos made in the init phase. Now install the elec and # chem protos on model. self.installCellFromProtos() # Now assign all the distributions @@ -650,16 +654,16 @@ class rdesigneur: ################################################################ # Here we get the time-series data and write to various formats - ################################################################ + ################################################################ #[TO DO] Add NSDF output function ''' The author of the functions -- [_savePlots(), _getTimeSeriesTable(), _writeXML(), _writeCSV(), _saveFormats(), _save()] is - Sarthak Sharma. + Sarthak Sharma. Email address: sarthaks442@gmail.com - ''' - + ''' + def _savePlots( self ): - + knownFields = { 'Vm':('CompartmentBase', 'getVm', 1000, 'Memb. Potential (mV)' ), 'Im':('CompartmentBase', 'getIm', 1e9, 'Memb. current (nA)' ), @@ -672,11 +676,11 @@ class rdesigneur: 'n':('PoolBase', 'getN', 1, '# of molecules'), 'conc':('PoolBase', 'getConc', 1000, 'Concentration (uM)' ) } - + save_graphs = moose.Neutral( self.modelPath + '/save_graphs' ) dummy = moose.element( '/' ) k = 0 - + for i in self.saveList: pair = i[0] + " " + i[1] dendCompts = self.elecid.compartmentsFromExpression[ pair ] @@ -702,12 +706,12 @@ class rdesigneur: moose.connect( save_vtabs[q], 'requestOut', p, plotField ) q += 1 - def _getTimeSeriesTable( self ): - + def _getTimeSeriesTable( self ): + ''' This function gets the list with all the details of the simulation required for plotting. - This function adds flexibility in terms of the details + This function adds flexibility in terms of the details we wish to store. ''' @@ -722,11 +726,11 @@ class rdesigneur: 'Ca':('CaConcBase', 'getCa', 1e3, 'Ca conc (uM)' ), 'n':('PoolBase', 'getN', 1, '# of molecules'), 'conc':('PoolBase', 'getConc', 1000, 'Concentration (uM)' ) - } - - ''' + } + + ''' This takes data from plotList - saveList is exactly like plotList but with a few additional arguments: + saveList is exactly like plotList but with a few additional arguments: ->It will have a resolution option, i.e., the number of decimal figures to which the value should be rounded ->There is a list of "saveAs" formats With saveList, the user will able to set what all details he wishes to be saved. @@ -739,33 +743,33 @@ class rdesigneur: # Here we get the object details from plotList savePlotObj, plotField = self._parseComptField( dendCompts, self.saveList[i], knownFields ) savePlotObj2, plotField2 = self._parseComptField( spineCompts, self.saveList[i], knownFields ) - savePlotObj3 = savePlotObj + savePlotObj2 - - rowList = list(ind) - save_vtab = moose.vec( ind[0] ) + savePlotObj3 = savePlotObj + savePlotObj2 + + rowList = list(ind) + save_vtab = moose.vec( ind[0] ) t = np.arange( 0, save_vtab[0].vector.size, 1 ) * save_vtab[0].dt - + rowList.append(save_vtab[0].dt) rowList.append(t) rowList.append([jvec.vector * ind[3] for jvec in save_vtab]) #get values rowList.append(self.saveList[i][3]) rowList.append(filter(lambda obj: obj.path != '/', savePlotObj3)) #this filters out dummy elements - + if (type(self.saveList[i][-1])==int): rowList.append(self.saveList[i][-1]) else: rowList.append(12) - + self.tabForXML.append(rowList) rowList = [] timeSeriesTable = self.tabForXML # the list with all the details of plot return timeSeriesTable - def _writeXML( self, filename, timeSeriesData ): #to write to XML file + def _writeXML( self, filename, timeSeriesData ): #to write to XML file plotData = timeSeriesData - print("[CAUTION] The '%s' file might be very large if all the compartments are to be saved." % filename) + print("[CAUTION] The '%s' file might be very large if all the compartments are to be saved." % filename) root = etree.Element("TimeSeriesPlot") parameters = etree.SubElement( root, "parameters" ) if self.params == None: @@ -785,13 +789,13 @@ class rdesigneur: title.set( 'dt', str(plotData[5])) p = [] assert(len(plotData[7]) == len(plotData[9])) - + res = plotData[10] for ind, jvec in enumerate(plotData[7]): p.append( etree.SubElement( title, "data")) p[-1].set( 'path', str(plotData[9][ind].path)) p[-1].text = ''.join( str(round(value,res)) + ' ' for value in jvec ) - + tree = etree.ElementTree(root) tree.write(filename) @@ -804,7 +808,7 @@ class rdesigneur: res = plotData[10] for ind, jvec in enumerate(plotData[7]): - header.append(plotData[9][ind].path) + header.append(plotData[9][ind].path) dataList.append([round(value,res) for value in jvec.tolist()]) dl = [tuple(lst) for lst in dataList] rows = zip(tuple(time), *dl) @@ -815,7 +819,7 @@ class rdesigneur: writer.writerow(header) for row in rows: writer.writerow(row) - + ##########****SAVING*****############### def _saveFormats(self, timeSeriesData, k, *filenames): "This takes in the filenames and writes to corresponding format." diff --git a/moose-core/python/rdesigneur/rdesigneurProtos.py b/moose-core/python/rdesigneur/rdesigneurProtos.py index ea794d9bf6f7d0e520b5827165a7a85c87232fd7..43213b09be3209e52442b68c79d5f886c96c25df 100644 --- a/moose-core/python/rdesigneur/rdesigneurProtos.py +++ b/moose-core/python/rdesigneur/rdesigneurProtos.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # rdesignerProtos.py --- # # Filename: rdesignerProtos.py diff --git a/moose-core/python/rdesigneur/rmoogli.py b/moose-core/python/rdesigneur/rmoogli.py index 7f8fa883b372bea23ec50fc754653e93c3f5995c..597303810f8dfc430b24a55415403eda3902d514 100644 --- a/moose-core/python/rdesigneur/rmoogli.py +++ b/moose-core/python/rdesigneur/rmoogli.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ######################################################################### ## rdesigneur0_4.py --- ## This program is part of 'MOOSE', the @@ -21,14 +22,14 @@ display = os.environ.get('DISPLAY', '' ) if not display: hasDisplay = False print( "Warning: Environment variable DISPLAY is not set." - " Did you forget to pass -X or -Y switch to ssh command?\n" + " Did you forget to pass -X or -Y switch to ssh command?\n" "Anyway, MOOSE will continue without graphics.\n" ) hasMoogli = True if hasDisplay: - try: + try: from PyQt4 import QtGui import moogli import moogli.extensions.moose @@ -71,7 +72,7 @@ def interlude( view ): # This func is used for later viewers, that don't handle advancing time. def interlude2( view ): val = [ moose.getField( i, view.mooField, "double" ) * view.mooScale for i in view.mooObj ] - + view.mooGroup.set("color", val, view.mapper) view.yaw( rotation ) if moose.element("/clock").currentTime >= runtime: @@ -105,8 +106,8 @@ def makeMoogli( rd, mooObj, moogliEntry, fieldInfo ): #print "########### Len( cpa, mooObj ) = ", len( cpa ), len( mooObj ), len( updateShapes ) updateGroup.attach_shapes( updateShapes ) - normalizer = moogli.utilities.normalizer( - moogliEntry[5], moogliEntry[6], + normalizer = moogli.utilities.normalizer( + moogliEntry[5], moogliEntry[6], clipleft =True, clipright = True ) colormap = moogli.colors.MatplotlibColorMap(matplotlib.cm.rainbow) diff --git a/moose-core/python/setup.py b/moose-core/python/setup.py index a6c3852c787d09e3d59d8b03ba82c359759e8f11..f8d537d0129e531d60288284535a50d0a6c649ab 100644 --- a/moose-core/python/setup.py +++ b/moose-core/python/setup.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # This file is part of MOOSE simulator: http://moose.ncbs.res.in. # MOOSE is free software: you can redistribute it and/or modify @@ -13,12 +14,12 @@ # along with MOOSE. If not, see <http://www.gnu.org/licenses/>. -"""setup.py: +"""setup.py: Script to install python targets. """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] @@ -65,9 +66,9 @@ setup( , 'moose.chemUtil' , 'moose.merge' ], - package_dir = { - 'moose' : 'moose' + package_dir = { + 'moose' : 'moose' , 'rdesigneur' : 'rdesigneur' }, package_data = { 'moose' : ['_moose' + suffix] }, - ) + ) diff --git a/moose-core/randnum/Binomial.cpp b/moose-core/randnum/Binomial.cpp index 2114cd0c5fa045c2f59e73fb1c10e10d761ca578..2014c283cd19ff846e883e71e2940f386ec7dfac 100644 --- a/moose-core/randnum/Binomial.cpp +++ b/moose-core/randnum/Binomial.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: Binomial.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-10-28 13:44:46 @@ -45,7 +45,7 @@ const double fc[] = { const vector <double> initializeLookupTable() { static vector <double> table; - + for ( int i = 0; i < 10; ++i ) { table.push_back(fc[i]); @@ -54,12 +54,12 @@ const vector <double> initializeLookupTable() { double denom = 1.0/(i+1); double value = (0.083333333333333333 - (0.002777777777777778 - 0.0007936508*denom*denom)*denom*denom)*denom; - table.push_back(value); + table.push_back(value); } - return table; + return table; } -static const vector <double> lookupTable = initializeLookupTable(); - +static const vector <double> lookupTable = initializeLookupTable(); + /** @@ -75,7 +75,7 @@ inline double getFc(unsigned int k) else { return lookupTable[k]; - } + } } /** @@ -84,31 +84,31 @@ inline double getFc(unsigned int k) */ Binomial::Binomial( long n, double p):n_(n), p_(p) { - + if (( p < 0 ) || ( p > 1 )) { cerr << "ERROR: p must be in [0,1] range." << endl; - p = 0.0; + p = 0.0; return; } if ( n < 1 ) { cerr << "ERROR: n must be >= 1" << endl; - return; + return; } - - + + double tmpMean; double tmp; isInverted_ = false; - + // tmpMean = n*((p < 0.5)? p : (1-p)); - + // if ((tmpMean > 10.0)) // { // the above can be simplified as: ( saves one floating point comparison, aesthetically pleasing :D ) if ( n > 20 ) - { + { if( p < 0.5 ) { p_ = p; @@ -119,7 +119,7 @@ Binomial::Binomial( long n, double p):n_(n), p_(p) isInverted_ = true; } tmpMean = n*p_; - + tmp = sqrt(tmpMean*(1.0 - p_)); paramC_ = tmpMean + 0.5; paramB_ = 1.15 + 2.53*tmp; @@ -127,18 +127,18 @@ Binomial::Binomial( long n, double p):n_(n), p_(p) paramAlpha_ = (2.83 + 5.1/paramB_)*tmp; paramUr_ = 0.43; paramVr_ = 0.92 - 4.2/paramB_; - paramUrVr_ = 0.86*paramVr_; + paramUrVr_ = 0.86*paramVr_; paramM_ = floor(tmpMean+p_); paramR_ = floor(p_/(1-p_)); paramNr_ = (n+1)*paramR_; - paramNpq_ = tmpMean*(1-p_); + paramNpq_ = tmpMean*(1-p_); } mean_ = n_*p_; } long Binomial::getN() const { - return n_; + return n_; } double Binomial::getP() const @@ -150,7 +150,7 @@ double Binomial::getP() const else { return p_; - } + } } double Binomial::getMean() const @@ -159,13 +159,13 @@ double Binomial::getMean() const { return (n_ - mean_); }else{ - return mean_; - } + return mean_; + } } double Binomial::getVariance() const { - static double variance = sqrt(n_*p_*(1.0-p_)); + static double variance = sqrt(n_*p_*(1.0-p_)); return variance; } @@ -187,13 +187,13 @@ double Binomial::getNextSample() const { sample = (double)n_; } - else + else { if ( mean_ > 10 ) { sample = isInverted_? n_ - generateTrd(): generateTrd(); } - else + else { for ( unsigned int i = 0; i < n_; ++i) { @@ -201,13 +201,13 @@ double Binomial::getNextSample() const if ( myRand < p_ ) { sample+=1; - } - } + } + } } -// cerr << "Sample value: " << sample << " " << isInverted_<< endl; +// cerr << "Sample value: " << sample << " " << isInverted_<< endl; } - - return sample; + + return sample; } /** @@ -230,7 +230,7 @@ double Binomial::generateTrd() const double varI; double varRho; double varT; - + while ( true ) { // 1a: generate a uniform random number v @@ -256,7 +256,7 @@ double Binomial::generateTrd() const // 2b(iii) generate a uniform random number v in (0,vr) varV = mtrand()*paramVr_; } - // 3.0a: us = 0.5 - |u| + // 3.0a: us = 0.5 - |u| varUs = (varU < 0) ? 0.5 + varU : 0.5 - varU; // 3.0b: k = floor( ( 2*a/us + b )*u + c ) varK = floor( (2*paramA_/varUs+paramB_)*varU + paramC_); @@ -265,7 +265,7 @@ double Binomial::generateTrd() const { continue; } - + // 3.0d: v = v*alpha/(a/(us*us)+b) varV = varV*paramAlpha_/(paramA_/(varUs*varUs) + paramB_ ); // 3.0e: km = | k - m | @@ -276,7 +276,7 @@ double Binomial::generateTrd() const // 3.1: recursive evaluation of f(k) // 3.1a: f = 1 varF = 1; - // 3.1b: if (m < k) + // 3.1b: if (m < k) if ( paramM_ < varK ) { // 3.1b(i): set i = m @@ -339,7 +339,7 @@ double Binomial::generateTrd() const { return varK; } - // 3.4c: otherwise goto (1) + // 3.4c: otherwise goto (1) } } @@ -354,10 +354,10 @@ void testBinomial() int trialMin = 2; int trialMax = trialMin*1000; - + double tmp; - + for ( int i = trialMin; i < trialMax; i =(int)( i* 1.5) ) { for ( double p = 0.1; p < .95; p += 0.1) @@ -366,20 +366,20 @@ void testBinomial() tmp = 0; for ( int j = 0; j < i; ++j ) { - tmp += b.getNextSample(); + tmp += b.getNextSample(); } cerr << "Diff( " << i << "," << p << ") " << tmp/i - b.getMean() << " [ " << tmp/i << " - " << b.getMean() <<" ]" - << endl; - } + << endl; + } } } #if 0 // test main int main(void) { - testBinomial(); - return 0; + testBinomial(); + return 0; } #endif // test main diff --git a/moose-core/randnum/Binomial.h b/moose-core/randnum/Binomial.h index e542635dada5dc12bdc4c049ced4d82157881509..06401f4d32061bea9b68d11955572e79f04bb423 100644 --- a/moose-core/randnum/Binomial.h +++ b/moose-core/randnum/Binomial.h @@ -25,31 +25,31 @@ class Binomial:public Probability Binomial(){}; Binomial( long n, double p); long getN() const; - double getP() const; + double getP() const; double getMean() const; double getVariance() const; double getNextSample() const; - + private: double generateTrd() const; bool isInverted_; - + unsigned long n_; double p_; double mean_; - + double paramC_; double paramB_; double paramA_; double paramAlpha_; - double paramUr_; - double paramVr_; + double paramUr_; + double paramVr_; double paramUrVr_; - double paramM_; - double paramR_; + double paramM_; + double paramR_; double paramNr_; double paramNpq_; }; - + #endif diff --git a/moose-core/randnum/BinomialRng.cpp b/moose-core/randnum/BinomialRng.cpp index 9bf7815daeb58154a4c50c5aff278844fe032e3a..50765b2e0b2e6edf0ed37a9dbc5e1b8aeb215e0a 100644 --- a/moose-core/randnum/BinomialRng.cpp +++ b/moose-core/randnum/BinomialRng.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: BinomialRng.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-08 10:58:01 @@ -42,7 +42,7 @@ const Cinfo* BinomialRng::initCinfo() &n, &p, }; - + static string doc[] = { "Name", "BinomialRng", "Author", "Subhasis Ray", @@ -60,7 +60,7 @@ const Cinfo* BinomialRng::initCinfo() return &binomialRngCinfo; } - + static const Cinfo* binomialRngCinfo = BinomialRng::initCinfo(); BinomialRng::BinomialRng() @@ -68,9 +68,9 @@ BinomialRng::BinomialRng() isNSet_ = false; isPSet_ = false; isModified_ = true; - + n_ = 0; - p_ = 0; + p_ = 0; } /** @@ -85,30 +85,30 @@ void BinomialRng::setN(double value) cerr << "ERROR: BinomialRng::innerSetN - n must be a positive integer." << endl; return; } - + if(!isNSet_) { isNSet_ = true; n_ = n; } - else + else { if (n_!= n ) { n_ = n; - isModified_ = true; + isModified_ = true; } } - + if ( isNSet_ && isPSet_ && isModified_) { { if ( rng_ ) { delete rng_; - } + } rng_ = new Binomial((unsigned long)n_,p_); - isModified_ = false; - } + isModified_ = false; + } } } @@ -136,16 +136,16 @@ void BinomialRng::setP(double p) } else { if (!isClose< double >(p_,p, DBL_EPSILON)) { p_ = p; - isModified_ = true; + isModified_ = true; } - } - + } + if ( isNSet_ && isPSet_ && isModified_ ){ if ( rng_ ){ - delete rng_; + delete rng_; } rng_ = new Binomial((long)(n_),p_); - isModified_ = false; + isModified_ = false; } } diff --git a/moose-core/randnum/BinomialRng.h b/moose-core/randnum/BinomialRng.h index 7b3066e70b068c94e0c8d02035ddea0085e0c98d..df470a5100c1548262fc5b7f51e6ba9e90f270ce 100644 --- a/moose-core/randnum/BinomialRng.h +++ b/moose-core/randnum/BinomialRng.h @@ -1,6 +1,6 @@ /******************************************************************* * File: BinomialRng.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-08 10:48:59 @@ -27,10 +27,10 @@ class BinomialRng: public RandGenerator { public: BinomialRng(); - void setN(double n); - double getN() const; + void setN(double n); + double getN() const; void setP(double p); - double getP() const; + double getP() const; virtual void vReinit( const Eref& e, ProcPtr p); static const Cinfo * initCinfo(); @@ -39,7 +39,7 @@ class BinomialRng: public RandGenerator unsigned long n_; bool isPSet_; double p_; - bool isModified_; + bool isModified_; }; #endif diff --git a/moose-core/randnum/Exponential.cpp b/moose-core/randnum/Exponential.cpp index 31bc641355e3463688160b2dade048c766d2dfad..99f7770db0a0f3158990e8e0a112185cea9187fa 100644 --- a/moose-core/randnum/Exponential.cpp +++ b/moose-core/randnum/Exponential.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: Exponential.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-01 09:03:51 @@ -38,7 +38,7 @@ Exponential::Exponential(ExponentialGenerator method, double mean):mean_(mean) break; default: generator_ = &(Exponential::randomMinimization); - break; + break; } } @@ -49,12 +49,12 @@ double Exponential::getMean() const double Exponential::getVariance() const { - return mean_*mean_; + return mean_*mean_; } double Exponential::getNextSample() const { - return generator_(mean_); + return generator_(mean_); } @@ -65,8 +65,8 @@ double Exponential::logarithmic(double mean) { uniform = 1.0e-6; } - - return - mean*log(uniform); + + return - mean*log(uniform); } extern unsigned long genrand_int32(void); @@ -76,7 +76,7 @@ extern unsigned long genrand_int32(void); {Qk} = {(ln2/1! + (ln2)^2/2! + (ln2)^3/3! + ... + (ln2)^k/k!)} used in the random minimization algorithm. */ -static const double q[] = +static const double q[] = { 1.0, // dummy for q[0] 0.69314718055994528622676, @@ -99,7 +99,7 @@ static const double q[] = double Exponential::randomMinimization(double mean) { double result; - + unsigned long uniform = genrand_int32(); // 1) generate t+1 (=32) bit uniform random binary fraction .b0..bt int j = 0; @@ -107,29 +107,29 @@ double Exponential::randomMinimization(double mean) { uniform = 1; } - + while (0x80000000 & uniform ) // 1) detect the first 0 bit { uniform = uniform << 1; // 1a) shift off leading j+1 bits, setting u = .b(j+1) .. b(t) - ++j; + ++j; } uniform = uniform << 1; // 1a)shift off leading j+1 bits, setting u = .b(j+1) .. b(t) double uniform_frac = uniform / 4294967296.0; - + if ( uniform_frac < LN2 ) // 2) u < ln2? { - result = mean*(j*LN2 + uniform_frac); // x <- mean * ( j * ln2 + u ) + result = mean*(j*LN2 + uniform_frac); // x <- mean * ( j * ln2 + u ) } - else + else { // 3) minimize unsigned int k = 2; unsigned long v = ~0UL; unsigned long u; - + while ( ( uniform_frac >= q[k] )) { - k++; + k++; } for ( unsigned int i = 0; i < k; ++i ) { @@ -139,11 +139,11 @@ double Exponential::randomMinimization(double mean) v = u; } } - + result = mean*( j + v/4294967296.0 )*LN2; } - - return result; + + return result; } #if 0 // test main #include <vector> @@ -151,35 +151,35 @@ int main(void) { double mean = .25; double sum = 0.0; - double sd = 0.0; + double sd = 0.0; vector <unsigned> classes; Exponential ex(mean); int MAX_SAMPLE = 100000; int MAX_CLASSES = 1000; - - + + for ( int i = 0; i < MAX_CLASSES; ++i ) { - classes.push_back(0); + classes.push_back(0); } - + for ( int i = 0; i < MAX_SAMPLE; ++i ) { double p = ex.getNextSample();//aliasMethod(); int index = (int)(p*MAX_CLASSES); // cout << index << " ] " << p << endl; - + if ( index < MAX_CLASSES){ classes[index]++; } - else + else { - classes[MAX_CLASSES-1]++; + classes[MAX_CLASSES-1]++; } - - + + sum += p; - sd += (p - mean)*(p - mean); + sd += (p - mean)*(p - mean); } mean = sum/MAX_SAMPLE; sd = sqrt(sd/MAX_SAMPLE); @@ -188,7 +188,7 @@ int main(void) { cout << classes[i] << endl; } - + return 0; } #endif // test main diff --git a/moose-core/randnum/Exponential.h b/moose-core/randnum/Exponential.h index 9d27ba07e5995cc767980bf95584873aa07d434e..7c92e0884ae790c77be386fe05fc1de9715b2dc7 100644 --- a/moose-core/randnum/Exponential.h +++ b/moose-core/randnum/Exponential.h @@ -1,6 +1,6 @@ /******************************************************************* * File: Exponential.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-01 08:59:47 @@ -24,13 +24,13 @@ enum ExponentialGenerator RANDOM_MINIMIZATION }; - + class Exponential: public Probability { public: Exponential(double mean); Exponential( ExponentialGenerator generator, double mean); - + double getMean() const; double getVariance() const; double getNextSample() const; @@ -39,10 +39,10 @@ class Exponential: public Probability double (*generator_)(double); static double logarithmic(double mean); static double randomMinimization(double mean); - - + + }; - + #endif diff --git a/moose-core/randnum/ExponentialRng.cpp b/moose-core/randnum/ExponentialRng.cpp index e22ea96645dff84697dd140f8cd1906710d7b311..9b9bbada08537ddd6913bb2b93ae5f6a814a1023 100644 --- a/moose-core/randnum/ExponentialRng.cpp +++ b/moose-core/randnum/ExponentialRng.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: ExponentialRng.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-08 11:33:45 @@ -28,7 +28,7 @@ const Cinfo* ExponentialRng::initCinfo() "Mean of the exponential distribution.", &ExponentialRng::setMean, &ExponentialRng::getMean); - + static ValueFinfo< ExponentialRng, int > method( "method", "The algorithm to use for computing the sample. Two methods are" @@ -38,12 +38,12 @@ const Cinfo* ExponentialRng::initCinfo() " 3.4.1 : Algorithm S.", &ExponentialRng::setMethod, &ExponentialRng::getMethod); - + static Finfo* exponentialRngFinfos[] = { &mean, &method, }; - + static string doc[] = { "Name", "ExponentialRng", "Author", "Subhasis Ray", @@ -65,14 +65,14 @@ const Cinfo* ExponentialRng::initCinfo() return &exponentialRngCinfo; } - + static const Cinfo* exponentialRngCinfo = ExponentialRng::initCinfo(); ExponentialRng::ExponentialRng() { - mean_ = 0; + mean_ = 0; isMeanSet_ = false; - method_ = RANDOM_MINIMIZATION; + method_ = RANDOM_MINIMIZATION; } /** Replaces the same method in base class. Returns the mean as @@ -80,7 +80,7 @@ ExponentialRng::ExponentialRng() */ double ExponentialRng::getMean() const { - return mean_; + return mean_; } /** Sets the mean. Since exponential distribution is defined in terms @@ -91,8 +91,8 @@ void ExponentialRng::setMean(double mean) { if ( !rng_ ){ rng_ = new Exponential(mean); - isMeanSet_ = true; - } + isMeanSet_ = true; + } } /** @@ -102,7 +102,7 @@ void ExponentialRng::vReinit(const Eref& e, ProcPtr p) { Exponential * erng = static_cast<Exponential *>(rng_); if (!erng){ - cerr << "ERROR: ExponentialRng::vReinit - mean must be set before using the Exponential distribution generator." << endl; + cerr << "ERROR: ExponentialRng::vReinit - mean must be set before using the Exponential distribution generator." << endl; } } @@ -113,7 +113,7 @@ void ExponentialRng::vReinit(const Eref& e, ProcPtr p) */ int ExponentialRng::getMethod() const { - return method_; + return method_; } /** @@ -131,7 +131,7 @@ void ExponentialRng::setMethod(int method) method_ = LOGARITHMIC; break; default: - method_ = RANDOM_MINIMIZATION; + method_ = RANDOM_MINIMIZATION; break; } } else { diff --git a/moose-core/randnum/ExponentialRng.h b/moose-core/randnum/ExponentialRng.h index 056a74d91eacfd5d1c87c852672b899b87800e58..08a8c2452bfaa0e6145c3ce962aef39d310b1697 100644 --- a/moose-core/randnum/ExponentialRng.h +++ b/moose-core/randnum/ExponentialRng.h @@ -1,6 +1,6 @@ /******************************************************************* * File: ExponentialRng.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-08 11:27:50 @@ -30,19 +30,19 @@ class ExponentialRng: public RandGenerator { public: ExponentialRng(); - double getMean() const; + double getMean() const; void setMean(double mean); - int getMethod() const; - void setMethod(int method); + int getMethod() const; + void setMethod(int method); virtual void vReinit( const Eref& e, ProcPtr p); static const Cinfo* initCinfo(); - + private: - double mean_; + double mean_; bool isMeanSet_; int method_; - + }; diff --git a/moose-core/randnum/Gamma.cpp b/moose-core/randnum/Gamma.cpp index c704777c30a0ea1d65265a95e2d3afbf3d7a6365..e2eb58ea2be8995081950bf94be67bd29835a7ca 100644 --- a/moose-core/randnum/Gamma.cpp +++ b/moose-core/randnum/Gamma.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: Gamma.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-05 18:33:01 @@ -25,10 +25,10 @@ Gamma::Gamma(double alpha, double theta):alpha_(alpha), theta_(theta) { if (( alpha < 0 ) || (theta < 0 )) - { + { cerr << "ERROR: setting parameter of Gamma distribution to negative. Setting both to 1." << endl; alpha_ = 1; - theta_ = 1; + theta_ = 1; } } double Gamma::getAlpha() @@ -54,7 +54,7 @@ double Gamma::getVariance() const double Gamma::getNextSample() const { double result; - + if ( alpha_ <= 1 ) { result = gammaSmall(); @@ -68,7 +68,7 @@ double Gamma::getNextSample() const result *= theta_; } - return result; + return result; } // See Algorithm A in TAOCP by Knuth, Vol 2 ,Section 3.4.1 @@ -81,13 +81,13 @@ double Gamma::gammaLarge() const// alpha > 1 double uniformV; double check; double tmp; - + while (true) { - uniformU = mtrand(); + uniformU = mtrand(); yValue = tan(M_PI*uniformU); tmp = sqrt(2*alpha_ - 1)*yValue; - + result = tmp + alpha_ - 1; if (result > 0) { @@ -98,7 +98,7 @@ double Gamma::gammaLarge() const// alpha > 1 return result; } } - } + } return result; // silence the compiler } @@ -107,7 +107,7 @@ double Gamma::gammaLarge() const// alpha > 1 double Gamma::gammaSmall() const // 0 < alpha < 1 { static Exponential expGen(1.0); - + // G1. initialize static double p = NATURAL_E/(alpha_+NATURAL_E); static double pByE = 1.0/(alpha_+NATURAL_E); @@ -115,7 +115,7 @@ double Gamma::gammaSmall() const // 0 < alpha < 1 double expSample; double xValue = 0.0; double qValue; - + while ( true ) { // G2. generate G deviate @@ -125,7 +125,7 @@ double Gamma::gammaSmall() const // 0 < alpha < 1 { expSample = expGen.getNextSample(); } - + if ( uniformU < p ) { xValue = exp(-expSample/alpha_); @@ -135,20 +135,20 @@ double Gamma::gammaSmall() const // 0 < alpha < 1 } qValue = p*exp(-xValue); } - else + else { xValue = 1 + expSample; qValue = p + (1.0-p)*pow(xValue, alpha_ - 1.0); } - + // G3. reject? if ( uniformU < qValue ) { return xValue; } } - return xValue; // silence the compiler + return xValue; // silence the compiler } - + #endif diff --git a/moose-core/randnum/Gamma.h b/moose-core/randnum/Gamma.h index 9087425a672c985198dc7f8338c750550e62da1a..2812c76277fb62dade6e5c3fe54d031e61055376 100644 --- a/moose-core/randnum/Gamma.h +++ b/moose-core/randnum/Gamma.h @@ -1,6 +1,6 @@ /******************************************************************* * File: Gamma.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-05 19:22:32 @@ -26,7 +26,7 @@ class Gamma: public Probability public: Gamma(double alpha, double theta); double getAlpha(); - double getTheta(); + double getTheta(); double getMean() const; double getVariance() const; double getNextSample() const; @@ -35,8 +35,8 @@ class Gamma: public Probability double theta_; double gammaSmall() const; double gammaLarge() const; - + }; - + #endif diff --git a/moose-core/randnum/GammaRng.cpp b/moose-core/randnum/GammaRng.cpp index bae4504b10c1f4bb1ecf03d028425545da2195e0..eac78fbaefe2e94e17921902a4dcec532320d1dd 100644 --- a/moose-core/randnum/GammaRng.cpp +++ b/moose-core/randnum/GammaRng.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: GammaRng.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-08 11:56:00 @@ -37,7 +37,7 @@ const Cinfo* GammaRng::initCinfo() &alpha, &theta, }; - + static string doc[] = { "Name", "GammaRng", "Author", "Subhasis Ray", @@ -56,7 +56,7 @@ const Cinfo* GammaRng::initCinfo() return &gammaRngCinfo; } - + static const Cinfo* gammaRngCinfo = GammaRng::initCinfo(); GammaRng::GammaRng() @@ -64,21 +64,21 @@ GammaRng::GammaRng() isAlphaSet_ = false; isThetaSet_ = false; alpha_ = 1; - theta_ = 1; + theta_ = 1; } /** returns the shape parameter. */ double GammaRng::getAlpha() const { - return alpha_; + return alpha_; } /** Sets parameter alpha. Also known as the shape parameter. */ void GammaRng::setAlpha(double alpha) { - + if (fabs(alpha) < DBL_MIN) { cerr << "ERROR: Shape parameter alpha must be non-zero." << endl; @@ -100,7 +100,7 @@ void GammaRng::setAlpha(double alpha) */ double GammaRng::getTheta()const { - return theta_; + return theta_; } /** @@ -108,7 +108,7 @@ double GammaRng::getTheta()const */ void GammaRng::setTheta(double theta) { - + if (fabs(theta) < DBL_MIN) { cerr << "ERROR: Scale parameter theta must be non-zero." << endl; @@ -132,7 +132,7 @@ void GammaRng::vReinit(const Eref& e, ProcPtr p) { if (! rng_ ) { - cerr << "ERROR: GammaRng::vReinit - parameters alpha and theta must be set before using the Gamma distribution generator." << endl; + cerr << "ERROR: GammaRng::vReinit - parameters alpha and theta must be set before using the Gamma distribution generator." << endl; } } diff --git a/moose-core/randnum/GammaRng.h b/moose-core/randnum/GammaRng.h index ffc47332974a782a03655bf9fcfe8a7e66834939..381da44e74b09c581326721e8365e07b8ea760e9 100644 --- a/moose-core/randnum/GammaRng.h +++ b/moose-core/randnum/GammaRng.h @@ -1,6 +1,6 @@ /******************************************************************* * File: GammaRng.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-08 11:53:29 @@ -35,17 +35,17 @@ class GammaRng: public RandGenerator double getTheta() const; void setAlpha(double alpha); void setTheta(double theta); - + virtual void vReinit( const Eref& e, ProcPtr p); static const Cinfo * initCinfo(); - + private: double alpha_; double theta_; - + bool isAlphaSet_; - bool isThetaSet_; + bool isThetaSet_; }; diff --git a/moose-core/randnum/Normal.cpp b/moose-core/randnum/Normal.cpp index 61c7b7199e3af91cc4e8efbc7f8ff0aca895dc09..608ce92804319037370324513fd2a8b070e534aa 100644 --- a/moose-core/randnum/Normal.cpp +++ b/moose-core/randnum/Normal.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: Normal.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-10-31 13:48:53 @@ -32,7 +32,7 @@ Normal::Normal(double mean, double variance, NormalGenerator method):mean_(mean) cout << "Warning: cannot set variance <= 0. Setting to 1.0." << endl; variance_ = 1.0; } - + isStandard_ = isClose< double >(0.0, mean, DBL_EPSILON) && isClose < double > (1.0, variance, DBL_EPSILON); switch(method) { @@ -45,7 +45,7 @@ Normal::Normal(double mean, double variance, NormalGenerator method):mean_(mean) #ifdef USE_GSL case ZIGGURAT: generator_ = &(Normal::gslZiggurat); - break; + break; #endif default: cerr << "ERROR: Normal() - generator method# " << method << ". Don't know how to do this. Using alias method."<<endl; @@ -55,7 +55,7 @@ Normal::Normal(double mean, double variance, NormalGenerator method):mean_(mean) double dummy() { - return 0.0; + return 0.0; } double Normal::getNextSample() const @@ -66,7 +66,7 @@ double Normal::getNextSample() const { sample = mean_ + sd*sample; } - return sample; + return sample; } double Normal::getMean() const @@ -91,7 +91,7 @@ void Normal::setVariance( double variance ) { cout << "Warning: cannot set variance < 0." << endl; return; - } + } variance_ = variance; isStandard_ = isClose< double > (0.0, mean_, DBL_EPSILON) && isClose< double >(1.0, variance_, DBL_EPSILON); } @@ -120,7 +120,7 @@ void Normal::setMethod(NormalGenerator method) default: cerr << "ERROR: Normal() - generator method# " << method << ". Don't know how to do this. Using alias method."<<endl; generator_ = &(Normal::aliasMethod); - method_ = ALIAS; + method_ = ALIAS; } } @@ -135,16 +135,16 @@ double Normal::gslZiggurat() static bool inited = false; if (!inited) { - /* create a generator chosen by the + /* create a generator chosen by the environment variable GSL_RNG_TYPE */ - + gsl_rng_env_setup(); - + T = gsl_rng_default; r = gsl_rng_alloc (T); - inited = true; + inited = true; } - return gsl_ran_gaussian_ziggurat(r, 1.0); + return gsl_ran_gaussian_ziggurat(r, 1.0); } #endif // !USE_GSL @@ -153,7 +153,7 @@ double Normal::gslZiggurat() */ double Normal::BoxMueller() { - double result; + double result; double a, b, r; do { @@ -162,9 +162,9 @@ double Normal::BoxMueller() r = a * a + b * b; } while ( r >= 1.0 ); r = sqrt( - 2.0 * log(r) / r ); - result = r * a; - - return result; + result = r * a; + + return result; } /** Refer to: @@ -174,19 +174,19 @@ double Normal::BoxMueller() We are assuming size of long to be 32 bit */ -const unsigned long y[] = +const unsigned long y[] = { 200, 199, 199, 198, 197, 196, 195, 193, 192, 190, 188, 186, 184, 181, 179, 176, 173, 170, 167, 164, 161, 157, 154, 151, 147, 143, 140, 136, 132, 128, 125, 121, 117, 113, 110, 106, 102, 98, 95, 91, 88, 84, 81, 77, 74, 71, 68, 64, 61, 59, 56, 53, 50, 48, 45, 43, 40, 38, 36, 34, 32, 30, 28, 27, 25, 23, 22, 20, 19, 18, 17, 15, 14, 13, 12, 11, 11, 10, 9, 8, 8, 7, 6, 6, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -const long a[] = +const long a[] = { - 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 27, 26, 25, 24, 23, 22, 21, -1, 19, 19, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 + 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 27, 26, 25, 24, 23, 22, 21, -1, 19, 19, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; -const unsigned long q[] = +const unsigned long q[] = { - 28, 32, 33, 36, 40, 43, 45, 47, 51, 53, 57, 59, 27, 37, 43, 54, 28, 45, 60, 63, 49, 61, 52, 34, 63, 46, 34, 18, 47, 40, 36, 29, 61, 57, 53, 51, 47, 43, 40, 37, 33, 31, 27, 25, 21, 19, 17, 14, 11, 9 , 8, 5, 54, 51, 49, 46, 44, 41, 39, 37, 35, 33, 31, 29, 28, 26, 24, 23, 21, 20, 19, 18, 16, 15, 14, 13, 12, 12, 11, 10, 9, 9, 8, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + 28, 32, 33, 36, 40, 43, 45, 47, 51, 53, 57, 59, 27, 37, 43, 54, 28, 45, 60, 63, 49, 61, 52, 34, 63, 46, 34, 18, 47, 40, 36, 29, 61, 57, 53, 51, 47, 43, 40, 37, 33, 31, 27, 25, 21, 19, 17, 14, 11, 9 , 8, 5, 54, 51, 49, 46, 44, 41, 39, 37, 35, 33, 31, 29, 28, 26, 24, 23, 21, 20, 19, 18, 16, 15, 14, 13, 12, 12, 11, 10, 9, 9, 8, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; const double c = 0.004996971959878404; @@ -194,122 +194,122 @@ const double d = 1.861970434352886050; /*********************************************************************************************************************************/ /* TODO: This implementation has a bug. The sample mean deviates a lot * from the generator mean for very small numbers, like 1e-7 - * Need to make sure that this is not due to 32/64 bit incompatibility. + * Need to make sure that this is not due to 32/64 bit incompatibility. */ /*********************************************************************************************************************************/ double Normal::aliasMethod() { double result; - + unsigned long uniform; unsigned long uniform_prime; unsigned long x_num; unsigned long t_num; unsigned long v_num; - + unsigned long i_num, k_num, sgn; while (true) { - + // 1) u = .B1..B7 (base 256) - we take the little endian approach uniform = genrand_int32(); // .B1B2B3B4 - limited by precision - - // 1a) s = B1[0] + + // 1a) s = B1[0] sgn = uniform & 0x80000000UL; // 1b) B1[0] = 0 uniform = uniform & 0x7fffffffUL; - + // 2) i = B1[1..7] i_num = uniform >> 24; // 3) k = (B2 ^ B4) and retain least significant 6 bits of k k_num = ((uniform >> 16) ^ uniform ) & 0x0000003fUL; - + // 4) k <q[i]? goto 7 if ( k_num >= q[i_num] ) { // 5) i = a[i] i_num = a[i_num]; - + // 5a)i = ~0? goto 11 if (i_num != ~(0UL)) { - + // 6) B1 = i uniform = (uniform & 0x00ffffffUL) | (i_num << (WORD_LENGTH-8)); - + // 6a) x = 8*u x_num = uniform << 3; - + // 6b) goto 8 - s = 0? return x: return -x // result = x_num/4294967296.0; // convert to double // result = (sgn == 0) ? result : -result; - //return result; + //return result; break; } } else { - - + + // 7) x = 8*u x_num = uniform << 3; - + // 7a) if (k <= y[i-1] - y[i]) goto 9 if (k_num > y[i_num-1] - y[i_num]) { - // 8) s = 0? return x: return -x + // 8) s = 0? return x: return -x // result = x_num/4294967296.0; // convert to double // result = (sgn == 0) ? result : -result; - //return result; + //return result; break; - + } - + // 9) u' = .B1'..B7' .. using B1-B4 for precision limitation uniform_prime = genrand_int32(); // 9a) t = x*x/2 t_num = x_num*(x_num/2); - + // 9b) v = c*(y[i] + u'*(y[i-1] - y[i] + 1)) v_num = (unsigned long)(c*(y[i_num] + uniform_prime*(y[i_num - 1] - y[i_num] + 1))); - + // 10) v > exp(-t)? goto 1: goto 8 - - + + if ( testAcceptance(t_num, v_num )) { result = x_num/4294967296.0; // convert to double result = (sgn == 0) ? result : -result; //return result; - break; - + break; + }else { continue; } - } - + } + // 11) u = .B1..B7 uniform = genrand_int32(); - + // 11a) u < 1/9? goto 1 if ( uniform/4294967296.0 < 1.0/9.0) { continue; } - + // 12) x = 3.75 + 0.25/u unsigned long divider = ((uniform << 24) + ((uniform << 16) & 0x00ff0000UL) + ((uniform << 8) & 0x0000ff00UL) + (uniform & 0x000000ffUL)); - + x_num = (unsigned long)( 3.75 + (1.0*0x40000000UL)/divider); // 12a) t = x*x/2-8, v = d*u*u*u' t_num = x_num*x_num/2 - 0x8UL; v_num = (unsigned long)(d*uniform*uniform*uniform_prime); - + // 12b) goto 10 // 10) v > exp(-t)? goto 1: goto 8 if ( testAcceptance(t_num, v_num) ) @@ -319,8 +319,8 @@ double Normal::aliasMethod() // result = (sgn == 0) ? result : -result; // return result; break; - - + + }else // goto 1 { continue; @@ -328,9 +328,9 @@ double Normal::aliasMethod() } // 8) result = (sgn == 0) ? x_num/4294967296.0 : -(x_num/4294967296.0); - + return result; - + } /** Method to check if v > exp(-t) without doing the exponentiation @@ -340,11 +340,11 @@ bool Normal::testAcceptance(unsigned long t_num, unsigned long v_num) { bool accept = false; bool cont = true; - + double t = t_num/4294967296.0; double v = v_num/4294967296.0; // return (v > exp(-t)); - + while(cont) { // a) if ( t >= LN2 ) @@ -352,13 +352,13 @@ bool Normal::testAcceptance(unsigned long t_num, unsigned long v_num) // b) t = t - LN2; v += v; - + if ( v > 1 ) { - return false; + return false; } else - { + { continue; } } @@ -366,14 +366,14 @@ bool Normal::testAcceptance(unsigned long t_num, unsigned long v_num) v = v + t - 1; if ( v <= 0 ) { - return true; + return true; } // d) double r = t * t; v = v + v - r; if ( v > 0) { - return false; + return false; } double c = 3.0; // e) @@ -394,9 +394,9 @@ bool Normal::testAcceptance(unsigned long t_num, unsigned long v_num) return false; } c += 1.0; - } + } } - return accept; + return accept; } /** @@ -409,7 +409,7 @@ double algorithmM() // not implemented { cout << "algorithmM() - not yet implemented." << endl; return 0.0; - + double result; double u; int psi; @@ -456,7 +456,7 @@ double algorithmM() // not implemented // M9 [ Attach sign ] // if ( psi == 1 ) X = -X - return result; + return result; } #endif /** @@ -465,9 +465,9 @@ double algorithmM() // not implemented double algorithmF() { cout << "algorithmF() - not implemented." << endl; - + double result = 0; - return result; + return result; } @@ -483,7 +483,7 @@ void checkMeanVariance(Normal& normalGen, unsigned seqLen) { double sample = normalGen.getNextSample(); seq.push_back(sample); - mean += sample; + mean += sample; } mean /= seqLen; cout << "Testing Normal: " << normalGen.getMethod() << " method for " << seqLen << " samples :: mean set - " << normalGen.getMean() << ", sample mean - " << mean << ". "; @@ -499,10 +499,10 @@ void checkMeanVariance(Normal& normalGen, unsigned seqLen) void testNormal() { // const unsigned SEQ_LEN = 1000; - + Normal* normalGen = new Normal(); // make sure default constructor creates standard normal - assert(isClose< double >(normalGen->getMean(), 0.0, DBL_EPSILON)); + assert(isClose< double >(normalGen->getMean(), 0.0, DBL_EPSILON)); assert(isClose< double > (normalGen->getVariance(), 1.0, DBL_EPSILON)); // check if setting method is effective normalGen->setMethod(ALIAS); @@ -511,11 +511,11 @@ void testNormal() delete normalGen; normalGen = new Normal(100.0, 33.0, BOX_MUELLER); assert(normalGen->getMethod() == BOX_MUELLER); - assert(isClose< double >(normalGen->getMean(), 100.0, DBL_EPSILON)); + assert(isClose< double >(normalGen->getMean(), 100.0, DBL_EPSILON)); assert(isClose(normalGen->getVariance(), 33.0, DBL_EPSILON)); checkMeanVariance(*normalGen, 1000); // check the sample mean and variance for "Box-Mueller method" delete normalGen; - + // non standard normal distr. normalGen = new Normal(); normalGen->setMean(-100.0); @@ -526,8 +526,8 @@ void testNormal() void testByte2Double() { double res; - - unsigned char bytes[] = + + unsigned char bytes[] = { 0, 0, 0, 0, 0 }; @@ -540,7 +540,7 @@ void testByte2Double() bytes[2] = 0x3; res = byte2double(bytes, 3); printf("0.000003 H = %.20g\n", res); - bytes[1] = 0x2; + bytes[1] = 0x2; res = byte2double(bytes, 2); printf("0.0002 H = %.20g\n", res); assert(isClose< double >(res, 0.000030517578125)); @@ -548,8 +548,8 @@ void testByte2Double() res = byte2double(bytes, 1); printf("0.01 H = %.20g\n", res); assert(res == 0.00390625); - res = byte2double(bytes, 5); - printf("0.0102030405 in hex = %.20g\n", res); + res = byte2double(bytes, 5); + printf("0.0102030405 in hex = %.20g\n", res); assert(isClose< double >(res, 0.0039369473279293742962, 1e-9));// the right comparison is from the same program. Should check for various architectures. } #endif // #if 0 @@ -565,12 +565,12 @@ int main(void) double sum = 0.0; int freq [200]; Normal n(BOX_MUELLER); - + for ( int i = 0; i < 200; ++i ) { freq[i] = 0; } - + for ( int i = 0; i < 10000; ++i ) { double p = n.getNextSample();//aliasMethod(); @@ -580,11 +580,11 @@ int main(void) index = 0; else if ( index > 199 ) index = 199; - + freq[index]++; - + sum += p; - sd = p*p; + sd = p*p; } mean = sum/1000; sd = sd/1000; @@ -593,9 +593,9 @@ int main(void) { cout << freq[i] << endl; } - + testNormal(); - + return 0; } #endif // ! define(DO_UNIT_TESTS) && defined(TEST_MAIN) diff --git a/moose-core/randnum/Normal.h b/moose-core/randnum/Normal.h index fbf803b2f49671884b03085eb846de3b9699c3b2..c74cf9bb3a66405ed6f8fd7e71f1d52da288d44b 100644 --- a/moose-core/randnum/Normal.h +++ b/moose-core/randnum/Normal.h @@ -28,7 +28,7 @@ enum NormalGenerator class Normal : public Probability { - + public: Normal(double mean=0.0, double variance=1.0, NormalGenerator algorithm=ALIAS); double getMean() const; @@ -47,8 +47,8 @@ class Normal : public Probability static double BoxMueller(); static double aliasMethod(); static double gslZiggurat(); - static bool testAcceptance(unsigned long t, unsigned long v); + static bool testAcceptance(unsigned long t, unsigned long v); }; - + #endif diff --git a/moose-core/randnum/NormalRng.cpp b/moose-core/randnum/NormalRng.cpp index 6fa1419adbe7808f5f0b4821e6cc15962fe9a203..e31f636f31a900b7bed1b657d4785f3b89c9e5a9 100644 --- a/moose-core/randnum/NormalRng.cpp +++ b/moose-core/randnum/NormalRng.cpp @@ -45,7 +45,7 @@ const Cinfo* NormalRng::initCinfo() &variance, &method, }; - + static string doc[] = { "Name", "NormalRng", "Author", "Subhasis Ray", @@ -63,11 +63,11 @@ const Cinfo* NormalRng::initCinfo() return &normalRngCinfo; } - + static const Cinfo* normalRngCinfo = NormalRng::initCinfo(); /** - Set the mean of the internal generator object. + Set the mean of the internal generator object. */ void NormalRng::setMean(double mean) { @@ -79,7 +79,7 @@ void NormalRng::setMean(double mean) /** Since normal distribution is defined in terms of mean and variance, we - want to store them in order to create the internal generator object. + want to store them in order to create the internal generator object. */ void NormalRng::setVariance(double variance) { @@ -114,7 +114,7 @@ int NormalRng::getMethod() const */ void NormalRng::setMethod(int method) { - Normal* nrng = static_cast <Normal*> (rng_); + Normal* nrng = static_cast <Normal*> (rng_); if ( nrng ){ cout << "Warning: Changing method after generator object has been created. Current method: " << nrng->getMethod() << ". New method: " << method << endl; nrng->setMethod((NormalGenerator)method); diff --git a/moose-core/randnum/NormalRng.h b/moose-core/randnum/NormalRng.h index b1416b172ab0c7509d76dbd920011550075facc4..55e100d2b4f0760541b334a80e21346fa474d3b1 100644 --- a/moose-core/randnum/NormalRng.h +++ b/moose-core/randnum/NormalRng.h @@ -1,6 +1,6 @@ /******************************************************************* * File: NormalRng.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-05 10:19:18 @@ -40,5 +40,5 @@ class NormalRng: public RandGenerator static const Cinfo * initCinfo(); }; - + #endif diff --git a/moose-core/randnum/Poisson.cpp b/moose-core/randnum/Poisson.cpp index 7170fcedc317c1a03e2ee6c42587d96fb1e69726..fe06c4e34b91b96742c17347ab4d6fd323837ca0 100644 --- a/moose-core/randnum/Poisson.cpp +++ b/moose-core/randnum/Poisson.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: Poisson.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-01 16:09:38 @@ -62,7 +62,7 @@ Poisson::~Poisson() if (gammaGen_) { delete gammaGen_; - } + } } @@ -117,12 +117,12 @@ double Poisson::getNextSample() const double Poisson::poissonSmall(const Poisson& poisson) { double product = 1.0; - + int i = 0; while ( product > poisson.mValue_ ) { product *= mtrand(); - ++i; + ++i; } return i; } @@ -140,21 +140,21 @@ double Poisson::poissonSmall(const Poisson& poisson) static double m_value = floor(0.875*mean_); // alpha = 7/8 = 0.875 is a good value according to Ahrens and Dieter static Gamma gammaGen(m_value, 1.0); double n_value; - - double x_value = gammaGen.getNextSample(); - + + double x_value = gammaGen.getNextSample(); + if ( x_value < mean_ ) { - Poisson poissonGen(mean_ - x_value); + Poisson poissonGen(mean_ - x_value); n_value = m_value + poissonGen.getNextSample(); } else { Binomial binomialGen((long)m_value-1,mean_/x_value); - n_value = binomialGen.getNextSample(); + n_value = binomialGen.getNextSample(); } - - return n_value; + + return n_value; } */ // WATCH OUT: this is recursive. look for better alternative. @@ -178,27 +178,27 @@ double Poisson::poissonLarge(const Poisson& poisson) int main(int argc, char **argv) { double mean = 4; - + if (argc > 1) mean = atof(argv[1]); - - + + double sum = 0.0; - double sd = 0.0; + double sd = 0.0; vector <double> samples; Poisson poisson(mean); int MAX_SAMPLE = 100000; unsigned index; - - + + cout << "epsilon = " << getMachineEpsilon() << endl; for ( int i = 0; i < MAX_SAMPLE; ++i ) { double p = poisson.getNextSample();//aliasMethod(); samples.push_back(p); - + sum += p; - sd += (p - mean)*(p - mean); + sd += (p - mean)*(p - mean); } mean = sum/MAX_SAMPLE; sd = sqrt(sd/MAX_SAMPLE); @@ -208,11 +208,11 @@ int main(int argc, char **argv) unsigned i = 0; unsigned start = 0; index = 0; - + while ( i < samples.size() ) { int count = 0; - + while( ( i < samples.size() ) && (samples[i] == samples[start] )) { ++count; @@ -222,9 +222,9 @@ int main(int argc, char **argv) { cout << index++ << " " << 0 << endl; } - - cout << index++ << " " << count << endl; - start = i; + + cout << index++ << " " << count << endl; + start = i; } return 0; } diff --git a/moose-core/randnum/Poisson.h b/moose-core/randnum/Poisson.h index 7269a334a7a1df5e8cb979fecf14838755941fac..985bd56f56693bc3991bbf9e8967348acec326a0 100644 --- a/moose-core/randnum/Poisson.h +++ b/moose-core/randnum/Poisson.h @@ -1,6 +1,6 @@ /******************************************************************* * File: Poisson.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-02 09:43:47 @@ -33,7 +33,7 @@ class Poisson:public Probability public: Poisson(double mean=1.0); ~Poisson(); - + void setMean(double mean); double getMean() const; double getVariance() const; @@ -47,5 +47,5 @@ class Poisson:public Probability double (*generator_)(const Poisson&); double mValue_; }; - + #endif diff --git a/moose-core/randnum/PoissonRng.cpp b/moose-core/randnum/PoissonRng.cpp index e7b0017bbc472319f02b155a39a4428981841f23..b8ac5b5c140730fe859b41c3ad8464e88eef9ba1 100644 --- a/moose-core/randnum/PoissonRng.cpp +++ b/moose-core/randnum/PoissonRng.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: PoissonRng.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-08 09:53:32 @@ -45,16 +45,16 @@ const Cinfo* PoissonRng::initCinfo() &dinfo, doc, sizeof( doc ) / sizeof( string )); - + return &poissonRngCinfo; } - + static const Cinfo* poissonRngCinfo = PoissonRng::initCinfo(); PoissonRng::PoissonRng() { - //do nothing. should not try to get mean + //do nothing. should not try to get mean } /** @@ -69,7 +69,7 @@ void PoissonRng::setMean(double mean) rng_ = new Poisson(mean); } else { prng->setMean(mean); - } + } } /** reports error in case the parameter mean has not been set. @@ -78,9 +78,9 @@ void PoissonRng::vReinit(const Eref& e, ProcPtr p) { if ( !rng_ ) { - cerr << "ERROR: PoissonRng::vReinit - mean must be set before using the Poisson distribution generator." << endl; + cerr << "ERROR: PoissonRng::vReinit - mean must be set before using the Poisson distribution generator." << endl; } } - + #endif diff --git a/moose-core/randnum/PoissonRng.h b/moose-core/randnum/PoissonRng.h index 650b1bc7d182516be013d9aa5750527940203092..119276b750d04b58700a161cfb78ca1e2cd1f37b 100644 --- a/moose-core/randnum/PoissonRng.h +++ b/moose-core/randnum/PoissonRng.h @@ -1,6 +1,6 @@ /******************************************************************* * File: PoissonRng.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-07 16:22:35 diff --git a/moose-core/randnum/Probability.cpp b/moose-core/randnum/Probability.cpp index 5a8b1ca87c2937e1fba8de40b09166fe7020e095..c7ad7da78c116b8e505ef465186bfb1480e0ed03 100644 --- a/moose-core/randnum/Probability.cpp +++ b/moose-core/randnum/Probability.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: Probability.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-10-28 13:35:39 diff --git a/moose-core/randnum/Probability.h b/moose-core/randnum/Probability.h index 70b579b0897d9614322baa1568be62c32d34000c..61c5acf5d5ad1c2488949b5e6c3977f3210f0719 100644 --- a/moose-core/randnum/Probability.h +++ b/moose-core/randnum/Probability.h @@ -27,14 +27,14 @@ class Probability { public: virtual ~Probability(){}; - + virtual double getMean() const =0; virtual double getVariance()const =0; virtual double getNextSample()const =0; - + private: // long double mean_; // TODO : do we really need this? -// long double variance_;// TODO : do we really need this? +// long double variance_;// TODO : do we really need this? }; - + #endif diff --git a/moose-core/randnum/RNG.h b/moose-core/randnum/RNG.h index 8fe38b64c1a19168271e8ae627f6d8bddb9a8828..9eb1639ec093dd4088d20aea500155f38a74d0ff 100644 --- a/moose-core/randnum/RNG.h +++ b/moose-core/randnum/RNG.h @@ -43,7 +43,7 @@ using namespace std; namespace moose { -/* +/* * ===================================================================================== * Class: RNG * Description: Random number generator class. @@ -65,7 +65,7 @@ class RNG void setRandomSeed( ) { -#if defined(USE_BOOST) +#if defined(USE_BOOST) #if defined(BOOST_RANDOM_DEVICE_EXISTS) boost::random::random_device rd; setSeed( rd() ); @@ -130,8 +130,8 @@ class RNG */ T uniform( void ) { -#if defined(USE_BOOST) || defined(ENABLE_CPP11) - return dist_( rng_ ); +#if defined(USE_BOOST) || defined(ENABLE_CPP11) + return dist_( rng_ ); #else return mtrand(); #endif diff --git a/moose-core/randnum/RandGenerator.cpp b/moose-core/randnum/RandGenerator.cpp index 6fabd15246bca5da95b76cdd87f5c9603ad60f9c..7bd80f355fc4528866de305a6a746c249a06f0e2 100644 --- a/moose-core/randnum/RandGenerator.cpp +++ b/moose-core/randnum/RandGenerator.cpp @@ -57,7 +57,7 @@ const Cinfo * RandGenerator::initCinfo() ////////////////////////////////////////////////////////////// // ValueFinfo Definitions ////////////////////////////////////////////////////////////// - + static ReadOnlyValueFinfo<RandGenerator, double> sample( "sample", "Generated pseudorandom number.", @@ -78,7 +78,7 @@ const Cinfo * RandGenerator::initCinfo() output(), &proc, }; - + static string doc[] = { "Name", "RandGenerator", "Author", "Subhasis Ray", @@ -87,7 +87,7 @@ const Cinfo * RandGenerator::initCinfo() " directly. Instead, its subclasses named after specific distributions" " should be used.", }; - + static Dinfo< RandGenerator > dinfo; static Cinfo randGeneratorCinfo( "RandGenerator", @@ -97,7 +97,7 @@ const Cinfo * RandGenerator::initCinfo() &dinfo, doc, sizeof( doc ) / sizeof( string )); - + return &randGeneratorCinfo; } @@ -106,7 +106,7 @@ static const Cinfo * randGeneratorCinfo = RandGenerator::initCinfo(); RandGenerator::RandGenerator() { sample_ = 0.0; - rng_ = NULL; + rng_ = NULL; } RandGenerator::~RandGenerator() @@ -124,16 +124,16 @@ double RandGenerator::getMean() const { return rng_->getMean(); } - return 0.0; + return 0.0; } double RandGenerator::getVariance() const { if (rng_) { - return rng_->getVariance(); + return rng_->getVariance(); } - return 0.0; + return 0.0; } double RandGenerator::getSample() const @@ -151,7 +151,7 @@ void RandGenerator::process( const Eref& e, ProcPtr p ) void RandGenerator::reinit(const Eref& e, ProcPtr p) { - vReinit(e, p); + vReinit(e, p); } void RandGenerator::vReinit(const Eref& e, ProcPtr p) diff --git a/moose-core/randnum/RandGenerator.h b/moose-core/randnum/RandGenerator.h index 850511313dbb12f773d3da5261b5a4e0717a92bc..7e37b716ceabce763c2573e80a2611583a414cc2 100644 --- a/moose-core/randnum/RandGenerator.h +++ b/moose-core/randnum/RandGenerator.h @@ -1,6 +1,6 @@ /******************************************************************* * File: RandGenerator.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-11-07 16:25:08 @@ -27,22 +27,22 @@ generators (which is an instance of Probability class). */ class RandGenerator -{ +{ public: RandGenerator(); virtual ~RandGenerator(); - double getMean() const; + double getMean() const; double getVariance() const; double getSample() const; void process( const Eref& e, ProcPtr info); void reinit( const Eref& e, ProcPtr info); virtual void vReinit( const Eref& e, ProcPtr info); - + static const Cinfo * initCinfo(); protected: Probability* rng_; double sample_; }; - + #endif diff --git a/moose-core/randnum/Uniform.cpp b/moose-core/randnum/Uniform.cpp index 850a5fa2fbefb90cbc3deb89385da69729e122e4..1b9fb8bf9f6fdca4c453bf7dae42a018a63b4695 100644 --- a/moose-core/randnum/Uniform.cpp +++ b/moose-core/randnum/Uniform.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: Uniform.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2008-02-21 17:12:55 @@ -30,7 +30,7 @@ using namespace std; Uniform::Uniform() { min_ = 0.0; - max_ = 1.0; + max_ = 1.0; } Uniform::Uniform(double min, double max) { @@ -41,7 +41,7 @@ Uniform::Uniform(double min, double max) max_ = 1.0; return; } - + min_ = min; max_ = max; } @@ -79,15 +79,15 @@ double Uniform::getNextSample() const void doTest(double min, double max, unsigned count) { Uniform rng; - + rng.setMin(min); rng.setMax(max); assert(isClose<double>(min, rng.getMin(), DBL_EPSILON)); assert(isClose<double>(max, rng.getMax(), DBL_EPSILON)); vector <double> seq; double mean = 0.0; - - + + for (unsigned ii = 0; ii < count; ++ii ) { double sample; @@ -103,7 +103,7 @@ void doTest(double min, double max, unsigned count) } var = var / count; cout << "theoretical mean: " << rng.getMean() << ", sample mean: " << mean << ", theoretical var: " << rng.getVariance() << ", sample var: " << var << ", sample size: " << count << endl; - + } void testUniform() @@ -117,7 +117,7 @@ void testUniform() #if defined( TEST_MAIN ) && defined(DO_UNIT_TESTS) int main(void) { - testUniform(); + testUniform(); } #endif // !defined( TEST_MAIN ) && defined(DO_UNIT_TESTS) diff --git a/moose-core/randnum/Uniform.h b/moose-core/randnum/Uniform.h index c11389cd5fe12ab214f8f7361c8022c108faff4f..3073fb8252578b8f20424682fd76710d3c5f414d 100644 --- a/moose-core/randnum/Uniform.h +++ b/moose-core/randnum/Uniform.h @@ -1,6 +1,6 @@ /******************************************************************* * File: Uniform.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2008-02-21 17:09:54 @@ -32,12 +32,12 @@ class Uniform: public Probability double getMax() const; void setMin(double min); void setMax(double max); - + private: double min_; double max_; - + }; - + #endif diff --git a/moose-core/randnum/UniformRng.cpp b/moose-core/randnum/UniformRng.cpp index 18aeb1240e0ea6aa21fc471073a83f3ada2a8351..15630b7c459fb28404b4d043c1a6f31cf212ac97 100644 --- a/moose-core/randnum/UniformRng.cpp +++ b/moose-core/randnum/UniformRng.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: UniformRng.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2008-02-01 11:30:20 @@ -34,7 +34,7 @@ const Cinfo* UniformRng::initCinfo() "The upper bound on the numbers generated", &UniformRng::setMax, &UniformRng::getMax); - + static Finfo * uniformRngFinfos[] = { &min, &max, diff --git a/moose-core/randnum/UniformRng.h b/moose-core/randnum/UniformRng.h index 3606cf11ed11bb3110851f9336de6c091661e8ae..da4d4af07952f84606e0564044300a30f112c8c6 100644 --- a/moose-core/randnum/UniformRng.h +++ b/moose-core/randnum/UniformRng.h @@ -1,6 +1,6 @@ /******************************************************************* * File: UniformRng.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2008-02-01 11:52:48 @@ -35,9 +35,9 @@ class UniformRng: public RandGenerator static const Cinfo * initCinfo(); private: double min_; - double max_; + double max_; }; - - + + #endif diff --git a/moose-core/randnum/mt19937ar.cpp b/moose-core/randnum/mt19937ar.cpp index cddcf0990bcea5609de4f08764b77e29e683c700..3becb14a9a1aa52b9e7e0ea1e7fd706129ed57d8 100644 --- a/moose-core/randnum/mt19937ar.cpp +++ b/moose-core/randnum/mt19937ar.cpp @@ -1,12 +1,12 @@ -/* +/* A C-program for MT19937, with initialization improved 2002/1/26. Coded by Takuji Nishimura and Makoto Matsumoto. - Before using, initialize the state by using init_genrand(seed) + Before using, initialize the state by using init_genrand(seed) or init_by_array(init_key, key_length). Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -19,8 +19,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -50,7 +50,7 @@ #endif #include <stdlib.h> #include "randnum.h" -/* Period parameters */ +/* Period parameters */ #define N 624 #define M 397 #define MATRIX_A 0x9908b0dfUL /* constant vector a */ @@ -65,8 +65,8 @@ void init_genrand(unsigned long s) { mt[0]= s & 0xffffffffUL; for (mti=1; mti<N; mti++) { - mt[mti] = - (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti); + mt[mti] = + (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti); /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ /* In the previous versions, MSBs of the seed affect */ /* only MSBs of the array mt[]. */ @@ -81,21 +81,21 @@ void init_genrand(unsigned long s) int gettimeofday( struct timeval* tv, void* timezone ) { FILETIME time; double timed; - + GetSystemTimeAsFileTime( &time ); - + // Apparently Win32 has units of 1e-7 sec (tenths of microsecs) // 4294967296 is 2^32, to shift high word over // 11644473600 is the number of seconds between // the Win32 epoch 1601-Jan-01 and the Unix epoch 1970-Jan-01 // Tests found floating point to be 10x faster than 64bit int math. - + timed = ((time.dwHighDateTime * 4294967296e-7) - 11644473600.0) + (time.dwLowDateTime * 1e-7); - + tv->tv_sec = (long) timed; tv->tv_usec = (long) ((timed - tv->tv_sec) * 1e6); - + return 0; } #endif @@ -130,7 +130,7 @@ void init_by_array(long int init_key[], int key_length) if (i>=N) { mt[0] = mt[N-1]; i=1; } } - mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */ + mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */ } /* generates a random number on [0,0xffffffff]-interval */ @@ -159,7 +159,7 @@ unsigned long genrand_int32(void) mti = 0; } - + y = mt[mti++]; /* Tempering */ @@ -180,30 +180,30 @@ long genrand_int31(void) /* generates a random number on [0,1]-real-interval */ double genrand_real1(void) { - return genrand_int32()*(1.0/4294967295.0); - /* divided by 2^32-1 */ + return genrand_int32()*(1.0/4294967295.0); + /* divided by 2^32-1 */ } /* generates a random number on [0,1)-real-interval */ double genrand_real2(void) { - return genrand_int32()*(1.0/4294967296.0); + return genrand_int32()*(1.0/4294967296.0); /* divided by 2^32 */ } /* generates a random number on (0,1)-real-interval */ double genrand_real3(void) { - return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0); + return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0); /* divided by 2^32 */ } /* generates a random number on [0,1) with 53-bit resolution*/ -double genrand_res53(void) -{ - unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6; - return(a*67108864.0+b)*(1.0/9007199254740992.0); -} +double genrand_res53(void) +{ + unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6; + return(a*67108864.0+b)*(1.0/9007199254740992.0); +} /* These real versions are due to Isaku Wada, 2002/01/09 added */ /* @@ -253,6 +253,6 @@ void mtseed(long seed = 0) /* generates a random number on [0,1)-real-interval */ double mtrand(void) { - return genrand_int32()*(1.0/4294967296.0); + return genrand_int32()*(1.0/4294967296.0); /* divided by 2^32 */ } diff --git a/moose-core/scheduling/CMakeLists.txt b/moose-core/scheduling/CMakeLists.txt index 49e5563468d882586b950db900b54e018d8d7e8f..52917a415d8cefc111a7e298405cf6fcd015dd5d 100644 --- a/moose-core/scheduling/CMakeLists.txt +++ b/moose-core/scheduling/CMakeLists.txt @@ -1,12 +1,15 @@ -file(GLOB scheduling_SRC - "*.h" - "*.cpp" -) +file(GLOB scheduling_SRC "*.cpp" ) -IF(NOTIFY_PROGRESS) - ADD_DEFINITIONS("-DNOTIFY_PROGRESS") -ENDIF() +if(NOTIFY_PROGRESS) + add_definitions("-DNOTIFY_PROGRESS") +endif(NOTIFY_PROGRESS) + +if(PARALLELIZED_CLOCK) + message( STATUS "Enabling high-level parallelization of moose::Clock" ) + add_definitions( -DPARALLELIZE_CLOCK_USING_CPP11_ASYNC ) +endif(PARALLELIZED_CLOCK) include_directories(../msg) include_directories(../basecode) + add_library(scheduling ${scheduling_SRC}) diff --git a/moose-core/scheduling/Clock.cpp b/moose-core/scheduling/Clock.cpp index b5bac41b1219c87702b57fe37736fa7605966c8c..bd1e6ca8b820e269d513958fcce55293002a502a 100644 --- a/moose-core/scheduling/Clock.cpp +++ b/moose-core/scheduling/Clock.cpp @@ -51,6 +51,11 @@ #include "header.h" #include "Clock.h" #include "../utility/numutil.h" +#include "../utility/print_function.hpp" + +#if PARALLELIZE_CLOCK_USING_CPP11_ASYNC +#include <future> +#endif // Declaration of some static variables. const unsigned int Clock::numTicks = 32; @@ -698,7 +703,9 @@ void Clock::handleStart( const Eref& e, double runtime, bool notify ) if ( stride_ == 0 || stride_ == ~0U ) stride_ = 1; unsigned long n = round( runtime / ( stride_ * dt_ ) ); + handleStep( e, n ); + } void Clock::handleStep( const Eref& e, unsigned long numSteps ) @@ -725,6 +732,40 @@ void Clock::handleStep( const Eref& e, unsigned long numSteps ) // Curr time is end of current step. unsigned long endStep = currentStep_ + stride_; currentTime_ = info_.currTime = dt_ * endStep; + +#if PARALLELIZE_CLOCK_USING_CPP11_ASYNC + + // NOTE: It does not produce very promising results. The challenge here + // is doing load-balancing. + // TODO: To start with, we can put one solver on one thread and everything + // else onto 1 thread. Each Hsove, Ksolve, and Gsolve can take its own + // thread and rest are on different threads. + + unsigned int nTasks = activeTicks_.size( ); + unsigned int numThreads_ = 3; + unsigned int blockSize = 1 + (nTasks / numThreads_); + + for( unsigned int i = 0; i < numThreads_; ++i ) + { + std::async( std::launch::async + , [this,blockSize,i,nTasks,endStep,e] + { + unsigned int mapI = i * blockSize; + // Get the block we want to run in paralle. + for( unsigned int ii = i * blockSize; ii < min((i+1) * blockSize, nTasks); ii++ ) + { + unsigned int j = activeTicks_[ ii ]; + if( endStep % j == 0 ) + { + info_.dt = j * dt_; + processVec( )[ activeTicksMap_[mapI] ]->send( e, &info_ ); + } + mapI++; + } + } + ); + } +#else vector< unsigned int >::const_iterator k = activeTicksMap_.begin(); for ( vector< unsigned int>::iterator j = activeTicks_.begin(); j != activeTicks_.end(); ++j ) @@ -736,6 +777,7 @@ void Clock::handleStep( const Eref& e, unsigned long numSteps ) } ++k; } +#endif // When 10% of simulation is over, notify user when notify_ is set to // true. @@ -750,9 +792,10 @@ void Clock::handleStep( const Eref& e, unsigned long numSteps ) << "% of total " << runTime_ << " seconds is over." << endl; } } + + if ( activeTicks_.size() == 0 ) + currentTime_ = runTime_; } - if ( activeTicks_.size() == 0 ) - currentTime_ = runTime_; info_.dt = dt_; isRunning_ = false; diff --git a/moose-core/scheduling/Clock.h b/moose-core/scheduling/Clock.h index 7d294d675a8fd7a95791682d419c926baf7509ac..3666337a436cca81296e68f323a6e6c1585b90da 100644 --- a/moose-core/scheduling/Clock.h +++ b/moose-core/scheduling/Clock.h @@ -12,9 +12,9 @@ /** * Clock now uses integral scheduling. The Clock has an array of child - * Ticks, each of which controls the process and reinit calls of its + * Ticks, each of which controls the process and reinit calls of its * targets. The Clock has a minimum dt. - * All ticks operate with (positive) integral multiples of this, + * All ticks operate with (positive) integral multiples of this, * from 1 to anything. If multiple Ticks are due to go off in a given * cycle, the order is from lowest to highest. Within a Tick the order * of execution of target objects is undefined. @@ -52,7 +52,7 @@ class Clock // Dest functions ////////////////////////////////////////////////////////// /** - * Halts running simulation gracefully, letting it restart + * Halts running simulation gracefully, letting it restart * wherever it left off from. */ void stop(); @@ -97,7 +97,7 @@ class Clock /// Utility func to range-check when Ticks are being changed. bool checkTickNum( const string& funcName, unsigned int i ) const; - /** + /** * Look up the default Tick number for the specified class. * Note that for objects having an 'init' action as well as process, * the assigned tick is for 'init' and the next number will be @@ -147,17 +147,17 @@ class Clock /** * Ticks are sub-elements and send messages to sets of target * Elements that handle calculations in which update order does - * not matter. + * not matter. */ vector< unsigned int > ticks_; /** - * Array of active ticks. Drops out ticks lacking targets or with + * Array of active ticks. Drops out ticks lacking targets or with * a zero step. Sorted in increasing order of tick index. */ vector< unsigned int > activeTicks_; /** - * Maps the activeTicks_ array to the ticks index so + * Maps the activeTicks_ array to the ticks index so * we can trigger the appropriate message. */ vector< unsigned int > activeTicksMap_; diff --git a/moose-core/scheduling/testScheduling.cpp b/moose-core/scheduling/testScheduling.cpp index 1cce18e849621ad0b732667eabe5046e1bcefa84..197bce0c5f2bb819d9b4970b89c9d8ef71e43214 100644 --- a/moose-core/scheduling/testScheduling.cpp +++ b/moose-core/scheduling/testScheduling.cpp @@ -53,7 +53,7 @@ static const Cinfo* testSchedCinfo = TestSched::initCinfo(); void TestSched::process( const Eref& e, ProcPtr p ) { - static const int timings[] = { 1, 2, 2, 2, 3, 3, 4, 4, 4, + static const int timings[] = { 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 8, 8, 8, 9, 9, 10, 10, 10, 10, 10, 11, 12, 12, 12, 12, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 17, 18, 18, 18, 18, 19, 20, 20, 20, 20, 20, @@ -102,24 +102,24 @@ void testClock() Element* tse = new Element( tsid, testSchedCinfo, "tse", 1 ); Eref ts( tse, 0 ); - + FuncId f( processFinfo.getFid() ); const Finfo* proc0 = clock.element()->cinfo()->findFinfo( "process0" ); assert( proc0 ); const SrcFinfo* sproc0 = dynamic_cast< const SrcFinfo* >( proc0 ); assert( sproc0 ); unsigned int b0 = sproc0->getBindIndex(); - SingleMsg *m0 = new SingleMsg( er0.eref(), ts ); + SingleMsg *m0 = new SingleMsg( er0.eref(), ts ); er0.element()->addMsgAndFunc( m0->mid(), f, er0.dataId.value()*2 + b0); - SingleMsg *m1 = new SingleMsg( er1.eref(), ts ); + SingleMsg *m1 = new SingleMsg( er1.eref(), ts ); er1.element()->addMsgAndFunc( m1->mid(), f, er1.dataId.value()*2 + b0); SingleMsg *m2 = new SingleMsg( er2.eref(), ts ); er2.element()->addMsgAndFunc( m2->mid(), f, er2.dataId.value()*2 + b0); - SingleMsg *m3 = new SingleMsg( er3.eref(), ts ); + SingleMsg *m3 = new SingleMsg( er3.eref(), ts ); er3.element()->addMsgAndFunc( m3->mid(), f, er3.dataId.value()*2 + b0); - SingleMsg *m4 = new SingleMsg( er4.eref(), ts ); + SingleMsg *m4 = new SingleMsg( er4.eref(), ts ); er4.element()->addMsgAndFunc( m4->mid(), f, er4.dataId.value()*2 + b0); - SingleMsg *m5 = new SingleMsg( er5.eref(), ts ); + SingleMsg *m5 = new SingleMsg( er5.eref(), ts ); er5.element()->addMsgAndFunc( m5->mid(), f, er5.dataId.value()*2 + b0); diff --git a/moose-core/scheduling/testScheduling.h b/moose-core/scheduling/testScheduling.h index 17d1298a60663bf54d2e5b250ca481623660463b..e05a07d91b4c2da629740cd6efbbb55d578b951e 100644 --- a/moose-core/scheduling/testScheduling.h +++ b/moose-core/scheduling/testScheduling.h @@ -10,7 +10,7 @@ class TestSched { public: - /** + /** * This may be created as an array, but only on one thread */ TestSched() diff --git a/moose-core/scripts/build_macosx_bundle.sh b/moose-core/scripts/build_macosx_bundle.sh index f34139b17a12d40f67b489f2282a4aff0aab9598..cd5fbb6175aad1df30e818e1d61b5c6ba3dbbedf 100755 --- a/moose-core/scripts/build_macosx_bundle.sh +++ b/moose-core/scripts/build_macosx_bundle.sh @@ -1,12 +1,12 @@ #!/bin/bash -mkdir -p _build +mkdir -p _build ( cd _build rm -f moose*.dmg rm -rf moose-3.0.1-Linux* cmake -DCMAKE_INSTALL_PREFIX=/Moose.app .. make -j4 - #cpack -G Bundle + #cpack -G Bundle cpack -G DragNDrop -V 7z x moose-3.0.1-Linux-.dmg ) diff --git a/moose-core/scripts/build_pypi.sh b/moose-core/scripts/build_pypi.sh index f6783d3a7c8dce52d0acfd0bd36fa389167ba36f..486bd2421174415fa08c46c5d920a03309a02e58 100755 --- a/moose-core/scripts/build_pypi.sh +++ b/moose-core/scripts/build_pypi.sh @@ -2,9 +2,9 @@ set -e # This creates a package for pip. For testing purpose moose_dir=moose-3.0 -( - cd .. - svn export --force . scripts/$moose_dir +( + cd .. + svn export --force . scripts/$moose_dir ) ( cp setup.py $moose_dir/ diff --git a/moose-core/scripts/cmake_sanity_check.py b/moose-core/scripts/cmake_sanity_check.py index a3c0f90b5b9b3901b8c5b61300d1fa8bd38a7236..075eb8b6b4a8aa2fe55771cafd5c181e162b0671 100755 --- a/moose-core/scripts/cmake_sanity_check.py +++ b/moose-core/scripts/cmake_sanity_check.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """cmake_sanity_check.py: Check if Cmake files are ok. Last modified: Sat Jan 18, 2014 05:01PM @@ -6,7 +7,7 @@ Last modified: Sat Jan 18, 2014 05:01PM NOTE: Run in this directory only. """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] @@ -87,7 +88,7 @@ def checkSrcs(): else: print(" Failed: In dir {}, CMake is missing object {}".format(d, srcName)) - + def main(): test_dir = sys.argv[1] check(test_dir) diff --git a/moose-core/scripts/color.sh b/moose-core/scripts/color.sh index abca956cbdb7a4fea701f63841c2dba408469943..abac71107e7bc7f3793af150c98c8bdb93154fce 100755 --- a/moose-core/scripts/color.sh +++ b/moose-core/scripts/color.sh @@ -19,7 +19,7 @@ WHITE='\033[01;37m' function colorPrint { - case $1 in + case $1 in "WARN") echo -e "[WARN] ${LRED} $2 ${RESTORE} $3" ;; diff --git a/moose-core/scripts/moosegui.py b/moose-core/scripts/moosegui.py index 85ddc97865df5ca618d366d04d7ed24832251dde..40feef0c824f3cab0c2fdcae482baf030b6dccc0 100755 --- a/moose-core/scripts/moosegui.py +++ b/moose-core/scripts/moosegui.py @@ -1,15 +1,16 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # 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 diff --git a/moose-core/scripts/pre-commit-config.yaml b/moose-core/scripts/pre-commit-config.yaml deleted file mode 100644 index b5ccd235bbb18ec0364c61ee2eada886397d2c5e..0000000000000000000000000000000000000000 --- a/moose-core/scripts/pre-commit-config.yaml +++ /dev/null @@ -1,10 +0,0 @@ -- repo: https://github.com/pre-commit/pre-commit-hooks - sha: v0.6.1 - hooks: - - id: check-added-large-files - - id: check-ast - - id: check-merge-conflict - - id: check-case-conflict - - id: check-docstring-first - - id: debug-statements - diff --git a/moose-core/scripts/setup.py b/moose-core/scripts/setup.py index 9720d691f79828942889ac36f09cf5caf4f57095..746ba5a078982dc72b6b08f694ee5adcce5bfb62 100755 --- a/moose-core/scripts/setup.py +++ b/moose-core/scripts/setup.py @@ -1,11 +1,12 @@ +# -*- coding: utf-8 -*- -"""setup.py: This +"""setup.py: This scripts prepare MOOSE for PyPI. Last modified: Mon Jul 28, 2014 12:52AM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] @@ -42,7 +43,7 @@ class BuildCommand(_build): self.build_temp = '/tmp' self.build_lib = '/tmp' self.new_dir = os.path.join(os.path.split(__file__)[0], build_dir) - + def finalize_options(self): pass @@ -141,19 +142,19 @@ url = 'http://moose.ncbs.res.in/' setup( name = name - , version = version + , version = version , author = "Upinder Bhalla et. al." , author_email = "bhalla@ncbs.res.in" , maintainer = 'Dilawar Singh' , maintainer_email = 'dilawars@ncbs.res.in' - , description = description + , description = description , license = "LGPL" , url = url , long_description = read('README') , ext_modules = [ Extension('_moose', [ '*' ]) ] - , cmdclass = { + , cmdclass = { 'install' : InstallCommand , 'build_py' : BuildPyCommand , 'build_ext' : BuildCommand diff --git a/moose-core/setup_/__init__.py b/moose-core/setup_/__init__.py index 36d7f9c0a6fbf09b0f465493a01752a59ca658c9..50aca64a597d87ddbda39b60ac2ed743b7ccb993 100644 --- a/moose-core/setup_/__init__.py +++ b/moose-core/setup_/__init__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- sources = [ 'basecode/consts.cpp', 'basecode/Element.cpp', @@ -34,7 +35,7 @@ sources = [ 'basecode/ReduceBase.cpp', 'basecode/main.cpp', 'basecode/testAsync.cpp', - + 'biophysics/SynBase.cpp', 'biophysics/IntFire.cpp', 'biophysics/IzhikevichNrn.cpp', @@ -64,7 +65,7 @@ sources = [ 'biophysics/MarkovSolver.cpp', 'biophysics/ReadCell.cpp', 'biophysics/testBiophysics.cpp', - + 'builtins/Arith.cpp', 'builtins/Group.cpp', 'builtins/Mdouble.cpp', @@ -78,12 +79,12 @@ sources = [ 'builtins/HDF5WriterBase.cpp', 'builtins/HDF5DataWriter.cpp', 'builtins/testBuiltins.cpp', - + 'device/PulseGen.cpp', 'device/DiffAmp.cpp', 'device/PIDController.cpp', 'device/RC.cpp', - + 'geom/Geometry.cpp', 'geom/Surface.cpp', 'geom/Panel.cpp', @@ -94,7 +95,7 @@ sources = [ 'geom/RectPanel.cpp', 'geom/TriPanel.cpp', 'geom/testGeom.cpp', - + 'hsolve/HSolveStruct.cpp', 'hsolve/HinesMatrix.cpp', 'hsolve/HSolvePassive.cpp', @@ -108,7 +109,7 @@ sources = [ 'hsolve/ZombieCompartment.cpp', 'hsolve/ZombieCaConc.cpp', 'hsolve/ZombieHHChannel.cpp', - + 'kinetics/PoolBase.cpp', 'kinetics/Pool.cpp', 'kinetics/BufPool.cpp', @@ -123,7 +124,7 @@ sources = [ 'kinetics/SumFunc.cpp', 'kinetics/lookupSizeFromMesh.cpp', 'kinetics/testKinetics.cpp', - + 'ksolve/Port.cpp', 'ksolve/Stoich.cpp', 'ksolve/KinSparseMatrix.cpp', @@ -138,10 +139,10 @@ sources = [ 'ksolve/FuncTerm.cpp', 'ksolve/GssaStoich.cpp', 'ksolve/testKsolve.cpp', - + 'manager/SimManager.cpp', 'manager/testSimManager.cpp', - + 'mesh/ChemMesh.cpp', 'mesh/MeshEntry.cpp', 'mesh/CylMesh.cpp', @@ -149,7 +150,7 @@ sources = [ 'mesh/Boundary.cpp', 'mesh/Stencil.cpp', 'mesh/testMesh.cpp', - + 'msg/Msg.cpp', 'msg/DiagonalMsg.cpp', 'msg/OneToAllMsg.cpp', @@ -158,11 +159,11 @@ sources = [ 'msg/SparseMsg.cpp', 'msg/ReduceMsg.cpp', 'msg/testMsg.cpp', - + 'pymoose/moosemodule.cpp', - + 'randnum/mt19937ar.cpp', - + 'regressionTests/regressionTest.cpp', 'regressionTests/rtTable.cpp', 'regressionTests/rtReadKkit.cpp', @@ -170,12 +171,12 @@ sources = [ 'regressionTests/rtReacDiff.cpp', 'regressionTests/perfTestMarkovSolver.cpp', 'regressionTests/benchmarkTests.cpp', - + 'scheduling/Clock.cpp', 'scheduling/Tick.cpp', 'scheduling/TickMgr.cpp', 'scheduling/testScheduling.cpp', - + 'shell/Shell.cpp', 'shell/ShellCopy.cpp', 'shell/ShellSetGet.cpp', @@ -185,7 +186,7 @@ sources = [ 'shell/Neutral.cpp', 'shell/Wildcard.cpp', 'shell/testShell.cpp', - + #~ 'smol/SmolSim.cpp', #~ 'smol/SmolPool.cpp', #~ 'smol/SmolMol.cpp', @@ -193,7 +194,7 @@ sources = [ #~ 'smol/SmolEnz.cpp', #~ 'smol/SmolMMenz.cpp', #~ 'smol/testSmol.cpp', - + 'utility/strutil.cpp', 'utility/types.cpp', 'utility/setupenv.cpp', diff --git a/moose-core/shell/CMakeLists.txt b/moose-core/shell/CMakeLists.txt index 50bcc5d8404565a02cc26dc031aa84b4bbfb0e34..5d5c661ee7d9d7c2110c0926251a64b86f9a2ef9 100644 --- a/moose-core/shell/CMakeLists.txt +++ b/moose-core/shell/CMakeLists.txt @@ -4,13 +4,13 @@ if(LIBSBML_FOUND) add_definitions(-DUSE_SBML) endif() -add_library(shell - Shell.cpp - ShellCopy.cpp - ShellThreads.cpp - LoadModels.cpp - SaveModels.cpp - Neutral.cpp - Wildcard.cpp - testShell.cpp +add_library(shell + Shell.cpp + ShellCopy.cpp + ShellThreads.cpp + LoadModels.cpp + SaveModels.cpp + Neutral.cpp + Wildcard.cpp + testShell.cpp ) diff --git a/moose-core/shell/Neutral.cpp b/moose-core/shell/Neutral.cpp index d6fa80439c1623a48d9daf42714b435213d23734..9b5a2ecff69ed7fb315f9fd088654084555d142f 100644 --- a/moose-core/shell/Neutral.cpp +++ b/moose-core/shell/Neutral.cpp @@ -19,41 +19,41 @@ const Cinfo* Neutral::initCinfo() // Element Value Finfos ///////////////////////////////////////////////////////////////// - static ElementValueFinfo< Neutral, string > name( + static ElementValueFinfo< Neutral, string > name( "name", - "Name of object", - &Neutral::setName, + "Name of object", + &Neutral::setName, &Neutral::getName ); // Should be renamed to myId - static ReadOnlyElementValueFinfo< Neutral, ObjId > me( + static ReadOnlyElementValueFinfo< Neutral, ObjId > me( "me", - "ObjId for current object", + "ObjId for current object", &Neutral::getObjId ); - static ReadOnlyElementValueFinfo< Neutral, ObjId > parent( + static ReadOnlyElementValueFinfo< Neutral, ObjId > parent( "parent", - "Parent ObjId for current object", + "Parent ObjId for current object", &Neutral::getParent ); - static ReadOnlyElementValueFinfo< Neutral, vector< Id > > children( + static ReadOnlyElementValueFinfo< Neutral, vector< Id > > children( "children", - "vector of ObjIds listing all children of current object", + "vector of ObjIds listing all children of current object", &Neutral::getChildren ); - static ReadOnlyElementValueFinfo< Neutral, string > path( + static ReadOnlyElementValueFinfo< Neutral, string > path( "path", - "text path for object", + "text path for object", &Neutral::getPath ); /* */ - static ReadOnlyElementValueFinfo< Neutral, string > className( + static ReadOnlyElementValueFinfo< Neutral, string > className( "className", - "Class Name of object", + "Class Name of object", &Neutral::getClass ); - static ElementValueFinfo< Neutral, unsigned int > numData( + static ElementValueFinfo< Neutral, unsigned int > numData( "numData", "# of Data entries on Element." "Note that on a FieldElement this does NOT refer to field entries," @@ -62,7 +62,7 @@ const Cinfo* Neutral::initCinfo() &Neutral::setNumData, &Neutral::getNumData ); - static ElementValueFinfo< Neutral, unsigned int > numField( + static ElementValueFinfo< Neutral, unsigned int > numField( "numField", "For a FieldElement: number of entries of self." "For a regular Element: One.", @@ -74,20 +74,20 @@ const Cinfo* Neutral::initCinfo() "Object id of self, converted to an unsigned int.", &Neutral::getId ); - static ReadOnlyElementValueFinfo< Neutral, unsigned int > index( + static ReadOnlyElementValueFinfo< Neutral, unsigned int > index( "index", "For a FieldElement: Object index of parent." "For a regular Element: Object index (dataId) of self.", &Neutral::getIndex ); - static ReadOnlyElementValueFinfo< Neutral, unsigned int > fieldIndex( + static ReadOnlyElementValueFinfo< Neutral, unsigned int > fieldIndex( "fieldIndex", "For a FieldElement: field Index of self." "For a regular Element: zero.", &Neutral::getFieldIndex ); - static ElementValueFinfo< Neutral, int > - tick( + static ElementValueFinfo< Neutral, int > + tick( "tick", "Clock tick for this Element for periodic execution in the " "main simulation event loop. A default is normally assigned, " @@ -99,14 +99,14 @@ const Cinfo* Neutral::initCinfo() &Neutral::setTick, &Neutral::getTick ); - static ReadOnlyElementValueFinfo< Neutral, double > + static ReadOnlyElementValueFinfo< Neutral, double > dt( "dt", "Timestep used for this Element. Zero if not scheduled.", &Neutral::getDt ); - static ReadOnlyElementValueFinfo< Neutral, vector< string > > + static ReadOnlyElementValueFinfo< Neutral, vector< string > > valueFields( "valueFields", "List of all value fields on Element." @@ -117,7 +117,7 @@ const Cinfo* Neutral::initCinfo() &Neutral::getValueFields ); - static ReadOnlyElementValueFinfo< Neutral, vector< string > > + static ReadOnlyElementValueFinfo< Neutral, vector< string > > sourceFields( "sourceFields", "List of all source fields on Element, that is fields that " @@ -125,7 +125,7 @@ const Cinfo* Neutral::initCinfo() &Neutral::getSourceFields ); - static ReadOnlyElementValueFinfo< Neutral, vector< string > > + static ReadOnlyElementValueFinfo< Neutral, vector< string > > destFields( "destFields", "List of all destination fields on Element, that is, fields" @@ -133,36 +133,36 @@ const Cinfo* Neutral::initCinfo() &Neutral::getDestFields ); - static ReadOnlyElementValueFinfo< Neutral, vector< ObjId > > msgOut( + static ReadOnlyElementValueFinfo< Neutral, vector< ObjId > > msgOut( "msgOut", - "Messages going out from this Element", + "Messages going out from this Element", &Neutral::getOutgoingMsgs ); - static ReadOnlyElementValueFinfo< Neutral, vector< ObjId > > msgIn( + static ReadOnlyElementValueFinfo< Neutral, vector< ObjId > > msgIn( "msgIn", - "Messages coming in to this Element", + "Messages coming in to this Element", &Neutral::getIncomingMsgs ); - static ReadOnlyLookupElementValueFinfo< Neutral, string, vector< Id > > neighbors( + static ReadOnlyLookupElementValueFinfo< Neutral, string, vector< Id > > neighbors( "neighbors", - "Ids of Elements connected this Element on specified field.", + "Ids of Elements connected this Element on specified field.", &Neutral::getNeighbors ); - static ReadOnlyLookupElementValueFinfo< Neutral, string, vector< ObjId > > msgDests( + static ReadOnlyLookupElementValueFinfo< Neutral, string, vector< ObjId > > msgDests( "msgDests", - "ObjIds receiving messages from the specified SrcFinfo", + "ObjIds receiving messages from the specified SrcFinfo", &Neutral::getMsgDests ); - static ReadOnlyLookupElementValueFinfo< Neutral, string, vector< string > > msgDestFunctions( + static ReadOnlyLookupElementValueFinfo< Neutral, string, vector< string > > msgDestFunctions( "msgDestFunctions", "Matching function names for each ObjId receiving a msg from " - "the specified SrcFinfo", + "the specified SrcFinfo", &Neutral::getMsgDestFunctions ); - static ReadOnlyLookupElementValueFinfo< Neutral, string, bool >isA( + static ReadOnlyLookupElementValueFinfo< Neutral, string, bool >isA( "isA", "Returns true if the current object is derived from the specified " - "the specified class", + "the specified class", &Neutral::isA ); ///////////////////////////////////////////////////////////////// @@ -177,14 +177,14 @@ const Cinfo* Neutral::initCinfo() ///////////////////////////////////////////////////////////////// // SrcFinfos ///////////////////////////////////////////////////////////////// - static SrcFinfo1< int > childOut( "childOut", + static SrcFinfo1< int > childOut( "childOut", "Message to child Elements"); ///////////////////////////////////////////////////////////////// // DestFinfos ///////////////////////////////////////////////////////////////// - static DestFinfo parentMsg( "parentMsg", - "Message from Parent Element(s)", + static DestFinfo parentMsg( "parentMsg", + "Message from Parent Element(s)", new EpFunc1< Neutral, int >( &Neutral::destroy ) ); static DestFinfo blockNodeBalance( "blockNodeBalance", @@ -209,7 +209,7 @@ const Cinfo* Neutral::initCinfo() "Arguments are: myNode, nodeAssignment", new EpFunc2< Neutral, unsigned int, vector< unsigned int > >( &Neutral::generalNodeBalance ) ); - + ///////////////////////////////////////////////////////////////// // Setting up the Finfo list. ///////////////////////////////////////////////////////////////// @@ -294,12 +294,12 @@ Neutral Neutral::getThis() const void Neutral::setName( const Eref& e, string name ) { if ( e.id().value() <= 3 ) { - cout << "Warning: Neutral::setName on '" << e.id().path() << + cout << "Warning: Neutral::setName on '" << e.id().path() << "'. Cannot rename core objects\n"; return; } if ( !Shell::isNameValid( name ) ) { - cout << "Warning: Neutral::setName on '" << e.id().path() << + cout << "Warning: Neutral::setName on '" << e.id().path() << "'. Illegal character in name.\n"; return; } @@ -357,7 +357,7 @@ void Neutral::children( const Eref& e, vector< Id >& ret ) static const Finfo* cf = neutralCinfo->findFinfo( "childOut" ); static const SrcFinfo* cf2 = dynamic_cast< const SrcFinfo* >( cf ); static const BindIndex bi = cf2->getBindIndex(); - + const vector< MsgFuncBinding >* bvec = e.element()->getMsgAndFunc( bi ); for ( vector< MsgFuncBinding >::const_iterator i = bvec->begin(); @@ -447,7 +447,7 @@ void Neutral::setTick( const Eref& e, int num ) double Neutral::getDt( const Eref& e ) const { int tick = e.element()->getTick(); - if ( tick < 0 ) + if ( tick < 0 ) return 0.0; Id clockId( 1 ); return LookupField< unsigned int, double >::get( @@ -496,7 +496,7 @@ vector< ObjId > Neutral::getOutgoingMsgs( const Eref& e ) const unsigned int numBindIndex = e.element()->cinfo()->numBindIndex(); for ( unsigned int i = 0; i < numBindIndex; ++i ) { - const vector< MsgFuncBinding >* v = + const vector< MsgFuncBinding >* v = e.element()->getMsgAndFunc( i ); if ( v ) { for ( vector< MsgFuncBinding >::const_iterator mb = v->begin(); @@ -529,7 +529,7 @@ vector< Id > Neutral::getNeighbors( const Eref& e, string field ) const if ( finfo ) e.element()->getNeighbors( ret, finfo ); else - cout << "Warning: Neutral::getNeighbors: Id.Field '" << + cout << "Warning: Neutral::getNeighbors: Id.Field '" << e.id().path() << "." << field << "' not found\n"; return ret; @@ -546,7 +546,7 @@ vector< ObjId > Neutral::getMsgDests( const Eref& e, string field ) const tgt, func ); return tgt; } else { - cout << "Warning: Neutral::getMsgDests: Id.Field '" << + cout << "Warning: Neutral::getMsgDests: Id.Field '" << e.id().path() << "." << field << "' not found or not a SrcFinfo\n"; } @@ -566,7 +566,7 @@ vector< string > Neutral::getMsgDestFunctions( const Eref& e, string field ) con tgt, func ); return func; } else { - cout << "Warning: Neutral::getMsgDestFunctions: Id.Field '" << + cout << "Warning: Neutral::getMsgDestFunctions: Id.Field '" << e.id().path() << "." << field << "' not found or not a SrcFinfo\n"; } @@ -581,7 +581,7 @@ bool Neutral::isA( const Eref& e, string className ) const ////////////////////////////////////////////////////////////////////////// unsigned int Neutral::buildTree( const Eref& e, vector< Id >& tree ) - const + const { unsigned int ret = 1; Eref er( e.element(), ALLDATA ); @@ -601,7 +601,7 @@ unsigned int Neutral::buildTree( const Eref& e, vector< Id >& tree ) // Stage 0: Check if it is a Msg. This is deleted by Msg::deleteMsg( ObjId ) // Stage 1: mark for deletion. This is done by setting cinfo = 0 // Stage 2: Clear out outside-going msgs -// Stage 3: delete self and attached msgs, +// Stage 3: delete self and attached msgs, void Neutral::destroy( const Eref& e, int stage ) { if ( e.element()->cinfo()->isA( "Msg" ) ) { @@ -612,7 +612,7 @@ void Neutral::destroy( const Eref& e, int stage ) Eref er( e.element(), ALLDATA ); unsigned int numDescendants = buildTree( er, tree ); /* - cout << "Neutral::destroy: id = " << e.id() << + cout << "Neutral::destroy: id = " << e.id() << ", name = " << e.element()->getName() << ", numDescendants = " << numDescendants << endl; */ @@ -624,7 +624,7 @@ void Neutral::destroy( const Eref& e, int stage ) * Request conversion of data into a blockDataHandler subclass, * and to carry out node balancing of data as per args. */ -void Neutral::blockNodeBalance( const Eref& e, +void Neutral::blockNodeBalance( const Eref& e, unsigned int, unsigned int, unsigned int ) { } @@ -633,7 +633,7 @@ void Neutral::blockNodeBalance( const Eref& e, * Request conversion of data into a generalDataHandler subclass, * and to carry out node balancing of data as per args. */ -void Neutral::generalNodeBalance( const Eref& e, +void Neutral::generalNodeBalance( const Eref& e, unsigned int myNode, vector< unsigned int > nodeAssignment ) { } @@ -651,7 +651,7 @@ bool Neutral::isDescendant( Id me, Id ancestor ) static const FuncId pafid = pf2->getFid(); Eref e = me.eref(); - + while ( e.element()->id() != Id() && e.element()->id() != ancestor ) { ObjId mid = e.element()->findCaller( pafid ); assert( mid != ObjId() ); @@ -662,7 +662,7 @@ bool Neutral::isDescendant( Id me, Id ancestor ) } // static function -Id Neutral::child( const Eref& e, const string& name ) +Id Neutral::child( const Eref& e, const string& name ) { static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" ); static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf ); @@ -670,7 +670,7 @@ Id Neutral::child( const Eref& e, const string& name ) static const Finfo* cf = neutralCinfo->findFinfo( "childOut" ); static const SrcFinfo* cf2 = dynamic_cast< const SrcFinfo* >( cf ); static const BindIndex bi = cf2->getBindIndex(); - + const vector< MsgFuncBinding >* bvec = e.element()->getMsgAndFunc( bi ); vector< Id > ret; @@ -721,7 +721,7 @@ ObjId Neutral::parent( ObjId oid ) return pa; } -// Static function +// Static function string Neutral::path( const Eref& e ) { static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" ); diff --git a/moose-core/shell/Neutral.h b/moose-core/shell/Neutral.h index 1b28dd7f47f95e441c9487550ec5ab5362fe0afc..b5bf3e69ce9271d3eadb3f2ff90364d81bb1cfed 100644 --- a/moose-core/shell/Neutral.h +++ b/moose-core/shell/Neutral.h @@ -31,7 +31,7 @@ class Neutral ///////////////////////////////////////////////////////////////// /** - * Field access functions for the entire object. For Neutrals + * Field access functions for the entire object. For Neutrals * the setThis function is a dummy: it doesn't do anything because * the Neutral has no data to set. However, the function name acts * as a placeholder and derived objects can override the function @@ -41,7 +41,7 @@ class Neutral void setThis( Neutral v ); /** - * Field access functions for the entire object. For Neutrals + * Field access functions for the entire object. For Neutrals * the getThis function does return the Neutral object, but it * has no data to set. However, the function name acts * as a placeholder and derived objects can override the function @@ -86,7 +86,7 @@ class Neutral * of the specified SrcFinfo, by the current object. * Twin function to getMsgDests. */ - vector< string > getMsgDestFunctions( + vector< string > getMsgDestFunctions( const Eref& e, string src ) const; /** @@ -131,7 +131,7 @@ class Neutral unsigned int getNumData( const Eref& e ) const; /** - * numField is the size of the field array on the FieldElement + * numField is the size of the field array on the FieldElement * specified by the Eref including its data index. */ void setNumField( const Eref& e, unsigned int num ); @@ -146,7 +146,7 @@ class Neutral /** * The clock Tick specifies the timing and order of execution - * of the 'process' action of this object in the simulation. + * of the 'process' action of this object in the simulation. * The timing is set by assigning the appropriate dt to * this tick in the Clock object. * A value of -1 means that the object is disabled. @@ -177,7 +177,7 @@ class Neutral * Request conversion of data into a blockDataHandler subclass, * and to carry out node balancing of data as per args. */ - void blockNodeBalance( const Eref& e, + void blockNodeBalance( const Eref& e, unsigned int, unsigned int, unsigned int ); /** @@ -186,7 +186,7 @@ class Neutral */ void generalNodeBalance( const Eref& e, unsigned int myNode, vector< unsigned int > nodeAssignment ); - + //////////////////////////////////////////////////////////// // Static utility functions diff --git a/moose-core/shell/ShellCopy.cpp b/moose-core/shell/ShellCopy.cpp index c9644d987771fdd16686433280092cab0bad94b2..3788c474f436357a16d4640dadaf3bc2d2b9d8c8 100644 --- a/moose-core/shell/ShellCopy.cpp +++ b/moose-core/shell/ShellCopy.cpp @@ -13,7 +13,7 @@ #include "../scheduling/Clock.h" /// Returns the Id of the root of the copied tree upon success. -Id Shell::doCopy( Id orig, ObjId newParent, string newName, +Id Shell::doCopy( Id orig, ObjId newParent, string newName, unsigned int n, bool toGlobal, bool copyExtMsg ) { if ( newName.length() > 0 && !isNameValid( newName ) ) { @@ -26,13 +26,13 @@ Id Shell::doCopy( Id orig, ObjId newParent, string newName, return Id(); } if ( n < 1 ) { - cout << "Warning: Shell::doCopy( " << orig.path() << " to " << + cout << "Warning: Shell::doCopy( " << orig.path() << " to " << newParent.path() << " ) : numCopies must be > 0, using 1 \n"; return Id(); } if ( Neutral::child( newParent.eref(), newName ) != Id() ) { cout << "Error: Shell::doCopy: Cannot copy object '" << newName << - "' onto '" << newParent.path() << + "' onto '" << newParent.path() << "' since object with same name already present.\n"; return Id(); } @@ -59,12 +59,12 @@ Id Shell::doCopy( Id orig, ObjId newParent, string newName, * Note that 'n' is the number of complete duplicates. If there were * 10 dataEntries in the original, there will now be 10 x n. */ -Element* innerCopyElements( Id orig, ObjId newParent, Id newId, +Element* innerCopyElements( Id orig, ObjId newParent, Id newId, unsigned int n, bool toGlobal, map< Id, Id >& tree ) { // Element* e = new Element( newId, orig.element(), n, toGlobal ); unsigned int newNumData = orig.element()->numData() * n; - Element* e = orig.element()->copyElement( + Element* e = orig.element()->copyElement( newParent, newId, newNumData, toGlobal ); assert( e ); Shell::adopt( newParent, newId, 0 ); @@ -89,27 +89,27 @@ Element* innerCopyElements( Id orig, ObjId newParent, Id newId, void innerCopyMsgs( map< Id, Id >& tree, unsigned int n, bool copyExtMsgs ) { static const Finfo* cf = Neutral::initCinfo()->findFinfo( "childOut" ); - static const SrcFinfo1< int >* cf2 = + static const SrcFinfo1< int >* cf2 = dynamic_cast< const SrcFinfo1< int >* >( cf ); assert( cf ); assert( cf2 ); /* cout << endl << Shell::myNode() << ": innerCopyMsg "; - for ( map< Id, Id >::const_iterator i = tree.begin(); + for ( map< Id, Id >::const_iterator i = tree.begin(); i != tree.end(); ++i ) { cout << " (" << i->first << "," << i->second << ") "; } cout << endl; */ - for ( map< Id, Id >::const_iterator i = tree.begin(); + for ( map< Id, Id >::const_iterator i = tree.begin(); i != tree.end(); ++i ) { Element *e = i->first.element(); unsigned int j = 0; const vector< MsgFuncBinding >* b = e->getMsgAndFunc( j ); while ( b ) { if ( j != cf2->getBindIndex() ) { - for ( vector< MsgFuncBinding >::const_iterator k = + for ( vector< MsgFuncBinding >::const_iterator k = b->begin(); k != b->end(); ++k ) { ObjId mid = k->mid; @@ -131,7 +131,7 @@ void innerCopyMsgs( map< Id, Id >& tree, unsigned int n, bool copyExtMsgs ) assert( 0 ); } if ( tgt != tree.end() ) - m->copy( e->id(), i->second, tgt->second, + m->copy( e->id(), i->second, tgt->second, k->fid, j, n ); } } @@ -147,7 +147,7 @@ bool Shell::innerCopy( const vector< ObjId >& args, const string& newName, map< Id, Id > tree; // args are orig, newParent, newElm. assert( args.size() == 3 ); - Element* e = innerCopyElements( args[0], args[1], args[2], + Element* e = innerCopyElements( args[0], args[1], args[2], n, toGlobal, tree ); if ( !e ) { return 0; @@ -159,7 +159,7 @@ bool Shell::innerCopy( const vector< ObjId >& args, const string& newName, return 1; } -void Shell::handleCopy( const Eref& er, vector< ObjId > args, +void Shell::handleCopy( const Eref& er, vector< ObjId > args, string newName, unsigned int n, bool toGlobal, bool copyExtMsgs ) { if ( !innerCopy( args, newName, n, toGlobal, copyExtMsgs ) ) { @@ -167,9 +167,9 @@ void Shell::handleCopy( const Eref& er, vector< ObjId > args, newName << ", " << n << endl; } /* - static const Finfo* ackf = + static const Finfo* ackf = Shell::initCinfo()->findFinfo( "ack" ); - static const SrcFinfo2< unsigned int, unsigned int >* + static const SrcFinfo2< unsigned int, unsigned int >* ack = dynamic_cast< const SrcFinfo2< unsigned int, unsigned int >* >( ackf ); assert( ackf ); assert( ack ); diff --git a/moose-core/shell/ShellThreads.cpp b/moose-core/shell/ShellThreads.cpp index 20d4176e6ba9298500cc63fdff5f5fb2788b379e..76e3d0275a67cccbfd8e37a634b4abbca341c54a 100644 --- a/moose-core/shell/ShellThreads.cpp +++ b/moose-core/shell/ShellThreads.cpp @@ -30,7 +30,7 @@ void Shell::launchParser() Id shellId; Shell* s = reinterpret_cast< Shell* >( shellId.eref().data() ); bool quit = 0; - + cout << "moose : " << flush; while ( !quit ) { string temp; diff --git a/moose-core/shell/Wildcard.h b/moose-core/shell/Wildcard.h index 38d1f4ba9049ce4418b0b00fea97793e42aa928a..912b37086b5a1b0e6b61409c0fe38cbd97e37875 100644 --- a/moose-core/shell/Wildcard.h +++ b/moose-core/shell/Wildcard.h @@ -64,7 +64,7 @@ int wildcardFind(const string& n, vector<ObjId>& ret); * Recursive function to compare all descendants and cram matches into ret. * Returns number of matches. * Index is either ALLDATA == ~0U, or a specified number. - * insideBrace is a string that can be empty, or specify one of the + * insideBrace is a string that can be empty, or specify one of the * expressions: * [TYPE==<string>] * [TYPE=<string>] @@ -76,7 +76,7 @@ int wildcardFind(const string& n, vector<ObjId>& ret); * [ISA!=<string>] * [FIELD(<fieldName)=<string>] */ -int allChildren( ObjId start, unsigned int index, +int allChildren( ObjId start, unsigned int index, const string& insideBrace, vector< ObjId >& ret ); diff --git a/moose-core/shell/testShell.cpp b/moose-core/shell/testShell.cpp index 297b6473f05e1fb1f508c39f28ed3d67d5fca9e4..6a5e8d2a6afeae41b97eabb4a864a9a0d26d33c5 100644 --- a/moose-core/shell/testShell.cpp +++ b/moose-core/shell/testShell.cpp @@ -98,7 +98,7 @@ void testTreeTraversal() //////////////////////////////////////////////////////////////// // Checking for child Id lists //////////////////////////////////////////////////////////////// - vector< Id > kids = + vector< Id > kids = Field< vector< Id > >::get( ObjId( f1, 0 ), "children" ); assert( kids.size() == 1 ); assert( kids[0] == f2a ); @@ -119,7 +119,7 @@ void testTreeTraversal() assert( kids.size() == 2 ); assert( kids[0] == f3aa ); assert( kids[1] == f3ab ); - + kids = Field< vector< Id > >::get( ObjId( f2b, 0 ), "children" ); assert( kids.size() == 0 ); kids = Field< vector< Id > >::get( ObjId( f2b, 5 ), "children" ); @@ -216,7 +216,7 @@ void testTreeTraversal() assert( shell->doFind( "f3ba/../../" ) == ObjId( f1, 1 ) ); assert( shell->doFind( "../../f1/f2a[4]/f3ab" ) == f3ab ); // assert( shell->doFind( "../f2a[4]/f3ab" ) == f3ab ); - + cout << "." << flush; //////////////////////////////////////////////////////////////// // Checking getChild @@ -446,7 +446,7 @@ void testCopyFieldElement() Id origId = shell->doCreate( "SimpleSynHandler", Id(), "f1", size, MooseGlobal ); Id origSynId( origId.value() + 1 ); Id origChild = shell->doCreate( "Neutral", origId, "f2", size2, MooseGlobal ); - + Element* syn = origSynId.element(); assert( syn != 0 ); assert( syn->getName() == "synapse" ); @@ -463,7 +463,7 @@ void testCopyFieldElement() */ bool ret; for ( unsigned int i = 0; i < size; ++i ) { - ret = Field< unsigned int >::set( ObjId( origId, i ), + ret = Field< unsigned int >::set( ObjId( origId, i ), "numSynapse", i ); assert( ret ); } @@ -504,7 +504,7 @@ void testCopyFieldElement() Id copyChild = copyChildren[1]; Element* copySynElm = copySynId.element(); - + // Element should exist even if data doesn't assert ( copySynElm != 0 ); assert ( copySynElm->getName() == "synapse" ); @@ -512,7 +512,7 @@ void testCopyFieldElement() unsigned int numSyn = 0; for ( unsigned int i = 0; i < numCopy * size; ++i ) { // assert( copySynElm->numField( i ) == i % size ); - unsigned int nf = Field< unsigned int >::get( + unsigned int nf = Field< unsigned int >::get( ObjId( copySynId, i ), "numField" ); assert( nf == i % size ); numSyn += i % size; @@ -521,7 +521,7 @@ void testCopyFieldElement() assert ( copyChild.element() != 0 ); assert ( copyChild.element()->getName() == "f2" ); assert( copyChild.element()->numData() == numCopy * size2 ); - + for ( unsigned int i = 0; i < numCopy * size; ++i ) { unsigned int k = i % size; vector< double > delay; @@ -540,7 +540,7 @@ void testCopyFieldElement() assert( doubleEq( delay[j], 3.14 * j + k * k ) ); } } - + shell->doDelete( origId ); shell->doDelete( copyId ); cout << "." << flush; @@ -572,13 +572,13 @@ void testObjIdToAndFromPath() assert( doubleEq( wt, 1999.0 ) ); // char* origSynData = origSynId.element()->data( 7, 5 ); // assert( origSynData != 0 ); - Id level2 = shell->doCreate( "Neutral", + Id level2 = shell->doCreate( "Neutral", ObjId( level1, index1 ), "f2", s2 ); - Id level3 = shell->doCreate( "Neutral", + Id level3 = shell->doCreate( "Neutral", ObjId( level2, index2 ), "f3", s3 ); - Id level4 = shell->doCreate( "Neutral", + Id level4 = shell->doCreate( "Neutral", ObjId( level3, index3 ), "f4", s4 ); - Id level5 = shell->doCreate( "Neutral", + Id level5 = shell->doCreate( "Neutral", ObjId( level4, index4 ), "f5", s5 ); ObjId oi( level5, index5 ); @@ -679,17 +679,17 @@ void testShellParserStart() /* // No idea what FuncId to use here. Assume 0. FuncId f( 0 ); - SingleMsg m0( er0, ts ); + SingleMsg m0( er0, ts ); er0.element()->addMsgAndFunc( m0.mid(), f, 0 ); - SingleMsg m1( er1, ts ); + SingleMsg m1( er1, ts ); er1.element()->addMsgAndFunc( m1.mid(), f, 1 ); - SingleMsg m2( er2, ts ); + SingleMsg m2( er2, ts ); er2.element()->addMsgAndFunc( m2.mid(), f, 2 ); - SingleMsg m3( er3, ts ); + SingleMsg m3( er3, ts ); er3.element()->addMsgAndFunc( m3.mid(), f, 3 ); - SingleMsg m4( er4, ts ); + SingleMsg m4( er4, ts ); er4.element()->addMsgAndFunc( m4.mid(), f, 4 ); - SingleMsg m5( er5, ts ); + SingleMsg m5( er5, ts ); er5.element()->addMsgAndFunc( m5.mid(), f, 5 ); */ @@ -713,7 +713,7 @@ void testInterNodeOps() // redundant. if ( shell->myNode() == 0 ) { unsigned int size = 6139; child = shell->doCreate( "Neutral", Id(), "test", size ); - } + } // cout << shell->myNode() << ": testInterNodeOps: #entries = " << child()->dataHandler()->numData() << endl; shell->doDelete( child ); @@ -759,7 +759,7 @@ void testShellSetGet() cout << "." << flush; } -bool checkArg1( Id id, +bool checkArg1( Id id, double v0, double v1, double v2, double v3, double v4 ) { bool ret = 1; @@ -792,7 +792,7 @@ bool checkArg1( Id id, return ret; } -bool checkOutput( Id e, +bool checkOutput( Id e, double v0, double v1, double v2, double v3, double v4 ) { bool ret = true; @@ -869,27 +869,27 @@ void testShellAddMsg() // Set up messaging /////////////////////////////////////////////////////////// // Should give 04000 - ObjId m1 = shell->doAddMsg( "Single", + ObjId m1 = shell->doAddMsg( "Single", ObjId( a1, 3 ), "output", ObjId( a2, 1 ), "arg3" ); assert( m1 != ObjId() ); // Should give 33333 - ObjId m2 = shell->doAddMsg( "OneToAll", + ObjId m2 = shell->doAddMsg( "OneToAll", ObjId( b1, 2 ), "output", ObjId( b2, 0 ), "arg3" ); assert( m2 != ObjId() ); // Should give 12345 - ObjId m3 = shell->doAddMsg( "OneToOne", + ObjId m3 = shell->doAddMsg( "OneToOne", ObjId( c1, 0 ), "output", ObjId( c2, 0 ), "arg3" ); assert( m3 != ObjId() ); // Should give 01234 - ObjId m4 = shell->doAddMsg( "Diagonal", + ObjId m4 = shell->doAddMsg( "Diagonal", ObjId( d1, 0 ), "output", ObjId( d2, 0 ), "arg3" ); assert( m4 != ObjId() ); // Should give 54321 - ObjId m5 = shell->doAddMsg( "Sparse", + ObjId m5 = shell->doAddMsg( "Sparse", ObjId( e1, 0 ), "output", ObjId( e2, 0 ), "arg3" ); assert( m5 != ObjId() ); @@ -911,13 +911,13 @@ void testShellAddMsg() // Should give 15 15 15 15 15 for ( unsigned int i = 0; i < 5; ++i ) { - ObjId m6 = shell->doAddMsg( "OneToAll", + ObjId m6 = shell->doAddMsg( "OneToAll", ObjId( f1, i ), "output", ObjId( f2, i ), "arg3" ); assert( m6 != ObjId() ); } // Should give 14 13 12 11 10 - ObjId m7 = shell->doAddMsg( "Sparse", + ObjId m7 = shell->doAddMsg( "Sparse", ObjId( g1, 0 ), "output", ObjId( g2, 0 ), "arg3" ); assert( m7 != ObjId() ); for ( unsigned int i = 0; i < 5; ++i ) { @@ -952,7 +952,7 @@ void testShellAddMsg() /////////////////////////////////////////////////////////// // Set up initial conditions /////////////////////////////////////////////////////////// - + // shell->doReinit(); vector< double > init; // 12345 @@ -1031,7 +1031,7 @@ void testShellAddMsg() /////////////////////////////////////////////////////////// // Check output. /////////////////////////////////////////////////////////// - + ret = checkOutput( a1, 1, 2, 3, 4, 5 ); assert( ret ); ret = checkOutput( b1, 1, 2, 3, 4, 5 ); @@ -1131,27 +1131,27 @@ void testCopyMsgOps() // Set up messaging /////////////////////////////////////////////////////////// // Should give 04000 - ObjId m1 = shell->doAddMsg( "Single", + ObjId m1 = shell->doAddMsg( "Single", ObjId( a1, 3 ), "output", ObjId( a2, 1 ), "arg1" ); assert( m1 != ObjId() ); // Should give 33333 - ObjId m2 = shell->doAddMsg( "OneToAll", + ObjId m2 = shell->doAddMsg( "OneToAll", ObjId( b1, 2 ), "output", ObjId( b2, 0 ), "arg1" ); assert( m2 != ObjId() ); // Should give 12345 - ObjId m3 = shell->doAddMsg( "OneToOne", + ObjId m3 = shell->doAddMsg( "OneToOne", ObjId( c1, 0 ), "output", ObjId( c2, 0 ), "arg1" ); assert( m3 != ObjId() ); // Should give 01234 - ObjId m4 = shell->doAddMsg( "Diagonal", + ObjId m4 = shell->doAddMsg( "Diagonal", ObjId( d1, 0 ), "output", ObjId( d2, 0 ), "arg1" ); assert( m4 != ObjId() ); // Should give 54321 - ObjId m5 = shell->doAddMsg( "Sparse", + ObjId m5 = shell->doAddMsg( "Sparse", ObjId( e1, 0 ), "output", ObjId( e2, 0 ), "arg1" ); assert( m5 != ObjId() ); @@ -1220,7 +1220,7 @@ void testCopyMsgOps() /////////////////////////////////////////////////////////// // Check output. /////////////////////////////////////////////////////////// - + ret = checkOutput( kids[1], 0, 4, 0, 0, 0 ); assert( ret ); ret = checkOutput( kids[2], 1, 2, 3, 4, 5 ); @@ -1251,7 +1251,7 @@ void testShellParserQuit() cout << "." << flush; } -extern bool +extern bool extractIndex( const string& s, unsigned int& index ); void testExtractIndices() @@ -1354,12 +1354,12 @@ void testChopPath() assert( args[2] == "zod" ); assert( index.size() == 3 ); - + assert( index[0] == 1 ); assert( index[1] == 2 ); assert( index[2] == 3 ); - assert( Shell::chopPath( "/foo/bar[1]/zod[2]/zung[3]", + assert( Shell::chopPath( "/foo/bar[1]/zod[2]/zung[3]", args, index ) == 1 ); assert( args.size() == 4 ); assert( args[0] == "foo" ); @@ -1368,7 +1368,7 @@ void testChopPath() assert( args[3] == "zung" ); assert( index.size() == 4 ); - + assert( index[0] == 0 ); assert( index[1] == 1 ); assert( index[2] == 2 ); @@ -1445,7 +1445,7 @@ void testFindModelParent() assert( ok ); assert( parentId == foo2 ); assert( modelName == "bar" ); - + shell->doDelete( foo ); shell->doDelete( foo2 ); shell->doDelete( zod ); @@ -1468,7 +1468,7 @@ void testSyncSynapseSize() // Element should exist even if data doesn't assert ( syn != 0 ); - assert ( syn->getName() == "synapse" ); + assert ( syn->getName() == "synapse" ); assert( syn->numData() == size ); vector< unsigned int > ns( size, 0 ); @@ -1485,7 +1485,7 @@ void testSyncSynapseSize() assert( Field< unsigned int >::get( oi, "numField" ) == i ); // low-level access only works on single node. - if ( Shell::numNodes() == 1 ) + if ( Shell::numNodes() == 1 ) assert( oi.element()->numField( i ) == i ); for ( unsigned int j = 0; j < i; ++j ) { @@ -1509,7 +1509,7 @@ void testSyncSynapseSize() /** * Tests message inspection fields on Neutral. - * These include + * These include * msgOut: all outgoing Msgs, reported as ObjId of their managers * msgIn: all incoming Msgs, reported as ObjId of their managers * msgSrc: All source Ids of messages coming into specified field @@ -1543,27 +1543,27 @@ void testGetMsgs() // Set up messaging /////////////////////////////////////////////////////////// // Should give 04000 - ObjId m1 = shell->doAddMsg( "Single", + ObjId m1 = shell->doAddMsg( "Single", ObjId( a1, 3 ), "output", ObjId( a2, 1 ), "arg3" ); assert( m1 != ObjId() ); // Should give 33333 - ObjId m2 = shell->doAddMsg( "OneToAll", + ObjId m2 = shell->doAddMsg( "OneToAll", ObjId( a1, 2 ), "output", ObjId( b2, 0 ), "arg3" ); assert( m2 != ObjId() ); // Should give 12345 - ObjId m3 = shell->doAddMsg( "OneToOne", + ObjId m3 = shell->doAddMsg( "OneToOne", ObjId( a1, 0 ), "output", ObjId( c2, 0 ), "arg3" ); assert( m3 != ObjId() ); // Should give 01234 - ObjId m4 = shell->doAddMsg( "Diagonal", + ObjId m4 = shell->doAddMsg( "Diagonal", ObjId( a1, 0 ), "output", ObjId( d2, 0 ), "arg3" ); assert( m4 != ObjId() ); // Should give 54321 - ObjId m5 = shell->doAddMsg( "Sparse", + ObjId m5 = shell->doAddMsg( "Sparse", ObjId( a1, 0 ), "output", ObjId( e2, 0 ), "arg3" ); assert( m5 != ObjId() ); @@ -1573,7 +1573,7 @@ void testGetMsgs() // Nov 2013: Wait till the Msg ObjIds are set up. /* - vector< ObjId > msgMgrs = + vector< ObjId > msgMgrs = Field< vector< ObjId > >::get( a1, "msgOut" ); assert( msgMgrs.size() == 5 ); // 5 above. for ( unsigned int i = 0; i < 5; ++i ) @@ -1640,7 +1640,7 @@ void testGetMsgs() */ //////////////////////////////////////////////////////////////// - // Check that the MsgSrcs are OK. + // Check that the MsgSrcs are OK. //////////////////////////////////////////////////////////////// vector< Id > srcIds; srcIds = LookupField< string, vector< Id > >::get( a2, "neighbors", "arg3" ); @@ -1655,7 +1655,7 @@ void testGetMsgs() assert( srcIds.size() == 1 ); assert( srcIds[0] == a1 ); - ObjId m6 = shell->doAddMsg( "Single", + ObjId m6 = shell->doAddMsg( "Single", ObjId( b1, 3 ), "output", ObjId( b2, 1 ), "arg3" ); assert( m6 != ObjId() ); srcIds.resize( 0 ); @@ -1666,7 +1666,7 @@ void testGetMsgs() cout << "." << flush; //////////////////////////////////////////////////////////////// - // Check that the MsgDests are OK. + // Check that the MsgDests are OK. //////////////////////////////////////////////////////////////// vector< Id > destIds; destIds = LookupField< string, vector< Id > >::get( a1, "neighbors", "output" ); @@ -1705,7 +1705,7 @@ void testGetMsgSrcAndTarget() } // Defined in Element.cpp. -extern void filterOffNodeTargets( +extern void filterOffNodeTargets( unsigned int start, unsigned int end, bool isSrcGlobal, @@ -1741,7 +1741,7 @@ void testFilterOffNodeTargets() vector< vector< Eref > > erefs = origErefs; vector< vector< bool > > targetNodes = origTargetNodes; - filterOffNodeTargets( + filterOffNodeTargets( 0, numSrcData, false, myNode, erefs, targetNodes ); for ( unsigned int i = 0; i < numSrcData; ++i ) { @@ -1781,7 +1781,7 @@ void testFilterOffNodeTargets() unsigned int start = numPerSrcNode * myNode; unsigned int end = start + 1+ (numSrcData-1) % numPerSrcNode; - filterOffNodeTargets( + filterOffNodeTargets( start, end, false, myNode, erefs, targetNodes ); for ( unsigned int i = 0; i < numData; ++i ) { @@ -1825,7 +1825,7 @@ void testShell( ) ////// testShellParserQuit(); testGetMsgs(); // Tests getting Msg info from Neutral. testGetMsgSrcAndTarget(); - + // This is a multinode test, but only needs to run on master node. testFilterOffNodeTargets(); } diff --git a/moose-core/signeur/Adaptor.cpp b/moose-core/signeur/Adaptor.cpp index d1e2fa04618e3b9c4168dd38ee1f741d8ccfd048..91b2764ed7a1d042909e1ff9448cfd228a4c36cc 100644 --- a/moose-core/signeur/Adaptor.cpp +++ b/moose-core/signeur/Adaptor.cpp @@ -20,7 +20,7 @@ /////////////////////////////////////////////////////// static SrcFinfo1< double > *output() { - static SrcFinfo1< double > output( "output", + static SrcFinfo1< double > output( "output", "Sends the output value every timestep." ); return &output; @@ -29,7 +29,7 @@ static SrcFinfo1< double > *output() /* static SrcFinfo0 *requestInput() { - static SrcFinfo0 requestInput( "requestInput", + static SrcFinfo0 requestInput( "requestInput", "Sends out the request. Issued from the process call." ); return &requestInput; @@ -38,7 +38,7 @@ static SrcFinfo0 *requestInput() static SrcFinfo1< vector< double >* > *requestOut() { - static SrcFinfo1< vector< double >* > requestOut( "requestOut", + static SrcFinfo1< vector< double >* > requestOut( "requestOut", "Sends out a request to a field with a double or array of doubles. " "Issued from the process call." "Works for any number of targets." @@ -48,7 +48,7 @@ static SrcFinfo1< vector< double >* > *requestOut() /* static DestFinfo* handleInput() { - static DestFinfo handleInput( "handleInput", + static DestFinfo handleInput( "handleInput", "Handle the returned value, which is in a prepacked buffer.", new OpFunc1< Adaptor, PrepackedBuffer >( &Adaptor::handleBufInput ) ); @@ -61,25 +61,25 @@ const Cinfo* Adaptor::initCinfo() /////////////////////////////////////////////////////// // Field definitions /////////////////////////////////////////////////////// - static ValueFinfo< Adaptor, double > inputOffset( + static ValueFinfo< Adaptor, double > inputOffset( "inputOffset", "Offset to apply to input message, before scaling", &Adaptor::setInputOffset, &Adaptor::getInputOffset ); - static ValueFinfo< Adaptor, double > outputOffset( + static ValueFinfo< Adaptor, double > outputOffset( "outputOffset", "Offset to apply at output, after scaling", &Adaptor::setOutputOffset, &Adaptor::getOutputOffset ); - static ValueFinfo< Adaptor, double > scale( + static ValueFinfo< Adaptor, double > scale( "scale", "Scaling factor to apply to input", &Adaptor::setScale, &Adaptor::getScale ); - static ReadOnlyValueFinfo< Adaptor, double > outputValue( + static ReadOnlyValueFinfo< Adaptor, double > outputValue( "outputValue", "This is the linearly transformed output.", &Adaptor::getOutput @@ -88,15 +88,15 @@ const Cinfo* Adaptor::initCinfo() /////////////////////////////////////////////////////// // MsgDest definitions /////////////////////////////////////////////////////// - static DestFinfo input( + static DestFinfo input( "input", "Input message to the adaptor. If multiple inputs are " "received, the system averages the inputs.", new OpFunc1< Adaptor, double >( &Adaptor::input ) ); /* - new DestFinfo( "setup", - Ftype4< string, double, double, double >::global(), + new DestFinfo( "setup", + Ftype4< string, double, double, double >::global(), RFCAST( &Adaptor::setup ), "Sets up adaptor in placeholder mode." "This is done when the kinetic model is yet to be built, " @@ -107,7 +107,7 @@ const Cinfo* Adaptor::initCinfo() "Note that the direction of the adaptor operation is given " "by whether the channel/Ca is connected as input or output." ), - new DestFinfo( "build", Ftype0::global(), + new DestFinfo( "build", Ftype0::global(), RFCAST( &Adaptor::build ), "Completes connection to previously specified molecule " "on kinetic model." @@ -117,11 +117,11 @@ const Cinfo* Adaptor::initCinfo() /////////////////////////////////////////////////////// // Shared definitions /////////////////////////////////////////////////////// - static DestFinfo process( "process", + static DestFinfo process( "process", "Handles 'process' call", new ProcOpFunc< Adaptor>( &Adaptor::process ) ); - static DestFinfo reinit( "reinit", + static DestFinfo reinit( "reinit", "Handles 'reinit' call", new ProcOpFunc< Adaptor>( &Adaptor::reinit ) ); @@ -130,7 +130,7 @@ const Cinfo* Adaptor::initCinfo() { &process, &reinit }; - static SharedFinfo proc( "proc", + static SharedFinfo proc( "proc", "This is a shared message to receive Process message " "from the scheduler. ", processShared, sizeof( processShared ) / sizeof( Finfo* ) @@ -139,7 +139,7 @@ const Cinfo* Adaptor::initCinfo() ////////////////////////////////////////////////////////////////////// // Now set it all up. ////////////////////////////////////////////////////////////////////// - static Finfo* adaptorFinfos[] = + static Finfo* adaptorFinfos[] = { &inputOffset, // Value &outputOffset, // Value @@ -150,7 +150,7 @@ const Cinfo* Adaptor::initCinfo() requestOut(), // SrcFinfo &proc, // SharedFinfo }; - + static string doc[] = { "Name", "Adaptor", @@ -291,23 +291,23 @@ static const Cinfo* adaptorCinfo = Adaptor::initCinfo(); // Here we set up Adaptor class functions //////////////////////////////////////////////////////////////////// Adaptor::Adaptor() - : - output_( 0.0 ), - inputOffset_( 0.0 ), + : + output_( 0.0 ), + inputOffset_( 0.0 ), outputOffset_( 0.0 ), scale_( 1.0 ), molName_( "" ), - sum_( 0.0 ), + sum_( 0.0 ), counter_( 0 ), numRequestOut_( 0 ) -{ +{ ; } //////////////////////////////////////////////////////////////////// // Here we set up Adaptor value fields //////////////////////////////////////////////////////////////////// -void Adaptor::setInputOffset( double value ) +void Adaptor::setInputOffset( double value ) { inputOffset_ = value; } @@ -316,7 +316,7 @@ double Adaptor::getInputOffset() const return inputOffset_; } -void Adaptor::setOutputOffset( double value ) +void Adaptor::setOutputOffset( double value ) { outputOffset_ = value; } @@ -325,7 +325,7 @@ double Adaptor::getOutputOffset() const return outputOffset_; } -void Adaptor::setScale( double value ) +void Adaptor::setScale( double value ) { scale_ = value; } @@ -353,10 +353,10 @@ void Adaptor::input( double v ) // separated out to help with unit tests. void Adaptor::innerProcess() { - if ( counter_ == 0 ) { + if ( counter_ == 0 ) { output_ = outputOffset_; } else { - output_ = outputOffset_ + + output_ = outputOffset_ + scale_ * ( ( sum_ / counter_ ) - inputOffset_ ); } sum_ = 0.0; @@ -365,7 +365,7 @@ void Adaptor::innerProcess() void Adaptor::process( const Eref& e, ProcPtr p ) { - // static FuncId fid = handleInput()->getFid(); + // static FuncId fid = handleInput()->getFid(); if ( numRequestOut_ > 0 ) { vector< double > ret; requestOut()->send( e, &ret ); diff --git a/moose-core/signeur/Adaptor.h b/moose-core/signeur/Adaptor.h index 475d7dc8ac427e7f9d1591924ddec54000ca530b..53e0637b6f83b2c4cf376ba5c03461d2d46cfdec 100644 --- a/moose-core/signeur/Adaptor.h +++ b/moose-core/signeur/Adaptor.h @@ -20,24 +20,24 @@ * cases such as mechanical models. * * - * The API for interfacing between solution engines rests on + * The API for interfacing between solution engines rests on * the following capabilities of MOOSE. * 1. The object-oriented interface with classes mapped to biological * and modeling concepts such as electrical and chemical compartments, * ion channels and molecular pools. * 2. The invisible mapping of Solvers (Objects implementing numerical - * engines) to the object-oriented interface. Solvers work behind the + * engines) to the object-oriented interface. Solvers work behind the * scenes to update the objects. - * 3. The messaging interface which allows any visible field to be - * accessed and updated from any other object. + * 3. The messaging interface which allows any visible field to be + * accessed and updated from any other object. * 4. The clock-based scheduler which drives operations of any subset of * objects at any interval. For example, this permits the operations of - * field access and update to take place at quite different timescales + * field access and update to take place at quite different timescales * from the numerical engines. * 5. The implementation of Adaptor classes. These perform a linear * transformation:: * - * (y = scale * (x + inputOffset) + outputOffset ) + * (y = scale * (x + inputOffset) + outputOffset ) * * where y is output and x is the input. The input is the average of * any number of sources (through messages) and any number of timesteps. @@ -46,29 +46,29 @@ * It is worth adding that messages can transport arbitrary data structures, * so it would also be possible to devise a complicated opaque message * directly between solvers. The implementation of Adaptors working on - * visible fields does this much more transparently and gives the user + * visible fields does this much more transparently and gives the user * facile control over the scaling transformatoin. * * These adaptors are used especially in the rdesigneur framework of MOOSE, * which enables multiscale reaction-diffusion and electrical signaling * models. - * As an example of this API in operation, I consider two mappings: + * As an example of this API in operation, I consider two mappings: * 1. Calcium mapped from electrical to chemical computations. * 2. phosphorylation state of a channel mapped to the channel conductance. * * 1. Calcium mapping. * Problem statement. * Calcium is computed in the electrical solver as one or more pools that - * are fed by calcium currents, and is removed by an exponential - * decay process. This calcium pool is non-diffusive in the current + * are fed by calcium currents, and is removed by an exponential + * decay process. This calcium pool is non-diffusive in the current * electrical solver. It has to be mapped to chemical calcium pools at a * different spatial discretization, which do diffuse. * In terms of the list of capabilities described above, this is how the * API works. * 1. The electrical model is partitioned into a number of electrical * compartments, some of which have the 'electrical' calcium pool - * as child object in a UNIX filesystem-like tree. Thus the - * 'electrical' calcium is represented as an object with + * as child object in a UNIX filesystem-like tree. Thus the + * 'electrical' calcium is represented as an object with * concentration, location and so on. * 2. The Solver computes the time-course of evolution of the calcium * concentration. Whenever any function queries the 'concentration' @@ -82,8 +82,8 @@ * ticking away, but it also can drive the operations of the adaptor. * Thus the rate of updates to and from the adaptor can be controlled. * 5. The adaptor averages its inputs. Say the electrical solver is - * going at a timestep of 50 usec, and the chemical solver at 5000 - * usec. The adaptor will take 100 samples of the electrical + * going at a timestep of 50 usec, and the chemical solver at 5000 + * usec. The adaptor will take 100 samples of the electrical * concentration, and average them to compute the 'input' to the * linear scaling. Suppose that the electrical model has calcium units * of micromolar, but has a zero baseline. The chemical model has @@ -93,10 +93,10 @@ * its output to the chemical solver. Here we have similar situation * to item (1), where the chemical entities are calcium pools in * space, each with their own calcium concentration. - * The messaging (3) determines another aspect of the mapping here: - * the fan in or fan out. In this case, a single electrical + * The messaging (3) determines another aspect of the mapping here: + * the fan in or fan out. In this case, a single electrical * compartment may house 10 chemical compartments. Then the output - * message from the adaptor goes to update the calcium pool + * message from the adaptor goes to update the calcium pool * concentration on the appropriate 10 objects representing calcium * in each of the compartments. * @@ -120,11 +120,11 @@ * 5. The adaptor averages the spatially distributed inputs from calcium, * and now does a different linear transform. In this case it converts * chemical concentration into the channel conductance. As before, - * the 'electrical' channel is an object (point 1) with a field for - * conductance, and this term is mapped into the internal data + * the 'electrical' channel is an object (point 1) with a field for + * conductance, and this term is mapped into the internal data * structures of the solver (point 2) invisibly to the user. * - * + * * */ class Adaptor @@ -152,8 +152,8 @@ class Adaptor void process( const Eref& e, ProcPtr p ); void reinit( const Eref& e, ProcPtr p ); /* - static void setup( const Eref& e, const Qinfo* q, - string molName, double scale, + static void setup( const Eref& e, const Qinfo* q, + string molName, double scale, double inputOffset, double outputOffset ); static void build( const Eref& e, const Qinfo* q); */ @@ -171,7 +171,7 @@ class Adaptor unsigned int counter_; /// Counts number of inputs received. /// Counts number of targets of requestField message - unsigned int numRequestOut_; + unsigned int numRequestOut_; }; #endif // _Adaptor_h diff --git a/moose-core/signeur/testSigNeur.cpp b/moose-core/signeur/testSigNeur.cpp index c94228cccc6da3d71eec3231de1016f65258f63b..9ea85ed4e250cf736a0e2fd425383911385c4fdf 100644 --- a/moose-core/signeur/testSigNeur.cpp +++ b/moose-core/signeur/testSigNeur.cpp @@ -43,16 +43,16 @@ void testAdaptorRequestField() Id onepool = shell->doCreate( "Pool", model, "onepool", 1 ); Id twopool = shell->doCreate( "Pool", model, "twopool", 2 ); Id tenpool = shell->doCreate( "Pool", model, "tenpool", 10 ); - ObjId mid = shell->doAddMsg( "Single", adaptor, "requestOut", + ObjId mid = shell->doAddMsg( "Single", adaptor, "requestOut", onepool, "getNInit" ); assert( !mid.bad() ); - mid = shell->doAddMsg( "Single", adaptor, "requestOut", + mid = shell->doAddMsg( "Single", adaptor, "requestOut", ObjId( twopool, 0 ), "getNInit" ); assert( !mid.bad() ); - mid = shell->doAddMsg( "Single", adaptor, "requestOut", + mid = shell->doAddMsg( "Single", adaptor, "requestOut", ObjId( twopool, 1 ), "getNInit" ); assert( !mid.bad() ); - mid = shell->doAddMsg( "OneToAll", adaptor, "requestOut", + mid = shell->doAddMsg( "OneToAll", adaptor, "requestOut", tenpool, "getNInit" ); assert( !mid.bad() ); Field< double >::set( onepool, "nInit", 1.0 ); @@ -91,9 +91,9 @@ void testAdaptorRequestField() // Ca pool in spine head fed by GluR. // Chem: // PSD: GluR pool. -// Head: Ca pool. GluR pool. 'Enz' to take to PSD. +// Head: Ca pool. GluR pool. 'Enz' to take to PSD. // Reac balances with PSD. -// Dend: Ca pool binds to 'kinase'. Kinase phosph K chan. +// Dend: Ca pool binds to 'kinase'. Kinase phosph K chan. // Dephosph by reac. // Ca is pumped out into a buffered non-reactive pool // @@ -111,7 +111,7 @@ void testAdaptorRequestField() // Defined in testBiophysics.cpp extern Id makeSquid(); // Defined in testMesh.cpp -extern Id makeSpine( Id compt, Id cell, unsigned int index, double frac, +extern Id makeSpine( Id compt, Id cell, unsigned int index, double frac, double len, double dia, double theta ); Id makeSpineWithReceptor( Id compt, Id cell, unsigned int index, double frac ) @@ -119,7 +119,7 @@ Id makeSpineWithReceptor( Id compt, Id cell, unsigned int index, double frac ) Shell* shell = reinterpret_cast< Shell* >( ObjId( Id(), 0 ).data() ); double spineLength = 5.0e-6; double spineDia = 4.0e-6; - Id spineCompt = makeSpine( compt, cell, index, frac, + Id spineCompt = makeSpine( compt, cell, index, frac, spineLength, spineDia, 0.0 ); Id gluR = shell->doCreate( "SynChan", spineCompt, "gluR", 1 ); @@ -135,7 +135,7 @@ Id makeSpineWithReceptor( Id compt, Id cell, unsigned int index, double frac ) Id caPool = shell->doCreate( "CaConc", spineCompt, "ca", 1 ); Field< double >::set( caPool, "CaBasal", 1e-4 ); // millimolar Field< double >::set( caPool, "tau", 0.01 ); // seconds - double B = 1.0 / ( + double B = 1.0 / ( FaradayConst * spineLength * spineDia * spineDia * 0.25 * PI ); B = B / 20.0; Field< double >::set( caPool, "B", B ); // Convert from current to conc @@ -316,12 +316,12 @@ void buildSigNeurChem( Id nid, Id neuroMesh, Id spineMesh, Id psdMesh ) Id dendTurnOnKinase = shell->doCreate( "Reac", neuroMesh, "turnOnKinase", 1); - mid = shell->doAddMsg( + mid = shell->doAddMsg( "OneToOne", dendTurnOnKinase, "sub", dendCa, "reac" ); - mid = shell->doAddMsg( + mid = shell->doAddMsg( "OneToOne", dendTurnOnKinase, "sub", dendKinaseInact, "reac" ); assert( ! mid.bad() ); - mid = shell->doAddMsg( + mid = shell->doAddMsg( "OneToOne", dendTurnOnKinase, "prd", dendKinase, "reac" ); assert( ! mid.bad() ); Field< double >::set( dendTurnOnKinase, "Kf", 0.5e3 ); @@ -412,10 +412,10 @@ void makeChemInNeuroMesh() const unsigned int numComptsInDend = 100; const unsigned int numSpines = 5; unsigned int size; - + // 25 Apr 2013: this doesn't work, though it should. Need to clean up. //size = psdMeshEntries.element()->dataHandler()->totalEntries(); - + Id psdMeshEntries( "/n/psdMesh/mesh" ); size = Id( "/n/spineMesh/mesh" ).element()->numData(); assert( size == numSpines ); @@ -460,7 +460,7 @@ void makeChemInNeuroMesh() Shell* shell = reinterpret_cast< Shell* >( ObjId( Id(), 0 ).data() ); shell->doDelete( nid ); cout << "." << flush; -} +} Id makeChemInCubeMesh() { @@ -468,8 +468,8 @@ Id makeChemInCubeMesh() vector< int > dims( 1, 1 ); double dendSide = 10.8e-6; // Matches vol cylinder of 100x4 microns. double spineSide = 6.8e-6; // Matches vol of 5 spines of 5x4 microns. - double psdSide = 8.565e-7; // Matches 'vol' of 5 psds of 4 microns - // diameter. Assume thickness of 0.01 micron, since area not + double psdSide = 8.565e-7; // Matches 'vol' of 5 psds of 4 microns + // diameter. Assume thickness of 0.01 micron, since area not // comparable otherwise. Id nid( "/n" ); @@ -510,7 +510,7 @@ Id makeChemInCubeMesh() // Check that stuff has been built /////////////////////////////////////////////////////////////////// unsigned int size; - + Id psdMeshEntries( "/n/psdMesh/mesh" ); size = Id( "/n/spineMesh/mesh" ).element()->numData(); assert( size == 1 ); @@ -602,7 +602,7 @@ void testChemInCubeMesh() vector< Id > ids; simpleWildcardFind( "/n/##[ISA=PoolBase]", ids ); for( vector< Id >::iterator i = ids.begin(); i != ids.end(); ++i ) { - cout << i->path() << + cout << i->path() << " : concInit = " << Field< double >::get( *i, "concInit" ) << "; nInit = " << Field< double >::get( *i, "nInit" ) << "; volume = " << Field< double >::get( *i, "volume" ) @@ -611,7 +611,7 @@ void testChemInCubeMesh() ids.clear(); simpleWildcardFind( "/n/##[ISA=ReacBase]", ids ); for( vector< Id >::iterator i = ids.begin(); i != ids.end(); ++i ) { - cout << i->element()->getName() << + cout << i->element()->getName() << ": Kf = " << Field< double >::get( *i, "Kf" ) << "; Kb = " << Field< double >::get( *i, "Kb" ) << ": kf = " << Field< double >::get( *i, "kf" ) << @@ -621,7 +621,7 @@ void testChemInCubeMesh() ids.clear(); simpleWildcardFind( "/n/##[ISA=EnzBase]", ids ); for( vector< Id >::iterator i = ids.begin(); i != ids.end(); ++i ) { - cout << i->path() << + cout << i->path() << ": Km = " << Field< double >::get( *i, "Km" ) << "; kcat = " << Field< double >::get( *i, "kcat" ) << "; k1 = " << Field< double >::get( *i, "k1" ) << @@ -635,26 +635,26 @@ void testChemInCubeMesh() // Run it ///////////////////////////////////////////////////////////////////// Id tab = shell->doCreate( "Table", nid, "tab", dims.size() ); - ObjId mid = shell->doAddMsg( "Single", tab, "requestData", + ObjId mid = shell->doAddMsg( "Single", tab, "requestData", Id( "/n/psdMesh/psdGluR" ), "get_n" ); assert( ! mid.bad() ); Id tabCa = shell->doCreate( "Table", nid, "tabCa", dims.size() ); - mid = shell->doAddMsg( "Single", tabCa, "requestData", + mid = shell->doAddMsg( "Single", tabCa, "requestData", Id( "/n/spineMesh/Ca" ), "get_conc" ); assert( ! mid.bad() ); Id tab2 = shell->doCreate( "Table", nid, "tab2", dims.size() ); - mid = shell->doAddMsg( "Single", tab2, "requestData", + mid = shell->doAddMsg( "Single", tab2, "requestData", Id( "/n/neuroMesh/kChan_p" ), "get_conc" ); assert( ! mid.bad() ); Id tab4 = shell->doCreate( "Table", nid, "tab4", dims.size() ); - mid = shell->doAddMsg( "Single", tab4, "requestData", + mid = shell->doAddMsg( "Single", tab4, "requestData", Id( "/n/neuroMesh/Ca.kinase" ), "get_conc" ); assert( ! mid.bad() ); Id tab3 = shell->doCreate( "Table", nid, "tab3", dims.size() ); - mid = shell->doAddMsg( "Single", tab3, "requestData", + mid = shell->doAddMsg( "Single", tab3, "requestData", Id( "/n/spineMesh/toPsd" ), "get_conc" ); assert( ! mid.bad() ); @@ -682,7 +682,7 @@ void testChemInCubeMesh() ////////////////////////////////////////////////////////////////////// // Build a solver, reset and run ////////////////////////////////////////////////////////////////////// - + Id solver = shell->doCreate( "GslStoich", nid, "solver", dims.size() ); assert( solver != Id() ); Field< string >::set( solver, "path", "/n/##" ); @@ -722,7 +722,7 @@ void testSigNeurElec() double Em = Field< double >::get( *i, "Em" ); double Cm = Field< double >::get( *i, "Cm" ); string name = i->element()->getName(); - cout << name << ": Ra = " << Ra << ", Rm = " << Rm << + cout << name << ": Ra = " << Ra << ", Rm = " << Rm << ", Cm = " << Cm << ", Em = " << Em << endl; } */ @@ -788,7 +788,7 @@ void testSigNeurElec() cout << "." << flush; } -Id addPlot( const string& objPath, const string& field, +Id addPlot( const string& objPath, const string& field, const string& plotname ) { Shell* shell = reinterpret_cast< Shell* >( ObjId( Id(), 0 ).data() ); @@ -852,36 +852,36 @@ Id buildAdaptorsInCubeMesh( vector< Id >& plots ) // Adaptors /////////////////////////////////////////////////////////////////// Id adaptCa = shell->doCreate( "Adaptor", nid, "adaptCa", dims.size() ); - mid = shell->doAddMsg( "OneToAll", + mid = shell->doAddMsg( "OneToAll", elecCa, "concOut", adaptCa, "input" ); assert( ! mid.bad() ); /* - mid = shell->doAddMsg( "OneToAll", + mid = shell->doAddMsg( "OneToAll", adaptCa, "requestOut", elecCa, "get_Ca" ); assert( ! mid.bad() ); */ - mid = shell->doAddMsg( "OneToAll", + mid = shell->doAddMsg( "OneToAll", adaptCa, "output", chemCa, "set_conc" ); assert( ! mid.bad() ); Field< double >::set( adaptCa, "outputOffset", 0.0001 ); // 100 nM Field< double >::set( adaptCa, "scale", 0.05 ); // .06 to .003 mM Id adaptGluR = shell->doCreate( "Adaptor", nid, "adaptGluR", dims.size() ); - mid = shell->doAddMsg( "OneToAll", + mid = shell->doAddMsg( "OneToAll", adaptGluR, "requestOut", chemGluR, "get_n" ); assert( ! mid.bad() ); - mid = shell->doAddMsg( "OneToAll", + mid = shell->doAddMsg( "OneToAll", adaptGluR, "output", elecGluR, "set_Gbar" ); assert( ! mid.bad() ); - // max n = 100, max Gar = + // max n = 100, max Gar = Field< double >::set( adaptGluR, "scale", 1e-4/100 ); // from n to pS Id adaptK = shell->doCreate( "Adaptor", nid, "adaptK", dims.size() ); - mid = shell->doAddMsg( "OneToAll", + mid = shell->doAddMsg( "OneToAll", adaptK, "requestOut", chemK, "get_conc" ); assert( ! mid.bad() ); - mid = shell->doAddMsg( "OneToAll", + mid = shell->doAddMsg( "OneToAll", adaptK, "output", elecK, "set_Gbar" ); assert( ! mid.bad() ); Field< double >::set( adaptK, "scale", 0.3 ); // from mM to Siemens @@ -1001,11 +1001,11 @@ void testSigNeur() void testSigNeurProcess() { testAdaptorRequestField(); - // After 2 June 2013, checkin 4579, the tests in + // After 2 June 2013, checkin 4579, the tests in // testSigNeurElec - // testChemInCubeMesh + // testChemInCubeMesh // testAdaptorsInCubeMesh() // Does a chem+elec model with adaptors - // have been moved to a + // have been moved to a // separate Python snippet called testSigNeur.py. These tests take // too long to run in unit tests and anyway it does not test as much // as generate an output that I can compare with the expected one. diff --git a/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.cpp b/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.cpp index 29e340a57a2e5267c2e49f25842fd7c552f43efe..6734a574b696f169131f02acab90247a8788db69 100644 --- a/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.cpp +++ b/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.cpp @@ -17,11 +17,11 @@ const Cinfo* GraupnerBrunel2012CaPlasticitySynHandler::initCinfo() { - static string doc[] = + static string doc[] = { "Name", "GraupnerBrunel2012CaPlasticitySynHandler", "Author", "Aditya Gilra", - "Description", + "Description", "The GraupnerBrunel2012CaPlasticitySynHandler handles synapses" "with Ca-based plasticity as per Higgins et al. 2014 and Graupner and Brunel 2012." "Note 1:" @@ -47,7 +47,7 @@ const Cinfo* GraupnerBrunel2012CaPlasticitySynHandler::initCinfo() }; static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > Ca( - "Ca", + "Ca", "Ca is a post-synaptic decaying variable as a proxy for Ca concentration" "and receives an impulse whenever a pre- or post- spike occurs." "Caution: Ca is updated via an event-based rule, so it is only updated and valid" @@ -59,42 +59,42 @@ const Cinfo* GraupnerBrunel2012CaPlasticitySynHandler::initCinfo() ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > CaInit( - "CaInit", + "CaInit", "CaInit is the initial value for Ca", &GraupnerBrunel2012CaPlasticitySynHandler::setCaInit, &GraupnerBrunel2012CaPlasticitySynHandler::getCaInit ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > tauCa( - "tauCa", + "tauCa", "tauCa is the time constant for decay of Ca", &GraupnerBrunel2012CaPlasticitySynHandler::setTauCa, &GraupnerBrunel2012CaPlasticitySynHandler::getTauCa ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > tauSyn( - "tauSyn", + "tauSyn", "tauSyn is the time constant for synaptic weight evolution equation", &GraupnerBrunel2012CaPlasticitySynHandler::setTauSyn, &GraupnerBrunel2012CaPlasticitySynHandler::getTauSyn ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > CaPre( - "CaPre", + "CaPre", "CaPre is added to Ca on every pre-spike", &GraupnerBrunel2012CaPlasticitySynHandler::setCaPre, &GraupnerBrunel2012CaPlasticitySynHandler::getCaPre ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > CaPost( - "CaPost", + "CaPost", "CaPost is added to Ca on every post-spike", &GraupnerBrunel2012CaPlasticitySynHandler::setCaPost, &GraupnerBrunel2012CaPlasticitySynHandler::getCaPost ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > delayD( - "delayD", + "delayD", "Time delay D after pre-spike, when Ca is increased by Capre." " delayD represents NMDA rise time.", &GraupnerBrunel2012CaPlasticitySynHandler::setDelayD, @@ -102,21 +102,21 @@ const Cinfo* GraupnerBrunel2012CaPlasticitySynHandler::initCinfo() ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > gammaP( - "gammaP", + "gammaP", "gammaP is the potentiation factor for synaptic weight increase if Ca>thetaP", &GraupnerBrunel2012CaPlasticitySynHandler::setGammaP, &GraupnerBrunel2012CaPlasticitySynHandler::getGammaP ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > gammaD( - "gammaD", + "gammaD", "gammaD is the depression factor for synaptic weight decrease if Ca>thetaD", &GraupnerBrunel2012CaPlasticitySynHandler::setGammaD, &GraupnerBrunel2012CaPlasticitySynHandler::getGammaD ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > thetaP( - "thetaP", + "thetaP", "Potentiation threshold for Ca" "User must ensure thetaP>thetaD, else simulation results will be wrong.", &GraupnerBrunel2012CaPlasticitySynHandler::setThetaP, @@ -124,7 +124,7 @@ const Cinfo* GraupnerBrunel2012CaPlasticitySynHandler::initCinfo() ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > thetaD( - "thetaD", + "thetaD", "Depression threshold for Ca" "User must ensure thetaP>thetaD, else simulation results will be wrong.", &GraupnerBrunel2012CaPlasticitySynHandler::setThetaD, @@ -132,7 +132,7 @@ const Cinfo* GraupnerBrunel2012CaPlasticitySynHandler::initCinfo() ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, bool > bistable( - "bistable", + "bistable", "If true, the synapse is bistable as in GraupnerBrunel2012 paper." "The effect of potential on the weight update is usually ignorable" " if Ca is above thetaP and thetaD most of the time.", @@ -141,35 +141,35 @@ const Cinfo* GraupnerBrunel2012CaPlasticitySynHandler::initCinfo() ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, bool > noisy( - "noisy", + "noisy", "If true, turn noise on as per noiseSD", &GraupnerBrunel2012CaPlasticitySynHandler::setNoisy, &GraupnerBrunel2012CaPlasticitySynHandler::getNoisy ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > noiseSD( - "noiseSD", + "noiseSD", "Standard deviation of noise added to Ca", &GraupnerBrunel2012CaPlasticitySynHandler::setNoiseSD, &GraupnerBrunel2012CaPlasticitySynHandler::getNoiseSD ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > weightMax( - "weightMax", + "weightMax", "An upper bound on the weight", &GraupnerBrunel2012CaPlasticitySynHandler::setWeightMax, &GraupnerBrunel2012CaPlasticitySynHandler::getWeightMax ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > weightMin( - "weightMin", + "weightMin", "A lower bound on the weight", &GraupnerBrunel2012CaPlasticitySynHandler::setWeightMin, &GraupnerBrunel2012CaPlasticitySynHandler::getWeightMin ); static ValueFinfo< GraupnerBrunel2012CaPlasticitySynHandler, double > weightScale( - "weightScale", + "weightScale", "Scale all pre-synaptic weights by weightScale before adding to activation (default 1.0)" "In the terminology of the paper Higgins et al 2012, weight is synaptic efficacy," "while weightScale*weight is what finally is added to activation variable.", @@ -182,7 +182,7 @@ const Cinfo* GraupnerBrunel2012CaPlasticitySynHandler::initCinfo() new EpFunc1< GraupnerBrunel2012CaPlasticitySynHandler, \ double >( &GraupnerBrunel2012CaPlasticitySynHandler::addPostSpike ) ); - static FieldElementFinfo< SynHandlerBase, Synapse > synFinfo( + static FieldElementFinfo< SynHandlerBase, Synapse > synFinfo( "synapse", "Sets up field Elements for synapse", Synapse::initCinfo(), @@ -231,7 +231,7 @@ static const Cinfo* GraupnerBrunel2012CaPlasticitySynHandlerCinfo =\ GraupnerBrunel2012CaPlasticitySynHandler::initCinfo(); GraupnerBrunel2012CaPlasticitySynHandler::GraupnerBrunel2012CaPlasticitySynHandler() -{ +{ Ca_ = 0.0; CaInit_ = 0.0; tauCa_ = 1.0; @@ -259,7 +259,7 @@ GraupnerBrunel2012CaPlasticitySynHandler& GraupnerBrunel2012CaPlasticitySynHandl ( const GraupnerBrunel2012CaPlasticitySynHandler& ssh) { synapses_ = ssh.synapses_; - for ( vector< Synapse >::iterator + for ( vector< Synapse >::iterator i = synapses_.begin(); i != synapses_.end(); ++i ) i->setHandler( this ); @@ -297,7 +297,7 @@ Synapse* GraupnerBrunel2012CaPlasticitySynHandler::vGetSynapse( unsigned int i ) return &dummy; } -void GraupnerBrunel2012CaPlasticitySynHandler::addSpike( +void GraupnerBrunel2012CaPlasticitySynHandler::addSpike( unsigned int index, double time, double weight ) { assert( index < synapses_.size() ); @@ -318,38 +318,38 @@ weightFactors GraupnerBrunel2012CaPlasticitySynHandler::updateCaWeightFactors( d Ca_ *= exp(-deltaT/tauCa_); lastCaUpdateTime_ = currTime; weightFactors wUp; // by default all are set to 0.0 - + // calculate/approximate time spent above potentiation and depression thresholds // see pg 13 of Higgins et al | October 2014 | Volume 10 | Issue 10 | e1003834 | PLOS Comp Biol // starting from bottom condition, going upwards in the algorithm given in above paper if (CaOld <= thetaD_) { } else if (CaOld <= thetaP_) { - //cout << "tD<Caold<tP" << "\n"; + //cout << "tD<Caold<tP" << "\n"; if (Ca_ <= thetaD_) { wUp.tD = tauCa_*log(CaOld/thetaD_); - //cout << "Ca<tD" << "\n"; + //cout << "Ca<tD" << "\n"; } else { wUp.tD = deltaT; - //cout << "Ca>tD" << "\n"; + //cout << "Ca>tD" << "\n"; } } else { - //cout << "Caold>tP" << "\n"; + //cout << "Caold>tP" << "\n"; if (Ca_ <= thetaD_) { wUp.tP = tauCa_*log(CaOld/thetaP_); wUp.tD = tauCa_*log(thetaP_/thetaD_); - //cout << "Ca<tD" << "\n"; - //cout << "Caold = " << CaOld << "thetaP = " << thetaP_ << "\n"; + //cout << "Ca<tD" << "\n"; + //cout << "Caold = " << CaOld << "thetaP = " << thetaP_ << "\n"; } else if (Ca_ <= thetaP_) { wUp.tP = tauCa_*log(CaOld/thetaP_); wUp.tD = deltaT - wUp.tP; - //cout << "Ca<tP" << "\n"; + //cout << "Ca<tP" << "\n"; } else { wUp.tP = deltaT; //cout << "Ca>tP" << "\n"; } } wUp.t0 = deltaT - wUp.tP - wUp.tD; - + // Depending on tP and tD, I return A,B,C factors for weight update // (see page 13 of Higgins et al 2014). // A,B,C,D,E are used to compute the weight change for one or multiple synapses @@ -366,7 +366,7 @@ weightFactors GraupnerBrunel2012CaPlasticitySynHandler::updateCaWeightFactors( d wUp.C = 0.0; } } - + if (wUp.tD > 0) { wUp.D = exp(-wUp.tD*gammaD_/tauSyn_); if (noisy_) { @@ -377,7 +377,7 @@ weightFactors GraupnerBrunel2012CaPlasticitySynHandler::updateCaWeightFactors( d wUp.E = 0.0; } } - + //cout << currTime << " tD = " << wUp.tD << " tP = " << wUp.tP << "\n"; // tP, tD, A, B, C, D, E of wUp // are set to 0.0 by default in struct constructor @@ -398,7 +398,7 @@ void GraupnerBrunel2012CaPlasticitySynHandler::updateWeight( Synapse* synPtr, we newWeight = wFacPtr->D*newWeight + wFacPtr->E; // update the weight again //cout << " newweight = " << newWeight << "\n"; } - + // potential is usually ignorable when t0 is small, // i.e. Ca is mostly above thetaD or thetaP //cout << "before bistable newWeight = " << newWeight << "\n"; @@ -412,16 +412,16 @@ void GraupnerBrunel2012CaPlasticitySynHandler::updateWeight( Synapse* synPtr, we } } //cout << "after bistable newWeight = " << newWeight << "\n"; - + // clip weight within [weightMin,weightMax] newWeight = std::max(weightMin_, std::min(newWeight, weightMax_)); //cout << " clipweight = " << newWeight << "\n"; - //cout << " A = " << wFacPtr->A << " B = " << wFacPtr->B << " C = " << wFacPtr->C + //cout << " A = " << wFacPtr->A << " B = " << wFacPtr->B << " C = " << wFacPtr->C // << " D = " << wFacPtr->D << " E = " << wFacPtr->E << " newW = "<< newWeight << "\n"; synPtr->setWeight( newWeight ); } -void GraupnerBrunel2012CaPlasticitySynHandler::vProcess( const Eref& e, ProcPtr p ) +void GraupnerBrunel2012CaPlasticitySynHandler::vProcess( const Eref& e, ProcPtr p ) { double activation = 0.0; double currTime = p->currTime; @@ -465,14 +465,14 @@ void GraupnerBrunel2012CaPlasticitySynHandler::vProcess( const Eref& e, ProcPtr // or to LIF as an impulse to voltage. //activation += currEvent.weight * weightScale_ / p->dt; activation += currSynPtr->getWeight() * weightScale_ / p->dt; - + // update only once for this time-step if an event occurs if (!CaFactorsUpdated) { // update Ca and weightFactors wFacs = updateCaWeightFactors( currTime ); CaFactorsUpdated = true; } - + events_.pop(); } if ( activation != 0.0 ) @@ -488,7 +488,7 @@ void GraupnerBrunel2012CaPlasticitySynHandler::vProcess( const Eref& e, ProcPtr wFacs = updateCaWeightFactors( currTime ); CaFactorsUpdated = true; } - Ca_ += CaPre_; + Ca_ += CaPre_; delayDPreEvents_.pop(); } @@ -503,10 +503,10 @@ void GraupnerBrunel2012CaPlasticitySynHandler::vProcess( const Eref& e, ProcPtr CaFactorsUpdated = true; } Ca_ += CaPost_; - + postEvents_.pop(); } - + // If any event has happened, update all pre-synaptic weights // If you want individual Ca for each pre-synapse // create individual SynHandlers for each @@ -523,7 +523,7 @@ void GraupnerBrunel2012CaPlasticitySynHandler::vProcess( const Eref& e, ProcPtr } -void GraupnerBrunel2012CaPlasticitySynHandler::vReinit( const Eref& e, ProcPtr p ) +void GraupnerBrunel2012CaPlasticitySynHandler::vReinit( const Eref& e, ProcPtr p ) { // For no apparent reason, priority queues don't have a clear operation. while( !events_.empty() ) diff --git a/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.h b/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.h index 8ea9af065b1b6810c22685d2b928f44dcb8a2b11..2c3055593acdba3bae06331e45b6a4cb2f5b1f8b 100644 --- a/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.h +++ b/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.h @@ -72,12 +72,12 @@ struct weightFactors { /** * This handles simple synapses without plasticity. It uses a priority - * queue to manage them. This gets inefficient for large numbers of + * queue to manage them. This gets inefficient for large numbers of * synapses but is pretty robust. */ class GraupnerBrunel2012CaPlasticitySynHandler: public SynHandlerBase { - public: + public: GraupnerBrunel2012CaPlasticitySynHandler(); ~GraupnerBrunel2012CaPlasticitySynHandler(); GraupnerBrunel2012CaPlasticitySynHandler& operator \ diff --git a/moose-core/synapse/RollingMatrix.cpp b/moose-core/synapse/RollingMatrix.cpp index 5fd84a9bfe83c4ab42a239731bc2d96a827759de..1ce87c9bccdb9307f08dd40c4cc230d02a49fc84 100644 --- a/moose-core/synapse/RollingMatrix.cpp +++ b/moose-core/synapse/RollingMatrix.cpp @@ -64,7 +64,7 @@ void RollingMatrix::sumIntoRow( const vector< double >& input, unsigned int row } -double RollingMatrix::dotProduct( const vector< double >& input, +double RollingMatrix::dotProduct( const vector< double >& input, unsigned int row, unsigned int startColumn ) const { unsigned int index = (row + currentStartRow_) % nrows_; @@ -82,7 +82,7 @@ double RollingMatrix::dotProduct( const vector< double >& input, return ret; } -void RollingMatrix::correl( vector< double >& ret, +void RollingMatrix::correl( vector< double >& ret, const vector< double >& input, unsigned int row) const { @@ -103,7 +103,7 @@ void RollingMatrix::rollToNextRow() { if ( currentStartRow_ == 0 ) currentStartRow_ = nrows_ - 1; - else + else currentStartRow_--; zeroOutRow( 0 ); } diff --git a/moose-core/synapse/RollingMatrix.h b/moose-core/synapse/RollingMatrix.h index 104636a80937df4a84189d4c138a0a330467f2c7..b78a5b25e5ed1328025e42f1c501c1655af0cfce 100644 --- a/moose-core/synapse/RollingMatrix.h +++ b/moose-core/synapse/RollingMatrix.h @@ -14,7 +14,7 @@ typedef vector< double > SparseVector; class RollingMatrix { - public: + public: // Specify empty matrix. RollingMatrix(); ~RollingMatrix(); @@ -34,13 +34,13 @@ class RollingMatrix { // Row index is relative to current zero. void sumIntoRow( const vector< double >& input, unsigned int row ); - // Return dot product of input with internal vector at specified + // Return dot product of input with internal vector at specified // row, starting at specified column. double dotProduct( const vector< double >& input, unsigned int row, unsigned int startColumn ) const; // Return correlation found by summing dotProduct across all columns - void correl( vector< double >& ret, const vector< double >& input, + void correl( vector< double >& ret, const vector< double >& input, unsigned int row ) const; // Zero out contents of row. @@ -48,7 +48,7 @@ class RollingMatrix { // Roll the matrix by one row. What was row 0 becomes row 1, etc. // Last row vanishes. - void rollToNextRow(); // + void rollToNextRow(); // private: unsigned int nrows_; diff --git a/moose-core/synapse/STDPSynHandler.cpp b/moose-core/synapse/STDPSynHandler.cpp index 568a89de799e9eb4c28dcb39ce678bc6e690fb30..372e6d66dc60267e8f0997afd95fac722f0cb9bb 100644 --- a/moose-core/synapse/STDPSynHandler.cpp +++ b/moose-core/synapse/STDPSynHandler.cpp @@ -17,17 +17,17 @@ const Cinfo* STDPSynHandler::initCinfo() { - static string doc[] = + static string doc[] = { "Name", "STDPSynHandler", "Author", "Aditya Gilra", - "Description", + "Description", "The STDPSynHandler handles synapses with spike timing dependent plasticity (STDP). " "It uses two priority queues to manage pre and post spikes." }; static ValueFinfo< STDPSynHandler, double > aMinus( - "aMinus", + "aMinus", "aMinus is a post-synaptic variable that keeps a decaying 'history' of previous post-spike(s)" "and is used to update the synaptic weight when a pre-synaptic spike appears." "It determines the t_pre > t_post (pre after post) part of the STDP window.", @@ -36,42 +36,42 @@ const Cinfo* STDPSynHandler::initCinfo() ); static ValueFinfo< STDPSynHandler, double > aMinus0( - "aMinus0", + "aMinus0", "aMinus0 is added to aMinus on every pre-spike", &STDPSynHandler::setAMinus0, &STDPSynHandler::getAMinus0 ); static ValueFinfo< STDPSynHandler, double > tauMinus( - "tauMinus", + "tauMinus", "aMinus decays with tauMinus time constant", &STDPSynHandler::setTauMinus, &STDPSynHandler::getTauMinus ); static ValueFinfo< STDPSynHandler, double > aPlus0( - "aPlus0", + "aPlus0", "aPlus0 is added to aPlus on every pre-spike", &STDPSynHandler::setAPlus0, &STDPSynHandler::getAPlus0 ); static ValueFinfo< STDPSynHandler, double > tauPlus( - "tauPlus", + "tauPlus", "aPlus decays with tauPlus time constant", &STDPSynHandler::setTauPlus, &STDPSynHandler::getTauPlus ); static ValueFinfo< STDPSynHandler, double > weightMax( - "weightMax", + "weightMax", "an upper bound on the weight", &STDPSynHandler::setWeightMax, &STDPSynHandler::getWeightMax ); static ValueFinfo< STDPSynHandler, double > weightMin( - "weightMin", + "weightMin", "a lower bound on the weight", &STDPSynHandler::setWeightMin, &STDPSynHandler::getWeightMin @@ -81,18 +81,18 @@ const Cinfo* STDPSynHandler::initCinfo() "Handles arriving spike messages from post-synaptic neuron, inserts into postEvent queue.", new EpFunc1< STDPSynHandler, double >( &STDPSynHandler::addPostSpike ) ); - static FieldElementFinfo< SynHandlerBase, STDPSynapse > synFinfo( + static FieldElementFinfo< SynHandlerBase, STDPSynapse > synFinfo( "synapse", "Sets up field Elements for synapse", STDPSynapse::initCinfo(), - /* + /* below SynHandlerBase::getSynapse is a function that returns Synapse*, but I need to cast the returned pointer to an STDPSynapse*. Since I take the address (&) of SynHandlerBase::getSynapse which is: Synapse* (SynHandlerBase::*)(unsigned int), I need to cast the address of the function to: STDPSynapse* (SynHandlerBase::*)(unsigned int). - + This is required to put STDPSynapse in above FieldElementFinfo definition, see FieldElementFinfo template class in basecode/FieldElementFinfo.h */ @@ -130,7 +130,7 @@ const Cinfo* STDPSynHandler::initCinfo() static const Cinfo* STDPSynHandlerCinfo = STDPSynHandler::initCinfo(); STDPSynHandler::STDPSynHandler() -{ +{ aMinus_ = 0.0; tauMinus_ = 1.0; aMinus0_ = 0.0; @@ -146,7 +146,7 @@ STDPSynHandler::~STDPSynHandler() STDPSynHandler& STDPSynHandler::operator=( const STDPSynHandler& ssh) { synapses_ = ssh.synapses_; - for ( vector< STDPSynapse >::iterator + for ( vector< STDPSynapse >::iterator i = synapses_.begin(); i != synapses_.end(); ++i ) i->setHandler( this ); @@ -183,7 +183,7 @@ STDPSynapse* STDPSynHandler::vGetSynapse( unsigned int i ) return &dummy; } -void STDPSynHandler::addSpike( +void STDPSynHandler::addSpike( unsigned int index, double time, double weight ) { assert( index < synapses_.size() ); @@ -195,7 +195,7 @@ void STDPSynHandler::addPostSpike( const Eref& e, double time ) postEvents_.push( PostSynEvent( time ) ); } -void STDPSynHandler::vProcess( const Eref& e, ProcPtr p ) +void STDPSynHandler::vProcess( const Eref& e, ProcPtr p ) { double activation = 0.0; @@ -226,11 +226,11 @@ void STDPSynHandler::vProcess( const Eref& e, ProcPtr p ) // or to LIF as an impulse to voltage. //activation += currEvent.weight / p->dt; activation += currSynPtr->getWeight() / p->dt; - + // Maintain 'history' of pre-spikes in Aplus // Add aPlus0 to the aPlus for this synapse due to pre-spike currSynPtr->setAPlus( currSynPtr->getAPlus() + aPlus0_ ); - + // Change weight by aMinus_ at each pre-spike // clip weight within [weightMin,weightMax] double newWeight = currEvent.weight + aMinus_; @@ -246,7 +246,7 @@ void STDPSynHandler::vProcess( const Eref& e, ProcPtr p ) while( !postEvents_.empty() && postEvents_.top().time <= p->currTime ) { // Add aMinus0 to the aMinus for this synapse aMinus_ += aMinus0_; - + // Change weight of all synapses by aPlus_ at each post-spike for (unsigned int i=0; i<synapses_.size(); i++) { // since aPlus_, tauPlus_ are private inside STDPSynapse, @@ -259,11 +259,11 @@ void STDPSynHandler::vProcess( const Eref& e, ProcPtr p ) double newWeight = currSynPtr->getWeight() + currSynPtr->getAPlus(); newWeight = std::max(weightMin_, std::min(newWeight, weightMax_)); currSynPtr->setWeight( newWeight ); - } + } postEvents_.pop(); } - + // modify aPlus and aMinus at every time step // Future: I could make this event-driven. Would be faster. // Or have a field to set it to event-driven or continuous. @@ -282,10 +282,10 @@ void STDPSynHandler::vProcess( const Eref& e, ProcPtr p ) // decay aMinus for this STDPSynHandler which sits on the post-synaptic compartment // forward Euler aMinus_ -= aMinus_/tauMinus_*dt_; - + } -void STDPSynHandler::vReinit( const Eref& e, ProcPtr p ) +void STDPSynHandler::vReinit( const Eref& e, ProcPtr p ) { // For no apparent reason, priority queues don't have a clear operation. while( !events_.empty() ) diff --git a/moose-core/synapse/STDPSynHandler.h b/moose-core/synapse/STDPSynHandler.h index e5fc9f456dff9b186e91807ed4b9da4d339ffa71..947db5f13387af002c573e35dfb5affca8dbd672 100644 --- a/moose-core/synapse/STDPSynHandler.h +++ b/moose-core/synapse/STDPSynHandler.h @@ -55,12 +55,12 @@ struct ComparePostSynEvent /** * This handles simple synapses without plasticity. It uses a priority - * queue to manage them. This gets inefficient for large numbers of + * queue to manage them. This gets inefficient for large numbers of * synapses but is pretty robust. */ class STDPSynHandler: public SynHandlerBase { - public: + public: STDPSynHandler(); ~STDPSynHandler(); STDPSynHandler& operator=( const STDPSynHandler& other ); diff --git a/moose-core/synapse/STDPSynapse.cpp b/moose-core/synapse/STDPSynapse.cpp index c42ef26c22118c49837946da37aaf9fe4d634ebb..211c60bac362f14d52bec754fc8586dd378b1d7b 100644 --- a/moose-core/synapse/STDPSynapse.cpp +++ b/moose-core/synapse/STDPSynapse.cpp @@ -15,7 +15,7 @@ const Cinfo* STDPSynapse::initCinfo() { - static string doc[] = + static string doc[] = { "Name", "STDPSynapse", "Author", "Aditya Gilra", @@ -23,7 +23,7 @@ const Cinfo* STDPSynapse::initCinfo() }; static ValueFinfo< STDPSynapse, double > aPlus( - "aPlus", + "aPlus", "aPlus is a pre-synaptic variable that keeps a decaying 'history' of previous pre-spike(s)" "and is used to update the synaptic weight when a post-synaptic spike appears." "It determines the t_pre < t_post (pre before post) part of the STDP window.", diff --git a/moose-core/synapse/SeqSynHandler.cpp b/moose-core/synapse/SeqSynHandler.cpp index 51a231ed50906b42e5efcf78e349102244abd57b..30346936110d9c15f1ec34cc4ea8fd0e1822a457 100644 --- a/moose-core/synapse/SeqSynHandler.cpp +++ b/moose-core/synapse/SeqSynHandler.cpp @@ -18,11 +18,11 @@ const Cinfo* SeqSynHandler::initCinfo() { - static string doc[] = + static string doc[] = { "Name", "SeqSynHandler", "Author", "Upi Bhalla", - "Description", + "Description", "The SeqSynHandler handles synapses that recognize sequentially " "ordered input, where the ordering is both in space and time. " "It assumes that the N input synapses are ordered and " @@ -40,7 +40,7 @@ const Cinfo* SeqSynHandler::initCinfo() "It computes a vector with the local *response* term for each " "point along all inputs, by taking a 2-d convolution of the " "kernel with the history[time][synapse#] matrix." - "\nThe local response can affect the synapse in three ways: " + "\nThe local response can affect the synapse in three ways: " "1. It can sum the entire response vector, scale by the " "*responseScale* term, and send to the synapse as a steady " "activation. Consider this a cell-wide immediate response to " @@ -55,7 +55,7 @@ const Cinfo* SeqSynHandler::initCinfo() "This is not yet implemented.\n" }; - static FieldElementFinfo< SynHandlerBase, Synapse > synFinfo( + static FieldElementFinfo< SynHandlerBase, Synapse > synFinfo( "synapse", "Sets up field Elements for synapse", Synapse::initCinfo(), @@ -105,7 +105,7 @@ const Cinfo* SeqSynHandler::initCinfo() &SeqSynHandler::setWeightScale, &SeqSynHandler::getWeightScale ); - static ReadOnlyValueFinfo< SeqSynHandler, vector< double > > + static ReadOnlyValueFinfo< SeqSynHandler, vector< double > > weightScaleVec( "weightScaleVec", "Vector of weight scaling for each synapse", @@ -155,15 +155,15 @@ static const Cinfo* seqSynHandlerCinfo = SeqSynHandler::initCinfo(); ////////////////////////////////////////////////////////////////////// SeqSynHandler::SeqSynHandler() - : + : kernelEquation_( "" ), kernelWidth_( 5 ), - historyTime_( 2.0 ), - seqDt_ ( 1.0 ), + historyTime_( 2.0 ), + seqDt_ ( 1.0 ), responseScale_( 1.0 ), weightScale_( 0.0 ), seqActivation_( 0.0 ) -{ +{ int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) ); history_.resize( numHistory, 0 ); } @@ -175,7 +175,7 @@ SeqSynHandler::~SeqSynHandler() SeqSynHandler& SeqSynHandler::operator=( const SeqSynHandler& ssh) { synapses_ = ssh.synapses_; - for ( vector< Synapse >::iterator + for ( vector< Synapse >::iterator i = synapses_.begin(); i != synapses_.end(); ++i ) i->setHandler( this ); @@ -223,8 +223,8 @@ void SeqSynHandler::updateKernel() double x = 0; double t = 0; mu::Parser p; - p.DefineVar("x", &x); - p.DefineVar("t", &t); + p.DefineVar("x", &x); + p.DefineVar("t", &t); p.DefineConst(_T("pi"), (mu::value_type)M_PI); p.DefineConst(_T("e"), (mu::value_type)M_E); p.SetExpr( kernelEquation_ ); @@ -372,7 +372,7 @@ void SeqSynHandler::dropSynapse( unsigned int msgLookup ) } ///////////////////////////////////////////////////////////////////// -void SeqSynHandler::vProcess( const Eref& e, ProcPtr p ) +void SeqSynHandler::vProcess( const Eref& e, ProcPtr p ) { // Here we look at the correlations and do something with them. int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) ); @@ -380,28 +380,28 @@ void SeqSynHandler::vProcess( const Eref& e, ProcPtr p ) // Check if we need to do correlations at all. if ( numHistory > 0 && kernel_.size() > 0 ) { // Check if timestep rolls over a seqDt boundary - if ( static_cast< int >( p->currTime / seqDt_ ) > + if ( static_cast< int >( p->currTime / seqDt_ ) > static_cast< int >( (p->currTime - p->dt) / seqDt_ ) ) { history_.rollToNextRow(); history_.sumIntoRow( latestSpikes_, 0 ); latestSpikes_.assign( vGetNumSynapses(), 0.0 ); - + // Build up the sum of correlations over time vector< double > correlVec( vGetNumSynapses(), 0.0 ); for ( int i = 0; i < numHistory; ++i ) history_.correl( correlVec, kernel_[i], i ); if ( responseScale_ > 0.0 ) { // Sum all responses, send to chan seqActivation_ = 0.0; - for ( vector< double >::iterator y = correlVec.begin(); + for ( vector< double >::iterator y = correlVec.begin(); y != correlVec.end(); ++y ) seqActivation_ += *y; - + // We'll use the seqActivation_ to send a special msg. seqActivation_ *= responseScale_; } if ( weightScale_ > 0.0 ) { // Short term changes in individual wts weightScaleVec_ = correlVec; - for ( vector< double >::iterator y=weightScaleVec_.begin(); + for ( vector< double >::iterator y=weightScaleVec_.begin(); y != weightScaleVec_.end(); ++y ) *y *= weightScale_; } @@ -414,7 +414,7 @@ void SeqSynHandler::vProcess( const Eref& e, ProcPtr p ) double activation = seqActivation_; // Start with seq activation if ( weightScale_ > 0.0 ) { while( !events_.empty() && events_.top().time <= p->currTime ) { - activation += events_.top().weight * + activation += events_.top().weight * weightScaleVec_[ events_.top().synIndex ] / p->dt; events_.pop(); } @@ -428,7 +428,7 @@ void SeqSynHandler::vProcess( const Eref& e, ProcPtr p ) SynHandlerBase::activationOut()->send( e, activation ); } -void SeqSynHandler::vReinit( const Eref& e, ProcPtr p ) +void SeqSynHandler::vReinit( const Eref& e, ProcPtr p ) { // For no apparent reason, priority queues don't have a clear operation. while( !events_.empty() ) diff --git a/moose-core/synapse/SeqSynHandler.h b/moose-core/synapse/SeqSynHandler.h index 55fd01181bcf868b610c0192456fc04f5c05b71d..2a8d0171cfc139adc006372f789ab5ca7c5d6652 100644 --- a/moose-core/synapse/SeqSynHandler.h +++ b/moose-core/synapse/SeqSynHandler.h @@ -25,7 +25,7 @@ */ class SeqSynHandler: public SynHandlerBase { - public: + public: SeqSynHandler(); ~SeqSynHandler(); SeqSynHandler& operator=( const SeqSynHandler& other ); @@ -69,7 +69,7 @@ class SeqSynHandler: public SynHandlerBase private: void updateKernel(); /* - * Here I would like to put in a sparse matrix. + * Here I would like to put in a sparse matrix. * Each timestep is a row * Each column is a neuron * Each value is the weight, though I could also look this up. @@ -82,13 +82,13 @@ class SeqSynHandler: public SynHandlerBase * Then run through all available places. */ string kernelEquation_; - unsigned int kernelWidth_; // Width in terms of number of synapses + unsigned int kernelWidth_; // Width in terms of number of synapses // Time to store history. KernelDt defines num of rows - double historyTime_; + double historyTime_; double seqDt_; // Time step for successive entries in kernel // Scaling factor for sustained activation of synapse from response - double responseScale_; + double responseScale_; // Scaling factor for weight changes in each synapse from response double weightScale_; @@ -97,12 +97,12 @@ class SeqSynHandler: public SynHandlerBase double seqActivation_; // global activation if sequence recognized // Weight scaling based on individual synapse sequence tuning. - vector< double > weightScaleVec_; - + vector< double > weightScaleVec_; + /////////////////////////////////////////// // Tracks the spikes that came in recently, as input to correlation // analysis for sequence recognition. - vector< double > latestSpikes_; + vector< double > latestSpikes_; /////////////////////////////////////////// vector< vector< double > > kernel_; //Kernel for seq selectivity diff --git a/moose-core/synapse/SimpleSynHandler.cpp b/moose-core/synapse/SimpleSynHandler.cpp index 360769e2e363c3be2ef2004864005ef399d317f4..b1323cb101783a530a8545f25849eb404f36841c 100644 --- a/moose-core/synapse/SimpleSynHandler.cpp +++ b/moose-core/synapse/SimpleSynHandler.cpp @@ -16,16 +16,16 @@ const Cinfo* SimpleSynHandler::initCinfo() { - static string doc[] = + static string doc[] = { "Name", "SimpleSynHandler", "Author", "Upi Bhalla", - "Description", + "Description", "The SimpleSynHandler handles simple synapses without plasticity. " "It uses a priority queue to manage them." }; - static FieldElementFinfo< SynHandlerBase, Synapse > synFinfo( + static FieldElementFinfo< SynHandlerBase, Synapse > synFinfo( "synapse", "Sets up field Elements for synapse", Synapse::initCinfo(), @@ -63,7 +63,7 @@ SimpleSynHandler::~SimpleSynHandler() SimpleSynHandler& SimpleSynHandler::operator=( const SimpleSynHandler& ssh) { synapses_ = ssh.synapses_; - for ( vector< Synapse >::iterator + for ( vector< Synapse >::iterator i = synapses_.begin(); i != synapses_.end(); ++i ) i->setHandler( this ); @@ -97,14 +97,14 @@ Synapse* SimpleSynHandler::vGetSynapse( unsigned int i ) return &dummy; } -void SimpleSynHandler::addSpike( +void SimpleSynHandler::addSpike( unsigned int index, double time, double weight ) { assert( index < synapses_.size() ); events_.push( SynEvent( time, weight ) ); } -void SimpleSynHandler::vProcess( const Eref& e, ProcPtr p ) +void SimpleSynHandler::vProcess( const Eref& e, ProcPtr p ) { double activation = 0.0; while( !events_.empty() && events_.top().time <= p->currTime ) { @@ -121,7 +121,7 @@ void SimpleSynHandler::vProcess( const Eref& e, ProcPtr p ) SynHandlerBase::activationOut()->send( e, activation ); } -void SimpleSynHandler::vReinit( const Eref& e, ProcPtr p ) +void SimpleSynHandler::vReinit( const Eref& e, ProcPtr p ) { // For no apparent reason, priority queues don't have a clear operation. while( !events_.empty() ) diff --git a/moose-core/synapse/SimpleSynHandler.h b/moose-core/synapse/SimpleSynHandler.h index 4029332b9621e6abc68d74e2b7b62c49e10bd207..9b3138bf0337783f9b4bfd95c800ab5aa6991d14 100644 --- a/moose-core/synapse/SimpleSynHandler.h +++ b/moose-core/synapse/SimpleSynHandler.h @@ -39,12 +39,12 @@ struct CompareSynEvent /** * This handles simple synapses without plasticity. It uses a priority - * queue to manage them. This gets inefficient for large numbers of + * queue to manage them. This gets inefficient for large numbers of * synapses but is pretty robust. */ class SimpleSynHandler: public SynHandlerBase { - public: + public: SimpleSynHandler(); ~SimpleSynHandler(); SimpleSynHandler& operator=( const SimpleSynHandler& other ); diff --git a/moose-core/synapse/SynHandlerBase.cpp b/moose-core/synapse/SynHandlerBase.cpp index 21fa5ad34509a818405642e819606b80afdd5983..3c30a30bf1702accb1ce7ad378208a1eb51a0afd 100644 --- a/moose-core/synapse/SynHandlerBase.cpp +++ b/moose-core/synapse/SynHandlerBase.cpp @@ -44,7 +44,7 @@ const Cinfo* SynHandlerBase::initCinfo() "Handles 'reinit' call. Initializes all the synapses.", new ProcOpFunc< SynHandlerBase >(& SynHandlerBase::reinit ) ); - static Finfo* processShared[] = + static Finfo* processShared[] = { &process, &reinit }; @@ -64,7 +64,7 @@ const Cinfo* SynHandlerBase::initCinfo() { "Name", "SynHandlerBase", "Author", "Upi Bhalla", - "Description", + "Description", "Base class for handling synapse arrays converging onto a given " "channel or integrate-and-fire neuron. This class provides the " "interface for channels/intFires to connect to a range of synapse " @@ -125,7 +125,7 @@ bool SynHandlerBase::rangeWarning( const string& field, double value ) if ( value < RANGE ) { cout << "Warning: Ignored attempt to set " << field << " of SynHandler " << - // c->target().e->name() << + // c->target().e->name() << " to less than " << RANGE << endl; return 1; } diff --git a/moose-core/synapse/SynHandlerBase.h b/moose-core/synapse/SynHandlerBase.h index d9e96b113438ab3a4676519f97bcd6da13e3a38b..660da06d6c8b7d63bcd70878b0d05d2c21839099 100644 --- a/moose-core/synapse/SynHandlerBase.h +++ b/moose-core/synapse/SynHandlerBase.h @@ -16,19 +16,19 @@ class Synapse; * This is a pure virtual base class for accessing and handling synapses. * It provides a uniform interface so that all classes that use synapses * can do so without duplication. - * The derived classes have the responsibility of handling the + * The derived classes have the responsibility of handling the * synaptic events as well as possible return events from the parent. */ class SynHandlerBase { - public: + public: SynHandlerBase(); virtual ~SynHandlerBase(); - + //////////////////////////////////////////////////////////////// // Field assignment stuff. //////////////////////////////////////////////////////////////// - + /** * Resizes the synapse storage */ @@ -55,8 +55,8 @@ class SynHandlerBase bool rangeWarning( const string& field, double value ); //////////////////////////////////////////////////////////////// - /** - * Adds a new synapse, returns its index. This is + /** + * Adds a new synapse, returns its index. This is * triggered by addMsg of inputs to the child synapse. The * SynHandler has to ensure that we have enough synapses allocated * to handle the new message, and the return value is used so that @@ -77,7 +77,7 @@ class SynHandlerBase * eventual arrival of the spike, and is typically well in the * future. The index specifies which synapse the spike came to. */ - virtual void addSpike( + virtual void addSpike( unsigned int index, double time, double weight ) = 0; //////////////////////////////////////////////////////////////// // Virtual func definitions for fields. diff --git a/moose-core/synapse/Synapse.cpp b/moose-core/synapse/Synapse.cpp index 8a4467303ff91540eb8829749a43db0b7999db36..17aa5a0daeb64bdcc31efb1cfc5c5ebc27f88186 100644 --- a/moose-core/synapse/Synapse.cpp +++ b/moose-core/synapse/Synapse.cpp @@ -37,7 +37,7 @@ const Cinfo* Synapse::initCinfo() &addSpike, // DestFinfo }; - static string doc[] = + static string doc[] = { "Name", "Synapse", "Author", "Upi Bhalla", @@ -110,15 +110,15 @@ void Synapse::addSpike( const Eref& e, double time ) // static function, executed by the Synapse Element when a message is // added to the Element. Expands the parent synapse array to fit. void Synapse::addMsgCallback( - const Eref& e, const string& finfoName, + const Eref& e, const string& finfoName, ObjId msg, unsigned int msgLookup ) { if ( finfoName == "addSpike" ) { ObjId pa = Neutral::parent( e ); - SynHandlerBase* sh = + SynHandlerBase* sh = reinterpret_cast< SynHandlerBase* >( pa.data() ); unsigned int synapseNumber = sh->addSynapse(); - SetGet2< unsigned int, unsigned int >::set( + SetGet2< unsigned int, unsigned int >::set( msg, "fieldIndex", msgLookup, synapseNumber ); } } @@ -129,12 +129,12 @@ void Synapse::addMsgCallback( // unused entry. Could even reuse if a synapse is added later, but all // this policy is independent of the Synapse class. void Synapse::dropMsgCallback( - const Eref& e, const string& finfoName, + const Eref& e, const string& finfoName, ObjId msg, unsigned int msgLookup ) { if ( finfoName == "addSpike" ) { ObjId pa = Neutral::parent( e ); - SynHandlerBase* sh = + SynHandlerBase* sh = reinterpret_cast< SynHandlerBase* >( pa.data() ); sh->dropSynapse( msgLookup ); } diff --git a/moose-core/synapse/Synapse.h b/moose-core/synapse/Synapse.h index 1ca09c7029ba53e8f8433768fbc6f3c8480e9432..12e5915de832eab23cf8eaa5cb2d3af6c0a8d10b 100644 --- a/moose-core/synapse/Synapse.h +++ b/moose-core/synapse/Synapse.h @@ -30,11 +30,11 @@ class Synapse void setHandler( SynHandlerBase* h ); /////////////////////////////////////////////////////////////// - static void addMsgCallback( - const Eref& e, const string& finfoName, + static void addMsgCallback( + const Eref& e, const string& finfoName, ObjId msg, unsigned int msgLookup ); - static void dropMsgCallback( - const Eref& e, const string& finfoName, + static void dropMsgCallback( + const Eref& e, const string& finfoName, ObjId msg, unsigned int msgLookup ); static const Cinfo* initCinfo(); private: diff --git a/moose-core/synapse/testSynapse.cpp b/moose-core/synapse/testSynapse.cpp index 2edd4165c1c5866effe687f2e08e5bc943e792fe..39b083887b9fea1cad34c5778ec5ea167d614301 100644 --- a/moose-core/synapse/testSynapse.cpp +++ b/moose-core/synapse/testSynapse.cpp @@ -26,7 +26,7 @@ void testRollingMatrix() int ncol = 10; RollingMatrix rm; rm.resize( 5, 10 ); - + for ( int i = 0; i < nr; ++i ) { rm.sumIntoEntry( i + 1, i, i ); } @@ -38,7 +38,7 @@ void testRollingMatrix() cout << "." << flush; // Old row0 becomes row1 and so on. Old row4 (now 0) should be cleared. - rm.rollToNextRow(); + rm.rollToNextRow(); for ( int i = 0; i < nr; ++i ) { for ( int j = 0; j < ncol; ++j ) { // cout << rm.get( i, j ); @@ -135,10 +135,10 @@ void testSeqSynapse() for ( int i = 0; i < numSyn-4; ++i ) assert( doubleEq( wts[i], 2.0 ) ); assert( doubleEq( wts[6], 3 ) ); // Edge effects. Last -1 vanishes. - assert( doubleEq( wts[7], 4 ) ); // Edge effects. + assert( doubleEq( wts[7], 4 ) ); // Edge effects. assert( doubleEq( wts[8], 5 ) ); // Edge effects. assert( doubleEq( wts[9], 4 ) ); // Edge effects. - + cout << "." << flush; shell->doDelete( sid ); } diff --git a/moose-core/tests/issues/hsolve/compare_moose_nrn.py b/moose-core/tests/issues/hsolve/compare_moose_nrn.py index f62f9e5fcfc07aec4b52d3de84b966ef71051f1b..f262401e73551a533b3f3e2796f51c275c17c8ec 100644 --- a/moose-core/tests/issues/hsolve/compare_moose_nrn.py +++ b/moose-core/tests/issues/hsolve/compare_moose_nrn.py @@ -1,47 +1,48 @@ -# compare_moose_nrn.py --- -# +# -*- coding: utf-8 -*- +# compare_moose_nrn.py --- +# # Filename: compare_moose_nrn.py -# Description: +# Description: # Author: subha -# Maintainer: +# Maintainer: # Created: Sat Apr 30 02:43:29 2016 (-0400) -# Version: +# Version: # Last-Updated: Sat Apr 30 03:01:04 2016 (-0400) # By: subha # Update #: 19 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: @@ -61,5 +62,5 @@ pl.legend() pl.show() -# +# # compare_moose_nrn.py ends here diff --git a/moose-core/tests/issues/hsolve/h10.CNG.moose.py b/moose-core/tests/issues/hsolve/h10.CNG.moose.py index 999200eacf6dcf2699046be6890e4341e1182dce..79c72d8c757964a1e83b423b37cc7d8cb1e414ed 100644 --- a/moose-core/tests/issues/hsolve/h10.CNG.moose.py +++ b/moose-core/tests/issues/hsolve/h10.CNG.moose.py @@ -1,47 +1,48 @@ -# h10.CNG.moose.py --- -# +# -*- coding: utf-8 -*- +# h10.CNG.moose.py --- +# # Filename: h10.CNG.moose.py -# Description: +# Description: # Author: subha -# Maintainer: +# Maintainer: # Created: Sat Apr 30 02:10:09 2016 (-0400) -# Version: +# Version: # Last-Updated: Sat Apr 30 03:12:18 2016 (-0400) # By: subha # Update #: 95 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: from __future__ import print_function @@ -91,18 +92,18 @@ if __name__ == '__main__': solver.target = '/model/h10/soma' solver.dt = dt outfile = 'h10.CNG.moose.hsolve.txt' - else: + else: outfile = 'h10.CNG.moose.ee.txt' for ii in range(20): moose.setClock(ii, dt) - simtime = 100e-3 + simtime = 100e-3 moose.reinit() moose.start(simtime) t = np.arange(len(tab_v_soma.vector)) * simtime / len(tab_v_soma.vector) np.savetxt(outfile, np.vstack([t, tab_v_soma.vector, tab_v_apical.vector]).T) - -# + +# # h10.CNG.moose.py ends here diff --git a/moose-core/tests/issues/issue_124.py b/moose-core/tests/issues/issue_124.py index d4c377726da243976de3bc4d655be32d8312606a..d409e60afb7217fb5733531ca0eff65b1cdd9193 100644 --- a/moose-core/tests/issues/issue_124.py +++ b/moose-core/tests/issues/issue_124.py @@ -1,18 +1,19 @@ +# -*- coding: utf-8 -*- import moose print(( 'Using moose form %s' % moose.__file__ )) def main(): - solver = "gssa" + solver = "gssa" moose.Neutral('/model') moose.CubeMesh('/model/kinetics') moose.Pool('/model/kinetics/A') - + #delete if exists if ( moose.exists( 'model/kinetics/stoich' ) ): moose.delete( '/model/kinetics/stoich' ) moose.delete( '/model/kinetics/ksolve' ) - + #create solver compt = moose.element( '/model/kinetics' ) ksolve = moose.Gsolve( '/model/kinetics/ksolve' ) @@ -25,7 +26,7 @@ def main(): print(" After reinit") moose.start( 10 ) print( "Done" ) - + # Run the 'main' if this script is executed standalone. if __name__ == '__main__': main() diff --git a/moose-core/tests/issues/issue_34.py b/moose-core/tests/issues/issue_34.py index 2ec5ee70ef02a18b909cae1536e29ac0ce1aec1a..11995f5a29c36c7d29b204d0705122a9f77e5685 100644 --- a/moose-core/tests/issues/issue_34.py +++ b/moose-core/tests/issues/issue_34.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Issue 34 on github. import moose import moose.utils as mu diff --git a/moose-core/tests/issues/issue_45.py b/moose-core/tests/issues/issue_45.py index 6a5d721736a8d22fc5b9ab297224172cb2469eb7..a87ad5cd3a3ebb2954e058a8d748e4eaff2bc732 100644 --- a/moose-core/tests/issues/issue_45.py +++ b/moose-core/tests/issues/issue_45.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import print_function import moose diff --git a/moose-core/tests/issues/issue_47.py b/moose-core/tests/issues/issue_47.py index de3b3b3a1ead0a3d947e57e96f558ab4cc321545..d2d6d964d4a5fe8710efa78e4aaf471d1f61ae34 100644 --- a/moose-core/tests/issues/issue_47.py +++ b/moose-core/tests/issues/issue_47.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Issue 47 on moose-core import moose print( '[INFO] Using moose from %s' % moose.__file__ ) diff --git a/moose-core/tests/issues/issue_69.py b/moose-core/tests/issues/issue_69.py index 20749afc2b1e073c20dfa1cc9ef6877f1f8c1135..93388421a8df109ecfb5cebdab9455371af96696 100644 --- a/moose-core/tests/issues/issue_69.py +++ b/moose-core/tests/issues/issue_69.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Github issue #69, Also BhallaLab/moose-gui#3. import moose diff --git a/moose-core/tests/issues/issue_93.py b/moose-core/tests/issues/issue_93.py index d804a342dc5733ff7d7f5df80d2af7887a9fdb32..3a043308b70628164b4820ab5c9f33b9b0eafd85 100644 --- a/moose-core/tests/issues/issue_93.py +++ b/moose-core/tests/issues/issue_93.py @@ -1,4 +1,5 @@ -# Issue #93 on moose-core +# -*- coding: utf-8 -*- +# Issue #93 on moose-core import numpy as np import pylab as pl @@ -25,7 +26,7 @@ def loadAndRun(solver=True): stim.delay[0] = 50e-3 stim.delay[1] = 1e9 stim.level[0] = 1e-9 - stim.width[0] = 2e-3 + stim.width[0] = 2e-3 moose.connect(stim, 'output', comp, 'injectMsg') tab = moose.Table('/cell/Vm') moose.connect(tab, 'requestOut', comp, 'getVm') @@ -34,7 +35,7 @@ def loadAndRun(solver=True): moose.reinit() print('[INFO] Running for %s' % simtime) moose.start(simtime ) - vec = tab_soma.vector + vec = tab_soma.vector moose.delete( '/cell' ) return vec @@ -45,10 +46,10 @@ def main( ): hsolveVec = loadAndRun( True ) clk = moose.Clock( '/clock' ) print( '[DEBUG] Total entries %s' % len( eeVec )) - t = pl.linspace(0, clk.currentTime, len( eeVec )) + t = pl.linspace(0, clk.currentTime, len( eeVec )) pl.plot(t, eeVec, label = 'ee' ) pl.plot( t, hsolveVec, label = 'hsolve' ) - outfile = '%s.png' % sys.argv[0] + outfile = '%s.png' % sys.argv[0] pl.legend( ) pl.savefig( outfile ) print( '[INFO] Wrote results to %s' % outfile ) diff --git a/moose-core/tests/python/Rallpacks/compartment.py b/moose-core/tests/python/Rallpacks/compartment.py index 253c6e78618914ba2b8ac0720dc9aafea954ec02..04d7bd313fe459bbc0289a90f4191efe5f399bff 100644 --- a/moose-core/tests/python/Rallpacks/compartment.py +++ b/moose-core/tests/python/Rallpacks/compartment.py @@ -1,13 +1,14 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- -"""Compartment.py: +"""Compartment.py: A compartment in moose. Last modified: Tue May 13, 2014 06:03PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -49,7 +50,7 @@ class MooseCompartment(): self.mc_.Cm = self.Cm self.mc_.Em = self.Em self.mc_.initVm = self.Em - + except Exception as e: utils.dump("ERROR" , [ "Can't create compartment with path %s " % path @@ -62,13 +63,13 @@ class MooseCompartment(): def __repr__( self ): msg = '{}: '.format( self.mc_.path ) - msg += '\n\t|- Length: {:1.4e}, Diameter: {:1.4e}'.format( + msg += '\n\t|- Length: {:1.4e}, Diameter: {:1.4e}'.format( self.mc_.length, self.mc_.diameter ) # msg += '\n\t|- Cross-section: {:1.4e}, SurfaceArea: {:1.4e}'.format( # self.crossSection, self.surfaceArea # ) - msg += '\n\t|- Ra: {:1.3e}, Rm: {:1.3e}, Cm: {:1.3e}, Em: {:1.3e}'.format( + msg += '\n\t|- Ra: {:1.3e}, Rm: {:1.3e}, Cm: {:1.3e}, Em: {:1.3e}'.format( self.mc_.Ra, self.mc_.Rm, self.mc_.Cm, self.mc_.Em ) return msg @@ -83,7 +84,7 @@ class MooseCompartment(): self.crossSection = ( math.pi * self.diameter * self.diameter ) / 4.0 self.Ra = ( self.RA * self.compLength ) / self.crossSection self.Rm = ( self.RM / self.surfaceArea ) - self.Cm = ( self.CM * self.surfaceArea ) + self.Cm = ( self.CM * self.surfaceArea ) class TestCompartment( unittest.TestCase): @@ -102,16 +103,16 @@ class TestCompartment( unittest.TestCase): m = MooseCompartment( ) m.createCompartment( path='/model/compartment1' ) - self.assertFalse ( m.mc_ + self.assertFalse ( m.mc_ , 'Should not create compartment when parent does not exists.' ) - + def test_properties( self ): m = MooseCompartment() m.createCompartment('/comp1') self.assertTrue( m.mc_.Em <= 0.0 , "Em is initialized to some positive value." - " Current value is %s " % m.mc_.Em + " Current value is %s " % m.mc_.Em ) self.assertTrue( m.mc_.Rm >= 0.0 , "Rm should be initialized to non-zero positive float" diff --git a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/compare.py b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/compare.py index fa5a86bdc5ecba1ce791b941d9769893a12d1681..b1ef6ac7eed07e8e3728653fa401cc627ce517cd 100755 --- a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/compare.py +++ b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/compare.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python - -"""compare.py: Compare data generated by MOOSE and NEURON. +# -*- coding: utf-8 -*- +""" +compare.py: Compare data generated by MOOSE and NEURON. Last modified: Wed May 28, 2014 02:48PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -24,10 +24,10 @@ import numpy as np EPSILON = 1e-10 def findMaxima(y, x, filters=[], **kwargs): - """Find the location of peaks in data - - If type of peak is cap then - + """Find the location of peaks in data + + If type of peak is cap then + """ maximas = [] index = [] @@ -45,7 +45,7 @@ def findMaxima(y, x, filters=[], **kwargs): return index, maximas def findMinima(y, x, filters=[], **kwargs): - """Find all minimas on the curve + """Find all minimas on the curve """ minimas = [] index = [] @@ -63,7 +63,7 @@ def findMinima(y, x, filters=[], **kwargs): return index, minimas def compareData(x1, y1, x2, y2): - """Given two plots (x1, y1) and (x2, y2), Do some statistics on them + """Given two plots (x1, y1) and (x2, y2), Do some statistics on them """ # First compare that there x-axis are same. else report warning. @@ -75,7 +75,7 @@ def compareData(x1, y1, x2, y2): assert(len(x1) == len(x2)), "X axis must have equal no of entries" for i, x in enumerate(x1): msg = "Value mismatch in x-axis: {}-{} = {}".format(x, x2[i], x-x2[i]) - assert np.absolute(x - x2[i]) < EPSILON, msg + assert np.absolute(x - x2[i]) < EPSILON, msg # Good, now do a simple root-mean square test on both y-axis. pylab.figure() @@ -84,7 +84,7 @@ def compareData(x1, y1, x2, y2): pylab.plot(maximasY1[0], maximasY1[1], '^') pylab.plot(maximasY2[0], maximasY2[1], 'o') pylab.show() - + def compare(mooseData, nrnData, outputFile = None): """Compare two data-vectors """ @@ -96,17 +96,6 @@ def compare(mooseData, nrnData, outputFile = None): for i, v in enumerate( mooseY ): peaksY1 = compareData(mooseX, mooseY.values()[i], nrnX, nrnY.values()[i]) print(peaksY1) -""" - pylab.figure() - pylab.plot(mooseX, mooseY.values()[i]) - pylab.plot(nrnX, nrnY.values()[i]) - if outputFile is None: - pylab.show() - else: - outFile = "{}{}.png".format(outputFile, i) - print("[INFO] Dumping plot to {}".format(outFile)) - pylab.savefig(outFile) -""" def txtToData(txt): """Convert text to data""" diff --git a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/moose_sim.py b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/moose_sim.py index 98f927efe7d2c134a791a169c2be26f5aaf52953..0045db3ae40259f9dfa3f99e3541c8ae4934aaa7 100644 --- a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/moose_sim.py +++ b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/moose_sim.py @@ -1,13 +1,14 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- -"""moose_sim.py: +"""moose_sim.py: A cable with 1000 compartments with HH-type channels in it. Last modified: Wed May 21, 2014 09:51AM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -55,7 +56,7 @@ class MooseCompartment(): self.mc_.Cm = self.Cm self.mc_.Em = self.Em self.mc_.initVm = self.Em - + except Exception as e: utils.dump("ERROR" , [ "Can't create compartment with path %s " % path @@ -68,13 +69,13 @@ class MooseCompartment(): def __repr__( self ): msg = '{}: '.format( self.mc_.path ) - msg += '\n\t|- Length: {:1.4e}, Diameter: {:1.4e}'.format( + msg += '\n\t|- Length: {:1.4e}, Diameter: {:1.4e}'.format( self.mc_.length, self.mc_.diameter ) # msg += '\n\t|- Cross-section: {:1.4e}, SurfaceArea: {:1.4e}'.format( # self.crossSection, self.surfaceArea # ) - msg += '\n\t|- Ra: {:1.3e}, Rm: {:1.3e}, Cm: {:1.3e}, Em: {:1.3e}'.format( + msg += '\n\t|- Ra: {:1.3e}, Rm: {:1.3e}, Cm: {:1.3e}, Em: {:1.3e}'.format( self.mc_.Ra, self.mc_.Rm, self.mc_.Cm, self.mc_.Em ) return msg @@ -89,17 +90,17 @@ class MooseCompartment(): self.crossSection = ( np.pi * self.diameter * self.diameter ) / 4.0 self.Ra = ( self.RA * self.compLength ) / self.crossSection self.Rm = ( self.RM / self.surfaceArea ) - self.Cm = ( self.CM * self.surfaceArea ) + self.Cm = ( self.CM * self.surfaceArea ) def alphaM(A, B, V0, v): '''Compute alpha_m at point v - aplha_m = A(v - v0 ) / (exp((v-V0)/B) - 1) + aplha_m = A(v - v0 ) / (exp((v-V0)/B) - 1) ''' return (A*(v-V0) / (np.exp((v - V0)/B) -1 )) def alphaN(A, B, V0, v): - '''Compute alpha_n at point v + '''Compute alpha_n at point v aplha_n = A(v-V0) / (exp((v-V0)/B) -1 ) ''' return alphaM(A, B, V0, v) @@ -113,12 +114,12 @@ def betaN(A, B, V0, v): return betaM(A, B, V0, v) def alphaH(A, B, V0, v): - '''Compute alpha_h at point v + '''Compute alpha_h at point v ''' return (A * np.exp(( v - V0) / B)) def behaH(A, B, V0, v): - '''Compute beta_h at point v + '''Compute beta_h at point v ''' return (A * np.exp((v-V0)/B) + 1) @@ -134,9 +135,9 @@ def createChannel(species, path, **kwargs): def create_na_chan(parent='/library', name='na', vmin=-110e-3, vmax=50e-3, vdivs=3000): """Create a Hodhkin-Huxley Na channel under `parent`. - + vmin, vmax, vdivs: voltage range and number of divisions for gate tables - + """ na = moose.HHChannel('%s/%s' % (parent, name)) na.Xpower = 3 @@ -162,9 +163,9 @@ def create_na_chan(parent='/library', name='na', vmin=-110e-3, vmax=50e-3, vdivs def create_k_chan(parent='/library', name='k', vmin=-120e-3, vmax=40e-3, vdivs=3000): """Create a Hodhkin-Huxley K channel under `parent`. - + vmin, vmax, vdivs: voltage range and number of divisions for gate tables - + """ k = moose.HHChannel('%s/%s' % (parent, name)) k.Xpower = 4 @@ -178,7 +179,7 @@ def create_k_chan(parent='/library', name='k', vmin=-120e-3, vmax=40e-3, vdivs=3 n_gate.tableA = n_alpha n_gate.tableB = n_alpha + n_beta return k - + def creaetHHComp(parent='/library', name='hhcomp', diameter=1e-6, length=1e-6): """Create a compartment with Hodgkin-Huxley type ion channels (Na and K). @@ -199,7 +200,7 @@ def creaetHHComp(parent='/library', name='hhcomp', diameter=1e-6, length=1e-6): na = moose.element('%s/na' % (c.path)) # Na-conductance 120 mS/cm^2 - na.Gbar = 120e-3 * sarea * 1e4 + na.Gbar = 120e-3 * sarea * 1e4 na.Ek = 115e-3 + EREST_ACT moose.connect(c, 'channel', na, 'channel') @@ -210,7 +211,7 @@ def creaetHHComp(parent='/library', name='hhcomp', diameter=1e-6, length=1e-6): k = moose.element('%s/k' % (c.path)) # K-conductance 36 mS/cm^2 - k.Gbar = 36e-3 * sarea * 1e4 + k.Gbar = 36e-3 * sarea * 1e4 k.Ek = -12e-3 + EREST_ACT moose.connect(c, 'channel', k, 'channel') return (c, na, k) @@ -238,7 +239,7 @@ def setupDUT( dt ): pg.firstLevel = 1e-10 moose.connect(pg, 'output', comp, 'injectMsg') setupClocks( dt ) - + def setupClocks( dt ): moose.setClock(0, dt) moose.setClock(1, dt) @@ -307,7 +308,7 @@ if __name__ == '__main__': , default = 1e-3 , type = float , help = 'You should record membrane potential somewhere, right?' - ) + ) parser.add_argument( '--length' , default = 1e-3 , type = float diff --git a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/neuron_sim.py b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/neuron_sim.py index 518e22c3cf1f184fd17e6867eca3036bfd000c35..f0d8658c37c5e1888f56abf3b46d3fc74ee575fc 100644 --- a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/neuron_sim.py +++ b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/neuron_sim.py @@ -1,6 +1,7 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- -"""rallpack3_moose_vs_neuron.py: +"""rallpack3_moose_vs_neuron.py: This file compares moose and neuron for rallpack3. @@ -8,7 +9,7 @@ Last modified: Sun May 25, 2014 07:05AM """ from __future__ import print_function - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -110,7 +111,7 @@ if __name__ == '__main__': , default = 999 , type = int , help = 'Index of compartment at which membrane potential is recorded' - ) + ) parser.add_argument( '--length' , default = 1e-3 , type = float diff --git a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/profile_neuron.sh b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/profile_neuron.sh index ec5fc0b9a6b0ce2b423ab5be13702baad5d64488..da61576a22dcc605ee0aa37149018bac70e36349 100755 --- a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/profile_neuron.sh +++ b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/profile_neuron.sh @@ -3,6 +3,6 @@ echo "Profiling neuron simulator of rallpack3" ncomp=50 while [ $ncomp -lt 50000 ]; do echo "Cable with compartment $ncomp" - python ./neuron_sim.py --ncomp $ncomp --data data/L$ncomp.out + python ./neuron_sim.py --ncomp $ncomp --data data/L$ncomp.out ncomp=$(echo $ncomp+50 | bc) done diff --git a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/profile_rallapck.py b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/profile_rallapck.py index 595fdba10231b6fff8bac41450373db4b69b34b7..4f451657bd44fd71e02dcfd91ebf6bb3225a7dca 100755 --- a/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/profile_rallapck.py +++ b/moose-core/tests/python/Rallpacks/moose_vs_neuron/rallpack3/profile_rallapck.py @@ -1,12 +1,13 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- -"""profile_rallapck.py: +"""profile_rallapck.py: Last modified: Sat Jan 18, 2014 05:01PM """ from __future__ import print_function - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -34,10 +35,10 @@ def runRallpack3( startN = 10, stepSize = 50): pass def simResult( elemXml ): - """ Get a single simXML and return a plottable entity + """ Get a single simXML and return a plottable entity """ timeStamp = elemXml.get("time_stamp") - global simclockList + global simclockList global xvec global yvecs yvecs = [] @@ -72,7 +73,7 @@ def plotProfile(results, plots = []): plots.append(p) def processProfile ( profileFile ): - """ This function process the profile file given in xml format + """ This function process the profile file given in xml format """ print("[STEP] Processing profile file {}".format( profileFile )) with open( profileFile, "r") as f: @@ -101,7 +102,7 @@ def main( args ): pylab.savefig(output) else: print("[TODO] Profile rallpack3") - + if __name__ == '__main__': import argparse # Argument parser. diff --git a/moose-core/tests/python/Rallpacks/profile_rallapck.py b/moose-core/tests/python/Rallpacks/profile_rallapck.py index 7dd4f4cecfd750d60f98709d138fa373a0e84460..7aae15383ea48d3f20f45ea431fc139124b601fe 100755 --- a/moose-core/tests/python/Rallpacks/profile_rallapck.py +++ b/moose-core/tests/python/Rallpacks/profile_rallapck.py @@ -1,11 +1,12 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- -"""profile_rallapck.py: +"""profile_rallapck.py: Last modified: Sat Jan 18, 2014 05:01PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -35,10 +36,10 @@ def runRallpack3( startN = 10, stepSize = 50): comps += stepSize def simResult( elemXml ): - """ Get a single simXML and return a plottable entity + """ Get a single simXML and return a plottable entity """ timeStamp = elemXml.get("time_stamp") - global simclockList + global simclockList simclockList = {} elementList = {} for x in elemXml.iterchildren("elements"): @@ -79,7 +80,7 @@ def plotProfile(results, output=None): pylab.savefig(output) def processProfile ( profileFile ): - """ This function process the profile file given in xml format + """ This function process the profile file given in xml format """ print("[STEP] Processing profile file {}".format( profileFile )) with open( profileFile, "r") as f: @@ -96,7 +97,7 @@ def main( args ): plotProfile(results, output=args.get('output', None)) else: print("[TODO] No input data file given to process. Run rallpack3 here.") - + if __name__ == '__main__': import argparse # Argument parser. diff --git a/moose-core/tests/python/Rallpacks/rallpacks_cable_hhchannel.py b/moose-core/tests/python/Rallpacks/rallpacks_cable_hhchannel.py index d970434753334df4e407d422cdf00ca078d594f2..ba0773c7761aa1e5bc3802b65fc56059400f6e0b 100644 --- a/moose-core/tests/python/Rallpacks/rallpacks_cable_hhchannel.py +++ b/moose-core/tests/python/Rallpacks/rallpacks_cable_hhchannel.py @@ -1,11 +1,12 @@ -"""rallpacks_cable_hhchannel.py: +# -*- coding: utf-8 -*- +"""rallpacks_cable_hhchannel.py: A cable with 1000 compartments with HH-type channels in it. Last modified: Wed May 21, 2014 09:51AM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -33,12 +34,12 @@ cable = [] def alphaM(A, B, V0, v): '''Compute alpha_m at point v - aplha_m = A(v - v0 ) / (exp((v-V0)/B) - 1) + aplha_m = A(v - v0 ) / (exp((v-V0)/B) - 1) ''' return (A*(v-V0) / (np.exp((v - V0)/B) -1 )) def alphaN(A, B, V0, v): - '''Compute alpha_n at point v + '''Compute alpha_n at point v aplha_n = A(v-V0) / (exp((v-V0)/B) -1 ) ''' return alphaM(A, B, V0, v) @@ -52,12 +53,12 @@ def betaN(A, B, V0, v): return betaM(A, B, V0, v) def alphaH(A, B, V0, v): - '''Compute alpha_h at point v + '''Compute alpha_h at point v ''' return (A * np.exp(( v - V0) / B)) def behaH(A, B, V0, v): - '''Compute beta_h at point v + '''Compute beta_h at point v ''' return (A * np.exp((v-V0)/B) + 1) @@ -73,9 +74,9 @@ def createChannel(species, path, **kwargs): def create_na_chan(parent='/library', name='na', vmin=-110e-3, vmax=50e-3, vdivs=3000): """Create a Hodhkin-Huxley Na channel under `parent`. - + vmin, vmax, vdivs: voltage range and number of divisions for gate tables - + """ na = moose.HHChannel('%s/%s' % (parent, name)) na.Xpower = 3 @@ -101,9 +102,9 @@ def create_na_chan(parent='/library', name='na', vmin=-110e-3, vmax=50e-3, vdivs def create_k_chan(parent='/library', name='k', vmin=-120e-3, vmax=40e-3, vdivs=3000): """Create a Hodhkin-Huxley K channel under `parent`. - + vmin, vmax, vdivs: voltage range and number of divisions for gate tables - + """ k = moose.HHChannel('%s/%s' % (parent, name)) k.Xpower = 4 @@ -117,7 +118,7 @@ def create_k_chan(parent='/library', name='k', vmin=-120e-3, vmax=40e-3, vdivs=3 n_gate.tableA = n_alpha n_gate.tableB = n_alpha + n_beta return k - + def creaetHHComp(parent='/library', name='hhcomp', diameter=1e-6, length=1e-6): """Create a compartment with Hodgkin-Huxley type ion channels (Na and K). @@ -138,7 +139,7 @@ def creaetHHComp(parent='/library', name='hhcomp', diameter=1e-6, length=1e-6): na = moose.element('%s/na' % (c.path)) # Na-conductance 120 mS/cm^2 - na.Gbar = 120e-3 * sarea * 1e4 + na.Gbar = 120e-3 * sarea * 1e4 na.Ek = 115e-3 + EREST_ACT moose.connect(c, 'channel', na, 'channel') @@ -149,7 +150,7 @@ def creaetHHComp(parent='/library', name='hhcomp', diameter=1e-6, length=1e-6): k = moose.element('%s/k' % (c.path)) # K-conductance 36 mS/cm^2 - k.Gbar = 36e-3 * sarea * 1e4 + k.Gbar = 36e-3 * sarea * 1e4 k.Ek = -12e-3 + EREST_ACT moose.connect(c, 'channel', k, 'channel') return (c, na, k) @@ -177,7 +178,7 @@ def setupDUT( dt ): pg.firstLevel = 1e-10 moose.connect(pg, 'output', comp, 'injectMsg') setupClocks( dt ) - + def setupClocks( dt ): moose.setClock(0, dt) moose.setClock(1, dt) @@ -200,7 +201,7 @@ def main(args): dt = args['dt'] makeCable(args) setupDUT( dt ) - t = time.time() + t = time.time() simulate( args['run_time'], dt ) print( 'Time to run %f seconds ' % ( time.time() - t ) ) @@ -243,7 +244,7 @@ if __name__ == '__main__': , default = 1e-3 , type = float , help = 'You should record membrane potential somewhere, right?' - ) + ) parser.add_argument( '--length' , default = 1e-3 , type = float diff --git a/moose-core/tests/python/Rallpacks/rallpacks_passive_cable.py b/moose-core/tests/python/Rallpacks/rallpacks_passive_cable.py index 4867a34b676d56a31003dfdee535823d81371bc0..0d988dd942fec2eea6e212c794e1198d95ca3f58 100644 --- a/moose-core/tests/python/Rallpacks/rallpacks_passive_cable.py +++ b/moose-core/tests/python/Rallpacks/rallpacks_passive_cable.py @@ -1,11 +1,12 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """cable.py: A passive cable of n compartments. Last modified: Wed May 21, 2014 04:26AM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -55,7 +56,7 @@ class PasiveCable( ): self.cable.append(c) self.connect( ) utils.dump( "STEP" - , "Passive cable is connected and ready for simulation." + , "Passive cable is connected and ready for simulation." ) def connect( self ): @@ -77,7 +78,7 @@ class PasiveCable( ): # Inject the current from stim to first compartment. moose.connect( stim, 'output', self.cable[0].mc_, 'injectMsg' ) - + # Fill the data from stim into table. inputTable = moose.Table( '{}/inputTable'.format( self.tablePath ) ) self.stimTables.append( inputTable ) @@ -99,8 +100,8 @@ class PasiveCable( ): self.simDt = simDt self.plotDt = plotDt self.setupDUT( ) - - # Setup clocks + + # Setup clocks utils.dump("STEP", "Setting up the clocks ... ") moose.setClock( 0, self.simDt ) moose.setClock( 1, self.simDt ) @@ -179,7 +180,7 @@ if __name__ == '__main__': parser.add_argument( '--x' , default = 1e-3 , help = 'You should record membrane potential somewhere, right?' - ) + ) parser.add_argument( '--length' , default = 1e-3 , help = 'Length of the cable' diff --git a/moose-core/tests/python/Rallpacks/rallpacks_tree_cable.py b/moose-core/tests/python/Rallpacks/rallpacks_tree_cable.py index a7f7b2609e48a41f1f5549d21b65058715f81bf7..c3ae7b5f4558d0f96dc12ad7361eb0faa959c83d 100644 --- a/moose-core/tests/python/Rallpacks/rallpacks_tree_cable.py +++ b/moose-core/tests/python/Rallpacks/rallpacks_tree_cable.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """tree_cable.py: A depth 10 binary tree like cable with following properties. @@ -25,7 +26,7 @@ Last modified: Sat Jan 18, 2014 05:01PM """ from __future__ import print_function - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -68,7 +69,7 @@ class BinaryCable( ): self.tablePath = '/data' moose.Neutral(self.tablePath) self.stimTables = [] - + def buildParameterLists(self): ''' Build list of parameters in moose ''' while len(self.compDiamList) < self.depth: @@ -122,7 +123,7 @@ class BinaryCable( ): # Inject the current from stim to first compartment. moose.connect( stim, 'output', self.cable[0][0], 'injectMsg' ) - + # Fill the data from stim into table. inputTable = moose.Table( '{}/inputTable'.format( self.tablePath ) ) self.stimTables.append( inputTable ) @@ -130,7 +131,7 @@ class BinaryCable( ): def recordAt( self, depth, index ): ''' Parameter index is python list-like index. Index -1 is the last - elements in the list + elements in the list ''' utils.dump( "RECORD" , "Adding probe at index {} and depth {}".format(index, depth) @@ -149,12 +150,12 @@ class BinaryCable( ): hsolve.target = self.cablePath def simulate(self, simTime, simDt, plotDt=None): - '''Simulate the cable + '''Simulate the cable ''' self.simDt = simDt self.setupDUT( ) - - # Setup clocks + + # Setup clocks moose.setClock( 0, self.simDt ) # Use clocks @@ -172,7 +173,7 @@ class BinaryCable( ): moose.start( simTime ) def main( args ): - # d is depth of cable. + # d is depth of cable. d = args['tree_depth'] assert d > 0, "Cable depth can not be nagative" binCable = BinaryCable( depth = d ) @@ -223,7 +224,7 @@ if __name__ == '__main__': parser.add_argument( '--x' , default = 1e-3 , help = 'You should record membrane potential somewhere, right?' - ) + ) parser.add_argument( '--length' , default = 1e-3 , help = 'Length of the cable' diff --git a/moose-core/tests/python/benchmark.py b/moose-core/tests/python/benchmark.py index 563a6cc280948de396c4245146e57ebcf026d1c5..db7d57a54a4c6776f277be3b2b18ecb3c30c4016 100644 --- a/moose-core/tests/python/benchmark.py +++ b/moose-core/tests/python/benchmark.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import print_function from datetime import datetime diff --git a/moose-core/tests/python/chan_proto.py b/moose-core/tests/python/chan_proto.py index 52dceee92812e7e032c0e9dbbe811d0bf27cc368..10ad79d86977815996515b344fdbe1bd5e77206b 100644 --- a/moose-core/tests/python/chan_proto.py +++ b/moose-core/tests/python/chan_proto.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """\ Create general Channel Proto, pass in name, x and y power, and params @@ -61,7 +62,7 @@ def interpolate_values_in_table(tabA,V_0,l=40): def fix_singularities(Params,Gate): import param_chan - + if Params.A_C < 0: V_0 = Params.A_vslope*np.log(-Params.A_C)-Params.Avhalf diff --git a/moose-core/tests/python/mpi/benchmark.py b/moose-core/tests/python/mpi/benchmark.py index fd0042e132a9e416069ed722c5d389d5fe3e8324..29c01fc0f7ed6ef827b104045e55745a139137a9 100644 --- a/moose-core/tests/python/mpi/benchmark.py +++ b/moose-core/tests/python/mpi/benchmark.py @@ -1,47 +1,48 @@ -# benchmark.py --- -# +# -*- coding: utf-8 -*- +# benchmark.py --- +# # Filename: benchmark.py # Description: Script for performance benchmarking -# Author: -# Maintainer: +# Author: +# Maintainer: # Created: Thu Jan 23 16:06:25 2014 (+0530) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: """This script tries to run the test case multiple times with @@ -70,7 +71,7 @@ def create_hostfile(slotcount=None, filename='hostfile'): slotcount = multiprocessing.cpu_count() with open(filename, 'w') as hostfile: hostfile.write('%s slots=%d\n' % (socket.gethostname(), slotcount)) - + def run(script, scriptargs=[], hostfile='hostfile', np=2, ni=1, oversubscribe=False): """Run `script` with arguments in `scriptargs` list. Use `hostfile` @@ -110,12 +111,12 @@ def run(script, scriptargs=[], hostfile='hostfile', np=2, ni=1, oversubscribe=Fa def print_usage(argv0): print('''Usage: %s [-s slotcount] [-f hostfile] [-n maxprocess] [-i iterations] {script} [script arguments] - + Run {script} using up to {slotcount} slots and display execution time. If specified, the host information will be written in `hostfile`. Default is "hostfile".''' % (argv0)) sys.exit(1) - + if __name__ == '__main__': if len(sys.argv) < 2: print_usage(sys.argv[0]) @@ -144,8 +145,8 @@ if __name__ == '__main__': scriptargs = rest[1:] create_hostfile(slotcount=slots, filename=hostfile) run(script, scriptargs, hostfile=hostfile, np=np, ni=ni) - -# + +# # benchmark.py ends here diff --git a/moose-core/tests/python/mpi/recurrentIntFire.py b/moose-core/tests/python/mpi/recurrentIntFire.py index e69031711b2c6f57ef5376762fad75cb874848e2..573552b125b028f312b56d799ecb4c8b21022088 100644 --- a/moose-core/tests/python/mpi/recurrentIntFire.py +++ b/moose-core/tests/python/mpi/recurrentIntFire.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import print_function import random @@ -50,7 +51,7 @@ def make_network(): numTotSyn = sum( numSynVec ) for item in network.vec: neuron = moose.element( item ) - neuron.synapse.delay = [ (delayMin + random.random() * delayMax) for r in range( len( neuron.synapse ) ) ] + neuron.synapse.delay = [ (delayMin + random.random() * delayMax) for r in range( len( neuron.synapse ) ) ] neuron.synapse.weight = nprand.rand( len( neuron.synapse ) ) * weightMax print('after setup, t = ', time.time() - t0, ", numTotSyn = ", numTotSyn) @@ -59,8 +60,8 @@ def make_network(): netvec = network.vec for i in range( size ): synvec = netvec[i].synapse.vec - synvec.weight = [ (random.random() * weightMax) for r in range( synvec.len )] - synvec.delay = [ (delayMin + random.random() * delayMax) for r in range( synvec.len )] + synvec.weight = [ (random.random() * weightMax) for r in range( synvec.len )] + synvec.delay = [ (delayMin + random.random() * delayMax) for r in range( synvec.len )] """ #moose.useClock( 9, '/postmaster', 'process' ) diff --git a/moose-core/tests/python/mus/cachannel.py b/moose-core/tests/python/mus/cachannel.py index 5b3922780c251e36f1b11e5074bcfe74daf04af3..c162a1093d0c64ccf8afb21db3ee4633acaf4e5f 100644 --- a/moose-core/tests/python/mus/cachannel.py +++ b/moose-core/tests/python/mus/cachannel.py @@ -1,47 +1,48 @@ -# cachannel.py --- -# +# -*- coding: utf-8 -*- +# cachannel.py --- +# # Filename: cachannel.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Wed Jun 4 14:59:08 2014 (+0530) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# -# -# -# +# 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: import numpy as np @@ -54,11 +55,11 @@ lib = moose.Neutral('/library') def make_cat(): """ Ported to pymoose. - Subhasis Ray. Wed Jun 4 15:25:21 IST 2014 - + Original comment: - + COMMENT - T-type Ca channel + T-type Ca channel ca.mod to lead to thalamic ca current inspired by destexhe and huguenrd Uses fixed eca instead of GHK eqn changed from (AS Oct0899) @@ -109,14 +110,14 @@ def make_cahva(): COMMENT 26 Ago 2002 Modification of original channel to allow variable time step and to correct an initialization error. Done by Michael Hines(michael.hines@yale.e) and Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course in Computational Neuroscience. Obidos, Portugal - + ca.mod Uses fixed eca instead of GHK eqn - + HVA Ca current Based on Reuveni, Friedman, Amitai and Gutnick (1993) J. Neurosci. 13: 4609-4621. - + Author: Zach Mainen, Salk Institute, 1994, zach@salk.edu ENDCOMMENT @@ -131,7 +132,7 @@ def make_cahva(): b = 0.94*np.exp((-75-vm)/17) mtau = 1/tadj/(a+b) minf = a/(a+b) - # "h" inactivation + # "h" inactivation a = 0.000457*np.exp((-13-vm)/50) b = 0.0065/(np.exp((-vm-15)/28) + 1) htau = 1/tadj/(a+b) @@ -152,5 +153,5 @@ def make_cahva(): return channel -# +# # cachannel.py ends here diff --git a/moose-core/tests/python/mus/hchannel.py b/moose-core/tests/python/mus/hchannel.py index ceecca5fcb931f2f13a545110a843693e4361e10..41664740c30f3c4affca2528a70a1a3756c04d9e 100644 --- a/moose-core/tests/python/mus/hchannel.py +++ b/moose-core/tests/python/mus/hchannel.py @@ -1,47 +1,48 @@ -# hchannel.py --- -# +# -*- coding: utf-8 -*- +# hchannel.py --- +# # Filename: hchannel.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Thu Jun 5 15:20:30 2014 (+0530) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: @@ -85,5 +86,5 @@ def make_h(): channel.gateX[0].max = 1e-3 * vmax return channel -# +# # hchannel.py ends here diff --git a/moose-core/tests/python/mus/kchannel.py b/moose-core/tests/python/mus/kchannel.py index da35a796ba6f69bcf05f970abeb1b42ded2bc3a7..0bd7ec221cebc73d1cdd7cdc89d8eebe85660f69 100644 --- a/moose-core/tests/python/mus/kchannel.py +++ b/moose-core/tests/python/mus/kchannel.py @@ -1,47 +1,48 @@ -# kchannel.py --- -# +# -*- coding: utf-8 -*- +# kchannel.py --- +# # Filename: kchannel.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Wed Jun 4 12:30:31 2014 (+0530) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# -# -# -# +# 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: @@ -49,7 +50,7 @@ import numpy as np import moose from settings import * -def rates_kv(v, Ra, Rb, tha, qa): +def rates_kv(v, Ra, Rb, tha, qa): a = Ra * (v - tha) / (1 - np.exp(-(v - tha)/qa)) b = -Rb * (v - tha) / (1 - np.exp((v - tha)/qa)) ntau = 1e-3/tadj/(a+b) @@ -60,26 +61,26 @@ def make_kv(): """Translated to pymoose from original model by Zach Mainen. - Subhasis Ray 2014-06-04 Original comment: - + COMMENT 26 Ago 2002 Modification of original channel to allow variable time step and to correct an initialization error. Done by Michael Hines(michael.hines@yale.e) and Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course in Computational Neuroscience. Obidos, Portugal - + kv.mod - + Potassium channel, Hodgkin-Huxley style kinetics Kinetic rates based roughly on Sah et al. and Hamill et al. (1991) - + Author: Zach Mainen, Salk Institute, 1995, zach@salk.edu - + ENDCOMMENT """ gbar = 5 * tadj # (pS/um2) : 0.03 mho/cm2 tha = 25 # (mV) : v 1/2 for inf - qa = 9 # (mV) : inf slope + qa = 9 # (mV) : inf slope Ra = 0.02 # (/ms) : max act rate - Rb = 0.002 # (/ms) : max deact rate + Rb = 0.002 # (/ms) : max deact rate vmin = -120 # (mV) vmax = 100 # (mV) v = np.linspace(vmin, vmax, 3000) @@ -102,26 +103,26 @@ def make_km(): COMMENT 26 Ago 2002 Modification of original channel to allow variable time step and to correct an initialization error. Done by Michael Hines(michael.hines@yale.e) and Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course in Computational Neuroscience. Obidos, Portugal - + km.mod - + Potassium channel, Hodgkin-Huxley style kinetics Based on I-M (muscarinic K channel) Slow, noninactivating - + Author: Zach Mainen, Salk Institute, 1995, zach@salk.edu - + ENDCOMMENT """ gbar = 10 # (pS/um2) = S/m2 : 0.03 mho/cm2 tha = -30 # (mV) : v 1/2 for inf - qa = 9 # (mV) : inf slope + qa = 9 # (mV) : inf slope Ra = 0.001 # (/ms) : max act rate (slow) Rb = 0.001 # (/ms) : max deact rate (slow) vmin = -120 # (mV) vmax = 100 # (mV) - v = np.linspace(vmin, vmax, 3000) + v = np.linspace(vmin, vmax, 3000) a = Ra * (v - tha) / (1 - np.exp(-(v - tha)/qa)) b = -Rb * (v - tha) / (1 - np.exp((v - tha)/qa)) ntau = 1 / tadj /(a + b) @@ -146,21 +147,21 @@ def make_kca(): Done by Michael Hines(michael.hines@yale.e) and Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course in Computational Neuroscience. Obidos, Portugal kca.mod - + Calcium-dependent potassium channel Based on Pennefather (1990) -- sympathetic ganglion cells taken from Reuveni et al (1993) -- neocortical cells - + Author: Zach Mainen, Salk Institute, 1995, zach@salk.edu - + ENDCOMMENT """ gbar = 10 # (pS/um2) : 0.03 mho/cm2 - caix = 1 # - Ra = 0.01 # (/ms) : max act rate - Rb = 0.02 # (/ms) : max deact rate + caix = 1 # + Ra = 0.01 # (/ms) : max act rate + Rb = 0.02 # (/ms) : max deact rate vmin = -120 # (mV) vmax = 100 # (mV) # In MOOSE we set up lookup tables beforehand @@ -187,8 +188,8 @@ def make_kca(): # floating point though, but I am using it for # conc, because only nOut src msg is available moose.connect(capool, 'nOut', channel, 'concen') - -# + +# # kchannel.py ends here diff --git a/moose-core/tests/python/mus/nachannel.py b/moose-core/tests/python/mus/nachannel.py index 9025fd78f8280f55d0791410aecc99da6e85d93a..e3281a948956eed4e51c9aa2576d19df0a6b64cd 100644 --- a/moose-core/tests/python/mus/nachannel.py +++ b/moose-core/tests/python/mus/nachannel.py @@ -1,54 +1,4 @@ -# nachannel.py --- -# -# Filename: nachannel.py -# Description: -# Author: Subhasis Ray -# Maintainer: -# Created: Tue Jun 3 20:48:17 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: - -import moose -from settings import * -import numpy as np - +# -*- coding: utf-8 -*- """Converted from the neuron modl file by Zach Mainen 1994. - Subhasis Ray 2014-06-04 @@ -67,7 +17,7 @@ van Elburg!) na.mod -Sodium channel, Hodgkin-Huxley style kinetics. +Sodium channel, Hodgkin-Huxley style kinetics. Kinetics were fit to data from Huguenard et al. (1988) and Hamill et al. (1991) @@ -84,6 +34,9 @@ Author: Zach Mainen, Salk Institute, 1994, zach@salk.edu ENDCOMMENT """ +import moose +from settings import * +import numpy as np def trap0(v, th, a, q): return np.where(np.abs((v-th)/q) > 1e-6, @@ -93,7 +46,7 @@ def trap0(v, th, a, q): def make_na(): library = moose.Neutral('/library') channel = moose.HHChannel('/library/Na') - channel.Gbar = 0.0 # 1000 * tadj + channel.Gbar = 0.0 # 1000 * tadj channel.Xpower = 3 channel.Ypower = 1 vshift = -5 # -10 # has been set to -5 in init_biophysics.hoc @@ -102,17 +55,17 @@ def make_na(): vmax = 100 vm = np.linspace(vmin, vmax, vdivs) + vshift tha = -35 # (mV) : v 1/2 for act (-42) - qa = 9 # (mV) : act slope - Ra = 0.182 # (/ms) : open (v) - Rb = 0.124 # (/ms) : close (v) - # - thi1 = -50 # (mV) : v 1/2 for inact - thi2 = -75 # (mV) : v 1/2 for inact + qa = 9 # (mV) : act slope + Ra = 0.182 # (/ms) : open (v) + Rb = 0.124 # (/ms) : close (v) + # + thi1 = -50 # (mV) : v 1/2 for inact + thi2 = -75 # (mV) : v 1/2 for inact qi = 5 # (mV) : inact tau slope - thinf = -65 # (mV) : inact inf slope + thinf = -65 # (mV) : inact inf slope qinf = 6.2 # (mV) : inact inf slope - Rg = 0.0091 # (/ms) : inact (v) - Rd = 0.024 # (/ms) : inact recov (v) + Rg = 0.0091 # (/ms) : inact (v) + Rd = 0.024 # (/ms) : inact recov (v) # m gate - activation a = trap0(vm, tha, Ra, qa) @@ -123,7 +76,7 @@ def make_na(): channel.gateX[0].tableB = 1.0 / mtau # this contains alpha + beta channel.gateX[0].min = vmin * 1e-3 channel.gateX[0].max = vmax * 1e-3 - + # h gate - inactivation a = trap0(vm, thi1, Rd, qi) b = trap0(-vm, -thi2, Rg, qi) @@ -159,5 +112,5 @@ if __name__ == '__main__': legend() show() -# +# # nachannel.py ends here diff --git a/moose-core/tests/python/mus/nmda.py b/moose-core/tests/python/mus/nmda.py index 5c95b9a640f9efa93041a5ed3c384f9bca8dc90c..a3ddb4a56b1d1bdb7a533ba3c6929ac331f5303b 100644 --- a/moose-core/tests/python/mus/nmda.py +++ b/moose-core/tests/python/mus/nmda.py @@ -10,4 +10,4 @@ import moose def make_nmda(path): nmda = moose.MarkovChannel(path) return nmda - + diff --git a/moose-core/tests/python/mus/rc19.py b/moose-core/tests/python/mus/rc19.py index f16cf4a1646e79510bc01bbe5ea902b080c2db8f..b98e4f2fd7cf2899a68ac77219c9f4042a862a67 100644 --- a/moose-core/tests/python/mus/rc19.py +++ b/moose-core/tests/python/mus/rc19.py @@ -1,47 +1,48 @@ -# rc19.py --- -# +# -*- coding: utf-8 -*- +# rc19.py --- +# # Filename: rc19.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Sat May 24 14:10:22 2014 (+0530) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: """Cell morphology and passive properties from Branco et al 2010.""" @@ -118,7 +119,7 @@ def make_prototype(passive=True): make_cat() make_cahva() make_h() - try: + try: proto = moose.element(path) except ValueError: print('Loading model %s to %s' % (pfile, path)) @@ -135,7 +136,7 @@ def setup_model(model_path, synapse_locations, passive=False, solver='hsolve'): `model_path` - location where the model should be created. - + `synapse_locations`: compartment names for the synapses. """ @@ -176,7 +177,7 @@ def setup_recording(data_path, neuron, syninfo_list): nmda_data = moose.Neutral('%s/G_NMDA' % (data_path)) ampa_gk = [] nmda_gk = [] - + # Record synaptic conductances for syninfo in syninfo_list: compname = syninfo['spike'].parent.name @@ -193,10 +194,10 @@ def setup_recording(data_path, neuron, syninfo_list): def setup_experiment(name, stim_order, onset, interval, passive=False, solver='hsolve'): """Setup an experiment with specified stimulation order. `stim_order` is a - series of integers specifying the compartment numbers along dendritic - branch dend_13. `onset` is time of onset of stimulation protocol. - `inteval` is the interval between stimulation time of - successive synapses.""" + series of integers specifying the compartment numbers along dendritic + branch dend_13. `onset` is time of onset of stimulation protocol. + `inteval` is the interval between stimulation time of + successive synapses.""" model_container = moose.Neutral('/model/%s' % (name)) model_info = setup_model(model_container.path, synloc, passive=passive, solver=solver) data_container = moose.Neutral('/data/%s' % (name)) @@ -212,7 +213,7 @@ def setup_experiment(name, stim_order, onset, interval, passive=False, solver='h print('Stimulus onset:', onset) print('Inter stimulus interval:', interval) return (data_info, model_info) - + tstop = 200e-3 tonset = 50e-3 @@ -285,5 +286,5 @@ if __name__ == '__main__': run_sim_parallel(passive=passive, solver=solver) -# +# # rc19.py ends here diff --git a/moose-core/tests/python/mus/settings.py b/moose-core/tests/python/mus/settings.py index 280efa905e1776a8703dd578d7abfabee5b34ce7..bd030859837358484c02b710361ae4e4201bdea1 100644 --- a/moose-core/tests/python/mus/settings.py +++ b/moose-core/tests/python/mus/settings.py @@ -1,47 +1,48 @@ -# settings.py --- -# +# -*- coding: utf-8 -*- +# settings.py --- +# # Filename: settings.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Wed Jun 4 12:26:46 2014 (+0530) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# - -# Commentary: -# -# -# -# +# 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: @@ -53,5 +54,5 @@ temp = 37 # Centegrade : experimental temperature tadj = q10 ** ((temp - temp0)/10.0) -# +# # settings.py ends here diff --git a/moose-core/tests/python/mus/synapse.py b/moose-core/tests/python/mus/synapse.py index 4ed2b50d9e0455987331ba21d6b743401312f728..617f93eb75f6da8ebac4808738de855fead0a738 100644 --- a/moose-core/tests/python/mus/synapse.py +++ b/moose-core/tests/python/mus/synapse.py @@ -1,47 +1,48 @@ -# synapse.py --- -# +# -*- coding: utf-8 -*- +# synapse.py --- +# # Filename: synapse.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Mon May 26 11:29:54 2014 (+0530) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: @@ -52,7 +53,7 @@ def make_NMDA(comp): based on Dave Beeman's implementation. This implementation of NMDA uses the formulation by Zador, Koch - and Brown (1990) where + and Brown (1990) where Gk = Gbar * (exp(- t / tau1) - exp(-t / tau2)) / (1 + eta * [Mg2+] * exp(- gmma * Vm)) @@ -76,11 +77,11 @@ def make_NMDA(comp): mgblock.CMg = 1.2 # [Mg] in mM mgblock.Zk = 2 mgblock.KMg_A = 1.0/0.28 - mgblock.KMg_B = 1.0/62 + mgblock.KMg_B = 1.0/62 moose.connect( nmda, 'channelOut', mgblock, 'origChannel', 'OneToOne' ) moose.connect(mgblock, 'channel', comp, 'channel') return nmda, mgblock - + def make_AMPA(comp): ampa = moose.SynChan('%s/ampa' % (comp.path)) ampa.synapse.num = 1 @@ -89,7 +90,7 @@ def make_AMPA(comp): ampa.bufferTime = 0.0001 moose.connect(ampa, 'channel', comp, 'channel') return ampa - + def make_synapse(comp): nmda, mgblock = make_NMDA(comp) ampa = make_AMPA(comp) @@ -104,5 +105,5 @@ def make_synapse(comp): -# +# # synapse.py ends here diff --git a/moose-core/tests/python/neuroml/CA1.py b/moose-core/tests/python/neuroml/CA1.py index 085726ec8201ef3403dbde4271eff992eff2a140..544fad594f9f4d59c3afaf03d3b08d4ed1feb8ff 100644 --- a/moose-core/tests/python/neuroml/CA1.py +++ b/moose-core/tests/python/neuroml/CA1.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ## Aditya Gilra, NCBS, Bangalore, 2012 ## Dilawar Singh, NCBS, 2015 diff --git a/moose-core/tests/python/neuroml/CA1_hsolve.py b/moose-core/tests/python/neuroml/CA1_hsolve.py index ea1e67fb13783e85b0e7a84b39ea7564253a1325..058fd03bf9090ebef582351fcb86a836a2f11781 100644 --- a/moose-core/tests/python/neuroml/CA1_hsolve.py +++ b/moose-core/tests/python/neuroml/CA1_hsolve.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ## Aditya Gilra, NCBS, Bangalore, 2012 """ @@ -30,7 +31,7 @@ def loadGran98NeuroML_L123(filename,params): #somaIKCa = setupTable('somaIKCa',moose.HHChannel(soma_path+'/Gran_KCa_98'),'Gk') #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X') soma = moose.Compartment(soma_path) - + print("Reinit MOOSE ... ") resetSim(['/elec','/cells'],simdt,plotdt,simmethod='hsolve') # from moose.utils print("Running ... ") diff --git a/moose-core/tests/python/neuroml/FvsI_CA1.py b/moose-core/tests/python/neuroml/FvsI_CA1.py index 79de2e11a684f64ae850b191f697ba57adc1286b..5f4ed1ef483169945907950deeb4e394e868bb4c 100644 --- a/moose-core/tests/python/neuroml/FvsI_CA1.py +++ b/moose-core/tests/python/neuroml/FvsI_CA1.py @@ -24,7 +24,7 @@ from moose.neuroml.NeuroML import NeuroML import numpy as np import unittest -soma_ = None +soma_ = None cellSpikeTable_ = None def loadModel(filename): @@ -53,7 +53,7 @@ def applyCurrent(currenti): if len(spikesList)>0: spikesList = spikesList[np.where(spikesList>0.0)[0]] spikesNow = len(spikesList) - else: + else: spikesNow = 0.0 print("For injected current {0}, no of spikes in {1} second: {2}".format( currenti, 1.0, spikesNow ) diff --git a/moose-core/tests/python/neuroml/count.py b/moose-core/tests/python/neuroml/count.py index 0055dfc855ffeb4f5e4740dcc6f8427969f79f1d..a6681bfd1580a0a3f41016a668fa117c362cb7a0 100644 --- a/moose-core/tests/python/neuroml/count.py +++ b/moose-core/tests/python/neuroml/count.py @@ -1,9 +1,10 @@ -"""count.py: +# -*- coding: utf-8 -*- +"""count.py: Counting related function goes here. """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] @@ -51,7 +52,7 @@ def spike_train_simple_stat( vec, threshold = 0.0, **kwargs ): meanSteps = -1 varSteps = -1 result['number of spikes'] = nSpikes - result['mean spike-interval'] = meanSteps + result['mean spike-interval'] = meanSteps result['variance spike-interval'] = varSteps result['min'] = vec.min() result['max'] = vec.max() diff --git a/moose-core/tests/python/params.py b/moose-core/tests/python/params.py index 406965738033096b2fd85fb6e4250c4decd88554..1feacecc91b9a7de77d801b1bf26722d1196a65f 100644 --- a/moose-core/tests/python/params.py +++ b/moose-core/tests/python/params.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- t_stop = 10 dend_diameter = 2.2627398e-6 dend_length = 1.131369936e-6 @@ -22,5 +23,5 @@ inject = 0.1e-9 gbar = 1 #MMpump km = 0.3e-3 -kcat = 85e-22 +kcat = 85e-22 pumps = 1 diff --git a/moose-core/tests/python/streamer.py b/moose-core/tests/python/streamer.py index 6b7533be9dea0f04ca12abf0fd48c9597eaa6d5b..de22d53457d4f484b938d5454ffee69424d85bc2 100644 --- a/moose-core/tests/python/streamer.py +++ b/moose-core/tests/python/streamer.py @@ -1,4 +1,5 @@ -"""test_table_stream.py: +# -*- coding: utf-8 -*- +"""test_table_stream.py: Test moose.TableStream. diff --git a/moose-core/tests/python/test_all.sh b/moose-core/tests/python/test_all.sh index 338a20cb746752c06064f4b6a3a4eb6d83a9f221..4b10beabc7040fd2da49d94cab7496d62f329b4f 100755 --- a/moose-core/tests/python/test_all.sh +++ b/moose-core/tests/python/test_all.sh @@ -1,6 +1,6 @@ #!/bin/bash -test_scripts="./test_function.py +test_scripts="./test_function.py test_function.py test_moose_paths.py test_mumbl.py diff --git a/moose-core/tests/python/test_difshells.py b/moose-core/tests/python/test_difshells.py index 9f4f35e99488066a3a3e4f292effbc4576e51606..005899d17e555cb59342cee7a13bed2c4171a6dc 100644 --- a/moose-core/tests/python/test_difshells.py +++ b/moose-core/tests/python/test_difshells.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import moose import numpy as np import matplotlib.pyplot as plt @@ -52,7 +53,7 @@ def add_difshells_and_buffers(comp,difshell_no,difbuff_no): if difshell_no < 1: return [], [] - difshell = [] + difshell = [] shell_thickness = comp.diameter / difshell_no / 2. difbuffer = [] for i in range(difshell_no): @@ -120,14 +121,14 @@ if __name__ == '__main__': pulse.width[0] = 500e-3 pulse.level[0] = inject pulse.delay[1] = 1e9 - + chan = chan_proto.chan_proto('/library/CaL12',param_chan.Cal) - + m = moose.connect(pulse, 'output', dend, 'injectMsg') moose.connect(vmtab, 'requestOut', dend, 'getVm') - + chan = addOneChan('CaL12', gbar, dend) moose.connect(gktab, 'requestOut', chan, 'getGk') diff --git a/moose-core/tests/python/test_function.py b/moose-core/tests/python/test_function.py index 6e20c34fa0680688ae3a7954088fa9fda61e7daf..3ba99164289c2b5d23cba7419de448700c846567 100644 --- a/moose-core/tests/python/test_function.py +++ b/moose-core/tests/python/test_function.py @@ -1,47 +1,48 @@ -# test_function.py --- -# +# -*- coding: utf-8 -*- +# test_function.py --- +# # Filename: test_function.py -# Description: +# Description: # Author: subha -# Maintainer: +# Maintainer: # Created: Sat Mar 28 19:34:20 2015 (-0400) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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""" @@ -106,5 +107,5 @@ if __name__ == '__main__': test_var_order() -# +# # test_function.py ends here diff --git a/moose-core/tests/python/test_gc.py b/moose-core/tests/python/test_gc.py index 91b48f714d4ef172921253a05e01de8f86f262a8..5ae78d0ec4573f629625a23bb7cb784e5f82d337 100644 --- a/moose-core/tests/python/test_gc.py +++ b/moose-core/tests/python/test_gc.py @@ -1,47 +1,48 @@ -# test_gc.py --- -# +# -*- coding: utf-8 -*- +# test_gc.py --- +# # Filename: test_gc.py -# Description: +# Description: # Author: Subhasis Ray -# Maintainer: +# Maintainer: # Created: Mon May 19 10:25:13 2014 (+0530) -# Version: -# Last-Updated: -# By: +# Version: +# Last-Updated: +# By: # Update #: 0 -# URL: -# Keywords: -# Compatibility: -# -# +# URL: +# Keywords: +# Compatibility: +# +# -# Commentary: -# -# -# -# +# 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: """Test script for memory allocation and garbage collection issues.""" @@ -69,17 +70,17 @@ classes = [ 'DiffAmp', 'IntFire', 'MgBlock',] - + def allocate_large_vecs(m, n): """Allocate m vecs with n elements each""" test = moose.Neutral('/test') - ret = [] + ret = [] for jj, mclass in zip(range(m), cycle(classes)): eval_str = 'moose.vec(path="%s/%s_%d", n=%d, dtype="%s")' % (test.path, mclass, jj, n, - mclass) + mclass) mobj = eval(eval_str) print('Created', mobj.path) ret.append(mobj) @@ -116,7 +117,7 @@ def check_vector_field(m, n): return tabs import numpy as np - + if __name__ == '__main__': np_arrays = [] for ii in range(3): @@ -133,5 +134,5 @@ if __name__ == '__main__': -# +# # test_gc.py ends here diff --git a/moose-core/tests/python/test_hsolve_externalCalcium.py b/moose-core/tests/python/test_hsolve_externalCalcium.py index 9519d86379f585d22391e3e32ccb0244e836926c..f6e149f486f85145c53933ea4d50a8e4ceecd7c0 100644 --- a/moose-core/tests/python/test_hsolve_externalCalcium.py +++ b/moose-core/tests/python/test_hsolve_externalCalcium.py @@ -1,4 +1,5 @@ -# Test scripts are always called from BUILD directory by cmake. +# -*- coding: utf-8 -*- +# Test scripts are always called from BUILD directory by cmake. import os import sys @@ -31,7 +32,7 @@ if __name__ =='__main__': for tick in range(0, 7): moose.setClock(tick,10e-6) moose.setClock(8, 0.005) - + lib = moose.Neutral('/library') model = moose.loadModel(p_file,'neuron') pulse = moose.PulseGen('/neuron/pulse') @@ -42,7 +43,7 @@ if __name__ =='__main__': pulse.width[0] = 500e-12 pulse.level[0] = inject pulse.delay[1] = 1e9 - + for comp in moose.wildcardFind('/neuron/#[TYPE=Compartment]'): new_comp = moose.element(comp) new_comp.initVm = -.08 @@ -53,10 +54,8 @@ if __name__ =='__main__': moose.connect(chan, "IkOut", difs[0], "influx") if 'SK' in name: - moose.connect(difs[0], 'concentrationOut', chan, 'concen') - - - + moose.connect(difs[0], 'concentrationOut', chan, 'concen') + data = moose.Neutral('/data') vmtab = moose.Table('/data/Vm') shelltab = moose.Table('/data/Ca') @@ -66,7 +65,7 @@ if __name__ =='__main__': moose.connect(shelltab, 'requestOut', difs[0], 'getC') moose.connect(caltab,'requestOut',moose.element('/neuron/soma/CaL12') ,'getGk') moose.connect(sktab,'requestOut', moose.element('/neuron/soma/SK'),'getGk') - + hsolve = moose.HSolve('/neuron/hsolve') hsolve.dt = 10e-6 hsolve.target = ('/neuron/soma') @@ -79,4 +78,3 @@ if __name__ =='__main__': assert_stat( vec2, [ 5.0e-5, 5.075007e-5, 5.036985e-5, 2.1950117e-7] ) assert len(np.where(sktab.vector<1e-19)[0]) == 2001 assert len(np.where(shelltab.vector>50e-6)[0]) == 2000 - diff --git a/moose-core/tests/python/test_kkit.py b/moose-core/tests/python/test_kkit.py index b9bc6b81c1a0fd9d347cf05af053c31161e23754..de2a1c692ddcd9243f2262fd314d853c76215eaf 100644 --- a/moose-core/tests/python/test_kkit.py +++ b/moose-core/tests/python/test_kkit.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import matplotlib # Tests may be run over ssh without -X e.g. on travis. matplotlib.use( 'Agg' ) @@ -12,7 +13,7 @@ scriptdir = os.path.dirname( os.path.realpath( __file__ ) ) print( 'Script dir %s' % scriptdir ) def main(): - """ This example illustrates loading, running, and saving a kinetic model + """ This example illustrates loading, running, and saving a kinetic model defined in kkit format. It uses a default kkit model but you can specify another using the command line ``python filename runtime solver``. We use the gsl solver here. The model already defines a couple of plots and sets the runtime to 20 seconds. """ solver = "gsl" # Pick any of gsl, gssa, ee.. @@ -27,13 +28,13 @@ def main(): if ( len( sys.argv ) == 4 ): solver = sys.argv[3] modelId = moose.loadModel( mfile, 'model', solver ) - # Increase volume so that the stochastic solver gssa + # Increase volume so that the stochastic solver gssa # gives an interesting output #compt = moose.element( '/model/kinetics' ) - #compt.volume = 1e-19 + #compt.volume = 1e-19 moose.reinit() - moose.start( runtime ) + moose.start( runtime ) # Report parameters ''' @@ -53,7 +54,7 @@ def main(): vals = x.vector stats = [ vals.min(), vals.max( ), vals.mean(), vals.std( ) ] expected = [ 0.0, 0.00040464 , 0.0001444 , 0.00013177 ] - assert numpy.allclose(stats, expected, rtol=1e-4) , 'Got %s expected %s' % (stats, expected ) + assert numpy.allclose(stats, expected, rtol=1e-4) , 'Got %s expected %s' % (stats, expected ) plt.legend() plt.savefig( '%s.png' % sys.argv[0] ) print( 'Wrote results to %s.png' % sys.argv[0] ) diff --git a/moose-core/tests/python/test_ksolve.py b/moose-core/tests/python/test_ksolve.py index 1b6c210af793091083f1c8d0fcb08062b7201833..f70d889d8a4c606d35583b3c53165d9239cca620 100644 --- a/moose-core/tests/python/test_ksolve.py +++ b/moose-core/tests/python/test_ksolve.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import sys import numpy as np import time @@ -31,7 +32,7 @@ ksolve = moose.Ksolve( '/compt/ksolve' ) stoich = moose.Stoich( '/compt/stoich' ) stoich.compartment = compt stoich.ksolve = ksolve -stoich.path = '/compt/##' +stoich.path = '/compt/##' moose.reinit() print( '[INFO] Using method = %s' % ksolve.method ) t1 = time.time() @@ -42,7 +43,7 @@ expected = [ 7.77859 , 2.77858 , 2.27541 , 6.12141 , 7.77858 , 2.77858 , 2.77858 , 2.27541 , 6.12141 , 7.77858 , 2.77858 , 2.27541 , 6.12141 , 7.77858 , 2.77858 , 2.27541 , 6.12141 , 7.77858 , 2.77858 , 2.27541 , 6.12141 , 7.77858 , 2.77858 , 2.27541 , 6.12141 , 7.77858 , 2.77858 - , 2.27541 , 6.12141 , 7.77858 , 2.77858 , 2.27541 , 6.12141 + , 2.27541 , 6.12141 , 7.77858 , 2.77858 , 2.27541 , 6.12141 ] concs = [ p.conc for p in pools ] if(not np.isclose( concs, expected ).all() ): diff --git a/moose-core/tests/python/test_moogli.py b/moose-core/tests/python/test_moogli.py index 98e9ffb9b08c74b82efc9acebfa10d1664a48f15..8533a395748a6a840aa4d4606b1ab35de776dd7a 100644 --- a/moose-core/tests/python/test_moogli.py +++ b/moose-core/tests/python/test_moogli.py @@ -1,9 +1,10 @@ -"""test_moogli.py: +# -*- coding: utf-8 -*- +"""test_moogli.py: Some sanity tests on moogli """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] diff --git a/moose-core/tests/python/test_moose_paths.py b/moose-core/tests/python/test_moose_paths.py index 210c579f3d9364b5a21e372cd8d6f047733edcfe..7992d0c005b69782b0edefa1e3b93d3778d652b4 100644 --- a/moose-core/tests/python/test_moose_paths.py +++ b/moose-core/tests/python/test_moose_paths.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import moose import re diff --git a/moose-core/tests/python/test_mumbl.py b/moose-core/tests/python/test_mumbl.py index 8e3686554f23d38ec913c7af70096a185fca32d2..702d0c2386cf4a114335aa2d13f17aab11609664 100644 --- a/moose-core/tests/python/test_mumbl.py +++ b/moose-core/tests/python/test_mumbl.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # This file is part of MOOSE simulator: http://moose.ncbs.res.in. # MOOSE is free software: you can redistribute it and/or modify @@ -13,14 +14,14 @@ # along with MOOSE. If not, see <http://www.gnu.org/licenses/>. -"""test_mumbl.py: +"""test_mumbl.py: A test script to test MUMBL support in MOOSE. Last modified: Fri Jun 13, 2014 06:30PM """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, NCBS Bangalore" __credits__ = ["NCBS Bangalore", "Bhalla Lab"] @@ -58,6 +59,6 @@ def main(): , outfile = '%s.png' % sys.argv[0] , subplot = True ) - + if __name__ == '__main__': main() diff --git a/moose-core/tests/python/test_neuroml.py b/moose-core/tests/python/test_neuroml.py index 733e9cc174e3fb19f504a0e781aa483218e5a116..b6174b611b502994135266ddbb4dbcd81331f7f9 100644 --- a/moose-core/tests/python/test_neuroml.py +++ b/moose-core/tests/python/test_neuroml.py @@ -1,9 +1,10 @@ -"""ca1_test.py: +# -*- coding: utf-8 -*- +"""ca1_test.py: Testing scripts for CA1. """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] diff --git a/moose-core/tests/python/test_nsdf.py b/moose-core/tests/python/test_nsdf.py index 5873a7ed5250409ca62f9faed0ffd1aad75b81f0..3a4da9fcc449d159c5376eb507642420ba0ec8bf 100644 --- a/moose-core/tests/python/test_nsdf.py +++ b/moose-core/tests/python/test_nsdf.py @@ -1,4 +1,5 @@ -# test_nsdf.py --- +# -*- coding: utf-8 -*- +# test_nsdf.py --- # Changed from nsdf.py from # https://github.com/BhallaLab/moose-examples/snippets/nsdf.py @@ -64,7 +65,7 @@ def setup_model(): this simulation we generate square pules from a PulseGen object and use a SpikeGen to detect the threshold crossing events of rising edges. We store the pulsegen output as Uniform data and the threshold -crossing times as Event data. ''' +crossing times as Event data. ''' nsdf.stringAttr['creator'] = getpass.getuser() nsdf.stringVecAttr['software'] = ['python2.7', 'moose3' ] nsdf.stringVecAttr['method'] = [''] @@ -75,7 +76,7 @@ crossing times as Event data. ''' nsdf.stringAttr['/data/uniform/PulseGen/outputValue/tunit'] = 's' nsdf.stringAttr['/data/uniform/PulseGen/outputValue/unit'] = 'A' eventDataPath = '/data/event/SpikeGen/spikeOut/{}_{}_{}/unit'.format(t_lead.vec.value, - t_lead.getDataIndex(), + t_lead.getDataIndex(), t_lead.fieldIndex) nsdf.stringAttr[eventDataPath] = 's' diff --git a/moose-core/tests/python/test_pymoose.py b/moose-core/tests/python/test_pymoose.py index b14a946b897b051abe02a15ff17f09ab8f0cf671..903b419989da3f6b110a1e8fdf36538fb5cb476e 100644 --- a/moose-core/tests/python/test_pymoose.py +++ b/moose-core/tests/python/test_pymoose.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import print_function import sys try: @@ -28,7 +29,7 @@ class TestVec(unittest.TestCase): em = moose.vec('testIndexError', n=3, g=1, dtype='Neutral') with self.assertRaises(IndexError): el = em[5] - + def testSlice(self): em = moose.vec('/testSlice', n=10, g=1, dtype='Neutral') sl = em[5:8] @@ -70,7 +71,7 @@ class TestNeutral(unittest.TestCase): else: for oid in oidlist: self.assertEqual(hash(oid), oid.vec.value >> 48 | oid.dindex >> 16 | oid.findex) - + class TestNeutral1(unittest.TestCase): def setUp(self): @@ -85,7 +86,7 @@ class TestNeutral1(unittest.TestCase): print(self.a_path, self.b_path) print(self.a.path, self.b.path) print(len(self.c.vec), self.c_len) - + def testNew(self): self.assertTrue(moose.exists(self.a_path)) @@ -93,7 +94,7 @@ class TestNeutral1(unittest.TestCase): self.assertTrue(moose.exists(self.b_path)) def testNewChildWithSingleDim(self): - self.assertTrue(moose.exists(self.c_path)) + self.assertTrue(moose.exists(self.c_path)) def testDimension(self): self.assertEqual(self.c.vec.shape[0], self.c_len) @@ -147,7 +148,7 @@ class TestNeutral1(unittest.TestCase): self.assertTrue(id2 > id1) self.assertTrue(id2 >= id1) self.assertTrue(id1 <= id2) - + def testRename(self): """Rename an element in a Id and check if that was effective. This tests for setting values also.""" @@ -188,10 +189,10 @@ class TestWildcardFind(unittest.TestCase): # This causes a lot of error message from SetGet::strGet - can # we combine conditions with logical operators? # '/x[]/##[(ISA=IntFire) AND (FIELD(Vm)<0)]' - yless = moose.wildcardFind('/x[]/##[FIELD(Vm)<0]') + yless = moose.wildcardFind('/x[]/##[FIELD(Vm)<0]') self.assertEqual(set(yless), set(self.y.vec[:5])) - - + + # class TestPyMooseGlobals(unittest.TestCase): # def setUp(self): # path1 = 'neutral%d' % (uuid.uuid4().int) @@ -219,14 +220,14 @@ class TestWildcardFind(unittest.TestCase): # self.assertTrue(isinstance(x, moose.Neutral)) # self.assertEqual(x.path, self.src1.path) # self.assertRaises(NameError, moose.element, 'abracadabra') - + class TestMessages(unittest.TestCase): def setUp(self): path1 = '/comp%d' % (uuid.uuid4().int) path2 = '/comp%d' % (uuid.uuid4().int) self.src1 = moose.Compartment(path1) - self.dest1 = moose.Compartment(path2) + self.dest1 = moose.Compartment(path2) def testConnect(self): print('Testing connect ...', end=' ') @@ -257,7 +258,7 @@ class TestMessages(unittest.TestCase): # print 'Testing getInMessageDict ...', # indict = self.src1.getInMessageDict() # self.assertTrue('parentMsg' in indict) - + # class TestNeighbors(unittest.TestCase): # def setUp(self): @@ -266,7 +267,7 @@ class TestMessages(unittest.TestCase): # self.table = moose.Table('table') # moose.connect(self.table, 'requestData', self.compartment, 'get_Im') # moose.connect(self.pulsegen, 'output', self.compartment, 'injectMsg') - + # def testNeighborDict(self): # print 'Testing neighbour dict ...' # neighbors = self.compartment.neighborDict @@ -275,7 +276,7 @@ class TestMessages(unittest.TestCase): # self.assertTrue(self.compartment.oid_ in [n.oid_ for n in self.pulsegen.neighborDict['output']]) # self.assertTrue(self.compartment.oid_ in [n.oid_ for n in self.table.neighborDict['requestData']]) # print 'OK' - + class TestDelete(unittest.TestCase): def setUp(self): self.oid = moose.Neutral('testDelete') @@ -307,11 +308,11 @@ class TestFieldAccess(unittest.TestCase): # cwe = moose.getCwe() # self.model = moose.loadModel('../Demos/Genesis_files/Kholodenko.g', '%s/kholodenko' % (self.container.path)) # moose.setCwe(cwe) - + # def testVecUnsigned(self): # x = moose.element('%s/kinetics' % (self.model.path)) # self.assertTrue(len(x.meshToSpace) > 0) - + if __name__ == '__main__': print('PyMOOSE Regression Tests:') unittest.main() diff --git a/moose-core/tests/python/test_pyrun.py b/moose-core/tests/python/test_pyrun.py index 1aed223d4c0b62cf588c2ce496d71df556cc034c..7bb7129312dd0becded75fa9f2c3d233d606eee3 100644 --- a/moose-core/tests/python/test_pyrun.py +++ b/moose-core/tests/python/test_pyrun.py @@ -1,2 +1,3 @@ +# -*- coding: utf-8 -*- import moose moose.PyRun('/p') diff --git a/moose-core/tests/python/test_random_gen.sh b/moose-core/tests/python/test_random_gen.sh index fa5f9af3b0a6eba2d8b50c58db4abf080e82f6e4..95c9576cb899d8a7d0eec024788793a1f9fa1d2f 100755 --- a/moose-core/tests/python/test_random_gen.sh +++ b/moose-core/tests/python/test_random_gen.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash PYTHON_EXECUTABLE=${1:-/usr/bin/python} -if [ $2 ]; then +if [ $2 ]; then export PYTHONPATH="$2" fi FAILED=0 @@ -36,7 +36,7 @@ else FAILED=1 fi -if [ $FAILED -eq 1 ]; then +if [ $FAILED -eq 1 ]; then exit 1 else exit 0; diff --git a/moose-core/tests/python/test_sbml.py b/moose-core/tests/python/test_sbml.py index 4a7163ecede113bfa555e78f91266c9108bcd400..64b90bfb3dc403f35277cbc9b8bff3161aca8360 100644 --- a/moose-core/tests/python/test_sbml.py +++ b/moose-core/tests/python/test_sbml.py @@ -1,7 +1,8 @@ +# -*- coding: utf-8 -*- """ Test SBML capabilities of PyMOOSE """ - + __author__ = "Dilawar Singh, HarshaRani" __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] diff --git a/moose-core/tests/python/test_snippets.py b/moose-core/tests/python/test_snippets.py index c0e70356140d812d30c68bddf2d3a81c81683ff7..c956f27a82084b2fd3f6f5a9e445e218ff7b41e8 100644 --- a/moose-core/tests/python/test_snippets.py +++ b/moose-core/tests/python/test_snippets.py @@ -1,10 +1,11 @@ -"""test_snippets.py: +# -*- coding: utf-8 -*- +"""test_snippets.py: This script tests all the snippets. """ from __future__ import print_function - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] diff --git a/moose-core/tests/python/test_streamer.py b/moose-core/tests/python/test_streamer.py index 099b0cdb07c633ab963358eb8d1063c0e5003bc5..43387df4b69d0fe08a6302bce55ee7af0d6e3ff9 100644 --- a/moose-core/tests/python/test_streamer.py +++ b/moose-core/tests/python/test_streamer.py @@ -1,9 +1,10 @@ -"""test_streamer.py: +# -*- coding: utf-8 -*- +"""test_streamer.py: Test script for Streamer class. """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2016, Dilawar Singh" __credits__ = ["NCBS Bangalore"] @@ -25,7 +26,7 @@ def sanity_test( ): b = moose.Table( '/t1/t1' ) c = moose.Table( '/t1/t1/t1' ) print(a) - print(b) + print(b) print(c) st = moose.Streamer( '/s' ) @@ -111,8 +112,8 @@ def test( ): # Total rows should be 58 (counting zero as well). # print(data) # print( data.dtype ) - time = data['time'] - print( time ) + time = data['time'] + print( time ) assert data.shape >= (58,), data.shape print( '[INFO] Test 2 passed' ) return 0 diff --git a/moose-core/tests/python/test_synchan.py b/moose-core/tests/python/test_synchan.py index 9873c16507d83d6a2865e010260c947761d9d8ad..46e1206e23cba776f15cd44e03ffdab805c63ed5 100644 --- a/moose-core/tests/python/test_synchan.py +++ b/moose-core/tests/python/test_synchan.py @@ -1,4 +1,5 @@ -# test_synchan.py --- +# -*- coding: utf-8 -*- +# test_synchan.py --- import moose print( 'Using moose from %s' % moose.__file__ ) @@ -13,11 +14,11 @@ def make_synapse(path): syn.Gk = 1.0 # mS syn.Ek = 0.0 - ## NOTE: This is old implementation. + ## NOTE: This is old implementation. #syn.synapse.num = 1 ## syn.bufferTime = 1.0 # ms #syn.synapse.delay = 1.0 - #syn.synapse.weight = 1.0 + #syn.synapse.weight = 1.0 #print 'Synapses:', len(syn.synapse), 'w=', syn.synapse[0].weight # IN new implementation, there is SimpleSynHandler class which takes cares @@ -26,7 +27,7 @@ def make_synapse(path): synH.synapse.num = 1 ## syn.bufferTime = 1.0 # ms synH.synapse.delay = 1.0 - synH.synapse.weight = 1.0 + synH.synapse.weight = 1.0 synH.connect('activationOut', syn, 'activation') print(('Synapses:', len(synH.synapse), 'w=', synH.synapse[0].weight )) @@ -35,7 +36,7 @@ def make_synapse(path): spikegen.refractT = 10.0 # With this setting it will fire at 1 s / 10 ms = 100 Hz spikegen.threshold = 0.5 # This will send alternatind -1 and +1 to SpikeGen to make it fire - spike_stim = moose.PulseGen('%s/spike_stim' % (syn.parent.path)) + spike_stim = moose.PulseGen('%s/spike_stim' % (syn.parent.path)) spike_stim.delay[0] = 1.0 spike_stim.level[0] = 1.0 spike_stim.width[0] = 100.0 @@ -54,5 +55,5 @@ if __name__ == '__main__': moose.start(100) -# +# # test_synchan.py ends here diff --git a/moose-core/tests/python/test_table_streaming_support.py b/moose-core/tests/python/test_table_streaming_support.py index 868f5a2d42173f5fbfaba885283d299c6a14b047..0747ef66d52a300c84bafb00a7de143aee996fa6 100644 --- a/moose-core/tests/python/test_table_streaming_support.py +++ b/moose-core/tests/python/test_table_streaming_support.py @@ -1,9 +1,10 @@ -"""test_table_streaming_support.py: +# -*- coding: utf-8 -*- +"""test_table_streaming_support.py: Test the streaming support in moose.Table. """ - + __author__ = "Dilawar Singh" __copyright__ = "Copyright 2016, Dilawar Singh" __credits__ = ["NCBS Bangalore"] @@ -21,9 +22,9 @@ print( '[INFO] Using moose form %s' % moose.__file__ ) def print_table( table ): msg = "" - msg += " outfile : %s" % table.outfile - msg += " useStreamer: %s" % table.useStreamer - msg += ' Path: %s' % table.path + msg += " outfile : %s" % table.outfile + msg += " useStreamer: %s" % table.useStreamer + msg += ' Path: %s' % table.path print( msg ) def test( ): diff --git a/moose-core/tests/python/test_vec.py b/moose-core/tests/python/test_vec.py index 7b3489c1163943994f62c2e5e3dc6a9cccd63da1..c3ad5c1ef3d5bd114d1890c644a0d958b72a85c6 100644 --- a/moose-core/tests/python/test_vec.py +++ b/moose-core/tests/python/test_vec.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import moose foo = moose.Pool('/foo1', 500) bar = moose.vec('/foo1') diff --git a/moose-core/utility/Annotator.cpp b/moose-core/utility/Annotator.cpp index 9592c44aa0539f907bf5946e0534543fff4743ac..184ab6b668df8c1dfd06ce405b2182a3fc6e63ea 100644 --- a/moose-core/utility/Annotator.cpp +++ b/moose-core/utility/Annotator.cpp @@ -116,8 +116,8 @@ const Cinfo* Annotator::initCinfo() static const Cinfo* annotatorCinfo = Annotator::initCinfo(); Annotator::Annotator() - : x_( 0.0 ), y_( 0.0 ), z_( 0.0 ), - notes_( "" ), color_( "white" ), textColor_( "black" ), + : x_( 0.0 ), y_( 0.0 ), z_( 0.0 ), + notes_( "" ), color_( "white" ), textColor_( "black" ), icon_( "sphere" ),solver_( "gsl"),runtime_(100.0),dirpath_(""),modeltype_("") { ; diff --git a/moose-core/utility/Annotator.h b/moose-core/utility/Annotator.h index 3dce201cc651e60ff802d8050c2aa50813707d66..8dd4e5d5b78bac44dcaf07a52a57118cb56e94fd 100644 --- a/moose-core/utility/Annotator.h +++ b/moose-core/utility/Annotator.h @@ -11,13 +11,13 @@ class Annotator { - public: + public: Annotator(); - + //////////////////////////////////////////////////////////////// // Field assignment stuff. //////////////////////////////////////////////////////////////// - + double getX() const; void setX( double v ); double getY() const; diff --git a/moose-core/utility/CMakeLists.txt b/moose-core/utility/CMakeLists.txt index 8e368b2ce6d0a44f11984c44841bea7a9e8b7c96..67e180ed0c76160676bff86d0cd124299c2de5c4 100644 --- a/moose-core/utility/CMakeLists.txt +++ b/moose-core/utility/CMakeLists.txt @@ -1,13 +1,13 @@ IF(WITH_BOOST) include(CheckIncludeFiles) -check_include_files( ${Boost_INCLUDE_DIRS}/boost/random/random_device.hpp +check_include_files( ${Boost_INCLUDE_DIRS}/boost/random/random_device.hpp BOOST_RANDOM_DEVICE_EXISTS ) endif(WITH_BOOST) include_directories(../msg) include_directories(../basecode) -add_library(utility +add_library(utility strutil.cpp types.cpp setupenv.cpp diff --git a/moose-core/utility/Vec.cpp b/moose-core/utility/Vec.cpp index d68c58c8feefed179e783b60e3c48f8212ead92a..2233ba1e0297c1f7d0e7c5646bb43b7f4903b764 100644 --- a/moose-core/utility/Vec.cpp +++ b/moose-core/utility/Vec.cpp @@ -52,16 +52,16 @@ void Vec::orthogonalAxes( Vec& u, Vec& v ) const { Vec Vec::pointOnLine( const Vec& end, double k ) { - return Vec( + return Vec( a0_ + k * ( end.a0_ - a0_ ), a1_ + k * ( end.a1_ - a1_ ), a2_ + k * ( end.a2_ - a2_ ) ); } bool Vec::operator==( const Vec& other ) const { - return - doubleEq( a0_, other.a0_) && - doubleEq( a1_, other.a1_) && + return + doubleEq( a0_, other.a0_) && + doubleEq( a1_, other.a1_) && doubleEq( a2_, other.a2_); } diff --git a/moose-core/utility/Vec.h b/moose-core/utility/Vec.h index 054db3188e285c30269496682f5efb67e247372a..6b5b4be10f843e8b32a5f377f86bb2a5262a6b5f 100644 --- a/moose-core/utility/Vec.h +++ b/moose-core/utility/Vec.h @@ -57,7 +57,7 @@ class Vec { Vec operator*( const double& other ) const; private: - double a0_; + double a0_; double a1_; double a2_; }; diff --git a/moose-core/utility/cnpy.cpp b/moose-core/utility/cnpy.cpp index 60d7717598bdba86c73da564d704e55d8a5d3200..4acc65580e111f05df03dcbfb3518173df9cd61e 100644 --- a/moose-core/utility/cnpy.cpp +++ b/moose-core/utility/cnpy.cpp @@ -24,7 +24,7 @@ using namespace std; namespace cnpy2 { -// Check the endian-ness of machine at run-time. This is from library +// Check the endian-ness of machine at run-time. This is from library // https://github.com/rogersce/cnpy char BigEndianTest() { unsigned char x[] = {1,0}; @@ -60,7 +60,7 @@ char map_type(const std::type_info& t) else return '?'; } -void split(vector<string>& strs, string& input, const string& pat) +void split(vector<string>& strs, string& input, const string& pat) { char* pch; pch = strtok( &input[0], pat.c_str() ); @@ -75,7 +75,7 @@ void split(vector<string>& strs, string& input, const string& pat) /** * @brief Check if a numpy file is sane or not. * - * Read first 8 bytes and compare with standard header. + * Read first 8 bytes and compare with standard header. * * @param npy_file Path to file. * @@ -119,12 +119,12 @@ void parse_header( FILE* fp, string& header ) /** * @brief Change shape in numpy header. * - * @param + * @param * @param data_len - * @param + * @param */ void change_shape_in_header( const string& filename - , const size_t data_len, const size_t numcols + , const size_t data_len, const size_t numcols ) { string header; @@ -154,7 +154,7 @@ void change_shape_in_header( const string& filename split( tokens, shapeStr, "," ); string newShape = ""; - for (size_t i = 0; i < tokens.size(); i++) + for (size_t i = 0; i < tokens.size(); i++) newShape += moose::toString( atoi( tokens[i].c_str() ) + data_len/numcols ) + ","; string newHeader = prefixHeader + newShape + postfixHeader + "\n"; diff --git a/moose-core/utility/cnpy.hpp b/moose-core/utility/cnpy.hpp index 2a824adbcbf318ee0662a3530e9c02dc3fb975cc..afbc0e71de23496ede1b6db67f42631c493d017b 100644 --- a/moose-core/utility/cnpy.hpp +++ b/moose-core/utility/cnpy.hpp @@ -3,9 +3,9 @@ * * Filename: cnpy.h * - * Description: Write a stl vector to numpy format 2. + * Description: Write a stl vector to numpy format 2. * - * This program is part of MOOSE simulator. + * This program is part of MOOSE simulator. * * Version: 1.0 * Created: 05/04/2016 10:36:19 AM @@ -47,7 +47,7 @@ using namespace std; namespace cnpy2 { -// Check the endian-ness of machine at run-time. This is from library +// Check the endian-ness of machine at run-time. This is from library // https://github.com/rogersce/cnpy char BigEndianTest(); @@ -59,7 +59,7 @@ void split(vector<string>& strs, string& input, const string& pat); /** * @brief Check if a numpy file is sane or not. * - * Read first 8 bytes and compare with standard header. + * Read first 8 bytes and compare with standard header. * * @param npy_file Path to file. * @@ -77,12 +77,12 @@ void parse_header( FILE* fp, string& header ); /** * @brief Change shape in numpy header. * - * @param + * @param * @param data_len - * @param + * @param */ void change_shape_in_header( const string& filename - , const size_t data_len, const size_t numcols + , const size_t data_len, const size_t numcols ); static const unsigned int __pre__size__ = 8; @@ -92,7 +92,7 @@ static char __pre__[__pre__size__] = { }; template< typename T> -void write_header( +void write_header( FILE* fp , const vector<string>& colnames , vector<unsigned int>shape , char version @@ -111,7 +111,7 @@ void write_header( dict += "], 'fortran_order': False, 'shape': ("; dict += moose::toString(shape[0]); - for(size_t i = 1; i < shape.size(); i++) + for(size_t i = 1; i < shape.size(); i++) { dict += ","; dict += moose::toString(shape[i]); @@ -127,7 +127,7 @@ void write_header( // memory. dict += string(11, ' '); /* 32 bit number is fit */ - // pad with spaces so that preamble+headerlen+dict is modulo 16 bytes. + // pad with spaces so that preamble+headerlen+dict is modulo 16 bytes. // preamble is 8 bytes, header len is 4 bytes, total 12. // dict needs to end with \n unsigned int remainder = 16 - (12 + dict.size()) % 16; @@ -156,11 +156,11 @@ void write_header( // write to version 1 or version 2. template<typename T> -void save_numpy( - const string& outfile +void save_numpy( + const string& outfile , const vector<double>& vec , vector<string> colnames - , const string openmode + , const string openmode , const char version = '1' ) { @@ -199,7 +199,7 @@ void save_numpy( } else if(! is_valid_numpy_file( fp ) ) { - moose::showWarn( outfile + " is not a valid numpy file" + moose::showWarn( outfile + " is not a valid numpy file" + " I am not goind to write to it" ); return; diff --git a/moose-core/utility/current_function.hpp b/moose-core/utility/current_function.hpp index 5eeae0ffc5871dd4720f4f3519b52d8f60b0afed..6221132977604d07d4ccb238b32cf3f1d0febd70 100644 --- a/moose-core/utility/current_function.hpp +++ b/moose-core/utility/current_function.hpp @@ -8,7 +8,7 @@ #endif // -// Modified boost/current_function.hpp +// Modified boost/current_function.hpp // // SIMPLE_CURRENT_FUNCTION // diff --git a/moose-core/utility/matrix_util.cpp b/moose-core/utility/matrix_util.cpp index 030a1c66210d05e43ea42bd632a0e0c07a5ba697..7db63a81721337d3b87fbb71d083d066d53d47bd 100644 --- a/moose-core/utility/matrix_util.cpp +++ b/moose-core/utility/matrix_util.cpp @@ -38,14 +38,14 @@ void swapRows( ublas::matrix< value_type >& mat, unsigned int r1, unsigned int r2) { ublas::vector<value_type> temp( mat.size2() ); - for (size_t i = 0; i < mat.size2(); i++) + for (size_t i = 0; i < mat.size2(); i++) { temp[i] = mat(r1, i ); mat(r1, i ) = mat(r2, i ); } - for (size_t i = 0; i < mat.size2(); i++) - mat(r2, i) = temp[i]; + for (size_t i = 0; i < mat.size2(); i++) + mat(r2, i) = temp[i]; } diff --git a/moose-core/utility/matrix_util.h b/moose-core/utility/matrix_util.h index 47030d321803cbf6611d4602a196bd552bc98ef5..9b232abbc1f86cbba76ac8bd02afc68f2b04a0c6 100644 --- a/moose-core/utility/matrix_util.h +++ b/moose-core/utility/matrix_util.h @@ -38,5 +38,5 @@ void eliminateRowsBelow( ublas::matrix< value_type >& U, int start, int leftCol unsigned int rankUsingBoost( ublas::matrix<value_type>& U ); -#endif +#endif #endif /* ----- #ifndef matrix_util_INC ----- */ diff --git a/moose-core/utility/numutil.cpp b/moose-core/utility/numutil.cpp index f7f0ec10a057bc9204df8ae922ebc7ab01b375e3..240b125f8d888e1889566e5d50ed27c4625b2e01 100644 --- a/moose-core/utility/numutil.cpp +++ b/moose-core/utility/numutil.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: numutil.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray dot subhasis at gmail dot com * Created: 2007-11-02 11:46:40 @@ -29,7 +29,7 @@ bool almostEqual(float x, float y, float epsilon) if (x == 0.0 && y == 0.0) { return true; } - + if (fabs(x) > fabs(y)) { return fabs((x - y) / x) < epsilon; } else { diff --git a/moose-core/utility/numutil.h b/moose-core/utility/numutil.h index f3417ce16524480f37b613fcfccda4529b697316..01ed6e2abbe4c3669533dbed425c64b576235433 100644 --- a/moose-core/utility/numutil.h +++ b/moose-core/utility/numutil.h @@ -1,6 +1,6 @@ /******************************************************************* * File: numutil.h - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray dot subhasis at gmail dot com * Created: 2007-11-02 11:47:21 @@ -31,7 +31,7 @@ const double NATURAL_E = 2.718281828459045; //extern const double EPSILON; #ifndef M_PI -#define M_PI 3.14159265358979323846 +#define M_PI 3.14159265358979323846 #endif #ifndef M_E @@ -59,7 +59,7 @@ bool isInfinity( T value ) * Algorithm (from Knuth) 'a' and 'b' are close if: * | ( a - b ) / a | < e AND | ( a - b ) / b | < e * where 'e' is a small number. - * + * * In this function, 'e' is computed as: * e = tolerance * machine-epsilon */ diff --git a/moose-core/utility/print_function.hpp b/moose-core/utility/print_function.hpp index 885b88cde0298ca509a5b74f433e59930584cb36..d8f5831f54a12267d19fe0190a2e7ce7f9d9d608 100644 --- a/moose-core/utility/print_function.hpp +++ b/moose-core/utility/print_function.hpp @@ -59,15 +59,15 @@ namespace moose { /** * @brief Enumerate type for debug and log. */ - enum serverity_level_ { - trace, debug, info , warning, fixme , error, fatal, failed + enum serverity_level_ { + trace, debug, info , warning, fixme , error, fatal, failed }; - static string levels_[9] = { - "TRACE", "DEBUG", "INFO", "WARNING", "FIXME" , "ERROR", "FATAL", "FAILED" + static string levels_[9] = { + "TRACE", "DEBUG", "INFO", "WARNING", "FIXME" , "ERROR", "FATAL", "FAILED" }; - /* + /* * === FUNCTION ============================================================== * Name: mapToString * Description: GIven a map, return a string representation of it. @@ -136,12 +136,12 @@ namespace moose { inline string debugPrint(string msg, string prefix = "DEBUG" , string color=T_RESET, unsigned debugLevel = 0 - ) + ) { stringstream ss; ss.str(""); if(debugLevel <= DEBUG_LEVEL) { - ss << setw(debugLevel/2) << "[" << prefix << "] " + ss << setw(debugLevel/2) << "[" << prefix << "] " << color << msg << T_RESET; } return ss.str(); @@ -149,7 +149,7 @@ namespace moose { /*----------------------------------------------------------------------------- * This function __dump__ a message onto console. Fills appropriate colors as - * needed. + * needed. *-----------------------------------------------------------------------------*/ inline void __dump__(string msg, serverity_level_ type = debug, bool autoFormat = true) @@ -172,7 +172,7 @@ namespace moose { { if('`' == msg[i]) { - if(!set and reset) + if(!set and reset) { set = true; reset = false; @@ -226,7 +226,7 @@ namespace moose { #ifdef NDEBUG #define LOG(t, a ) ((void)0); #else /* ----- not NDEBUG ----- */ -#define LOG(t, a) { stringstream __ss__; __ss__ << a; moose::__dump__(__ss__.str(), t ); } +#define LOG(t, a) { stringstream __ss__; __ss__ << a; moose::__dump__(__ss__.str(), t ); } #endif /* ----- not NDEBUG ----- */ /*----------------------------------------------------------------------------- @@ -250,12 +250,12 @@ namespace moose { * * @param msg String, message to be written. * @param type Type of the message. - * @param redirectToConsole + * @param redirectToConsole * @param removeTicks */ inline void log(string msg, serverity_level_ type = debug , bool redirectToConsole = true - , bool removeTicks = true + , bool removeTicks = true ) { diff --git a/moose-core/utility/setupenv.cpp b/moose-core/utility/setupenv.cpp index 4410f883f879e7b530cfb16ba9cff739596fd9b2..3d8b32714927c705d733c3f49aca4a5414323368 100644 --- a/moose-core/utility/setupenv.cpp +++ b/moose-core/utility/setupenv.cpp @@ -1,31 +1,31 @@ -// setupenv.cpp --- -// +// setupenv.cpp --- +// // Filename: setupenv.cpp -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Copyright (C) 2010 Subhasis Ray, all rights reserved. // Created: Sat Mar 26 22:36:10 2011 (+0530) -// Version: +// Version: // Last-Updated: Fri Aug 10 17:15:17 2012 (+0530) // By: subha // Update #: 31 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// -// -// -// +// Commentary: +// +// +// +// // Change log: -// -// -// +// +// +// // Code: @@ -70,7 +70,7 @@ namespace moose { unsigned int cores = getNumCores(); stringstream s; s << cores; - argmap.insert(pair<string, string>("NUMCORES", s.str())); + argmap.insert(pair<string, string>("NUMCORES", s.str())); } char * numNodes = getenv("NUMNODES"); if (numNodes != NULL){ @@ -108,5 +108,5 @@ namespace moose { } -// +// // setupenv.cpp ends here diff --git a/moose-core/utility/simple_assert.hpp b/moose-core/utility/simple_assert.hpp index 6ca992c812ea26e6c98d73a711753d45e492479d..78c41d8fd65969343c30fe95b58588664a3c15a7 100644 --- a/moose-core/utility/simple_assert.hpp +++ b/moose-core/utility/simple_assert.hpp @@ -21,7 +21,7 @@ // // mooseinspect:naassert_macro // -// Log: +// Log: // Thursday 01 May 2014 01:18:02 PM IST // // This files is a modified version of boost/assert.hpp file. The names of @@ -96,9 +96,9 @@ namespace moose #endif namespace moose - { - namespace assertion - { + { + namespace assertion + { namespace detail { inline void assertion_failed_msg(char const * expr, char const * msg, char const * function, diff --git a/moose-core/utility/simple_logger.hpp b/moose-core/utility/simple_logger.hpp index e2f1a477eaf4db43d2ae229b9c0f2f0e22f5d781..92e18ae68a6cc782e8e342015fe01f2feeea1643 100644 --- a/moose-core/utility/simple_logger.hpp +++ b/moose-core/utility/simple_logger.hpp @@ -12,22 +12,22 @@ * * Author: Dilawar Singh (), dilawars@ncbs.res.in * Organization: NCBS Bangalore - * + * * Copyright (C) 2014, Dilawar Singh, NCBS Bangalore - * + * * 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 2 of the License, 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; if not, see <http://www.gnu.org/licenses/>. - * + * * ============================================================================== */ @@ -84,7 +84,7 @@ class SimpleLogger { logSS << "\t<start_time>" << startTime << "</start_time>" << endl; logSS << "\t<messages>" << endl; -#ifdef OS_WINDOWS +#ifdef OS_WINDOWS outputFile = homeDir + "\\.moose\\log"; #else outputFile = homeDir + "/.moose/log"; @@ -101,7 +101,7 @@ class SimpleLogger { * * @return A string represeting current timestamp. */ - const std::string timeStamp() + const std::string timeStamp() { time_t now = time(0); struct tm tstruct; @@ -133,7 +133,7 @@ class SimpleLogger { stringstream ss; ss << title; - for(unsigned i = 0; i < width - title.size(); ++i) + for(unsigned i = 0; i < width - title.size(); ++i) ss << "~"; ss << endl; @@ -141,7 +141,7 @@ class SimpleLogger { for( it = m.begin(); it != m.end(); it++) ss << setw(width/2) << it->first << setw(width/2) << it->second << endl; - for(unsigned i = 0; i < width; ++i) + for(unsigned i = 0; i < width; ++i) ss << "="; ss << endl; @@ -210,9 +210,9 @@ class SimpleLogger { typename map<A, B>::const_iterator it; for(it = m.begin(); it != m.end(); it++) { - ss << prefix << prefix - << "<" << it->first << ">" - << it->second + ss << prefix << prefix + << "<" << it->first << ">" + << it->second << "</" << it->first << ">" << endl; } @@ -246,7 +246,7 @@ class SimpleLogger { logF.close(); return logSS.str(); } - + /** * @brief Checks if given directory path exists on system. * @@ -304,7 +304,7 @@ class SimpleLogger { { if('`' == msg[i]) { - if(!set and reset) + if(!set and reset) { set = true; reset = false; @@ -339,18 +339,18 @@ class SimpleLogger { * @param msg * @param level * - * @return + * @return */ std::string log(string type, const string& msg) { -#ifdef ENABLE_LOGGER +#ifdef ENABLE_LOGGER stringstream ss; string time = timeStamp(); fstream logF; logF.open(outputFile.c_str(), std::fstream::out | std::fstream::app); ss << "<" << type << " time=\"" << time << "\">"; ss << msg << "</" << type << ">" << endl; - logF << ss.str(); + logF << ss.str(); logF.close(); string newmsg = ss.str(); return newmsg; diff --git a/moose-core/utility/simple_test.hpp b/moose-core/utility/simple_test.hpp index e6ba411587480bcc2b4978228c27fec2b069c846..9772931b49b60c4c9ee58e43a3aa5d10c1657d5f 100644 --- a/moose-core/utility/simple_test.hpp +++ b/moose-core/utility/simple_test.hpp @@ -11,7 +11,7 @@ * Compiler: gcc * * Author: Dilawar Singh (), dilawars@ncbs.res.in - * Organization: + * Organization: * * ============================================================================== */ diff --git a/moose-core/utility/strutil.cpp b/moose-core/utility/strutil.cpp index 643e3baf9961bc3cc72064395b159a95c7fbf9bc..399d2d71ccf0b0babd2e810b03ec60e8c373e313 100644 --- a/moose-core/utility/strutil.cpp +++ b/moose-core/utility/strutil.cpp @@ -1,6 +1,6 @@ /******************************************************************* * File: StringUtil.cpp - * Description: + * Description: * Author: Subhasis Ray * E-mail: ray.subhasis@gmail.com * Created: 2007-09-25 12:12:10 @@ -16,7 +16,7 @@ namespace moose { // Adapted from code available on oopweb.com void tokenize( - const string& str, + const string& str, const string& delimiters, vector< string >& tokens ) { @@ -28,7 +28,7 @@ void tokenize( { // Found a token, add it to the vector. tokens.push_back( str.substr( begin, end - begin ) ); - + // Update boundaries begin = str.find_first_not_of( delimiters, end ); end = str.find_first_of( delimiters, begin ); @@ -53,9 +53,9 @@ std::string trim(const std::string myString, const string& delimiters) { if (myString.length() == 0 ) { - return myString; + return myString; } - + string::size_type end = myString.find_last_not_of(delimiters); string::size_type begin = myString.find_first_not_of(delimiters); @@ -63,8 +63,8 @@ std::string trim(const std::string myString, const string& delimiters) { return std::string(myString, begin, end-begin+1); } - - return ""; + + return ""; } std::string fix(const std::string userPath, const string& delimiters) @@ -93,7 +93,7 @@ std::string fix(const std::string userPath, const string& delimiters) int testTrim() { - std::string testStrings [] = + std::string testStrings [] = { " space at beginning", "space at end ", @@ -108,8 +108,8 @@ int testTrim() "space and tab at end \t", " \rtab and return at both sides \r" }; - - std::string results[] = + + std::string results[] = { "space at beginning", "space at end", @@ -124,17 +124,17 @@ int testTrim() "space and tab at end", "tab and return at both sides" }; - + bool success = true; - + for (unsigned int i = 0; i < sizeof(testStrings)/sizeof(*testStrings); ++i ) { std::string trimmed = trim(testStrings[i]); success = (results[i].compare(trimmed)==0); - + cout << "'" << trimmed << "'" << (success ?" SUCCESS":"FAILED") << endl; } - return success?1:0; + return success?1:0; } @@ -155,7 +155,7 @@ int strncasecmp( const string& a, const string& b, size_t n) if( b.size() < n ) return a.size() - b.size(); - + return 0; } diff --git a/moose-core/utility/strutil.h b/moose-core/utility/strutil.h index c5247c23487193ccff266a44d4d9f61d8eb14e0f..d6f48bfd7a85ba15d16c6202f12fbc5e1fd061d5 100644 --- a/moose-core/utility/strutil.h +++ b/moose-core/utility/strutil.h @@ -11,7 +11,7 @@ #include <string> #include <vector> -namespace moose +namespace moose { /** List of characters considered to be whitespace */ static const char* const DELIMITERS=" \t\r\n"; @@ -19,7 +19,7 @@ namespace moose /** Splits given string into tokens */ void tokenize( const std::string& str, const std::string& delimiters, - std::vector< std::string >& tokens + std::vector< std::string >& tokens ); /** trims the leading and trailing white spaces */ @@ -32,11 +32,11 @@ namespace moose bool endswith(const std::string& full, const std::string& ending); /** - * @brief Compares the two strings a and b for first n characters, ignoring + * @brief Compares the two strings a and b for first n characters, ignoring * the case of the characters. Return 0 in case both are same upto first n * characters. Othere a non-zero value is returned. When n is smaller or * equal to the size of both strings, positive is return if a is larger than - * b, or negative when a is smaller than b. + * b, or negative when a is smaller than b. * * When n is larger than size of a or b, non-zero values is returned when a and b * are not equal upto min(n, min(a.size(), b.size())) characters. diff --git a/moose-core/utility/testing_macros.hpp b/moose-core/utility/testing_macros.hpp index 99881aec48c355406014b8d314295f1d3feb39c2..5d55dffca4ae9e4035dd028f6246fbc0e79abd02 100644 --- a/moose-core/utility/testing_macros.hpp +++ b/moose-core/utility/testing_macros.hpp @@ -2,7 +2,7 @@ * * Filename: testing_macros.hpp * - * Description: This file contains some macros useful in testing. + * Description: This file contains some macros useful in testing. * * Version: 1.0 * Created: Monday 19 May 2014 05:04:41 IST @@ -10,7 +10,7 @@ * Compiler: gcc * * Author: Dilawar Singh (), dilawars@ncbs.res.in - * Organization: + * Organization: * * ============================================================================== */ @@ -40,7 +40,7 @@ static ostringstream assertStream; #define LOCATION(ss) \ ss << "In function: " << SIMPLE_CURRENT_FUNCTION; \ - ss << " file: " << __FILE__ << ":" << __LINE__ << endl; + ss << " file: " << __FILE__ << ":" << __LINE__ << endl; #define EXPECT_TRUE( condition, msg) \ if( !(condition) ) {\ diff --git a/moose-core/utility/types.cpp b/moose-core/utility/types.cpp index 4c358a639e56ce1fc084028eb0d2e9b948a9dbce..7c30f2dca76e843099259ccd3dd579cbe6f291bc 100644 --- a/moose-core/utility/types.cpp +++ b/moose-core/utility/types.cpp @@ -1,32 +1,32 @@ -// types.cpp --- -// +// types.cpp --- +// // Filename: types.cpp -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Copyright (C) 2010 Subhasis Ray, all rights reserved. // Created: Wed Mar 23 10:10:45 2011 (+0530) -// Version: +// Version: // Last-Updated: Tue Jul 23 12:47:59 2013 (+0530) // By: subha // Update #: 93 -// URL: -// Keywords: -// Compatibility: -// -// +// URL: +// Keywords: +// Compatibility: +// +// -// Commentary: -// +// Commentary: +// // Some utility functions to give short character representations for // particular type names. -// -// +// +// // Change log: -// -// -// +// +// +// // Code: #include <string> @@ -65,7 +65,7 @@ char shortType(string name) typemap.insert(pair<string, char>("vector<long long>", 'A')); // moose typemap.insert(pair<string, char>("vector<unsigned long long>", 'B')); // moose typemap.insert(pair<string, char>("vector<unsigned int>", 'N')); // moose - typemap.insert(pair<string, char>("vector<unsigned long>", 'P')); // moose + typemap.insert(pair<string, char>("vector<unsigned long>", 'P')); // moose typemap.insert(pair<string, char>("vector<float>", 'F')); // moose typemap.insert(pair<string, char>("vector<double>", 'D')); // moose typemap.insert(pair<string, char>("vector<string>", 'S')); // moose @@ -127,7 +127,7 @@ char innerType(char typecode){ } return iter->second; } - -// + +// // types.cpp ends here diff --git a/moose-core/utility/utility.h b/moose-core/utility/utility.h index ef5ef712b4d029a3d1cf94abc2d1efcd1e61deef..303de2774031b16a9fbd6c715f89ef568ca19c4e 100644 --- a/moose-core/utility/utility.h +++ b/moose-core/utility/utility.h @@ -1,31 +1,31 @@ -// utility.h --- -// +// utility.h --- +// // Filename: utility.h -// Description: +// Description: // Author: Subhasis Ray -// Maintainer: +// Maintainer: // Copyright (C) 2010 Subhasis Ray, all rights reserved. // Created: Wed Mar 23 10:25:58 2011 (+0530) -// Version: +// Version: // Last-Updated: Tue Jul 23 12:48:17 2013 (+0530) // By: subha // Update #: 19 -// URL: -// Keywords: -// Compatibility: -// -// - -// Commentary: -// -// -// -// +// URL: +// Keywords: +// Compatibility: +// +// + +// Commentary: +// +// +// +// // Change log: -// -// -// +// +// +// // Code: @@ -43,7 +43,7 @@ namespace moose { * @brief Givem path of MOOSE element, return its name. It's behaviour is * like `basename` of unix command e.g. /a/b/c --> c * - * @return + * @return */ inline string basename( const string& path ) { @@ -56,5 +56,5 @@ namespace moose { #endif // !_UTILITY_H -// +// // utility.h ends here