From df65dd31b8c918c6ac9ba2e9e908633ab0cd504c Mon Sep 17 00:00:00 2001 From: Dilawar Singh <dilawar@users.noreply.github.com> Date: Thu, 11 Oct 2018 14:55:12 +0530 Subject: [PATCH] 2018 oct11 (#244) * Pull subtree to master branch. * Squashed 'moose-core/' changes from d229eba6bb..b4637b21a0 b4637b21a0 Merge pull request #317 from upibhalla/master d6e35de324 Merge branch 'master' into master ecfca84012 Update README.md (#312) f66ba90038 Merge branch 'master' of https://github.com/BhallaLab/moose-core 51dd776253 Rdesigneur passiveDistrib modified to handle legacy commands 5d20e04333 corrected the spell of CyclMesh-->CylMesh, negating the yaxis for kkit is corrected as now saving the value of scene coOrdinates (#313) a8769f2c48 Update CMakeLists.txt f0e4db0e98 Fixes to build failure on OSX because cmake does not MACOSX but APPLE on (#316) 2fb51c9a56 Hotfix: Neuroml2 fixes. (#315) e46429530f Merge pull request #314 from upibhalla/master b57a6d0df0 Merge branch 'master' into master d2749931d0 Build System Tweaks (#309) 293d441443 Some fixes to Ca-dependent channel prototypes in rdesigneur. 88bcf0797c Merge pull request #311 from upibhalla/master aaf589ab23 Merge branch 'master' of https://github.com/BhallaLab/moose-core 0909ceb328 Fixes as suggested by PyLint. Added a target pylint in cmake file. (#308) cdbf917b21 Merge branch 'master' of https://github.com/BhallaLab/moose-core 79e2d65f58 hotfix for running Boost, Added NMDAR to rdesigneurProtos. eb4e836623 Fixed boost segfault with dense solver. Also remove GSL specific attrib from the test. (#310) 8463cc73e5 Update setup.cmake.py (#307) 8c38fc6d60 Removed deprecated warnings from neuroml2 reader (#305) 6df4332d2d Fixes to BOOST based steadystate solver (#306) 99dd7d2503 Merge pull request #302 from BhallaLab/chhennapoda 86c4244522 Merge branch 'master' into chhennapoda ec06b242ae HotFix: Fix regression in StreadyState solver caused by #293. (#304) 6b79f6701c prefer .so suffix over CPython version specific suffix . this way a wheel compiled by any version of python3 will work with any python3. 92da6a7fb8 removed python-libsbml from install dependencies; added matplotlib. sbml and neuroml packages should be installed by user and not automatically. They may not be available for all distribution of python on all OSes. e2bc19c0e4 Merge branch 'master' into chhennapoda 385a5cf0a1 Merge pull request #303 from upibhalla/master 080767c5aa Fixes to rdesigneur due to bad merge. Cleanup on rmoogli 62f8bc89e0 Tweak to Neuron.cpp so it can handle insertion of spines with uniform spacing. b6088109bf Fixes for linux. 406fee2a06 Temp commit to test on OSX. cc3c604b9f Merge branch 'master' into chhennapoda 342092829c Update moose_test.py (#301) 61f4f66843 show timeout in moose.test() . abf822c4a6 with python2, just test with GSL. Build python3 first. 088c61673c Made changes to build system so that pymoose directory can be built in isolation. Build system is bit more module. Ideally I should make sure that each subdirectory can built in isolation. 3c0ff27903 Few changes to build with python3.6. 5d688f63d8 Use option --relative in setup.py and tell cmake not to look into usr prefix anymore. 1f3fe9fc35 Merge branch 'chhennapoda' of github.com:BhallaLab/moose-core into chhennapoda 3e19983c83 removed unneeded library which is never used. c2fbab8726 cmake related changes to build on centos5 (manylinux docker image). f1230f1518 Merge branch 'master' of https://github.com/upibhalla/moose-core 23a2892cc8 Merge branch 'master' of https://github.com/BhallaLab/moose-core 8a835c1332 minor bugfix to rdesigneur 6ef1d567ec Merge branch 'master' into master a9a2e758ff Merge branch 'master' of https://github.com/BhallaLab/moose-core 5e1294d991 Further updates to rdesigneur for argument handling a702bded54 Put in kwargs based specification of plotList, stimList and moogList. Folded savePlots into plotList but not yet tested. git-subtree-dir: moose-core git-subtree-split: b4637b21a04e37e3358867c2327d636369990e15 --- moose-core/.travis.yml | 16 +- moose-core/.travis/run_pylint.sh | 36 + moose-core/.travis/travis_build_osx.sh | 10 +- moose-core/.travis/travis_prepare_linux.sh | 5 +- moose-core/CMakeLists.txt | 53 +- moose-core/CheckCXXCompiler.cmake | 12 +- moose-core/README.md | 12 +- moose-core/basecode/Cinfo.cpp | 8 - moose-core/basecode/Eref.h | 13 - moose-core/basecode/SrcFinfo.h | 7 - moose-core/basecode/main.cpp | 14 - moose-core/benchmarks/CMakeLists.txt | 6 +- moose-core/benchmarks/kineticMarks.cpp | 2 +- moose-core/biophysics/CMakeLists.txt | 88 +- moose-core/biophysics/CaConc.cpp | 3 +- moose-core/biophysics/CaConcBase.cpp | 4 +- moose-core/biophysics/ChanBase.cpp | 4 +- moose-core/biophysics/ChanCommon.cpp | 2 +- moose-core/biophysics/CompartmentBase.cpp | 4 +- .../biophysics/CompartmentDataHolder.cpp | 2 +- moose-core/biophysics/DifBuffer.cpp | 4 +- moose-core/biophysics/DifBufferBase.cpp | 4 +- moose-core/biophysics/DifShell.cpp | 2 +- moose-core/biophysics/DifShellBase.cpp | 4 +- moose-core/biophysics/GapJunction.cpp | 2 +- moose-core/biophysics/HHChannel.cpp | 4 +- moose-core/biophysics/HHChannel2D.cpp | 4 +- moose-core/biophysics/HHChannelBase.cpp | 4 +- moose-core/biophysics/HHGate.cpp | 4 +- moose-core/biophysics/HHGate2D.cpp | 4 +- moose-core/biophysics/IntFire.cpp | 2 +- moose-core/biophysics/IzhikevichNrn.cpp | 2 +- moose-core/biophysics/Leakage.cpp | 2 +- moose-core/biophysics/MMPump.cpp | 4 +- moose-core/biophysics/MarkovChannel.cpp | 2 +- moose-core/biophysics/MarkovGslSolver.cpp | 2 +- moose-core/biophysics/MarkovRateTable.cpp | 2 +- moose-core/biophysics/MarkovSolver.cpp | 4 +- moose-core/biophysics/MarkovSolverBase.cpp | 4 +- moose-core/biophysics/MatrixOps.cpp | 2 +- moose-core/biophysics/MgBlock.cpp | 2 +- moose-core/biophysics/NMDAChan.cpp | 4 +- moose-core/biophysics/Nernst.cpp | 2 +- moose-core/biophysics/Neuron.cpp | 16 +- moose-core/biophysics/ReadCell.cpp | 2 +- moose-core/biophysics/ReadSwc.cpp | 2 +- moose-core/biophysics/SpikeGen.cpp | 2 +- moose-core/biophysics/Spine.cpp | 4 +- moose-core/biophysics/SymCompartment.cpp | 2 +- moose-core/biophysics/SynChan.cpp | 2 +- moose-core/biophysics/VClamp.cpp | 4 +- moose-core/biophysics/VectorTable.cpp | 2 +- moose-core/builtins/Arith.cpp | 2 +- moose-core/builtins/CMakeLists.txt | 6 +- moose-core/builtins/Func.cpp | 2 +- moose-core/builtins/Func.h | 2 +- moose-core/builtins/Function.cpp | 4 +- moose-core/builtins/Function.h | 10 +- moose-core/builtins/Group.cpp | 2 +- moose-core/builtins/Interpol.cpp | 2 +- moose-core/builtins/Interpol2D.cpp | 2 +- moose-core/builtins/Mstring.cpp | 2 +- moose-core/builtins/SpikeStats.cpp | 2 +- moose-core/builtins/Stats.cpp | 2 +- moose-core/builtins/StimulusTable.cpp | 2 +- moose-core/builtins/Streamer.cpp | 8 +- moose-core/builtins/StreamerBase.cpp | 4 +- moose-core/builtins/Table.cpp | 6 +- moose-core/builtins/TableBase.cpp | 2 +- moose-core/builtins/TimeTable.cpp | 2 +- moose-core/builtins/Variable.cpp | 2 +- moose-core/builtins/testBuiltins.cpp | 6 +- moose-core/device/CMakeLists.txt | 4 +- moose-core/device/PulseGen.cpp | 2 +- moose-core/diffusion/CMakeLists.txt | 4 +- moose-core/diffusion/DiffPoolVec.cpp | 2 +- moose-core/diffusion/Dsolve.cpp | 14 +- .../diffusion/standaloneTestFastElim.cpp | 1000 +++++++++-------- moose-core/diffusion/testDiffusion.cpp | 2 +- moose-core/examples/CMakeLists.txt | 4 +- moose-core/examples/Ex.cpp | 6 +- moose-core/examples/Example.cpp | 13 +- moose-core/examples/Example.h | 4 + .../external/muparser/include/muParser.h | 2 +- moose-core/external/muparser/src/muParser.cpp | 4 +- moose-core/external/xgetopt/XGetopt.cpp | 219 ---- moose-core/external/xgetopt/XGetopt.h | 23 - moose-core/hsolve/CMakeLists.txt | 5 +- moose-core/hsolve/Cell.cpp | 10 +- moose-core/hsolve/HSolve.cpp | 2 +- moose-core/hsolve/HSolveActive.cpp | 2 +- moose-core/hsolve/HSolveInterface.cpp | 2 +- moose-core/hsolve/HSolveStruct.cpp | 2 +- moose-core/hsolve/HinesMatrix.cpp | 2 +- moose-core/hsolve/ZombieCaConc.cpp | 2 +- moose-core/hsolve/ZombieCompartment.h | 6 +- moose-core/hsolve/ZombieHHChannel.h | 4 +- moose-core/intfire/AdExIF.cpp | 4 +- moose-core/intfire/AdThreshIF.cpp | 4 +- moose-core/intfire/CMakeLists.txt | 3 +- moose-core/intfire/ExIF.cpp | 4 +- moose-core/intfire/IzhIF.cpp | 4 +- moose-core/intfire/QIF.cpp | 4 +- moose-core/intfire/testIntFire.cpp | 2 +- moose-core/kinetics/CMakeLists.txt | 38 +- moose-core/kinetics/ConcChan.cpp | 2 +- moose-core/kinetics/CplxEnzBase.cpp | 4 +- moose-core/kinetics/Enz.cpp | 4 +- moose-core/kinetics/EnzBase.cpp | 4 +- moose-core/kinetics/MMenz.cpp | 4 +- moose-core/kinetics/PoolBase.cpp | 4 +- moose-core/kinetics/Reac.cpp | 4 +- moose-core/kinetics/ReacBase.cpp | 4 +- moose-core/kinetics/ReadCspace.cpp | 2 +- moose-core/kinetics/ReadKkit.cpp | 2 +- moose-core/kinetics/Species.cpp | 2 +- moose-core/kinetics/WriteKkit.cpp | 2 +- moose-core/kinetics/lookupVolumeFromMesh.cpp | 8 +- moose-core/kinetics/testKinetics.cpp | 2 +- moose-core/ksolve/CMakeLists.txt | 5 +- moose-core/ksolve/FuncTerm.cpp | 2 +- moose-core/ksolve/FuncTerm.h | 2 +- moose-core/ksolve/Gsolve.cpp | 2 +- moose-core/ksolve/GssaVoxelPools.cpp | 12 +- moose-core/ksolve/KinSparseMatrix.cpp | 4 +- moose-core/ksolve/RateTerm.cpp | 4 +- moose-core/ksolve/Stoich.cpp | 16 +- moose-core/ksolve/VoxelPools.cpp | 22 +- moose-core/ksolve/VoxelPoolsBase.cpp | 5 +- moose-core/ksolve/ZombieBufPool.cpp | 6 +- moose-core/ksolve/ZombieEnz.cpp | 11 +- moose-core/ksolve/ZombieFunction.cpp | 12 +- moose-core/ksolve/ZombieMMenz.cpp | 9 +- moose-core/ksolve/ZombiePool.cpp | 6 +- moose-core/ksolve/ZombiePoolInterface.cpp | 4 +- moose-core/ksolve/ZombieReac.cpp | 8 +- moose-core/ksolve/testKsolve.cpp | 7 +- moose-core/mesh/CMakeLists.txt | 7 +- moose-core/mesh/ChemCompt.cpp | 6 +- moose-core/mesh/CubeMesh.cpp | 6 +- moose-core/mesh/CylBase.cpp | 9 +- moose-core/mesh/CylMesh.cpp | 6 +- moose-core/mesh/EndoMesh.cpp | 6 +- moose-core/mesh/MeshCompt.cpp | 4 +- moose-core/mesh/MeshEntry.cpp | 4 +- moose-core/mesh/NeuroMesh.cpp | 8 +- moose-core/mesh/NeuroNode.cpp | 4 +- moose-core/mesh/PsdMesh.cpp | 8 +- moose-core/mesh/SpineEntry.cpp | 2 +- moose-core/mesh/SpineMesh.cpp | 8 +- moose-core/mesh/testMesh.cpp | 8 +- moose-core/mpi/CMakeLists.txt | 3 +- moose-core/mpi/PostMaster.cpp | 2 +- moose-core/msg/CMakeLists.txt | 3 +- moose-core/msg/DiagonalMsg.cpp | 2 +- moose-core/msg/Msg.cpp | 6 +- moose-core/msg/OneToAllMsg.cpp | 2 +- moose-core/msg/OneToOneDataIndexMsg.cpp | 2 +- moose-core/msg/OneToOneMsg.cpp | 2 +- moose-core/msg/SingleMsg.cpp | 2 +- moose-core/msg/testMsg.cpp | 2 +- moose-core/pymoose/CMakeLists.txt | 23 +- moose-core/python/moose/OrderedDict.py | 1 - moose-core/python/moose/SBML/validation.py | 1 + moose-core/python/moose/SBML/writeSBML.py | 19 +- moose-core/python/moose/__init__.py | 11 +- moose-core/python/moose/chemMerge/merge.py | 10 - .../python/moose/chemUtil/chemConnectUtil.py | 15 +- moose-core/python/moose/fixXreacs.py | 70 +- moose-core/python/moose/genesis/writeKkit.py | 2 +- moose-core/python/moose/hdfutil.py | 32 +- moose-core/python/moose/moose.py | 77 +- moose-core/python/moose/neuroml/ChannelML.py | 19 +- moose-core/python/moose/neuroml/NetworkML.py | 2 +- moose-core/python/moose/neuroml/NeuroML.py | 4 +- moose-core/python/moose/neuroml2/converter.py | 207 ---- moose-core/python/moose/neuroml2/hhfit.py | 2 +- moose-core/python/moose/neuroml2/reader.py | 55 +- moose-core/python/moose/neuroml2/run_cell.py | 17 +- .../python/moose/neuroml2/run_hhcell.py | 16 +- moose-core/python/moose/plot_utils.py | 7 +- moose-core/python/moose/utils.py | 21 +- moose-core/python/rdesigneur/rdesigneur.py | 30 +- .../python/rdesigneur/rdesigneurProtos.py | 67 +- moose-core/scheduling/CMakeLists.txt | 6 +- moose-core/scheduling/testScheduling.cpp | 8 +- moose-core/setup.py | 172 --- moose-core/shell/CMakeLists.txt | 28 +- moose-core/shell/LoadModels.cpp | 2 +- moose-core/shell/Neutral.cpp | 8 +- moose-core/shell/SaveModels.cpp | 2 +- moose-core/shell/Shell.cpp | 22 +- moose-core/shell/Shell.h | 2 - moose-core/shell/ShellCopy.cpp | 4 +- moose-core/shell/ShellThreads.cpp | 4 +- moose-core/shell/Wildcard.cpp | 4 +- moose-core/shell/testShell.cpp | 10 +- moose-core/signeur/Adaptor.cpp | 2 +- moose-core/signeur/CMakeLists.txt | 4 +- moose-core/synapse/CMakeLists.txt | 4 +- moose-core/synapse/STDPSynHandler.cpp | 2 +- moose-core/synapse/STDPSynapse.cpp | 2 +- moose-core/synapse/SeqSynHandler.cpp | 6 +- moose-core/synapse/SimpleSynHandler.cpp | 2 +- moose-core/synapse/SynHandlerBase.cpp | 2 +- moose-core/synapse/Synapse.cpp | 4 +- .../moose_vs_neuron/rallpack3/moose_sim.py | 10 - moose-core/tests/python/abstrModelEqns9.py | 10 +- moose-core/tests/python/testXchan1.py | 2 - moose-core/tests/python/testXdiff1.py | 2 - moose-core/tests/python/testXenz1.py | 2 - moose-core/tests/python/testXreacs2.py | 2 - moose-core/tests/python/testXreacs3.py | 2 - moose-core/tests/python/testXreacs4.py | 2 - moose-core/tests/python/testXreacs4a.py | 2 - moose-core/tests/python/testXreacs5.py | 2 - moose-core/tests/python/testXreacs5a.py | 2 - moose-core/tests/python/testXreacs6.py | 2 - moose-core/tests/python/testXreacs7.py | 2 - moose-core/tests/python/testXreacs8.py | 2 - ...GraupnerBrunel2012_STDPfromCaPlasticity.py | 2 - moose-core/tests/python/test_kkit.py | 1 - moose-core/tests/python/test_moose_attribs.py | 67 ++ moose-core/tests/python/test_muparser.py | 3 - moose-core/tests/python/test_neuroml2.py | 21 +- moose-core/tests/python/test_rdesigneur.py | 3 - .../test_rdesigneur_random_syn_input.py | 46 + moose-core/utility/Annotator.cpp | 2 +- moose-core/utility/CMakeLists.txt | 5 +- moose-core/utility/cnpy.hpp | 2 +- moose-core/utility/print_function.hpp | 9 +- moose-core/wheels/Dockerfile | 17 - moose-core/wheels/build_wheels.sh | 46 - 233 files changed, 1454 insertions(+), 1999 deletions(-) create mode 100755 moose-core/.travis/run_pylint.sh delete mode 100644 moose-core/external/xgetopt/XGetopt.cpp delete mode 100644 moose-core/external/xgetopt/XGetopt.h delete mode 100644 moose-core/python/moose/neuroml2/converter.py delete mode 100755 moose-core/setup.py create mode 100644 moose-core/tests/python/test_moose_attribs.py create mode 100644 moose-core/tests/python/test_rdesigneur_random_syn_input.py delete mode 100644 moose-core/wheels/Dockerfile delete mode 100755 moose-core/wheels/build_wheels.sh diff --git a/moose-core/.travis.yml b/moose-core/.travis.yml index 01188d6d..e6912225 100644 --- a/moose-core/.travis.yml +++ b/moose-core/.travis.yml @@ -4,8 +4,11 @@ group: travis_lts dist: xenial os: -- linux -- osx + - linux + - osx + +osx_image: xcode10 + notifications: email: recipients: @@ -20,22 +23,17 @@ addons: update: true 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 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 -script: +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.travis/travis_prepare_linux.sh; fi -- python2 -m compileall -q . || echo "Python2 not found" -- if type python3 > /dev/null; then python3 -m compileall -q . ; fi +script: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_build_osx.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/travis_build_linux.sh; fi diff --git a/moose-core/.travis/run_pylint.sh b/moose-core/.travis/run_pylint.sh new file mode 100755 index 00000000..91d39812 --- /dev/null +++ b/moose-core/.travis/run_pylint.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -e +python3 -m pip install pylint --user +PYLINT="python3 -m pylint -E \ + --disable=no-member --disable=no-name-in-module \ + --disable=invalid-unary-operand-type \ + --disable=import-error \ + " +function do_pylint() { + echo "Checking $1" + DIR=$(dirname $1) + SNAME=$(basename $1) + ( + cd $DIR + $PYLINT $@ $SNAME + ) +} + +FILES=$(find . -type f -name "*.py" | shuf) +N=4 +i=0 +for f in $FILES; do + #i=$((i+1)) + #if [ $i -eq $N ]; then + # i=0 + # wait; + #fi + # do_pylint "$f" + echo "Checking $f" + DIR=$(dirname $f) + SNAME=$(basename $f) + ( + cd $DIR + $PYLINT $@ $SNAME + ) +done diff --git a/moose-core/.travis/travis_build_osx.sh b/moose-core/.travis/travis_build_osx.sh index 814f6af5..7e947674 100755 --- a/moose-core/.travis/travis_build_osx.sh +++ b/moose-core/.travis/travis_build_osx.sh @@ -23,12 +23,18 @@ set -e # NOTE: On travis, don't enable -j`nproc` option. It may not compile properly. ( - # Make sure not to pick up python from /opt. - PATH=/usr/bin:/usr/local/bin:$PATH + PATH=/usr/local/bin:/usr/bin:$PATH + + # Get pylint + python -m pip install pylint --user + python -m pip install python-libsbml --user + python -m pip install pyneuroml --user + mkdir -p _GSL_BUILD && cd _GSL_BUILD \ && cmake -DDEBUG=ON \ -DPYTHON_EXECUTABLE=`which python` .. + make pylint -j3 make && ctest --output-on-failure cd .. # Now with boost. diff --git a/moose-core/.travis/travis_prepare_linux.sh b/moose-core/.travis/travis_prepare_linux.sh index 0c0e604f..37f5dd33 100755 --- a/moose-core/.travis/travis_prepare_linux.sh +++ b/moose-core/.travis/travis_prepare_linux.sh @@ -26,6 +26,7 @@ apt-get install -qq python-numpy python-matplotlib python-networkx python-pip apt-get install -qq python3-lxml python-lxml apt-get install -qq python3-numpy python3-matplotlib python3-dev apt-get install -qq python-pip python3-pip +apt-get install -qq python-tk python3-tk apt-get install -qq libgraphviz-dev # Gsl @@ -40,5 +41,5 @@ apt-get install -qq python-scipy python3-scipy apt-get install -qq python-lxml python3-lxml apt-get install -qq python-setuptools python3-setuptools apt-get install -qq python-tornado python3-tornado -python2 -m pip install pyNeuroML libNeuroML -python3 -m pip install pyNeuroML libNeuroML +/usr/bin/python2 -m pip install pyNeuroML libNeuroML +/usr/bin/python3 -m pip install pyNeuroML libNeuroML diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt index a71896f6..ec094e58 100644 --- a/moose-core/CMakeLists.txt +++ b/moose-core/CMakeLists.txt @@ -66,15 +66,6 @@ add_custom_target(uninstall # This is for testing purpose. link_directories(${CMAKE_CURRENT_BINARY_DIR}) -################################# OS Specific ################################## -message(STATUS "Operating system: ${CMAKE_SYSTEM_NAME}") -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - CMAKE_POLICY(SET CMP0042 NEW) - set(MACOSX TRUE) -else() - set(MACOSX FALSE) -endif() - ################################ CMAKE OPTIONS ################################## option(WITH_NSDF "Enable NSDF support. Requires hdf5" OFF ) @@ -106,9 +97,10 @@ else() message(STATUS "Building for Release/No unit tests.") set(CMAKE_BUILD_TYPE Release) add_definitions(-UDO_UNIT_TESTS -O3 -DDISABLE_DEBUG) - # Treat all warnings as errors. Some the warnings are disabled in - # CheckCXXCompiler.cmake . - add_definitions(-Werror) + + # DO NOT Treat all warnings as errors. With some compilers and newer versions + # this often causes headache. + # add_definitions(-Werror) endif() if(GPROF AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") @@ -361,9 +353,18 @@ if(SYSTEM_SHARED_LIBS) list(REMOVE_DUPLICATES SYSTEM_SHARED_LIBS) endif( ) +# cmake --help-policy CMP0042. Also in pymoose/CMakeLists.txt +# More details: +# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling +# especially section 'Mac OS X and the RPATH' +# Switching is OFF since all libraries are statically linked in module. +if(APPLE) + set_target_properties( libmoose PROPERTIES MACOSX_RPATH OFF) +endif(APPLE) + # MAC linker does not understand many of gnu-ld options. # message( DEBUG "Shared libs: ${SYSTEM_SHARED_LIBS}") -if(MACOSX) +if(APPLE) target_link_libraries(libmoose "-Wl,-all_load" ${MOOSE_LIBRARIES} @@ -374,7 +375,7 @@ if(MACOSX) ${SYSTEM_SHARED_LIBS} ${CMAKE_DL_LIBS} ) -ELSE(MACOSX) +else(APPLE) target_link_libraries(libmoose "-Wl,--whole-archive" ${MOOSE_LIBRARIES} @@ -382,7 +383,7 @@ ELSE(MACOSX) "-Wl,--no-whole-archive" ${SYSTEM_SHARED_LIBS} ) -endif(MACOSX) +endif(APPLE) add_dependencies(moose.bin libmoose) target_link_libraries(moose.bin moose ${CMAKE_DL_LIBS}) @@ -518,5 +519,27 @@ foreach( _test_script ${PY_TEST_SCRIPTS} ) ) endforeach( ) +# add pylint target. +set(PYSCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/python ) +file(GLOB_RECURSE PY_SCRIPTS "python/*.py") +add_custom_target( pylint ) +foreach( _py_script ${PY_SCRIPTS} ) + get_filename_component( _py_name ${_py_script} NAME_WE) + file( READ ${_py_script} pytext) + string(MD5 _md5 "${pytext}") + set(TGT_NAME "${_py_name}-${_md5}" ) + set(PYLINT_OPTIONS --disable=no-member --disable=no-name-in-module + --disable=invalid-unary-operand-type + --disable=import-error + --disable=no-method-argument + ) + add_custom_target( ${TGT_NAME} + COMMAND ${PYTHON_EXECUTABLE} -m pylint -E ${PYLINT_OPTIONS} ${_py_script} + COMMENT "Running pylint on ${_py_script}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + add_dependencies(pylint ${TGT_NAME} ) +endforeach( ) + ############################ CPACK ###################################### include(${CMAKE_CURRENT_SOURCE_DIR}/cmake_moose_cpack.cmake) diff --git a/moose-core/CheckCXXCompiler.cmake b/moose-core/CheckCXXCompiler.cmake index c6173acb..b1520579 100644 --- a/moose-core/CheckCXXCompiler.cmake +++ b/moose-core/CheckCXXCompiler.cmake @@ -1,5 +1,8 @@ -########################### COMPILER MACROS ##################################### +if(COMPILER_IS_TESTED) + return() +endif() +########################### COMPILER MACROS ##################################### include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG( "-std=c++11" COMPILER_SUPPORTS_CXX11 ) CHECK_CXX_COMPILER_FLAG( "-std=c++0x" COMPILER_SUPPORTS_CXX0X ) @@ -15,6 +18,8 @@ add_definitions(-Wall ) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") add_definitions( -Wno-unused-local-typedefs ) +elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) + add_definitions( -Wno-unused-local-typedef ) endif() @@ -32,12 +37,11 @@ if(COMPILER_SUPPORT_UNUSED_BUT_SET_VARIABLE_NO_WARN) endif(COMPILER_SUPPORT_UNUSED_BUT_SET_VARIABLE_NO_WARN) if(COMPILER_SUPPORTS_CXX11) - message(STATUS "Your compiler supports c++11 features. Enabling it") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") add_definitions( -DENABLE_CPP11 ) if(APPLE) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" ) - message(STATUS "NOTE: Making clang to inline more aggresively" ) + # message(STATUS "NOTE: Making clang to inline more aggresively" ) add_definitions( -mllvm -inline-threshold=1000 ) endif(APPLE) else(COMPILER_SUPPORTS_CXX11) @@ -48,4 +52,4 @@ else(COMPILER_SUPPORTS_CXX11) ") endif(COMPILER_SUPPORTS_CXX11) - +set(COMPILER_IS_TESTED ON) diff --git a/moose-core/README.md b/moose-core/README.md index 6e5ed75a..6d24f263 100644 --- a/moose-core/README.md +++ b/moose-core/README.md @@ -1,17 +1,19 @@ -[](https://travis-ci.org/BhallaLab/moose-core) | [](https://badge.fury.io/py/pymoose) | [Nightly Linux Build on OBS](https://software.opensuse.org//download.html?project=home%3Amoose&package=pymoose) +[](https://travis-ci.org/BhallaLab/moose-core) | [](https://badge.fury.io/py/pymoose) This is the core computational engine of [MOOSE simulator](https://github.com/BhallaLab/moose). This repository contains C++ codebase and python interface called `pymoose`. For more details about MOOSE simulator, visit https://moose.ncbs.res.in . -# Download and Install +# Installation This repository is sufficient for using MOOSE as a python module. We provide python package via `pip`. $ pip install pymoose --user -`pymoose` is part of [MOOSE simulator](https://github.com/BhallaLab/moose). We also provide linux packages of -MOOSE simlulator. It can be downloaded from [Open Build Service](https://software.opensuse.org//download.html?project=home%3Amoose&package=moose). -In addition to `pymoose`, it also contain a `GUI` to create and visualize chemical network, and `moogli`, a visualizer of neural activity. +To install `nightly` build: + + $ pip install pymoose --user --pre --upgrde + +Have a look at examples, tutorials and demo here https://github.com/BhallaLab/moose-examples. # Build diff --git a/moose-core/basecode/Cinfo.cpp b/moose-core/basecode/Cinfo.cpp index d373cf71..cbbe2eb2 100644 --- a/moose-core/basecode/Cinfo.cpp +++ b/moose-core/basecode/Cinfo.cpp @@ -202,14 +202,6 @@ const Cinfo* Cinfo::find( const string& name ) map<string, Cinfo*>::iterator i = cinfoMap().find(name); if ( i != cinfoMap().end() ) return i->second; - -#ifdef RESULT_CHECK - stringstream ss; - ss << "+ " << name << " not found. Available names are " << endl; - ss << mapToString<string, Cinfo*>( cinfoMap() ); - dump(ss.str(), "DEBUG"); -#endif /* ----- not RESULT_CHECK ----- */ - return 0; } diff --git a/moose-core/basecode/Eref.h b/moose-core/basecode/Eref.h index f3014fb2..bb71ce25 100644 --- a/moose-core/basecode/Eref.h +++ b/moose-core/basecode/Eref.h @@ -10,19 +10,6 @@ #ifndef _EREF_H #define _EREF_H -#ifdef CYMOOSE - -#include <iostream> -#include <vector> -using namespace std; - -class Element; -class Id; -class ObjId; -class MsgDigest; - -#endif /* ----- CYMOOSE ----- */ - class Eref { public: diff --git a/moose-core/basecode/SrcFinfo.h b/moose-core/basecode/SrcFinfo.h index 0a3b6d71..9d521c16 100644 --- a/moose-core/basecode/SrcFinfo.h +++ b/moose-core/basecode/SrcFinfo.h @@ -9,13 +9,6 @@ #ifndef _SRC_FINFO_H #define _SRC_FINFO_H -#ifdef CYMOOSE - -#include "../basecode/Finfo.h" -#include "../basecode/header.h" - -#endif /* ----- CYMOOSE ----- */ - /** * This set of classes define Message Sources. Their main job is to supply * a type-safe send operation, and to provide typechecking for it. diff --git a/moose-core/basecode/main.cpp b/moose-core/basecode/main.cpp index cde0f33d..dc194c08 100644 --- a/moose-core/basecode/main.cpp +++ b/moose-core/basecode/main.cpp @@ -10,18 +10,10 @@ #include "header.h" #include "SparseMatrix.h" -#ifndef WIN32 -#include <sys/time.h> -#else #include <time.h> -#endif #include <math.h> #include <queue> -#ifdef WIN32 -#include "../external/xgetopt/XGetopt.h" -#else #include <unistd.h> // for getopt -#endif #include "../scheduling/Clock.h" #include "../msg/DiagonalMsg.h" #include "../msg/SparseMsg.h" @@ -93,12 +85,6 @@ extern void mooseBenchmarks( unsigned int option ); unsigned int getNumCores() { unsigned int numCPU = 0; -#ifdef WIN_32 - SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); - - numCPU = sysinfo.dwNumberOfProcessors; -#endif #ifdef LINUX numCPU = sysconf( _SC_NPROCESSORS_ONLN ); diff --git a/moose-core/benchmarks/CMakeLists.txt b/moose-core/benchmarks/CMakeLists.txt index 84b460a3..ab846b73 100644 --- a/moose-core/benchmarks/CMakeLists.txt +++ b/moose-core/benchmarks/CMakeLists.txt @@ -1,5 +1,7 @@ -include_directories(../msg) -include_directories(../basecode) +cmake_minimum_required(VERSION 2.8) + +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake ) + add_library(benchmarks benchmarks.cpp kineticMarks.cpp diff --git a/moose-core/benchmarks/kineticMarks.cpp b/moose-core/benchmarks/kineticMarks.cpp index a8e87741..370cb000 100644 --- a/moose-core/benchmarks/kineticMarks.cpp +++ b/moose-core/benchmarks/kineticMarks.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" /// Small model, long runtime. diff --git a/moose-core/biophysics/CMakeLists.txt b/moose-core/biophysics/CMakeLists.txt index 91444ada..390117a9 100644 --- a/moose-core/biophysics/CMakeLists.txt +++ b/moose-core/biophysics/CMakeLists.txt @@ -1,53 +1,53 @@ -include_directories(../basecode ../synapse ../utility ../) -include_directories(../external/muparser/include) +cmake_minimum_required(VERSION 2.8) +include(${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) if(WITH_GSL) include_directories(${GSL_INCLUDE_DIRS}) endif(WITH_GSL) set(BIOPHYSICS_SRCS - IntFire.cpp - SpikeGen.cpp - RandSpike.cpp - CompartmentDataHolder.cpp - CompartmentBase.cpp - Compartment.cpp - SymCompartment.cpp - GapJunction.cpp - ChanBase.cpp - ChanCommon.cpp - HHChannel.cpp - HHChannelBase.cpp - HHChannel2D.cpp - HHGate.cpp - HHGate2D.cpp - HHChannel2D.cpp - CaConcBase.cpp - CaConc.cpp - MgBlock.cpp - Nernst.cpp - Neuron.cpp - ReadCell.cpp - SwcSegment.cpp - ReadSwc.cpp - SynChan.cpp - NMDAChan.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 - Spine.cpp + IntFire.cpp + SpikeGen.cpp + RandSpike.cpp + CompartmentDataHolder.cpp + CompartmentBase.cpp + Compartment.cpp + SymCompartment.cpp + GapJunction.cpp + ChanBase.cpp + ChanCommon.cpp + HHChannel.cpp + HHChannelBase.cpp + HHChannel2D.cpp + HHGate.cpp + HHGate2D.cpp + HHChannel2D.cpp + CaConcBase.cpp + CaConc.cpp + MgBlock.cpp + Nernst.cpp + Neuron.cpp + ReadCell.cpp + SwcSegment.cpp + ReadSwc.cpp + SynChan.cpp + NMDAChan.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 + Spine.cpp ) if(WITH_GSL) diff --git a/moose-core/biophysics/CaConc.cpp b/moose-core/biophysics/CaConc.cpp index 40f3bf2b..91dd8fce 100644 --- a/moose-core/biophysics/CaConc.cpp +++ b/moose-core/biophysics/CaConc.cpp @@ -7,8 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -// #include <cfloat> -#include "header.h" +#include "../basecode/header.h" #include "CaConcBase.h" #include "CaConc.h" diff --git a/moose-core/biophysics/CaConcBase.cpp b/moose-core/biophysics/CaConcBase.cpp index f569cbae..c95c386a 100644 --- a/moose-core/biophysics/CaConcBase.cpp +++ b/moose-core/biophysics/CaConcBase.cpp @@ -8,8 +8,8 @@ **********************************************************************/ // #include <cfloat> -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "CaConcBase.h" /////////////////////////////////////////////////////// diff --git a/moose-core/biophysics/ChanBase.cpp b/moose-core/biophysics/ChanBase.cpp index b483dbcb..02f2ba58 100644 --- a/moose-core/biophysics/ChanBase.cpp +++ b/moose-core/biophysics/ChanBase.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "ChanBase.h" SrcFinfo1< double >* ChanBase::permeability() diff --git a/moose-core/biophysics/ChanCommon.cpp b/moose-core/biophysics/ChanCommon.cpp index 124fe67f..a65282e7 100644 --- a/moose-core/biophysics/ChanCommon.cpp +++ b/moose-core/biophysics/ChanCommon.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "ChanBase.h" #include "ChanCommon.h" diff --git a/moose-core/biophysics/CompartmentBase.cpp b/moose-core/biophysics/CompartmentBase.cpp index 795acb5a..2085589c 100644 --- a/moose-core/biophysics/CompartmentBase.cpp +++ b/moose-core/biophysics/CompartmentBase.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "CompartmentBase.h" #include "CompartmentDataHolder.h" #include "../shell/Wildcard.h" diff --git a/moose-core/biophysics/CompartmentDataHolder.cpp b/moose-core/biophysics/CompartmentDataHolder.cpp index 88940dc4..e1c70eba 100644 --- a/moose-core/biophysics/CompartmentDataHolder.cpp +++ b/moose-core/biophysics/CompartmentDataHolder.cpp @@ -6,7 +6,7 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "CompartmentBase.h" #include "CompartmentDataHolder.h" // static func diff --git a/moose-core/biophysics/DifBuffer.cpp b/moose-core/biophysics/DifBuffer.cpp index 7e34e8a5..04e170f0 100644 --- a/moose-core/biophysics/DifBuffer.cpp +++ b/moose-core/biophysics/DifBuffer.cpp @@ -45,10 +45,10 @@ // Code: -#include "header.h" +#include "../basecode/header.h" #include "DifBufferBase.h" #include "DifBuffer.h" -#include "ElementValueFinfo.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/numutil.h" #include <cmath> const double DifBuffer::EPSILON = 1.0e-10; diff --git a/moose-core/biophysics/DifBufferBase.cpp b/moose-core/biophysics/DifBufferBase.cpp index 1be36d79..6e5bd8ae 100644 --- a/moose-core/biophysics/DifBufferBase.cpp +++ b/moose-core/biophysics/DifBufferBase.cpp @@ -1,6 +1,6 @@ -#include "header.h" +#include "../basecode/header.h" #include "DifBufferBase.h" -#include "ElementValueFinfo.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/numutil.h" #include <cmath> diff --git a/moose-core/biophysics/DifShell.cpp b/moose-core/biophysics/DifShell.cpp index c094d8c4..c24c9658 100644 --- a/moose-core/biophysics/DifShell.cpp +++ b/moose-core/biophysics/DifShell.cpp @@ -8,7 +8,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "DifShellBase.h" #include "DifShell.h" diff --git a/moose-core/biophysics/DifShellBase.cpp b/moose-core/biophysics/DifShellBase.cpp index d6b6ed20..9742d839 100644 --- a/moose-core/biophysics/DifShellBase.cpp +++ b/moose-core/biophysics/DifShellBase.cpp @@ -8,9 +8,9 @@ ** See the file COPYING.LIB for the full notice. ****/ -#include "header.h" +#include "../basecode/header.h" #include "DifShellBase.h" -#include "ElementValueFinfo.h" +#include "../basecode/ElementValueFinfo.h" SrcFinfo1< double >* DifShellBase::concentrationOut() { diff --git a/moose-core/biophysics/GapJunction.cpp b/moose-core/biophysics/GapJunction.cpp index d7d88768..cfdda6c3 100644 --- a/moose-core/biophysics/GapJunction.cpp +++ b/moose-core/biophysics/GapJunction.cpp @@ -45,7 +45,7 @@ // Code: -#include "header.h" +#include "../basecode/header.h" #include "GapJunction.h" static SrcFinfo2< double, double >* channel1Out() diff --git a/moose-core/biophysics/HHChannel.cpp b/moose-core/biophysics/HHChannel.cpp index 87453e97..e7c72b5a 100644 --- a/moose-core/biophysics/HHChannel.cpp +++ b/moose-core/biophysics/HHChannel.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "HHGate.h" #include "ChanBase.h" #include "ChanCommon.h" diff --git a/moose-core/biophysics/HHChannel2D.cpp b/moose-core/biophysics/HHChannel2D.cpp index f937f692..d0d2cf02 100644 --- a/moose-core/biophysics/HHChannel2D.cpp +++ b/moose-core/biophysics/HHChannel2D.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../builtins/Interpol2D.h" #include "ChanBase.h" #include "ChanCommon.h" diff --git a/moose-core/biophysics/HHChannelBase.cpp b/moose-core/biophysics/HHChannelBase.cpp index 147bb6e8..91813380 100644 --- a/moose-core/biophysics/HHChannelBase.cpp +++ b/moose-core/biophysics/HHChannelBase.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "HHGate.h" #include "ChanBase.h" #include "HHChannelBase.h" diff --git a/moose-core/biophysics/HHGate.cpp b/moose-core/biophysics/HHGate.cpp index 64140728..0e8ca584 100644 --- a/moose-core/biophysics/HHGate.cpp +++ b/moose-core/biophysics/HHGate.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "HHGate.h" static const double SINGULARITY = 1.0e-6; diff --git a/moose-core/biophysics/HHGate2D.cpp b/moose-core/biophysics/HHGate2D.cpp index e0628095..c3c88138 100644 --- a/moose-core/biophysics/HHGate2D.cpp +++ b/moose-core/biophysics/HHGate2D.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../builtins/Interpol2D.h" #include "HHGate2D.h" diff --git a/moose-core/biophysics/IntFire.cpp b/moose-core/biophysics/IntFire.cpp index 990e62d7..04acbd29 100644 --- a/moose-core/biophysics/IntFire.cpp +++ b/moose-core/biophysics/IntFire.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <queue> -#include "header.h" +#include "../basecode/header.h" #include "IntFire.h" static SrcFinfo1< double > *spikeOut() { diff --git a/moose-core/biophysics/IzhikevichNrn.cpp b/moose-core/biophysics/IzhikevichNrn.cpp index 0a8ac0ed..89f78696 100644 --- a/moose-core/biophysics/IzhikevichNrn.cpp +++ b/moose-core/biophysics/IzhikevichNrn.cpp @@ -28,7 +28,7 @@ // Code: -#include "header.h" +#include "../basecode/header.h" #include "IzhikevichNrn.h" diff --git a/moose-core/biophysics/Leakage.cpp b/moose-core/biophysics/Leakage.cpp index b3bf9b71..bd52d20f 100644 --- a/moose-core/biophysics/Leakage.cpp +++ b/moose-core/biophysics/Leakage.cpp @@ -45,7 +45,7 @@ // Code: -#include "header.h" +#include "../basecode/header.h" #include "ChanBase.h" #include "ChanCommon.h" #include "Leakage.h" diff --git a/moose-core/biophysics/MMPump.cpp b/moose-core/biophysics/MMPump.cpp index e6c0dd76..8c4e7423 100644 --- a/moose-core/biophysics/MMPump.cpp +++ b/moose-core/biophysics/MMPump.cpp @@ -1,6 +1,6 @@ -#include "header.h" +#include "../basecode/header.h" #include "MMPump.h" -#include "ElementValueFinfo.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/numutil.h" #include <cmath> diff --git a/moose-core/biophysics/MarkovChannel.cpp b/moose-core/biophysics/MarkovChannel.cpp index ab601ca8..a79b17b4 100644 --- a/moose-core/biophysics/MarkovChannel.cpp +++ b/moose-core/biophysics/MarkovChannel.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "VectorTable.h" #include "../builtins/Interpol2D.h" #include "MarkovRateTable.h" diff --git a/moose-core/biophysics/MarkovGslSolver.cpp b/moose-core/biophysics/MarkovGslSolver.cpp index 0260215a..ca90e7a3 100644 --- a/moose-core/biophysics/MarkovGslSolver.cpp +++ b/moose-core/biophysics/MarkovGslSolver.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include <gsl/gsl_errno.h> #include <gsl/gsl_odeiv.h> #include "MarkovGslSolver.h" diff --git a/moose-core/biophysics/MarkovRateTable.cpp b/moose-core/biophysics/MarkovRateTable.cpp index 12dbe32f..5bcaf532 100644 --- a/moose-core/biophysics/MarkovRateTable.cpp +++ b/moose-core/biophysics/MarkovRateTable.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ #include <iomanip> -#include "header.h" +#include "../basecode/header.h" #include "VectorTable.h" #include "../builtins/Interpol2D.h" #include "MarkovRateTable.h" diff --git a/moose-core/biophysics/MarkovSolver.cpp b/moose-core/biophysics/MarkovSolver.cpp index 0c877950..3f1a0e00 100644 --- a/moose-core/biophysics/MarkovSolver.cpp +++ b/moose-core/biophysics/MarkovSolver.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include <float.h> //Needed for DBL_MAX and DBL_MIN -#include "header.h" +#include <cfloat> //Needed for DBL_MAX and DBL_MIN +#include "../basecode/header.h" #include "MatrixOps.h" #include "VectorTable.h" diff --git a/moose-core/biophysics/MarkovSolverBase.cpp b/moose-core/biophysics/MarkovSolverBase.cpp index bcf5ccf4..6d57f1fc 100644 --- a/moose-core/biophysics/MarkovSolverBase.cpp +++ b/moose-core/biophysics/MarkovSolverBase.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include <float.h> //Needed for DBL_MAX and DBL_MIN -#include "header.h" +#include <cfloat> +#include "../basecode/header.h" #include "MatrixOps.h" #include "VectorTable.h" diff --git a/moose-core/biophysics/MatrixOps.cpp b/moose-core/biophysics/MatrixOps.cpp index f0f478c3..d251cf54 100644 --- a/moose-core/biophysics/MatrixOps.cpp +++ b/moose-core/biophysics/MatrixOps.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <vector> #include <math.h> -#include "doubleEq.h" +#include "../basecode/doubleEq.h" #include <iostream> #include "MatrixOps.h" diff --git a/moose-core/biophysics/MgBlock.cpp b/moose-core/biophysics/MgBlock.cpp index a070e7aa..ace49df1 100644 --- a/moose-core/biophysics/MgBlock.cpp +++ b/moose-core/biophysics/MgBlock.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "ChanBase.h" #include "ChanCommon.h" #include "MgBlock.h" diff --git a/moose-core/biophysics/NMDAChan.cpp b/moose-core/biophysics/NMDAChan.cpp index 7699ab16..1544d730 100644 --- a/moose-core/biophysics/NMDAChan.cpp +++ b/moose-core/biophysics/NMDAChan.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "ChanBase.h" #include "ChanCommon.h" #include "SynChan.h" diff --git a/moose-core/biophysics/Nernst.cpp b/moose-core/biophysics/Nernst.cpp index 3ffb36ae..01104201 100644 --- a/moose-core/biophysics/Nernst.cpp +++ b/moose-core/biophysics/Nernst.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Nernst.h" const double Nernst::R_OVER_F = 8.6171458e-5; diff --git a/moose-core/biophysics/Neuron.cpp b/moose-core/biophysics/Neuron.cpp index 3fbab6d0..15ec8e60 100644 --- a/moose-core/biophysics/Neuron.cpp +++ b/moose-core/biophysics/Neuron.cpp @@ -7,19 +7,19 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" -#include "LookupElementValueFinfo.h" -#include "shell/Shell.h" -#include "shell/Wildcard.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" +#include "../basecode/LookupElementValueFinfo.h" +#include "../shell/Shell.h" +#include "../shell/Wildcard.h" #include "ReadCell.h" -#include "utility/Vec.h" +#include "../utility/Vec.h" #include "SwcSegment.h" #include "Spine.h" #include "Neuron.h" -#include "basecode/global.h" +#include "../basecode/global.h" -#include "muParser.h" +#include "../external/muparser/include/muParser.h" class nuParser: public mu::Parser { diff --git a/moose-core/biophysics/ReadCell.cpp b/moose-core/biophysics/ReadCell.cpp index 2a35b98c..d900e5a3 100644 --- a/moose-core/biophysics/ReadCell.cpp +++ b/moose-core/biophysics/ReadCell.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" #include "ReadCell.h" #include "../utility/utility.h" diff --git a/moose-core/biophysics/ReadSwc.cpp b/moose-core/biophysics/ReadSwc.cpp index 22cc98c8..9329ed51 100644 --- a/moose-core/biophysics/ReadSwc.cpp +++ b/moose-core/biophysics/ReadSwc.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" #include "../utility/Vec.h" #include "SwcSegment.h" diff --git a/moose-core/biophysics/SpikeGen.cpp b/moose-core/biophysics/SpikeGen.cpp index dad12260..3fe04809 100644 --- a/moose-core/biophysics/SpikeGen.cpp +++ b/moose-core/biophysics/SpikeGen.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "SpikeGen.h" /////////////////////////////////////////////////////// diff --git a/moose-core/biophysics/Spine.cpp b/moose-core/biophysics/Spine.cpp index 03ca6eac..d3da2e1a 100644 --- a/moose-core/biophysics/Spine.cpp +++ b/moose-core/biophysics/Spine.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/Vec.h" #include "SwcSegment.h" #include "Spine.h" diff --git a/moose-core/biophysics/SymCompartment.cpp b/moose-core/biophysics/SymCompartment.cpp index 11d2a07f..b71df59b 100644 --- a/moose-core/biophysics/SymCompartment.cpp +++ b/moose-core/biophysics/SymCompartment.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "CompartmentBase.h" #include "Compartment.h" diff --git a/moose-core/biophysics/SynChan.cpp b/moose-core/biophysics/SynChan.cpp index 4fd207c5..4ce9a3b7 100644 --- a/moose-core/biophysics/SynChan.cpp +++ b/moose-core/biophysics/SynChan.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "ChanBase.h" #include "ChanCommon.h" #include "SynChan.h" diff --git a/moose-core/biophysics/VClamp.cpp b/moose-core/biophysics/VClamp.cpp index b28218d5..cd0760ff 100644 --- a/moose-core/biophysics/VClamp.cpp +++ b/moose-core/biophysics/VClamp.cpp @@ -45,8 +45,8 @@ // Code: -#include "header.h" -#include "Dinfo.h" +#include "../basecode/header.h" +#include "../basecode/Dinfo.h" #include "VClamp.h" using namespace moose; diff --git a/moose-core/biophysics/VectorTable.cpp b/moose-core/biophysics/VectorTable.cpp index ef66a926..cbb8c96d 100644 --- a/moose-core/biophysics/VectorTable.cpp +++ b/moose-core/biophysics/VectorTable.cpp @@ -6,7 +6,7 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "VectorTable.h" #define INIT_XMIN 0 diff --git a/moose-core/builtins/Arith.cpp b/moose-core/builtins/Arith.cpp index ae5166bf..6e091ecd 100644 --- a/moose-core/builtins/Arith.cpp +++ b/moose-core/builtins/Arith.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <queue> -#include "header.h" +#include "../basecode/header.h" #include "Arith.h" static SrcFinfo1< double > *output() { diff --git a/moose-core/builtins/CMakeLists.txt b/moose-core/builtins/CMakeLists.txt index 64caa561..9c226011 100644 --- a/moose-core/builtins/CMakeLists.txt +++ b/moose-core/builtins/CMakeLists.txt @@ -1,7 +1,5 @@ -include_directories( ${CMAKE_SOURCE_DIR}/msg ) -include_directories( ${CMAKE_SOURCE_DIR}/basecode ) -include_directories( ${CMAKE_SOURCE_DIR}/external/muparser/include ) -include_directories( ${CMAKE_SOURCE_DIR}/scheduling ) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake ) set(SRCS Arith.cpp diff --git a/moose-core/builtins/Func.cpp b/moose-core/builtins/Func.cpp index c8c6624d..7408ded3 100644 --- a/moose-core/builtins/Func.cpp +++ b/moose-core/builtins/Func.cpp @@ -45,7 +45,7 @@ // Code: -#include "header.h" +#include "../basecode/header.h" #include "../utility/utility.h" #include "../utility/numutil.h" #include "Func.h" diff --git a/moose-core/builtins/Func.h b/moose-core/builtins/Func.h index 9c2ee784..4ca6d097 100644 --- a/moose-core/builtins/Func.h +++ b/moose-core/builtins/Func.h @@ -47,7 +47,7 @@ #ifndef _FUNC_H #define _FUNC_H -#include "muParser.h" +#include "../external/muparser/include/muParser.h" /** Simple function parser and evaluator for MOOSE. This can take a mathematical expression in standard C form and a list of variables values and diff --git a/moose-core/builtins/Function.cpp b/moose-core/builtins/Function.cpp index 8c82c64b..3883b699 100644 --- a/moose-core/builtins/Function.cpp +++ b/moose-core/builtins/Function.cpp @@ -45,13 +45,13 @@ // Code: -#include "header.h" +#include "../basecode/header.h" #include "../utility/utility.h" #include "../utility/numutil.h" #include "Variable.h" #include "Function.h" -#include "ElementValueFinfo.h" +#include "../basecode/ElementValueFinfo.h" #define PARSER_MAXVARS 100 diff --git a/moose-core/builtins/Function.h b/moose-core/builtins/Function.h index 8f50957b..6a9fff3f 100644 --- a/moose-core/builtins/Function.h +++ b/moose-core/builtins/Function.h @@ -48,7 +48,7 @@ #ifndef _MOOSE_FUNCTION_H_ #define _MOOSE_FUNCTION_H_ -#include "muParser.h" +#include "../external/muparser/include/muParser.h" /** Simple function parser and evaluator for MOOSE. This can take a mathematical @@ -149,11 +149,11 @@ protected: bool _useTrigger; bool _doEvalAtReinit; - // this stores variables received via incoming messages, identifiers of + // this stores variables received via incoming messages, identifiers of // the form x{i} are included in this vector<Variable *> _varbuf; - // this stores variable values pulled by sending request. identifiers of + // this stores variable values pulled by sending request. identifiers of // the form y{i} are included in this vector< double * > _pullbuf; map< string, double *> _constbuf; // for constants @@ -163,7 +163,9 @@ protected: void _clearBuffer(); void _showError(mu::Parser::exception_type &e) const; - char* _stoich; // Used by kinetic solvers when this is zombified. + + // Used by kinetic solvers when this is zombified. + char* _stoich; }; diff --git a/moose-core/builtins/Group.cpp b/moose-core/builtins/Group.cpp index 2a0db02f..b15cb223 100644 --- a/moose-core/builtins/Group.cpp +++ b/moose-core/builtins/Group.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <queue> -#include "header.h" +#include "../basecode/header.h" #include "Group.h" ////////////////////////////////////////////////////////////// diff --git a/moose-core/builtins/Interpol.cpp b/moose-core/builtins/Interpol.cpp index ee84e447..b7443ab8 100644 --- a/moose-core/builtins/Interpol.cpp +++ b/moose-core/builtins/Interpol.cpp @@ -45,7 +45,7 @@ // -#include "header.h" +#include "../basecode/header.h" #include "../utility/numutil.h" #include "TableBase.h" #include "Interpol.h" diff --git a/moose-core/builtins/Interpol2D.cpp b/moose-core/builtins/Interpol2D.cpp index de5b6a6d..a35fe86a 100644 --- a/moose-core/builtins/Interpol2D.cpp +++ b/moose-core/builtins/Interpol2D.cpp @@ -9,7 +9,7 @@ #include <fstream> #include <sstream> -#include "header.h" +#include "../basecode/header.h" #include "../utility/strutil.h" #include "Interpol2D.h" diff --git a/moose-core/builtins/Mstring.cpp b/moose-core/builtins/Mstring.cpp index 3b3e2068..f19b805e 100644 --- a/moose-core/builtins/Mstring.cpp +++ b/moose-core/builtins/Mstring.cpp @@ -6,7 +6,7 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Mstring.h" const Cinfo* Mstring::initCinfo() diff --git a/moose-core/builtins/SpikeStats.cpp b/moose-core/builtins/SpikeStats.cpp index 544d843f..24c5a429 100644 --- a/moose-core/builtins/SpikeStats.cpp +++ b/moose-core/builtins/SpikeStats.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Stats.h" #include "SpikeStats.h" diff --git a/moose-core/builtins/Stats.cpp b/moose-core/builtins/Stats.cpp index cc2f94b3..5c1ab3ab 100644 --- a/moose-core/builtins/Stats.cpp +++ b/moose-core/builtins/Stats.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Stats.h" static SrcFinfo1< vector< double >* > *requestOut() { diff --git a/moose-core/builtins/StimulusTable.cpp b/moose-core/builtins/StimulusTable.cpp index 00b442f7..c5068fdb 100644 --- a/moose-core/builtins/StimulusTable.cpp +++ b/moose-core/builtins/StimulusTable.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include <fstream> #include "TableBase.h" #include "StimulusTable.h" diff --git a/moose-core/builtins/Streamer.cpp b/moose-core/builtins/Streamer.cpp index dd9c0bf2..5ecde621 100644 --- a/moose-core/builtins/Streamer.cpp +++ b/moose-core/builtins/Streamer.cpp @@ -17,11 +17,11 @@ #include <algorithm> #include <sstream> -#include "global.h" -#include "header.h" +#include "../basecode/global.h" +#include "../basecode/header.h" #include "Streamer.h" -#include "Clock.h" -#include "utility/utility.h" +#include "../scheduling/Clock.h" +#include "../utility/utility.h" #include "../shell/Shell.h" diff --git a/moose-core/builtins/StreamerBase.cpp b/moose-core/builtins/StreamerBase.cpp index be264dd0..cb436b99 100644 --- a/moose-core/builtins/StreamerBase.cpp +++ b/moose-core/builtins/StreamerBase.cpp @@ -15,8 +15,8 @@ */ -#include "global.h" -#include "header.h" +#include "../basecode/global.h" +#include "../basecode/header.h" #include "StreamerBase.h" #include "../scheduling/Clock.h" diff --git a/moose-core/builtins/Table.cpp b/moose-core/builtins/Table.cpp index c82c6a8d..f5a6b771 100644 --- a/moose-core/builtins/Table.cpp +++ b/moose-core/builtins/Table.cpp @@ -7,13 +7,13 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "global.h" +#include "../basecode/header.h" +#include "../basecode/global.h" #include <fstream> #include "TableBase.h" #include "Table.h" -#include "Clock.h" +#include "../scheduling/Clock.h" #include "StreamerBase.h" // Write to numpy arrays. diff --git a/moose-core/builtins/TableBase.cpp b/moose-core/builtins/TableBase.cpp index f5c11e75..e4467c6f 100644 --- a/moose-core/builtins/TableBase.cpp +++ b/moose-core/builtins/TableBase.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include <fstream> #include "../utility/strutil.h" #include "TableBase.h" diff --git a/moose-core/builtins/TimeTable.cpp b/moose-core/builtins/TimeTable.cpp index d2ebdb80..ec9a7bf2 100644 --- a/moose-core/builtins/TimeTable.cpp +++ b/moose-core/builtins/TimeTable.cpp @@ -9,7 +9,7 @@ **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include <fstream> #include "TableBase.h" #include "TimeTable.h" diff --git a/moose-core/builtins/Variable.cpp b/moose-core/builtins/Variable.cpp index bfeb6995..6233e248 100644 --- a/moose-core/builtins/Variable.cpp +++ b/moose-core/builtins/Variable.cpp @@ -45,7 +45,7 @@ // Code: -#include "header.h" +#include "../basecode/header.h" #include "Variable.h" #include "Function.h" diff --git a/moose-core/builtins/testBuiltins.cpp b/moose-core/builtins/testBuiltins.cpp index 4c05470a..d94f4ecf 100644 --- a/moose-core/builtins/testBuiltins.cpp +++ b/moose-core/builtins/testBuiltins.cpp @@ -7,9 +7,9 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "DiagonalMsg.h" -#include "OneToAllMsg.h" +#include "../basecode/header.h" +#include "../msg/DiagonalMsg.h" +#include "../msg/OneToAllMsg.h" #include "../scheduling/Clock.h" #include "Arith.h" #include "TableBase.h" diff --git a/moose-core/device/CMakeLists.txt b/moose-core/device/CMakeLists.txt index 564ae44c..01b5bc9b 100644 --- a/moose-core/device/CMakeLists.txt +++ b/moose-core/device/CMakeLists.txt @@ -1,5 +1,5 @@ -include_directories(../msg) -include_directories(../basecode) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) add_library(device PulseGen.cpp DiffAmp.cpp diff --git a/moose-core/device/PulseGen.cpp b/moose-core/device/PulseGen.cpp index 20a10af5..b98a4981 100644 --- a/moose-core/device/PulseGen.cpp +++ b/moose-core/device/PulseGen.cpp @@ -29,7 +29,7 @@ // Code: -#include "header.h" +#include "../basecode/header.h" #include "PulseGen.h" static SrcFinfo1< double >* outputOut() diff --git a/moose-core/diffusion/CMakeLists.txt b/moose-core/diffusion/CMakeLists.txt index b084c506..95c1ebf0 100644 --- a/moose-core/diffusion/CMakeLists.txt +++ b/moose-core/diffusion/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.6) -include_directories(../basecode ../utility ../ksolve) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) include_directories(${GSL_INCLUDE_DIRS}) add_library(diffusion FastMatrixElim.cpp diff --git a/moose-core/diffusion/DiffPoolVec.cpp b/moose-core/diffusion/DiffPoolVec.cpp index d8a9208d..536d7dd7 100644 --- a/moose-core/diffusion/DiffPoolVec.cpp +++ b/moose-core/diffusion/DiffPoolVec.cpp @@ -14,7 +14,7 @@ #include <iostream> using namespace std; -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "DiffPoolVec.h" /** diff --git a/moose-core/diffusion/Dsolve.cpp b/moose-core/diffusion/Dsolve.cpp index c1428146..b90fbc26 100644 --- a/moose-core/diffusion/Dsolve.cpp +++ b/moose-core/diffusion/Dsolve.cpp @@ -7,14 +7,14 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" -#include "SparseMatrix.h" -#include "KinSparseMatrix.h" -#include "VoxelPoolsBase.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" +#include "../basecode/SparseMatrix.h" +#include "../ksolve/KinSparseMatrix.h" +#include "../ksolve/VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" -#include "XferInfo.h" -#include "ZombiePoolInterface.h" +#include "../ksolve/XferInfo.h" +#include "../ksolve/ZombiePoolInterface.h" #include "../kinetics/ConcChan.h" #include "DiffPoolVec.h" #include "ConcChanInfo.h" diff --git a/moose-core/diffusion/standaloneTestFastElim.cpp b/moose-core/diffusion/standaloneTestFastElim.cpp index 9e4eb675..35b56b10 100644 --- a/moose-core/diffusion/standaloneTestFastElim.cpp +++ b/moose-core/diffusion/standaloneTestFastElim.cpp @@ -18,60 +18,61 @@ const unsigned int SM_MAX_COLUMNS = 200000; const unsigned int SM_RESERVE = 8; void sortByColumn( - vector< unsigned int >& col, vector< double >& entry ); + vector< unsigned int >& col, vector< double >& entry ); void testSorting(); class Unroll { - public: - Unroll( double diag, double off, unsigned int i, unsigned int j ) - : - diagVal( diag ), - offDiagVal( off ), - row( i ), - col( j ) - {;} - double diagVal; - double offDiagVal; - unsigned int row; // On which the diagonal is located - unsigned int col; // Col on which the offDiagVal is located. +public: + Unroll( double diag, double off, unsigned int i, unsigned int j ) + : + diagVal( diag ), + offDiagVal( off ), + row( i ), + col( j ) + {;} + double diagVal; + double offDiagVal; + unsigned int row; // On which the diagonal is located + unsigned int col; // Col on which the offDiagVal is located. }; class FastElim: public SparseMatrix< double > { - public: - void makeTestMatrix( const double* test, unsigned int numCompts ); - /* - void rowElim( unsigned int row1, unsigned int row2, - vector< double >& rhs ); - */ - void buildForwardElim( vector< unsigned int >& diag, - vector< Triplet< double > >& fops ); - void buildBackwardSub( vector< unsigned int >& diag, - vector< Triplet< double > >& bops, vector< double >& diagVal ); - ///////////////////////////////////////////////////////////// - // Here we do stuff to set up the Hines ordering of the matrix. - ///////////////////////////////////////////////////////////// - bool hinesReorder( const vector< unsigned int >& parentVoxel ); - const double* allEntries() const; - void shuffleRows( - const vector< unsigned int >& lookupOldRowFromNew ); - /* - bool hinesReorder(); - 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, - vector< unsigned int >& rowReorder, - vector< bool >& extracted ); - */ +public: + void makeTestMatrix( const double* test, unsigned int numCompts ); + /* + void rowElim( unsigned int row1, unsigned int row2, + vector< double >& rhs ); + */ + void buildForwardElim( vector< unsigned int >& diag, + vector< Triplet< double > >& fops ); + void buildBackwardSub( vector< unsigned int >& diag, + vector< Triplet< double > >& bops, vector< double >& diagVal ); + ///////////////////////////////////////////////////////////// + // Here we do stuff to set up the Hines ordering of the matrix. + ///////////////////////////////////////////////////////////// + bool hinesReorder( const vector< unsigned int >& parentVoxel ); + const double* allEntries() const; + void shuffleRows( + const vector< unsigned int >& lookupOldRowFromNew ); + /* + bool hinesReorder(); + 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, + vector< unsigned int >& rowReorder, + vector< bool >& extracted ); + */ }; -const double* FastElim::allEntries() const { - return &N_[0]; +const double* FastElim::allEntries() const +{ + return &N_[0]; } // @@ -84,99 +85,111 @@ const double* FastElim::allEntries() const { */ bool FastElim::hinesReorder( const vector< unsigned int >& parentVoxel ) { - // 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 ); - vector< unsigned int > lookupOldRowFromNew; - vector< bool > rowPending( nrows_, true ); - unsigned int numDone = 0; - for ( unsigned int i = 0; i < nrows_; ++i ) { - if ( parentVoxel[i] != -1 ) - numKids[ parentVoxel[i] ]++; - } - while ( numDone < nrows_ ) { - for ( unsigned int i = 0; i < nrows_; ++i ) { - if ( rowPending[i] && numKids[i] == 0 ) { - lookupOldRowFromNew.push_back( i ); - rowPending[i] = false; - numDone++; - unsigned int pa = parentVoxel[i]; - // Unsure what the root parent is. Assume it is -1 - while ( pa != -1 && numKids[pa] == 1 ) { - assert( rowPending[pa] ); - rowPending[pa] = false; - numDone++; - lookupOldRowFromNew.push_back( pa ); - pa = parentVoxel[pa]; - } - if ( pa != -1 ) { - assert( numKids[pa] > 0 ); - numKids[pa]--; - } - } - } - } - - cout << setprecision(4); - cout << "oldRowFromNew= {" ; - for ( int i = 0; i < nrows_; ++i ) - cout << lookupOldRowFromNew[i] << ", "; - cout << "}\n"; - // Then we fill in the reordered matrix. Note we need to reorder - // columns too. - shuffleRows( lookupOldRowFromNew ); + // 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 ); + vector< unsigned int > lookupOldRowFromNew; + vector< bool > rowPending( nrows_, true ); + unsigned int numDone = 0; + for ( unsigned int i = 0; i < nrows_; ++i ) + { + if ( parentVoxel[i] != -1 ) + numKids[ parentVoxel[i] ]++; + } + while ( numDone < nrows_ ) + { + for ( unsigned int i = 0; i < nrows_; ++i ) + { + if ( rowPending[i] && numKids[i] == 0 ) + { + lookupOldRowFromNew.push_back( i ); + rowPending[i] = false; + numDone++; + unsigned int pa = parentVoxel[i]; + // Unsure what the root parent is. Assume it is -1 + while ( pa != -1 && numKids[pa] == 1 ) + { + assert( rowPending[pa] ); + rowPending[pa] = false; + numDone++; + lookupOldRowFromNew.push_back( pa ); + pa = parentVoxel[pa]; + } + if ( pa != -1 ) + { + assert( numKids[pa] > 0 ); + numKids[pa]--; + } + } + } + } + + cout << setprecision(4); + cout << "oldRowFromNew= {" ; + for ( int i = 0; i < nrows_; ++i ) + cout << lookupOldRowFromNew[i] << ", "; + cout << "}\n"; + // Then we fill in the reordered matrix. Note we need to reorder + // columns too. + shuffleRows( lookupOldRowFromNew ); + return true; } // Fill in the reordered matrix. Note we need to reorder columns too. void FastElim::shuffleRows( - const vector< unsigned int >& lookupOldRowFromNew ) + const vector< unsigned int >& lookupOldRowFromNew ) { - vector< unsigned int > lookupNewRowFromOld( nrows_ ); - for ( unsigned int i = 0; i < nrows_; ++i ) - lookupNewRowFromOld[ lookupOldRowFromNew[i] ] = i; - - FastElim temp = *this; - clear(); - setSize( temp.nrows_, temp.nrows_ ); - for ( unsigned int i = 0; i < lookupOldRowFromNew.size(); ++i ) { - vector< unsigned int > c; - vector< double > e; - unsigned int num = temp.getRow( lookupOldRowFromNew[i], e, c ); - vector< unsigned int > newc( num ); - vector< double > newe( num ); - for ( unsigned int j = 0; j < num; ++j ) { - newc[j] = lookupNewRowFromOld[ c[j] ]; - newe[j] = e[j]; - } - // Now we need to sort the new row entries in increasing col order. - /* - sortByColumn( newc, newe ); - addRow( i, newe, newc ); - */ - sortByColumn( newc, e ); - addRow( i, e, newc ); - } + vector< unsigned int > lookupNewRowFromOld( nrows_ ); + for ( unsigned int i = 0; i < nrows_; ++i ) + lookupNewRowFromOld[ lookupOldRowFromNew[i] ] = i; + + FastElim temp = *this; + clear(); + setSize( temp.nrows_, temp.nrows_ ); + for ( unsigned int i = 0; i < lookupOldRowFromNew.size(); ++i ) + { + vector< unsigned int > c; + vector< double > e; + unsigned int num = temp.getRow( lookupOldRowFromNew[i], e, c ); + vector< unsigned int > newc( num ); + vector< double > newe( num ); + for ( unsigned int j = 0; j < num; ++j ) + { + newc[j] = lookupNewRowFromOld[ c[j] ]; + newe[j] = e[j]; + } + // Now we need to sort the new row entries in increasing col order. + /* + sortByColumn( newc, newe ); + addRow( i, newe, newc ); + */ + sortByColumn( newc, e ); + addRow( i, e, newc ); + } } 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 - // 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 ) { - if ( col[j] < col[j-1] ) { - unsigned int temp = col[j]; - col[j] = col[j-1]; - col[j-1] = temp; - double v = entry[j]; - entry[j] = entry[j-1]; - entry[j-1] = v; - } - } - } + unsigned int num = col.size(); + assert( num == entry.size() ); + // 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 ) + { + if ( col[j] < col[j-1] ) + { + unsigned int temp = col[j]; + col[j] = col[j-1]; + col[j-1] = temp; + double v = entry[j]; + entry[j] = entry[j-1]; + entry[j-1] = v; + } + } + } } /* @@ -254,20 +267,25 @@ void FastElim::rowElim( unsigned int row1, unsigned int row2, void FastElim::makeTestMatrix( const double* test, unsigned int numCompts ) { - setSize( numCompts, numCompts ); - vector< double > row( numCompts, ~0 ); - unsigned int i = 1; - for ( unsigned int i = 0; i < numCompts; ++i ) { - for ( unsigned int j = 0; j < numCompts; ++j ) { - unsigned int k = i * numCompts + j; - if ( test[k] < 0.1 ) { - } else { - N_.push_back( test[k] ); - colIndex_.push_back( j ); - } - } - rowStart_[i + 1] = N_.size(); - } + setSize( numCompts, numCompts ); + vector< double > row( numCompts, ~0 ); + unsigned int i = 1; + for ( unsigned int i = 0; i < numCompts; ++i ) + { + for ( unsigned int j = 0; j < numCompts; ++j ) + { + unsigned int k = i * numCompts + j; + if ( test[k] < 0.1 ) + { + } + else + { + N_.push_back( test[k] ); + colIndex_.push_back( j ); + } + } + rowStart_[i + 1] = N_.size(); + } } /* @@ -284,60 +302,73 @@ back-substitution. * rows, if any, on branches. */ void FastElim::buildForwardElim( vector< unsigned int >& diag, - vector< Triplet< double > >& fops ) + vector< Triplet< double > >& fops ) { - vector< vector< unsigned int > > rowsToElim( nrows_ ); - diag.clear(); - for ( unsigned int i = 0; i < nrows_; ++i ) { - unsigned int rs = rowStart_[i]; - unsigned int re = rowStart_[i+1]; - for ( unsigned int j = rs; j < re; ++j ) { - unsigned int k = colIndex_[j]; - if ( k == i ) { - diag.push_back(j); - } else if ( k > i ) { - rowsToElim[ i ].push_back( k ); - } - } - } - for ( unsigned int i = 0; i < nrows_; ++i ) { - double d = N_[diag[i]]; - unsigned int diagend = rowStart_[ i + 1 ]; - assert( diag[i] < diagend ); - vector< unsigned int >& elim = rowsToElim[i]; - for ( unsigned int j = 0; j < elim.size(); ++j ) { - unsigned int erow = elim[j]; - if ( erow == i ) continue; - unsigned int rs = rowStart_[ erow ]; - unsigned int re = rowStart_[ erow+1 ]; - // assert( colIndex_[rs] == i ); - double ratio = get( erow, i ) / d; - // double ratio = N_[rs]/N_[diag[i]]; - for ( unsigned int k = diag[i]+1; k < diagend; ++k ) { - unsigned int col = colIndex_[k]; - // findElimEntry, subtract it out. - for ( unsigned int q = rs; q < re; ++q ) { - if ( colIndex_[q] == col ) { - N_[q] -= N_[k] * ratio; - } - } - } - fops.push_back( Triplet< double >( ratio, i, erow) ); - } - } - for ( unsigned int i = 0; i < rowsToElim.size(); ++i ) { - cout << i << " : "; - for ( unsigned int j = 0; j < rowsToElim[i].size(); ++j ) { - cout << rowsToElim[i][j] << " "; - } - cout << endl; - } - for ( unsigned int i = 0; i < fops.size(); ++i ) { - cout << "fops[" << i << "]= " << fops[i].b_ << " " << fops[i].c_ << - " " << fops[i].a_ << endl; - } - /* - */ + vector< vector< unsigned int > > rowsToElim( nrows_ ); + diag.clear(); + for ( unsigned int i = 0; i < nrows_; ++i ) + { + unsigned int rs = rowStart_[i]; + unsigned int re = rowStart_[i+1]; + for ( unsigned int j = rs; j < re; ++j ) + { + unsigned int k = colIndex_[j]; + if ( k == i ) + { + diag.push_back(j); + } + else if ( k > i ) + { + rowsToElim[ i ].push_back( k ); + } + } + } + for ( unsigned int i = 0; i < nrows_; ++i ) + { + double d = N_[diag[i]]; + unsigned int diagend = rowStart_[ i + 1 ]; + assert( diag[i] < diagend ); + vector< unsigned int >& elim = rowsToElim[i]; + for ( unsigned int j = 0; j < elim.size(); ++j ) + { + unsigned int erow = elim[j]; + if ( erow == i ) continue; + unsigned int rs = rowStart_[ erow ]; + unsigned int re = rowStart_[ erow+1 ]; + // assert( colIndex_[rs] == i ); + double ratio = get( erow, i ) / d; + // double ratio = N_[rs]/N_[diag[i]]; + for ( unsigned int k = diag[i]+1; k < diagend; ++k ) + { + unsigned int col = colIndex_[k]; + // findElimEntry, subtract it out. + for ( unsigned int q = rs; q < re; ++q ) + { + if ( colIndex_[q] == col ) + { + N_[q] -= N_[k] * ratio; + } + } + } + fops.push_back( Triplet< double >( ratio, i, erow) ); + } + } + for ( unsigned int i = 0; i < rowsToElim.size(); ++i ) + { + cout << i << " : "; + for ( unsigned int j = 0; j < rowsToElim[i].size(); ++j ) + { + cout << rowsToElim[i][j] << " "; + } + cout << endl; + } + for ( unsigned int i = 0; i < fops.size(); ++i ) + { + cout << "fops[" << i << "]= " << fops[i].b_ << " " << fops[i].c_ << + " " << fops[i].a_ << endl; + } + /* + */ } /** @@ -350,307 +381,320 @@ void FastElim::buildForwardElim( vector< unsigned int >& diag, * RHS[row] = ( RHS[row] - offDiagVal * RHS[col] ) / diagVal */ void FastElim::buildBackwardSub( vector< unsigned int >& diag, - vector< Triplet< double > >& bops, vector< double >& diagVal ) + 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 - // rows, if any, on branches. - vector< vector< unsigned int > > rowsToSub( nrows_ ); - - for ( unsigned int i = 0; i < nrows_; ++i ) { - unsigned int d = diag[i] + 1; - unsigned int re = rowStart_[i+1]; - for ( unsigned int j = d; j < re; ++j ) { - unsigned int k = colIndex_[j]; - // At this point the row to sub is at (i, k). We need to go down - // to the (k,k) diagonal to sub it out. - rowsToSub[ k ].push_back( i ); - } - } - for ( unsigned int i = 0; i < rowsToSub.size(); ++i ) { - cout << i << " : "; - for ( unsigned int j = 0; j < rowsToSub[i].size(); ++j ) { - cout << rowsToSub[i][j] << " "; - } - cout << endl; - } - - diagVal.resize( 0 ); - // Fill in the diagonal terms. Here we do all entries. - for ( unsigned int i = 0; i != nrows_ ; ++i ) { - diagVal.push_back( 1.0 / N_[diag[i]] ); - } - - // Fill in the back-sub operations. Note we don't need to check zero. - for ( unsigned int i = nrows_-1; i != 0 ; --i ) { - for ( unsigned int j = rowsToSub[i].size() - 1; j != -1; --j ) { - unsigned int k = rowsToSub[i][j]; - double val = get( k, i ); //k is the row to go, i is the diag. - bops.push_back( Triplet< double >( val * diagVal[i], i, k ) ); - } - } - - for ( unsigned int i = 0; i < bops.size(); ++i ) { - cout << i << ": " << bops[i].a_ << " " << - bops[i].b_ << " " << // diagonal index - bops[i].c_ << " " << // off-diagonal index - 1.0 / diagVal[bops[i].b_] << // diagonal value. - endl; - } + // 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 + // rows, if any, on branches. + vector< vector< unsigned int > > rowsToSub( nrows_ ); + + for ( unsigned int i = 0; i < nrows_; ++i ) + { + unsigned int d = diag[i] + 1; + unsigned int re = rowStart_[i+1]; + for ( unsigned int j = d; j < re; ++j ) + { + unsigned int k = colIndex_[j]; + // At this point the row to sub is at (i, k). We need to go down + // to the (k,k) diagonal to sub it out. + rowsToSub[ k ].push_back( i ); + } + } + for ( unsigned int i = 0; i < rowsToSub.size(); ++i ) + { + cout << i << " : "; + for ( unsigned int j = 0; j < rowsToSub[i].size(); ++j ) + { + cout << rowsToSub[i][j] << " "; + } + cout << endl; + } + + diagVal.resize( 0 ); + // Fill in the diagonal terms. Here we do all entries. + for ( unsigned int i = 0; i != nrows_ ; ++i ) + { + diagVal.push_back( 1.0 / N_[diag[i]] ); + } + + // Fill in the back-sub operations. Note we don't need to check zero. + for ( unsigned int i = nrows_-1; i != 0 ; --i ) + { + for ( unsigned int j = rowsToSub[i].size() - 1; j != -1; --j ) + { + unsigned int k = rowsToSub[i][j]; + double val = get( k, i ); //k is the row to go, i is the diag. + bops.push_back( Triplet< double >( val * diagVal[i], i, k ) ); + } + } + + for ( unsigned int i = 0; i < bops.size(); ++i ) + { + cout << i << ": " << bops[i].a_ << " " << + bops[i].b_ << " " << // diagonal index + bops[i].c_ << " " << // off-diagonal index + 1.0 / diagVal[bops[i].b_] << // diagonal value. + endl; + } } void advance( vector< double >& y, - const vector< Triplet< double > >& ops, // has both fops and bops. - const vector< double >& diagVal ) + const vector< Triplet< double > >& ops, // has both fops and bops. + const vector< double >& diagVal ) { - for ( vector< Triplet< double > >::const_iterator - i = ops.begin(); i != ops.end(); ++i ) - y[i->c_] -= y[i->b_] * i->a_; - - assert( y.size() == diagVal.size() ); - vector< double >::iterator iy = y.begin(); - for ( vector< double >::const_iterator - i = diagVal.begin(); i != diagVal.end(); ++i ) - *iy++ *= *i; + for ( vector< Triplet< double > >::const_iterator + i = ops.begin(); i != ops.end(); ++i ) + y[i->c_] -= y[i->b_] * i->a_; + + assert( y.size() == diagVal.size() ); + vector< double >::iterator iy = y.begin(); + for ( vector< double >::const_iterator + i = diagVal.begin(); i != diagVal.end(); ++i ) + *iy++ *= *i; } double checkAns( - const double* m, unsigned int numCompts, - const double* ans, const double* rhs ) + const double* m, unsigned int numCompts, + const double* ans, const double* rhs ) { - vector< double > check( numCompts, 0.0 ); - for ( unsigned int i = 0; i < numCompts; ++i ) { - for ( unsigned int j = 0; j < numCompts; ++j ) - check[i] += m[i*numCompts + j] * ans[j]; - } - double ret = 0.0; - for ( unsigned int i = 0; i < numCompts; ++i ) - ret += (check[i] - rhs[i]) * (check[i] - rhs[i] ); - return ret; + vector< double > check( numCompts, 0.0 ); + for ( unsigned int i = 0; i < numCompts; ++i ) + { + for ( unsigned int j = 0; j < numCompts; ++j ) + check[i] += m[i*numCompts + j] * ans[j]; + } + double ret = 0.0; + for ( unsigned int i = 0; i < numCompts; ++i ) + ret += (check[i] - rhs[i]) * (check[i] - rhs[i] ); + return ret; } -main() +int main() { -/* -2 11 - 1 4 - 3 10 - 9 5 - 6 - 7 - 8 - - 1 2 3 4 5 6 7 8 9 10 11 -1 x x 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 -11 x x - static double test[] = { - 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, - 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 0, 8, 9, 0, 0, 0, 0, 10, 0, 0, - 11, 0, 12, 13, 0, 0, 0, 0, 0, 0, 14, - 0, 0, 0, 0, 15, 16, 0, 0, 17, 18, 0, - 0, 0, 0, 0, 19, 20, 21, 0, 22, 0, 0, - 0, 0, 0, 0, 0, 23, 24, 25, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 26, 27, 0, 0, 0, - 0, 0, 28, 0, 29, 30, 0, 0, 31, 0, 0, - 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, - 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 35, - }; - const unsigned int numCompts = 11; -// static unsigned int parents[] = { 3,1,9,3,6,7,8,-1,6,5,4 }; - static unsigned int parents[] = { 2,0,8,2,5,6,7,-1,5,4,3 }; -*/ - -/* -1 3 - 2 4 - 7 5 - 8 6 - 9 - 10 - 11 - - 1 2 3 4 5 6 7 8 9 10 11 -1 x x -2 x x x -3 x x -4 x x x -5 x x -6 x x x -7 x x x x -8 x x x -9 x x x x -10 x x x -11 x x - static double test[] = { - 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 4, 0, 0, 0, 0, 5, 0, 0, 0, 0, - 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8, 9, 0, 0, 10, 0, 0, 0, 0, - 0, 0, 0, 0, 11, 12, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 13, 14, 0, 0, 15, 0, 0, - 0, 16, 0, 17, 0, 0, 18, 19, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 21, 22, 0, 0, - 0, 0, 0, 0, 0, 23, 0, 24, 25, 26, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 28, 29, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, - }; - const unsigned int numCompts = 11; - static unsigned int parents[] = { 1,6,3,6,5,8,7,8,9,10,-1}; -*/ - -/* -Linear cable, 12 segments. -*/ - - static double test[] = { - 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 13, 14, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 16, 17, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 18, 19, 20, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 21, 22, 23, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 24, 25, 26, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 28, 29, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 32, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, - }; - const unsigned int numCompts = 12; - static unsigned int parents[] = { 1,2,3,4,5,6,7,8,9,10,11,-1}; - - /* - static double test[] = { - 1, 2, - 3, 4 - }; - const unsigned int numCompts = 2; - static double test[] = { - 1, 2, 0, 0, - 3, 4, 5, 0, - 0, 6, 7, 8, - 0, 0, 9, 10 - }; - const unsigned int numCompts = 4; - static double test[] = { - 1, 2, 0, 0, 0, 0, - 3, 4, 5, 0, 0, 0, - 0, 6, 7, 8, 0, 0, - 0, 0, 9, 10, 11, 0, - 0, 0, 0, 12, 13, 14, - 0, 0, 0, 0, 15, 16, - }; - const unsigned int numCompts = 6; - static double test[] = { - 1, 2, 0, 0, 0, 0, - 3, 4, 0, 0, 1, 0, - 0, 0, 7, 8, 0, 0, - 0, 0, 9, 10, 11, 0, - 0, 1, 0, 12, 13, 14, - 0, 0, 0, 0, 15, 16, - }; - const unsigned int numCompts = 6; - */ - // testSorting(); // seems to work fine. - FastElim fe; - vector< Triplet< double > > fops; - vector< Unroll > bops; - fe.makeTestMatrix( test, numCompts ); - fe.print(); - cout << endl << endl; - vector< unsigned int > parentVoxel; - parentVoxel.insert( parentVoxel.begin(), &parents[0], &parents[numCompts] ); - fe.hinesReorder( parentVoxel ); - /* - */ - /* - vector< unsigned int > shuf; - for ( unsigned int i = 0; i < numCompts; ++i ) - shuf.push_back( i ); - shuf[0] = 1; - shuf[1] = 0; - fe.shuffleRows( shuf ); - */ - fe.print(); - cout << endl << endl; - FastElim foo = fe; - - vector< unsigned int > diag; - vector< double > diagVal; - fe.buildForwardElim( diag, fops ); - fe.print(); - fe.buildBackwardSub( diag, fops, diagVal ); - vector< double > y( numCompts, 1.0 ); - vector< double > ones( numCompts, 1.0 ); - advance( y, fops, diagVal ); - for ( int i = 0; i < numCompts; ++i ) - 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: " << - checkAns( &alle[0], numCompts, &y[0], &ones[0] ) << endl; - - - - ///////////////////////////////////////////////////////////////////// - // Here we do the gsl test. - vector< double > temp( &test[0], &test[numCompts*numCompts] ); - gsl_matrix_view m = gsl_matrix_view_array( &temp[0], numCompts, numCompts ); - - vector< double > z( numCompts, 1.0 ); - gsl_vector_view b = gsl_vector_view_array( &z[0], numCompts ); - gsl_vector* x = gsl_vector_alloc( numCompts ); - int s; - gsl_permutation* p = gsl_permutation_alloc( numCompts ); - gsl_linalg_LU_decomp( &m.matrix, p, &s ); - gsl_linalg_LU_solve( &m.matrix, p, &b.vector, x); - vector< double > gslAns( numCompts ); - for ( int i = 0; i < numCompts; ++i ) { - gslAns[i] = gsl_vector_get( x, i ); - cout << "x[" << i << "]= " << gslAns[i] << endl; - } - /* - */ - cout << "GSL: " << checkAns( test, numCompts, &gslAns[0], &ones[0] ) << endl; - gsl_vector_free( x ); - - + /* + 2 11 + 1 4 + 3 10 + 9 5 + 6 + 7 + 8 + + 1 2 3 4 5 6 7 8 9 10 11 + 1 x x 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 + 11 x x + static double test[] = { + 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, + 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 0, 8, 9, 0, 0, 0, 0, 10, 0, 0, + 11, 0, 12, 13, 0, 0, 0, 0, 0, 0, 14, + 0, 0, 0, 0, 15, 16, 0, 0, 17, 18, 0, + 0, 0, 0, 0, 19, 20, 21, 0, 22, 0, 0, + 0, 0, 0, 0, 0, 23, 24, 25, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 26, 27, 0, 0, 0, + 0, 0, 28, 0, 29, 30, 0, 0, 31, 0, 0, + 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, + 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 35, + }; + const unsigned int numCompts = 11; + // static unsigned int parents[] = { 3,1,9,3,6,7,8,-1,6,5,4 }; + static unsigned int parents[] = { 2,0,8,2,5,6,7,-1,5,4,3 }; + */ + + /* + 1 3 + 2 4 + 7 5 + 8 6 + 9 + 10 + 11 + + 1 2 3 4 5 6 7 8 9 10 11 + 1 x x + 2 x x x + 3 x x + 4 x x x + 5 x x + 6 x x x + 7 x x x x + 8 x x x + 9 x x x x + 10 x x x + 11 x x + static double test[] = { + 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 4, 0, 0, 0, 0, 5, 0, 0, 0, 0, + 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 9, 0, 0, 10, 0, 0, 0, 0, + 0, 0, 0, 0, 11, 12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 13, 14, 0, 0, 15, 0, 0, + 0, 16, 0, 17, 0, 0, 18, 19, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 20, 21, 22, 0, 0, + 0, 0, 0, 0, 0, 23, 0, 24, 25, 26, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 28, 29, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, + }; + const unsigned int numCompts = 11; + static unsigned int parents[] = { 1,6,3,6,5,8,7,8,9,10,-1}; + */ + + /* + Linear cable, 12 segments. + */ + + static double test[] = + { + 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 12, 13, 14, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 16, 17, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 18, 19, 20, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 21, 22, 23, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 24, 25, 26, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 28, 29, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, + }; + const unsigned int numCompts = 12; + static int parents[] = { 1,2,3,4,5,6,7,8,9,10,11,-1}; + + /* + static double test[] = { + 1, 2, + 3, 4 + }; + const unsigned int numCompts = 2; + static double test[] = { + 1, 2, 0, 0, + 3, 4, 5, 0, + 0, 6, 7, 8, + 0, 0, 9, 10 + }; + const unsigned int numCompts = 4; + static double test[] = { + 1, 2, 0, 0, 0, 0, + 3, 4, 5, 0, 0, 0, + 0, 6, 7, 8, 0, 0, + 0, 0, 9, 10, 11, 0, + 0, 0, 0, 12, 13, 14, + 0, 0, 0, 0, 15, 16, + }; + const unsigned int numCompts = 6; + static double test[] = { + 1, 2, 0, 0, 0, 0, + 3, 4, 0, 0, 1, 0, + 0, 0, 7, 8, 0, 0, + 0, 0, 9, 10, 11, 0, + 0, 1, 0, 12, 13, 14, + 0, 0, 0, 0, 15, 16, + }; + const unsigned int numCompts = 6; + */ + // testSorting(); // seems to work fine. + FastElim fe; + vector< Triplet< double > > fops; + vector< Unroll > bops; + fe.makeTestMatrix( test, numCompts ); + fe.print(); + cout << endl << endl; + vector< unsigned int > parentVoxel; + parentVoxel.insert( parentVoxel.begin(), &parents[0], &parents[numCompts] ); + fe.hinesReorder( parentVoxel ); + /* + */ + /* + vector< unsigned int > shuf; + for ( unsigned int i = 0; i < numCompts; ++i ) + shuf.push_back( i ); + shuf[0] = 1; + shuf[1] = 0; + fe.shuffleRows( shuf ); + */ + fe.print(); + cout << endl << endl; + FastElim foo = fe; + + vector< unsigned int > diag; + vector< double > diagVal; + fe.buildForwardElim( diag, fops ); + fe.print(); + fe.buildBackwardSub( diag, fops, diagVal ); + vector< double > y( numCompts, 1.0 ); + vector< double > ones( numCompts, 1.0 ); + advance( y, fops, diagVal ); + for ( int i = 0; i < numCompts; ++i ) + 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: " << + checkAns( &alle[0], numCompts, &y[0], &ones[0] ) << endl; + + + + ///////////////////////////////////////////////////////////////////// + // Here we do the gsl test. + vector< double > temp( &test[0], &test[numCompts*numCompts] ); + gsl_matrix_view m = gsl_matrix_view_array( &temp[0], numCompts, numCompts ); + + vector< double > z( numCompts, 1.0 ); + gsl_vector_view b = gsl_vector_view_array( &z[0], numCompts ); + gsl_vector* x = gsl_vector_alloc( numCompts ); + int s; + gsl_permutation* p = gsl_permutation_alloc( numCompts ); + gsl_linalg_LU_decomp( &m.matrix, p, &s ); + gsl_linalg_LU_solve( &m.matrix, p, &b.vector, x); + vector< double > gslAns( numCompts ); + for ( int i = 0; i < numCompts; ++i ) + { + gslAns[i] = gsl_vector_get( x, i ); + cout << "x[" << i << "]= " << gslAns[i] << endl; + } + /* + */ + cout << "GSL: " << checkAns( test, numCompts, &gslAns[0], &ones[0] ) << endl; + gsl_vector_free( x ); + return 0; } void testSorting() { - static unsigned int k[] = {20,40,60,80,100,10,30,50,70,90}; - static double d[] = {1,2,3,4,5,6,7,8,9,10}; - vector< unsigned int > col; - col.insert( col.begin(), k, k+10); - vector< double > entry; - entry.insert( entry.begin(), d, d+10); - sortByColumn( col, entry ); - cout << "testing sorting\n"; - for ( int i = 0; i < col.size(); ++i ) { - cout << "d[" << i << "]= " << k[i] << - ", col[" << i << "]= " << col[i] << ", e=" << entry[i] << endl; - } - cout << endl; + static unsigned int k[] = {20,40,60,80,100,10,30,50,70,90}; + static double d[] = {1,2,3,4,5,6,7,8,9,10}; + vector< unsigned int > col; + col.insert( col.begin(), k, k+10); + vector< double > entry; + entry.insert( entry.begin(), d, d+10); + sortByColumn( col, entry ); + cout << "testing sorting\n"; + for ( int i = 0; i < col.size(); ++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 f887cff1..b4ad4170 100644 --- a/moose-core/diffusion/testDiffusion.cpp +++ b/moose-core/diffusion/testDiffusion.cpp @@ -19,7 +19,7 @@ using namespace std; #ifdef USE_GSL #include <gsl/gsl_linalg.h> #endif -#include "header.h" +#include "../basecode/header.h" #include "../basecode/SparseMatrix.h" #include "FastMatrixElim.h" #include "../shell/Shell.h" diff --git a/moose-core/examples/CMakeLists.txt b/moose-core/examples/CMakeLists.txt index b1b3231f..d3a64a16 100644 --- a/moose-core/examples/CMakeLists.txt +++ b/moose-core/examples/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.6) -include_directories(../basecode) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) ADD_LIBRARY(examples Example.cpp Ex.cpp diff --git a/moose-core/examples/Ex.cpp b/moose-core/examples/Ex.cpp index 761bb4f7..2554e468 100644 --- a/moose-core/examples/Ex.cpp +++ b/moose-core/examples/Ex.cpp @@ -1,6 +1,6 @@ -#include "header.h" -#include "ElementValueFinfo.h" -#include "LookupElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" +#include "../basecode/LookupElementValueFinfo.h" #include "Ex.h" Ex::Ex() diff --git a/moose-core/examples/Example.cpp b/moose-core/examples/Example.cpp index 9f9609f8..5f083b28 100644 --- a/moose-core/examples/Example.cpp +++ b/moose-core/examples/Example.cpp @@ -1,8 +1,7 @@ -#include "header.h" +#include "../basecode/header.h" #include "Example.h" -#include "ElementValueFinfo.h" -#include "LookupElementValueFinfo.h" -#include <stdio.h> +#include "../basecode/ElementValueFinfo.h" +#include "../basecode/LookupElementValueFinfo.h" static SrcFinfo1< double > *output() { static SrcFinfo1< double > output( @@ -90,9 +89,9 @@ const Cinfo* Example::initCinfo(){ static const Cinfo* exampleCinfo = Example::initCinfo(); Example::Example() - : - output_( 0.0 ), - x_( 0.0 ), y_( 0.0 ) + : x_( 0.0 ) + , y_( 0.0 ) + , output_( 0.0 ) { ; } diff --git a/moose-core/examples/Example.h b/moose-core/examples/Example.h index e643506d..1d3ff683 100644 --- a/moose-core/examples/Example.h +++ b/moose-core/examples/Example.h @@ -1,3 +1,5 @@ +#ifndef EXAMPLE_H +#endif /* end of include guard: EXAMPLE_H */ class Example { private: @@ -25,3 +27,5 @@ class Example { static const Cinfo* initCinfo(); }; + +#define EXAMPLE_H diff --git a/moose-core/external/muparser/include/muParser.h b/moose-core/external/muparser/include/muParser.h index a4a678e2..653cd44a 100644 --- a/moose-core/external/muparser/include/muParser.h +++ b/moose-core/external/muparser/include/muParser.h @@ -33,7 +33,7 @@ #include "muParserTemplateMagic.h" // Get the random number generator type from here. -#include "randnum/RNG.h" +#include "../../../randnum/RNG.h" extern moose::RNG<double> rng; diff --git a/moose-core/external/muparser/src/muParser.cpp b/moose-core/external/muparser/src/muParser.cpp index 4d89e6f7..65a1f314 100644 --- a/moose-core/external/muparser/src/muParser.cpp +++ b/moose-core/external/muparser/src/muParser.cpp @@ -23,8 +23,8 @@ 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" +#include "../include/muParser.h" +#include "../include/muParserTemplateMagic.h" //--- Standard includes ------------------------------------------------------------------------ #include <cmath> diff --git a/moose-core/external/xgetopt/XGetopt.cpp b/moose-core/external/xgetopt/XGetopt.cpp deleted file mode 100644 index 66c59eea..00000000 --- a/moose-core/external/xgetopt/XGetopt.cpp +++ /dev/null @@ -1,219 +0,0 @@ -// XGetopt.cpp Version 1.2 -// -// Author: Hans Dietrich -// hdietrich2@hotmail.com -// -// Description: -// XGetopt.cpp implements getopt(), a function to parse command lines. -// -// History -// Version 1.2 - 2003 May 17 -// - Added Unicode support -// -// Version 1.1 - 2002 March 10 -// - 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. -// -// This software is provided "as is" with no expressed -// or implied warranty. I accept no liability for any -// damage or loss of business that this software may cause. -// -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// if you are using precompiled headers then include this line: -//#include "stdafx.h" -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// if you are not using precompiled headers then include these lines: -#include <windows.h> -#include <stdio.h> -//#include <tchar.h> -/////////////////////////////////////////////////////////////////////////////// - - -#include "XGetopt.h" - - -/////////////////////////////////////////////////////////////////////////////// -// -// X G e t o p t . c p p -// -// -// NAME -// getopt -- parse command line options -// -// SYNOPSIS -// int getopt(int argc, TCHAR *argv[], TCHAR *optstring) -// -// extern TCHAR *optarg; -// extern int optind; -// -// DESCRIPTION -// The getopt() function parses the command line arguments. Its -// arguments argc and argv are the argument count and array as -// passed into the application on program invocation. In the case -// of Visual C++ programs, argc and argv are available via the -// variables __argc and __argv (double underscores), respectively. -// getopt returns the next option letter in argv that matches a -// letter in optstring. (Note: Unicode programs should use -// __targv instead of __argv. Also, all character and string -// literals should be enclosed in _T( ) ). -// -// optstring is a string of recognized option letters; if a letter -// is followed by a colon, the option is expected to have an argument -// that may or may not be separated from it by white space. optarg -// is set to point to the start of the option argument on return from -// getopt. -// -// Option letters may be combined, e.g., "-ab" is equivalent to -// "-a -b". Option letters are case sensitive. -// -// getopt places in the external variable optind the argv index -// of the next argument to be processed. optind is initialized -// to 0 before the first call to getopt. -// -// When all options have been processed (i.e., up to the first -// non-option argument), getopt returns EOF, optarg will point -// to the argument, and optind will be set to the argv index of -// the argument. If there are no non-option arguments, optarg -// will be set to NULL. -// -// The special option "--" may be used to delimit the end of the -// options; EOF will be returned, and "--" (and everything after it) -// will be skipped. -// -// RETURN VALUE -// For option letters contained in the string optstring, getopt -// will return the option letter. getopt returns a question mark (?) -// when it encounters an option letter not included in optstring. -// EOF is returned when processing is finished. -// -// BUGS -// 1) Long options are not supported. -// 2) The GNU double-colon extension is not supported. -// 3) The environment variable POSIXLY_CORRECT is not supported. -// 4) The + syntax is not supported. -// 5) The automatic permutation of arguments is not supported. -// 6) This implementation of getopt() returns EOF if an error is -// encountered, instead of -1 as the latest standard requires. -// -// EXAMPLE -// BOOL CMyApp::ProcessCommandLine(int argc, TCHAR *argv[]) -// { -// int c; -// -// while ((c = getopt(argc, argv, _T("aBn:"))) != EOF) -// { -// switch (c) -// { -// case _T('a'): -// TRACE(_T("option a\n")); -// // -// // set some flag here -// // -// break; -// -// case _T('B'): -// TRACE( _T("option B\n")); -// // -// // set some other flag here -// // -// break; -// -// case _T('n'): -// TRACE(_T("option n: value=%d\n"), atoi(optarg)); -// // -// // do something with value here -// // -// break; -// -// case _T('?'): -// TRACE(_T("ERROR: illegal option %s\n"), argv[optind-1]); -// return FALSE; -// break; -// -// default: -// TRACE(_T("WARNING: no handler for option %c\n"), c); -// return FALSE; -// break; -// } -// } -// // -// // check for non-option args here -// // -// return TRUE; -// } -// -/////////////////////////////////////////////////////////////////////////////// - -char *optarg; // global argument pointer -int optind = 0; // global argv index - -int getopt(int argc, char *argv[], char *optstring) -{ - static char *next = NULL; - if (optind == 0) - next = NULL; - - optarg = NULL; - - if (next == NULL || *next == _T('\0')) - { - if (optind == 0) - optind++; - - if (optind >= argc || argv[optind][0] != _T('-') || argv[optind][1] == _T('\0')) - { - optarg = NULL; - if (optind < argc) - optarg = argv[optind]; - return EOF; - } - - if (_tcscmp(argv[optind], _T("--")) == 0) - { - optind++; - optarg = NULL; - if (optind < argc) - optarg = argv[optind]; - return EOF; - } - - next = argv[optind]; - next++; // skip past - - optind++; - } - - char c = *next++; - char *cp = _tcschr(optstring, c); - - if (cp == NULL || c == _T(':')) - return _T('?'); - - cp++; - if (*cp == _T(':')) - { - if (*next != _T('\0')) - { - optarg = next; - next = NULL; - } - else if (optind < argc) - { - optarg = argv[optind]; - optind++; - } - else - { - return _T('?'); - } - } - - return c; -} diff --git a/moose-core/external/xgetopt/XGetopt.h b/moose-core/external/xgetopt/XGetopt.h deleted file mode 100644 index fa6f6ad1..00000000 --- a/moose-core/external/xgetopt/XGetopt.h +++ /dev/null @@ -1,23 +0,0 @@ -// XGetopt.h Version 1.2 -// -// Author: Hans Dietrich -// hdietrich2@hotmail.com -// -// This software is released into the public domain. -// You are free to use it in any way you like. -// -// This software is provided "as is" with no expressed -// or implied warranty. I accept no liability for any -// damage or loss of business that this software may cause. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef XGETOPT_H -#define XGETOPT_H - -extern int optind, opterr; -extern char *optarg; - -int getopt(int argc, char *argv[], char *optstring); - -#endif //XGETOPT_H diff --git a/moose-core/hsolve/CMakeLists.txt b/moose-core/hsolve/CMakeLists.txt index 427efb30..f3d6c4eb 100644 --- a/moose-core/hsolve/CMakeLists.txt +++ b/moose-core/hsolve/CMakeLists.txt @@ -1,8 +1,9 @@ -cmake_minimum_required(VERSION 2.6) -include_directories(../basecode ../utility ../kinetics ../external/debug) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) add_library(hsolve HSolveStruct.cpp HinesMatrix.cpp + Cell.cpp HSolvePassive.cpp RateLookup.cpp HSolveActive.cpp diff --git a/moose-core/hsolve/Cell.cpp b/moose-core/hsolve/Cell.cpp index 6a6eeb8d..ac811584 100644 --- a/moose-core/hsolve/Cell.cpp +++ b/moose-core/hsolve/Cell.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" #include "Cell.h" @@ -273,7 +273,7 @@ Id Cell::findCompt( Id cell ) } else { - dump("TODO", "TODO: Commented out code. "); + moose::showWarn( "TODO: Commented out code. "); Id curr = child.back(); #if 0 /* ----- #if 0 : If0Label_1 ----- */ @@ -286,7 +286,6 @@ Id Cell::findCompt( Id cell ) } #endif /* ----- #if 0 : If0Label_1 ----- */ - cstack.push_back( children( curr ) ); } } @@ -297,11 +296,10 @@ Id Cell::findCompt( Id cell ) void Cell::setupSolver( Id cell, Id seed ) const { Id solver = Id::nextId(); - dump("FIXME" - , "Using 0 for parentMsgIndex in function call Shell::innerCreate" + moose::showWarn( + "FIXME: Using 0 for parentMsgIndex in function call Shell::innerCreate" "0 in first and third argument to NodeBalance. " "I am not sure if I should be doing this here in this function." - " -- Dilawar" ); NodeBalance nb(0, MooseBlockBalance, 0); shell_->innerCreate("HSolve", cell, solver, solverName_, nb, 0); diff --git a/moose-core/hsolve/HSolve.cpp b/moose-core/hsolve/HSolve.cpp index 7f3cc36b..5d04a777 100644 --- a/moose-core/hsolve/HSolve.cpp +++ b/moose-core/hsolve/HSolve.cpp @@ -9,7 +9,7 @@ #include "../basecode/header.h" #include "../basecode/global.h" -#include "ElementValueFinfo.h" +#include "../basecode/ElementValueFinfo.h" #include "HSolveStruct.h" #include "HinesMatrix.h" #include "HSolvePassive.h" diff --git a/moose-core/hsolve/HSolveActive.cpp b/moose-core/hsolve/HSolveActive.cpp index bbe70662..662c4cc8 100644 --- a/moose-core/hsolve/HSolveActive.cpp +++ b/moose-core/hsolve/HSolveActive.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include <queue> #include "HSolveStruct.h" #include "HinesMatrix.h" diff --git a/moose-core/hsolve/HSolveInterface.cpp b/moose-core/hsolve/HSolveInterface.cpp index 5a8e8e3c..548646dd 100644 --- a/moose-core/hsolve/HSolveInterface.cpp +++ b/moose-core/hsolve/HSolveInterface.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "HSolveStruct.h" #include "HinesMatrix.h" #include "HSolvePassive.h" diff --git a/moose-core/hsolve/HSolveStruct.cpp b/moose-core/hsolve/HSolveStruct.cpp index 11daa9e5..ce40817c 100644 --- a/moose-core/hsolve/HSolveStruct.cpp +++ b/moose-core/hsolve/HSolveStruct.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <cmath> -#include "header.h" +#include "../basecode/header.h" #include "../biophysics/SpikeGen.h" #include "HSolveStruct.h" diff --git a/moose-core/hsolve/HinesMatrix.cpp b/moose-core/hsolve/HinesMatrix.cpp index 47b12009..66d51dbf 100644 --- a/moose-core/hsolve/HinesMatrix.cpp +++ b/moose-core/hsolve/HinesMatrix.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "HinesMatrix.h" #include <sstream> #include <iomanip> diff --git a/moose-core/hsolve/ZombieCaConc.cpp b/moose-core/hsolve/ZombieCaConc.cpp index e7d18d2c..5e55f5bc 100644 --- a/moose-core/hsolve/ZombieCaConc.cpp +++ b/moose-core/hsolve/ZombieCaConc.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../biophysics/CaConcBase.h" #include "HinesMatrix.h" diff --git a/moose-core/hsolve/ZombieCompartment.h b/moose-core/hsolve/ZombieCompartment.h index 507b602c..e4ef5ca4 100644 --- a/moose-core/hsolve/ZombieCompartment.h +++ b/moose-core/hsolve/ZombieCompartment.h @@ -11,10 +11,10 @@ #ifndef _ZOMBIE_COMPARTMENT_H #define _ZOMBIE_COMPARTMENT_H -#include "global.h" +#include "../basecode/global.h" -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/print_function.hpp" #include "../biophysics/CompartmentBase.h" #include "../biophysics/Compartment.h" diff --git a/moose-core/hsolve/ZombieHHChannel.h b/moose-core/hsolve/ZombieHHChannel.h index 756a2eaa..98bdf41c 100644 --- a/moose-core/hsolve/ZombieHHChannel.h +++ b/moose-core/hsolve/ZombieHHChannel.h @@ -29,8 +29,8 @@ * respectively. */ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "HinesMatrix.h" #include "HSolveStruct.h" #include "HSolvePassive.h" diff --git a/moose-core/intfire/AdExIF.cpp b/moose-core/intfire/AdExIF.cpp index f9fddfa5..8b714bd4 100644 --- a/moose-core/intfire/AdExIF.cpp +++ b/moose-core/intfire/AdExIF.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../biophysics/CompartmentBase.h" #include "../biophysics/Compartment.h" #include "IntFireBase.h" diff --git a/moose-core/intfire/AdThreshIF.cpp b/moose-core/intfire/AdThreshIF.cpp index 064f4511..a5805460 100644 --- a/moose-core/intfire/AdThreshIF.cpp +++ b/moose-core/intfire/AdThreshIF.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../biophysics/CompartmentBase.h" #include "../biophysics/Compartment.h" #include "IntFireBase.h" diff --git a/moose-core/intfire/CMakeLists.txt b/moose-core/intfire/CMakeLists.txt index 06435a8e..5bbddab9 100644 --- a/moose-core/intfire/CMakeLists.txt +++ b/moose-core/intfire/CMakeLists.txt @@ -1,5 +1,4 @@ cmake_minimum_required(VERSION 2.8) -include_directories(../basecode) -add_definitions( -std=c++11 ) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) file(GLOB SRC *.cpp) add_library(intfire ${SRC}) diff --git a/moose-core/intfire/ExIF.cpp b/moose-core/intfire/ExIF.cpp index dcde4431..65c1db04 100644 --- a/moose-core/intfire/ExIF.cpp +++ b/moose-core/intfire/ExIF.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../biophysics/CompartmentBase.h" #include "../biophysics/Compartment.h" #include "IntFireBase.h" diff --git a/moose-core/intfire/IzhIF.cpp b/moose-core/intfire/IzhIF.cpp index 6359727e..15ce57ae 100644 --- a/moose-core/intfire/IzhIF.cpp +++ b/moose-core/intfire/IzhIF.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../biophysics/CompartmentBase.h" #include "../biophysics/Compartment.h" #include "IntFireBase.h" diff --git a/moose-core/intfire/QIF.cpp b/moose-core/intfire/QIF.cpp index 62e4a85f..c3c4850f 100644 --- a/moose-core/intfire/QIF.cpp +++ b/moose-core/intfire/QIF.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "../biophysics/CompartmentBase.h" #include "../biophysics/Compartment.h" #include "IntFireBase.h" diff --git a/moose-core/intfire/testIntFire.cpp b/moose-core/intfire/testIntFire.cpp index ed1a15bb..9e9ddf90 100644 --- a/moose-core/intfire/testIntFire.cpp +++ b/moose-core/intfire/testIntFire.cpp @@ -8,7 +8,7 @@ **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" #include "../biophysics/CompartmentBase.h" #include "../biophysics/Compartment.h" diff --git a/moose-core/kinetics/CMakeLists.txt b/moose-core/kinetics/CMakeLists.txt index b836312c..cdd8315d 100644 --- a/moose-core/kinetics/CMakeLists.txt +++ b/moose-core/kinetics/CMakeLists.txt @@ -1,20 +1,20 @@ -include_directories(../msg) -include_directories(../basecode ../utility) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) add_library(kinetics - PoolBase.cpp - Pool.cpp - BufPool.cpp - ReacBase.cpp - Reac.cpp - EnzBase.cpp - CplxEnzBase.cpp - Enz.cpp - MMenz.cpp - Species.cpp - ConcChan.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 + ConcChan.cpp + ReadKkit.cpp + WriteKkit.cpp + ReadCspace.cpp + lookupVolumeFromMesh.cpp + testKinetics.cpp + ) diff --git a/moose-core/kinetics/ConcChan.cpp b/moose-core/kinetics/ConcChan.cpp index 62170845..6edc7431 100644 --- a/moose-core/kinetics/ConcChan.cpp +++ b/moose-core/kinetics/ConcChan.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "ConcChan.h" static SrcFinfo2< double, double > *inPoolOut() { diff --git a/moose-core/kinetics/CplxEnzBase.cpp b/moose-core/kinetics/CplxEnzBase.cpp index 361f672f..36e23591 100644 --- a/moose-core/kinetics/CplxEnzBase.cpp +++ b/moose-core/kinetics/CplxEnzBase.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "lookupVolumeFromMesh.h" #include "EnzBase.h" #include "CplxEnzBase.h" diff --git a/moose-core/kinetics/Enz.cpp b/moose-core/kinetics/Enz.cpp index f41d109a..358ab906 100644 --- a/moose-core/kinetics/Enz.cpp +++ b/moose-core/kinetics/Enz.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "lookupVolumeFromMesh.h" #include "EnzBase.h" #include "CplxEnzBase.h" diff --git a/moose-core/kinetics/EnzBase.cpp b/moose-core/kinetics/EnzBase.cpp index 0812374c..68982016 100644 --- a/moose-core/kinetics/EnzBase.cpp +++ b/moose-core/kinetics/EnzBase.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "lookupVolumeFromMesh.h" #include "EnzBase.h" diff --git a/moose-core/kinetics/MMenz.cpp b/moose-core/kinetics/MMenz.cpp index cd03b00f..af24152e 100644 --- a/moose-core/kinetics/MMenz.cpp +++ b/moose-core/kinetics/MMenz.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "lookupVolumeFromMesh.h" #include "EnzBase.h" #include "MMenz.h" diff --git a/moose-core/kinetics/PoolBase.cpp b/moose-core/kinetics/PoolBase.cpp index b00153f4..bff5f026 100644 --- a/moose-core/kinetics/PoolBase.cpp +++ b/moose-core/kinetics/PoolBase.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "lookupVolumeFromMesh.h" #include "PoolBase.h" diff --git a/moose-core/kinetics/Reac.cpp b/moose-core/kinetics/Reac.cpp index 7e3bc72d..02de9aed 100644 --- a/moose-core/kinetics/Reac.cpp +++ b/moose-core/kinetics/Reac.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "lookupVolumeFromMesh.h" #include "ReacBase.h" #include "Reac.h" diff --git a/moose-core/kinetics/ReacBase.cpp b/moose-core/kinetics/ReacBase.cpp index 0d3273d1..2ce128bd 100644 --- a/moose-core/kinetics/ReacBase.cpp +++ b/moose-core/kinetics/ReacBase.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "lookupVolumeFromMesh.h" #include "ReacBase.h" diff --git a/moose-core/kinetics/ReadCspace.cpp b/moose-core/kinetics/ReadCspace.cpp index 86b1f3f0..ac60d9e4 100644 --- a/moose-core/kinetics/ReadCspace.cpp +++ b/moose-core/kinetics/ReadCspace.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <fstream> -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" #define DO_CSPACE_DEBUG 0 diff --git a/moose-core/kinetics/ReadKkit.cpp b/moose-core/kinetics/ReadKkit.cpp index 1a2e0776..0b382464 100644 --- a/moose-core/kinetics/ReadKkit.cpp +++ b/moose-core/kinetics/ReadKkit.cpp @@ -11,7 +11,7 @@ #include <iomanip> #include <fstream> -#include "header.h" +#include "../basecode/header.h" #include "../utility/utility.h" #include "PoolBase.h" #include "Pool.h" diff --git a/moose-core/kinetics/Species.cpp b/moose-core/kinetics/Species.cpp index 1d579f9f..8229f752 100644 --- a/moose-core/kinetics/Species.cpp +++ b/moose-core/kinetics/Species.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Species.h" static SrcFinfo1< double > *molWtOut() { diff --git a/moose-core/kinetics/WriteKkit.cpp b/moose-core/kinetics/WriteKkit.cpp index 3c3bc890..00917878 100644 --- a/moose-core/kinetics/WriteKkit.cpp +++ b/moose-core/kinetics/WriteKkit.cpp @@ -12,7 +12,7 @@ #include "../shell/Wildcard.h" -#include "header.h" +#include "../basecode/header.h" #include "../utility/utility.h" #include "PoolBase.h" diff --git a/moose-core/kinetics/lookupVolumeFromMesh.cpp b/moose-core/kinetics/lookupVolumeFromMesh.cpp index 84f9ebf9..e0457b6b 100644 --- a/moose-core/kinetics/lookupVolumeFromMesh.cpp +++ b/moose-core/kinetics/lookupVolumeFromMesh.cpp @@ -7,13 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -/* -#include "../mesh/VoxelJunction.h" -#include "../mesh/MeshEntry.h" -#include "../mesh/Boundary.h" -#include "../mesh/ChemCompt.h" -*/ +#include "../basecode/header.h" #include "lookupVolumeFromMesh.h" // Utility function: return the compartment in which the specified diff --git a/moose-core/kinetics/testKinetics.cpp b/moose-core/kinetics/testKinetics.cpp index b63e099c..b1252a22 100644 --- a/moose-core/kinetics/testKinetics.cpp +++ b/moose-core/kinetics/testKinetics.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" #include "ReadKkit.h" #include "ReadCspace.h" diff --git a/moose-core/ksolve/CMakeLists.txt b/moose-core/ksolve/CMakeLists.txt index c43875a0..f5124aab 100644 --- a/moose-core/ksolve/CMakeLists.txt +++ b/moose-core/ksolve/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 2.8) include(CheckIncludeFileCXX) - -include_directories(../builtins ../basecode ../utility ../kinetics) -include_directories(../mesh) -include_directories(../external/muparser/include ) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) if(WITH_BOOST) find_package(Boost REQUIRED COMPONENTS thread) diff --git a/moose-core/ksolve/FuncTerm.cpp b/moose-core/ksolve/FuncTerm.cpp index 1ca12021..c8690071 100644 --- a/moose-core/ksolve/FuncTerm.cpp +++ b/moose-core/ksolve/FuncTerm.cpp @@ -23,7 +23,7 @@ #include <sstream> using namespace std; -#include "muParser.h" +#include "../external/muparser/include/muParser.h" #include "FuncTerm.h" #include "../utility/numutil.h" diff --git a/moose-core/ksolve/FuncTerm.h b/moose-core/ksolve/FuncTerm.h index ccf2dcd1..fe735278 100644 --- a/moose-core/ksolve/FuncTerm.h +++ b/moose-core/ksolve/FuncTerm.h @@ -10,7 +10,7 @@ #ifndef _FUNC_TERM_H #define _FUNC_TERM_H -#include "muParser.h" +#include "../external/muparser/include/muParser.h" class FuncTerm { diff --git a/moose-core/ksolve/Gsolve.cpp b/moose-core/ksolve/Gsolve.cpp index d99dd12a..332005a6 100644 --- a/moose-core/ksolve/Gsolve.cpp +++ b/moose-core/ksolve/Gsolve.cpp @@ -18,7 +18,7 @@ #include "RateTerm.h" #include "FuncTerm.h" #include "FuncRateTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "GssaSystem.h" #include "Stoich.h" diff --git a/moose-core/ksolve/GssaVoxelPools.cpp b/moose-core/ksolve/GssaVoxelPools.cpp index ae725120..a12d693e 100644 --- a/moose-core/ksolve/GssaVoxelPools.cpp +++ b/moose-core/ksolve/GssaVoxelPools.cpp @@ -7,14 +7,12 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#ifdef ENABLE_CPP11 -#include <memory> -#endif - -#include "header.h" +#include "../basecode/header.h" +#include "../basecode/global.h" +#include "../randnum/RNG.h" #include "RateTerm.h" #include "FuncTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" @@ -23,8 +21,6 @@ #include "Stoich.h" #include "GssaSystem.h" #include "GssaVoxelPools.h" -#include "../randnum/RNG.h" -#include "../basecode/global.h" /** * The SAFETY_FACTOR Protects against the total propensity exceeding diff --git a/moose-core/ksolve/KinSparseMatrix.cpp b/moose-core/ksolve/KinSparseMatrix.cpp index 1b1c1d31..0ff7676b 100644 --- a/moose-core/ksolve/KinSparseMatrix.cpp +++ b/moose-core/ksolve/KinSparseMatrix.cpp @@ -14,8 +14,8 @@ #include <iostream> #include <cassert> #include <cmath> -#include "SparseMatrix.h" -#include "utility/numutil.h" +#include "../basecode/SparseMatrix.h" +#include "../utility/numutil.h" #include "KinSparseMatrix.h" using namespace std; diff --git a/moose-core/ksolve/RateTerm.cpp b/moose-core/ksolve/RateTerm.cpp index 53250711..66f6ae33 100644 --- a/moose-core/ksolve/RateTerm.cpp +++ b/moose-core/ksolve/RateTerm.cpp @@ -12,9 +12,9 @@ #include <vector> #include <algorithm> #include <cassert> -using namespace std; -#include "header.h" +#include "../basecode/header.h" #include "RateTerm.h" +using namespace std; const double RateTerm::EPSILON = 1.0e-6; diff --git a/moose-core/ksolve/Stoich.cpp b/moose-core/ksolve/Stoich.cpp index 3cd9d902..62959a2a 100644 --- a/moose-core/ksolve/Stoich.cpp +++ b/moose-core/ksolve/Stoich.cpp @@ -7,16 +7,16 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" -#include "PoolBase.h" -#include "ReacBase.h" -#include "EnzBase.h" -#include "CplxEnzBase.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" +#include "../kinetics/PoolBase.h" +#include "../kinetics/ReacBase.h" +#include "../kinetics/EnzBase.h" +#include "../kinetics/CplxEnzBase.h" #include "FuncTerm.h" #include "RateTerm.h" #include "FuncRateTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" @@ -26,7 +26,7 @@ #include "../builtins/Function.h" #include "ZombieFunction.h" #include "Stoich.h" -#include "lookupVolumeFromMesh.h" +#include "../kinetics/lookupVolumeFromMesh.h" #include "../scheduling/Clock.h" #include "../shell/Shell.h" #include "../shell/Wildcard.h" diff --git a/moose-core/ksolve/VoxelPools.cpp b/moose-core/ksolve/VoxelPools.cpp index 53f5a173..dd797fd3 100644 --- a/moose-core/ksolve/VoxelPools.cpp +++ b/moose-core/ksolve/VoxelPools.cpp @@ -23,7 +23,7 @@ using namespace boost::numeric; #include "VoxelPools.h" #include "RateTerm.h" #include "FuncTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "../mesh/VoxelJunction.h" #include "XferInfo.h" @@ -150,7 +150,7 @@ void VoxelPools::advance( const ProcInfo* p ) // This is usually the default method. It works well in practice. Tested // with steady-state solver. Closest to GSL rk5 . if( method_ == "rk5" || method_ == "gsl" || method_ == "boost" ) - odeint::integrate_const( + odeint::integrate_adaptive( make_dense_output( epsAbs_, epsRel_, odeint::runge_kutta_dopri5<vector_type_>() ) , sys , Svec() , p->currTime - p->dt , p->currTime , p->dt ); @@ -163,24 +163,26 @@ void VoxelPools::advance( const ProcInfo* p ) else if( method_ == "rk4" ) odeint::integrate_const( rk4_stepper_type_() , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt ); - else if( method_ == "rk5a") - odeint::integrate_adaptive( odeint::make_controlled<rk_dopri_stepper_type_>( epsAbs_, epsRel_ ) - , sys , Svec() , p->currTime - p->dt , p->currTime, p->dt ); else if ("rk54" == method_ ) odeint::integrate_const( rk_karp_stepper_type_() , sys , Svec() , p->currTime - p->dt, p->currTime, p->dt); - else if ("rk54a" == method_ ) + else if ("rkck" == method_ ) odeint::integrate_adaptive( odeint::make_controlled<rk_karp_stepper_type_>( epsAbs_, epsRel_ ) , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); else if( method_ == "rk8" ) odeint::integrate_const( rk_felhberg_stepper_type_() , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); else if( method_ == "rk8a" ) - odeint::integrate_adaptive( odeint::make_controlled<rk_felhberg_stepper_type_>( epsAbs_, epsRel_ ) - , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); + odeint::integrate_adaptive( rk_felhberg_stepper_type_() + , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); else - odeint::integrate_adaptive( odeint::make_controlled<rk_karp_stepper_type_>( epsAbs_, epsRel_ ) - , sys, Svec(), p->currTime - p->dt, p->currTime, p->dt); + { + cerr << "Ksolve: Unknow method " << method_ << ", using default!" << endl; + odeint::integrate_const( + make_dense_output( epsAbs_, epsRel_, odeint::runge_kutta_dopri5<vector_type_>() ) + , sys , Svec() , p->currTime - p->dt , p->currTime , p->dt + ); + } #endif if ( !stoichPtr_->getAllowNegative() ) // clean out negatives diff --git a/moose-core/ksolve/VoxelPoolsBase.cpp b/moose-core/ksolve/VoxelPoolsBase.cpp index f0261245..6a35f477 100644 --- a/moose-core/ksolve/VoxelPoolsBase.cpp +++ b/moose-core/ksolve/VoxelPoolsBase.cpp @@ -6,15 +6,14 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" - +#include "../basecode/header.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" #include "XferInfo.h" #include "ZombiePoolInterface.h" #include "RateTerm.h" #include "FuncTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "Stoich.h" diff --git a/moose-core/ksolve/ZombieBufPool.cpp b/moose-core/ksolve/ZombieBufPool.cpp index 82665529..a0fb2df5 100644 --- a/moose-core/ksolve/ZombieBufPool.cpp +++ b/moose-core/ksolve/ZombieBufPool.cpp @@ -6,15 +6,15 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "PoolBase.h" +#include "../basecode/header.h" +#include "../kinetics/PoolBase.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" #include "XferInfo.h" #include "ZombiePoolInterface.h" #include "ZombiePool.h" #include "ZombieBufPool.h" -#include "lookupVolumeFromMesh.h" +#include "../kinetics/lookupVolumeFromMesh.h" // Entirely derived from ZombiePool. Only the zombification routines differ. const Cinfo* ZombieBufPool::initCinfo() diff --git a/moose-core/ksolve/ZombieEnz.cpp b/moose-core/ksolve/ZombieEnz.cpp index e73c27ac..4c06cf0e 100644 --- a/moose-core/ksolve/ZombieEnz.cpp +++ b/moose-core/ksolve/ZombieEnz.cpp @@ -6,12 +6,11 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" - -#include "lookupVolumeFromMesh.h" +#include "../basecode/header.h" +#include "../kinetics/lookupVolumeFromMesh.h" #include "RateTerm.h" #include "FuncTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" @@ -19,8 +18,8 @@ #include "ZombiePoolInterface.h" #include "Stoich.h" -#include "EnzBase.h" -#include "CplxEnzBase.h" +#include "../kinetics/EnzBase.h" +#include "../kinetics/CplxEnzBase.h" #include "ZombieEnz.h" #define EPSILON 1e-15 diff --git a/moose-core/ksolve/ZombieFunction.cpp b/moose-core/ksolve/ZombieFunction.cpp index 9e184961..48a21899 100644 --- a/moose-core/ksolve/ZombieFunction.cpp +++ b/moose-core/ksolve/ZombieFunction.cpp @@ -7,19 +7,19 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" -#include "Variable.h" -#include "Function.h" +#include "../builtins/Variable.h" +#include "../builtins/Function.h" #include "ZombieFunction.h" #include "FuncTerm.h" #include "RateTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "VoxelPoolsBase.h" -#include "VoxelJunction.h" +#include "../mesh/VoxelJunction.h" #include "XferInfo.h" #include "ZombiePoolInterface.h" #include "Stoich.h" diff --git a/moose-core/ksolve/ZombieMMenz.cpp b/moose-core/ksolve/ZombieMMenz.cpp index dc400897..0eeaef1a 100644 --- a/moose-core/ksolve/ZombieMMenz.cpp +++ b/moose-core/ksolve/ZombieMMenz.cpp @@ -6,12 +6,11 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" - -#include "lookupVolumeFromMesh.h" +#include "../basecode/header.h" +#include "../kinetics/lookupVolumeFromMesh.h" #include "RateTerm.h" #include "FuncTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" @@ -19,7 +18,7 @@ #include "ZombiePoolInterface.h" #include "Stoich.h" -#include "EnzBase.h" +#include "../kinetics/EnzBase.h" #include "ZombieMMenz.h" #define EPSILON 1e-15 diff --git a/moose-core/ksolve/ZombiePool.cpp b/moose-core/ksolve/ZombiePool.cpp index 6d612c83..b1e3af86 100644 --- a/moose-core/ksolve/ZombiePool.cpp +++ b/moose-core/ksolve/ZombiePool.cpp @@ -7,14 +7,14 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "PoolBase.h" +#include "../basecode/header.h" +#include "../kinetics/PoolBase.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" #include "XferInfo.h" #include "ZombiePoolInterface.h" #include "ZombiePool.h" -#include "lookupVolumeFromMesh.h" +#include "../kinetics/lookupVolumeFromMesh.h" #define EPSILON 1e-15 diff --git a/moose-core/ksolve/ZombiePoolInterface.cpp b/moose-core/ksolve/ZombiePoolInterface.cpp index 1df99ae2..62a50f9f 100644 --- a/moose-core/ksolve/ZombiePoolInterface.cpp +++ b/moose-core/ksolve/ZombiePoolInterface.cpp @@ -6,7 +6,7 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #ifdef USE_GSL #include <gsl/gsl_errno.h> #include <gsl/gsl_matrix.h> @@ -21,7 +21,7 @@ #include "RateTerm.h" #include "FuncTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "Stoich.h" #include "../shell/Shell.h" diff --git a/moose-core/ksolve/ZombieReac.cpp b/moose-core/ksolve/ZombieReac.cpp index c12f30b8..55a00887 100644 --- a/moose-core/ksolve/ZombieReac.cpp +++ b/moose-core/ksolve/ZombieReac.cpp @@ -7,12 +7,12 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ReacBase.h" -#include "lookupVolumeFromMesh.h" +#include "../basecode/header.h" +#include "../kinetics/ReacBase.h" +#include "../kinetics/lookupVolumeFromMesh.h" #include "RateTerm.h" #include "FuncTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" diff --git a/moose-core/ksolve/testKsolve.cpp b/moose-core/ksolve/testKsolve.cpp index 6f0275ff..64ae8db7 100644 --- a/moose-core/ksolve/testKsolve.cpp +++ b/moose-core/ksolve/testKsolve.cpp @@ -6,12 +6,11 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../shell/Shell.h" #include "RateTerm.h" -#include "muParser.h" #include "FuncTerm.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "KinSparseMatrix.h" #include "VoxelPoolsBase.h" #include "../mesh/VoxelJunction.h" @@ -19,6 +18,8 @@ #include "ZombiePoolInterface.h" #include "Stoich.h" +#include "../external/muparser/include/muParser.h" + /** * Tab controlled by table * A + Tab <===> B diff --git a/moose-core/mesh/CMakeLists.txt b/moose-core/mesh/CMakeLists.txt index a04e31dd..bbeb98c3 100644 --- a/moose-core/mesh/CMakeLists.txt +++ b/moose-core/mesh/CMakeLists.txt @@ -1,6 +1,5 @@ -include_directories(../msg) -include_directories(../basecode) -include_directories(../utility) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) add_library(mesh ChemCompt.cpp MeshCompt.cpp @@ -13,6 +12,6 @@ add_library(mesh SpineEntry.cpp SpineMesh.cpp PsdMesh.cpp - EndoMesh.cpp + EndoMesh.cpp testMesh.cpp ) diff --git a/moose-core/mesh/ChemCompt.cpp b/moose-core/mesh/ChemCompt.cpp index 1d2b3f7f..b8961f1d 100644 --- a/moose-core/mesh/ChemCompt.cpp +++ b/moose-core/mesh/ChemCompt.cpp @@ -7,9 +7,9 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" -#include "LookupElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" +#include "../basecode/LookupElementValueFinfo.h" #include "Boundary.h" #include "MeshEntry.h" #include "ChemCompt.h" diff --git a/moose-core/mesh/CubeMesh.cpp b/moose-core/mesh/CubeMesh.cpp index 728c69ba..d5050743 100644 --- a/moose-core/mesh/CubeMesh.cpp +++ b/moose-core/mesh/CubeMesh.cpp @@ -7,9 +7,9 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "SparseMatrix.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" +#include "../basecode/ElementValueFinfo.h" #include "Boundary.h" #include "MeshEntry.h" #include "VoxelJunction.h" diff --git a/moose-core/mesh/CylBase.cpp b/moose-core/mesh/CylBase.cpp index a4d8d6bb..209977db 100644 --- a/moose-core/mesh/CylBase.cpp +++ b/moose-core/mesh/CylBase.cpp @@ -6,12 +6,9 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -//#include <vector> -//#include <cassert> -//using namespace std; -#include "header.h" -#include "SparseMatrix.h" -// #include "ElementValueFinfo.h" + +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" #include "Boundary.h" #include "MeshEntry.h" #include "VoxelJunction.h" diff --git a/moose-core/mesh/CylMesh.cpp b/moose-core/mesh/CylMesh.cpp index 9fc8352e..e0057529 100644 --- a/moose-core/mesh/CylMesh.cpp +++ b/moose-core/mesh/CylMesh.cpp @@ -7,9 +7,9 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "SparseMatrix.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/Vec.h" #include "Boundary.h" #include "MeshEntry.h" diff --git a/moose-core/mesh/EndoMesh.cpp b/moose-core/mesh/EndoMesh.cpp index 33c13bdb..7902e3bd 100644 --- a/moose-core/mesh/EndoMesh.cpp +++ b/moose-core/mesh/EndoMesh.cpp @@ -7,9 +7,9 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "SparseMatrix.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/Vec.h" #include "Boundary.h" #include "MeshEntry.h" diff --git a/moose-core/mesh/MeshCompt.cpp b/moose-core/mesh/MeshCompt.cpp index 5b46bd6a..8e4186d3 100644 --- a/moose-core/mesh/MeshCompt.cpp +++ b/moose-core/mesh/MeshCompt.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "SparseMatrix.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" #include "VoxelJunction.h" #include "Boundary.h" // #include "Stencil.h" diff --git a/moose-core/mesh/MeshEntry.cpp b/moose-core/mesh/MeshEntry.cpp index 88d95b75..3388e3fa 100644 --- a/moose-core/mesh/MeshEntry.cpp +++ b/moose-core/mesh/MeshEntry.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "MeshEntry.h" #include "Boundary.h" // #include "Stencil.h" diff --git a/moose-core/mesh/NeuroMesh.cpp b/moose-core/mesh/NeuroMesh.cpp index cb0ccc56..5e5e82f4 100644 --- a/moose-core/mesh/NeuroMesh.cpp +++ b/moose-core/mesh/NeuroMesh.cpp @@ -7,12 +7,10 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include <cctype> -#include "header.h" -#include "SparseMatrix.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/Vec.h" - -#include "ElementValueFinfo.h" #include "Boundary.h" #include "MeshEntry.h" #include "ChemCompt.h" diff --git a/moose-core/mesh/NeuroNode.cpp b/moose-core/mesh/NeuroNode.cpp index 9610227b..0cfc583d 100644 --- a/moose-core/mesh/NeuroNode.cpp +++ b/moose-core/mesh/NeuroNode.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "SparseMatrix.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" #include "Boundary.h" #include "MeshEntry.h" #include "VoxelJunction.h" diff --git a/moose-core/mesh/PsdMesh.cpp b/moose-core/mesh/PsdMesh.cpp index da23aebb..75e8e2ed 100644 --- a/moose-core/mesh/PsdMesh.cpp +++ b/moose-core/mesh/PsdMesh.cpp @@ -7,12 +7,10 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include <cctype> -#include "header.h" -#include "SparseMatrix.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/Vec.h" - -#include "ElementValueFinfo.h" #include "Boundary.h" #include "MeshEntry.h" #include "ChemCompt.h" diff --git a/moose-core/mesh/SpineEntry.cpp b/moose-core/mesh/SpineEntry.cpp index c2d01652..f9e3a918 100644 --- a/moose-core/mesh/SpineEntry.cpp +++ b/moose-core/mesh/SpineEntry.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Boundary.h" #include "MeshEntry.h" #include "VoxelJunction.h" diff --git a/moose-core/mesh/SpineMesh.cpp b/moose-core/mesh/SpineMesh.cpp index 4fca0872..a14dfbc2 100644 --- a/moose-core/mesh/SpineMesh.cpp +++ b/moose-core/mesh/SpineMesh.cpp @@ -7,12 +7,10 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include <cctype> -#include "header.h" -#include "SparseMatrix.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" +#include "../basecode/ElementValueFinfo.h" #include "../utility/Vec.h" - -#include "ElementValueFinfo.h" #include "Boundary.h" #include "MeshEntry.h" #include "ChemCompt.h" diff --git a/moose-core/mesh/testMesh.cpp b/moose-core/mesh/testMesh.cpp index 2ab6f067..0446a8f0 100644 --- a/moose-core/mesh/testMesh.cpp +++ b/moose-core/mesh/testMesh.cpp @@ -7,19 +7,17 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "SparseMatrix.h" +#include "../basecode/header.h" +#include "../basecode/SparseMatrix.h" #include "../shell/Shell.h" #include "Boundary.h" #include "MeshEntry.h" -// #include "Stencil.h" #include "ChemCompt.h" #include "MeshCompt.h" #include "CubeMesh.h" #include "CylBase.h" #include "NeuroNode.h" -#include "SparseMatrix.h" -// #include "NeuroStencil.h" +#include "../basecode/SparseMatrix.h" #include "NeuroMesh.h" #include "../utility/Vec.h" #include "CylMesh.h" diff --git a/moose-core/mpi/CMakeLists.txt b/moose-core/mpi/CMakeLists.txt index a3617266..02006208 100644 --- a/moose-core/mpi/CMakeLists.txt +++ b/moose-core/mpi/CMakeLists.txt @@ -1,4 +1,5 @@ -include_directories(../msg ../basecode) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) IF(USE_MPI) find_package(MPI REQUIRED) include_directories(MPI_INCLUDE_PATH) diff --git a/moose-core/mpi/PostMaster.cpp b/moose-core/mpi/PostMaster.cpp index 194fdfd4..85760dc2 100644 --- a/moose-core/mpi/PostMaster.cpp +++ b/moose-core/mpi/PostMaster.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "PostMaster.h" #include "../shell/Shell.h" diff --git a/moose-core/msg/CMakeLists.txt b/moose-core/msg/CMakeLists.txt index 9b5d6bc3..d7209e19 100644 --- a/moose-core/msg/CMakeLists.txt +++ b/moose-core/msg/CMakeLists.txt @@ -1,4 +1,5 @@ -include_directories(../basecode) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) add_library(msg Msg.cpp DiagonalMsg.cpp diff --git a/moose-core/msg/DiagonalMsg.cpp b/moose-core/msg/DiagonalMsg.cpp index cc1fa542..4ff6d581 100644 --- a/moose-core/msg/DiagonalMsg.cpp +++ b/moose-core/msg/DiagonalMsg.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "DiagonalMsg.h" // Static field declaration diff --git a/moose-core/msg/Msg.cpp b/moose-core/msg/Msg.cpp index 5d5a3a79..f2603652 100644 --- a/moose-core/msg/Msg.cpp +++ b/moose-core/msg/Msg.cpp @@ -7,16 +7,16 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "SingleMsg.h" #include "DiagonalMsg.h" #include "OneToOneMsg.h" #include "OneToOneDataIndexMsg.h" #include "OneToAllMsg.h" -#include "SparseMatrix.h" +#include "../basecode/SparseMatrix.h" #include "SparseMsg.h" #include "../shell/Shell.h" // For the myNode() and numNodes() definitions -#include "MsgElement.h" +#include "../basecode/MsgElement.h" #include "../shell/Shell.h" diff --git a/moose-core/msg/OneToAllMsg.cpp b/moose-core/msg/OneToAllMsg.cpp index 262e0494..96cd8208 100644 --- a/moose-core/msg/OneToAllMsg.cpp +++ b/moose-core/msg/OneToAllMsg.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "OneToAllMsg.h" // Initializing static variables diff --git a/moose-core/msg/OneToOneDataIndexMsg.cpp b/moose-core/msg/OneToOneDataIndexMsg.cpp index d26f82e9..42b20da1 100644 --- a/moose-core/msg/OneToOneDataIndexMsg.cpp +++ b/moose-core/msg/OneToOneDataIndexMsg.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "OneToOneDataIndexMsg.h" // Initializing static variables diff --git a/moose-core/msg/OneToOneMsg.cpp b/moose-core/msg/OneToOneMsg.cpp index e1625eae..d36720dd 100644 --- a/moose-core/msg/OneToOneMsg.cpp +++ b/moose-core/msg/OneToOneMsg.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "OneToOneMsg.h" // Initializing static variables diff --git a/moose-core/msg/SingleMsg.cpp b/moose-core/msg/SingleMsg.cpp index c8ba6f00..fd02beb3 100644 --- a/moose-core/msg/SingleMsg.cpp +++ b/moose-core/msg/SingleMsg.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "SingleMsg.h" // Initializing static variables diff --git a/moose-core/msg/testMsg.cpp b/moose-core/msg/testMsg.cpp index 90d7fae5..a8fa0f6d 100644 --- a/moose-core/msg/testMsg.cpp +++ b/moose-core/msg/testMsg.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "../builtins/Arith.h" #include "../shell/Shell.h" diff --git a/moose-core/pymoose/CMakeLists.txt b/moose-core/pymoose/CMakeLists.txt index 0a2a6388..22f4613e 100644 --- a/moose-core/pymoose/CMakeLists.txt +++ b/moose-core/pymoose/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/") @@ -68,7 +69,7 @@ endif() # Remove prefix lib from python module. if(NOT(PYTHON_SO_EXTENSION STREQUAL "")) - set_target_properties(_moose PROPERTIES SUFFIX ${PYTHON_SO_EXTENSION}) + set_target_properties(_moose PROPERTIES SUFFIX ${PYTHON_SO_EXTENSION}) endif() set_target_properties(_moose PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYMOOSE_OUTPUT_DIRECTORY} @@ -76,22 +77,22 @@ set_target_properties(_moose PROPERTIES SUFFIX ${PYTHON_SO_EXTENSION} ) -# On OSX+Brew and python2.5; link with libstdc++ -if(MACOSX AND ("${PYTHON_VERSION_MAJOR}" STREQUAL "2")) - add_definitions( -std=c++11 -stdlib=libc++ ) -endif() - # see issue #80 if(HDF5_FOUND AND WITH_NSDF) set_target_properties( _moose PROPERTIES LINK_FLAGS "-L${HDF5_LIBRARY_DIRS}" ) endif() -if(MACOSX) +if(APPLE) set(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup") message(STATUS "ADDING some linker flags ${CMAKE_EXE_LINKER_FLAGS}") -endif(MACOSX) +endif(APPLE) + +# cmake --help-policy CMP0042 +if(APPLE) + set_target_properties( _moose PROPERTIES MACOSX_RPATH OFF) +endif(APPLE) -if(MACOSX) +if(APPLE) target_link_libraries( _moose "-Wl,-all_load" ${MOOSE_LIBRARIES} @@ -100,7 +101,7 @@ if(MACOSX) target_link_libraries(_moose ${SYSTEM_SHARED_LIBS} ) -else(MACOSX) +else(APPLE) target_link_libraries(_moose "-Wl,--whole-archive" ${MOOSE_LIBRARIES} @@ -108,7 +109,7 @@ else(MACOSX) "-Wl,--no-whole-archive" ${SYSTEM_SHARED_LIBS} ) -endif(MACOSX) +endif(APPLE) add_custom_command(TARGET _moose POST_BUILD COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "MOOSE python extention is successfully built. Now " diff --git a/moose-core/python/moose/OrderedDict.py b/moose-core/python/moose/OrderedDict.py index cf7e1716..3f217842 100644 --- a/moose-core/python/moose/OrderedDict.py +++ b/moose-core/python/moose/OrderedDict.py @@ -14,7 +14,6 @@ try: except ImportError: pass - class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps keys to values. diff --git a/moose-core/python/moose/SBML/validation.py b/moose-core/python/moose/SBML/validation.py index e9670fa1..48facdf0 100644 --- a/moose-core/python/moose/SBML/validation.py +++ b/moose-core/python/moose/SBML/validation.py @@ -112,5 +112,6 @@ def validateModel(sbmlDoc): # consistencyMessages) if __name__ == '__main__': + import libsbml sbmlDoc = libsbml.readSBML('00001-sbml-l3v1.xml') validateModel(sbmlDoc) diff --git a/moose-core/python/moose/SBML/writeSBML.py b/moose-core/python/moose/SBML/writeSBML.py index 8124611b..ec9d357f 100644 --- a/moose-core/python/moose/SBML/writeSBML.py +++ b/moose-core/python/moose/SBML/writeSBML.py @@ -32,17 +32,12 @@ Aug 3 : Added recalculatecoordinates,cleanup in groupName ''' import sys import re +import os import moose from moose.SBML.validation import validateModel from moose.chemUtil.chemConnectUtil import * from moose.chemUtil.graphUtils import * - -# ToDo: -# Table should be written -# boundary condition for buffer pool having assignment statment constant -# shd be false - foundLibSBML_ = False try: from libsbml import * @@ -171,10 +166,6 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}): else: return False, "Atleast one compartment should exist to write SBML" -def calPrime(x): - prime = int((20 * (float(x - cmin) / float(cmax - cmin))) - 10) - return prime - def writeEnz(modelpath, cremodel_, sceneitems,groupInfo): for enz in moose.wildcardFind(modelpath + '/##[ISA=EnzBase]'): enzannoexist = False @@ -1060,12 +1051,6 @@ def writeSimulationAnnotation(modelpath): modelAnno = modelAnno + "</moose:ModelAnnotation>" return modelAnno -def xyPosition(objInfo,xory): - try: - return(float(moose.element(objInfo).getField(xory))) - except ValueError: - return (float(0)) - def recalculatecoordinates(modelpath, mObjlist,xcord,ycord): positionInfoExist = not(len(np.nonzero(xcord)[0]) == 0 \ and len(np.nonzero(ycord)[0]) == 0) @@ -1081,7 +1066,7 @@ def recalculatecoordinates(modelpath, mObjlist,xcord,ycord): objInfo = merts.path+'/info' if moose.exists(objInfo): Ix = defaultsceneWidth * ((xyPosition(objInfo,'x')-xmin)/(xmax-xmin)) - Iy = defaultsceneHeight * ((ymin-xyPosition(objInfo,'y'))/(ymax-ymin)) + Iy = defaultsceneHeight * ((xyPosition(objInfo,'y')-ymin)/(ymax-ymin)) moose.element(objInfo).x = Ix moose.element(objInfo).y = Iy diff --git a/moose-core/python/moose/__init__.py b/moose-core/python/moose/__init__.py index ceec0ffd..407b6950 100644 --- a/moose-core/python/moose/__init__.py +++ b/moose-core/python/moose/__init__.py @@ -1,8 +1,13 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function -# Bring moose.py functions into global namespace. - +# Bring everything from moose.py to global namespace. from moose.moose import * -__version__ = version( ) +# Bring everything from c++ module to global namespace. Not everything is +# imported by the pervios import statement. +from moose._moose import * + +# create a shorthand for version() call here. +__version__ = version() + diff --git a/moose-core/python/moose/chemMerge/merge.py b/moose-core/python/moose/chemMerge/merge.py index d3d80058..6b37ae44 100644 --- a/moose-core/python/moose/chemMerge/merge.py +++ b/moose-core/python/moose/chemMerge/merge.py @@ -714,17 +714,7 @@ def checkexist(spList,objB,objA): return allexist -def findCompartment(element): - while not mooseIsInstance(element,["CubeMesh","CyclMesh"]): - element = element.parent - return element - -def mooseIsInstance(element, classNames): - return moose.element(element).__class__.__name__ in classNames - - if __name__ == "__main__": - try: sys.argv[1] except IndexError: diff --git a/moose-core/python/moose/chemUtil/chemConnectUtil.py b/moose-core/python/moose/chemUtil/chemConnectUtil.py index f4cbccbc..bbb18ed5 100644 --- a/moose-core/python/moose/chemUtil/chemConnectUtil.py +++ b/moose-core/python/moose/chemUtil/chemConnectUtil.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- """ ChemconnectUtil.py Some of the command function are written """ -#Created : Friday May 27 12:19:00 2016(+0530) - __author__ = "Harsha Rani" __copyright__ = "Copyright 2017, Harsha Rani and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] @@ -13,16 +11,14 @@ __email__ = "hrani@ncbs.res.in" __status__ = "Development" __updated__ = "Aug 8 2017" -#Aug 8 : added findCompartment function here - import moose import numpy as np def xyPosition(objInfo,xory): try: - return(float(moose.element(objInfo).getField(xory))) - except ValueError: - return (float(0)) + return float(moose.element(objInfo).getField(xory)) + except ValueError as e: + return float(0) def setupMeshObj(modelRoot): ''' Setup compartment and its members pool,reaction,enz cplx under self.meshEntry dictionaries \ @@ -94,9 +90,6 @@ def setupMeshObj(modelRoot): ymax = max(ycord) return meshEntry,xmin,xmax,ymin,ymax,positionInfoExist,listOfitems -def sizeHint(self): - return QtCore.QSize(800,400) - def getxyCord(xcord,ycord,list1,listOfitems): for item in list1: # if isinstance(item,Function): @@ -200,7 +193,7 @@ def countitems(mitems,objtype): def findCompartment(element): if element.path == '/': return moose.element('/') - elif mooseIsInstance(element, ["CubeMesh", "CyclMesh"]): + elif mooseIsInstance(element, ["CubeMesh", "CylMesh"]): return (element) else: return findCompartment(moose.element(element.parent)) diff --git a/moose-core/python/moose/fixXreacs.py b/moose-core/python/moose/fixXreacs.py index de7bec63..7009390f 100644 --- a/moose-core/python/moose/fixXreacs.py +++ b/moose-core/python/moose/fixXreacs.py @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import print_function, division, absolute_import + #################################################################### # fixXreacs.py # The program is meant to take a model and reconfigure any cross-compartment @@ -10,17 +13,16 @@ # This program carries no warranty whatsoever. #################################################################### - import sys -import moose +import moose._moose as _moose msgSeparator = "_xMsg_" def findCompt( elm ): - elm = moose.element( elm ) + elm = _moose.element( elm ) pa = elm.parent while pa.path != '/': - if moose.Neutral(pa).isA[ 'ChemCompt' ]: + if _moose.Neutral(pa).isA[ 'ChemCompt' ]: return pa.path pa = pa.parent print( 'Error: No compartment parent found for ' + elm.path ) @@ -31,7 +33,7 @@ def checkEqual(lst): return not lst or lst.count(lst[0]) == len(lst) def findXreacs( basepath, reacType ): - reacs = moose.wildcardFind( basepath + '/##[ISA=' + reacType + 'Base]' ) + reacs = _moose.wildcardFind( basepath + '/##[ISA=' + reacType + 'Base]' ) ret = [] for i in reacs: reacc = findCompt( i ) @@ -48,38 +50,38 @@ def findXreacs( basepath, reacType ): return ret def removeEnzFromPool( pool ): - kids = moose.wildcardFind( pool.path + "/#" ) + kids = _moose.wildcardFind( pool.path + "/#" ) for i in kids: if i.isA[ 'EnzBase' ]: - moose.delete( i ) + _moose.delete( i ) elif i.isA[ 'Function' ]: - moose.delete( i ) + _moose.delete( i ) # If a pool is not in the same compt as reac, make a proxy in the reac # compt, connect it up, and disconnect the one in the old compt. def proxify( reac, reacc, direction, pool, poolc ): - reacc_elm = moose.element( reacc ) - reac_elm = moose.element( reac ) + reacc_elm = _moose.element( reacc ) + reac_elm = _moose.element( reac ) # Preserve the rates which were set up for the x-compt reacn - #moose.showfield( reac ) - dupname = pool.name + '_xfer_' + moose.element(poolc).name + #_moose.showfield( reac ) + dupname = pool.name + '_xfer_' + _moose.element(poolc).name #print "#############", pool, dupname, poolc - if moose.exists( reacc + '/' + dupname ): - duppool = moose.element( reacc + '/' + dupname ) + if _moose.exists( reacc + '/' + dupname ): + duppool = _moose.element( reacc + '/' + dupname ) else: # This also deals with cases where the duppool is buffered. - duppool = moose.copy(pool, reacc_elm, dupname ) + duppool = _moose.copy(pool, reacc_elm, dupname ) duppool.diffConst = 0 # diffusion only happens in original compt removeEnzFromPool( duppool ) disconnectReactant( reac, pool, duppool ) - moose.connect( reac, direction, duppool, 'reac' ) - #moose.showfield( reac ) - #moose.showmsg( reac ) + _moose.connect( reac, direction, duppool, 'reac' ) + #_moose.showfield( reac ) + #_moose.showmsg( reac ) def enzProxify( enz, enzc, direction, pool, poolc ): if enzc == poolc: return - enze = moose.element( enz ) + enze = _moose.element( enz ) # kcat and k2 are indept of volume, just time^-1 km = enze.numKm proxify( enz, enzc, direction, pool, poolc ) @@ -88,7 +90,7 @@ def enzProxify( enz, enzc, direction, pool, poolc ): def reacProxify( reac, reacc, direction, pool, poolc ): if reacc == poolc: return - reac_elm = moose.element( reac ) + reac_elm = _moose.element( reac ) kf = reac_elm.numKf kb = reac_elm.numKb proxify( reac, reacc, direction, pool, poolc ) @@ -106,26 +108,26 @@ def identifyMsg( src, srcOut, dest ): def disconnectReactant( reacOrEnz, reactant, duppool ): outMsgs = reacOrEnz.msgOut infoPath = duppool.path + '/info' - if moose.exists( infoPath ): - info = moose.element( infoPath ) + if _moose.exists( infoPath ): + info = _moose.element( infoPath ) else: - info = moose.Annotator( infoPath ) + info = _moose.Annotator( infoPath ) - #moose.le( reactant ) + #_moose.le( reactant ) notes = "" - #moose.showmsg( reacOrEnz ) + #_moose.showmsg( reacOrEnz ) for i in outMsgs: #print "killing msg from {} to {}\nfor {} and {}".format( reacOrEnz.path, reactant.path, i.srcFieldsOnE1[0], i.srcFieldsOnE2[0] ) if i.e1 == reactant: msgStr = identifyMsg( i.e2, i.e2.srcFieldsOnE2[0], i.e1 ) if len( msgStr ) > 0: notes += msgStr - moose.delete( i ) + _moose.delete( i ) elif i.e2 == reactant: msgStr = identifyMsg( i.e1[0], i.srcFieldsOnE1[0], i.e2[0] ) if len( msgStr ) > 0: notes += msgStr - moose.delete( i ) + _moose.delete( i ) #print "MSGS to rebuild:", notes info.notes += notes @@ -152,7 +154,7 @@ def fixXreacs( basepath ): def getOldRates( msgs ): if len( msgs ) > 1 : m1 = msgs[1].split( msgSeparator )[0] - elm = moose.element( m1.split( ' ' )[0] ) + elm = _moose.element( m1.split( ' ' )[0] ) if elm.isA[ 'ReacBase' ]: return [elm.numKf, elm.numKb] elif elm.isA[ 'EnzBase' ]: @@ -164,7 +166,7 @@ def restoreOldRates( oldRates, msgs ): #print oldRates, msgs if len( msgs ) > 1 : m1 = msgs[1].split( msgSeparator )[0] - elm = moose.element( m1.split( ' ' )[0] ) + elm = _moose.element( m1.split( ' ' )[0] ) if elm.isA[ 'ReacBase' ]: elm.numKf = oldRates[0] elm.numKb = oldRates[1] @@ -174,20 +176,20 @@ def restoreOldRates( oldRates, msgs ): def restoreXreacs( basepath ): - proxyInfo = moose.wildcardFind( basepath + "/##/#_xfer_#/info" ) + proxyInfo = _moose.wildcardFind( basepath + "/##/#_xfer_#/info" ) for i in proxyInfo: msgs = i.notes.split( msgSeparator ) oldRates = getOldRates( msgs ) #print( "Deleting {}".format( i.parent.path ) ) #print msgs - moose.delete( i.parent ) + _moose.delete( i.parent ) for j in msgs[1:]: if len( j ) > 0: args = j.split( ' ' ) assert( len( args ) == 4 ) - #moose.showfield( args[0] ) - moose.connect( args[0], args[1], args[2], args[3] ) + #_moose.showfield( args[0] ) + _moose.connect( args[0], args[1], args[2], args[3] ) #print( "Reconnecting {}".format( args ) ) - #moose.showfield( args[0] ) + #_moose.showfield( args[0] ) restoreOldRates( oldRates, msgs ) diff --git a/moose-core/python/moose/genesis/writeKkit.py b/moose-core/python/moose/genesis/writeKkit.py index f6bba42b..8fc63569 100644 --- a/moose-core/python/moose/genesis/writeKkit.py +++ b/moose-core/python/moose/genesis/writeKkit.py @@ -583,7 +583,7 @@ def getColorCheck(color,GENESIS_COLOR_SEQUENCE): index = color return index elif isinstance(color, tuple): - color = map(int, color)[0:3] + color =[int(x) for x in color[0:3]] index = nearestColorIndex(color, GENESIS_COLOR_SEQUENCE) return index elif isinstance(color, int): diff --git a/moose-core/python/moose/hdfutil.py b/moose-core/python/moose/hdfutil.py index 3d1fd80a..bae19268 100644 --- a/moose-core/python/moose/hdfutil.py +++ b/moose-core/python/moose/hdfutil.py @@ -84,12 +84,12 @@ # # Code: -from __future__ import print_function +from __future__ import print_function, division, absolute_import try: from future_builtins import zip except ImportError: pass -from . import moose as moose__ +import moose import numpy as np import h5py as h5 import time @@ -123,8 +123,8 @@ def get_rec_dtype(em): if em.className in dtype_table: dtype = dtype_table[em.className] else: - print('Creating entries for class:', obj.className) - fielddict = moose__.getFieldDict(obj.className, 'valueFinfo') + print('Creating entries for class:', em.className) + fielddict = moose.getFieldDict(em.className, 'valueFinfo') print(fielddict) # If we do not have the type of this field in cpp-np data @@ -137,8 +137,8 @@ def get_rec_dtype(em): fields = [(fieldname, cpptonp[ftype]) # [('path', 'S1024')] for fieldname, ftype in sorted(fielddict.items()) if ftype in cpptonp] - dtype_table[obj.className] = np.dtype(fields) - return dtype_table[obj.className] + dtype_table[em.className] = np.dtype(fields) + return dtype_table[em.className] def save_dataset(classname, rec, dtype, hdfnode): """Saves the data from rec into dataset""" @@ -211,15 +211,15 @@ def loadtree(hdfnode, moosenode): shape = dims[path] em = moose.vec(rpath, shape, classname) wfields = {} - for cinfo in moose__.element('/classes').children: + 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][:] fieldnames = dset.dtype.names for ii in range(len(dset)): - obj = moose__.element(dset['path'][ii][len(basepath):]) + obj = moose.element(dset['path'][ii][len(basepath):]) for f in wfields[obj.className]: obj.setField(f, dset[f][ii]) @@ -244,7 +244,7 @@ def savestate(filename=None): class_count_dict = {} class_array_dict = {} objcount = 0 - for obj in moose__.wildcardFind("/##"): + for obj in moose.wildcardFind("/##"): if obj.path.startswith('/Msg') or obj.path.startswith('/class') or obj.className == 'Table' or obj.className == 'TableEntry': continue print('Processing:', obj.path, obj.className) @@ -257,7 +257,7 @@ def savestate(filename=None): # If we do not yet have dataset for this class, create one and keep it in dict if obj.className not in class_dataset_dict: print('Creating entries for class:', obj.className) - fielddict = moose__.getFieldDict(obj.className, 'valueFinfo') + fielddict = moose.getFieldDict(obj.className, 'valueFinfo') print(fielddict) keys = sorted(fielddict) fields = [] # [('path', 'S1024')] @@ -280,7 +280,7 @@ def savestate(filename=None): for f in ds.dtype.names: print('getting field:', f) entry.getField(f) - fields = [f.path if isinstance(f, moose__.vec) or isinstance(f, moose__.element) else f for f in fields] + fields = [f.path if isinstance(f, moose.vec) or isinstance(f, moose.element) else f for f in fields] class_array_dict[obj.className].append(fields) # print 'fields:' # print fields @@ -305,9 +305,9 @@ def savestate(filename=None): def restorestate(filename): wfields = {} - for cinfo in moose__.element('/classes').children: + 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'][:] @@ -318,12 +318,12 @@ def restorestate(filename): sorted_paths = sorted(typeinfo['path'], key=lambda x: x.count('/')) for path in sorted_paths: name = path.rpartition('/')[-1].partition('[')[0] - moose__.vec(parentdict[path] + '/' + name, eval(dimsdict[path]), classdict[path]) + moose.vec(parentdict[path] + '/' + name, eval(dimsdict[path]), classdict[path]) for key in fd['/elements']: dset = fd['/elements/'][key][:] fieldnames = dset.dtype.names for ii in range(len(dset)): - obj = moose__.element(dset['path'][ii]) + obj = moose.element(dset['path'][ii]) for f in wfields[obj.className]: obj.setField(f, dset[f][ii]) diff --git a/moose-core/python/moose/moose.py b/moose-core/python/moose/moose.py index e6cf9bf7..069d43b9 100644 --- a/moose-core/python/moose/moose.py +++ b/moose-core/python/moose/moose.py @@ -4,18 +4,20 @@ from __future__ import print_function, division, absolute_import # Author: Subhasis Ray # Maintainer: Dilawar Singh, Harsha Rani, Upi Bhalla -from __future__ import print_function, division, absolute_import - -from contextlib import closing import warnings import pydoc -from io import StringIO -from os.path import splitext import moose import moose.utils as mu +from io import StringIO +from os.path import splitext +from contextlib import closing -sbmlImport_, sbmlError_ = True, '' +# Import function from C++ module into moose namespace. +# from moose._moose import * +import moose._moose as _moose +# sbml import. +sbmlImport_, sbmlError_ = True, '' try: import moose.SBML.readSBML as _readSBML import moose.SBML.writeSBML as _writeSBML @@ -58,16 +60,6 @@ except Exception as e: mergechemImport_ = False mergechemError_ = '%s' % e - -# Import function from C++ module into moose namespace. -from moose._moose import * - -#`loadModel` is deleted from global import, -# this is to bypass the call from c++ module which is due to fixXreacs() which is -# now written in python and readKkit.cpp will not be possible to set/call the solver due to this - -del globals()['loadModel'] - def loadModel(filename, target,method=None): solverClass = 'Neutral' if method != None: @@ -98,8 +90,10 @@ def loadModel(filename, target,method=None): chemError_ = _chemUtil.add_Delete_ChemicalSolver.mooseAddChemSolver(target,method) return ret +# Version def version( ): - return VERSION + # Show user version. + return moose._moose.VERSION # Tests from moose.moose_test import test @@ -252,7 +246,7 @@ def pwe(): the path, use moose.getCwe() """ - pwe_ = moose.getCwe() + pwe_ = _moose.getCwe() print(pwe_.getPath()) return pwe_ @@ -273,19 +267,19 @@ def le(el=None): """ if el is None: - el = getCwe() + el = _moose.getCwe() elif isinstance(el, str): - if not exists(el): + if not _moose.exists(el): raise ValueError('no such element') - el = element(el) - elif isinstance(el, vec): + el = _moose.element(el) + elif isinstance(el, _moose.vec): el = el[0] print('Elements under', el.path) for ch in el.children: print(ch.path) return [child.path for child in el.children] -ce = setCwe # ce is a GENESIS shorthand for change element. +ce = _moose.setCwe # ce is a GENESIS shorthand for change element. def syncDataHandler(target): @@ -309,10 +303,10 @@ def syncDataHandler(target): raise NotImplementedError('The implementation is not working for IntFire - goes to invalid objects. \ First fix that issue with SynBase or something in that line.') if isinstance(target, str): - if not moose.exists(target): + if not _moose.exists(target): raise ValueError('%s: element does not exist.' % (target)) - target = vec(target) - moose.syncDataHandler(target) + target = _moose.vec(target) + _moose.syncDataHandler(target) def showfield(el, field='*', showtype=False): @@ -337,11 +331,11 @@ def showfield(el, field='*', showtype=False): """ if isinstance(el, str): - if not exists(el): + if not _moose.exists(el): raise ValueError('no such element') - el = element(el) + el = _moose.element(el) if field == '*': - value_field_dict = getFieldDict(el.className, 'valueFinfo') + value_field_dict = _moose.getFieldDict(el.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('\n[', el.path, ']') @@ -397,7 +391,7 @@ def listmsg(el): connections of `el`. """ - obj = element(el) + obj = _moose.element(el) ret = [] for msg in obj.inMsg: ret.append(msg) @@ -419,7 +413,7 @@ def showmsg(el): None """ - obj = element(el) + obj = _moose.element(el) print('INCOMING:') for msg in obj.msgIn: print( @@ -467,7 +461,7 @@ def getfielddoc(tokens, indent=''): fieldname = tokens[1] while True: try: - classelement = moose.element('/classes/' + classname) + classelement = _moose.element('/classes/' + classname) for finfo in classelement.children: for fieldelement in finfo: baseinfo = '' @@ -526,12 +520,13 @@ def getmoosedoc(tokens, inherited=False): """ indent = ' ' - with closing(StringIO()) as docstring: + docstring = StringIO() + with closing(docstring): if not tokens: return "" try: - class_element = moose.element('/classes/%s' % (tokens[0])) - except ValueError: + class_element = _moose.element('/classes/%s' % (tokens[0])) + except ValueError as e: raise NameError('name \'%s\' not defined.' % (tokens[0])) if len(tokens) > 1: docstring.write(toUnicode(getfielddoc(tokens))) @@ -539,14 +534,14 @@ def getmoosedoc(tokens, inherited=False): docstring.write(toUnicode('%s\n' % (class_element.docs))) append_finfodocs(tokens[0], docstring, indent) if inherited: - mro = eval('moose.%s' % (tokens[0])).mro() + mro = eval('_moose.%s' % (tokens[0])).mro() for class_ in mro[1:]: - if class_ == moose.melement: + if class_ == _moose.melement: break docstring.write(toUnicode( '\n\n#Inherited from %s#\n' % (class_.__name__))) append_finfodocs(class_.__name__, docstring, indent) - if class_ == moose.Neutral: # Neutral is the toplevel moose class + if class_ == _moose.Neutral: # Neutral is the toplevel moose class break return docstring.getvalue() @@ -554,13 +549,13 @@ def getmoosedoc(tokens, inherited=False): def append_finfodocs(classname, docstring, indent): """Append list of finfos in class name to docstring""" try: - class_element = moose.element('/classes/%s' % (classname)) + class_element = _moose.element('/classes/%s' % (classname)) except ValueError: raise NameError('class \'%s\' not defined.' % (classname)) for ftype, rname in finfotypes: docstring.write(toUnicode('\n*%s*\n' % (rname.capitalize()))) try: - finfo = moose.element('%s/%s' % (class_element.path, ftype)) + finfo = _moose.element('%s/%s' % (class_element.path, ftype)) for field in finfo.vec: docstring.write(toUnicode( '%s%s: %s\n' % (indent, field.fieldName, field.type))) @@ -621,7 +616,7 @@ def doc(arg, inherited=True, paged=True): tokens = tokens[1:] elif isinstance(arg, type): tokens = [arg.__name__] - elif isinstance(arg, melement) or isinstance(arg, vec): + elif isinstance(arg, _moose.melement) or isinstance(arg, _moose.vec): text = '%s: %s\n\n' % (arg.path, arg.className) tokens = [arg.className] if tokens: diff --git a/moose-core/python/moose/neuroml/ChannelML.py b/moose-core/python/moose/neuroml/ChannelML.py index cc2c4443..73ded19c 100644 --- a/moose-core/python/moose/neuroml/ChannelML.py +++ b/moose-core/python/moose/neuroml/ChannelML.py @@ -13,8 +13,9 @@ readChannelMLFromFile(...) to load a standalone ChannelML file (synapse/channel) readChannelML(...) / readSynapseML to load from an xml.etree xml element (could be part of a larger NeuroML file). """ -from __future__ import print_function -from xml.etree import ElementTree as ET +from __future__ import print_function, division +from xml.etree import cElementTree as ET +import string import os import sys import math @@ -401,7 +402,7 @@ class ChannelML(): def make_cml_function(self, element, fn_name, concdep=None): fn_type = element.attrib['expr_form'] if fn_type in ['exponential','sigmoid','exp_linear']: - fn = self.make_function( fn_name, fn_type, rate=float(element.attrib['rate']),\ + self.make_function( fn_name, fn_type, rate=float(element.attrib['rate']),\ midpoint=float(element.attrib['midpoint']), scale=float(element.attrib['scale'] ) ) elif fn_type == 'generic': ## OOPS! These expressions should be in SI units, since I converted to SI @@ -414,7 +415,7 @@ class ChannelML(): 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+')') - fn = self.make_function( fn_name, fn_type, expr_string=expr_string, concdep=concdep ) + self.make_function( fn_name, fn_type, expr_string=expr_string, concdep=concdep ) else: pu.fatal("Unsupported function type %s "% fn_type) sys.exit() @@ -464,11 +465,13 @@ class ChannelML(): val = eval(alternativeFalse,{"__builtins__":None},allowed_locals) else: val = eval(expr_str,{"__builtins__" : None},allowed_locals) - if fn_name == 'tau': return val/self.q10factor - else: return val - + if fn_name == 'tau': + return val/self.q10factor + else: + return val fn.__name__ = fn_name setattr(self.__class__, fn.__name__, fn) + return None def make_new_synapse(syn_name, postcomp, syn_name_full, nml_params): @@ -482,7 +485,7 @@ def make_new_synapse(syn_name, postcomp, syn_name_full, nml_params): else: raise IOError( 'For mechanism {0}: files {1} not found under {2}.'.format( - mechanismname, model_filename, self.model_dir + syn_name, model_filename, nml_params['model_dir'] ) ) ## deep copies the library SynChan and SynHandler diff --git a/moose-core/python/moose/neuroml/NetworkML.py b/moose-core/python/moose/neuroml/NetworkML.py index 14ae5f53..1bbf54c1 100644 --- a/moose-core/python/moose/neuroml/NetworkML.py +++ b/moose-core/python/moose/neuroml/NetworkML.py @@ -267,7 +267,7 @@ class NetworkML(): else: raise IOError( 'For mechanism {0}: files {1} not found under {2}.'.format( - mechanismname, model_filename, self.model_dir + syn_name, model_filename, self.model_dir ) ) weight = float(syn_props.attrib['weight']) diff --git a/moose-core/python/moose/neuroml/NeuroML.py b/moose-core/python/moose/neuroml/NeuroML.py index 5d9d8edf..e63fbb4e 100644 --- a/moose-core/python/moose/neuroml/NeuroML.py +++ b/moose-core/python/moose/neuroml/NeuroML.py @@ -50,8 +50,8 @@ In [3]: moose.neuroml.loadNeuroML_L123('Generated.net.xml') """ import moose -from moose.utils import * -from xml.etree import ElementTree as ET +import moose.utils as mu +from xml.etree import cElementTree as ET from moose.neuroml.ChannelML import ChannelML from moose.neuroml.MorphML import MorphML from moose.neuroml.NetworkML import NetworkML diff --git a/moose-core/python/moose/neuroml2/converter.py b/moose-core/python/moose/neuroml2/converter.py deleted file mode 100644 index 37dc7307..00000000 --- a/moose-core/python/moose/neuroml2/converter.py +++ /dev/null @@ -1,207 +0,0 @@ -# -*- coding: utf-8 -*- -# converter.py --- -# -# Filename: mtoneuroml.py -# Description: -# Author: -# Maintainer: -# Created: Mon Apr 22 12:15:23 2013 (+0530) -# Version: -# Last-Updated: Wed Jul 10 16:36:14 2013 (+0530) -# By: subha -# Update #: 819 -# 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: - -#!!!!! TODO: unit conversion !!!! - -try: - from future_builtins import zip -except ImportError: - pass -import traceback -import warnings -from collections import deque -import numpy as np -from scipy.optimize import curve_fit -from matplotlib import pyplot as plt - -import moose -from moose.utils import autoposition -import neuroml -import hhfit - - -def convert_morphology(root, positions='auto'): - """Convert moose neuron morphology contained under `root` into a - NeuroML object. The id of the return object is - {root.name}_morphology. Each segment object gets the numeric value - of the moose id of the object. The name of the segments are same - as the corresponding moose compartment. - - 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 - ------ - a neuroml.Morphology instance. - - """ - if positions == 'auto': - queue = deque([autoposition(root)]) - elif positions == 'explicit': - 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: - raise Exception('There must be one and only one top level compartment. Found %d' % (len(topcomp_list))) - else: - raise Exception('allowed values for keyword argument positions=`auto` or `explicit`') - comp_seg = {} - parent = None - while len(queue) > 0: - compartment = queue.popleft() - proximal = neuroml.Point3DWithDiam(x=compartment.x0, - y=compartment.y0, - z=compartment.z0, - diameter=compartment.diameter) - distal = neuroml.Point3DWithDiam(x=compartment.x, - y=compartment.y, - z=compartment.z, - diameter=compartment.diameter) - plist = list(map(moose.element, compartment.neighbours['axial'])) - 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) - # TODO: For the time being using numerical value of the moose - # id for neuroml id.This needs to be updated for handling - # array elements - segment.name = compartment.name - comp_seg[compartment] = segment - queue.extend([comp for comp in map(moose.element, compartment.neighbours['raxial'])]) - morph = neuroml.Morphology(id='%s_morphology' % (root.name)) - morph.segments.extend(comp_seg.values()) - return morph - - -def define_vdep_rate(fn, name): - """Define new component type with generic expressions for voltage - dependent rate. - - """ - 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) - alpha = gate.tableA.copy() - beta = gate.tableB - alpha - vrange = np.linspace(gate.min, gate.max, len(alpha)) - afn, ap = hhfit.find_ratefn(vrange, alpha) - bfn, bp = hhfit.find_ratefn(vrange, beta) - if afn is None: - raise Exception('could not find a fitting function for `alpha`') - if bfn is None: - raise Exception('could not find a fitting function for `alpha`') - afn_type = fn_rate_map[afn] - 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, - midpoint='%gmV' % (ap[2]), - scale='%gmV' % (ap[1]), - rate='%gper_ms' % (ap[0])) - bfn_type = fn_rate_map[bfn] - 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, - 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. - - TODO: need to check useConcentration option for Ca2+ and V - dependent gates. How to handle generic expressions??? - - """ - nml_channel = neuroml.IonChannel(id=channel.id_.value, - name=channel.name, - type='ionChannelHH', - conductance=channel.Gbar) - if channel.Xpower > 0: - hh_rate_x = convert_hhgate(channel.gateX[0]) - hh_rate_x.instances = channel.Xpower - nml_channel.gate.append(hh_rate_x) - if channel.Ypower > 0: - hh_rate_y = convert_hhgate(channel.gateY[0]) - hh_rate_y.instances = channel.Ypower - nml_channel.gate.append(hh_rate_y) - if channel.Zpower > 0: - hh_rate_z = convert_hhgate(channel.gateZ[0]) - hh_rate_y.instances = channel.Zpower - nml_channel.gate.append(hh_rate_z) - return nml_channel - - -# -# converter.py ends here diff --git a/moose-core/python/moose/neuroml2/hhfit.py b/moose-core/python/moose/neuroml2/hhfit.py index c4eb3391..e82effda 100644 --- a/moose-core/python/moose/neuroml2/hhfit.py +++ b/moose-core/python/moose/neuroml2/hhfit.py @@ -133,7 +133,7 @@ def double_exp(x, a, k1, x1, k2, x2, y0=0): ret = np.zeros(len(x)) try: ret = a / (np.exp(k1 * (x - x1)) + np.exp(k2 * (x - x2))) + y0 - except RuntimeWaring as e: + except RuntimeWarning as e: traceback.print_exc() return ret diff --git a/moose-core/python/moose/neuroml2/reader.py b/moose-core/python/moose/neuroml2/reader.py index 75c9a7f2..6a9dec0f 100644 --- a/moose-core/python/moose/neuroml2/reader.py +++ b/moose-core/python/moose/neuroml2/reader.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import print_function, division, absolute_import + # reader.py --- # # Filename: reader.py @@ -14,7 +16,6 @@ """Implementation of reader for NeuroML 2 models. TODO: handle morphologies of more than one segment... """ -from __future__ import print_function, division, absolute_import try: from future_builtins import zip, map @@ -29,9 +30,15 @@ import neuroml as nml from pyneuroml import pynml import moose import moose.utils as mu - from .units import SI -from . import hhfit + + +def _unique( ls ): + res = [ ] + for l in ls: + if l not in res: + res.append( l ) + return res def _unique( ls ): res = [ ] @@ -357,7 +364,7 @@ class NML2Reader(object): raise Exception('No prototype pool for %s referred to by %s' % ( species.concentration_model, species.id) ) - pool_id = moose.copy(proto_pool, comp, species.id) + pool_id = moose.copy(proto_pool, compartment, species.id) pool = moose.element(pool_id) pool.B = pool.B / (np.pi * compartment.length * ( 0.5 * compartment.diameter + pool.thickness) * @@ -381,18 +388,19 @@ class NML2Reader(object): return False - rate_fn_map = { - 'HHExpRate': hhfit.exponential2, - 'HHSigmoidRate': hhfit.sigmoid2, - 'HHSigmoidVariable': hhfit.sigmoid2, - 'HHExpLinearRate': hhfit.linoid2 } - def calculateRateFn(self, ratefn, vmin, vmax, tablen=3000, vShift='0mV'): """Returns A / B table from ngate.""" + from . import hhfit + rate_fn_map = { + 'HHExpRate': hhfit.exponential2, + 'HHSigmoidRate': hhfit.sigmoid2, + 'HHSigmoidVariable': hhfit.sigmoid2, + 'HHExpLinearRate': hhfit.linoid2 } + tab = np.linspace(vmin, vmax, tablen) if self._is_standard_nml_rate(ratefn): midpoint, rate, scale = map(SI, (ratefn.midpoint, ratefn.rate, ratefn.scale)) - return self.rate_fn_map[ratefn.type](tab, rate, scale, midpoint) + return rate_fn_map[ratefn.type](tab, rate, scale, midpoint) else: for ct in self.doc.ComponentType: if ratefn.type == ct.name: @@ -421,11 +429,13 @@ class NML2Reader(object): try: ionChannel = self.id_to_ionChannel[chdens.ion_channel] except KeyError: - mu.info('No channel with id', chdens.ion_channel) + mu.info('No channel with id: %s' % chdens.ion_channel) continue if self.verbose: - mu.info('Setting density of channel %s in %s to %s; erev=%s (passive: %s)'%(chdens.id, segments, condDensity,erev,self.isPassiveChan(ionChannel))) + mu.info('Setting density of channel %s in %s to %s; erev=%s (passive: %s)'%( + chdens.id, segments, condDensity,erev,self.isPassiveChan(ionChannel)) + ) if self.isPassiveChan(ionChannel): for seg in segments: @@ -542,13 +552,13 @@ class NML2Reader(object): if hasattr(ngate,'steady_state') and (ngate.time_course is None) and (ngate.steady_state is not None): inf = ngate.steady_state tau = 1 / (alpha + beta) - if (inf is not None): + if inf is not None: inf = self.calculateRateFn(inf, vmin, vmax, vdivs) mgate.tableA = q10_scale * (inf / tau) mgate.tableB = q10_scale * (1 / tau) if self.verbose: - mu.info(self.filename, '== Created', mchan.path, 'for', chan.id) + mu.info('%s: Created %s for %s'%(self.filename,mchan.path,chan.id)) return mchan def createPassiveChannel(self, chan): @@ -558,7 +568,7 @@ class NML2Reader(object): else: mchan = moose.Leakage(epath) if self.verbose: - mu.info(self.filename, 'Created', mchan.path, 'for', chan.id) + mu.info('%s: Created %s for %s'%(self.filename,mchan.path,chan.id)) return mchan def importInputs(self, doc): @@ -579,7 +589,7 @@ class NML2Reader(object): def importIonChannels(self, doc, vmin=-150e-3, vmax=100e-3, vdivs=5000): if self.verbose: - mu.info(self.filename, 'Importing the ion channels') + mu.info('%s : Importing the ion channels' % self.filename ) for chan in doc.ion_channel+doc.ion_channel_hhs: if chan.type == 'ionChannelHH': @@ -593,11 +603,12 @@ class NML2Reader(object): self.nml_to_moose[chan] = mchan self.proto_chans[chan.id] = mchan if self.verbose: - mu.info(self.filename, 'Created ion channel', mchan.path, 'for', chan.type, chan.id) + mu.info( self.filename + ' : Created ion channel %s for %s %s'%( + mchan.path, chan.type, chan.id)) def importConcentrationModels(self, doc): for concModel in doc.decaying_pool_concentration_models: - proto = self.createDecayingPoolConcentrationModel(concModel) + self.createDecayingPoolConcentrationModel(concModel) def createDecayingPoolConcentrationModel(self, concModel): """Create prototype for concentration model""" @@ -606,10 +617,6 @@ class NML2Reader(object): else: name = concModel.id ca = moose.CaConc('%s/%s' % (self.lib.path, id)) - mu.info('11111', concModel.restingConc) - mu.info('2222', concModel.decayConstant) - mu.info('33333', concModel.shellThickness) - ca.CaBasal = SI(concModel.restingConc) ca.tau = SI(concModel.decayConstant) ca.thick = SI(concModel.shellThickness) @@ -619,4 +626,4 @@ class NML2Reader(object): self.proto_pools[concModel.id] = ca 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)) + mu.debug('Created moose element: %s for nml conc %s' % (ca.path, concModel.id)) diff --git a/moose-core/python/moose/neuroml2/run_cell.py b/moose-core/python/moose/neuroml2/run_cell.py index a95e2a29..81d535f1 100644 --- a/moose-core/python/moose/neuroml2/run_cell.py +++ b/moose-core/python/moose/neuroml2/run_cell.py @@ -43,6 +43,7 @@ # Code: import moose +import moose.utils as mu import sys from reader import NML2Reader import numpy as np @@ -76,16 +77,10 @@ def run(nogui): plotdt = 1e-4 simtime = 150e-3 - if (1): - #moose.showmsg( '/clock' ) - for i in range(8): - moose.setClock( i, simdt ) - moose.setClock( 8, plotdt ) - moose.reinit() - else: - utils.resetSim([model.path, data.path], simdt, plotdt, simmethod='ee') - moose.showmsg( '/clock' ) - + for i in range(8): + moose.setClock( i, simdt ) + moose.setClock( 8, plotdt ) + moose.reinit() moose.start(simtime) print("Finished simulation!") @@ -113,4 +108,4 @@ if __name__ == '__main__': nogui = '-nogui' in sys.argv - run(nogui) \ No newline at end of file + run(nogui) diff --git a/moose-core/python/moose/neuroml2/run_hhcell.py b/moose-core/python/moose/neuroml2/run_hhcell.py index 61e18afc..fb92841d 100644 --- a/moose-core/python/moose/neuroml2/run_hhcell.py +++ b/moose-core/python/moose/neuroml2/run_hhcell.py @@ -120,15 +120,11 @@ def run(nogui): simdt = 1e-6 plotdt = 1e-4 simtime = 300e-3 - if (1): - #moose.showmsg( '/clock' ) - for i in range(8): - moose.setClock( i, simdt ) - moose.setClock( 8, plotdt ) - moose.reinit() - else: - utils.resetSim([model.path, data.path], simdt, plotdt, simmethod='ee') - moose.showmsg( '/clock' ) + #moose.showmsg( '/clock' ) + for i in range(8): + moose.setClock( i, simdt ) + moose.setClock( 8, plotdt ) + moose.reinit() moose.start(simtime) print("Finished simulation!") @@ -164,4 +160,4 @@ if __name__ == '__main__': nogui = '-nogui' in sys.argv run(nogui) - \ No newline at end of file + diff --git a/moose-core/python/moose/plot_utils.py b/moose-core/python/moose/plot_utils.py index 9b309e46..a680dbbe 100644 --- a/moose-core/python/moose/plot_utils.py +++ b/moose-core/python/moose/plot_utils.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# plot_utils.py: Some utility function for plotting data in moose. - from __future__ import print_function, division, absolute_import __author__ = "Dilawar Singh" @@ -225,7 +222,7 @@ def saveRecords(records, xvec = None, **kwargs): for k in records: try: yvec = records[k].vector - except AtrributeError as e: + except AttributeError as e: yevc = records[k] yvecs.append(yvec) xvec = np.linspace(0, clock.currentTime, len(yvecs[0])) @@ -287,7 +284,7 @@ def plotRecords(records, xvec = None, **kwargs): plt.close( ) -def plotTables( regex = '.*', **kwargs ): +def plotTablesByRegex( regex = '.*', **kwargs ): """plotTables Plot all moose.Table/moose.Table2 matching given regex. By default plot all tables. Table names must be unique. Table name are used as legend. diff --git a/moose-core/python/moose/utils.py b/moose-core/python/moose/utils.py index 8dbec98a..64fdee8b 100644 --- a/moose-core/python/moose/utils.py +++ b/moose-core/python/moose/utils.py @@ -82,15 +82,17 @@ def readtable(table, filename, separator=None): line_no = 0 for line in in_file: line_no = line_no + 1 - tokens = split(line, separator) - if len(token) is 0: + tokens = line.split(separator) + if len(tokens) is 0: continue - elif len(token) == 1: - table[ii] = float(token[0]) - elif len(token) == 2: - table[int(token[0])] = float(token[1]) + elif len(tokens) == 1: + table[ii] = float(tokens[0]) + elif len(tokens) == 2: + table[int(tokens[0])] = float(tokens[1]) else: - print("pymoose.readTable(", table, ",", filename, ",", separator, ") - line#", line_no, " does not fit.") + print("pymoose.readTable(", table, ",", filename, ",", separator + , ") - line#", line_no, " does not fit." + ) def getfields(moose_object): """Returns a dictionary of the fields and values in this object.""" @@ -310,8 +312,9 @@ def autoposition(root): compartments = moose.wildcardFind('%s/##[TYPE=Compartment]' % (root.path)) stack = [compartment for compartment in map(moose.element, compartments) if len(compartment.neighbors['axial']) == 0] - if len(stack) != 1: - raise Exception('There must be one and only one top level compartment. Found %d' % (len(topcomp_list))) + + assert len(stack) == 1, 'There must be one and only one top level\ + compartment. Found %d' % len(stack) ret = stack[0] while len(stack) > 0: comp = stack.pop() diff --git a/moose-core/python/rdesigneur/rdesigneur.py b/moose-core/python/rdesigneur/rdesigneur.py index 447faa11..492cb180 100644 --- a/moose-core/python/rdesigneur/rdesigneur.py +++ b/moose-core/python/rdesigneur/rdesigneur.py @@ -311,7 +311,7 @@ class rdesigneur: protoName = protoVec[0][6:] if self.isKnownClassOrFile( protoName, knownClasses ): try: - getAttr( moose, protoName )( '/library/' + protoVec[1] ) + getattr( moose, protoName )( '/library/' + protoVec[1] ) except AttributeError: raise BuildError( protoType + "Proto: Moose class '" \ + protoVec[0] + "' not found." ) @@ -399,7 +399,7 @@ class rdesigneur: period = name.rfind( '.' ) slash = name.rfind( '/' ) if ( slash >= period ): - raise BuildError( "chanProto: bad filename:" + i[0] ) + raise BuildError( "chanProto: bad filename:" + name ) if ( slash < 0 ): return name[:period] else: @@ -441,7 +441,7 @@ class rdesigneur: for i in range( len(args) ): parms[i] = args[i] if parms[6] <= 0: - return _self.buildElecSoma( parms[:4] ) + return self.buildElecSoma( parms[:4] ) cell = moose.Neuron( '/library/' + parms[1] ) prev = buildCompt( cell, 'soma', dia = args[2], dx = args[3] ) dx = parms[5]/parms[6] @@ -494,10 +494,12 @@ class rdesigneur: # Expression can use p, g, L, len, dia, maxP, maxG, maxL. temp = [] for i in self.passiveDistrib: - if (len( i ) < 3) or (len(i) %2 != 1): - raise BuildError( "buildPassiveDistrib: Need 3 + N*2 arguments, have {}".format( len(i) ) ) + # Handle legacy format of ['.', path, field, expr [field expr]] + if (len( i ) < 3) or (i[0] != '.' and len(i) %2 != 1): + raise BuildError( "buildPassiveDistrib: Need 3 + N*2 arguments as (path field expr [field expr]...), have {}".format( len(i) ) ) - temp.append( '.' ) + if not(( len(i) % 2 ) != 1 and i[0] == '.' ): + temp.append( '.' ) temp.extend( i ) temp.extend( [""] ) self.elecid.passiveDistribution = temp @@ -1009,8 +1011,7 @@ rdesigneur.rmoogli.updateMoogliViewer() ################################################################ def validateFromMemory( self, epath, cpath ): - ret = self.validateChem() - return ret + return self.validateChem() ################################################################# # assumes ePath is the parent element of the electrical model, @@ -1065,8 +1066,9 @@ rdesigneur.rmoogli.updateMoogliViewer() self._configureSolvers() for i in self.adaptorList: - print(i) - self._buildAdaptor( i[0],i[1],i[2],i[3],i[4],i[5],i[6] ) + # print(i) + assert len(i) >= 8 + self._buildAdaptor( i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7] ) ################################################################ @@ -1196,6 +1198,8 @@ rdesigneur.rmoogli.updateMoogliViewer() if len( comptlist ) == 0: raise BuildError( "validateChem: no compartment on: " + cpath ) + return True + ''' if len( comptlist ) == 1: return; @@ -1566,9 +1570,9 @@ class rstim( baseplot ): self.expr = expr def printme( self ): - print( "{}, {}, {}, {}, {}, {}, {}, {}, {}, {}".format( - self.elecpath, - self.geom_expr, self.relpath, self.field, self.expr ) ) + print( "{0}, {1}, {2}, {3}, {4}".format( + self.elecpath, self.geom_expr, self.relpath, self.field, self.expr + ) ) @staticmethod def convertArg( arg ): diff --git a/moose-core/python/rdesigneur/rdesigneurProtos.py b/moose-core/python/rdesigneur/rdesigneurProtos.py index 920caaba..c85687c5 100644 --- a/moose-core/python/rdesigneur/rdesigneurProtos.py +++ b/moose-core/python/rdesigneur/rdesigneurProtos.py @@ -49,13 +49,16 @@ import moose import math from moose import utils -EREST_ACT = -0.060 -ECA = 0.080 -EK = -0.075 -SOMA_A = 3.32e-9 -per_ms = 1e3 -PI = 3.14159265359 +EREST_ACT = -0.060 +ECA = 0.080 +EK = -0.075 +SOMA_A = 3.32e-9 +per_ms = 1e3 +PI = 3.14159265359 FaradayConst = 96485.3365 # Coulomb/mol +#CA_SCALE = 25000 # Ratio of Traub units to mM. 250::0.01 +CA_SCALE = 1.0 # I have now set sensible ranges in the KCA and KAHP + def make_HH_Na(name = 'HH_Na', parent='/library', vmin=-110e-3, vmax=50e-3, vdivs=3000): @@ -310,13 +313,17 @@ def make_Ca_conc( name ): # this was specified here in make_Ca_conc. #======================================================================== -# Tabulated Ca-dependent K AHP Channel +# Tabulated Ca-dependent K AHP Channel: Traub 1991 #======================================================================== # This is a tabchannel which gets the calcium concentration from Ca_conc # in order to calculate the activation of its Z gate. It is set up much # like the Ca channel, except that the A and B tables have values which are # functions of concentration, instead of voltage. +# Traub's original equation is min(0.2e-4 Xi, 0.01) which suggests a max +# of 500 for the Xi (calcium) in his system. For dendritic calcium say 10uM +# or 0.01 mM. Elsewhere we estimate that the ratio of Traub units to mM is +# 250:0.01. Using this ratio, we should have xmax = 0.02. def make_K_AHP( name ): if moose.exists( '/library/' + name ): @@ -330,7 +337,7 @@ def make_K_AHP( name ): K_AHP.Zpower = 1 zgate = moose.element( K_AHP.path + '/gateZ' ) - xmax = 500.0 + xmax = 0.02 # 20 micromolar. zgate.min = 0 zgate.max = xmax zgate.divs = 3000 @@ -339,7 +346,7 @@ def make_K_AHP( name ): dx = (zgate.max - zgate.min)/zgate.divs x = zgate.min for i in range( zgate.divs + 1 ): - zA[i] = min( 0.02 * CA_SCALE * x, 10 ) + zA[i] = min( 250.00 * CA_SCALE * x, 10 ) zB[i] = 1.0 x = x + dx @@ -403,13 +410,14 @@ def make_K_C( name ): xgate.tableB = xB # Create a table for the function of concentration, allowing a -# concentration range of 0 to 200, with 3000 divisions. This is done +# concentration range of 0 to 100 uM, with 3000 divisions. This is done # using the Z gate, which can receive a CONCEN message. By using # the "instant" flag, the A and B tables are evaluated as lookup tables, # rather than being used in a differential equation. zgate = moose.element( K_C.path + '/gateZ' ) zgate.min = 0.0 - xmax = 150.0 + xmax = 0.02 # Max Ca conc is likely to be 100 uM even in spine, but + # based on estimates above let's keep it at 20uM. zgate.max = xmax zgate.divs = 3000 zA = np.zeros( (zgate.divs + 1), dtype=float) @@ -418,8 +426,8 @@ def make_K_C( name ): x = zgate.min #CaScale = 100000.0 / 250.0e-3 for i in range( zgate.divs + 1 ): - zA[i] = min( 1000.0, x * CA_SCALE / (250 * xmax ) ) - zB[i] = 1000.0 + zA[i] = min( 1.0, x * CA_SCALE / xmax) + zB[i] = 1.0 x += dx zgate.tableA = zA zgate.tableB = zB @@ -449,6 +457,39 @@ def make_glu( name ): sh.synapse[0].weight = 1 return glu +#======================================================================== +# NMDAChan: NMDA receptor +#======================================================================== + +def make_NMDA( name ): + if moose.exists( '/library/' + name ): + return + NMDA = moose.NMDAChan( '/library/' + name ) + NMDA.Ek = 0.0 + NMDA.tau1 = 20.0e-3 + NMDA.tau2 = 20.0e-3 + NMDA.Gbar = 5 * SOMA_A + NMDA.CMg = 1.2 # [Mg]ext in mM + NMDA.KMg_A = 1.0/0.28 + NMDA.KMg_B = 1.0/62 + NMDA.temperature = 300 # Temperature in Kelvin. + NMDA.extCa = 1.5 # [Ca]ext in mM + NMDA.intCa = 0.00008 # [Ca]int in mM + NMDA.intCaScale = 1 # Scale factor from elec Ca units to mM + NMDA.intCaOffset = 0.00008 # Basal [Ca]int in mM + NMDA.condFraction = 0.02 # Fraction of conductance due to Ca + + addmsg1 = moose.Mstring( NMDA.path + '/addmsg1' ) + addmsg1.value = '. ICaOut ../Ca_conc current' + addmsg2 = moose.Mstring( NMDA.path + '/addmsg2' ) + addmsg2.value = '../Ca_conc concOut . assignIntCa' + + sh = moose.SimpleSynHandler( NMDA.path + '/sh' ) + moose.connect( sh, 'activationOut', NMDA, 'activation' ) + sh.numSynapses = 1 + sh.synapse[0].weight = 1 + return NMDA + #======================================================================== # SynChan: GABA receptor #======================================================================== diff --git a/moose-core/scheduling/CMakeLists.txt b/moose-core/scheduling/CMakeLists.txt index 52917a41..1d60f72f 100644 --- a/moose-core/scheduling/CMakeLists.txt +++ b/moose-core/scheduling/CMakeLists.txt @@ -1,5 +1,6 @@ +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) file(GLOB scheduling_SRC "*.cpp" ) - if(NOTIFY_PROGRESS) add_definitions("-DNOTIFY_PROGRESS") endif(NOTIFY_PROGRESS) @@ -9,7 +10,4 @@ if(PARALLELIZED_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/testScheduling.cpp b/moose-core/scheduling/testScheduling.cpp index 197bce0c..d904fb16 100644 --- a/moose-core/scheduling/testScheduling.cpp +++ b/moose-core/scheduling/testScheduling.cpp @@ -7,13 +7,13 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "testScheduling.h" #include "Clock.h" -#include "SparseMatrix.h" -#include "SparseMsg.h" -#include "SingleMsg.h" +#include "../basecode/SparseMatrix.h" +#include "../msg/SparseMsg.h" +#include "../msg/SingleMsg.h" #include "../builtins/Arith.h" #include "../shell/Shell.h" diff --git a/moose-core/setup.py b/moose-core/setup.py deleted file mode 100755 index 4d9d8284..00000000 --- a/moose-core/setup.py +++ /dev/null @@ -1,172 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import print_function - -"""setup.py: This -NOT COMPLETE. -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"] -__license__ = "GNU GPL" -__version__ = "1.0.0" -__maintainer__ = "Dilawar Singh" -__email__ = "dilawars@ncbs.res.in" -__status__ = "Development" - -import os -import sys -import shutil - -from setuptools import setup -from distutils.core import Command, Extension -from distutils.command.install import install as _install -from distutils.command.build import build as _build -from distutils.command.build_py import build_py as _build_py - - -import distutils.spawn as ds - -build_dir = 'buildMooseUsingCmake' -if not os.path.isdir(build_dir): - os.makedirs(build_dir) - -class BuildCommand(_build): - """This command builds """ - user_options = _build.user_options + [] - - def initialize_options(self): - self.cwd = os.getcwd() - self.build_base = '/tmp' - 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 - - def get_source_files(self): - return [] - - def run(self): - print("++ Building MOOSE") - os.chdir(self.new_dir) - try: - ds.spawn(['cmake', '..' ]) - ds.spawn(['make', '_moose']) - except ds.DistutilsExecError as e: - print("Can't build MOOSE") - print(e) - os.chdir(self.cwd) - sys.exit(-1) - os.chdir(self.cwd) - -class InstallCommand(_install): - user_options = _install.user_options + [ - ('single-version-externally-managed', None, '') - ] - - def initialize_options(self): - _install.initialize_options(self) - self.cwd = os.getcwd() - self.single_version_externally_managed = False - self.record = None - self.build_lib = None - - def finalize_options(self): - _install.finalize_options(self) - - def run(self): - self.new_dir = os.path.join(os.path.split(__file__)[0], build_dir) - os.chdir(self.new_dir) - try: - ds.spawn(['cmake', '..' ]) - ds.spawn(['make', '_moose']) - except ds.DistutilsExecError as e: - print("Can't build MOOSE") - print(e) - os.chdir(self.cwd) - sys.exit(-1) - os.chdir(self.cwd) - - print("++ Installing PyMOOSE") - self.new_dir = os.path.join(os.path.split(__file__)[0], 'python') - os.chdir(self.new_dir) - try: - ds.spawn(["python", "setup.cmake.py", "install"]) - except ds.DistutilsExecError as e: - print("Can't install PyMOOSE") - print(e) - os.chdir(self.cwd) - sys.exit(-1) - os.chdir(self.cwd) - -class BuildPyCommand(_build_py): - """Build PyMoose for distribution""" - user_options = _build_py.user_options + [ - ( 'build_lib', None, 'Build library' ) - ] - - def initialize_options(self): - self.data_files = [] - self.build_lib = '/tmp' - self.cwd = os.getcwd() - self.compiler = None - self.new_dir = os.path.join(os.path.split(__file__)[0], 'python') - - def finalize_options(self): - pass - - def run(self): - pass - -## -# @brief FUnction to read a file. -# -# @param fname Name of the file. -# -# @return A string content of the file. -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - -name = 'moose' -version = '3.0' -description = ( - 'MOOSE is the Multiscale Object-Oriented Simulation Environment. ' - 'It is the base and numerical core for large, detailed simulations ' - 'including Computational Neuroscience and Systems Biology.' ) -url = 'http://moose.ncbs.res.in/' - - -setup( - name = name - , version = version - , author = "Upinder Bhalla et. al." - , author_email = "bhalla@ncbs.res.in" - , maintainer = 'Dilawar Singh' - , maintainer_email = 'dilawars@ncbs.res.in' - , description = description - , license = "LGPL" - , url = url - , long_description = read('./README.md') - , ext_modules = [ - Extension('_moose', [ '*' ]) - ] - , cmdclass = { - 'install' : InstallCommand - , 'build_py' : BuildPyCommand - , 'build_ext' : BuildCommand - } - , require = [ 'python-qt4' ] - , keywords = "neural simulation" - , classifiers=[ - 'Intended Audience :: Science/Research', - 'Operating System :: Linux', - 'Programming Language :: Python', - 'Programming Language :: C++', - ] - ) diff --git a/moose-core/shell/CMakeLists.txt b/moose-core/shell/CMakeLists.txt index 5d5c661e..f77084a6 100644 --- a/moose-core/shell/CMakeLists.txt +++ b/moose-core/shell/CMakeLists.txt @@ -1,16 +1,26 @@ -include_directories(../basecode ../msg ) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) 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 + Shell.cpp + ShellCopy.cpp + ShellThreads.cpp + LoadModels.cpp + SaveModels.cpp + Neutral.cpp + Wildcard.cpp + testShell.cpp ) + +## version is set by top-level script ../CMakeLists.txt . +#if(NOT MOOSE_VERSION) +# set(MOOSE_VERSION "undefined") +#endif() +# +#set_target_properties(shell +# PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} -DMOOSE_VERSION=\"${MOOSE_VERSION}\" +# ) diff --git a/moose-core/shell/LoadModels.cpp b/moose-core/shell/LoadModels.cpp index 6d1bc04e..0dbe00f0 100644 --- a/moose-core/shell/LoadModels.cpp +++ b/moose-core/shell/LoadModels.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <fstream> -#include "header.h" +#include "../basecode/header.h" #include "Shell.h" #include "../utility/strutil.h" #include "../utility/Vec.h" diff --git a/moose-core/shell/Neutral.cpp b/moose-core/shell/Neutral.cpp index 9b5a2ecf..314ece6c 100644 --- a/moose-core/shell/Neutral.cpp +++ b/moose-core/shell/Neutral.cpp @@ -7,10 +7,10 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "Dinfo.h" -#include "ElementValueFinfo.h" -#include "LookupElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/Dinfo.h" +#include "../basecode/ElementValueFinfo.h" +#include "../basecode/LookupElementValueFinfo.h" #include "Shell.h" const Cinfo* Neutral::initCinfo() diff --git a/moose-core/shell/SaveModels.cpp b/moose-core/shell/SaveModels.cpp index a252b3f3..c5c0a295 100644 --- a/moose-core/shell/SaveModels.cpp +++ b/moose-core/shell/SaveModels.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <fstream> -#include "header.h" +#include "../basecode/header.h" #include "Shell.h" // Defined in kinetics/WriteKkit.cpp diff --git a/moose-core/shell/Shell.cpp b/moose-core/shell/Shell.cpp index e4b29463..aa7cc983 100644 --- a/moose-core/shell/Shell.cpp +++ b/moose-core/shell/Shell.cpp @@ -10,19 +10,18 @@ #include <string> #include <algorithm> -using namespace std; +#include "../basecode/header.h" +#include "../basecode/global.h" +#include "../basecode/Dinfo.h" +#include "../basecode/SparseMatrix.h" +#include "../msg/SingleMsg.h" +#include "../msg/DiagonalMsg.h" +#include "../msg/OneToOneMsg.h" +#include "../msg/OneToAllMsg.h" +#include "../msg/SparseMsg.h" -#include "header.h" -#include "global.h" -#include "SingleMsg.h" -#include "DiagonalMsg.h" -#include "OneToOneMsg.h" -#include "OneToAllMsg.h" -#include "SparseMatrix.h" -#include "SparseMsg.h" #include "Shell.h" -#include "Dinfo.h" #include "Wildcard.h" // Want to separate out this search path into the Makefile options @@ -609,7 +608,8 @@ ObjId Shell::doFind( const string& path ) const string Shell::doVersion() { - return MOOSE_VERSION; + string v = MOOSE_VERSION; + return v; } void Shell::setCwe( ObjId val ) diff --git a/moose-core/shell/Shell.h b/moose-core/shell/Shell.h index 1b2a7f45..40c36b3c 100644 --- a/moose-core/shell/Shell.h +++ b/moose-core/shell/Shell.h @@ -11,10 +11,8 @@ #define _SHELL_H #include <string> - using namespace std; - class DestFinfo; enum AssignmentType { SINGLE, VECTOR, REPEAT }; diff --git a/moose-core/shell/ShellCopy.cpp b/moose-core/shell/ShellCopy.cpp index 3788c474..a0eb29d8 100644 --- a/moose-core/shell/ShellCopy.cpp +++ b/moose-core/shell/ShellCopy.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "OneToAllMsg.h" +#include "../basecode/header.h" +#include "../msg/OneToAllMsg.h" #include "Shell.h" #include "../scheduling/Clock.h" diff --git a/moose-core/shell/ShellThreads.cpp b/moose-core/shell/ShellThreads.cpp index 76e3d027..03efacd2 100644 --- a/moose-core/shell/ShellThreads.cpp +++ b/moose-core/shell/ShellThreads.cpp @@ -14,9 +14,9 @@ #ifdef USE_MPI #include <mpi.h> #endif -#include "header.h" +#include "../basecode/header.h" #include "Shell.h" -#include "Dinfo.h" +#include "../basecode/Dinfo.h" #define USE_NODES 1 diff --git a/moose-core/shell/Wildcard.cpp b/moose-core/shell/Wildcard.cpp index 0ce0567a..9031759a 100644 --- a/moose-core/shell/Wildcard.cpp +++ b/moose-core/shell/Wildcard.cpp @@ -7,12 +7,10 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include <stdio.h> +#include "../basecode/header.h" #include "Neutral.h" #include "Shell.h" #include "Wildcard.h" -// #define NOINDEX (UINT_MAX - 2) static int wildcardRelativeFind( ObjId start, const vector< string >& path, unsigned int depth, vector< ObjId >& ret ); diff --git a/moose-core/shell/testShell.cpp b/moose-core/shell/testShell.cpp index 6a5e8d2a..4fe322e6 100644 --- a/moose-core/shell/testShell.cpp +++ b/moose-core/shell/testShell.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Shell.h" #ifdef USE_MPI #include <mpi.h> @@ -16,10 +16,10 @@ #include "../scheduling/testScheduling.h" #include "../builtins/Arith.h" -#include "SparseMatrix.h" -#include "SparseMsg.h" -#include "SingleMsg.h" -#include "OneToAllMsg.h" +#include "../basecode/SparseMatrix.h" +#include "../msg/SparseMsg.h" +#include "../msg/SingleMsg.h" +#include "../msg/OneToAllMsg.h" #include "Wildcard.h" const bool TEST_WARNING = false; diff --git a/moose-core/signeur/Adaptor.cpp b/moose-core/signeur/Adaptor.cpp index 91b2764e..48c11a8a 100644 --- a/moose-core/signeur/Adaptor.cpp +++ b/moose-core/signeur/Adaptor.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Adaptor.h" /** diff --git a/moose-core/signeur/CMakeLists.txt b/moose-core/signeur/CMakeLists.txt index 4479310f..09083dcf 100644 --- a/moose-core/signeur/CMakeLists.txt +++ b/moose-core/signeur/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.6) -include_directories(../basecode ../utility ../kinetics) +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) add_library(signeur Adaptor.cpp testSigNeur.cpp diff --git a/moose-core/synapse/CMakeLists.txt b/moose-core/synapse/CMakeLists.txt index f122eb4e..35c7f098 100644 --- a/moose-core/synapse/CMakeLists.txt +++ b/moose-core/synapse/CMakeLists.txt @@ -1,7 +1,5 @@ cmake_minimum_required(VERSION 2.8) - -include_directories( ../basecode ../utility ../kinetics) -include_directories( ../external/muparser/include/ ) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) set( SYNAPSE_SRCS GraupnerBrunel2012CaPlasticitySynHandler.cpp diff --git a/moose-core/synapse/STDPSynHandler.cpp b/moose-core/synapse/STDPSynHandler.cpp index a414913b..f7edf824 100644 --- a/moose-core/synapse/STDPSynHandler.cpp +++ b/moose-core/synapse/STDPSynHandler.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <queue> -#include "header.h" +#include "../basecode/header.h" #include "Synapse.h" #include "SynEvent.h" // only using the SynEvent class from this #include "SynHandlerBase.h" diff --git a/moose-core/synapse/STDPSynapse.cpp b/moose-core/synapse/STDPSynapse.cpp index 211c60ba..8a59e894 100644 --- a/moose-core/synapse/STDPSynapse.cpp +++ b/moose-core/synapse/STDPSynapse.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "SynHandlerBase.h" #include "Synapse.h" #include "STDPSynapse.h" diff --git a/moose-core/synapse/SeqSynHandler.cpp b/moose-core/synapse/SeqSynHandler.cpp index cb8bb0b6..7a0056dd 100644 --- a/moose-core/synapse/SeqSynHandler.cpp +++ b/moose-core/synapse/SeqSynHandler.cpp @@ -8,14 +8,14 @@ **********************************************************************/ #include <queue> -#include "global.h" -#include "header.h" +#include "../basecode/global.h" +#include "../basecode/header.h" #include "Synapse.h" #include "SynEvent.h" #include "SynHandlerBase.h" #include "RollingMatrix.h" #include "SeqSynHandler.h" -#include "muParser.h" +#include "../external/muparser/include/muParser.h" const Cinfo* SeqSynHandler::initCinfo() { diff --git a/moose-core/synapse/SimpleSynHandler.cpp b/moose-core/synapse/SimpleSynHandler.cpp index 51100cd2..4d6828bb 100644 --- a/moose-core/synapse/SimpleSynHandler.cpp +++ b/moose-core/synapse/SimpleSynHandler.cpp @@ -8,7 +8,7 @@ **********************************************************************/ #include <queue> -#include "header.h" +#include "../basecode/header.h" #include "Synapse.h" #include "SynEvent.h" #include "SynHandlerBase.h" diff --git a/moose-core/synapse/SynHandlerBase.cpp b/moose-core/synapse/SynHandlerBase.cpp index 6c325145..a7bffb04 100644 --- a/moose-core/synapse/SynHandlerBase.cpp +++ b/moose-core/synapse/SynHandlerBase.cpp @@ -7,7 +7,7 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Synapse.h" #include "SynHandlerBase.h" diff --git a/moose-core/synapse/Synapse.cpp b/moose-core/synapse/Synapse.cpp index 30c97b1b..6089a2a8 100644 --- a/moose-core/synapse/Synapse.cpp +++ b/moose-core/synapse/Synapse.cpp @@ -7,8 +7,8 @@ ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" -#include "ElementValueFinfo.h" +#include "../basecode/header.h" +#include "../basecode/ElementValueFinfo.h" #include "SynHandlerBase.h" #include "Synapse.h" 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 0045db3a..476e1c63 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 @@ -123,16 +123,6 @@ def behaH(A, B, V0, v): ''' return (A * np.exp((v-V0)/B) + 1) -def createChannel(species, path, **kwargs): - """Create a channel """ - if species == 'na': - return sodiumChannel( path, **kwargs) - elif species == 'ca': - channel.Xpower = 4 - else: - utils.dump("FATAL", "Unsupported channel type: {}".format(species)) - raise RuntimeError("Unsupported species of chanel") - def create_na_chan(parent='/library', name='na', vmin=-110e-3, vmax=50e-3, vdivs=3000): """Create a Hodhkin-Huxley Na channel under `parent`. diff --git a/moose-core/tests/python/abstrModelEqns9.py b/moose-core/tests/python/abstrModelEqns9.py index 208632e5..5745ff87 100644 --- a/moose-core/tests/python/abstrModelEqns9.py +++ b/moose-core/tests/python/abstrModelEqns9.py @@ -89,7 +89,7 @@ def makeChemProto( name, Aexpr, Bexpr, params ): return compt -def makeBis( args ): +def makeBis( args = None ): params = { 'k0a':0.1, # Constant 'k1a':-5.0, # Coeff for A @@ -124,7 +124,7 @@ def makeBis( args ): params ) return params -def makeFHN( args ): +def makeFHN( args = None ): params = { 'k_t':2.5, # Time-const. 'k_a':0.7, # Coeff1 @@ -160,7 +160,7 @@ def makeFHN( args ): return params -def makeNegFB( args ): +def makeNegFB( args = None ): params = { 'k1a':-0.1, # Coeff for decay of A, slow. 'k2a':-0.2, # Coeff for turnoff of A by B, medium. @@ -193,7 +193,7 @@ def makeNegFB( args ): return params # Was negFF2 in earlier versions of abstrModelEqns -def makeNegFF( args ): +def makeNegFF( args = None ): params = { 'k1a':-0.1, # Coeff for decay of A, slow. 'k2a':-0.01, # Coeff for turnoff of A by B, medium. @@ -237,5 +237,3 @@ if __name__ == '__main__': makeNegFB() print("Making Negative Feedforward models") makeNegFF() - - diff --git a/moose-core/tests/python/testXchan1.py b/moose-core/tests/python/testXchan1.py index c62f1427..d93b1b3e 100644 --- a/moose-core/tests/python/testXchan1.py +++ b/moose-core/tests/python/testXchan1.py @@ -27,8 +27,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose print( '[INFO ] Using moose from %s, %s' % (moose.__file__, moose.version()) ) import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXdiff1.py b/moose-core/tests/python/testXdiff1.py index 71b30993..0cec22d9 100644 --- a/moose-core/tests/python/testXdiff1.py +++ b/moose-core/tests/python/testXdiff1.py @@ -27,8 +27,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXenz1.py b/moose-core/tests/python/testXenz1.py index 80071aa5..75234a11 100644 --- a/moose-core/tests/python/testXenz1.py +++ b/moose-core/tests/python/testXenz1.py @@ -17,8 +17,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXreacs2.py b/moose-core/tests/python/testXreacs2.py index 1d5bed33..cee4e6b4 100644 --- a/moose-core/tests/python/testXreacs2.py +++ b/moose-core/tests/python/testXreacs2.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- import os -import matplotlib as mpl -import matplotlib.pyplot as plt mpl.rcParams['text.usetex'] = False import moose import numpy as np diff --git a/moose-core/tests/python/testXreacs3.py b/moose-core/tests/python/testXreacs3.py index fa99656f..a4d68029 100644 --- a/moose-core/tests/python/testXreacs3.py +++ b/moose-core/tests/python/testXreacs3.py @@ -22,8 +22,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXreacs4.py b/moose-core/tests/python/testXreacs4.py index d618e05c..ceb36096 100644 --- a/moose-core/tests/python/testXreacs4.py +++ b/moose-core/tests/python/testXreacs4.py @@ -11,8 +11,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXreacs4a.py b/moose-core/tests/python/testXreacs4a.py index 482c0dba..79f98ba6 100644 --- a/moose-core/tests/python/testXreacs4a.py +++ b/moose-core/tests/python/testXreacs4a.py @@ -11,8 +11,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXreacs5.py b/moose-core/tests/python/testXreacs5.py index 7012dd96..f011381e 100644 --- a/moose-core/tests/python/testXreacs5.py +++ b/moose-core/tests/python/testXreacs5.py @@ -11,8 +11,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXreacs5a.py b/moose-core/tests/python/testXreacs5a.py index 3d552f34..45e32743 100644 --- a/moose-core/tests/python/testXreacs5a.py +++ b/moose-core/tests/python/testXreacs5a.py @@ -11,8 +11,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXreacs6.py b/moose-core/tests/python/testXreacs6.py index 75bd905b..e491253d 100644 --- a/moose-core/tests/python/testXreacs6.py +++ b/moose-core/tests/python/testXreacs6.py @@ -11,8 +11,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXreacs7.py b/moose-core/tests/python/testXreacs7.py index 73008321..bb7d79a1 100644 --- a/moose-core/tests/python/testXreacs7.py +++ b/moose-core/tests/python/testXreacs7.py @@ -13,8 +13,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/testXreacs8.py b/moose-core/tests/python/testXreacs8.py index 0ae0dba9..bf5d28ed 100644 --- a/moose-core/tests/python/testXreacs8.py +++ b/moose-core/tests/python/testXreacs8.py @@ -22,8 +22,6 @@ import math import numpy as np -import matplotlib.pyplot as plt -import matplotlib.image as mpimg import moose import moose.fixXreacs as fixXreacs diff --git a/moose-core/tests/python/test_GraupnerBrunel2012_STDPfromCaPlasticity.py b/moose-core/tests/python/test_GraupnerBrunel2012_STDPfromCaPlasticity.py index 73aa8c9e..b01a3408 100644 --- a/moose-core/tests/python/test_GraupnerBrunel2012_STDPfromCaPlasticity.py +++ b/moose-core/tests/python/test_GraupnerBrunel2012_STDPfromCaPlasticity.py @@ -8,8 +8,6 @@ # NOTE: This script is used for testing random number generators on various # platform. This should not be used in any tutorial or scientific demo. -import matplotlib as mpl -mpl.use('Agg') import moose print( 'Using moose from %s' % moose.__file__ ) import numpy as np diff --git a/moose-core/tests/python/test_kkit.py b/moose-core/tests/python/test_kkit.py index 0b7c3758..e4b0336b 100644 --- a/moose-core/tests/python/test_kkit.py +++ b/moose-core/tests/python/test_kkit.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - import numpy import sys import os diff --git a/moose-core/tests/python/test_moose_attribs.py b/moose-core/tests/python/test_moose_attribs.py new file mode 100644 index 00000000..4d3d9770 --- /dev/null +++ b/moose-core/tests/python/test_moose_attribs.py @@ -0,0 +1,67 @@ +"""test_moose_attribs.py: + +""" + +__author__ = "Dilawar Singh" +__copyright__ = "Copyright 2017-, Dilawar Singh" +__version__ = "1.0.0" +__maintainer__ = "Dilawar Singh" +__email__ = "dilawars@ncbs.res.in" +__status__ = "Development" + +import sys +import os +import moose + +attribs = ['AdExIF', 'AdThreshIF', 'Adaptor', 'Annotator', 'Arith', 'BufPool', + 'CaConc', 'CaConcBase', 'ChanBase', 'ChemCompt', 'Cinfo', 'Clock', + 'Compartment', 'CompartmentBase', 'ConcChan', 'CplxEnzBase', 'CubeMesh', + 'CylMesh', 'DestField', 'DiagonalMsg', 'DifBuffer', 'DifBufferBase', + 'DifShell', 'DifShellBase', 'DiffAmp', 'Dsolve', 'ElementField', + 'EndoMesh', 'Enz', 'EnzBase', 'ExIF', 'Finfo', 'Func', 'Function', + 'GapJunction', 'GraupnerBrunel2012CaPlasticitySynHandler', 'Group', + 'Gsolve', 'HHChannel', 'HHChannel2D', 'HHChannelBase', 'HHGate', + 'HHGate2D', 'HSolve', 'INFINITE', 'IntFire', 'IntFireBase', 'Interpol', + 'Interpol2D', 'IzhIF', 'IzhikevichNrn', 'Ksolve', 'LIF', 'Leakage', + 'LookupField', 'MMPump', 'MMenz', 'MarkovChannel' , + # 'MarkovGslSolver', # This is GSL specific. + 'MarkovRateTable', 'MarkovSolver', 'MarkovSolverBase', 'MeshEntry', + 'MgBlock', 'Msg', 'Mstring', 'NMDAChan', 'Nernst', 'NeuroMesh', + 'Neuron', 'Neutral', 'OneToAllMsg', 'OneToOneDataIndexMsg', + 'OneToOneMsg', 'PIDController', 'Pool', 'PoolBase', + 'PostMaster', 'PsdMesh', 'PulseGen', 'PyRun', 'QIF', 'RC', 'RandSpike', + 'Reac', 'ReacBase', 'SBML', 'STDPSynHandler', 'STDPSynapse', + 'SeqSynHandler', 'Shell', 'SimpleSynHandler', 'SingleMsg', 'SparseMsg', + 'Species', 'SpikeGen', 'SpikeStats', 'Spine', 'SpineMesh', 'Stats', + 'SteadyState', 'StimulusTable', 'Stoich', 'Streamer', 'StringIO', + 'SymCompartment', 'SynChan', 'SynHandlerBase', 'Synapse', 'Table', + 'Table2', 'TableBase', 'TimeTable', 'VClamp', 'VERSION', 'Variable', + 'VectorTable', 'ZombieBufPool', 'ZombieCaConc', 'ZombieCompartment', + 'ZombieEnz', 'ZombieFunction', 'ZombieHHChannel', 'ZombieMMenz', + 'ZombiePool', 'ZombieReac', '_moose', + 'append_finfodocs', 'ce', 'chemMerge', + 'chemUtil', 'closing', 'connect', 'copy', 'delete', 'division', 'doc', + 'element', 'exists', 'finfotypes', 'fixXreacs', 'genesis', 'getCwe', + 'getField', 'getFieldDict', 'getFieldNames', 'getfielddoc', + 'getmoosedoc', 'isRunning', + 'known_types', 'le', 'listmsg', 'loadModel', 'melement', + 'mergeChemModel', 'moose', + 'mooseAddChemSolver', 'mooseDeleteChemSolver', 'mooseReadNML2', + 'mooseReadSBML', 'mooseWriteKkit', 'mooseWriteNML2', 'mooseWriteSBML', + 'moose_constants', 'moose_test', 'move', + 'nml2Import_', 'pager', 'print_utils', + 'pwe', 'pydoc', 'rand', 'reinit', + 'seed', 'sequence_types', 'setClock', 'setCwe', 'showfield', + 'showfields', 'showmsg', 'splitext', 'start', 'stop', 'syncDataHandler', + 'test', 'testSched', 'toUnicode', 'useClock', 'utils', 'vec', 'version', + 'warnings', 'wildcardFind'] + +def main(): + global attribs + for at in attribs: + assert hasattr( moose, at ), 'Attrib %s not found' % at + print( getattr(moose, at ) ) + +if __name__ == '__main__': + main() + diff --git a/moose-core/tests/python/test_muparser.py b/moose-core/tests/python/test_muparser.py index 205479f4..ca5c9da7 100644 --- a/moose-core/tests/python/test_muparser.py +++ b/moose-core/tests/python/test_muparser.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- - """test_muparser.py: - Modified from https://elifesciences.org/articles/25827 , Fig4.py - """ import sys import os diff --git a/moose-core/tests/python/test_neuroml2.py b/moose-core/tests/python/test_neuroml2.py index 541d7580..d1b34ea3 100644 --- a/moose-core/tests/python/test_neuroml2.py +++ b/moose-core/tests/python/test_neuroml2.py @@ -6,16 +6,8 @@ from __future__ import absolute_import, print_function, division -import moose -import moose.utils as mu -import sys -import os -import numpy as np - -SCRIPT_DIR = os.path.dirname( os.path.realpath( __file__ ) ) - # check if neuroml working properly. -# NOTE: This script does not work with python3 +# NOTE: This script does not work with python3 # See https://github.com/NeuroML/NeuroML2/issues/116 . If this bug is fixed then # remove this code block. import neuroml as nml @@ -23,9 +15,18 @@ a = nml.nml.nml.IonChannel() try: b = {a : 1 } except TypeError as e: - print( 'Failed due to https://github.com/NeuroML/NeuroML2/issues/116' ) + print( 'Failed due to https://github.com/NeuroML/NeuroML2/issues/116' ) quit( 0 ) +import moose +import moose.utils as mu +import sys +import os +import numpy as np + +SCRIPT_DIR = os.path.dirname( os.path.realpath( __file__ ) ) + + def run( nogui = True ): global SCRIPT_DIR filename = os.path.join(SCRIPT_DIR, 'test_files/passiveCell.nml' ) diff --git a/moose-core/tests/python/test_rdesigneur.py b/moose-core/tests/python/test_rdesigneur.py index c189bca6..46989c5f 100644 --- a/moose-core/tests/python/test_rdesigneur.py +++ b/moose-core/tests/python/test_rdesigneur.py @@ -10,9 +10,6 @@ __status__ = "Development" import sys import os -import matplotlib -matplotlib.use('Agg') -import matplotlib.pyplot as plt import numpy as np try: import rdesigneur as rd diff --git a/moose-core/tests/python/test_rdesigneur_random_syn_input.py b/moose-core/tests/python/test_rdesigneur_random_syn_input.py new file mode 100644 index 00000000..07c3ccb3 --- /dev/null +++ b/moose-core/tests/python/test_rdesigneur_random_syn_input.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +from __future__ import print_function, division + +# This example demonstrates random (Poisson) synaptic input to a cell. +# Copyright (C) Upinder S. Bhalla NCBS 2018 +# Released under the terms of the GNU Public License V3. No warranty. +# Changelog: +# Thursday 20 September 2018 09:53:27 AM IST +# - Turned into a test script. Dilawar Singh <dilawars@ncbs.res.in> + +import moose +import numpy as np + +moose.seed( 100 ) + +try: + import matplotlib +except Exception as e: + print( "[INFO ] matplotlib is not found. This test wont run." ) + quit() + +import rdesigneur as rd + +rdes = rd.rdesigneur( + cellProto = [['somaProto', 'soma', 20e-6, 200e-6]], + chanProto = [['make_glu()', 'glu']], + chanDistrib = [['glu', 'soma', 'Gbar', '1' ]], + stimList = [['soma', '0.5', 'glu', 'randsyn', '50' ]], + # Deliver stimulus to glu synapse on soma, at mean 50 Hz Poisson. + plotList = [['soma', '1', '.', 'Vm', 'Soma membrane potential']] +) +rdes.buildModel() +moose.reinit() +moose.start( 0.3 ) +tables = moose.wildcardFind( '/##[TYPE=Table]' ) +res = [ ] +for t in tables: + y = t.vector + u, s = np.mean(y), np.std(y) + res.append( (u,s) ) + + +# Got these values from version compiled on Sep 20, 2018 with moose.seed set to +# 100. +expected = [(-0.051218660048699974, 0.01028490481294165)] +assert np.isclose( expected, res, atol=1e-5).all(), "Expected %s, got %s" %(expected,res) diff --git a/moose-core/utility/Annotator.cpp b/moose-core/utility/Annotator.cpp index 8dca2186..4f1c51bd 100644 --- a/moose-core/utility/Annotator.cpp +++ b/moose-core/utility/Annotator.cpp @@ -6,7 +6,7 @@ ** GNU Lesser General Public License version 2.1 ** See the file COPYING.LIB for the full notice. **********************************************************************/ -#include "header.h" +#include "../basecode/header.h" #include "Annotator.h" const Cinfo* Annotator::initCinfo() diff --git a/moose-core/utility/CMakeLists.txt b/moose-core/utility/CMakeLists.txt index 67e180ed..5fcd5cee 100644 --- a/moose-core/utility/CMakeLists.txt +++ b/moose-core/utility/CMakeLists.txt @@ -1,3 +1,6 @@ +cmake_minimum_required(VERSION 2.8) +include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake) + IF(WITH_BOOST) include(CheckIncludeFiles) check_include_files( ${Boost_INCLUDE_DIRS}/boost/random/random_device.hpp @@ -5,8 +8,6 @@ check_include_files( ${Boost_INCLUDE_DIRS}/boost/random/random_device.hpp ) endif(WITH_BOOST) -include_directories(../msg) -include_directories(../basecode) add_library(utility strutil.cpp types.cpp diff --git a/moose-core/utility/cnpy.hpp b/moose-core/utility/cnpy.hpp index afbc0e71..b7148beb 100644 --- a/moose-core/utility/cnpy.hpp +++ b/moose-core/utility/cnpy.hpp @@ -38,7 +38,7 @@ #include <stdint.h> -#include "global.h" +#include "../basecode/global.h" #include "../utility/print_function.hpp" diff --git a/moose-core/utility/print_function.hpp b/moose-core/utility/print_function.hpp index 4b984d7c..c2cf0c7f 100644 --- a/moose-core/utility/print_function.hpp +++ b/moose-core/utility/print_function.hpp @@ -226,14 +226,13 @@ namespace moose { moose::__dump__(msg, moose::warning ); } - inline void showDebug( const string msg ) - { + inline void showDebug( const string msg ) + { #ifdef DISABLE_DEBUG - #else - moose::__dump__(msg, moose::debug ); + moose::__dump__(msg, moose::debug ); #endif - } + } inline void showError( string msg ) { diff --git a/moose-core/wheels/Dockerfile b/moose-core/wheels/Dockerfile deleted file mode 100644 index cec973ab..00000000 --- a/moose-core/wheels/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM quay.io/pypa/manylinux1_x86_64 -MAINTAINER Dilawar Singh <dilawar.s.rajput@gmail.com> - -# If you are behind proxy, uncomment the following lines with appropriate -# values. Otherwise comment them out. -ENV http_proxy http://proxy.ncbs.res.in:3128 -ENV https_proxy http://proxy.ncbs.res.in:3128 -ENV PATH=/usr/local/bin:$PATH - -RUN yum update -RUN yum install -y cmake28 && ln -sf /usr/bin/cmake28 /usr/bin/cmake -RUN yum install -y wget -RUN if [ ! -f /usr/local/lib/libgsl.a ]; then \ - wget --no-check-certificate ftp://ftp.gnu.org/gnu/gsl/gsl-2.4.tar.gz && \ - tar xvf gsl-2.4.tar.gz && cd gsl-2.4 && ./configure && make -j2 && \ - make install && cd; fi -RUN ./build_wheels.sh diff --git a/moose-core/wheels/build_wheels.sh b/moose-core/wheels/build_wheels.sh deleted file mode 100755 index 5509ea85..00000000 --- a/moose-core/wheels/build_wheels.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -set -e -set -x - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -MOOSE_SOURCE_DIR=/tmp/moose-core -# Clone git or update. -if [ ! -d $MOOSE_SOURCE_DIR ]; then - git clone -b wheels https://github.com/BhallaLab/moose-core --depth 10 $MOOSE_SOURCE_DIR -else - cd $MOOSE_SOURCE_DIR && git pull && git merge master -X theirs && cd - -fi - -# Try to link statically. -GSL_STATIC_LIBS="/usr/local/lib/libgsl.a;/usr/local/lib/libgslcblas.a" -CMAKE=/usr/bin/cmake28 - -WHEELHOUSE=$HOME/wheelhouse -mkdir -p $WHEELHOUSE -for PYDIR in /opt/python/cp27-cp27m/ /opt/python/cp34-cp34m/ /opt/python/cp36-cp36m/; do - PYVER=$(basename $PYDIR) - mkdir -p $PYVER - ( - cd $PYVER - echo "Building using $PYDIR in $PYVER" - PYTHON=$(ls $PYDIR/bin/python?.?) - $PYTHON -m pip install numpy - $CMAKE -DPYTHON_EXECUTABLE=$PYTHON \ - -DGSL_STATIC_LIBRARIES=$GSL_STATIC_LIBS \ - -DMOOSE_VERSION="3.2rc1" ${MOOSE_SOURCE_DIR} - make -j4 - - # Now build bdist_wheel - cd python - cp setup.cmake.py setup.py - $PYDIR/bin/pip wheel . -w $WHEELHOUSE - ) -done - -# now check the wheels. -for whl in $WHEELHOUSE/*.whl; do - #auditwheel repair "$whl" -w $WHEELHOUSE - auditwheel show "$whl" -done -ls -lh $WHEELHOUSE/*.whl -- GitLab