diff --git a/moose-core/.travis.yml b/moose-core/.travis.yml index 01188d6d9b71ef4bd491190ad1d7ac71c84e0d90..e69122259038e110c41ef471f75be1f04effb3c0 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 0000000000000000000000000000000000000000..91d39812d5bdea3fae8fe23682560fcb074df740 --- /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 814f6af5293a05be09313b8cbf01ed1ca4245dbc..7e947674b4f76968bd9ce53b24597bb0d6462161 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 0c0e604f3588ba294f8c86bcdf99142ca9e17884..37f5dd33ae01777ad31ef011a020cfa5c4e241d3 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 a71896f639068f44b6c42b11c73be926c7253a80..ec094e5877f7b3709101ccf45242d0240fff65d9 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 c6173acb709e6a64467a716f8c3039b838b9b129..b15205799ef3a5fb92556c1f0162735e09c74bb2 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 6e5ed75a7f0ca38b0fe1b561ee92a733fef38796..6d24f2632616a10256aa71adfa320c1c42d69f4a 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 d373cf71ba5711c167566a504bf34c9d5ad75d20..cbbe2eb2423c6fcc0fcbaec6de650a6c45c7c624 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 f3014fb21903c0c4447062336ee364245de6ee01..bb71ce251c84b919fb7d1c05f28e7c91fc0615aa 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 0a3b6d71c2ec3fea13e3c1773b173603e6266f7e..9d521c16df32e125bdb1069a9ed74298c845c529 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 cde0f33dc9292430bd7c23ec4b237cc28d54935e..dc194c0801d53ad76c801c9e560767677172e341 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 84b460a3018c31168e432707e34f5dd85036d9af..ab846b73b0e7d690ac8dc0d4196a0dc5745b53c9 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 a8e877411b01887e690e8d79ce87cc0061182321..370cb0001654f4c53758409154c4a1cb3addefc0 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 91444adae65cb960c3dd9dbf6330c2e498376d44..390117a92ef197fa278616c080578e54a8cc7c62 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 40f3bf2b7be1002cb77cfecb90f682cebfde56c7..91dd8fce018ce9b36ecdc5db6360fbd3f294d60d 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 f569cbaeb7651941e0fa53a7ad5d030514dcbca5..c95c386a86bc6f8687d3537391b405a9abd94da3 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 b483dbcb6bec2f8860856a3c2890bd9d9e14198b..02f2ba58266967bc0fad8e49f66292ea945a120a 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 124fe67f7e5bb337cc3dbf8d15b2f6c786f365e5..a65282e76e5d0d6e2317615bfd1ee22117365e04 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 795acb5a0950666cd24ac4c9427770104f2d0ce5..2085589cc6a9d0331449e8e6c85114f9807d2728 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 88940dc45edd89e8e849434b7aef787bb38b9c00..e1c70eba9eab89fad2f20d79323803fcf028bab1 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 7e34e8a57c10748cb49a82a5b80da79bd6cabd21..04e170f057f34e4691f0ab7942831688940e2697 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 1be36d79e2b1aeae6fbe98fe0cae9109eaaa554f..6e5bd8ae12bae54f9815c9a50b6e7efda99b9d02 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 c094d8c40b28057d62b9891495ee00e948991635..c24c9658866d63a0941ba9b75d44cc6a4ee8af2a 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 d6b6ed208f03b6157fc126a25bc7c883d6c47f7c..9742d839cc2a481ead7c7a801f0063a5b6f05889 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 d7d8876808e91df5d5445b157ffe040354e99478..cfdda6c3e414b5c50da1055e3b17ece392ddf78b 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 87453e97dfaef588e066c3d3fdb2ab9e769c7e00..e7c72b5ad1f7ec397b17b2f74a669872541f03b3 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 f937f692219291400320762f610058ab65dc73b1..d0d2cf02d1f46e8c0cfb58c6831cef2c3f5f7a64 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 147bb6e89bf092be1599226fc6da449ea823335b..9181338005971bbfffe5413fba5d612d11b90740 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 64140728b17fc9a439e2182c858c12afaa9f30b1..0e8ca5841a37cf2603dc1c20c4c02cc31478c06b 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 e0628095fc5902ef11eb9cbc01b8cad5337ec441..c3c88138eaad659f6756e9741e43857f39e78d59 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 990e62d751abdec03d780e19795dc9929d6ef5ae..04acbd29ec957cd794cdfbf510f2027facc6ceda 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 0a8ac0ed885af0f659982d0f42437278dbf0c8a0..89f78696af252b64e3e8971a75890e4e876658c0 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 b3bf9b71a1ee11cb6278c545e67183f784ed1f85..bd52d20f33cf4d848ae8ee16e92494c489f40818 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 e6c0dd768a1e8098c0fb05a97c41ae56480054af..8c4e7423155143ad06e84a3f7c45359fc9b560cb 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 ab601ca8df7ea245d9118d1b4fb0854e35eff306..a79b17b49b15dc0db5f26ed7cb89fe3bc5959ff1 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 0260215a7ee77b484a2a390297afe709c27619d6..ca90e7a3a312a19c3a87d053ef0c1297801d7247 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 12dbe32fcdc36d041485180ee5e2ff9bd37d0891..5bcaf532bc8a4e67783c96f214d4f59083ca0ca7 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 0c87795063770e5675cb0cef6e15e0190e98fef6..3f1a0e006ef0be354e496f1a1f6d4ba94c03248a 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 bcf5ccf46b24676a4da06ce6a837382c2142a12e..6d57f1fca7eda28a2fdcc9a3f09c5c66bec905f2 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 f0f478c3540243630216e0efe34a3c5f65bd24ef..d251cf548d5a28c27919696ab932a964ae4e2e62 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 a070e7aa837780f3b72b5997bbd66c3a4787793c..ace49df145ab563ece4e54d2dd43a74f5d3a8a2e 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 7699ab16b99646c41b77b2adec55a41c764cb169..1544d7307667e7e52ead0b91eebecdcf0cfd1df6 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 3ffb36ae05ad13ac3d7459cef8d6dbbc76bd4b81..01104201b1380eac88d133c0304d8a8e04883efe 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 3fbab6d0a237cd878e4874e1accd3046cf403c61..15ec8e60ec4b4ffcc82a852f3b3c5985ecc8d518 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 2a35b98c4a7a1dd091d024abe3118a9215d8fd9c..d900e5a34475822b9564113a226d1628cb70c527 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 22cc98c87e26dafbc94de8a2789e6a8fea43516f..9329ed51e1d791844173e010e3f6d8484dfc644d 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 dad122603bbd30c03465106519b4db1c0125742f..3fe048099c1dacbe9ea38c240eafc1da1cb3b96a 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 03ca6eacab84e0f3a1b7d48137c301ead12b80c3..d3da2e1a59b22a06c17abceb11c5accd0b4f1496 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 11d2a07f25794060985b85780b6298a0fd72ed20..b71df59bad24faf55925e97a41ca5d208460a576 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 4fd207c5d00c02ca8be72d4bdd369cf1175653eb..4ce9a3b77046afe6b19add7bbcb7fa40b80060e3 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 b28218d5261621b28f143addbc0ddbee50728389..cd0760ffd580565f2f2821e3e43ed02b4b379dca 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 ef66a92637ff4a35df102765f24d10cf55928569..cbb8c96db2a677d41f4a8f960e55b480f4ed0773 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 ae5166bfe2400e0321a614c57804be120bc4b420..6e091ecd7cf85fae94aab3d6807a668ed32b6f20 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 64caa56166ed0465785cbedccc1ed120619a6ead..9c2260113e0160cec1e5f827f1d36f2bf3c3a17c 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 c8c6624dc4d90350a781c6b8e64cd35d71b912a7..7408ded33a96726bbfc167c4ce2ae1f3a412a487 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 9c2ee784f574c88d410e06a3db7352c473b1b35e..4ca6d097e4ec971fdac439556e94fbec965a8eb4 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 8c82c64b0b8adca169b6d956971e7d12a0d683fe..3883b699a618a7b2b1e26dcb0dd45cd6b3c7fc03 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 8f50957bf7dcb335d96daac26364d246775a36ee..6a9fff3f0ebd8f2cfac2456f50ef9808f0e5a890 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 2a0db02ffe9e24a89e3e4da7d1ddbb0b3a2f1fd9..b15cb223d9f44835f274e84cd71935807064f299 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 ee84e447bbf942f0f8756dabf3074111fa1de26d..b7443ab807c2f53902d7773713bfcb88115c0187 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 de5b6a6d7e84ab701ab9a32fe0e3a531ef09de54..a35fe86a59d7cced8a9ff66ec623f2bbcdcef505 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 3b3e2068b39ef88e1f34f0dd1c06f36729ce8b16..f19b805e1a438daa1150c81928f917dfb1b43857 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 544d843f044c53d1a389c492f72e3b5007fefe46..24c5a429a84f57c2953f3d4eb2a6638955373a77 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 cc2f94b35133fe5ef5cd3a255f52663897630cf9..5c1ab3ab9febe0a693e0f4a5211c021f9695337a 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 00b442f78f6f248c63135d6dc4b4391c22b2d28a..c5068fdb29896b029c2dcd9fd513d325fcb65e96 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 dd9c0bf2f1ab213981d4f64b737d047bfee96275..5ecde62108ae1d59ee861868eedd83818ae4275e 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 be264dd03f00da5178db28c10a285b8be160c0d7..cb436b99a6926110b2f5a6073a801de40e5e705c 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 c82c6a8d145ff1c16bcd9d928334263bd1dca54d..f5a6b7710e336958109d44dfb1e51d7e4ff724fd 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 f5c11e754d02f955b779e7611bf8ef30d2aec35d..e4467c6f0be8b4f70e169ce2457fa05d14b04e9a 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 d2ebdb8051e849cb2eaa41cd6dcab0a2728d9597..ec9a7bf29b7c35ecbcd2ef44f78de183d8dc86ca 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 bfeb69954692e097078ee6fbe5b082f90ed72838..6233e24853dba9217b6a1a96c0538e059732688f 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 4c05470ae1bcc4e7b859b0ee9d7974890595bb38..d94f4ecf772dbd67ed31e6e458176ca94f2946f6 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 564ae44c3764a8e95c5f0eae832e3d4c82a45dfb..01b5bc9b2c998ab16baf9a4146fe2995f4aef784 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 20a10af5d63f06ba08b32b13a15180a3fef6ff8f..b98a498132d4ae68922523652934f7e9f89df3eb 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 b084c506729e00b09f760c8440df7702d2765448..95c1ebf0fdecf799a88a7c235db02254db015021 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 d8a9208dcc779ae82ff63783bc86a40be4c17f05..536d7dd737a48f9354f381661a7231db859699dd 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 c1428146e640c75d4ad6fe57ecffbe39b412cd6b..b90fbc267e6d419b04b912ca5070af8919436df0 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 9e4eb675ffd734802186728e693dba0799662777..35b56b101bb3a0a882799f118d20dca6ddf06086 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 f887cff1d966d407389c7dde0c1ceead895e0bd7..b4ad417044feb5874cd2a2d24828813b7215c595 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 b1b3231ffc2792ef2b4d3b390e77f4540943b955..d3a64a165c868b77bdb95d959f87f26a83a2da06 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 761bb4f7bd7d06c01aad24cb6989871c71453a07..2554e468b08735cc5c93557c3db85b91a376d95a 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 9f9609f887fd8612f763088cb56cb3c1f2ec6fdf..5f083b289a67e89bfe60d351493b798f9907c69b 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 e643506d098525bec27daaae72d8534a6dd95787..1d3ff68384577d98863acf48a868915d03703e04 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 a4a678e26e6f6bf8a4ab1addc49cbbd7cd43c446..653cd44ab19aa43d09c1f944acb5bafdc3861457 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 4d89e6f78ef0e29e392653f7637df9d87a0c963f..65a1f314e20c1c8a203a0bb09d7a51c91b368e56 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 66c59eea690d4eafaebeb32fa481be0594f66fbe..0000000000000000000000000000000000000000 --- 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 fa6f6ad1be43b56b8b92ceee94d9e31f4c7e315d..0000000000000000000000000000000000000000 --- 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 427efb30802036d1d5a57baddda81de045fbde33..f3d6c4eb63261f28d123c55d4f7f7693fe6859c2 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 6a6eeb8d3f1920fb384811c065a624d167c34a1b..ac8115840821c50a470657e6b919d74b1e005dbe 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 7f3cc36b0481effeef6071917d0b22e21f69e97f..5d04a7775fc8d7eff00e38d0f20f411f32a6f2fc 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 bbe70662fea71dedb177b0584797c8023b9c3bfd..662c4cc80f5b9eac11258b2c8257568f0928810d 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 5a8e8e3ca4dbb6181eb0070c22278c0e2d2c3fff..548646dd96a1af2b32c07d4390b39cbe795e887c 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 11daa9e5f0578428606facd6346159cb7c61d6b1..ce40817c3dda819ad0362eca30a69191a56e231d 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 47b12009c3949395e1774ab955360ed3f9682c67..66d51dbf2a863765a7f99850b9aa8cce18d7b536 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 e7d18d2c4a35a91f2a4735ce92e50aafd99ad35c..5e55f5bce5a9941b0809575cd8ccf3f7fb3728dc 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 507b602ca06b4e6170c5894535529a61eb03db33..e4ef5ca4ccdcb03f4fdfb6ca14a7258be7d6134f 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 756a2eaab05b85122d3cfeaa57b4beeb69615b54..98bdf41c1ac0b422a09a04634744766d083bd0bc 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 f9fddfa5dd92ee119e8fb48846bfdfb41cdd34cf..8b714bd41a0fa50e9a4c9ac21d117593ba4663de 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 064f45116a49db2bc843717a89c2a1439f2c25ac..a580546038fa0fc4aa5e87495653c4535770d185 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 06435a8e055245679563e08a99a360d05b3cddd6..5bbddab9a620ab94ec8b6e5d8df14c3adb95c3ec 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 dcde4431d0441eaa71427d6774e4a7088022003a..65c1db046979600c46e3024ac897dfef158d8f10 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 6359727ed6b79c207cd9a8149129da822bb5a59a..15ce57ae0ed408742c161005a3c20930b6d98e0d 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 62e4a85fe49e20d500b422765e8b6eef8beec2b7..c3c4850f4458a4a5b472c486be7145a91485efed 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 ed1a15bbff977276a2b3039c0b8f6030eff17a7c..9e9ddf90ead709ec1127c0bee5990861c743b4b8 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 b836312c7e44d67aacfddbcdca578517b42a6f75..cdd8315d814d84aa644bb2c542dac968bcdca87b 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 6217084580e80802edc8b61af191ddb5bee74b6a..6edc743159711b5b4b8fc034e080400aa05cf2fb 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 361f672fff1616d1c890107d59be25e59a5ba6ca..36e235916a7fcbfebe2711bbbf676c982857f517 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 f41d109ad984d7cde9275d8fea19338147e2d1ee..358ab90656dedd56326de25fdac322d46a946253 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 0812374c50886a4fe10587186fda234f54eca9d3..689820166841ca74e5c50f841567238c70e3d3f1 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 cd03b00fa5655e1c1a32c95ce15820fdfdd433d4..af24152e23002ad626ae1be3e19f9e35851399f0 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 b00153f4198897008e089b7b00109bee0c13cfc8..bff5f02689f3e9cb871627e3b4a54cdc545bc71e 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 7e3bc72dc68b069990837650019cc34b88f8c0a0..02de9aed1370bc069c4a4b304408b9584ca76aa8 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 0d3273d12d0d729f558a6bdbed39c4428418146a..2ce128bd47a16b3dc203b1f09cf4c6c284a90991 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 86b1f3f036b24455d2d2f6ee9a48d0ea19448d19..ac60d9e44681f5a8044a6775ae730779f62eb140 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 1a2e0776494a67175496e71e68a5004ddc6b2ace..0b3824643f39d5650183ed4342d22a09942533f9 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 1d579f9f7222ba4658b296254cb1966bd6d9c990..8229f752bd203d5774d3e449c0a9c4334713c668 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 3c3bc890afa1dbac1f5022bfc457ad1eefcbce52..0091787857f607696be68b0c0bcfac7ae377fb66 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 84f9ebf925d0a6bf9a00f91039994a733454bd0e..e0457b6b33c5bc4b2ce76c08309ff381da2d53ce 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 b63e099c80be968979708a733e550dda6ebf54d0..b1252a2257f7d6c2469caeb0c4835b295d74cf86 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 c43875a011951603ac3e865e9b73ccac7b9f279f..f5124aab4ce889bb72bd829c759c7b33d6248af8 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 1ca12021d767234f94dc4e280ef65fd1e2068bf3..c8690071379ac127444a64d4dd7064af889959f7 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 ccf2dcd1884d6c655549d7a047f508c8cc0c4ba1..fe735278adad1f6ba3c1feec04023df5fa313ec7 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 d99dd12a322b88b4129d544a491bc36c08586ae4..332005a696dbabebf08f98d0a60b46c62548450a 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 ae725120a3e8608dc495d0663356753632c6d463..a12d693e86eb89ca71a496d4629075ea3fb04b76 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 1b1c1d31e23e1ec85726fe71f1701db83930ca63..0ff7676b840924c27b238222d903a6e73b55748d 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 532507116108c32782470c38ef23aa0aff227cff..66f6ae33a869b03b68fb3d4f7b4e30967c562251 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 3cd9d9022bc419096a5c75ec90491f2e9a145b13..62959a2a31054298d017972fe535b2f510c44dd2 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 53f5a1731621c21ded74935276779e2aa968c671..dd797fd3f248ba09288b665ce083a25fbb80fe12 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 f0261245c61cb6ae7f3466519a149d05eba17065..6a35f477fa9abdaf0cc9faa749afbf2ba85ba8aa 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 826655299061397f79ccd60177a83c4310831960..a0fb2df51342bf64662d93eeaca2df73e1ff70f2 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 e73c27acc30fc776603ee8ea71fb61a19499494f..4c06cf0e6b54799bebc58d2a98dd0e2d9f212695 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 9e184961801f2945272346a2121e930ea46b7526..48a218990b6dffe3be174bb49c7e3a143389c70f 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 dc400897603a9fcf9414690b40df04234846d0e4..0eeaef1a5f04a2a79f875e82237da19d2a147be8 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 6d612c8332bdbc6e1bae085238874ed2f5b81456..b1e3af869c0683234ba8aa9602753bf771aa10b0 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 1df99ae25d9cfeacedc93bec5d2e27cc7a4e1571..62a50f9f13058ba0378d572bcfdd612ec6c6032a 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 c12f30b89aa3a535084e0e4b50ae6da4fd76ba74..55a0088773671529660bdacec572f6cd0f4a198e 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 6f0275ffa6d6ba4bfeec2fea5afec784a7e646d2..64ae8db71ebe0f9846643d25352757901dcaacc4 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 a04e31ddec7611a56febe8af1f51661d86ea6bcd..bbeb98c359db152b96500604c68e691cfb771088 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 1d2b3f7f289a3c1bd4399bf32115170612540198..b8961f1d9a8b968ced95b0565269a000f5209cdb 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 728c69ba095b1176e9d731be2a9f70f69f50c6a6..d50507437ff4d32d50aea6d83d4d48efeb67c3de 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 a4d8d6bb8b8d7a37387dad35c2ddddfc45bd5c4c..209977db25be38f9a9fc931464ffd2900c21c8cd 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 9fc8352efc126290cf597757b79297428acaa39c..e0057529e42134e4eb5a445372f958caecfa9e84 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 33c13bdbb4c6c7aa9ccb2d6d09e8eb5d05b0307d..7902e3bded47f9e28f2473eeadbfed264d647fc8 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 5b46bd6aee2f7864d1f433bebca6d133a0af8841..8e4186d32775ada42982d73863eb0f5e36e90782 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 88d95b7518d7f91cc2e777bf0c05a59a9e3aca23..3388e3fa435418c5868d0f3221c3e62d243f14be 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 cb0ccc56a4ef31529ccafee18ddbcae3cc541c53..5e5e82f48db9652207c8aaad0868966d579a2930 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 9610227b2308ada7650fd9cb00e2ad9853b4cf50..0cfc583d63a8aed4de38aa54140e2dc785e6b351 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 da23aebbf6f3a23a930077aff6f8175a767ea2f1..75e8e2ed041e1ea287aa40182dbd40d3fe641ed5 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 c2d01652a737dfd5ea4d923cf31902081cab710a..f9e3a918605482de9f662ffa451248dee27e058b 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 4fca087264fe7e29ee46db92010529ffd8df98a6..a14dfbc21659a77ec28d5513b5ea5b546fb5fcad 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 2ab6f067201d11d79a6548035aa53b68e4510cb3..0446a8f0c09bff3ba1a6499346b74909388e926e 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 a3617266891346eb3c2ecaefd67d39fffaec2bad..02006208cf41ec1b4b21677173d7d9b701c51d5f 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 194fdfd4f45968228ae9317ba292dcf607a96ea6..85760dc2fffb7dc37788fba26646c55d9af44cad 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 9b5d6bc3720122870e46ed714f578db2635a0878..d7209e19552129190840ee407876ee1781fe215d 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 cc1fa5426c7948ac78a6d4790a139eacbda805ee..4ff6d581f8df583c0f9afcd4ceb764bbe5de2f2e 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 5d5a3a793ded3a9e3da5816eeb54f65d7d78db7e..f260365224c18cfcb1a0f423f7ac3d64ba46adbe 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 262e0494a4caa080632a7850ba2399900a7c9267..96cd82088a8a2f2871c268baceb2820e06596612 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 d26f82e953bc2156ab669c16a3423c4893932129..42b20da17572bd0d1c779e306090403f6857f062 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 e1625eae02cf8882a39aba35a8865a796600bc57..d36720dd6130e7f41b883d0f71441f8565a8d106 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 c8ba6f001d952beb817fbf2e019e1b5f6230d2d8..fd02beb357d52705d750e99e7c292dbd32201b64 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 90d7fae58bebf6026f32efbc3b2aecbc9bcb670a..a8fa0f6df485aadd27dee78c3c44aa1b28d422c4 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 0a2a63885dbdac0e565d37df2e5fa49cdfa3f135..22f4613e8e599a934e1d9a4850c96bbbb5961e66 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 cf7e171642da148f9ac792e0dd03a11009a47919..3f217842c6883e264584effe3aa724e11a59aa32 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 e9670fa175949a8cb00b747ebad0e010cf03b3c8..48facdf07440d16e2dcb37fbdad470506c4d9c3f 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 8124611b4802e3f1b27ff2af7115e45371ae174d..ec9d357f24443cb458957c06ebb66f452c5b2efb 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 ceec0ffd1925bac30f0d3222c36bef78d7bccefb..407b6950d8246916d0178f6962a7f28bcae4c51c 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 d3d800582fd3428c253ce0fed2716b64889b18d7..6b37ae44d5665752dc1776de9cfeb3e560984717 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 f4cbccbc3e6228e6fd66177282ad52659b24e43d..bbb18ed55eee94434adf5dde60d64db7ccdb5086 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 de7bec638be4fcdc85b03f7598fc8758a5706479..7009390f3f6b107bb6985118cdad876968140ac7 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 f6bba42b84394f8963b31d97240a88679f453f8c..8fc6356902f2a4e07f5ecb586f34327d08a6b06c 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 3d1fd80adf6ffa766e5e03f056c6d929f256978c..bae192686cdcb75065053738125e44646bc07277 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 e6cf9bf7671de4bcf81dca56a7df495357dd09b5..069d43b9990f019dbcce29d3adc493d1b75d8ff6 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 cc2c44437609d793bb0634f75632db66b0127c54..73ded19ce84527d6360c09f4a8602a044e64bd72 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 14ae5f53598e34a5ce1ef96ea44d74f83bcaf2eb..1bbf54c1714d778cf06a71a517ab5d83b5e99050 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 5d9d8edf4799f6947ca1e97d6720d525e59528b3..e63fbb4eb4df8a75d1be1fe28c4db6568e25aa37 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 37dc7307faf57a4d8f8b6d5b0811b8ab51149e13..0000000000000000000000000000000000000000 --- 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 c4eb339139598f18082dd75fc37be59874e0c83d..e82effda29bfa7cd1a863f461ee5e9c6f726ceee 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 75c9a7f277d67889bb381180f4fa4044e4fbc0a7..6a9dec0fafb5d0574cfa7e196ae7b5a35d7c90fa 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 a95e2a29d5c3df18e2e826bcdcaf248c904a93a4..81d535f1eb5793bed53df430845179c3d2901f1d 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 61e18afc8d73e2214e252cc45d60b8aa2e86799e..fb92841dedcf4128576a26cc2235ff6e2ddc3d51 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 9b309e46e92fcee319b4084ae019b27b19b3dc22..a680dbbe89256ea6b8fe46d4e374633b70cffe85 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 8dbec98ab95916431cafe3e5efd3b0fc9630dd01..64fdee8be38591246e6162cce2c658bce0a1b527 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 447faa110d3b6f9469e9f1719f33bd785ab8d33a..492cb1802c31b6b614351578bceb0bcf58a50944 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 920caabaa6ce0a2eb8c1717f19b019e69006fd60..c85687c5fbe0611b97339e942c274b9f808a8cae 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 52917a415d8cefc111a7e298405cf6fcd015dd5d..1d60f72f95c97e6418167f33637ab7ab6077e506 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 197bce0c5f2bb819d9b4970b89c9d8ef71e43214..d904fb16808a604dc2f207d35a8bb3c627bd2b37 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 4d9d8284a8bc92b5d871bfc82fa0e034d60a238e..0000000000000000000000000000000000000000 --- 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 5d5c661ee7d9d7c2110c0926251a64b86f9a2ef9..f77084a6f4b876e9a27cde8a4e45240ea4435061 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 6d1bc04e4662449c668e7c6434b28af7081e6934..0dbe00f059b0cbfb08703608c487890315de4f74 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 9b5a2ecff69ed7fb315f9fd088654084555d142f..314ece6cbf85b785178dfabd7d7c59b868948f93 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 a252b3f38d3b138f994625312ddcc4a5afc75e92..c5c0a295b479e8b7c0eefed36af97cf39bd8d875 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 e4b2946350516eaa7dd4cc2ea8e6e7244062d820..aa7cc9831ef67209ae02853fddc9b5a5eba4ab87 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 1b2a7f45a57173b46a528e0d65627415dd0c9056..40c36b3c36c71aaa289317f2bf86f84513bb8d43 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 3788c474f436357a16d4640dadaf3bc2d2b9d8c8..a0eb29d87e17bfb08234ee0e7ecde8032c6ac91f 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 76e3d0275a67cccbfd8e37a634b4abbca341c54a..03efacd2d0ad713d84fd0912ec2e98e247f85a9f 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 0ce0567a4896e94c438810c26a0fc10d16bc998b..9031759ac6484d1fd8c76956f9726f88f361ed86 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 6a5e8d2a6afeae41b97eabb4a864a9a0d26d33c5..4fe322e6de7dc5078a199576288f1ed5891d2e18 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 91b2764ed7a1d042909e1ff9448cfd228a4c36cc..48c11a8a781f8f384573bff574eb8b1b42f0fad3 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 4479310f846e286393e644fa2b4b4a961a8c2b82..09083dcf247fff62460d03d4a1104f7f4cc7a323 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 f122eb4ee46b1a8b2706d5aad1deedad18d9a6e0..35c7f098c8a90e3d11a930708f4d788747c043c2 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 a414913b23b3d41d605158671d53c2a3fc0b53a6..f7edf824e1f54b642c6b067f1d1cc220ad9ad775 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 211c60bac362f14d52bec754fc8586dd378b1d7b..8a59e8943836c5b0cbee7ed5b599017459dc9e44 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 cb8bb0b69f0670f156fb70bf9525cec45590b62b..7a0056dd94bb5ee8b7b0e12d8abb625fdfad1e99 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 51100cd28bd0a3badb3ca8476356fa5e3ece8cfc..4d6828bb58babfb3a458a629e975bdd55116a234 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 6c3251456f1b369cc2ca191505b586b9d0e3da70..a7bffb0413d54b0428a673748298f21eb9dcb475 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 30c97b1b8021622966b72b3320602e76dfdeb1dd..6089a2a80195bedbed9827a5a2a0378ba2a81007 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 0045db3ae40259f9dfa3f99e3541c8ae4934aaa7..476e1c63f8c3363fa6c695e32f945d69072900aa 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 208632e59eacb35e211cc1dee14e13b35b8f8c68..5745ff87028fc1801c37655599634e688702a1e5 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 c62f1427307b54c771830e8b889a971cf9edf2da..d93b1b3e4482d661fa54eb0dea023f50b67e043c 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 71b309930cec00eb0430f3ef5d15d3890f221758..0cec22d9120681dc5843f65c01001708d290bd24 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 80071aa53c89a6c37b3215f58dc2ed9458a103a5..75234a11b4a69ef2a8d1b5ede3162841ea9c0081 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 1d5bed338b9c3f5e18583eea84612207f4ea3907..cee4e6b42456ddf0218642ed64fed6c8669a3315 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 fa99656f10af9b8f7347bc3e3b21ff36d2f6aed8..a4d68029d46744a30697ea9dfaacab9fc941efc4 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 d618e05c252ec5e08d4c4ba89799172d3b0a76ef..ceb36096dbe575342054cf1edbe007c0526719de 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 482c0dba721eb22b940c28adc7ce5753300a9a6b..79f98ba6c77023b1b045341df0403370d3370a31 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 7012dd96b4f9ba4dd7d6cc285c69c65ec0130e42..f011381ee21e9618904f977f9d7098642ed071d5 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 3d552f345c8763eef8297026f7622445740f58d9..45e32743ac0a752871bb3e267f5e1a920c23ef7a 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 75bd905bfe984ff4f8ce3f666075a8f78e948fd2..e491253d7f2bda43970bde47d8fe8b85f18db979 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 73008321b1c7f3b98614df5b3cf241896ae75e2e..bb7d79a1bee77d3fb74eb5308bb8f4e12e90f6e2 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 0ae0dba9dd9c6da23a6b9d241310a1e7e214de8b..bf5d28ed166f1159d548deac95bb23c7ea2a11d6 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 73aa8c9e50367b711761d7c0aa4b08d8569195df..b01a340875229cdb9eb6d3eda2363868260059b6 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 0b7c37583ace6fbd5c61d8425dad5e69314a8f43..e4b0336bcb824575d8267fe08ea48267a281bc31 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 0000000000000000000000000000000000000000..4d3d97702aa3ffc97c6b72948b82c6d02914cd81 --- /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 205479f44a1726fe88f128d86f74c132b75c168a..ca5c9da7ee2c81725ba865ffb0edb15f77a32f3e 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 541d75806ae342d0129c9fe1637223bbf1776d73..d1b34ea3c0face119246d40f90b244435a8d1732 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 c189bca6447d4c225a0b050b92b6c81c5a8f47e7..46989c5f7352933f6570538a3f8245ae3fdcfe92 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 0000000000000000000000000000000000000000..07c3ccb3387fec3b9cd71483f7939dcee2d66e07 --- /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 8dca2186f3cce73ad9db840ba7661c6e04f608ac..4f1c51bd307243573f13f2277c56e4083226c08c 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 67e180ed0c76160676bff86d0cd124299c2de5c4..5fcd5cee46b044817d95d7c8c99095b7f37d6b4f 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 afbc0e71de23496ede1b6db67f42631c493d017b..b7148beb0cf17d0cb73fd60c570c2df5ad9aff0b 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 4b984d7cd69a9aa88eae57ef99d32c67b60bb9fe..c2cf0c7fee54a0535a052261ee069e5bb5bb786a 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 cec973ab7386cb5fb611c360b6f4152ee026359b..0000000000000000000000000000000000000000 --- 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 5509ea8530b8a80b009d79fd8db29de334ef8fa4..0000000000000000000000000000000000000000 --- 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